From 03c8d46ed26a7a67c4f97efa22e5bc50542af493 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sun, 19 Mar 2023 06:48:49 -0700 Subject: [PATCH 01/29] Slowly Cleanup (#1213) * Add slowly.h * Init and destroy * File header --- include/functions.h | 5 +--- include/slowly.h | 31 ++++++++++++++++++++ include/z64.h | 19 ------------ src/code/PreRender.c | 9 +++--- src/code/sys_slowly.c | 53 ++++++++++++++++++++++------------ tools/disasm/functions.txt | 4 +-- tools/disasm/variables.txt | 2 +- tools/sizes/code_functions.csv | 4 +-- 8 files changed, 76 insertions(+), 51 deletions(-) create mode 100644 include/slowly.h diff --git a/include/functions.h b/include/functions.h index e5f0ccca6..fca5af036 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2684,10 +2684,7 @@ void func_8018450C(PlayState* play, SkeletonInfo* skeleton, Mtx* mtx, OverrideKe // void func_801850A0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // void func_801853C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_80185460(void); -//void Slowly_Main(SlowlyTask* slowly); -//void Slowly_ThreadEntry(SlowlyTask* slowly); -void Slowly_Start(SlowlyTask* slowly, void* stack, void (*callback)(), void* callbackArg0, void* callbackArg1); -void Slowly_Stop(SlowlyTask* slowly); + // void func_801857C0(void); // char* func_801857D0(void); // void func_80185864(void); diff --git a/include/slowly.h b/include/slowly.h new file mode 100644 index 000000000..b91d652d9 --- /dev/null +++ b/include/slowly.h @@ -0,0 +1,31 @@ +#ifndef SLOWLY_H +#define SLOWLY_H + +#include "ultra64.h" + +#define SLOWLY_STATUS_DONE (1 << 0) +#define SLOWLY_STATUS_STARTED (1 << 1) + +typedef void (*SlowlyCallbackZero)(void); +typedef void (*SlowlyCallbackOne)(void*); +typedef void (*SlowlyCallbackTwo)(void*, void*); + +typedef union { + SlowlyCallbackZero zero; + SlowlyCallbackOne one; + SlowlyCallbackTwo two; +} SlowlyCallback; // size = 0x4 + +typedef struct { + /* 0x000 */ OSThread thread; + /* 0x1B0 */ u8 argCount; + /* 0x1B1 */ u8 status; + /* 0x1B4 */ SlowlyCallback callback; + /* 0x1B8 */ void* arg0; + /* 0x1BC */ void* arg1; +} SlowlyMgr; // size = 0x1C0 + +void Slowly_Init(SlowlyMgr* slowly, void* stack, SlowlyCallbackTwo callback, void* arg0, void* arg1); +void Slowly_Destroy(SlowlyMgr* slowly); + +#endif diff --git a/include/z64.h b/include/z64.h index 17271501f..cd9dc71cf 100644 --- a/include/z64.h +++ b/include/z64.h @@ -219,25 +219,6 @@ typedef struct { /* 0x10 */ OSTime resetTime; } NmiBuff; // size >= 0x18 -typedef enum { - SLOWLY_CALLBACK_NO_ARGS, - SLOWLY_CALLBACK_ONE_ARG, - SLOWLY_CALLBACK_TWO_ARGS -} SlowlyCallbackArgCount; - -typedef struct { - /* 0x000 */ OSThread thread; - /* 0x1B0 */ u8 callbackArgCount; - /* 0x1B1 */ u8 status; - /* 0x1B4 */ union { - void (*callback0)(void); - void (*callback1)(void*); - void (*callback2)(void*, void*); - }; - /* 0x1B8 */ void* callbackArg0; - /* 0x1BC */ void* callbackArg1; -} SlowlyTask; // size = 0x1C0 - typedef struct { /* 0x00 */ int unk0; /* 0x04 */ void* unk4; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 247325251..16ae999c5 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -1,4 +1,5 @@ #include "global.h" +#include "slowly.h" #include "stack.h" /** @@ -411,7 +412,7 @@ void PreRender_ApplyFilters(PreRender* this) { } } -extern SlowlyTask D_801F6E00; +extern SlowlyMgr sSlowlyMgr; extern s32 D_801F6FC0; extern StackEntry sSlowlyStackInfo; extern STACK(sSlowlyStack, 0x1000); @@ -423,12 +424,12 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this) { if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) { if (D_801F6FC0) { StackCheck_Cleanup(&sSlowlyStackInfo); - Slowly_Stop(&D_801F6E00); + Slowly_Destroy(&sSlowlyMgr); } this->unk_4D = 1; StackCheck_Init(&sSlowlyStackInfo, sSlowlyStack, STACK_TOP(sSlowlyStack), 0, 0x100, "slowly"); - Slowly_Start(&D_801F6E00, STACK_TOP(sSlowlyStack), PreRender_ApplyFilters, this, NULL); + Slowly_Init(&sSlowlyMgr, STACK_TOP(sSlowlyStack), (void*)PreRender_ApplyFilters, this, NULL); D_801F6FC0 = true; } } @@ -439,7 +440,7 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this) { void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this) { if (D_801F6FC0) { StackCheck_Cleanup(&sSlowlyStackInfo); - Slowly_Stop(&D_801F6E00); + Slowly_Destroy(&sSlowlyMgr); D_801F6FC0 = false; } } diff --git a/src/code/sys_slowly.c b/src/code/sys_slowly.c index 415d5f297..29ac0db78 100644 --- a/src/code/sys_slowly.c +++ b/src/code/sys_slowly.c @@ -1,43 +1,58 @@ +/** + * @file sys_slowly.c + * + * This file implements a manager for running an asynchronous task on a thread with the lowest priority. + * + * The task callback is expected to have up to 2 void* arguments and have a void return. Setting `argCount` will adjust + * how many args the callback gets called with, but defaults to 2 and using the 2 argument callback. + * + * @note: `argCount` must be set manually, as this file implements no way to configure it. + */ +#include "slowly.h" #include "global.h" -#define SLOWLY_STATUS_DONE (1 << 0) -#define SLOWLY_STATUS_STARTED (1 << 1) - -void Slowly_Main(SlowlyTask* slowly) { +void Slowly_Main(SlowlyMgr* slowly) { slowly->status |= SLOWLY_STATUS_STARTED; - switch (slowly->callbackArgCount) { - case SLOWLY_CALLBACK_NO_ARGS: - slowly->callback0(); + switch (slowly->argCount) { + case 0: + slowly->callback.zero(); break; - case SLOWLY_CALLBACK_ONE_ARG: - slowly->callback1(slowly->callbackArg0); + + case 1: + slowly->callback.one(slowly->arg0); break; - case SLOWLY_CALLBACK_TWO_ARGS: - slowly->callback2(slowly->callbackArg0, slowly->callbackArg1); + + case 2: + slowly->callback.two(slowly->arg0, slowly->arg1); + break; + + default: break; } slowly->status |= SLOWLY_STATUS_DONE; } -void Slowly_ThreadEntry(SlowlyTask* slowly) { +void Slowly_ThreadEntry(void* arg) { + SlowlyMgr* slowly = (SlowlyMgr*)arg; + Slowly_Main(slowly); } -void Slowly_Start(SlowlyTask* slowly, void* stack, void (*callback)(), void* callbackArg0, void* callbackArg1) { - bzero(slowly, sizeof(SlowlyTask)); +void Slowly_Init(SlowlyMgr* slowly, void* stack, SlowlyCallbackTwo callback, void* arg0, void* arg1) { + bzero(slowly, sizeof(SlowlyMgr)); - slowly->callbackArgCount = SLOWLY_CALLBACK_TWO_ARGS; + slowly->argCount = 2; slowly->status = 0; - slowly->callback0 = callback; - slowly->callbackArg0 = callbackArg0; - slowly->callbackArg1 = callbackArg1; + slowly->callback.two = callback; + slowly->arg0 = arg0; + slowly->arg1 = arg1; osCreateThread(&slowly->thread, Z_THREAD_ID_SLOWLY, Slowly_ThreadEntry, slowly, stack, Z_PRIORITY_SLOWLY); osStartThread(&slowly->thread); } -void Slowly_Stop(SlowlyTask* slowly) { +void Slowly_Destroy(SlowlyMgr* slowly) { osDestroyThread(&slowly->thread); } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 235debbb5..ae62d6f36 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -3445,8 +3445,8 @@ 0x80185460:("func_80185460",), 0x80185660:("Slowly_Main",), 0x801856FC:("Slowly_ThreadEntry",), - 0x8018571C:("Slowly_Start",), - 0x801857A0:("Slowly_Stop",), + 0x8018571C:("Slowly_Init",), + 0x801857A0:("Slowly_Destroy",), 0x801857C0:("func_801857C0",), 0x801857D0:("func_801857D0",), 0x80185864:("func_80185864",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index c78f0a3a8..de6991bd5 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4061,7 +4061,7 @@ 0x801F6D50:("sBombersNotebook","UNK_TYPE1","",0x1), 0x801F6DFC:("sBombersNotebookOpen","u8","",0x1), 0x801F6DFD:("sMotionBlurStatus","UNK_TYPE1","",0x1), - 0x801F6E00:("D_801F6E00","SlowlyTask","",0x1c0), + 0x801F6E00:("sSlowlyMgr","SlowlyMgr","",0x1c0), 0x801F6FC0:("D_801F6FC0","UNK_TYPE1","",0x1), 0x801F6FC8:("sSlowlyStackInfo","StackEntry","",0x1c), 0x801F6FE8:("sSlowlyStack","u8","[4096]",0x1000), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 0f8f70b8a..3dd0ba708 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2959,8 +2959,8 @@ asm/non_matchings/code/c_keyframe/func_801853C8.s,func_801853C8,0x801853C8,0x26 asm/non_matchings/code/c_keyframe/func_80185460.s,func_80185460,0x80185460,0x80 asm/non_matchings/code/sys_slowly/Slowly_Main.s,Slowly_Main,0x80185660,0x27 asm/non_matchings/code/sys_slowly/Slowly_ThreadEntry.s,Slowly_ThreadEntry,0x801856FC,0x8 -asm/non_matchings/code/sys_slowly/Slowly_Start.s,Slowly_Start,0x8018571C,0x21 -asm/non_matchings/code/sys_slowly/Slowly_Stop.s,Slowly_Stop,0x801857A0,0x8 +asm/non_matchings/code/sys_slowly/Slowly_Init.s,Slowly_Init,0x8018571C,0x21 +asm/non_matchings/code/sys_slowly/Slowly_Destroy.s,Slowly_Destroy,0x801857A0,0x8 asm/non_matchings/code/sys_flashrom/func_801857C0.s,func_801857C0,0x801857C0,0x4 asm/non_matchings/code/sys_flashrom/func_801857D0.s,func_801857D0,0x801857D0,0x25 asm/non_matchings/code/sys_flashrom/func_80185864.s,func_80185864,0x80185864,0x29 From 6d1bc6e34b9a1bf17e90c677379fa5c27d2fec4b Mon Sep 17 00:00:00 2001 From: EllipticEllipsis Date: Tue, 21 Mar 2023 13:28:24 +0000 Subject: [PATCH 02/29] Ignore other rom extensions (#1218) --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index aa3f65077..ee2d1e325 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ tags # Project-specific ignores *.z64 +*.n64 +*.v64 *.sra *.bin *.elf From 9bb978527f619abbedbc5119fa2811385b29c01e Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Tue, 21 Mar 2023 07:12:22 -0700 Subject: [PATCH 03/29] Misc Cleanup 14 (#1214) * bgId * z64scene.h whitespace * SubS_ComputeTrackPointRot casts * Macros cleanup * ifs * Empty Loops * Lights_FindBufSlot void * SkelAnime_GetFrameData * }; * Struct inits * fs * @todo * Bug comments * EnPofusen and ObjUm * Trailing comma * Revert "bgId" This reverts commit eea073c5ac30fd41f50436eeade43a811d0f0981. * Revert "z64scene.h whitespace" This reverts commit 399fd57550b7536b357ab6283360042f2e3e1467. * Revert "SubS_ComputeTrackPointRot casts" This reverts commit dea896c8743475508a3c7391e9d19cdb6b63f6a7. * FAKE * Review * Format --- include/functions.h | 2 +- include/macros.h | 13 +++--- include/z64math.h | 12 +++-- include/z64message.h | 2 +- include/z64save.h | 9 ++-- include/z64subs.h | 2 +- src/code/z_collision_check.c | 4 +- src/code/z_skelanime.c | 5 +- src/code/z_snap.c | 5 +- src/libultra/io/contreaddata.c | 2 +- src/libultra/io/sptask.c | 3 +- src/libultra/os/initialize.c | 13 ++---- src/libultra/os/settimer.c | 6 +-- src/libultra/os/timerintr.c | 7 ++- src/libultra/voice/voicegetstatus.c | 4 +- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.c | 2 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 3 +- src/overlays/actors/ovl_En_Dai/z_en_dai.c | 9 ++-- src/overlays/actors/ovl_En_Daiku/z_en_daiku.h | 4 +- .../actors/ovl_En_Daiku2/z_en_daiku2.h | 6 +-- .../actors/ovl_En_Dekunuts/z_en_dekunuts.h | 10 ++-- src/overlays/actors/ovl_En_Dnb/z_en_dnb.c | 4 +- src/overlays/actors/ovl_En_Dno/z_en_dno.c | 4 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 4 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 2 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 2 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 2 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 3 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 46 +++++-------------- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 15 +++--- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 2 +- .../actors/ovl_En_Po_Fusen/z_en_po_fusen.c | 13 +++--- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 2 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 4 +- src/overlays/actors/ovl_En_Zos/z_en_zos.c | 4 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 5 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 4 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 2 +- 38 files changed, 117 insertions(+), 124 deletions(-) diff --git a/include/functions.h b/include/functions.h index fca5af036..223d4badb 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1476,7 +1476,7 @@ void Lights_BindPointWithReference(Lights* lights, LightParams* params, Vec3f* p void Lights_BindPoint(Lights* lights, LightParams* params, PlayState* play); void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused); void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayState* play); -LightNode* Lights_FindBufSlot(); +LightNode* Lights_FindBufSlot(void); void Lights_FreeNode(LightNode* light); void LightContext_Init(PlayState* play, LightContext* lightCtx); void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b); diff --git a/include/macros.h b/include/macros.h index a4923ac06..d572e9ccf 100644 --- a/include/macros.h +++ b/include/macros.h @@ -146,12 +146,13 @@ extern GraphicsContext* __gfxCtx; #define ROUND(x) (s32)(((x) >= 0.0) ? ((x) + 0.5) : ((x) - 0.5)) -#define SWAP(type, a, b) \ - { \ - type _temp = (a); \ - (a) = (b); \ - (b) = _temp; \ - } +#define SWAP(type, a, b) \ + { \ + type _temp = (a); \ + (a) = (b); \ + (b) = _temp; \ + } \ + (void)0 #define OVERLAY_RELOCATION_OFFSET(overlayEntry) ((uintptr_t)((overlayEntry)->vramStart) - (uintptr_t)((overlayEntry)->loadedRamAddr)) #define VRAM_PTR_SIZE(entry) ((uintptr_t)((entry)->vramEnd) - (uintptr_t)((entry)->vramStart)) diff --git a/include/z64math.h b/include/z64math.h index 70a115966..62b6432e8 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -104,11 +104,13 @@ typedef struct { #define LERPWEIGHT(val, prev, next) (((val) - (prev)) / ((next) - (prev))) #define F32_LERPWEIGHT(val, prev, next) (((f32)(val) - (f32)(prev)) / ((f32)(next) - (f32)(prev))) -#define VEC3F_LERPIMPDST(dst, v0, v1, t){ \ - (dst)->x = (v0)->x + (((v1)->x - (v0)->x) * t); \ - (dst)->y = (v0)->y + (((v1)->y - (v0)->y) * t); \ - (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ -} +#define VEC3F_LERPIMPDST(dst, v0, v1, t) \ + { \ + (dst)->x = (v0)->x + (((v1)->x - (v0)->x) * t); \ + (dst)->y = (v0)->y + (((v1)->y - (v0)->y) * t); \ + (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ + } \ + (void)0 #define IS_ZERO(f) (fabsf(f) < 0.008f) diff --git a/include/z64message.h b/include/z64message.h index 82c84a3f8..2b0387045 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -34,7 +34,7 @@ typedef enum TextState { #define FONT_CHAR_TEX_WIDTH 16 #define FONT_CHAR_TEX_HEIGHT 16 -//! @TODO: Make this use `sizeof(AnyFontTextureSymbol)` +//! TODO: Make this use `sizeof(AnyFontTextureSymbol)` #define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture // TODO: should Font be in its own header or is it fine to have it here? diff --git a/include/z64save.h b/include/z64save.h index d34b5f0d9..0037c5aa5 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -1450,9 +1450,12 @@ typedef enum SunsSongState { #define GET_WEEKEVENTREG_RACE_FLAGS (WEEKEVENTREG(92) & WEEKEVENTREG_RACE_FLAGS) -#define SET_WEEKEVENTREG_RACE_FLAGS(flag) \ - WEEKEVENTREG(92) &= (u8)~WEEKEVENTREG_RACE_FLAGS; \ - WEEKEVENTREG(92) = WEEKEVENTREG(92) | (u8)((WEEKEVENTREG(92) & ~WEEKEVENTREG_RACE_FLAGS) | (flag)) +#define SET_WEEKEVENTREG_RACE_FLAGS(flag) \ + { \ + WEEKEVENTREG(92) &= (u8)~WEEKEVENTREG_RACE_FLAGS; \ + WEEKEVENTREG(92) = WEEKEVENTREG(92) | (u8)((WEEKEVENTREG(92) & ~WEEKEVENTREG_RACE_FLAGS) | (flag)); \ + } \ + (void)0 /** * gSaveContext.eventInf diff --git a/include/z64subs.h b/include/z64subs.h index ca90cb232..cc0e7ba2f 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -16,7 +16,7 @@ typedef enum { /* 2 */ SUBS_CUTSCENE_SET_FLAG } SubSCutsceneType; -//! @TODO: rename based on func_8013E748 and func_800B8500 +//! TODO: rename based on func_8013E748 and func_800B8500 typedef s32 (*func_8013E748_VerifyFunc)(struct PlayState*, Actor*, void*); typedef s32 (*VerifyActor)(struct PlayState*, Actor*, Actor*, void*); diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 0e36f1c54..6ecbd617a 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -3837,7 +3837,7 @@ void CollisionCheck_SpawnShieldParticles(PlayState* play, Vec3f* v) { 35.0f, 30.0f, 8, - { 0, 0, 0, 0, 128, 255, 0, 300 }, + { 0, 0, 0, { 0, 128, 255 }, 0, 300 }, 1, }; s32 effectIndex; @@ -3892,7 +3892,7 @@ void CollisionCheck_SpawnShieldParticlesWood(PlayState* play, Vec3f* v, Vec3f* p 35.0f, 30.0f, 8, - { 0, 0, 0, 0, 128, 255, 0, 300 }, + { 0, 0, 0, { 0, 128, 255 }, 0, 300 }, 0, }; s32 effectIndex; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 13ce84ec4..9890f4741 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -630,7 +630,8 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount frameTable->x = jointIndices->x >= staticIndexMax ? dynamicData[jointIndices->x] : frameData[jointIndices->x]; frameTable->y = jointIndices->y >= staticIndexMax ? dynamicData[jointIndices->y] : frameData[jointIndices->y]; frameTable->z = jointIndices->z >= staticIndexMax ? dynamicData[jointIndices->z] : frameData[jointIndices->z]; - jointIndices++, frameTable++; + jointIndices++; + frameTable++; } } @@ -1577,7 +1578,7 @@ void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHead skelAnime->morphTable = ZeldaArena_Malloc(sizeof(*skelAnime->morphTable) * skelAnime->limbCount); // Debug prints here, required to match. - if (1) {}; + if (1) {} if (animation != NULL) { Animation_PlayLoop(skelAnime, animation); diff --git a/src/code/z_snap.c b/src/code/z_snap.c index d64cfbe6e..e9663b02f 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -42,9 +42,8 @@ s32 Snap_RecordPictographedActors(PlayState* play) { break; } - if (actor->id) { - ; // Needed to match - } + //! FAKE: + if (1) {} // Actors which may be pictographed anywhere switch (actor->id) { diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index 163756e07..061c01b0a 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -34,7 +34,7 @@ void osContGetReadData(OSContPad* data) { data->stick_x = readformat.stick_x; data->stick_y = readformat.stick_y; } - }; + } } void __osPackReadData() { diff --git a/src/libultra/io/sptask.c b/src/libultra/io/sptask.c index aeaaf0f82..8445f53b0 100644 --- a/src/libultra/io/sptask.c +++ b/src/libultra/io/sptask.c @@ -3,7 +3,8 @@ #define _osVirtualToPhysical(ptr) \ if (ptr != NULL) { \ ptr = (void*)osVirtualToPhysical(ptr); \ - } + } \ + (void)0 static OSTask sTmpTask; diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 9fbf5ff64..776191227 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -39,12 +39,9 @@ void osInitialize(void) { __osSetFpcCsr(0x01000800); __osSetWatchLo(0x04900000); - while (__osSiRawReadIo(0x1FC007FC, &pifdata)) { - ; - } - while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) { - ; - } + while (__osSiRawReadIo(0x1FC007FC, &pifdata)) {} + + while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) {} *(struct_exceptionPreamble*)0x80000000 = *((struct_exceptionPreamble*)__osExceptionPreamble); *(struct_exceptionPreamble*)0x80000080 = *((struct_exceptionPreamble*)__osExceptionPreamble); @@ -72,9 +69,7 @@ void osInitialize(void) { } if (__osGetCause() & 0x1000) { - while (1) { - ; - } + while (true) {} } HW_REG(AI_CONTROL_REG, u32) = 1; diff --git a/src/libultra/os/settimer.c b/src/libultra/os/settimer.c index c6de3c3e4..77f568a02 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -21,9 +21,9 @@ int osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMes saveMask = __osDisableInt(); if (__osTimerList->next != __osTimerList) { - if (0) { - ; - } + //! FAKE: + if (1) {} + spC = __osTimerList->next; sp14 = osGetCount(); sp10 = sp14 - __osTimerCounter; diff --git a/src/libultra/os/timerintr.c b/src/libultra/os/timerintr.c index 87f7129df..6b112e952 100644 --- a/src/libultra/os/timerintr.c +++ b/src/libultra/os/timerintr.c @@ -29,7 +29,7 @@ void __osTimerInterrupt(void) { if (__osTimerList->next == __osTimerList) { return; } - while (1) { + while (true) { t = __osTimerList->next; if (t == __osTimerList) { __osSetCompare(0); @@ -84,9 +84,8 @@ OSTime __osInsertTimer(OSTimer* t) { savedMask = __osDisableInt(); for (timep = __osTimerList->next, tim = t->value; timep != __osTimerList && tim > timep->value; - tim -= timep->value, timep = timep->next) { - ; - } + tim -= timep->value, timep = timep->next) {} + t->value = tim; if (timep != __osTimerList) { timep->value -= tim; diff --git a/src/libultra/voice/voicegetstatus.c b/src/libultra/voice/voicegetstatus.c index d8e7edb67..a3608277f 100644 --- a/src/libultra/voice/voicegetstatus.c +++ b/src/libultra/voice/voicegetstatus.c @@ -14,9 +14,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) { if (ret != CONT_ERR_CONTRFAIL) { __osContPifRam.status = CONT_CMD_READ_BUTTON; - for (i = 0; i < port; i++, *ptr++ = 0) { - ; - } + for (i = 0; i < port; i++, *ptr++ = 0) {} *ptr++ = 1; *ptr++ = 3; diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index 6ec0ed86b..a1c4f1d27 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -56,7 +56,7 @@ void BgTobira01_Open(BgTobira01* this, PlayState* play) { this->timer++; } else { this->timer--; - }; + } this->timer = CLAMP(this->timer, 0, 60); diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index c1303efab..f499b7e20 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -444,7 +444,8 @@ void DemoKankyo_Init(Actor* thisx, PlayState* play) { for (i = 0; i < ARRAY_COUNT(this->effects); i++) { this->effects[i].state = DEMO_KANKYO_STATE_INIT; } // clang-format on - if (1) {}; + //! FAKE: + if (1) {} switch (this->actor.params) { case DEMO_KANKYO_TYPE_LOSTWOODS: diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 4e4285b52..fbd829212 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -351,8 +351,8 @@ s32 func_80B3EC84(EnDai* this) { }; static Vec3f D_80B3FD7C[] = { - { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8, 0.8 }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, - { 1.0f, 0.8, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8, 0.9f }, { 1.0f, 1.0f, 1.0f }, + { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.8f, 0.8f }, { 1.0f, 1.1f, 1.1f }, { 1.0f, 1.3f, 1.3f }, { 1.0f, 0.7f, 0.9f }, + { 1.0f, 0.8f, 0.9f }, { 1.0f, 0.7f, 0.9f }, { 1.0f, 0.8f, 0.9f }, { 1.0f, 1.0f, 1.0f }, }; s32 i; @@ -379,7 +379,10 @@ s32 func_80B3ED88(EnDai* this) { static s16 D_80B3FE00[] = { 1, 2, 3 }; static Vec3f D_80B3FE08[] = { - 1.0f, 1.0f, 1.0f, 1.0f, 1.2f, 1.2f, 1.0f, 0.7f, 0.8f, 1.0f, 1.0f, 1.0f, + { 1.0f, 1.0f, 1.0f }, + { 1.0f, 1.2f, 1.2f }, + { 1.0f, 0.7f, 0.8f }, + { 1.0f, 1.0f, 1.0f }, }; s32 i; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index fa161e9fd..4a3c9b444 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -7,8 +7,8 @@ struct EnDaiku; typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); -#define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF); -#define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); +#define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) enum { /* 0x0 */ ENDAIKU_PARAMS_FF_0, diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index f13b89611..130a06a23 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -7,9 +7,9 @@ struct EnDaiku2; typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, PlayState*); -#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F); -#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F); -#define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1); +#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F) +#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F) +#define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1) enum { /* -1 */ ENDAIKU2_GET_7F_MINUS1 = -1, diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index c6672b06e..59b6677a0 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -8,13 +8,13 @@ struct EnDekunuts; typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, PlayState*); -#define ENDEKUNUTS_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF); +#define ENDEKUNUTS_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) enum { - /* 0x0 */ ENDEKUNUTS_GET_FF00_0, - /* 0x1 */ ENDEKUNUTS_GET_FF00_1, - /* 0x2 */ ENDEKUNUTS_GET_FF00_2, - /* 0xFF*/ ENDEKUNUTS_GET_FF00_FF = 0xFF, + /* 0x00 */ ENDEKUNUTS_GET_FF00_0, + /* 0x01 */ ENDEKUNUTS_GET_FF00_1, + /* 0x02 */ ENDEKUNUTS_GET_FF00_2, + /* 0xFF */ ENDEKUNUTS_GET_FF00_FF = 0xFF }; typedef struct EnDekunuts { diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index e96785133..7a8bc5ddb 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -275,7 +275,9 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) { } Matrix_Push(); - if (1) {}; + //! FAKE: + if (1) {} + arg0->unk_24 = (arg0->unk_01 / (f32)arg0->unk_02) * 255.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)arg0->unk_24); diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 2a60cec76..aad29992a 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -945,7 +945,9 @@ void func_80A73408(EnDno* this, PlayState* play) { if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->animIndex == EN_DNO_ANIM_SHOCK_START)) { - if (0) {}; + //! FAKE: + if (1) {} + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_SHOCK_LOOP, &this->animIndex); } } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index d7fa75636..11240f27b 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -154,6 +154,7 @@ s32 func_80B3CA20(EnDnp* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_GREET2); } } else if ((this->animIndex == EN_DNP_ANIM_UNUSED_WALK) && (this->animIndex == EN_DNP_ANIM_WALK)) { + //! @bug: Impossible to reach, && should be an || if (Animation_OnFrame(&this->skelAnime, 7.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKUHIME_WALK); } @@ -217,7 +218,8 @@ s32 func_80B3CDA4(EnDnp* this, PlayState* play) { pitch = Math_Vec3f_Pitch(&sp3C, &sp30); //! FAKE - if (1) {}; + if (1) {} + Math_SmoothStepToS(&this->unk_330, pitch, 3, 0x2AA8, 0x1); return 1; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index c93c8e005..33a819b20 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -113,7 +113,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) { this->dyna.actor.targetMode = 6; this->dyna.actor.colChkInfo.health = 1; - this->scale = 0.1; + this->scale = 0.1f; this->switchFlag = ENCOUNT2_GET_SWITCH_FLAG(&this->dyna.actor); if (this->switchFlag == 0x7F) { diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 65df46284..28267a485 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -159,8 +159,8 @@ void EnGirlA_SetupAction(EnGirlA* this, EnGirlAActionFunc action) { void EnGirlA_InitObjIndex(EnGirlA* this, PlayState* play) { s16 params = this->actor.params; - //! @bug: Condition is impossible, && should be an || if ((params >= SI_MAX) && (params < SI_POTION_RED_1)) { + //! @bug: Impossible to reach, && should be an || Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 74d4af13d..35770e38c 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -934,7 +934,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { func_80169EFC(&play->state); //! FAKE - if (0) {} + if (1) {} if (gSaveContext.save.time > CLOCK_TIME(18, 0) || gSaveContext.save.time < CLOCK_TIME(6, 0)) { gSaveContext.save.time = CLOCK_TIME(6, 0); diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index ca26d5c95..efce38ad8 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -193,7 +193,8 @@ void func_80B2654C(EnKendoJs* this, PlayState* play) { } else if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (Player_GetMask(play) < PLAYER_MASK_GIANT)) { u16 sp2E = Player_GetMask(play) + 0x273C; - if (0) {} + //! FAKE: + if (1) {} Message_StartTextbox(play, sp2E, &this->actor); this->unk_288 = sp2E; diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 392452c62..274ddbc49 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -86,41 +86,20 @@ static ColliderCylinderInit sCylinderInit = { { 15, 25, 4, { 0, 0, 0 } }, }; -static Vec3f D_808934C4 = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static InitChainEntry sInitChain[] = { - ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), - ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), -}; - -static Vec3f D_808934DC = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static Vec3f D_808934E8 = { - 90000.0f, - 90000.0f, - 90000.0f, -}; - -static s32 pad = 0; - void EnNiw_Init(Actor* thisx, PlayState* play) { + static InitChainEntry sInitChain[] = { + ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE), + ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), + ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP), + }; EnNiw* this = THIS; - Vec3f dTemp = D_808934C4; + Vec3f D_808934C4 = { 90000.0f, 90000.0f, 90000.0f }; if (this->actor.params < 0) { // all scene spawned cucco are (-1) this->actor.params = NIW_TYPE_REGULAR; } - Math_Vec3f_Copy(&this->unk2BC, &dTemp); + Math_Vec3f_Copy(&this->unk2BC, &D_808934C4); this->niwType = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -138,9 +117,6 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (this->niwType == NIW_TYPE_UNK1) { - // @Bug this unused variant is broken and crashes on spawn (EnNiw_Update expects a parent, NULL) - // if modified to change niwType to TYPE_REGULAR here, new size is smaller than normal - // theory: was meant to be a small hand held cucco for grog to show the player Actor_SetScale(&this->actor, (BREG(86) / 10000.0f) + 0.004f); } @@ -450,7 +426,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { } void EnNiw_Held(EnNiw* this, PlayState* play) { - Vec3f vec3fcopy = D_808934DC; + Vec3f D_808934DC = { 90000.0f, 90000.0f, 90000.0f }; s16 rotZ; if (this->heldTimer == 0) { @@ -483,7 +459,7 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { this->actor.shape.rot.y = rotZ; this->actor.shape.rot.x = rotZ; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Math_Vec3f_Copy(&this->unk2BC, &vec3fcopy); + Math_Vec3f_Copy(&this->unk2BC, &D_808934DC); this->actor.flags |= ACTOR_FLAG_1; // targetable ON this->actionFunc = EnNiw_Thrown; } @@ -666,7 +642,7 @@ void EnNiw_SetupRunAway(EnNiw* this) { void EnNiw_RunAway(EnNiw* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f tempVec3f = D_808934E8; + Vec3f D_808934E8 = { 90000.0f, 90000.0f, 90000.0f }; s16 temp298; f32 dX; f32 dZ; @@ -682,7 +658,7 @@ void EnNiw_RunAway(EnNiw* this, PlayState* play) { this->targetLimbRots[6] = 0; this->targetLimbRots[5] = 0; this->targetLimbRots[7] = 0; - Math_Vec3f_Copy(&this->unk2BC, &tempVec3f); + Math_Vec3f_Copy(&this->unk2BC, &D_808934E8); EnNiw_SetupIdle(this); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index c1cec3b88..c60397535 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -79,7 +79,7 @@ typedef struct EnNiw { /* 0x2E8 */ s16 yawTowardsPlayer; /* 0x2EA */ s16 headRotationToggle; /* 0x2EC */ s16 unk2EC; - /* 0x2EE */ UNK_TYPE1 pad2EE[0x6]; + /* 0x2EE */ UNK_TYPE1 pad2EE[0x6]; /* 0x2F4 */ f32 unusedFloat2F4; // set in EnNiw_Update if Cucco falls off map, never read /* 0x2F8 */ f32 unusedFloat2F8; /* 0x2FC */ f32 unusedFloat2FC; @@ -91,12 +91,13 @@ typedef struct EnNiw { /* 0x35C */ EnNiwFeather feathers[NIW_FEATHER_COUNT]; } EnNiw; // size = 0x7BC -// in init, any value below zero becomes zero -// however, in vanilla, only 0xFFFF (-1) exists in scene spawns, actors can spawn 0x0 -#define NIW_TYPE_VANILLA 0xFFFF -#define NIW_TYPE_REGULAR 0 -#define NIW_TYPE_UNK1 1 -#define NIW_TYPE_HELD 2 // spawns held by the bomber kid in east clock town during hide and seek +typedef enum { + /* -1 */ NIW_TYPE_VANILLA = -1, // Will be converted to 0, in vanilla exists only in scene spawns + /* 0 */ NIW_TYPE_REGULAR, + /* 1 */ NIW_TYPE_UNK1, // This unused variant must be spawned as a child, as it expects a NON-NULL parent. + // Theory: This was meant to be a small hand held cucco for Grog to show the player + /* 2 */ NIW_TYPE_HELD // spawns held by the bomber kid in east clock town during hide and seek +} NiwType; // the attacking cuccos are not here, they are a different actor: [ ovl_En_Attack_Niw ] typedef enum { diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index ac1c3cb8c..c26a1a2c7 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -265,8 +265,8 @@ void EnOssan_Init(Actor* thisx, PlayState* play) { EnOssan* this = THIS; s16 id; - //! @bug Condition is impossible, params cannot be both greater then 1 AND less then 0. if ((this->actor.params > ENOSSAN_PART_TIME_WORKER) && (this->actor.params < ENOSSAN_CURIOSITY_SHOP_MAN)) { + //! @bug: Impossible to reach, && should be an || Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index 809c738a4..145c0507d 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -16,7 +16,7 @@ void EnPoFusen_Destroy(Actor* thisx, PlayState* play); void EnPoFusen_Update(Actor* thisx, PlayState* play); void EnPoFusen_Draw(Actor* thisx, PlayState* play); -u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play); +s32 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play); void EnPoFusen_InitNoFuse(EnPoFusen* this); void EnPoFusen_InitFuse(EnPoFusen* this); void EnPoFusen_Pop(EnPoFusen* this, PlayState* play); @@ -146,9 +146,9 @@ void EnPoFusen_Destroy(Actor* thisx, PlayState* play) { } /** - * Search for Romani's actor, beacuse it's PoFusen's job to update her actor on pop. + * Search for Romani's actor, beacuse it's PoFusen's job to update her actor when the balloon is popped. */ -u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { +s32 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { Actor* actorIter = play->actorCtx.actorLists[ACTORCAT_NPC].first; if (POE_BALLOON_IS_FUSE_TYPE(&this->actor)) { @@ -166,7 +166,7 @@ u16 EnPoFusen_CheckParent(EnPoFusen* this, PlayState* play) { return false; } -u16 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { +s32 EnPoFusen_CheckCollision(EnPoFusen* this, PlayState* play) { if (this->actionFunc == EnPoFusen_IdleFuse) { return false; } @@ -195,7 +195,6 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { f32 shadowScaleTmp; f32 shadowAlphaTmp; f32 heightOffset; - f32 f255 = 255.0f; this->actor.world.pos = this->actor.home.pos; this->randScaleChange += 0x190; @@ -207,7 +206,7 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { this->actor.world.pos.y += heightOffset; this->actor.shape.rot.z = (Math_SinS(this->randBaseRotChange) * 910.0f); - if ((this->randScaleChange < 0x4000) && (this->randScaleChange >= -0x3FFF)) { + if ((this->randScaleChange < 0x4000) && (this->randScaleChange > -0x4000)) { Math_SmoothStepToS(&this->limbRotChainAndLantern, 0x38E, 0x14, 0xBB8, 0x64); } else { Math_SmoothStepToS(&this->limbRotChainAndLantern, 0x71C, 0x8, 0xBB8, 0x64); @@ -222,7 +221,7 @@ void EnPoFusen_Idle(EnPoFusen* this, PlayState* play) { shadowScaleTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 10.0f) + 50.0f; shadowAlphaTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 75.0f) + 100.0f; this->actor.shape.shadowScale = shadowScaleTmp; - this->actor.shape.shadowAlpha = (shadowAlphaTmp > f255) ? (u8)f255 : (u8)shadowAlphaTmp; + this->actor.shape.shadowAlpha = CLAMP_MAX(shadowAlphaTmp, 255.0f); } void EnPoFusen_IncrementRomaniPop(EnPoFusen* this) { diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 0fa09cf1c..54ed5babc 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -251,7 +251,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { return; } - //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro + //! TODO: Neither 0xED02 nor 0xED01 match CLOCK_TIME macro if (((play->sceneId == SCENE_MILK_BAR) && !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < 0xED02))) || ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 742ea8846..530b75b0e 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -86,7 +86,9 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966E0C); break; case WEATHERTAG_TYPE_UNK3: - if (0) {} // this can move to diff locations and still match + //! FAKE: this can move to different locations and still match + if (1) {} + EnWeatherTag_SetupAction(this, func_80966EF0); break; case WEATHERTAG_TYPE_UNK4: diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 00f76dafe..c538457e8 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -486,7 +486,9 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { break; default: - if (0) {} + //! FAKE: + if (1) {} + Message_CloseTextbox(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 97c8bb7d9..532daec90 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -151,7 +151,10 @@ void ObjAqua_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 60.0f); - if (1) {}; + + //! FAKE: + if (1) {} + this->actor.shape.shadowAlpha = 140; this->alpha = 255; if (func_80ACBA60(this, play)) { diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 978fe7f0e..dd9f84ae0 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -150,7 +150,7 @@ void ObjChan_CalculatePotPosition(Vec3f* childPosOut, Vec3s* childRotOut, Vec3f* childRotOut->y += childAngle; } -//! @TODO: Possibly takes actor and recasts +//! TODO: Possibly takes actor and recasts void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { ObjChan* this = this2; s32 i; @@ -210,7 +210,7 @@ void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { this->actionFunc = ObjChan_ChandelierAction; } -//! @TODO: More descriptive name than Action? +//! TODO: More descriptive name than Action? void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) { ObjChan* this = this2; ObjChan* temp; diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index af2654067..09fab57d6 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -1703,7 +1703,7 @@ void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation animIndex) { if (this->wheelRot / 0x199A != this->unk_420) { this->unk_420 = this->wheelRot / 0x199A; //! FAKE - if (!&sUmAnims[0]) {} + if (sUmAnims[0].doesMove) {} Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CART_WHEEL); } } From 2cb01b5b6a69635f7c8f554cf97442268aff28be Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 23 Mar 2023 09:36:09 +1100 Subject: [PATCH 04/29] z_room (1 non-matching) (#1143) * begin room docs and decomp * match Room_DrawImageSingle * match Room_DrawImageMulti * Room_AllocateAndLoad non-matching * big improvements on Room_DrawCullable * match Room_AllocateAndLoad * improvement? * cleanup * comments * cleanup * small pr suggestions * PR Suggestions * cleanup sceneCmds * some PR * PR Suggestions * more PR Suggestions * col to collision --- include/functions.h | 79 ++- include/regs.h | 5 + include/variables.h | 2 - include/z64.h | 2 - include/z64bgcheck.h | 5 +- include/z64scene.h | 240 +++---- spec | 1 - src/code/PreRender.c | 12 +- src/code/z_actor.c | 2 +- src/code/z_parameter.c | 7 +- src/code/z_play.c | 16 +- src/code/z_player_lib.c | 4 +- src/code/z_room.c | 589 ++++++++++++++++-- src/code/z_scene.c | 143 ++--- .../actors/ovl_Door_Shutter/z_door_shutter.c | 2 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 4 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 11 +- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 4 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 2 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 2 +- .../ovl_Obj_Flowerpot/z_obj_flowerpot.c | 4 +- tools/disasm/functions.txt | 82 +-- tools/disasm/variables.txt | 4 +- tools/namefixer.py | 5 +- tools/sizes/code_functions.csv | 82 +-- 26 files changed, 907 insertions(+), 404 deletions(-) diff --git a/include/functions.h b/include/functions.h index 223d4badb..d4ecd9579 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1888,19 +1888,14 @@ Gfx* Gfx_PrimColor(GraphicsContext* gfxCtx, s32 lodfrac, s32 r, s32 g, s32 b, s3 void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g, u8 b); void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b); void func_8012D40C(f32* param_1, f32* param_2, s16* param_3); -void Room_nop8012D510(PlayState* play, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4); -void Room_DrawType3Mesh(PlayState* play, Room* room, u32 flags); -void Room_DrawType0Mesh(PlayState* play, Room* room, u32 flags); -void Room_DrawType2Mesh(PlayState* play, Room* room, u32 flags); -void func_8012DEE8(PlayState* play, Room* room, u32 flags); -u32 func_8012E254(s32 param_1, PlayState* play); -void func_8012E32C(PlayState* play, Room* room, u32 flags); -void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags); + +void Room_Noop(PlayState* play, Room* room, Input* input, s32 arg3); void Room_Init(PlayState* play, RoomContext* roomCtx); -u32 Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx); +size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx); s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index); s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx); void Room_Draw(PlayState* play, Room* room, u32 flags); + void func_8012EBF8(PlayState* play, RoomContext* roomCtx); s32 Inventory_GetBtnBItem(PlayState* play); void Inventory_ChangeEquipment(s16 value); @@ -1919,40 +1914,40 @@ s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId); s32 Object_IsLoaded(ObjectContext* objectCtx, s32 index); void Object_LoadAll(ObjectContext* objectCtx); void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id); -void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdRoomList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdEntranceList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdPathList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdTransiActorList(PlayState* play, SceneCmd* cmd); +void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd); +void Scene_CommandActorList(PlayState* play, SceneCmd* cmd); +void Scene_CommandActorCutsceneCamList(PlayState* play, SceneCmd* cmd); +void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd); +void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd); +void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd); +void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd); +void Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd); +void Scene_CommandMesh(PlayState* play, SceneCmd* cmd); +void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd); +void Scene_CommandLightList(PlayState* play, SceneCmd* cmd); +void Scene_CommandPathList(PlayState* play, SceneCmd* cmd); +void Scene_CommandTransiActorList(PlayState* play, SceneCmd* cmd); void Door_InitContext(GameState* gameState, DoorContext* doorCtx); -void Scene_HeaderCmdEnvLightSettings(PlayState* play, SceneCmd* cmd); +void Scene_CommandEnvLightSettings(PlayState* play, SceneCmd* cmd); void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex); -void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdSkyboxDisables(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdExitList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd); -void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd); +void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd); +void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd); +void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd); +void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd); +void Scene_CommandExitList(PlayState* play, SceneCmd* cmd); +void Scene_Command09(PlayState* play, SceneCmd* cmd); +void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd); +void Scene_CommandEchoSetting(PlayState* play, SceneCmd* cmd); +void Scene_CommandAltHeaderList(PlayState* play, SceneCmd* cmd); +void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd); +void Scene_CommandActorCutsceneList(PlayState* play, SceneCmd* cmd); +void Scene_CommandMiniMap(PlayState* play, SceneCmd* cmd); +void Scene_Command1D(PlayState* play, SceneCmd* cmd); +void Scene_CommandMiniMapCompassInfo(PlayState* play, SceneCmd* cmd); +void Scene_CommandSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd); +void Scene_CommandAnimatedMaterials(PlayState* play, SceneCmd* cmd); void Scene_SetExitFade(PlayState* play); -s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header); +s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd); u16 Entrance_Create(s32 scene, s32 spawn, s32 layer); u16 Entrance_CreateFromSpawn(s32 spawn); void Scene_Draw(PlayState* play); @@ -2319,7 +2314,7 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) void func_80169EFC(GameState* thisx); void func_80169F78(GameState* thisx); void func_80169FDC(GameState* thisx); -s32 func_80169FFC(GameState* thisx); +s32 Play_CamIsNotFixed(GameState* thisx); s32 FrameAdvance_IsEnabled(GameState* thisx); s32 func_8016A02C(GameState* thisx, Actor* actor, s16* yaw); s32 Play_IsUnderwater(PlayState* this, Vec3f* pos); @@ -2367,7 +2362,7 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this); void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this); void func_801720C4(PreRender* this); void func_801720FC(PreRenderParams* params, Gfx** gfxp); -void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags); +void Prerender_DrawBackground2D(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags); void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size); void THGA_Dt(TwoHeadGfxArena* thga); u32 THGA_IsCrash(TwoHeadGfxArena* thga); diff --git a/include/regs.h b/include/regs.h index 5dee53e97..8de13fb66 100644 --- a/include/regs.h +++ b/include/regs.h @@ -63,6 +63,7 @@ extern RegEditor* gRegEditor; #define R_RUN_SPEED_LIMIT REG(45) #define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT +#define R_ROOM_IMAGE_NODRAW_FLAGS SREG(25) #define R_UPDATE_RATE SREG(30) #define R_FB_FILTER_TYPE SREG(80) #define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + c) @@ -139,6 +140,10 @@ extern RegEditor* gRegEditor; #define R_MINIMAP_DISABLED XREG(95) #define R_TRANS_FADE_FLASH_ALPHA_STEP iREG(50) // Set to a negative number to start the flash +#define R_ROOM_CULL_DEBUG_MODE iREG(86) +#define R_ROOM_CULL_NUM_ENTRIES iREG(87) +#define R_ROOM_CULL_USED_ENTRIES iREG(88) +#define R_ROOM_CULL_DEBUG_TARGET iREG(89) #define R_B_LABEL_DD WREG(0) #define R_OW_MINIMAP_X WREG(29) diff --git a/include/variables.h b/include/variables.h index b362c6a37..9ce8d04d5 100644 --- a/include/variables.h +++ b/include/variables.h @@ -592,8 +592,6 @@ extern Gfx gCullFrontDList[]; extern Gfx sSetupDL[438]; extern Gfx sFillSetupDL[12]; extern Gfx gEmptyDL[1]; -extern Vec3f D_801C1D10; -extern room_draw_func roomDrawFuncs[4]; extern u32 gBitFlags[32]; extern u16 gEquipMasks[]; extern u16 gEquipNegMasks[]; diff --git a/include/z64.h b/include/z64.h index cd9dc71cf..34be175f4 100644 --- a/include/z64.h +++ b/include/z64.h @@ -563,8 +563,6 @@ typedef void (*ColChkApplyFunc)(struct PlayState*, CollisionCheckContext*, Colli typedef void (*ColChkVsFunc)(struct PlayState*, CollisionCheckContext*, Collider*, Collider*); typedef s32 (*ColChkLineFunc)(struct PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); -typedef void(*room_draw_func)(struct PlayState* play, Room* room, u32 flags); - typedef struct { /* 0x000 */ u8 controllers; // bit 0 is set if controller 1 is plugged in, etc. /* 0x001 */ UNK_TYPE1 pad1[0x13]; diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index fa0443e65..ad56599b5 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -96,7 +96,10 @@ typedef struct { /* 0x00 */ Vec3s pos; /* 0x06 */ Vec3s rot; /* 0x0C */ s16 fov; - /* 0x0E */ s16 unk_0E; + /* 0x0E */ union { + s16 roomImageOverrideBgCamIndex; + s16 unk_0E; + }; /* 0x10 */ s16 unk_10; } BgCamFuncData; // size = 0x12 diff --git a/include/z64scene.h b/include/z64scene.h index 66830d86d..84b405b90 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -13,6 +13,9 @@ typedef struct { /* 0x4 */ uintptr_t vromEnd; } RomFile; // size = 0x8 +#define ROOM_DRAW_OPA (1 << 0) +#define ROOM_DRAW_XLU (1 << 1) + typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 data1; @@ -213,58 +216,132 @@ typedef struct { /* 0x4 */ void* segment; } SCmdMinimapChests; // size = 0x8 -typedef struct { - /* 0x0 */ Gfx* opaqueDl; - /* 0x4 */ Gfx* translucentDl; -} RoomMeshType0Params; // size = 0x8 - -// Fields TODO -typedef struct { - /* 0x0 */ u8 type; - /* 0x1 */ u8 format; // 1 = single, 2 = multi -} RoomMeshType1; // size = 0x2 - -// Size TODO -typedef struct { - /* 0x0 */ UNK_TYPE1 pad0[0x10]; -} RoomMeshType1Params; // size = 0x10 - -typedef struct { - /* 0x0 */ UNK_TYPE1 pad0[0x10]; -} RoomMeshType2Params; // size = 0x10 +typedef enum { + /* 0 */ ROOM_SHAPE_TYPE_NORMAL, + /* 1 */ ROOM_SHAPE_TYPE_IMAGE, + /* 2 */ ROOM_SHAPE_TYPE_CULLABLE, + /* 3 */ ROOM_SHAPE_TYPE_NONE, + /* 4 */ ROOM_SHAPE_TYPE_MAX +} RoomShapeType; typedef struct { /* 0x0 */ u8 type; - /* 0x1 */ u8 count; - /* 0x2 */ UNK_TYPE1 pad2[0x2]; - /* 0x4 */ RoomMeshType0Params* paramsStart; - /* 0x8 */ RoomMeshType0Params* paramsEnd; -} RoomMeshType0; // size = 0xC +} RoomShapeBase; // size = 0x1 typedef struct { - /* 0x0 */ u8 type; - /* 0x1 */ u8 count; - /* 0x2 */ UNK_TYPE1 pad2[0x2]; - /* 0x4 */ RoomMeshType2Params* paramsStart; - /* 0x8 */ RoomMeshType2Params* paramsEnd; -} RoomMeshType2; // size = 0xC + /* 0x0 */ Gfx* opa; + /* 0x4 */ Gfx* xlu; +} RoomShapeDListsEntry; // size = 0x8 + +typedef struct { + /* 0x0 */ RoomShapeBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ RoomShapeDListsEntry* entries; + /* 0x8 */ RoomShapeDListsEntry* entriesEnd; +} RoomShapeNormal; // size = 0xC + +typedef enum { + /* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1, + /* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI +} RoomShapeImageAmountType; + +typedef struct { + /* 0x0 */ RoomShapeBase base; + /* 0x1 */ u8 amountType; // uses `RoomShapeImageAmountType` + /* 0x4 */ RoomShapeDListsEntry* entry; +} RoomShapeImageBase; // size = 0x8 + +typedef struct { + /* 0x00 */ RoomShapeImageBase base; + /* 0x08 */ void* source; + /* 0x0C */ u32 unk_0C; + /* 0x10 */ void* tlut; + /* 0x14 */ u16 width; + /* 0x16 */ u16 height; + /* 0x18 */ u8 fmt; + /* 0x19 */ u8 siz; + /* 0x1A */ u16 tlutMode; + /* 0x1C */ u16 tlutCount; +} RoomShapeImageSingle; // size = 0x20 + +typedef struct { + /* 0x00 */ u16 unk_00; + /* 0x02 */ u8 bgCamIndex; // the bg cam index this entry is for + /* 0x04 */ void* source; + /* 0x08 */ u32 unk_0C; + /* 0x0C */ void* tlut; + /* 0x10 */ u16 width; + /* 0x12 */ u16 height; + /* 0x14 */ u8 fmt; + /* 0x15 */ u8 siz; + /* 0x16 */ u16 tlutMode; + /* 0x18 */ u16 tlutCount; +} RoomShapeImageMultiBgEntry; // size = 0x1C + +typedef struct { + /* 0x0 */ RoomShapeImageBase base; + /* 0x8 */ u8 numBackgrounds; + /* 0xC */ RoomShapeImageMultiBgEntry* backgrounds; +} RoomShapeImageMulti; // size = 0x10 + +typedef struct { + /* 0x0 */ Vec3s boundsSphereCenter; + /* 0x6 */ s16 boundsSphereRadius; + /* 0x8 */ Gfx* opa; + /* 0xC */ Gfx* xlu; +} RoomShapeCullableEntry; // size = 0x10 + +typedef struct { + /* 0x0 */ RoomShapeBase base; + /* 0x1 */ u8 numEntries; + /* 0x4 */ RoomShapeCullableEntry* entries; + /* 0x8 */ RoomShapeCullableEntry* entriesEnd; +} RoomShapeCullable; // size = 0xC typedef union { - RoomMeshType0 type0; - RoomMeshType1 type1; - RoomMeshType2 type2; -} RoomMesh; // size = 0xC + RoomShapeBase base; + RoomShapeNormal normal; + union { + RoomShapeImageBase base; + RoomShapeImageSingle single; + RoomShapeImageMulti multi; + } image; + RoomShapeCullable cullable; +} RoomShape; // "Ground Shape" + +// TODO: update ZAPD +#define SCENE_CMD_MESH SCENE_CMD_ROOM_SHAPE + +// TODO: Check which ones don't exist +typedef enum { + /* 0 */ ROOM_BEHAVIOR_TYPE1_0, + /* 1 */ ROOM_BEHAVIOR_TYPE1_1, + /* 2 */ ROOM_BEHAVIOR_TYPE1_2, + /* 3 */ ROOM_BEHAVIOR_TYPE1_3, // unused + /* 4 */ ROOM_BEHAVIOR_TYPE1_4, + /* 5 */ ROOM_BEHAVIOR_TYPE1_5 +} RoomBehaviorType1; + +typedef enum { + /* 0 */ ROOM_BEHAVIOR_TYPE2_0, + /* 1 */ ROOM_BEHAVIOR_TYPE2_1, + /* 2 */ ROOM_BEHAVIOR_TYPE2_2, + /* 3 */ ROOM_BEHAVIOR_TYPE2_HOT, + /* 4 */ ROOM_BEHAVIOR_TYPE2_4, + /* 5 */ ROOM_BEHAVIOR_TYPE2_5, + /* 6 */ ROOM_BEHAVIOR_TYPE2_6 +} RoomBehaviorType2; typedef struct { /* 0x00 */ s8 num; /* 0x01 */ u8 unk1; - /* 0x02 */ u8 unk2; // 3: Room is hot - /* 0x03 */ u8 unk3; + /* 0x02 */ u8 behaviorType2; + /* 0x03 */ u8 behaviorType1; /* 0x04 */ s8 echo; /* 0x05 */ u8 lensMode; /* 0x06 */ u8 enablePosLights; /* 0x07 */ UNK_TYPE1 pad7[0x1]; - /* 0x08 */ RoomMesh* mesh; + /* 0x08 */ RoomShape* roomShape; /* 0x0C */ void* segment; /* 0x10 */ UNK_TYPE1 pad10[0x4]; } Room; // size = 0x14 @@ -274,7 +351,7 @@ typedef struct { /* 0x14 */ Room prevRoom; /* 0x28 */ void* roomMemPages[2]; // In a scene with transitions, roomMemory is split between two pages that toggle each transition. This is one continuous range, as the second page allocates from the end /* 0x30 */ u8 activeMemPage; // 0 - First page in memory, 1 - Second page - /* 0x31 */ s8 unk31; + /* 0x31 */ s8 status; /* 0x32 */ UNK_TYPE1 pad32[0x2]; /* 0x34 */ void* activeRoomVram; /* 0x38 */ DmaRequest dmaRequest; @@ -286,15 +363,17 @@ typedef struct { /* 0x7A */ UNK_TYPE2 unk7A[3]; } RoomContext; // size = 0x80 -typedef struct { +typedef void(*RoomDrawHandler)(struct PlayState* play, Room* room, u32 flags); + +typedef struct TransitionActorEntry { struct { s8 room; // Room to switch to s8 bgCamIndex; // How the camera reacts during the transition. -2 for spiral staircase. -1 for generic door. 0+ will index scene CamData } /* 0x0 */ sides[2]; // 0 = front, 1 = back - /* 0x4 */ s16 id; + /* 0x4 */ s16 id; /* 0x6 */ Vec3s pos; - /* 0xC */ s16 rotY; - /* 0xE */ u16 params; + /* 0xC */ s16 rotY; + /* 0xE */ u16 params; } TransitionActorEntry; // size = 0x10 typedef struct { @@ -390,77 +469,6 @@ typedef struct { /* 0x00C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX]; } ObjectContext; // size = 0x958 -typedef struct { - /* 0x0 */ u8 headerType; -} MeshHeaderBase; // size = 0x1 - -typedef struct { - /* 0x0 */ MeshHeaderBase base; - /* 0x1 */ u8 numEntries; - /* 0x4 */ u32 dListStart; - /* 0x8 */ u32 dListEnd; -} MeshHeader0; // size = 0xC - -typedef struct { - /* 0x0 */ u32 opaqueDList; - /* 0x4 */ u32 translucentDList; -} MeshEntry0; // size = 0x8 - -typedef struct { - /* 0x0 */ MeshHeaderBase base; - /* 0x1 */ u8 format; - /* 0x4 */ u32 entryRecord; -} MeshHeader1Base; // size = 0x8 - -typedef struct { - /* 0x00 */ MeshHeader1Base base; - /* 0x08 */ u32 imagePtr; - /* 0x0C */ u32 unknown; - /* 0x10 */ u32 unknown2; - /* 0x14 */ u16 bgWidth; - /* 0x16 */ u16 bgHeight; - /* 0x18 */ u8 imageFormat; - /* 0x19 */ u8 imageSize; - /* 0x1A */ u16 imagePal; - /* 0x1C */ u16 imageFlip; -} MeshHeader1Single; // size = 0x20 - -typedef struct { - /* 0x0 */ MeshHeader1Base base; - /* 0x8 */ u8 bgCnt; - /* 0xC */ u32 bgRecordPtr; -} MeshHeader1Multi; // size = 0x10 - -typedef struct { - /* 0x00 */ u16 unknown; - /* 0x02 */ s8 bgID; - /* 0x04 */ u32 imagePtr; - /* 0x08 */ u32 unknown2; - /* 0x0C */ u32 unknown3; - /* 0x10 */ u16 bgWidth; - /* 0x12 */ u16 bgHeight; - /* 0x14 */ u8 imageFmt; - /* 0x15 */ u8 imageSize; - /* 0x16 */ u16 imagePal; - /* 0x18 */ u16 imageFlip; -} BackgroundRecord; // size = 0x1C - -typedef struct { - /* 0x0 */ s16 playerXMax; - /* 0x2 */ s16 playerZMax; - /* 0x4 */ s16 playerXMin; - /* 0x6 */ s16 playerZMin; - /* 0x8 */ u32 opaqueDList; - /* 0xC */ u32 translucentDList; -} MeshEntry2; // size = 0x10 - -typedef struct { - /* 0x0 */ MeshHeaderBase base; - /* 0x1 */ u8 numEntries; - /* 0x4 */ u32 dListStart; - /* 0x8 */ u32 dListEnd; -} MeshHeader2; // size = 0xC - typedef struct { /* 0x0 */ u8 count; // number of points in the path /* 0x1 */ u8 unk1; @@ -846,7 +854,7 @@ typedef enum { /* 0x07 */ SCENE_CMD_ID_SPECIAL_FILES, /* 0x08 */ SCENE_CMD_ID_ROOM_BEHAVIOR, /* 0x09 */ SCENE_CMD_ID_UNK_09, - /* 0x0A */ SCENE_CMD_ID_MESH, + /* 0x0A */ SCENE_CMD_ID_ROOM_SHAPE, /* 0x0B */ SCENE_CMD_ID_OBJECT_LIST, /* 0x0C */ SCENE_CMD_ID_LIGHT_LIST, /* 0x0D */ SCENE_CMD_ID_PATH_LIST, @@ -905,8 +913,8 @@ typedef enum { #define SCENE_CMD_UNK_09() \ { SCENE_CMD_ID_UNK_09, 0, CMD_W(0) } -#define SCENE_CMD_MESH(meshHeader) \ - { SCENE_CMD_ID_MESH, 0, CMD_PTR(meshHeader) } +#define SCENE_CMD_ROOM_SHAPE(roomShape) \ + { SCENE_CMD_ID_ROOM_SHAPE, 0, CMD_PTR(roomShape) } #define SCENE_CMD_OBJECT_LIST(numObjects, objectList) \ { SCENE_CMD_ID_OBJECT_LIST, numObjects, CMD_PTR(objectList) } diff --git a/spec b/spec index 404d10026..8c03e0389 100644 --- a/spec +++ b/spec @@ -505,7 +505,6 @@ beginseg include "build/src/code/z_rcp.o" pad_text include "build/src/code/z_room.o" - include "build/data/code/z_room.data.o" include "build/src/code/code_8012EC80.o" pad_text include "build/data/code/code_801C2410.data.o" diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 16ae999c5..075f941d4 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -53,8 +53,8 @@ void func_8016FDB8(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 ar flags = 0x1C; } - func_80172758(&gfx, buf, NULL, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, 0.0f, - 1.0f, 1.0f, flags); + Prerender_DrawBackground2D(&gfx, buf, NULL, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, + 0.0f, 0.0f, 1.0f, 1.0f, flags); gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); @@ -89,8 +89,8 @@ void func_8016FF90(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, s32 en gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, this->width, this->height); - func_80172758(&gfx, buf, 0, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, 0.0f, 1.0f, - 1.0f, 0xB); + Prerender_DrawBackground2D(&gfx, buf, 0, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, + 0.0f, 1.0f, 1.0f, 0xB); gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); @@ -454,8 +454,8 @@ void func_801720C4(PreRender* this) { #pragma GLOBAL_ASM("asm/non_matchings/code/PreRender/func_801720FC.s") -void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, - f32 y, f32 xScale, f32 yScale, u32 flags) { +void Prerender_DrawBackground2D(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, + u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags) { PreRenderParams params; PreRenderParams* paramsp = ¶ms; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 72d330f59..d3eea4ebe 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1344,7 +1344,7 @@ s32 func_800B715C(PlayState* play) { } void Actor_SetCameraHorseSetting(PlayState* play, Player* player) { - if ((play->roomCtx.curRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { + if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_4) && (player->actor.id == ACTOR_PLAYER)) { EnHorse* rideActor = (EnHorse*)player->rideActor; if ((rideActor != NULL) && !(rideActor->unk_1EC & 0x10)) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index f3bfb530f..ca127a8b6 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1767,7 +1767,7 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { break; } - if ((play->roomCtx.curRoom.unk3 == 1) && (interfaceCtx->minimapAlpha >= 255)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) && (interfaceCtx->minimapAlpha >= 255)) { interfaceCtx->minimapAlpha = 255; } } @@ -5096,8 +5096,9 @@ void Interface_Draw(PlayState* play) { // Load in Grandma's Story gSPLoadUcodeL(OVERLAY_DISP++, gspS2DEX2_fifo); gfx = OVERLAY_DISP; - func_80172758(&gfx, sStoryTextures[interfaceCtx->storyType], sStoryTLUTs[interfaceCtx->storyType], - SCREEN_WIDTH, SCREEN_HEIGHT, 2, 1, 0x8000, 0x100, 0.0f, 0.0f, 1.0f, 1.0f, 0); + Prerender_DrawBackground2D(&gfx, sStoryTextures[interfaceCtx->storyType], + sStoryTLUTs[interfaceCtx->storyType], SCREEN_WIDTH, SCREEN_HEIGHT, 2, 1, 0x8000, + 0x100, 0.0f, 0.0f, 1.0f, 1.0f, 0); OVERLAY_DISP = gfx; gSPLoadUcode(OVERLAY_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); diff --git a/src/code/z_play.c b/src/code/z_play.c index f6a425367..5f8c197f2 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -992,8 +992,8 @@ void Play_UpdateMain(PlayState* this) { Rumble_SetUpdateEnabled(false); } - Room_nop8012D510(this, &this->roomCtx.curRoom, &input[1], 0); - Room_nop8012D510(this, &this->roomCtx.prevRoom, &input[1], 1); + Room_Noop(this, &this->roomCtx.curRoom, &input[1], 0); + Room_Noop(this, &this->roomCtx.prevRoom, &input[1], 1); Skybox_Update(&this->skyboxCtx); if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { @@ -1127,7 +1127,7 @@ void Play_DrawMain(PlayState* this) { } if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { - if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.curRoom.mesh->type0.type == 1)) { + if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.curRoom.roomShape->base.type == ROOM_SHAPE_TYPE_IMAGE)) { func_8012CF0C(gfxCtx, false, true, 0, 0, 0); } else { func_8012CF0C(gfxCtx, true, true, this->lightCtx.fogColor.r, this->lightCtx.fogColor.g, @@ -1573,7 +1573,7 @@ void Play_InitScene(PlayState* this, s32 spawn) { Door_InitContext(&this->state, &this->doorCtx); Room_Init(this, &this->roomCtx); gSaveContext.worldMapArea = 0; - Scene_ProcessHeader(this, this->sceneSegment); + Scene_ExecuteCommands(this, this->sceneSegment); Play_InitEnvironment(this, this->skyboxId); } @@ -1940,11 +1940,10 @@ void func_80169FDC(GameState* thisx) { func_80169F78(thisx); } -// Used by Kankyo to determine how to change the lighting, e.g. for game over. -s32 func_80169FFC(GameState* thisx) { +s32 Play_CamIsNotFixed(GameState* thisx) { PlayState* this = (PlayState*)thisx; - return this->roomCtx.curRoom.mesh->type0.type != 1; + return this->roomCtx.curRoom.roomShape->base.type != ROOM_SHAPE_TYPE_IMAGE; } s32 FrameAdvance_IsEnabled(GameState* thisx) { @@ -2304,7 +2303,8 @@ void Play_Init(GameState* thisx) { while (!Room_HandleLoadCallbacks(this, &this->roomCtx)) {} - if ((CURRENT_DAY != 0) && ((this->roomCtx.curRoom.unk3 == 1) || (this->roomCtx.curRoom.unk3 == 5))) { + if ((CURRENT_DAY != 0) && ((this->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) || + (this->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_5))) { Actor_Spawn(&this->actorCtx, this, ACTOR_EN_TEST4, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0); } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 4bdd22e0a..6e7d0222c 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -441,7 +441,7 @@ void func_80123140(PlayState* play, Player* player) { IREG(69) = bootRegs[16]; MREG(95) = bootRegs[17]; - if (play->roomCtx.curRoom.unk3 == 2) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_2) { R_RUN_SPEED_LIMIT = 500; } @@ -1456,7 +1456,7 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) { EnvHazardTextTriggerEntry* triggerEntry; s32 envHazard; - if (play->roomCtx.curRoom.unk2 == 3) { // Room is hot + if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_HOT) { envHazard = PLAYER_ENV_HAZARD_HOTROOM - 1; } else if ((player->transformation != PLAYER_FORM_ZORA) && (player->underwaterTimer > 80)) { envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1; diff --git a/src/code/z_room.c b/src/code/z_room.c index eb615c409..3358bb300 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,62 +1,481 @@ #include "global.h" -void Room_nop8012D510(PlayState* play, Room* room, UNK_PTR param_3, UNK_TYPE1 param_4) { +void Room_Noop(PlayState* play, Room* room, Input* input, s32 arg3) { } -void Room_DrawType3Mesh(PlayState* play, Room* room, u32 flags) { +void Room_DrawNone(PlayState* play, Room* room, u32 flags) { } -void Room_DrawType0Mesh(PlayState* play, Room* room, u32 flags) { - RoomMeshType0* mesh; +static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; + +void Room_DrawNormal(PlayState* play, Room* room, u32 flags) { + RoomShapeNormal* roomShape; + RoomShapeDListsEntry* entry; s32 i; - RoomMeshType0Params* meshParams; - GraphicsContext* gfxCtx; - UNK_TYPE4 pad; - gfxCtx = play->state.gfxCtx; - if (flags & 1) { - func_800BCBF4(&D_801C1D10, play); - gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); + OPEN_DISPS(play->state.gfxCtx); + + if (flags & ROOM_DRAW_OPA) { + func_800BCBF4(&sZeroVec, play); + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); func_8012C268(play); - gSPMatrix(gfxCtx->polyOpa.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); } - if (flags & 2) { - func_800BCC68(&D_801C1D10, play); - gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); + if (flags & ROOM_DRAW_XLU) { + func_800BCC68(&sZeroVec, play); + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); func_8012C2DC(play->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); } - mesh = &room->mesh->type0; - meshParams = Lib_SegmentedToVirtual(mesh->paramsStart); - for (i = 0; i < mesh->count; i++) { - if ((flags & 1) && (meshParams->opaqueDl != NULL)) { - gSPDisplayList(gfxCtx->polyOpa.p++, meshParams->opaqueDl); + roomShape = &room->roomShape->normal; + entry = Lib_SegmentedToVirtual(roomShape->entries); + for (i = 0; i < roomShape->numEntries; i++) { + if ((flags & ROOM_DRAW_OPA) && (entry->opa != NULL)) { + gSPDisplayList(POLY_OPA_DISP++, entry->opa); } - if ((flags & 2) && (meshParams->translucentDl != NULL)) { - gSPDisplayList(gfxCtx->polyXlu.p++, meshParams->translucentDl); + if ((flags & ROOM_DRAW_XLU) && (entry->xlu != NULL)) { + gSPDisplayList(POLY_XLU_DISP++, entry->xlu); } - meshParams++; + entry++; } + + CLOSE_DISPS(play->state.gfxCtx); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_DrawType2Mesh.s") +typedef enum { + /* 0 */ ROOM_CULL_DEBUG_MODE_OFF, + /* 1 */ ROOM_CULL_DEBUG_MODE_UP_TO_TARGET, + /* 2 */ ROOM_CULL_DEBUG_MODE_ONLY_TARGET +} RoomCullableDebugMode; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012DEE8.s") +typedef struct RoomShapeCullableEntryLinked { + /* 0x00 */ RoomShapeCullableEntry* entry; + /* 0x04 */ f32 boundsNearZ; + /* 0x08 */ struct RoomShapeCullableEntryLinked* prev; + /* 0x0C */ struct RoomShapeCullableEntryLinked* next; +} RoomShapeCullableEntryLinked; // size = 0x10 -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012E254.s") +// TODO: 127 is an arbitrarily chosen number to make the stack sorta work +#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 127 -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8012E32C.s") +#ifdef NON_MATCHING +// Small regalloc, likely related to temp usage and scoping +void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { + RoomShapeCullable* roomShape; + RoomShapeCullableEntry* roomShapeCullableEntry; + RoomShapeCullableEntry* roomShapeCullableEntries; + RoomShapeCullableEntry* roomShapeCullableEntryIter; + Gfx* displayList; + f32 entryBoundsNearZ; + RoomShapeCullableEntryLinked linkedEntriesBuffer[ROOM_SHAPE_CULLABLE_MAX_ENTRIES]; + RoomShapeCullableEntryLinked* head = NULL; + RoomShapeCullableEntryLinked* tail = NULL; + s32 var_a1; + RoomShapeCullableEntryLinked* iter; + RoomShapeCullableEntryLinked* insert; + f32 var_fv1; + s32 i; + Vec3f pos; + Vec3f projectedPos; + s32 pad2; -void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { - RoomMeshType1* mesh = &room->mesh->type1; - if (mesh->format == 1) { - func_8012DEE8(play, room, flags); - } else if (mesh->format == 2) { - func_8012E32C(play, room, flags); + OPEN_DISPS(play->state.gfxCtx); + + if (flags & ROOM_DRAW_OPA) { + func_800BCBF4(&sZeroVec, play); + + //! TODO: Fake + if (1) {} + if (1) {} + if (1) {} + + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); + if (play->roomCtx.unk74 != NULL) { + gSPSegment(POLY_OPA_DISP++, 0x06, play->roomCtx.unk74); + } + func_8012C268(play); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + } + + if (flags & ROOM_DRAW_XLU) { + func_800BCC68(&sZeroVec, play); + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); + if (play->roomCtx.unk74 != NULL) { + gSPSegment(POLY_XLU_DISP++, 0x06, play->roomCtx.unk74); + } + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + } + + if ((room->enablePosLights != 0) || (MREG(93) != 0)) { + gSPSetGeometryMode(POLY_OPA_DISP++, G_LIGHTING_POSITIONAL); + gSPSetGeometryMode(POLY_XLU_DISP++, G_LIGHTING_POSITIONAL); + } + + roomShape = &room->roomShape->cullable; + roomShapeCullableEntry = Lib_SegmentedToVirtual(roomShape->entries); + insert = linkedEntriesBuffer; + + roomShapeCullableEntries = roomShapeCullableEntry; + + if (play->roomCtx.unk78 < 0) { + for (i = 0; i < roomShape->numEntries; i++, roomShapeCullableEntry++) { + if (R_ROOM_CULL_DEBUG_MODE != 0) { + if (((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_UP_TO_TARGET) && + (i <= R_ROOM_CULL_DEBUG_TARGET)) || + ((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_ONLY_TARGET) && (i == R_ROOM_CULL_DEBUG_TARGET))) { + if (flags & ROOM_DRAW_OPA) { + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + + if (flags & ROOM_DRAW_XLU) { + displayList = roomShapeCullableEntry->xlu; + if (displayList != NULL) { + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } + } + } else { + if (flags & ROOM_DRAW_OPA) { + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + + if (flags & ROOM_DRAW_XLU) { + displayList = roomShapeCullableEntry->xlu; + if (displayList != NULL) { + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } + } + } + } else { + f32 var_fa1 = 1.0f / play->projectionMtxFDiagonal.z; // sp54 + s32 pad5; + + // Pick and sort entries by depth + for (i = 0; i < roomShape->numEntries; i++, roomShapeCullableEntry++) { + + // Project the entry position, to get the depth it is at. + pos.x = roomShapeCullableEntry->boundsSphereCenter.x; + pos.y = roomShapeCullableEntry->boundsSphereCenter.y; + pos.z = roomShapeCullableEntry->boundsSphereCenter.z; + SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &pos, &projectedPos); + + projectedPos.z *= var_fa1; + + var_fv1 = ABS_ALT(roomShapeCullableEntry->boundsSphereRadius); + + // If the entry bounding sphere isn't fully before the rendered depth range + if (-var_fv1 < projectedPos.z) { + + // Compute the depth of the nearest point in the entry's bounding sphere + entryBoundsNearZ = projectedPos.z - var_fv1; + + // If the entry bounding sphere isn't fully beyond the rendered depth range + if (entryBoundsNearZ < play->lightCtx.zFar) { + + // This entry will be rendered + insert->entry = roomShapeCullableEntry; + + if (roomShapeCullableEntry->boundsSphereRadius < 0) { + insert->boundsNearZ = FLT_MAX; + } else { + insert->boundsNearZ = entryBoundsNearZ; + } + + // Insert into the linked list, ordered by ascending depth of the nearest point in the bounding + // sphere + iter = head; + if (iter == NULL) { + head = tail = insert; + insert->prev = insert->next = NULL; + } else { + do { + if (insert->boundsNearZ < iter->boundsNearZ) { + break; + } + iter = iter->next; + } while (iter != NULL); + + if (iter == NULL) { + insert->prev = tail; + insert->next = NULL; + tail->next = insert; + tail = insert; + } else { + insert->prev = iter->prev; + if (insert->prev == NULL) { + head = insert; + } else { + insert->prev->next = insert; + } + iter->prev = insert; + insert->next = iter; + } + } + + insert++; + } + } + } + + //! FAKE: Similar trick used in OoT + R_ROOM_CULL_NUM_ENTRIES = roomShape->numEntries & 0xFFFF & 0xFFFF & 0xFFFF; + + // Draw entries, from nearest to furthest + i = 1; + + if (flags & ROOM_DRAW_OPA) { + for (; head != NULL; head = head->next, i++) { + s32 pad3; + RoomShapeCullableEntry* roomShapeCullableEntry; + + roomShapeCullableEntry = head->entry; + + if (R_ROOM_CULL_DEBUG_MODE != ROOM_CULL_DEBUG_MODE_OFF) { + // Debug mode drawing + + if (((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_UP_TO_TARGET) && + (i <= R_ROOM_CULL_DEBUG_TARGET)) || + ((R_ROOM_CULL_DEBUG_MODE == ROOM_CULL_DEBUG_MODE_ONLY_TARGET) && + (i == R_ROOM_CULL_DEBUG_TARGET))) { + + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + } else { + displayList = roomShapeCullableEntry->opa; + if (displayList != NULL) { + gSPDisplayList(POLY_OPA_DISP++, displayList); + } + } + } + } + + if (flags & ROOM_DRAW_XLU) { + for (; head != NULL; head = head->prev) { + f32 temp_fv0; + f32 temp_fv1; + + roomShapeCullableEntry = head->entry; + displayList = roomShapeCullableEntry->xlu; + + if (displayList != NULL) { + if (roomShapeCullableEntry->boundsSphereRadius & 1) { + + temp_fv0 = head->boundsNearZ - (f32)(iREG(93) + 0xBB8); + temp_fv1 = iREG(94) + 0x7D0; + + if (temp_fv0 < temp_fv1) { + if (temp_fv0 < 0.0f) { + var_a1 = 255; + } else { + var_a1 = 255 - (s32)((temp_fv0 / temp_fv1) * 255.0f); + } + gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, var_a1); + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } else { + gSPDisplayList(POLY_XLU_DISP++, displayList); + } + } + } + } + + R_ROOM_CULL_USED_ENTRIES = i - 1; + } + + CLOSE_DISPS(play->state.gfxCtx); +} +#else +void Room_DrawCullable(PlayState* play, Room* room, u32 flags); +#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_DrawCullable.s") +#endif + +#define ROOM_IMAGE_NODRAW_BACKGROUND (1 << 0) +#define ROOM_IMAGE_NODRAW_OPA (1 << 1) +#define ROOM_IMAGE_NODRAW_XLU (1 << 2) + +void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) { + Camera* activeCam; + Gfx* gfx; + RoomShapeImageSingle* roomShape; + RoomShapeDListsEntry* entry; + u32 isFixedCamera; + u32 drawBackground; + u32 drawOpa; + u32 drawXlu; + + OPEN_DISPS(play->state.gfxCtx); + + activeCam = GET_ACTIVE_CAM(play); + isFixedCamera = false; // Condition is inferred from OoT + roomShape = &room->roomShape->image.single; + entry = Lib_SegmentedToVirtual(roomShape->base.entry); + drawBackground = (flags & ROOM_DRAW_OPA) && isFixedCamera && (roomShape->source != NULL) && + !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_BACKGROUND); + drawOpa = (flags & ROOM_DRAW_OPA) && (entry->opa != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_OPA); + drawXlu = (flags & ROOM_DRAW_XLU) && (entry->xlu != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_XLU); + + if (drawOpa || drawBackground) { + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); + + if (drawOpa) { + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_OPA_DISP++, entry->opa); + } + + if (drawBackground) { + gSPLoadUcodeL(POLY_OPA_DISP++, gspS2DEX2_fifo); + + gfx = POLY_OPA_DISP; + + { + Vec3f quakeOffset; + + Camera_GetQuakeOffset(&quakeOffset, activeCam); + + Prerender_DrawBackground2D( + &gfx, roomShape->source, roomShape->tlut, roomShape->width, roomShape->height, roomShape->fmt, + roomShape->siz, roomShape->tlutMode, roomShape->tlutCount, + (quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f, + quakeOffset.y * 2.4f + (quakeOffset.x + quakeOffset.z) * 0.3f, 1.0f, 1.0f, 0); + } + + POLY_OPA_DISP = gfx; + + gSPLoadUcode(POLY_OPA_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); + } + } + + if (drawXlu) { + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_XLU_DISP++, entry->xlu); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +RoomShapeImageMultiBgEntry* Room_GetImageMultiBgEntry(RoomShapeImageMulti* roomShapeImageMulti, PlayState* play) { + Camera* activeCam = GET_ACTIVE_CAM(play); + s32 bgCamIndex = activeCam->bgCamDataId; + s16 overrideBgCamIndex; + Player* player; + RoomShapeImageMultiBgEntry* bgEntry; + s32 i; + + overrideBgCamIndex = ((BgCamFuncData*)BgCheck_GetBgCamFuncDataImpl(&play->colCtx, bgCamIndex, BGCHECK_SCENE)) + ->roomImageOverrideBgCamIndex; + if (overrideBgCamIndex >= 0) { + bgCamIndex = overrideBgCamIndex; + } + + player = GET_PLAYER(play); + player->actor.params = (player->actor.params & 0xFF00) | bgCamIndex; + + bgEntry = Lib_SegmentedToVirtual(roomShapeImageMulti->backgrounds); + for (i = 0; i < roomShapeImageMulti->numBackgrounds; i++) { + if (bgEntry->bgCamIndex == bgCamIndex) { + return bgEntry; + } + bgEntry++; + } + + __assert("../z_room.c", 849); + + return NULL; +} + +void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) { + Camera* activeCam; + Gfx* gfx; + RoomShapeImageMulti* roomShape; + RoomShapeImageMultiBgEntry* bgEntry; + RoomShapeDListsEntry* dListsEntry; + u32 isFixedCamera; + u32 drawBackground; + u32 drawOpa; + u32 drawXlu; + + OPEN_DISPS(play->state.gfxCtx); + + activeCam = GET_ACTIVE_CAM(play); + isFixedCamera = false; // Condition is inferred from OoT + roomShape = &room->roomShape->image.multi; + dListsEntry = Lib_SegmentedToVirtual(roomShape->base.entry); + + bgEntry = Room_GetImageMultiBgEntry(roomShape, play); + + drawBackground = (flags & ROOM_DRAW_OPA) && isFixedCamera && (bgEntry->source != NULL) && + !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_BACKGROUND); + drawOpa = + (flags & ROOM_DRAW_OPA) && (dListsEntry->opa != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_OPA); + drawXlu = + (flags & ROOM_DRAW_XLU) && (dListsEntry->xlu != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_XLU); + + if (drawOpa || drawBackground) { + gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); + + if (drawOpa) { + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_OPA_DISP++, dListsEntry->opa); + } + + if (drawBackground) { + gSPLoadUcodeL(POLY_OPA_DISP++, gspS2DEX2_fifo); + + gfx = POLY_OPA_DISP; + + { + Vec3f quakeOffset; + + Camera_GetQuakeOffset(&quakeOffset, activeCam); + Prerender_DrawBackground2D(&gfx, bgEntry->source, bgEntry->tlut, bgEntry->width, bgEntry->height, + bgEntry->fmt, bgEntry->siz, bgEntry->tlutMode, bgEntry->tlutCount, + (quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f, + quakeOffset.y * 2.4f + (quakeOffset.x + quakeOffset.z) * 0.3f, 1.0f, 1.0f, + 0); + } + + POLY_OPA_DISP = gfx; + + gSPLoadUcode(POLY_OPA_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); + } + } + + if (drawXlu) { + gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); + func_8012C2DC(play->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(POLY_XLU_DISP++, dListsEntry->xlu); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Room_DrawImage(PlayState* play, Room* room, u32 flags) { + RoomShapeImageBase* roomShape = &room->roomShape->image.base; + + if (roomShape->amountType == ROOM_SHAPE_IMAGE_AMOUNT_SINGLE) { + Room_DrawImageSingle(play, room, flags); + } else if (roomShape->amountType == ROOM_SHAPE_IMAGE_AMOUNT_MULTI) { + Room_DrawImageMulti(play, room, flags); } else { __assert("../z_room.c", 965); } @@ -64,31 +483,96 @@ void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { void Room_Init(PlayState* play, RoomContext* roomCtx) { s32 i; + roomCtx->curRoom.num = -1; roomCtx->curRoom.segment = NULL; roomCtx->unk78 = 1; roomCtx->unk79 = 0; - for (i = 0; i < 3; i++) { + for (i = 0; i < ARRAY_COUNT(roomCtx->unk7A); i++) { roomCtx->unk7A[i] = 0; } } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_AllocateAndLoad.s") +size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx) { + size_t maxRoomSize = 0; + size_t roomSize; + s32 i; + s32 j; + s32 frontRoom; + s32 backRoom; + size_t frontRoomSize; + size_t backRoomSize; + size_t cumulRoomSize; + s32 pad[2]; + + { + RomFile* roomList = play->roomList; + + for (i = 0; i < play->numRooms; i++) { + roomSize = roomList[i].vromEnd - roomList[i].vromStart; + maxRoomSize = MAX(roomSize, maxRoomSize); + } + } + + if ((u32)play->doorCtx.numTransitionActors != 0) { + RomFile* roomList = play->roomList; + TransitionActorEntry* transitionActor = &play->doorCtx.transitionActorList[0]; + + for (j = 0; j < play->doorCtx.numTransitionActors; j++) { + frontRoom = transitionActor->sides[0].room; + backRoom = transitionActor->sides[1].room; + frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart; + backRoomSize = (backRoom < 0) ? 0 : roomList[backRoom].vromEnd - roomList[backRoom].vromStart; + cumulRoomSize = (frontRoom != backRoom) ? frontRoomSize + backRoomSize : frontRoomSize; + + maxRoomSize = MAX(cumulRoomSize, maxRoomSize); + transitionActor++; + } + } + + roomCtx->roomMemPages[0] = THA_AllocEndAlign16(&play->state.heap, maxRoomSize); + if (roomCtx->roomMemPages[0] == NULL) { + __assert("../z_room.c", 1078); + } + roomCtx->roomMemPages[1] = (void*)((uintptr_t)roomCtx->roomMemPages[0] + maxRoomSize); + roomCtx->activeMemPage = 0; + roomCtx->status = 0; + + if ((gSaveContext.respawnFlag != 0) && (gSaveContext.respawnFlag != -2) && (gSaveContext.respawnFlag != -7)) { + s32 respawnMode; + + if ((gSaveContext.respawnFlag == -8) || (gSaveContext.respawnFlag == -5) || (gSaveContext.respawnFlag == -4) || + ((gSaveContext.respawnFlag < 0) && (gSaveContext.respawnFlag != -1) && (gSaveContext.respawnFlag != -6))) { + respawnMode = RESPAWN_MODE_DOWN; + } else if (gSaveContext.respawnFlag < 0) { + respawnMode = RESPAWN_MODE_TOP; + } else { + respawnMode = gSaveContext.respawnFlag - 1; + } + frontRoom = gSaveContext.respawn[respawnMode].roomIndex; + } else { + frontRoom = play->setupEntranceList[play->curSpawn].room; + } + + Room_StartRoomTransition(play, roomCtx, frontRoom); + + return maxRoomSize; +} s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { - if (roomCtx->unk31 == 0) { - s32 size; + if (roomCtx->status == 0) { + size_t size; roomCtx->prevRoom = roomCtx->curRoom; roomCtx->curRoom.num = index; roomCtx->curRoom.segment = NULL; - roomCtx->unk31 = 1; + roomCtx->status = 1; size = play->roomList[index].vromEnd - play->roomList[index].vromStart; - roomCtx->activeRoomVram = (void*)(ALIGN16((u32)roomCtx->roomMemPages[roomCtx->activeMemPage] - + roomCtx->activeRoomVram = (void*)(ALIGN16((uintptr_t)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage - 7)); - osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1); + osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, ARRAY_COUNT(roomCtx->loadMsg)); DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0, &roomCtx->loadQueue, NULL); roomCtx->activeMemPage ^= 1; @@ -100,14 +584,13 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { } s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { - if (roomCtx->unk31 == 1) { - if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { - roomCtx->unk31 = 0; + if (roomCtx->status == 1) { + if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { + roomCtx->status = 0; roomCtx->curRoom.segment = roomCtx->activeRoomVram; - // TODO: Segment number enum - gSegments[0x03] = VIRTUAL_TO_PHYSICAL(roomCtx->activeRoomVram); + gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->activeRoomVram); - Scene_ProcessHeader(play, (SceneCmd*)roomCtx->curRoom.segment); + Scene_ExecuteCommands(play, roomCtx->curRoom.segment); func_80123140(play, GET_PLAYER(play)); Actor_SpawnTransitionActors(play, &play->actorCtx); @@ -127,11 +610,17 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { return 1; } +RoomDrawHandler sRoomDrawHandlers[] = { + Room_DrawNormal, // ROOM_SHAPE_TYPE_NORMAL + Room_DrawImage, // ROOM_SHAPE_TYPE_IMAGE + Room_DrawCullable, // ROOM_SHAPE_TYPE_CULLABLE + Room_DrawNone, // ROOM_SHAPE_TYPE_NONE +}; + void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { - // TODO: Segment number enum - gSegments[0x03] = VIRTUAL_TO_PHYSICAL(room->segment); - roomDrawFuncs[room->mesh->type0.type](play, room, flags); + gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); + sRoomDrawHandlers[room->roomShape->base.type](play, room, flags); } return; } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 1f431d0e4..13d93c515 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -141,7 +141,7 @@ void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) { } // SceneTableEntry Header Command 0x00: Spawn List -void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { s32 loadedCount; s16 playerObjectId; void* nextObject; @@ -168,19 +168,19 @@ void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x01: Actor List -void Scene_HeaderCmdActorList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandActorList(PlayState* play, SceneCmd* cmd) { play->numSetupActors = cmd->actorList.num; play->setupActorList = Lib_SegmentedToVirtual(cmd->actorList.segment); play->actorCtx.halfDaysBit = 0; } // SceneTableEntry Header Command 0x02: List of camera data for actor cutscenes -void Scene_HeaderCmdActorCutsceneCamList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandActorCutsceneCamList(PlayState* play, SceneCmd* cmd) { play->actorCsCamList = Lib_SegmentedToVirtual(cmd->actorCsCamList.segment); } // SceneTableEntry Header Command 0x03: Collision Header -void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) { +void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) { CollisionHeader* colHeaderTemp; CollisionHeader* colHeader; @@ -205,18 +205,18 @@ void Scene_HeaderCmdColHeader(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x04: Room List -void Scene_HeaderCmdRoomList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) { play->numRooms = cmd->roomList.num; play->roomList = Lib_SegmentedToVirtual(cmd->roomList.segment); } // SceneTableEntry Header Command 0x06: Entrance List -void Scene_HeaderCmdEntranceList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) { play->setupEntranceList = Lib_SegmentedToVirtual(cmd->entranceList.segment); } // SceneTableEntry Header Command 0x07: Special Files -void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { // @note These quest hint files are identical to OoT's. // They are not relevant in this game and the system to process these scripts has been removed. static RomFile naviQuestHintFiles[2] = { @@ -236,9 +236,9 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x08: Room Behavior -void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) { - play->roomCtx.curRoom.unk3 = cmd->roomBehavior.gpFlag1; - play->roomCtx.curRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; +void Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1; + play->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF; play->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1; play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; play->roomCtx.curRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1; @@ -246,12 +246,12 @@ void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x0A: Mesh Header -void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd) { - play->roomCtx.curRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); +void Scene_CommandMesh(PlayState* play, SceneCmd* cmd) { + play->roomCtx.curRoom.roomShape = Lib_SegmentedToVirtual(cmd->mesh.segment); } // SceneTableEntry Header Command 0x0B: Object List -void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) { s32 i; s32 j; s32 k; @@ -304,7 +304,7 @@ void Scene_HeaderCmdObjectList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x0C: Light List -void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) { s32 i; LightInfo* lightInfo = Lib_SegmentedToVirtual(cmd->lightList.segment); @@ -315,12 +315,12 @@ void Scene_HeaderCmdLightList(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x0D: Path List -void Scene_HeaderCmdPathList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) { play->setupPathList = Lib_SegmentedToVirtual(cmd->pathList.segment); } // SceneTableEntry Header Command 0x0E: Transition Actor List -void Scene_HeaderCmdTransiActorList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandTransiActorList(PlayState* play, SceneCmd* cmd) { play->doorCtx.numTransitionActors = cmd->transiActorList.num; play->doorCtx.transitionActorList = Lib_SegmentedToVirtual(cmd->transiActorList.segment); func_80105818(play, play->doorCtx.numTransitionActors, play->doorCtx.transitionActorList); @@ -332,7 +332,7 @@ void Door_InitContext(GameState* state, DoorContext* doorCtx) { } // SceneTableEntry Header Command 0x0F: Environment Light Settings List -void Scene_HeaderCmdEnvLightSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandEnvLightSettings(PlayState* play, SceneCmd* cmd) { play->envCtx.numLightSettings = cmd->lightSettingList.num; play->envCtx.lightSettingsList = Lib_SegmentedToVirtual(cmd->lightSettingList.segment); } @@ -363,7 +363,7 @@ void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) { } // SceneTableEntry Header Command 0x11: Skybox Settings -void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) { play->skyboxId = cmd->skyboxSettings.skyboxId & 3; play->envCtx.unk_17 = play->envCtx.unk_18 = cmd->skyboxSettings.unk5; play->envCtx.unk_1E = cmd->skyboxSettings.unk6; @@ -371,13 +371,13 @@ void Scene_HeaderCmdSkyboxSettings(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x12: Skybox Disables -void Scene_HeaderCmdSkyboxDisables(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) { play->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4; play->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5; } // SceneTableEntry Header Command 0x10: Time Settings -void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) { gSaveContext.skyboxTime = gSaveContext.save.time = CLOCK_TIME_ALT2_F(cmd->timeSettings.hour, cmd->timeSettings.min); @@ -418,7 +418,7 @@ void Scene_HeaderCmdTimeSettings(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x05: Wind Settings -void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) { s8 temp1 = cmd->windSettings.west; s8 temp2 = cmd->windSettings.vertical; s8 temp3 = cmd->windSettings.south; @@ -430,16 +430,16 @@ void Scene_HeaderCmdWindSettings(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x13: Exit List -void Scene_HeaderCmdExitList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) { play->setupExitList = Lib_SegmentedToVirtual(cmd->exitList.segment); } // SceneTableEntry Header Command 0x09: Undefined -void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) { +void Scene_Command09(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x15: Sound Settings= -void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) { play->sequenceCtx.seqId = cmd->soundSettings.seqId; play->sequenceCtx.ambienceId = cmd->soundSettings.ambienceId; @@ -450,12 +450,12 @@ void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x16: Echo Setting -void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd) { +void Scene_CommandEchoSetting(PlayState* play, SceneCmd* cmd) { play->roomCtx.curRoom.echo = cmd->echoSettings.echo; } // SceneTableEntry Header Command 0x18: Alternate Header List= -void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandAltHeaderList(PlayState* play, SceneCmd* cmd) { SceneCmd** altHeaderList; SceneCmd* altHeader; @@ -464,40 +464,40 @@ void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { altHeader = altHeaderList[gSaveContext.sceneLayer - 1]; if (altHeader != NULL) { - Scene_ProcessHeader(play, Lib_SegmentedToVirtual(altHeader)); + Scene_ExecuteCommands(play, Lib_SegmentedToVirtual(altHeader)); (cmd + 1)->base.code = 0x14; } } } // SceneTableEntry Header Command 0x17: Cutscene List -void Scene_HeaderCmdCutsceneList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) { play->csCtx.sceneCsCount = cmd->cutsceneList.sceneCsCount; play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->cutsceneList.segment); } // SceneTableEntry Header Command 0x1B: Actor Cutscene List -void Scene_HeaderCmdActorCutsceneList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandActorCutsceneList(PlayState* play, SceneCmd* cmd) { ActorCutscene_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num); } // SceneTableEntry Header Command 0x1C: Mini Maps -void Scene_HeaderCmdMiniMap(PlayState* play, SceneCmd* cmd) { +void Scene_CommandMiniMap(PlayState* play, SceneCmd* cmd) { func_80104CF4(play); func_8010549C(play, cmd->minimapSettings.segment); } // SceneTableEntry Header Command 0x1D: Undefined -void Scene_HeaderCmd1D(PlayState* play, SceneCmd* cmd) { +void Scene_Command1D(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x1E: Minimap Compass Icon Info -void Scene_HeaderCmdMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { +void Scene_CommandMiniMapCompassInfo(PlayState* play, SceneCmd* cmd) { func_8010565C(play, cmd->minimapChests.num, cmd->minimapChests.segment); } // SceneTableEntry Header Command 0x19: Sets Region Visited Flag -void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { +void Scene_CommandSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { s16 j = 0; s16 i = 0; @@ -525,7 +525,7 @@ void Scene_HeaderCmdSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { } // SceneTableEntry Header Command 0x1A: Material Animations -void Scene_HeaderCmdAnimatedMaterials(PlayState* play, SceneCmd* cmd) { +void Scene_CommandAnimatedMaterials(PlayState* play, SceneCmd* cmd) { play->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment); } @@ -536,57 +536,58 @@ void Scene_SetExitFade(PlayState* play) { play->transitionType = Entrance_GetTransitionFlags(play->nextEntrance) & 0x7F; } +void (*sSceneCmdHandlers[])(PlayState*, SceneCmd*) = { + Scene_CommandSpawnList, + Scene_CommandActorList, + Scene_CommandActorCutsceneCamList, + Scene_CommandCollisionHeader, + Scene_CommandRoomList, + Scene_CommandWindSettings, + Scene_CommandEntranceList, + Scene_CommandSpecialFiles, + Scene_CommandRoomBehavior, + Scene_Command09, + Scene_CommandMesh, + Scene_CommandObjectList, + Scene_CommandLightList, + Scene_CommandPathList, + Scene_CommandTransiActorList, + Scene_CommandEnvLightSettings, + Scene_CommandTimeSettings, + Scene_CommandSkyboxSettings, + Scene_CommandSkyboxDisables, + Scene_CommandExitList, + NULL, + Scene_CommandSoundSettings, + Scene_CommandEchoSetting, + Scene_CommandCutsceneList, + Scene_CommandAltHeaderList, + Scene_CommandSetRegionVisitedFlag, + Scene_CommandAnimatedMaterials, + Scene_CommandActorCutsceneList, + Scene_CommandMiniMap, + Scene_Command1D, + Scene_CommandMiniMapCompassInfo, +}; + /** * Executes all of the commands in a scene or room header. */ -s32 Scene_ProcessHeader(PlayState* play, SceneCmd* header) { - static void (*sceneCmdHandlers[])(PlayState*, SceneCmd*) = { - Scene_HeaderCmdSpawnList, - Scene_HeaderCmdActorList, - Scene_HeaderCmdActorCutsceneCamList, - Scene_HeaderCmdColHeader, - Scene_HeaderCmdRoomList, - Scene_HeaderCmdWindSettings, - Scene_HeaderCmdEntranceList, - Scene_HeaderCmdSpecialFiles, - Scene_HeaderCmdRoomBehavior, - Scene_HeaderCmd09, - Scene_HeaderCmdMesh, - Scene_HeaderCmdObjectList, - Scene_HeaderCmdLightList, - Scene_HeaderCmdPathList, - Scene_HeaderCmdTransiActorList, - Scene_HeaderCmdEnvLightSettings, - Scene_HeaderCmdTimeSettings, - Scene_HeaderCmdSkyboxSettings, - Scene_HeaderCmdSkyboxDisables, - Scene_HeaderCmdExitList, - NULL, - Scene_HeaderCmdSoundSettings, - Scene_HeaderCmdEchoSetting, - Scene_HeaderCmdCutsceneList, - Scene_HeaderCmdAltHeaderList, - Scene_HeaderCmdSetRegionVisitedFlag, - Scene_HeaderCmdAnimatedMaterials, - Scene_HeaderCmdActorCutsceneList, - Scene_HeaderCmdMiniMap, - Scene_HeaderCmd1D, - Scene_HeaderCmdMiniMapCompassInfo, - }; +s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) { u32 cmdId; while (true) { - cmdId = header->base.code; + cmdId = sceneCmd->base.code; if (cmdId == SCENE_CMD_ID_END) { break; } if (cmdId < SCENE_CMD_MAX) { - sceneCmdHandlers[cmdId](play, header); + sSceneCmdHandlers[cmdId](play, sceneCmd); } - header++; + sceneCmd++; } return 0; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 7a365e547..8a9d26a4d 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -498,7 +498,7 @@ void func_808A1618(DoorShutter* this, PlayState* play) { void func_808A1684(DoorShutter* this, PlayState* play) { f32 phi_f0; - if ((DECR(this->unk_166) == 0) && (play->roomCtx.unk31 == 0) && func_808A1340(this, play)) { + if ((DECR(this->unk_166) == 0) && (play->roomCtx.status == 0) && func_808A1340(this, play)) { if (this->doorType == 5) { phi_f0 = 20.0f; } else { diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 763e35311..4c0dd92d9 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -328,7 +328,7 @@ s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) { s32 func_8094E0F8(EnGm* this, PlayState* play) { s32 ret = false; - if ((this->unk_260 != play->roomCtx.curRoom.num) && (play->roomCtx.unk31 == 0)) { + if ((this->unk_260 != play->roomCtx.curRoom.num) && (play->roomCtx.status == 0)) { this->unk_260 = play->roomCtx.curRoom.num; this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, play); this->actor.draw = NULL; diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index a0e359205..e2d4792ca 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -182,7 +182,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { u32 enHollId = EN_HOLL_GET_ID(&this->actor); if (sLoadingPlaneDistance < playerDistFromCentralPlane) { - if ((play->roomCtx.prevRoom.num >= 0) && (play->roomCtx.unk31 == 0)) { + if ((play->roomCtx.prevRoom.num >= 0) && (play->roomCtx.status == 0)) { this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[this->playerSide].room; if (play->roomCtx.prevRoom.num == this->actor.room) { EnHoll_ChangeRooms(play); @@ -298,7 +298,7 @@ void EnHoll_VerticalIdle(EnHoll* this, PlayState* play) { } void EnHoll_RoomTransitionIdle(EnHoll* this, PlayState* play) { - if (play->roomCtx.unk31 == 0) { + if (play->roomCtx.status == 0) { func_8012EBF8(play, &play->roomCtx); if (play->bgCoverAlpha == 0) { this->bgCoverAlphaActive = false; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 7b3b28ea3..1f411bd39 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -684,7 +684,8 @@ void EnKusa_Update(Actor* thisx, PlayState* play2) { } else { this->actor.shape.yOffset = 0.0f; } - if ((kusaGameplayFrames != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { + if ((kusaGameplayFrames != play->gameplayFrames) && + (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0)) { EnKusa_Sway(); kusaGameplayFrames = play->gameplayFrames; } @@ -696,8 +697,9 @@ void EnKusa_DrawBush(Actor* thisx, PlayState* play2) { if ((this->actor.projectedPos.z <= 1200.0f) || ((this->isInWater & 1) && (this->actor.projectedPos.z < 1300.0f))) { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && - (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && + (this->actionFunc == EnKusa_WaitForInteract) && (this->actor.projectedPos.z > -150.0f) && + (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } @@ -725,7 +727,8 @@ void EnKusa_DrawGrass(Actor* thisx, PlayState* play) { if (this->isCut) { Gfx_DrawDListOpa(play, gKusaStump); } else { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && + (this->actionFunc == EnKusa_WaitForInteract)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 6d65b4910..49fa4a98a 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -1293,7 +1293,7 @@ void func_80A5E604(Actor* thisx, PlayState* play) { } else { this->actor.draw = func_80A5E6F0; - if (play->roomCtx.curRoom.unk3 == 0) { + if (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) { func_80A5B508(); } func_80A5CAF4(&D_80A5F1C0); @@ -1356,7 +1356,7 @@ void EnKusa2_Draw(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if (this->actor.projectedPos.z <= 1200.0f) { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A5B954(&D_80A60908[this->unk_1CE], 0.0015f); } diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 5a6c4573f..0e09b2e68 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -367,7 +367,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (play->numSetupActors <= 0) && - (play->roomCtx.unk31 == 0) && !Play_IsDebugCamEnabled()) { + (play->roomCtx.status == 0) && !Play_IsDebugCamEnabled()) { s16 temp_a2; u16 temp_a0 = D_80A43364[this->unk_144]; s16 temp_a3; diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index bf0dc785b..56b6c6f81 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -762,7 +762,7 @@ void func_80AF2938(EnTest7* this, PlayState* play) { player->stateFlags2 |= PLAYER_STATE2_20000000; this->unk_144 |= 2; this->unk_148.unk_04 = 30.0f; - if (play->roomCtx.curRoom.unk3 != 1) { + if (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) { func_80AF082C(this, func_80AF2AE8); } else { func_80AF082C(this, func_80AF2EC8); diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index ed67e92c2..a5c66629a 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -655,7 +655,7 @@ void ObjFlowerpot_Update(Actor* thisx, PlayState* play2) { func_80A1C554(this); - if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { + if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0)) { func_80A1B3D0(); D_80A1D830 = play->gameplayFrames; } @@ -680,7 +680,7 @@ void ObjFlowerpot_Draw(Actor* thisx, PlayState* play) { } if (!(this->unk_1EA & 2)) { - if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { + if ((play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_0) && (this->actionFunc == func_80A1C838)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A1B840(&D_80A1D838[this->unk_1EB]); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index ae62d6f36..437840bc6 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2391,14 +2391,14 @@ 0x8012CF0C:("func_8012CF0C",), 0x8012D374:("func_8012D374",), 0x8012D40C:("func_8012D40C",), - 0x8012D510:("Room_nop8012D510",), - 0x8012D528:("Room_DrawType3Mesh",), - 0x8012D53C:("Room_DrawType0Mesh",), - 0x8012D750:("Room_DrawType2Mesh",), - 0x8012DEE8:("func_8012DEE8",), - 0x8012E254:("func_8012E254",), - 0x8012E32C:("func_8012E32C",), - 0x8012E6A8:("Room_DrawType1Mesh",), + 0x8012D510:("Room_Noop",), + 0x8012D528:("Room_DrawNone",), + 0x8012D53C:("Room_DrawNormal",), + 0x8012D750:("Room_DrawCullable",), + 0x8012DEE8:("Room_DrawImageSingle",), + 0x8012E254:("Room_GetImageMultiBgEntry",), + 0x8012E32C:("Room_DrawImageMulti",), + 0x8012E6A8:("Room_DrawImage",), 0x8012E710:("Room_Init",), 0x8012E750:("Room_AllocateAndLoad",), 0x8012E96C:("Room_StartRoomTransition",), @@ -2422,40 +2422,40 @@ 0x8012F668:("Object_IsLoaded",), 0x8012F698:("Object_LoadAll",), 0x8012F73C:("func_8012F73C",), - 0x8012F79C:("Scene_HeaderCmdSpawnList",), - 0x8012F90C:("Scene_HeaderCmdActorList",), - 0x8012F954:("Scene_HeaderCmdActorCutsceneCamList",), - 0x8012F984:("Scene_HeaderCmdColHeader",), - 0x8012FA24:("Scene_HeaderCmdRoomList",), - 0x8012FA68:("Scene_HeaderCmdEntranceList",), - 0x8012FA98:("Scene_HeaderCmdSpecialFiles",), - 0x8012FB60:("Scene_HeaderCmdRoomBehavior",), - 0x8012FBE8:("Scene_HeaderCmdMesh",), - 0x8012FC18:("Scene_HeaderCmdObjectList",), - 0x8012FDA4:("Scene_HeaderCmdLightList",), - 0x8012FE2C:("Scene_HeaderCmdPathList",), - 0x8012FE5C:("Scene_HeaderCmdTransiActorList",), + 0x8012F79C:("Scene_CommandSpawnList",), + 0x8012F90C:("Scene_CommandActorList",), + 0x8012F954:("Scene_CommandActorCutsceneCamList",), + 0x8012F984:("Scene_CommandCollisionHeader",), + 0x8012FA24:("Scene_CommandRoomList",), + 0x8012FA68:("Scene_CommandEntranceList",), + 0x8012FA98:("Scene_CommandSpecialFiles",), + 0x8012FB60:("Scene_CommandRoomBehavior",), + 0x8012FBE8:("Scene_CommandMesh",), + 0x8012FC18:("Scene_CommandObjectList",), + 0x8012FDA4:("Scene_CommandLightList",), + 0x8012FE2C:("Scene_CommandPathList",), + 0x8012FE5C:("Scene_CommandTransiActorList",), 0x8012FEBC:("Door_InitContext",), - 0x8012FECC:("Scene_HeaderCmdEnvLightSettings",), + 0x8012FECC:("Scene_CommandEnvLightSettings",), 0x8012FF10:("Scene_LoadAreaTextures",), - 0x8012FF8C:("Scene_HeaderCmdSkyboxSettings",), - 0x8012FFF0:("Scene_HeaderCmdSkyboxDisables",), - 0x80130018:("Scene_HeaderCmdTimeSettings",), - 0x8013033C:("Scene_HeaderCmdWindSettings",), - 0x801303A0:("Scene_HeaderCmdExitList",), - 0x801303D0:("Scene_HeaderCmd09",), - 0x801303E0:("Scene_HeaderCmdSoundSettings",), - 0x8013043C:("Scene_HeaderCmdEchoSetting",), - 0x80130454:("Scene_HeaderCmdAltHeaderList",), - 0x801304CC:("Scene_HeaderCmdCutsceneList",), - 0x80130500:("Scene_HeaderCmdActorCutsceneList",), - 0x80130540:("Scene_HeaderCmdMiniMap",), - 0x80130578:("Scene_HeaderCmd1D",), - 0x80130588:("Scene_HeaderCmdMiniMapCompassInfo",), - 0x801305B0:("Scene_HeaderCmdSetRegionVisitedFlag",), - 0x80130674:("Scene_HeaderCmdAnimatedMaterials",), + 0x8012FF8C:("Scene_CommandSkyboxSettings",), + 0x8012FFF0:("Scene_CommandSkyboxDisables",), + 0x80130018:("Scene_CommandTimeSettings",), + 0x8013033C:("Scene_CommandWindSettings",), + 0x801303A0:("Scene_CommandExitList",), + 0x801303D0:("Scene_Command09",), + 0x801303E0:("Scene_CommandSoundSettings",), + 0x8013043C:("Scene_CommandEchoSetting",), + 0x80130454:("Scene_CommandAltHeaderList",), + 0x801304CC:("Scene_CommandCutsceneList",), + 0x80130500:("Scene_CommandActorCutsceneList",), + 0x80130540:("Scene_CommandMiniMap",), + 0x80130578:("Scene_Command1D",), + 0x80130588:("Scene_CommandMiniMapCompassInfo",), + 0x801305B0:("Scene_CommandSetRegionVisitedFlag",), + 0x80130674:("Scene_CommandAnimatedMaterials",), 0x801306A4:("Scene_SetExitFade",), - 0x801306E8:("Scene_ProcessHeader",), + 0x801306E8:("Scene_ExecuteCommands",), 0x80130768:("Entrance_Create",), 0x80130784:("Entrance_CreateFromSpawn",), 0x801307C0:("Scene_Draw",), @@ -3032,7 +3032,7 @@ 0x80169EFC:("func_80169EFC",), 0x80169F78:("func_80169F78",), 0x80169FDC:("func_80169FDC",), - 0x80169FFC:("func_80169FFC",), + 0x80169FFC:("Play_CamIsNotFixed",), 0x8016A01C:("FrameAdvance_IsEnabled",), 0x8016A02C:("func_8016A02C",), 0x8016A0AC:("Play_IsUnderwater",), @@ -3079,7 +3079,7 @@ 0x80172078:("PreRender_ApplyFiltersSlowlyDestroy",), 0x801720C4:("func_801720C4",), 0x801720FC:("func_801720FC",), - 0x80172758:("func_80172758",), + 0x80172758:("Prerender_DrawBackground2D",), 0x801727F0:("THGA_Ct",), 0x80172810:("THGA_Dt",), 0x80172830:("THGA_IsCrash",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index de6991bd5..bf6d8e8bb 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1339,8 +1339,8 @@ 0x801C0EF0:("sSetupDL","Gfx","[438]",0xdb0), 0x801C1CA0:("sFillSetupDL","Gfx","[12]",0x60), 0x801C1D00:("gEmptyDL","Gfx","[1]",0x8), - 0x801C1D10:("D_801C1D10","Vec3f","",0xc), - 0x801C1D1C:("roomDrawFuncs","room_draw_func","[4]",0x10), + 0x801C1D10:("sZeroVec","Vec3f","",0xc), + 0x801C1D1C:("sRoomDrawHandlers","RoomDrawHandler","[4]",0x10), 0x801C1D30:("gBitFlags","u32","[32]",0x80), 0x801C1DB0:("gEquipMasks","u16","[4]",0x8), 0x801C1DB8:("gEquipNegMasks","u16","[4]",0x8), diff --git a/tools/namefixer.py b/tools/namefixer.py index 828cf46bb..cb902dcb6 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -492,7 +492,7 @@ wordReplace = { "func_800DFC90": "Camera_GetCamDir", "func_800DFD04": "Camera_AddQuake", "func_800DFFAC": "Camera_ChangeDoorCam", - + "func_80169FFC": "Play_CamIsNotFixed", "func_801694DC": "Play_CreateSubCamera", "Play_GetActiveCameraIndex": "Play_GetActiveCamId", "func_80169590": "Play_ChangeCameraStatus", @@ -814,6 +814,9 @@ wordReplace = { "play->nextEntranceIndex": "play->nextEntrance", "play->sceneNum": "play->sceneId", "play->pauseCtx.unk_1F0": "play->pauseCtx.bombersNotebookOpen", + "play->roomCtx.curRoom.unk3": "play->roomCtx.curRoom.behaviorType1", + "play->roomCtx.curRoom.unk2": "play->roomCtx.curRoom.behaviorType2", + "play->roomCtx.unk31": "play->roomCtx.status", "actorCtx.unkC": "actorCtx.halfDaysBit", "actorCtx.unk1F4": "actorCtx.unk_1F4.unk_00", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 3dd0ba708..0f33e599d 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1905,14 +1905,14 @@ asm/non_matchings/code/z_rcp/Gfx_PrimColor.s,Gfx_PrimColor,0x8012CEA8,0x19 asm/non_matchings/code/z_rcp/func_8012CF0C.s,func_8012CF0C,0x8012CF0C,0x11A asm/non_matchings/code/z_rcp/func_8012D374.s,func_8012D374,0x8012D374,0x26 asm/non_matchings/code/z_rcp/func_8012D40C.s,func_8012D40C,0x8012D40C,0x3D -asm/non_matchings/code/z_room/Room_nop8012D510.s,Room_nop8012D510,0x8012D510,0x6 -asm/non_matchings/code/z_room/Room_DrawType3Mesh.s,Room_DrawType3Mesh,0x8012D528,0x5 -asm/non_matchings/code/z_room/Room_DrawType0Mesh.s,Room_DrawType0Mesh,0x8012D53C,0x85 -asm/non_matchings/code/z_room/Room_DrawType2Mesh.s,Room_DrawType2Mesh,0x8012D750,0x1E6 -asm/non_matchings/code/z_room/func_8012DEE8.s,func_8012DEE8,0x8012DEE8,0xDB -asm/non_matchings/code/z_room/func_8012E254.s,func_8012E254,0x8012E254,0x36 -asm/non_matchings/code/z_room/func_8012E32C.s,func_8012E32C,0x8012E32C,0xDF -asm/non_matchings/code/z_room/Room_DrawType1Mesh.s,Room_DrawType1Mesh,0x8012E6A8,0x1A +asm/non_matchings/code/z_room/Room_Noop.s,Room_Noop,0x8012D510,0x6 +asm/non_matchings/code/z_room/Room_DrawNone.s,Room_DrawNone,0x8012D528,0x5 +asm/non_matchings/code/z_room/Room_DrawNormal.s,Room_DrawNormal,0x8012D53C,0x85 +asm/non_matchings/code/z_room/Room_DrawCullable.s,Room_DrawCullable,0x8012D750,0x1E6 +asm/non_matchings/code/z_room/Room_DrawImageSingle.s,Room_DrawImageSingle,0x8012DEE8,0xDB +asm/non_matchings/code/z_room/Room_GetImageMultiBgEntry.s,Room_GetImageMultiBgEntry,0x8012E254,0x36 +asm/non_matchings/code/z_room/Room_DrawImageMulti.s,Room_DrawImageMulti,0x8012E32C,0xDF +asm/non_matchings/code/z_room/Room_DrawImage.s,Room_DrawImage,0x8012E6A8,0x1A asm/non_matchings/code/z_room/Room_Init.s,Room_Init,0x8012E710,0x10 asm/non_matchings/code/z_room/Room_AllocateAndLoad.s,Room_AllocateAndLoad,0x8012E750,0x87 asm/non_matchings/code/z_room/Room_StartRoomTransition.s,Room_StartRoomTransition,0x8012E96C,0x4F @@ -1936,40 +1936,40 @@ asm/non_matchings/code/z_scene/Object_GetIndex.s,Object_GetIndex,0x8012F608,0x18 asm/non_matchings/code/z_scene/Object_IsLoaded.s,Object_IsLoaded,0x8012F668,0xC asm/non_matchings/code/z_scene/Object_LoadAll.s,Object_LoadAll,0x8012F698,0x29 asm/non_matchings/code/z_scene/func_8012F73C.s,func_8012F73C,0x8012F73C,0x18 -asm/non_matchings/code/z_scene/Scene_HeaderCmdSpawnList.s,Scene_HeaderCmdSpawnList,0x8012F79C,0x5C -asm/non_matchings/code/z_scene/Scene_HeaderCmdActorList.s,Scene_HeaderCmdActorList,0x8012F90C,0x12 -asm/non_matchings/code/z_scene/Scene_HeaderCmdActorCutsceneCamList.s,Scene_HeaderCmdActorCutsceneCamList,0x8012F954,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdColHeader.s,Scene_HeaderCmdColHeader,0x8012F984,0x28 -asm/non_matchings/code/z_scene/Scene_HeaderCmdRoomList.s,Scene_HeaderCmdRoomList,0x8012FA24,0x11 -asm/non_matchings/code/z_scene/Scene_HeaderCmdEntranceList.s,Scene_HeaderCmdEntranceList,0x8012FA68,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdSpecialFiles.s,Scene_HeaderCmdSpecialFiles,0x8012FA98,0x32 -asm/non_matchings/code/z_scene/Scene_HeaderCmdRoomBehavior.s,Scene_HeaderCmdRoomBehavior,0x8012FB60,0x22 -asm/non_matchings/code/z_scene/Scene_HeaderCmdMesh.s,Scene_HeaderCmdMesh,0x8012FBE8,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdObjectList.s,Scene_HeaderCmdObjectList,0x8012FC18,0x63 -asm/non_matchings/code/z_scene/Scene_HeaderCmdLightList.s,Scene_HeaderCmdLightList,0x8012FDA4,0x22 -asm/non_matchings/code/z_scene/Scene_HeaderCmdPathList.s,Scene_HeaderCmdPathList,0x8012FE2C,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmdTransiActorList.s,Scene_HeaderCmdTransiActorList,0x8012FE5C,0x18 +asm/non_matchings/code/z_scene/Scene_CommandSpawnList.s,Scene_CommandSpawnList,0x8012F79C,0x5C +asm/non_matchings/code/z_scene/Scene_CommandActorList.s,Scene_CommandActorList,0x8012F90C,0x12 +asm/non_matchings/code/z_scene/Scene_CommandActorCutsceneCamList.s,Scene_CommandActorCutsceneCamList,0x8012F954,0xC +asm/non_matchings/code/z_scene/Scene_CommandCollisionHeader.s,Scene_CommandCollisionHeader,0x8012F984,0x28 +asm/non_matchings/code/z_scene/Scene_CommandRoomList.s,Scene_CommandRoomList,0x8012FA24,0x11 +asm/non_matchings/code/z_scene/Scene_CommandEntranceList.s,Scene_CommandEntranceList,0x8012FA68,0xC +asm/non_matchings/code/z_scene/Scene_CommandSpecialFiles.s,Scene_CommandSpecialFiles,0x8012FA98,0x32 +asm/non_matchings/code/z_scene/Scene_CommandRoomBehavior.s,Scene_CommandRoomBehavior,0x8012FB60,0x22 +asm/non_matchings/code/z_scene/Scene_CommandMesh.s,Scene_CommandMesh,0x8012FBE8,0xC +asm/non_matchings/code/z_scene/Scene_CommandObjectList.s,Scene_CommandObjectList,0x8012FC18,0x63 +asm/non_matchings/code/z_scene/Scene_CommandLightList.s,Scene_CommandLightList,0x8012FDA4,0x22 +asm/non_matchings/code/z_scene/Scene_CommandPathList.s,Scene_CommandPathList,0x8012FE2C,0xC +asm/non_matchings/code/z_scene/Scene_CommandTransiActorList.s,Scene_CommandTransiActorList,0x8012FE5C,0x18 asm/non_matchings/code/z_scene/Door_InitContext.s,Door_InitContext,0x8012FEBC,0x4 -asm/non_matchings/code/z_scene/Scene_HeaderCmdEnvLightSettings.s,Scene_HeaderCmdEnvLightSettings,0x8012FECC,0x11 +asm/non_matchings/code/z_scene/Scene_CommandEnvLightSettings.s,Scene_CommandEnvLightSettings,0x8012FECC,0x11 asm/non_matchings/code/z_scene/Scene_LoadAreaTextures.s,Scene_LoadAreaTextures,0x8012FF10,0x1F -asm/non_matchings/code/z_scene/Scene_HeaderCmdSkyboxSettings.s,Scene_HeaderCmdSkyboxSettings,0x8012FF8C,0x19 -asm/non_matchings/code/z_scene/Scene_HeaderCmdSkyboxDisables.s,Scene_HeaderCmdSkyboxDisables,0x8012FFF0,0xA -asm/non_matchings/code/z_scene/Scene_HeaderCmdTimeSettings.s,Scene_HeaderCmdTimeSettings,0x80130018,0xC9 -asm/non_matchings/code/z_scene/Scene_HeaderCmdWindSettings.s,Scene_HeaderCmdWindSettings,0x8013033C,0x19 -asm/non_matchings/code/z_scene/Scene_HeaderCmdExitList.s,Scene_HeaderCmdExitList,0x801303A0,0xC -asm/non_matchings/code/z_scene/Scene_HeaderCmd09.s,Scene_HeaderCmd09,0x801303D0,0x4 -asm/non_matchings/code/z_scene/Scene_HeaderCmdSoundSettings.s,Scene_HeaderCmdSoundSettings,0x801303E0,0x17 -asm/non_matchings/code/z_scene/Scene_HeaderCmdEchoSetting.s,Scene_HeaderCmdEchoSetting,0x8013043C,0x6 -asm/non_matchings/code/z_scene/Scene_HeaderCmdAltHeaderList.s,Scene_HeaderCmdAltHeaderList,0x80130454,0x1E -asm/non_matchings/code/z_scene/Scene_HeaderCmdCutsceneList.s,Scene_HeaderCmdCutsceneList,0x801304CC,0xD -asm/non_matchings/code/z_scene/Scene_HeaderCmdActorCutsceneList.s,Scene_HeaderCmdActorCutsceneList,0x80130500,0x10 -asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMap.s,Scene_HeaderCmdMiniMap,0x80130540,0xE -asm/non_matchings/code/z_scene/Scene_HeaderCmd1D.s,Scene_HeaderCmd1D,0x80130578,0x4 -asm/non_matchings/code/z_scene/Scene_HeaderCmdMiniMapCompassInfo.s,Scene_HeaderCmdMiniMapCompassInfo,0x80130588,0xA -asm/non_matchings/code/z_scene/Scene_HeaderCmdSetRegionVisitedFlag.s,Scene_HeaderCmdSetRegionVisitedFlag,0x801305B0,0x31 -asm/non_matchings/code/z_scene/Scene_HeaderCmdAnimatedMaterials.s,Scene_HeaderCmdAnimatedMaterials,0x80130674,0xC +asm/non_matchings/code/z_scene/Scene_CommandSkyboxSettings.s,Scene_CommandSkyboxSettings,0x8012FF8C,0x19 +asm/non_matchings/code/z_scene/Scene_CommandSkyboxDisables.s,Scene_CommandSkyboxDisables,0x8012FFF0,0xA +asm/non_matchings/code/z_scene/Scene_CommandTimeSettings.s,Scene_CommandTimeSettings,0x80130018,0xC9 +asm/non_matchings/code/z_scene/Scene_CommandWindSettings.s,Scene_CommandWindSettings,0x8013033C,0x19 +asm/non_matchings/code/z_scene/Scene_CommandExitList.s,Scene_CommandExitList,0x801303A0,0xC +asm/non_matchings/code/z_scene/Scene_Command09.s,Scene_Command09,0x801303D0,0x4 +asm/non_matchings/code/z_scene/Scene_CommandSoundSettings.s,Scene_CommandSoundSettings,0x801303E0,0x17 +asm/non_matchings/code/z_scene/Scene_CommandEchoSetting.s,Scene_CommandEchoSetting,0x8013043C,0x6 +asm/non_matchings/code/z_scene/Scene_CommandAltHeaderList.s,Scene_CommandAltHeaderList,0x80130454,0x1E +asm/non_matchings/code/z_scene/Scene_CommandCutsceneList.s,Scene_CommandCutsceneList,0x801304CC,0xD +asm/non_matchings/code/z_scene/Scene_CommandActorCutsceneList.s,Scene_CommandActorCutsceneList,0x80130500,0x10 +asm/non_matchings/code/z_scene/Scene_CommandMiniMap.s,Scene_CommandMiniMap,0x80130540,0xE +asm/non_matchings/code/z_scene/Scene_Command1D.s,Scene_Command1D,0x80130578,0x4 +asm/non_matchings/code/z_scene/Scene_CommandMiniMapCompassInfo.s,Scene_CommandMiniMapCompassInfo,0x80130588,0xA +asm/non_matchings/code/z_scene/Scene_CommandSetRegionVisitedFlag.s,Scene_CommandSetRegionVisitedFlag,0x801305B0,0x31 +asm/non_matchings/code/z_scene/Scene_CommandAnimatedMaterials.s,Scene_CommandAnimatedMaterials,0x80130674,0xC asm/non_matchings/code/z_scene/Scene_SetExitFade.s,Scene_SetExitFade,0x801306A4,0x11 -asm/non_matchings/code/z_scene/Scene_ProcessHeader.s,Scene_ProcessHeader,0x801306E8,0x20 +asm/non_matchings/code/z_scene/Scene_ExecuteCommands.s,Scene_ExecuteCommands,0x801306E8,0x20 asm/non_matchings/code/z_scene/Entrance_Create.s,Entrance_Create,0x80130768,0x7 asm/non_matchings/code/z_scene/Entrance_CreateFromSpawn.s,Entrance_CreateFromSpawn,0x80130784,0xF asm/non_matchings/code/z_scene_proc/Scene_Draw.s,Scene_Draw,0x801307C0,0xD @@ -2546,7 +2546,7 @@ asm/non_matchings/code/z_play/func_80169ECC.s,func_80169ECC,0x80169ECC,0xC asm/non_matchings/code/z_play/func_80169EFC.s,func_80169EFC,0x80169EFC,0x1F asm/non_matchings/code/z_play/func_80169F78.s,func_80169F78,0x80169F78,0x19 asm/non_matchings/code/z_play/func_80169FDC.s,func_80169FDC,0x80169FDC,0x8 -asm/non_matchings/code/z_play/func_80169FFC.s,func_80169FFC,0x80169FFC,0x8 +asm/non_matchings/code/z_play/Play_CamIsNotFixed.s,Play_CamIsNotFixed,0x80169FFC,0x8 asm/non_matchings/code/z_play/FrameAdvance_IsEnabled.s,FrameAdvance_IsEnabled,0x8016A01C,0x4 asm/non_matchings/code/z_play/func_8016A02C.s,func_8016A02C,0x8016A02C,0x20 asm/non_matchings/code/z_play/Play_IsUnderwater.s,Play_IsUnderwater,0x8016A0AC,0x2F @@ -2593,7 +2593,7 @@ asm/non_matchings/code/PreRender/PreRender_ApplyFiltersSlowlyInit.s,PreRender_Ap asm/non_matchings/code/PreRender/PreRender_ApplyFiltersSlowlyDestroy.s,PreRender_ApplyFiltersSlowlyDestroy,0x80172078,0x13 asm/non_matchings/code/PreRender/func_801720C4.s,func_801720C4,0x801720C4,0xE asm/non_matchings/code/PreRender/func_801720FC.s,func_801720FC,0x801720FC,0x197 -asm/non_matchings/code/PreRender/func_80172758.s,func_80172758,0x80172758,0x26 +asm/non_matchings/code/PreRender/Prerender_DrawBackground2D.s,Prerender_DrawBackground2D,0x80172758,0x26 asm/non_matchings/code/TwoHeadGfxArena/THGA_Ct.s,THGA_Ct,0x801727F0,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_Dt.s,THGA_Dt,0x80172810,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_IsCrash.s,THGA_IsCrash,0x80172830,0x8 From f3d2c56d1deed7194c77909ee41ed5b8ef3ef8a2 Mon Sep 17 00:00:00 2001 From: hayden Date: Thu, 23 Mar 2023 15:25:54 -0500 Subject: [PATCH 05/29] Updated function names in ovl_En_Bom & added documentation from OoT (#1219) * Updated function names in ovl_En_Bom & added documentation from OoT * Renamed BombType struct members * Updated instances of BOMB_BODY * Updated more instances of BombType --------- Co-authored-by: swinginman --- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 94 +++++++++++-------- src/overlays/actors/ovl_En_Bom/z_en_bom.h | 8 +- src/overlays/actors/ovl_En_Famos/z_en_famos.c | 2 +- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 2 +- tools/disasm/functions.txt | 8 +- 5 files changed, 63 insertions(+), 51 deletions(-) diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 8532f8be9..bdc59540b 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -17,11 +17,12 @@ void EnBom_Destroy(Actor* thisx, PlayState* play); void EnBom_Update(Actor* thisx, PlayState* play); void EnBom_Draw(Actor* thisx, PlayState* play); -void func_80871058(EnBom* this, PlayState* play); -void func_808714D4(EnBom* this, PlayState* play); +void EnBom_Move(EnBom* this, PlayState* play); +void EnBom_WaitForRelease(EnBom* this, PlayState* play); + void func_80872648(PlayState* play, Vec3f* arg1); void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 arg4); -void func_80872BC0(PlayState* play, s32 arg1); +void EnBom_DrawKeg(PlayState* play, s32 arg1); typedef struct { /* 0x00 */ Vec3f pos; @@ -173,11 +174,11 @@ void EnBom_Init(Actor* thisx, PlayState* play) { this->actor.flags |= ACTOR_FLAG_100000; if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = func_808714D4; + this->actionFunc = EnBom_WaitForRelease; this->actor.room = -1; Actor_SetScale(&this->actor, enBomScales[this->isPowderKeg]); } else { - this->actionFunc = func_80871058; + this->actionFunc = EnBom_Move; gSaveContext.powderKegTimer = 0; } } @@ -192,15 +193,16 @@ void EnBom_Destroy(Actor* thisx, PlayState* play) { } } -void func_80871058(EnBom* this, PlayState* play) { +void EnBom_Move(EnBom* this, PlayState* play) { static Vec3f D_80872E68[] = { { 2.0f, -6.0f, -0.3f }, { 1.5f, -5.0f, -0.6f }, { 0.2f, -6.0f, -0.1f }, }; + // if bomb has a parent actor, the bomb hasnt been released yet if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = func_808714D4; + this->actionFunc = EnBom_WaitForRelease; this->actor.room = -1; return; } @@ -209,6 +211,7 @@ void func_80871058(EnBom* this, PlayState* play) { this->actor.velocity.y = -this->actor.velocity.y; } + // rebound bomb off the wall it hits if ((this->actor.speed != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { s16 yDiff = BINANG_SUB(this->actor.wallYaw, this->actor.world.rot.y); @@ -298,9 +301,10 @@ void func_80871058(EnBom* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } -void func_808714D4(EnBom* this, PlayState* play) { +void EnBom_WaitForRelease(EnBom* this, PlayState* play) { + // if parent is NULL bomb has been released if (Actor_HasNoParent(&this->actor, play)) { - this->actionFunc = func_80871058; + this->actionFunc = EnBom_Move; this->actor.room = play->roomCtx.curRoom.num; this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; @@ -308,7 +312,7 @@ void func_808714D4(EnBom* this, PlayState* play) { if (this->isPowderKeg) { gSaveContext.powderKegTimer = 0; } - func_80871058(this, play); + EnBom_Move(this, play); } else { Math_Vec3f_ToVec3s(&this->actor.home.rot, &this->actor.parent->world.pos); if (this->isPowderKeg) { @@ -318,7 +322,7 @@ void func_808714D4(EnBom* this, PlayState* play) { Math_ScaledStepToS(&this->unk_1FA, 0, 2000); } -void func_808715B8(EnBom* this, PlayState* play) { +void EnBom_Explode(EnBom* this, PlayState* play) { static s16 D_80872E8C[] = { 100, 200 }; static Color_RGBA8 D_80872E90 = { 185, 140, 70, 255 }; static Color_RGBA8 D_80872E94 = { 255, 255, 255, 255 }; @@ -347,7 +351,7 @@ void func_808715B8(EnBom* this, PlayState* play) { this->collider2.base.atFlags &= ~OC1_TYPE_1; } - if (this->actor.params == ENBOM_1) { + if (this->actor.params == BOMB_TYPE_EXPLOSION) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); } @@ -423,12 +427,12 @@ static s16 D_80872E98[] = { 3, 5 }; static s16 D_80872E9C[] = { 10, 15 }; void EnBom_Update(Actor* thisx, PlayState* play) { - Vec3f spA4 = { 0.0f, 0.0f, 0.0f }; - Vec3f sp98 = { 0.0f, 0.1f, 0.0f }; - Vec3f sp8C = { 0.0f, 0.0f, 0.0f }; - Vec3f sp80; - Vec3f sp74 = { 0.0f, 0.6f, 0.0f }; - Color_RGBA8 sp70 = { 255, 255, 255, 255 }; + Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; + Vec3f bomb2Accel = { 0.0f, 0.1f, 0.0f }; // unused + Vec3f effAccel = { 0.0f, 0.0f, 0.0f }; + Vec3f effPos; + Vec3f dustAccel = { 0.0f, 0.6f, 0.0f }; + Color_RGBA8 dustColor = { 255, 255, 255, 255 }; EnBom* this = THIS; s32 pad; Player* player = GET_PLAYER(play); @@ -456,7 +460,7 @@ void EnBom_Update(Actor* thisx, PlayState* play) { } else { thisx->gravity = -1.2f; if (this->timer != 0) { - if (!this->isPowderKeg || (func_808715B8 == this->actionFunc) || !Play_InCsMode(play)) { + if (!this->isPowderKeg || (EnBom_Explode == this->actionFunc) || !Play_InCsMode(play)) { this->timer--; } } @@ -473,17 +477,18 @@ void EnBom_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, 0x1F); - if (thisx->params == ENBOM_0) { + if (thisx->params == BOMB_TYPE_BODY) { static Vec3us D_80872ED4[] = { { 40, 20, 100 }, { 300, 60, 600 }, }; Vec3us* sp60 = &D_80872ED4[this->isPowderKeg]; - sp74.y = 0.2f; - Math_Vec3f_Copy(&sp80, &thisx->home.pos); + // spawn spark effect on even frames + dustAccel.y = 0.2f; + Math_Vec3f_Copy(&effPos, &thisx->home.pos); if ((play->gameplayFrames % 2) == 0) { - EffectSsGSpk_SpawnFuse(play, thisx, &sp80, &spA4, &sp8C); + EffectSsGSpk_SpawnFuse(play, thisx, &effPos, &effVelocity, &effAccel); } if (this->isPowderKeg) { func_801A0810(&thisx->projectedPos, NA_SE_IT_BIG_BOMB_IGNIT - SFX_FLAG, @@ -494,22 +499,27 @@ void EnBom_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG); } - sp80.y += 3.0f; - func_800B0DE0(play, &sp80, &spA4, &sp74, &sp70, &sp70, 50, 5); + effPos.y += 3.0f; + func_800B0DE0(play, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 50, 5); if ((this->collider1.base.acFlags & AC_HIT) || ((this->collider1.base.ocFlags1 & OC1_HIT) && ((this->collider1.base.oc->category == ACTORCAT_ENEMY) || (this->collider1.base.oc->category == ACTORCAT_BOSS)))) { this->timer = 0; thisx->shape.rot.z = 0; - } else if ((this->timer > 100) && (Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f))) { - this->timer = 100; + } else { + // if a lit stick touches the bomb, set timer to 100 + // these bombs never have a timer over 70, so this isn't used + if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) { + this->timer = 100; + } } - sp74.y = 0.2f; - sp80 = thisx->world.pos; - sp80.y += 10.0f; + dustAccel.y = 0.2f; + effPos = thisx->world.pos; + effPos.y += 10.0f; + // double bomb flash speed and adjust red color at certain times during the countdown if ((this->timer == sp60->x) || (this->timer == sp60->y) || (this->timer == 3)) { thisx->shape.rot.z = 0; this->flashSpeedScale >>= 1; @@ -526,12 +536,12 @@ void EnBom_Update(Actor* thisx, PlayState* play) { } if (this->timer == 0) { - sp80 = thisx->world.pos; - sp80.y += 10.0f; + effPos = thisx->world.pos; + effPos.y += 10.0f; if (Actor_HasParent(thisx, play)) { - sp80.y += 30.0f; + effPos.y += 30.0f; } - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, sp80.x, sp80.y - 10.0f, sp80.z, 0, 0, 0, + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y - 10.0f, effPos.z, 0, 0, 0, this->isPowderKeg); func_800BC848(thisx, play, D_80872E98[this->isPowderKeg], D_80872E9C[this->isPowderKeg]); play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = @@ -539,10 +549,10 @@ void EnBom_Update(Actor* thisx, PlayState* play) { play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.ambientColor[1] = play->envCtx.lightSettings.ambientColor[2] = 250; Camera_AddQuake(&play->mainCamera, 2, 11, 8); - thisx->params = ENBOM_1; + thisx->params = BOMB_TYPE_EXPLOSION; this->timer = 10; thisx->flags |= (ACTOR_FLAG_20 | ACTOR_FLAG_100000); - this->actionFunc = func_808715B8; + this->actionFunc = EnBom_Explode; if (this->isPowderKeg) { gSaveContext.powderKegTimer = 0; Actor_PlaySfx(thisx, NA_SE_IT_BIG_BOMB_EXPLOSION); @@ -554,15 +564,17 @@ void EnBom_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(thisx, 20.0f); - if (thisx->params <= ENBOM_0) { + if (thisx->params <= BOMB_TYPE_BODY) { Collider_UpdateCylinder(thisx, &this->collider1); + + // if link is not holding the bomb anymore and bump conditions are met, subscribe to OC if (!Actor_HasParent(thisx, play) && (this->unk_1F8 != 0)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider1.base); } - if ((enBomScales[this->isPowderKeg] <= thisx->scale.x) && (thisx->params != ENBOM_1)) { + if ((enBomScales[this->isPowderKeg] <= thisx->scale.x) && (thisx->params != BOMB_TYPE_EXPLOSION)) { if (thisx->depthInWater >= 20.0f) { Vec3f sp54; @@ -600,7 +612,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if (this->actor.params == ENBOM_0) { + if (this->actor.params == BOMB_TYPE_BODY) { func_8012C28C(play->state.gfxCtx); Collider_UpdateSpheres(0, &this->collider2); @@ -644,7 +656,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_OPA_DISP++, gPowderKegGoronSkullDL); func_808726DC(play, &this->actor.home.pos, &sp58, &sp4C, this->timer); - func_80872BC0(play, this->timer); + EnBom_DrawKeg(play, this->timer); } } @@ -768,7 +780,7 @@ void func_808726DC(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, s32 a Math_Vec3f_Copy(arg1, &fuseSegmentPtr->pos); } -void func_80872BC0(PlayState* play, s32 arg1) { +void EnBom_DrawKeg(PlayState* play, s32 arg1) { s32 temp_s5; s32 i; PowderKegFuseSegment* fuseSegmentPtr = &sPowderKegFuseSegments[0]; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index 23218a183..bf568cd6a 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -11,10 +11,10 @@ typedef void (*EnBomActionFunc)(struct EnBom*, PlayState*); #define ENBOM_GETZ_80(thisx) ((thisx)->shape.rot.z & 0x80) #define ENBOM_GETZ_FF00(thisx) (((thisx)->shape.rot.z & 0xFF00) >> 8) -enum { - /* 0 */ ENBOM_0, - /* 1 */ ENBOM_1, -}; +typedef enum { + /* 0 */ BOMB_TYPE_BODY, + /* 1 */ BOMB_TYPE_EXPLOSION, +} BombType; typedef struct EnBom { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 1be1d1700..932d937ee 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -691,7 +691,7 @@ void EnFamos_DeathExplosion(EnFamos* this, PlayState* play) { if (this->stateTimer == 1) { EnBom* explosion = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, ENBOM_0); + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, 0, 0, 0, BOMB_TYPE_BODY); if (explosion != NULL) { explosion->timer = 0; // instant explosion } diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index 85df7e9d2..63ef35aab 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -740,7 +740,7 @@ void EnRat_Bounced(EnRat* this, PlayState* play) { void EnRat_Explode(EnRat* this, PlayState* play) { EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, ENBOM_0); + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_TYPE_BODY); if (bomb != NULL) { bomb->timer = 0; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 437840bc6..142c8f5bc 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -5098,14 +5098,14 @@ 0x808706E0:("EnOkuta_Draw",), 0x80870DB0:("EnBom_Init",), 0x80870FF8:("EnBom_Destroy",), - 0x80871058:("func_80871058",), - 0x808714D4:("func_808714D4",), - 0x808715B8:("func_808715B8",), + 0x80871058:("EnBom_Move",), + 0x808714D4:("EnBom_WaitForRelease",), + 0x808715B8:("EnBom_Explode",), 0x808719A8:("EnBom_Update",), 0x808722F4:("EnBom_Draw",), 0x80872648:("func_80872648",), 0x808726DC:("func_808726DC",), - 0x80872BC0:("func_80872BC0",), + 0x80872BC0:("EnBom_DrawKeg",), 0x80874810:("EnWallmas_Init",), 0x80874A28:("EnWallmas_Destroy",), 0x80874A88:("EnWallmas_Freeze",), From 147e4fcedca332070ca15dbc1db358ce2d42972c Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Fri, 24 Mar 2023 14:38:04 -0300 Subject: [PATCH 06/29] THA docs (#1177) * THA docs Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * format * namefixer * yada * remove zero pad comment * Update include/z64.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update include/thga.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * namefixer * bss * namefixer --------- Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- include/functions.h | 30 +---- include/tha.h | 28 +++++ include/thga.h | 33 +++++ include/z64.h | 16 +-- src/code/TwoHeadArena.c | 117 +++++++++++++----- src/code/TwoHeadGfxArena.c | 102 ++++++++++----- src/code/game.c | 16 +-- src/code/graph.c | 2 +- src/code/sched.c | 1 - src/code/sys_matrix.c | 2 +- src/code/z_bgcheck.c | 14 +-- src/code/z_debug_mode.c | 2 +- src/code/z_effect_soft_sprite.c | 2 +- src/code/z_kaleido_manager.c | 2 +- src/code/z_map_exp.c | 2 +- src/code/z_message.c | 2 +- src/code/z_parameter.c | 6 +- src/code/z_play.c | 8 +- src/code/z_room.c | 2 +- src/code/z_scene.c | 4 +- src/code/z_sram_NES.c | 2 +- src/code/z_vr_box.c | 6 +- src/overlays/actors/ovl_En_Twig/z_en_twig.c | 6 +- .../gamestates/ovl_daytelop/z_daytelop.c | 4 +- src/overlays/gamestates/ovl_title/z_title.c | 2 +- tools/disasm/functions.txt | 40 +++--- tools/namefixer.py | 17 +++ tools/sizes/code_functions.csv | 40 +++--- 28 files changed, 321 insertions(+), 187 deletions(-) create mode 100644 include/tha.h create mode 100644 include/thga.h diff --git a/include/functions.h b/include/functions.h index d4ecd9579..1cef380f1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2363,35 +2363,7 @@ void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this); void func_801720C4(PreRender* this); void func_801720FC(PreRenderParams* params, Gfx** gfxp); void Prerender_DrawBackground2D(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags); -void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size); -void THGA_Dt(TwoHeadGfxArena* thga); -u32 THGA_IsCrash(TwoHeadGfxArena* thga); -void THGA_Init(TwoHeadGfxArena* thga); -s32 THGA_GetSize(TwoHeadGfxArena* thga); -Gfx* THGA_GetHead(TwoHeadGfxArena* thga); -void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* start); -Gfx* THGA_GetTail(TwoHeadGfxArena* thga); -Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count); -Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga); -Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga); -Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, size_t size); -Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count); -Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga); -Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count); -Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga); -void* THA_GetHead(TwoHeadArena* tha); -void THA_SetHead(TwoHeadArena* tha, void* start); -void* THA_GetTail(TwoHeadArena* tha); -void* THA_AllocStart(TwoHeadArena* tha, size_t size); -void* THA_AllocStart1(TwoHeadArena* tha); -void* THA_AllocEnd(TwoHeadArena* tha, size_t size); -void* THA_AllocEndAlign16(TwoHeadArena* tha, size_t size); -void* THA_AllocEndAlign(TwoHeadArena* tha, size_t size, u32 mask); -s32 THA_GetSize(TwoHeadArena* tha); -u32 THA_IsCrash(TwoHeadArena* tha); -void THA_Init(TwoHeadArena* tha); -void THA_Ct(TwoHeadArena* tha, void* ptr, size_t size); -void THA_Dt(TwoHeadArena* tha); + void AudioMgr_StopAllSfxExceptSystem(void); void func_80172C30(AudioMgr* audioMgr); void AudioMgr_HandleRetrace(AudioMgr* audioMgr); diff --git a/include/tha.h b/include/tha.h new file mode 100644 index 000000000..805d421f9 --- /dev/null +++ b/include/tha.h @@ -0,0 +1,28 @@ +#ifndef THA_H +#define THA_H + +#include "ultra64.h" +#include "libc/stdint.h" + +typedef struct TwoHeadArena { + /* 0x0 */ size_t size; + /* 0x4 */ void* start; + /* 0x8 */ void* head; + /* 0xC */ void* tail; +} TwoHeadArena; // size = 0x10 + +void* THA_GetHead(TwoHeadArena* tha); +void THA_SetHead(TwoHeadArena* tha, void* newHead); +void* THA_GetTail(TwoHeadArena* tha); +void* THA_AllocHead(TwoHeadArena* tha, size_t size); +void* THA_AllocHeadByte(TwoHeadArena* tha); +void* THA_AllocTail(TwoHeadArena* tha, size_t size); +void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size); +void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask); +s32 THA_GetRemaining(TwoHeadArena* tha); +u32 THA_IsCrash(TwoHeadArena* tha); +void THA_Reset(TwoHeadArena* tha); +void THA_Init(TwoHeadArena* tha, void* start, size_t size); +void THA_Destroy(TwoHeadArena* tha); + +#endif diff --git a/include/thga.h b/include/thga.h new file mode 100644 index 000000000..351c36407 --- /dev/null +++ b/include/thga.h @@ -0,0 +1,33 @@ +#ifndef THGA_H +#define THGA_H + +#include "tha.h" + +typedef union TwoHeadGfxArena { + struct { // Same as TwoHeadArena, with different types and field names for the head and tail pointers + /* 0x0 */ size_t size; + /* 0x4 */ void* start; + /* 0x8 */ Gfx* p; + /* 0xC */ void* d; + }; + /* 0x0 */ TwoHeadArena tha; +} TwoHeadGfxArena; // size = 0x10 + +void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size); +void THGA_Destroy(TwoHeadGfxArena* thga); +u32 THGA_IsCrash(TwoHeadGfxArena* thga); +void THGA_Reset(TwoHeadGfxArena* thga); +s32 THGA_GetRemaining(TwoHeadGfxArena* thga); +Gfx* THGA_GetHead(TwoHeadGfxArena* thga); +void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* newHead); +void* THGA_GetTail(TwoHeadGfxArena* thga); +Gfx* THGA_AllocDisplayList(TwoHeadGfxArena* thga, size_t num); +Gfx* THGA_AllocGfx(TwoHeadGfxArena* thga); +Gfx* THGA_AllocGfx2(TwoHeadGfxArena* thga); +void* THGA_AllocTail(TwoHeadGfxArena* thga, size_t size); +Mtx* THGA_AllocMtxArray(TwoHeadGfxArena* thga, size_t num); +Mtx* THGA_AllocMtx(TwoHeadGfxArena* thga); +Vtx* THGA_AllocVtxArray(TwoHeadGfxArena* thga, size_t num); +Vtx* THGA_AllocVtx(TwoHeadGfxArena* thga); + +#endif diff --git a/include/z64.h b/include/z64.h index 34be175f4..043219fdb 100644 --- a/include/z64.h +++ b/include/z64.h @@ -25,6 +25,8 @@ #include "gfxprint.h" #include "sys_matrix.h" +#include "tha.h" +#include "thga.h" #include "z64actor.h" #include "z64animation.h" #include "z64audio.h" @@ -115,20 +117,6 @@ typedef struct { /* 0x8 */ void* end; } PolygonType2; // size = 0xC -typedef struct { - /* 0x0 */ u32 size; - /* 0x4 */ void* bufp; - /* 0x8 */ void* head; - /* 0xC */ void* tail; -} TwoHeadArena; // size = 0x10 - -typedef struct { - /* 0x0 */ u32 size; - /* 0x4 */ Gfx* bufp; - /* 0x8 */ Gfx* p; - /* 0xC */ Gfx* d; -} TwoHeadGfxArena; // size = 0x10 - typedef struct { /* 0x000 */ Gfx taskStart[9]; /* 0x048 */ Gfx clearZBuffer[8]; // original name: clear_zb_dl diff --git a/src/code/TwoHeadArena.c b/src/code/TwoHeadArena.c index 83d5be3d1..a476c3d74 100644 --- a/src/code/TwoHeadArena.c +++ b/src/code/TwoHeadArena.c @@ -1,79 +1,136 @@ -#include "global.h" +/** + * @file TwoHeadArena.c + * + * This file implements a simple general purpose double-ended stack allocator. + * + * A double-ended stack allocator accepts allocations at either the "head" or "tail" of its allotted memory region. + * While in general this type of allocator could accept deallocations on the most recently allocated block at either + * end, this implementation does not support any individual deallocations; the only provided way to deallocate anything + * is to reset the entire arena, deallocating everything. This scheme is most applicable to allocating similar data + * with identical lifetime. + */ + +#include "tha.h" +#include "alignment.h" +#include "functions.h" void* THA_GetHead(TwoHeadArena* tha) { return tha->head; } -void THA_SetHead(TwoHeadArena* tha, void* start) { - tha->head = start; +void THA_SetHead(TwoHeadArena* tha, void* newHead) { + tha->head = newHead; } void* THA_GetTail(TwoHeadArena* tha) { return tha->tail; } -void* THA_AllocStart(TwoHeadArena* tha, size_t size) { +/** + * Allocates to the head of the Two Head Arena. The allocation will not have any alignment guarantees. + */ +void* THA_AllocHead(TwoHeadArena* tha, size_t size) { void* start = tha->head; - tha->head = (u32)tha->head + size; + tha->head = (u8*)tha->head + size; return start; } -void* THA_AllocStart1(TwoHeadArena* tha) { - return THA_AllocStart(tha, 1); +void* THA_AllocHeadByte(TwoHeadArena* tha) { + return THA_AllocHead(tha, 1); } -void* THA_AllocEnd(TwoHeadArena* tha, size_t size) { - u32 mask; +/** + * Allocates to the tail end of the Two Head Arena. The allocation will be aligned based on the size of the allocation. + * All allocations of 16 bytes or more will be aligned to 16-bytes. Otherwise, the alignment will be the largest power + * of 2 for which the size is a multiple, in order to accommodate the alignment requirements of any data types that can + * fit within the allocation. + */ +void* THA_AllocTail(TwoHeadArena* tha, size_t size) { + uintptr_t mask; if (size >= 0x10) { - mask = ~0xF; + // Align 0x10 for allocations greater than 0x10 + mask = ALIGN_MASK(0x10); } else if (size & 1) { - mask = -1; + // No alignment for odd sizes + mask = ALIGN_MASK(1); } else if (size & 2) { - mask = ~0x1; + // Align 2 for multiples of 2 + mask = ALIGN_MASK(2); } else if (size & 4) { - mask = ~0x3; + // Align 4 for multiples of 4 + mask = ALIGN_MASK(4); + } else if (size & 8) { + // Align 8 for multiples of 8 + mask = ALIGN_MASK(8); } else { - mask = (size & 8) ? ~0x7 : -1; + mask = ALIGN_MASK(1); } - tha->tail = (((u32)tha->tail & mask) - size) & mask; + tha->tail = (void*)((((uintptr_t)tha->tail & mask) - size) & mask); return tha->tail; } -void* THA_AllocEndAlign16(TwoHeadArena* tha, size_t size) { - u32 mask = ~0xF; +/** + * Allocates to the tail end of the Two Head Arena with guaranteed 16-byte alignment. + */ +void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size) { + uintptr_t mask = ALIGN_MASK(0x10); - tha->tail = (((u32)tha->tail & mask) - size) & mask; + tha->tail = (void*)((((uintptr_t)tha->tail & mask) - size) & mask); return tha->tail; } -void* THA_AllocEndAlign(TwoHeadArena* tha, size_t size, u32 mask) { - tha->tail = (((u32)tha->tail & mask) - size) & mask; +/** + * Allocates to the tail end of the Two Head Arena using the provided mask to align the allocated region. + * + * @param tha Arena to allocate to + * @param size Size of the allocation + * @param mask Mask to use to align the allocated region. To align to n-bytes where n is a power of 2, use the + * ALIGN_MASK(n) macro + * + * @return Pointer to the start of the allocated block + */ +void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask) { + tha->tail = (void*)((((uintptr_t)tha->tail & mask) - size) & mask); return tha->tail; } -s32 THA_GetSize(TwoHeadArena* tha) { - return (u32)tha->tail - (u32)tha->head; +/** + * Gets the remaining size of the Two Head Arena + * + * @return Remaining size. A negative number indicates an overflow. + */ +s32 THA_GetRemaining(TwoHeadArena* tha) { + return (s32)((u8*)tha->tail - (u8*)tha->head); } +/** + * @return true if the Two Head Arena has overflowed, false otherwise + */ u32 THA_IsCrash(TwoHeadArena* tha) { - return THA_GetSize(tha) < 0; + return THA_GetRemaining(tha) < 0; } -void THA_Init(TwoHeadArena* tha) { - tha->head = tha->bufp; - tha->tail = (u32)tha->bufp + tha->size; +void THA_Reset(TwoHeadArena* tha) { + tha->head = tha->start; + tha->tail = (u8*)tha->start + tha->size; } -void THA_Ct(TwoHeadArena* tha, void* ptr, size_t size) { +/** + * Creates a new Two Head Arena at `start` with available size `size` + */ +void THA_Init(TwoHeadArena* tha, void* start, size_t size) { bzero(tha, sizeof(TwoHeadArena)); - tha->bufp = ptr; + tha->start = start; tha->size = size; - THA_Init(tha); + THA_Reset(tha); } -void THA_Dt(TwoHeadArena* tha) { +/** + * Destroys the Two Head Arena, no further allocations are possible + */ +void THA_Destroy(TwoHeadArena* tha) { bzero(tha, sizeof(TwoHeadArena)); } diff --git a/src/code/TwoHeadGfxArena.c b/src/code/TwoHeadGfxArena.c index 2f1629765..d40512efd 100644 --- a/src/code/TwoHeadGfxArena.c +++ b/src/code/TwoHeadGfxArena.c @@ -1,65 +1,105 @@ -#include "global.h" +/** + * @file TwoHeadGfxArena.c + * + * This file implements a particular use of the double-ended stack allocator from TwoHeadArena.c for graphics data. + * + * Display list commands are allocated from the head while other graphics data such as matrices and vertices are + * allocated from the tail end. + * + * @see TwoHeadArena.c + */ -void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size) { - THA_Ct((TwoHeadArena*)thga, start, size); +#include "thga.h" +#include "alignment.h" +#include "functions.h" + +void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size) { + THA_Init(&thga->tha, start, size); } -void THGA_Dt(TwoHeadGfxArena* thga) { - THA_Dt((TwoHeadArena*)thga); +void THGA_Destroy(TwoHeadGfxArena* thga) { + THA_Destroy(&thga->tha); } u32 THGA_IsCrash(TwoHeadGfxArena* thga) { - return THA_IsCrash((TwoHeadArena*)thga); + return THA_IsCrash(&thga->tha); } -void THGA_Init(TwoHeadGfxArena* thga) { - THA_Init((TwoHeadArena*)thga); +void THGA_Reset(TwoHeadGfxArena* thga) { + THA_Reset(&thga->tha); } -s32 THGA_GetSize(TwoHeadGfxArena* thga) { - return THA_GetSize((TwoHeadArena*)thga); +s32 THGA_GetRemaining(TwoHeadGfxArena* thga) { + return THA_GetRemaining(&thga->tha); } Gfx* THGA_GetHead(TwoHeadGfxArena* thga) { - return THA_GetHead((TwoHeadArena*)thga); + return THA_GetHead(&thga->tha); } -void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* start) { - THA_SetHead((TwoHeadArena*)thga, start); +void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* newHead) { + THA_SetHead(&thga->tha, newHead); } -Gfx* THGA_GetTail(TwoHeadGfxArena* thga) { - return THA_GetTail((TwoHeadArena*)thga); +void* THGA_GetTail(TwoHeadGfxArena* thga) { + return THA_GetTail(&thga->tha); } -Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count) { - return THA_AllocStart((TwoHeadArena*)thga, count * 8); +/** + * Allocates a display list of `num` Gfx commands to the head of the Two Head Gfx Arena. + */ +Gfx* THGA_AllocDisplayList(TwoHeadGfxArena* thga, size_t num) { + return THA_AllocHead(&thga->tha, num * sizeof(Gfx)); } -Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga) { - return THGA_AllocStartArray8(thga, 1); +/** + * Allocates a single Gfx command to the head of the Two Head Gfx Arena. + */ +Gfx* THGA_AllocGfx(TwoHeadGfxArena* thga) { + return THGA_AllocDisplayList(thga, 1); } -Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga) { - return THGA_AllocStart8(thga); +/** + * Identical to `THGA_AllocGfx` + * + * @see THGA_AllocGfx + */ +Gfx* THGA_AllocGfx2(TwoHeadGfxArena* thga) { + return THGA_AllocGfx(thga); } -Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, size_t size) { - return THA_AllocEnd((TwoHeadArena*)thga, size); +/** + * Allocates to the end of the Two Head Gfx Arena. Intended for data complementary to the display lists such as + * matrices and vertices that are only needed for a single graphics task. + */ +void* THGA_AllocTail(TwoHeadGfxArena* thga, size_t size) { + return THA_AllocTail(&thga->tha, size); } -Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count) { - return THGA_AllocEnd(thga, count * 0x40); +/** + * Allocates `num` matrices to the tail end of the Two Head Gfx Arena. + */ +Mtx* THGA_AllocMtxArray(TwoHeadGfxArena* thga, size_t num) { + return THGA_AllocTail(thga, num * sizeof(Mtx)); } -Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga) { - return THGA_AllocEnd(thga, 0x40); +/** + * Allocates a matrix to the tail end of the Two Head Gfx Arena. + */ +Mtx* THGA_AllocMtx(TwoHeadGfxArena* thga) { + return THGA_AllocTail(thga, sizeof(Mtx)); } -Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count) { - return THGA_AllocEnd(thga, count * 0x10); +/** + * Allocates `num` vertices to the tail end of the Two Head Gfx Arena. + */ +Vtx* THGA_AllocVtxArray(TwoHeadGfxArena* thga, u32 num) { + return THGA_AllocTail(thga, num * sizeof(Vtx)); } -Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga) { - return THGA_AllocEnd(thga, 0x10); +/** + * Allocates a vertex to the tail end of the Two Head Gfx Arena. + */ +Vtx* THGA_AllocVtx(TwoHeadGfxArena* thga) { + return THGA_AllocTail(thga, sizeof(Vtx)); } diff --git a/src/code/game.c b/src/code/game.c index f3c381e68..4a4be5291 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -158,11 +158,11 @@ void GameState_InitArena(GameState* gameState, size_t size) { void* buf = GameAlloc_Malloc(alloc, size); if (buf) { - THA_Ct(&gameState->heap, buf, size); + THA_Init(&gameState->heap, buf, size); return; } - THA_Ct(&gameState->heap, NULL, 0); + THA_Init(&gameState->heap, NULL, 0); __assert("../game.c", 1035); } @@ -174,9 +174,9 @@ void GameState_Realloc(GameState* gameState, size_t size) { size_t bytesAllocated; void* heapStart; - heapStart = gameState->heap.bufp; + heapStart = gameState->heap.start; alloc = &gameState->alloc; - THA_Dt(&gameState->heap); + THA_Destroy(&gameState->heap); GameAlloc_Free(alloc, heapStart); SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated); size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size); @@ -185,9 +185,9 @@ void GameState_Realloc(GameState* gameState, size_t size) { } if ((gameArena = GameAlloc_Malloc(alloc, size)) != NULL) { - THA_Ct(&gameState->heap, gameArena, size); + THA_Init(&gameState->heap, gameArena, size); } else { - THA_Ct(&gameState->heap, 0, 0); + THA_Init(&gameState->heap, 0, 0); __assert("../game.c", 1074); } } @@ -240,7 +240,7 @@ void GameState_Destroy(GameState* gameState) { func_801420F4(&D_801F8020); VisMono_Destroy(&sMonoColors); func_80140900(&D_801F8048); - THA_Dt(&gameState->heap); + THA_Destroy(&gameState->heap); GameAlloc_Cleanup(&gameState->alloc); } @@ -257,7 +257,7 @@ u32 GameState_IsRunning(GameState* gameState) { } s32 GameState_GetArenaSize(GameState* gameState) { - return THA_GetSize(&gameState->heap); + return THA_GetRemaining(&gameState->heap); } s32 func_80173B48(GameState* gameState) { diff --git a/src/code/graph.c b/src/code/graph.c index 6cc8d7772..558f7d563 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -26,7 +26,7 @@ void Graph_FaultClient(void) { } void Graph_InitTHGA(TwoHeadGfxArena* arena, Gfx* buffer, s32 size) { - THGA_Ct(arena, buffer, size); + THGA_Init(arena, buffer, size); } void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) { diff --git a/src/code/sched.c b/src/code/sched.c index 5f9cdf236..927a48f66 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #define RSP_DONE_MSG 667 diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index f2ed19c38..63857676e 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -74,7 +74,7 @@ MtxF* sCurrentMatrix; //!< original name: "Matrix_now" * @remark original name: "new_Matrix" */ void Matrix_Init(GameState* gameState) { - sMatrixStack = THA_AllocEndAlign16(&gameState->heap, MATRIX_STACK_SIZE * sizeof(MtxF)); + sMatrixStack = THA_AllocTailAlign16(&gameState->heap, MATRIX_STACK_SIZE * sizeof(MtxF)); sCurrentMatrix = sMatrixStack; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 6d4414c38..c04fce680 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -140,7 +140,7 @@ void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list) { } void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes) { - list->tbl = (SSNode*)THA_AllocEndAlign(&play->state.heap, numNodes * sizeof(SSNode), -2); + list->tbl = (SSNode*)THA_AllocTailAlign(&play->state.heap, numNodes * sizeof(SSNode), -2); list->maxNodes = numNodes; list->count = 0; } @@ -1591,7 +1591,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader colCtx->subdivAmount.z = 16; } } - colCtx->lookupTbl = THA_AllocEndAlign( + colCtx->lookupTbl = THA_AllocTailAlign( &play->state.heap, colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1); if (colCtx->lookupTbl == NULL) { @@ -2478,8 +2478,8 @@ void SSNodeList_Init(SSNodeList* this) { void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) { this->max = tblMax; this->count = 0; - this->tbl = THA_AllocEndAlign(&play->state.heap, tblMax * sizeof(SSNode), -2); - this->polyCheckTbl = THA_AllocEndAlign16(&play->state.heap, numPolys * sizeof(u8)); + this->tbl = THA_AllocTailAlign(&play->state.heap, tblMax * sizeof(SSNode), -2); + this->polyCheckTbl = THA_AllocTailAlign16(&play->state.heap, numPolys * sizeof(u8)); if (this->polyCheckTbl == NULL) { sprintf(D_801ED950, "this->polygon_check == NULL(game_alloc() MemoryAllocationError.)\n"); @@ -2621,7 +2621,7 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) { * Allocate dyna.polyList */ void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) { - *polyList = THA_AllocEndAlign(&play->state.heap, numPolys * sizeof(CollisionPoly), -2); + *polyList = THA_AllocTailAlign(&play->state.heap, numPolys * sizeof(CollisionPoly), -2); } /** @@ -2635,7 +2635,7 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) { * Allocate dyna.vtxList */ void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) { - *vtxList = THA_AllocEndAlign(&play->state.heap, numVtx * sizeof(Vec3s), -2); + *vtxList = THA_AllocTailAlign(&play->state.heap, numVtx * sizeof(Vec3s), -2); } /** @@ -2650,7 +2650,7 @@ void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList) { * Allocate dyna.waterBoxList */ void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) { - waterBoxList->boxes = THA_AllocEndAlign(&play->state.heap, numWaterBoxes * sizeof(WaterBox), -2); + waterBoxList->boxes = THA_AllocTailAlign(&play->state.heap, numWaterBoxes * sizeof(WaterBox), -2); } /** diff --git a/src/code/z_debug_mode.c b/src/code/z_debug_mode.c index a1b464463..a40bd29bd 100644 --- a/src/code/z_debug_mode.c +++ b/src/code/z_debug_mode.c @@ -128,7 +128,7 @@ void Debug_DrawText(GraphicsContext* gfxCtx) { Gfx* gfxHead; GfxPrint printer; - if (THGA_GetSize(&gfxCtx->polyOpa) >= 0x2800) { + if (THGA_GetRemaining(&gfxCtx->polyOpa) >= 0x2800) { GfxPrint_Init(&printer); OPEN_DISPS(gfxCtx); diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index ea8a546d6..775b68f01 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -8,7 +8,7 @@ void EffectSS_Init(PlayState* play, s32 numEntries) { EffectSs* effectsSs; EffectSsOverlay* overlay; - sEffectSsInfo.data_table = (EffectSs*)THA_AllocEndAlign16(&play->state.heap, numEntries * sizeof(EffectSs)); + sEffectSsInfo.data_table = (EffectSs*)THA_AllocTailAlign16(&play->state.heap, numEntries * sizeof(EffectSs)); sEffectSsInfo.searchIndex = 0; sEffectSsInfo.size = numEntries; diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 3771de9c0..0d9f30a08 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -65,7 +65,7 @@ void KaleidoManager_Init(PlayState* play) { } } - sKaleidoAreaPtr = THA_AllocEndAlign16(&play->state.heap, largestSize); + sKaleidoAreaPtr = THA_AllocTailAlign16(&play->state.heap, largestSize); gKaleidoMgrCurOvl = NULL; Fault_AddAddrConvClient(&sKaleidoMgrFaultAddrConvClient, KaleidoManager_FaultAddrConv, NULL); } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index ac78d1229..381387c5e 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -180,7 +180,7 @@ void Map_Init(PlayState* play) { func_80105C40(play->roomCtx.curRoom.num); interfaceCtx->unk_278 = -1; interfaceCtx->dungeonOrBossAreaMapIndex = -1; - interfaceCtx->mapSegment = THA_AllocEndAlign16(&play->state.heap, 0x1000); + interfaceCtx->mapSegment = THA_AllocTailAlign16(&play->state.heap, 0x1000); if (func_8010A2AC(play)) { gSaveContext.mapIndex = func_8010A238(play); return; diff --git a/src/code/z_message.c b/src/code/z_message.c index cc1e0c876..01e4a366d 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -572,7 +572,7 @@ void Message_Init(PlayState* play) { messageCtx->ocarinaAction = messageCtx->unk11FF2 = 0; messageCtx->unk1201E = 0xFF; View_Init(&messageCtx->view, play->state.gfxCtx); - messageCtx->unk11EF8 = THA_AllocEndAlign16(&play->state.heap, 0x13C00); + messageCtx->unk11EF8 = THA_AllocTailAlign16(&play->state.heap, 0x13C00); font = &play->msgCtx.font; Font_LoadOrderedFont(&play->msgCtx.font); font->unk_11D88 = 0; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index ca127a8b6..5f5440a2f 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -6006,16 +6006,16 @@ void Interface_Init(PlayState* play) { interfaceCtx->healthTimer = 200; parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static); - interfaceCtx->parameterSegment = THA_AllocEndAlign16(&play->state.heap, parameterStaticSize); + interfaceCtx->parameterSegment = THA_AllocTailAlign16(&play->state.heap, parameterStaticSize); DmaMgr_SendRequest0(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize); - interfaceCtx->doActionSegment = THA_AllocEndAlign16(&play->state.heap, 0xC90); + interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.heap, 0xC90); DmaMgr_SendRequest0(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300); DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180); Interface_NewDay(play, CURRENT_DAY); - interfaceCtx->iconItemSegment = THA_AllocEndAlign16(&play->state.heap, 0x4000); + interfaceCtx->iconItemSegment = THA_AllocTailAlign16(&play->state.heap, 0x4000); if (CUR_FORM_EQUIP(EQUIP_SLOT_B) < ITEM_F0) { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); diff --git a/src/code/z_play.c b/src/code/z_play.c index 5f8c197f2..52146a121 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1545,7 +1545,7 @@ void Play_GetFloorSurface(PlayState* this, MtxF* mtx, Vec3f* pos) { void* Play_LoadFile(PlayState* this, RomFile* entry) { size_t size = entry->vromEnd - entry->vromStart; - void* allocp = THA_AllocEndAlign16(&this->state.heap, size); + void* allocp = THA_AllocTailAlign16(&this->state.heap, size); DmaMgr_SendRequest0(allocp, entry->vromStart, size); @@ -2295,9 +2295,9 @@ void Play_Init(GameState* thisx) { D_801F6D4C->envColor.b = 0; D_801F6D4C->envColor.a = 0; EnvFlags_UnsetAll(this); - THA_GetSize(&this->state.heap); - zAllocSize = THA_GetSize(&this->state.heap); - zAlloc = (uintptr_t)THA_AllocEndAlign16(&this->state.heap, zAllocSize); + THA_GetRemaining(&this->state.heap); + zAllocSize = THA_GetRemaining(&this->state.heap); + zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.heap, zAllocSize); ZeldaArena_Init(((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc); //! @bug: Incorrect ALIGN16s Actor_InitContext(this, &this->actorCtx, this->linkActorEntry); diff --git a/src/code/z_room.c b/src/code/z_room.c index 3358bb300..369b2b0e5 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -530,7 +530,7 @@ size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx) { } } - roomCtx->roomMemPages[0] = THA_AllocEndAlign16(&play->state.heap, maxRoomSize); + roomCtx->roomMemPages[0] = THA_AllocTailAlign16(&play->state.heap, maxRoomSize); if (roomCtx->roomMemPages[0] == NULL) { __assert("../z_room.c", 1078); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 13d93c515..1db125af2 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -48,7 +48,7 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) { for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = 0; } // clang-format on - objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocEndAlign16(&gameState->heap, spaceSize); + objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocTailAlign16(&gameState->heap, spaceSize); objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP); @@ -357,7 +357,7 @@ void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) { size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart; if (size != 0) { - play->roomCtx.unk74 = THA_AllocEndAlign16(&play->state.heap, size); + play->roomCtx.unk74 = THA_AllocTailAlign16(&play->state.heap, size); DmaMgr_SendRequest0(play->roomCtx.unk74, vromStart, size); } } diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 67f8bdda6..c32a76d76 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1600,7 +1600,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { if (gSaveContext.unk_3F3F) { - sramCtx->saveBuf = THA_AllocEndAlign16(&gameState->heap, SAVE_BUFFER_SIZE); + sramCtx->saveBuf = THA_AllocTailAlign16(&gameState->heap, SAVE_BUFFER_SIZE); sramCtx->status = 0; } } diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 4d44de0f9..911e3e757 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -294,15 +294,15 @@ void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) { Skybox_Setup(gameState, skyboxCtx, skyboxId); if (skyboxId != SKYBOX_NONE) { - skyboxCtx->dListBuf = THA_AllocEndAlign16(&gameState->heap, 0x3840); + skyboxCtx->dListBuf = THA_AllocTailAlign16(&gameState->heap, 0x3840); if (skyboxId == SKYBOX_CUTSCENE_MAP) { // Allocate enough space for the vertices for a 6 sided skybox (cube) - skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6); + skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6); func_80143148(skyboxCtx, 6); } else { // Allocate enough space for the vertices for a 5 sided skybox (bottom is missing) - skyboxCtx->roomVtx = THA_AllocEndAlign16(&gameState->heap, sizeof(Vtx) * 32 * 5); + skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->heap, sizeof(Vtx) * 32 * 5); func_80143148(skyboxCtx, 5); } } diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index 8573c956d..205b9d9cc 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -37,9 +37,9 @@ ActorInit En_Twig_InitVars = { (ActorFunc)EnTwig_Draw, }; -static s32 sCurrentRing; -static s16 sRingCount; -static s16 sRingNotCollected[25]; +s32 sCurrentRing; +s16 sRingCount; +s16 sRingNotCollected[25]; static CollisionHeader* sColHeaders[] = { NULL, diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index 201030862..a9e738561 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -213,11 +213,11 @@ void DayTelop_Noop(DayTelopState* this) { void DayTelop_LoadGraphics(DayTelopState* this) { size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static); - this->daytelopStaticFile = THA_AllocEndAlign16(&this->state.heap, segmentSize); + this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize); DmaMgr_SendRequest0(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize); segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static); - this->gameoverStaticFile = THA_AllocEndAlign16(&this->state.heap, segmentSize); + this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize); DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize); } diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index e31e31c7d..f3ee9102f 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -153,7 +153,7 @@ void ConsoleLogo_Init(GameState* thisx) { ConsoleLogoState* this = (ConsoleLogoState*)thisx; uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static); - this->staticSegment = THA_AllocEndAlign16(&this->state.heap, segmentSize); + this->staticSegment = THA_AllocTailAlign16(&this->state.heap, segmentSize); DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize); Game_SetFramerateDivisor(&this->state, 1); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 142c8f5bc..9957b3696 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -3080,35 +3080,35 @@ 0x801720C4:("func_801720C4",), 0x801720FC:("func_801720FC",), 0x80172758:("Prerender_DrawBackground2D",), - 0x801727F0:("THGA_Ct",), - 0x80172810:("THGA_Dt",), + 0x801727F0:("THGA_Init",), + 0x80172810:("THGA_Destroy",), 0x80172830:("THGA_IsCrash",), 0x80172850:("THGA_Init",), - 0x80172870:("THGA_GetSize",), + 0x80172870:("THGA_GetRemaining",), 0x80172890:("THGA_GetHead",), 0x801728B0:("THGA_SetHead",), 0x801728D0:("THGA_GetTail",), - 0x801728F0:("THGA_AllocStartArray8",), - 0x80172914:("THGA_AllocStart8",), - 0x80172934:("THGA_AllocStart8Wrapper",), - 0x80172954:("THGA_AllocEnd",), - 0x80172974:("THGA_AllocEndArray64",), - 0x80172998:("THGA_AllocEnd64",), - 0x801729B8:("THGA_AllocEndArray16",), - 0x801729DC:("THGA_AllocEnd16",), + 0x801728F0:("THGA_AllocDisplayList",), + 0x80172914:("THGA_AllocGfx",), + 0x80172934:("THGA_AllocGfx2",), + 0x80172954:("THGA_AllocTail",), + 0x80172974:("THGA_AllocMtxArray",), + 0x80172998:("THGA_AllocMtx",), + 0x801729B8:("THGA_AllocVtxArray",), + 0x801729DC:("THGA_AllocVtx",), 0x80172A00:("THA_GetHead",), 0x80172A0C:("THA_SetHead",), 0x80172A18:("THA_GetTail",), - 0x80172A24:("THA_AllocStart",), - 0x80172A38:("THA_AllocStart1",), - 0x80172A58:("THA_AllocEnd",), - 0x80172AC8:("THA_AllocEndAlign16",), - 0x80172AE8:("THA_AllocEndAlign",), - 0x80172B04:("THA_GetSize",), + 0x80172A24:("THA_AllocHead",), + 0x80172A38:("THA_AllocHeadByte",), + 0x80172A58:("THA_AllocTail",), + 0x80172AC8:("THA_AllocTailAlign16",), + 0x80172AE8:("THA_AllocTailAlign",), + 0x80172B04:("THA_GetRemaining",), 0x80172B18:("THA_IsCrash",), - 0x80172B3C:("THA_Init",), - 0x80172B58:("THA_Ct",), - 0x80172B9C:("THA_Dt",), + 0x80172B3C:("THA_Reset",), + 0x80172B58:("THA_Init",), + 0x80172B9C:("THA_Destroy",), 0x80172BC0:("AudioMgr_StopAllSfxExceptSystem",), 0x80172C30:("func_80172C30",), 0x80172C68:("AudioMgr_HandleRetrace",), diff --git a/tools/namefixer.py b/tools/namefixer.py index cb902dcb6..d8c1e8bb2 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -117,6 +117,23 @@ wordReplace = { "Actor_MarkForDeath": "Actor_Kill", "func_800B84D0": "Actor_ProcessTalkRequest", "func_8017D668": "Math3D_PointDistToLine2D", + + "THGA_GetSize": "THGA_GetRemaining", + "THGA_AllocStartArray8": "THGA_AllocDisplayList", + "THGA_AllocStart8": "THGA_AllocGfx", + "THGA_AllocStart8Wrapper": "THGA_AllocGfx2", + "THGA_AllocEnd": "THGA_AllocTail", + "THGA_AllocEndArray64": "THGA_AllocMtxArray", + "THGA_AllocEnd64": "THGA_AllocMtx", + "THGA_AllocEndArray16": "THGA_AllocVtxArray", + "THGA_AllocEnd16": "THGA_AllocVtx", + "THA_AllocStart": "THA_AllocHead", + "THA_AllocStart1": "THA_AllocHeadByte", + "THA_AllocEnd": "THA_AllocTail", + "THA_AllocEndAlign16": "THA_AllocTailAlign16", + "THA_AllocEndAlign": "THA_AllocTailAlign", + "THA_GetSize": "THA_GetRemaining", + "func_800BDFC0": "Gfx_DrawDListOpa", "func_800BE03C": "Gfx_DrawDListXlu", "func_800B6FC8": "Player_GetHeight", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 0f33e599d..2ec163e24 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2594,35 +2594,35 @@ asm/non_matchings/code/PreRender/PreRender_ApplyFiltersSlowlyDestroy.s,PreRender asm/non_matchings/code/PreRender/func_801720C4.s,func_801720C4,0x801720C4,0xE asm/non_matchings/code/PreRender/func_801720FC.s,func_801720FC,0x801720FC,0x197 asm/non_matchings/code/PreRender/Prerender_DrawBackground2D.s,Prerender_DrawBackground2D,0x80172758,0x26 -asm/non_matchings/code/TwoHeadGfxArena/THGA_Ct.s,THGA_Ct,0x801727F0,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_Dt.s,THGA_Dt,0x80172810,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_Init.s,THGA_Init,0x801727F0,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_Destroy.s,THGA_Destroy,0x80172810,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_IsCrash.s,THGA_IsCrash,0x80172830,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_Init.s,THGA_Init,0x80172850,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_GetSize.s,THGA_GetSize,0x80172870,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_GetRemaining.s,THGA_GetRemaining,0x80172870,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_GetHead.s,THGA_GetHead,0x80172890,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_SetHead.s,THGA_SetHead,0x801728B0,0x8 asm/non_matchings/code/TwoHeadGfxArena/THGA_GetTail.s,THGA_GetTail,0x801728D0,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocStartArray8.s,THGA_AllocStartArray8,0x801728F0,0x9 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocStart8.s,THGA_AllocStart8,0x80172914,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocStart8Wrapper.s,THGA_AllocStart8Wrapper,0x80172934,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEnd.s,THGA_AllocEnd,0x80172954,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEndArray64.s,THGA_AllocEndArray64,0x80172974,0x9 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEnd64.s,THGA_AllocEnd64,0x80172998,0x8 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEndArray16.s,THGA_AllocEndArray16,0x801729B8,0x9 -asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocEnd16.s,THGA_AllocEnd16,0x801729DC,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocDisplayList.s,THGA_AllocDisplayList,0x801728F0,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocGfx.s,THGA_AllocGfx,0x80172914,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocGfx2.s,THGA_AllocGfx2,0x80172934,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocTail.s,THGA_AllocTail,0x80172954,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocMtxArray.s,THGA_AllocMtxArray,0x80172974,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocMtx.s,THGA_AllocMtx,0x80172998,0x8 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocVtxArray.s,THGA_AllocVtxArray,0x801729B8,0x9 +asm/non_matchings/code/TwoHeadGfxArena/THGA_AllocVtx.s,THGA_AllocVtx,0x801729DC,0x9 asm/non_matchings/code/TwoHeadArena/THA_GetHead.s,THA_GetHead,0x80172A00,0x3 asm/non_matchings/code/TwoHeadArena/THA_SetHead.s,THA_SetHead,0x80172A0C,0x3 asm/non_matchings/code/TwoHeadArena/THA_GetTail.s,THA_GetTail,0x80172A18,0x3 -asm/non_matchings/code/TwoHeadArena/THA_AllocStart.s,THA_AllocStart,0x80172A24,0x5 -asm/non_matchings/code/TwoHeadArena/THA_AllocStart1.s,THA_AllocStart1,0x80172A38,0x8 -asm/non_matchings/code/TwoHeadArena/THA_AllocEnd.s,THA_AllocEnd,0x80172A58,0x1C -asm/non_matchings/code/TwoHeadArena/THA_AllocEndAlign16.s,THA_AllocEndAlign16,0x80172AC8,0x8 -asm/non_matchings/code/TwoHeadArena/THA_AllocEndAlign.s,THA_AllocEndAlign,0x80172AE8,0x7 -asm/non_matchings/code/TwoHeadArena/THA_GetSize.s,THA_GetSize,0x80172B04,0x5 +asm/non_matchings/code/TwoHeadArena/THA_AllocHead.s,THA_AllocHead,0x80172A24,0x5 +asm/non_matchings/code/TwoHeadArena/THA_AllocHeadByte.s,THA_AllocHeadByte,0x80172A38,0x8 +asm/non_matchings/code/TwoHeadArena/THA_AllocTail.s,THA_AllocTail,0x80172A58,0x1C +asm/non_matchings/code/TwoHeadArena/THA_AllocTailAlign16.s,THA_AllocTailAlign16,0x80172AC8,0x8 +asm/non_matchings/code/TwoHeadArena/THA_AllocTailAlign.s,THA_AllocTailAlign,0x80172AE8,0x7 +asm/non_matchings/code/TwoHeadArena/THA_GetRemaining.s,THA_GetRemaining,0x80172B04,0x5 asm/non_matchings/code/TwoHeadArena/THA_IsCrash.s,THA_IsCrash,0x80172B18,0x9 -asm/non_matchings/code/TwoHeadArena/THA_Init.s,THA_Init,0x80172B3C,0x7 -asm/non_matchings/code/TwoHeadArena/THA_Ct.s,THA_Ct,0x80172B58,0x11 -asm/non_matchings/code/TwoHeadArena/THA_Dt.s,THA_Dt,0x80172B9C,0x9 +asm/non_matchings/code/TwoHeadArena/THA_Reset.s,THA_Reset,0x80172B3C,0x7 +asm/non_matchings/code/TwoHeadArena/THA_Init.s,THA_Init,0x80172B58,0x11 +asm/non_matchings/code/TwoHeadArena/THA_Destroy.s,THA_Destroy,0x80172B9C,0x9 asm/non_matchings/code/audio_stop_all_sfx/AudioMgr_StopAllSfxExceptSystem.s,AudioMgr_StopAllSfxExceptSystem,0x80172BC0,0x1C asm/non_matchings/code/audio_thread_manager/func_80172C30.s,func_80172C30,0x80172C30,0xE asm/non_matchings/code/audio_thread_manager/AudioMgr_HandleRetrace.s,AudioMgr_HandleRetrace,0x80172C68,0x91 From 045c3537a9bae4fa7fb33985c7834f3c956d42f1 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Fri, 24 Mar 2023 15:29:54 -0300 Subject: [PATCH 07/29] `z64game_over.h` (#1183) * z64game_over.h * format * Update include/z64game_over.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- include/functions.h | 3 -- include/z64.h | 17 +---------- include/z64game_over.h | 30 +++++++++++++++++++ include/z64shrink_window.h | 2 +- src/code/z_game_over.c | 20 +++++++++---- .../ovl_kaleido_scope/z_kaleido_scope_NES.c | 2 +- 6 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 include/z64game_over.h diff --git a/include/functions.h b/include/functions.h index 1cef380f1..bac7712b2 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2989,9 +2989,6 @@ u8 func_801A982C(void); // void func_801A99B8(void); // void func_801A9A74(void); -void GameOver_Init(PlayState* play); -void GameOver_FadeLights(PlayState* play); -void GameOver_Update(PlayState* play); void Regs_InitData(PlayState* play); #endif diff --git a/include/z64.h b/include/z64.h index 043219fdb..6e8e72938 100644 --- a/include/z64.h +++ b/include/z64.h @@ -39,6 +39,7 @@ #include "z64eff_footmark.h" #include "z64effect.h" #include "z64frameadvance.h" +#include "z64game_over.h" #include "z64interface.h" #include "z64item.h" #include "z64light.h" @@ -615,22 +616,6 @@ typedef struct { /* 0x1 */ u8 ambienceId; } SequenceContext; // size = 0x2 -typedef enum { - /* 0 */ GAMEOVER_INACTIVE, - /* 1 */ GAMEOVER_DEATH_START, - /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground - /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out - /* 20 */ GAMEOVER_REVIVE_START = 20, - /* 21 */ GAMEOVER_REVIVE_RUMBLE, - /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground - /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of player's body - /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as player is revived and gets back up -} GameOverState; - -typedef struct { - /* 0x0 */ u16 state; -} GameOverContext; // size = 0x2 - typedef struct PlayState { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneId; diff --git a/include/z64game_over.h b/include/z64game_over.h new file mode 100644 index 000000000..240efdf41 --- /dev/null +++ b/include/z64game_over.h @@ -0,0 +1,30 @@ +#ifndef Z64GAME_OVER_H +#define Z64GAME_OVER_H + +#include "ultra64.h" + +struct PlayState; + + +typedef enum GameOverState { + /* 0 */ GAMEOVER_INACTIVE, + /* 1 */ GAMEOVER_DEATH_START, + /* 2 */ GAMEOVER_DEATH_WAIT_GROUND, // wait for player to fall and hit the ground + /* 3 */ GAMEOVER_DEATH_FADE_OUT, // wait before fading out + /* 20 */ GAMEOVER_REVIVE_START = 20, + /* 21 */ GAMEOVER_REVIVE_RUMBLE, + /* 22 */ GAMEOVER_REVIVE_WAIT_GROUND, // wait for player to fall and hit the ground + /* 23 */ GAMEOVER_REVIVE_WAIT_FAIRY, // wait for the fairy to rise all the way up out of player's body + /* 24 */ GAMEOVER_REVIVE_FADE_OUT // fade out the game over lights as player is revived and gets back up +} GameOverState; + +typedef struct GameOverContext { + /* 0x0 */ u16 state; +} GameOverContext; // size = 0x2 + + +void GameOver_Init(struct PlayState* play); +void GameOver_FadeLights(struct PlayState* play); +void GameOver_Update(struct PlayState* play); + +#endif diff --git a/include/z64shrink_window.h b/include/z64shrink_window.h index 2742fb602..bff11b939 100644 --- a/include/z64shrink_window.h +++ b/include/z64shrink_window.h @@ -18,6 +18,6 @@ s32 ShrinkWindow_Pillarbox_GetSize(void); void ShrinkWindow_Init(void); void ShrinkWindow_Destroy(void); void ShrinkWindow_Update(s32 framerateDivisor); -void ShrinkWindow_Draw(GraphicsContext* gfxCtx); +void ShrinkWindow_Draw(struct GraphicsContext* gfxCtx); #endif diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index ec5d3b05c..01eaf2cd8 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,6 +1,10 @@ -#include "global.h" +#include "z64game_over.h" #include "z64rumble.h" #include "z64shrink_window.h" +#include "z64.h" +#include "functions.h" +#include "variables.h" +#include "macros.h" void GameOver_Init(PlayState* play) { play->gameOverCtx.state = GAMEOVER_INACTIVE; @@ -67,6 +71,7 @@ void GameOver_Update(PlayState* play) { Rumble_Request(0.0f, 126, 124, 63); gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; + case GAMEOVER_DEATH_FADE_OUT: if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { func_80169F78(&play->state); @@ -83,31 +88,36 @@ void GameOver_Update(PlayState* play) { Rumble_StateReset(); } break; + case GAMEOVER_REVIVE_START: - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_RUMBLE sGameOverTimer = 0; Kankyo_InitGameOverLights(play); ShrinkWindow_Letterbox_SetSizeTarget(32); break; + case GAMEOVER_REVIVE_RUMBLE: sGameOverTimer = 50; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_WAIT_GROUND Rumble_Request(0.0f, 126, 124, 63); break; + case GAMEOVER_REVIVE_WAIT_GROUND: sGameOverTimer--; if (sGameOverTimer == 0) { sGameOverTimer = 64; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_WAIT_FAIRY } break; + case GAMEOVER_REVIVE_WAIT_FAIRY: sGameOverTimer--; if (sGameOverTimer == 0) { sGameOverTimer = 50; - gameOverCtx->state++; + gameOverCtx->state++; // GAMEOVER_REVIVE_FADE_OUT } break; + case GAMEOVER_REVIVE_FADE_OUT: Kankyo_FadeOutGameOverLights(play); sGameOverTimer--; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index d1c42dd73..4c3ca7ebb 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -962,7 +962,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->promptChoice = PAUSE_PROMPT_YES; pauseCtx->state++; if (gameOverCtx->state == GAMEOVER_INACTIVE) { - pauseCtx->state++; + pauseCtx->state++; // GAMEOVER_DEATH_START } break; From 6685a4775e440b247f3db62db4162dccbf0775ea Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 30 Mar 2023 19:53:47 +1100 Subject: [PATCH 08/29] Audio `sequence.c` OK and documented (#1201) * import sequence docs * cleanup * do not need raw hex --- include/functions.h | 59 +- include/seqcmd.h | 521 ++++++++++ include/sequence.h | 17 +- include/variables.h | 45 +- include/z64.h | 1 + include/z64audio.h | 74 +- spec | 1 - src/audio/code_8019AF00.c | 304 ++++-- src/audio/sequence.c | 921 +++++++++++++++++- src/audio/sfx.c | 8 +- src/audio/voice_internal.c | 2 +- src/code/audio_thread_manager.c | 2 +- src/code/z_demo.c | 8 +- src/code/z_game_over.c | 2 +- src/code/z_parameter.c | 2 +- src/code/z_play.c | 4 +- src/code/z_scene.c | 2 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 6 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 10 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 4 +- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 2 +- src/overlays/actors/ovl_En_Baba/z_en_baba.c | 2 +- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 6 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 22 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 6 +- .../actors/ovl_En_Guruguru/z_en_guruguru.c | 4 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- .../z_en_horse_game_check.c | 8 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 4 +- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 8 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 4 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 2 +- .../actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c | 2 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 4 +- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 4 +- .../actors/ovl_En_Mt_tag/z_en_mt_tag.c | 8 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 10 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 2 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 6 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 10 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 2 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 2 +- src/overlays/actors/ovl_En_Zod/z_en_zod.c | 2 +- src/overlays/actors/ovl_En_Zov/z_en_zov.c | 2 +- src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c | 6 +- .../actors/ovl_Obj_Nozoki/z_obj_nozoki.c | 2 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 2 +- tools/disasm/functions.txt | 64 +- tools/disasm/variables.txt | 26 +- tools/namefixer.py | 9 +- tools/sizes/code_functions.csv | 64 +- 52 files changed, 1888 insertions(+), 404 deletions(-) create mode 100644 include/seqcmd.h diff --git a/include/functions.h b/include/functions.h index bac7712b2..793ac829b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2812,7 +2812,6 @@ void AudioOcarina_TerminaWallGenerateNotes(void); void AudioOcarina_PlayLongScarecrowAfterCredits(void); void Audio_Update(void); -// void func_8019E110(void); void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex); void play_sound(u16 sfxId); void func_8019F128(u16 sfxId); @@ -2846,10 +2845,10 @@ void Audio_PlaySfxForRiver(Vec3f* pos, f32 freqScale); // void Audio_PlaySfxForWaterfall(void); // void Audio_StepFreqLerp(void); void func_801A0124(Vec3f* pos, u8 arg1); -void func_801A0184(void); -void func_801A01C4(void); +void Audio_SetBgmVolumeOff(void); +void Audio_SetBgmVolumeOn(void); void func_801A0204(s8 seqId); -void func_801A0238(s32 arg0, s32 arg1); +void Audio_SetMainBgmVolume(u8 targetVolume, u8 volumeFadeTimer); // void Audio_SetGanonsTowerBgmVolumeLevel(void); // void Audio_SetGanonsTowerBgmVolume(void); // void Audio_UpdateRiverSoundVolumes(void); @@ -2879,12 +2878,9 @@ void func_801A1FB4(u8 playerIndex, Vec3f* pos, u16 seqId, f32 maxDist); void func_801A246C(u8 param_1, u8 param_2); void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne); void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne); -// void func_801A27E8(void); -// void func_801A281C(void); -void func_801A29D4(UNK_TYPE arg0, f32 arg1, UNK_TYPE arg2); -void func_801A2BB8(s32 seqId); -void func_801A2C20(void); -// void func_801A2C44(void); +void Audio_SetSeqTempoAndFreq(u8 seqPlayerIndex, f32 freqTempoScale, u8 duration); +void Audio_PlaySubBgm(u16 seqId); +void Audio_StopSubBgm(void); void Audio_PlaySequenceInCutscene(u16 seqId); void Audio_StopSequenceInCutscene(u16 seqId); s32 Audio_IsSequencePlaying(u8 seqId); @@ -2895,7 +2891,7 @@ void Audio_RestorePrevBgm(void); void Audio_PlayFanfare(u16 seqId); // void func_801A312C(void); void func_801A31EC(u16 seqId, s8 arg1, u8 arg2); -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); +void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); void Audio_SetSequenceMode(u8 seqMode); void Audio_UpdateEnemyBgmVolume(f32 dist); u8 func_801A3950(s32 playerIndex, s32 isChannelIOSet); @@ -2925,23 +2921,20 @@ void func_801A41F8(UNK_TYPE arg0); void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 arg0); void func_801A4428(u8 reverbIndex); void Audio_PreNMI(void); -// void Audio_ResetRequestedSceneSeqId(void); -// void func_801A44D4(void); s32 func_801A46F8(void); void func_801A4748(Vec3f* pos, u16 sfxId); void func_801A479C(Vec3f* arg0, u16 sfxId, s32 arg2); void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData); void Audio_PlayAmbience(u8 ambienceId); void Audio_Init(void); -void func_801A4D00(void); -// void func_801A4D50(void); -// void func_801A4DA4(void); -// void func_801A4DF4(void); -// void func_801A4E64(void); +void Audio_InitSound(void); +void Audio_ResetForAudioHeapStep3(void); +void Audio_ResetForAudioHeapStep2(void); +void Audio_ResetForAudioHeapStep1(s32 specId); // void func_801A4EB0(void); // void func_801A4EB8(void); -// void func_801A4FD8(void); +void func_801A4FD8(void); void func_801A5080(u16 arg0); u16 func_801A5100(void); void func_801A5118(void); @@ -2955,7 +2948,7 @@ UNK_TYPE func_801A51F0(UNK_TYPE arg0); // void func_801A54D0(void); // void func_801A5680(void); // void func_801A5808(void); -// void func_801A5A10(void); +void AudioVoice_ResetData(void); // void func_801A5A1C(void); void AudioSfx_MuteBanks(u16 muteMask); @@ -2974,20 +2967,18 @@ void AudioSfx_ProcessActiveSfx(void); u8 AudioSfx_IsPlaying(u32 sfxId); void AudioSfx_Reset(void); -void Audio_StartSequence(u8 playerIndex, u8 seqId, u8 seqArgs, u16 fadeTimer); -void Audio_StopSequence(u8 playerIndex, u16 fadeTimer); -// void func_801A7D84(void); -void Audio_QueueSeqCmd(u32 cmd); -void func_801A89D0(void); -u16 Audio_GetActiveSequence(u8 playerIndex); -s32 func_801A8ABC(u32 cmdVal, u32 cmdMask); -void Audio_SetVolumeScale(u8 playerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer); -void func_801A8D5C(void); -// void func_801A8E90(void); -u8 func_801A9768(void); -u8 func_801A982C(void); -// void func_801A99B8(void); -// void func_801A9A74(void); +void AudioSeq_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDuration); +void AudioSeq_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration); +void AudioSeq_QueueSeqCmd(u32 cmd); +void AudioSeq_ProcessSeqCmds(void); +u16 AudioSeq_GetActiveSeqId(u8 seqPlayerIndex); +s32 AudioSeq_IsSeqCmdNotQueued(u32 cmdVal, u32 cmdMask); +void AudioSeq_SetVolumeScale(u8 seqPlayerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer); +void AudioSeq_UpdateActiveSequences(void); +u8 AudioSeq_UpdateAudioHeapReset(void); +u8 AudioSeq_ResetReverb(void); +void AudioSeq_ResetActiveSequences(void); +void AudioSeq_ResetActiveSequencesAndVolume(void); void Regs_InitData(PlayState* play); diff --git a/include/seqcmd.h b/include/seqcmd.h new file mode 100644 index 000000000..a7db69dad --- /dev/null +++ b/include/seqcmd.h @@ -0,0 +1,521 @@ +#ifndef SEQCMD_H +#define SEQCMD_H + +// ==== Primary commands ==== + +#define SEQCMD_OP_MASK 0xF0000000 +#define SEQCMD_ASYNC_ACTIVE 0x8000000 +#define SEQCMD_SEQPLAYER_MASK 0x7000000 +#define SEQCMD_SEQID_MASK 0xFF // Only applies to certain seqcmds + +typedef enum { + /* 0x0 */ SEQCMD_OP_PLAY_SEQUENCE, + /* 0x1 */ SEQCMD_OP_STOP_SEQUENCE, + /* 0x2 */ SEQCMD_OP_QUEUE_SEQUENCE, + /* 0x3 */ SEQCMD_OP_UNQUEUE_SEQUENCE, + /* 0x4 */ SEQCMD_OP_SET_SEQPLAYER_VOLUME, + /* 0x5 */ SEQCMD_OP_SET_SEQPLAYER_FREQ, + /* 0x6 */ SEQCMD_OP_SET_CHANNEL_VOLUME, + /* 0x7 */ SEQCMD_OP_SET_SEQPLAYER_IO, + /* 0x8 */ SEQCMD_OP_SET_CHANNEL_IO, + /* 0x9 */ SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK, + /* 0xA */ SEQCMD_OP_SET_CHANNEL_DISABLE_MASK, + /* 0xB */ SEQCMD_OP_TEMPO_CMD, + /* 0xC */ SEQCMD_OP_SETUP_CMD, + /* 0xD */ SEQCMD_OP_SET_CHANNEL_FREQ, + /* 0xE */ SEQCMD_OP_GLOBAL_CMD, + /* 0xF */ SEQCMD_OP_RESET_AUDIO_HEAP +} SeqCmdOp; + +// ==== Secondary commands ==== + +// Subset of `SEQCMD_OP_TEMPO_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_TEMPO_SET, + /* 0x1 */ SEQCMD_SUB_OP_TEMPO_SPEED_UP, + /* 0x2 */ SEQCMD_SUB_OP_TEMPO_SLOW_DOWN, + /* 0x3 */ SEQCMD_SUB_OP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_TEMPO_RESET +} SeqCmdTempoCmdOp; + +// Subset of `SEQCMD_OP_SETUP_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME, + /* 0x1 */ SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE, + /* 0x2 */ SEQCMD_SUB_OP_SETUP_RESTART_SEQ, + /* 0x3 */ SEQCMD_SUB_OP_SETUP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_SETUP_TEMPO_RESET, + /* 0x5 */ SEQCMD_SUB_OP_SETUP_PLAY_SEQ, + /* 0x6 */ SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER, + /* 0x7 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED, + /* 0x8 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX, + /* 0x9 */ SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK, + /* 0xA */ SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ, + /* 0xE */ SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE = 0xE, + /* 0xF */ SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS +} SeqCmdSetupCmdOp; + +// Subset of `SEQCMD_OP_GLOBAL_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE, + /* 0x1 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES, + /* 0x2 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2 +} SeqCmdSubCmdOp; + +// ==== Audio Sequence Primary Commands ==== + +/** + * Play a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration effect will depend on seqArg. See below + * @param seqArg no effect: < 0x7F, skip ticks: = 0x7F, play after loading asynchronously: >= 0x80 (see note) + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note seqArg will also be stored in gActiveSeqs.seqId, any check against that seqId must also include seqArg. + * seqArg = 0x7F will interpret the duration as the number of ticks to skip. + * seqArg >= 0x80 load the soundFont asynchronously, will only start playing once loaded. + */ +#define SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_PLAY_SEQUENCE << 28) | ((seqPlayerIndex) << 24) | ((u32)(fadeInDuration) << 16) | \ + (u32)(seqId)) + +/** + * Stop a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to stop the sequence + * @param fadeOutDuration duration the sequence will fade out over + * + * @note the 0xFF in the command is not read from at all, but is common in all Stop SeqPlayer Commands + */ +#define SEQCMD_STOP_SEQUENCE(seqPlayerIndex, fadeOutDuration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_STOP_SEQUENCE << 28) | 0xFF | ((u8)(seqPlayerIndex) << 24) | \ + ((fadeOutDuration) << 16)) + +/** + * Add a sequence to a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, play the sequence + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is played, duration the sequence will fade in over + * @param priority priority in the queue. The highest valued priority will be queued to play first. Also used as `seqArg`. + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with the unqueue command + * @note for a priority >= 0x7F, similar effects happen as `seqArg` in the play sequence command + */ +#define SEQCMD_QUEUE_SEQUENCE(seqPlayerIndex, fadeInDuration, priority, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_QUEUE_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(fadeInDuration) << 16) | ((u8)(priority) << 8) | (u8)(seqId)) + +/** + * Remove a sequence from a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, stop the sequence, and play the next one in queue if any + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is stopped, duration the sequence will fade out over, and duration the next seq will fade in over + * @param seqId the id of the sequence to remove, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with this command + */ +#define SEQCMD_UNQUEUE_SEQUENCE(seqPlayerIndex, fadeOutInDuration, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_UNQUEUE_SEQUENCE << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u8)(fadeOutInDuration) << 16) | (u32)(seqId)) + +/** + * Set the volume of an entire sequence on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_SEQPLAYER_VOLUME(seqPlayerIndex, duration, volume) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u32)(duration) << 16) | (volume)) + +/** + * Scale the frequency of every channel on a given seqPlayer over a specified duration. + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFFF, with 1000 mapping to 1.0f + * + * @note 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an octave). + * Cannot be used with `SEQCMD_SET_CHANNEL_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_SEQPLAYER_FREQ(seqPlayerIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_FREQ << 28) | (u32)((seqPlayerIndex) << 24) | \ + ((u32)((duration) << 16)) | (u16)(freqScale)) + +/** + * Scale the frequency of a specific channel on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFF, with 1000 mapping to 1.0f + * + * @note a frequency of 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an + * octave). Cannot be used with `SEQCMD_SET_SEQPLAYER_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_CHANNEL_FREQ(seqPlayerIndex, channelIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_FREQ << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \ + ((channelIndex) << 12) | (freqScale)) + +/** + * Set the volume of a specific channel on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, channelIndex, duration, volume) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_VOLUME << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u32)(duration) << 16) | ((u32)(channelIndex) << 8) | (volume)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the global + * ioPort, which can affect the entire sequence. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each seqPlayer has 8 global ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_SEQPLAYER_IO(seqPlayerIndex, ioPort, ioData) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_IO << 28) | ((u32)(seqPlayerIndex) << 24) | ((u32)(ioPort) << 16) | \ + (u32)(ioData)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the channel + * ioPort, which will only affect a single channel. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param channelIndex the index of the channel to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each channel has 8 channel ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_CHANNEL_IO(seqPlayerIndex, channelIndex, ioPort, ioData) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO << 28) | ((u32)(seqPlayerIndex) << 24) | ((u32)(ioPort) << 16) | \ + ((u32)(channelIndex) << 8) | (u32)(ioData)) + +/** + * Disable (or reenable) specific channels from receiving input set by `SEQCMD_SET_CHANNEL_IO` + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + * + * @note using Audio_QueueCmdS8 0x06 will bypass this channelMask + */ +#define SEQCMD_SET_CHANNEL_IO_DISABLE_MASK(seqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK << 28) | ((u8)(seqPlayerIndex) << 24) | \ + (u16)(channelMask)) + +/** + * Disable (or reenable) specific channels + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_DISABLE_MASK << 28) | ((u32)(seqPlayerIndex) << 24) | \ + (u32)(channelMask)) + +// ==== Audio Sequence Tempo Commands ==== + +/** + * Set the absolute tempo of a sequence on a given seqPlayer, fading over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoTarget the target tempo for the sequence + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SET_TEMPO(seqPlayerIndex, duration, tempoTarget) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SET << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u8)(tempoTarget)) + +/** + * Increase the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoIncrease the change to add to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SPEED_UP_TEMPO(seqPlayerIndex, duration, tempoIncrease) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SPEED_UP << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoIncrease)) + +/** + * Decrease the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoDecrease the change to subtract to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SLOW_DOWN_TEMPO(seqPlayerIndex, duration, tempoDecrease) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SLOW_DOWN << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoDecrease)) + +/** + * Scale the tempo of a sequence by a multiplicative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SCALE_TEMPO(seqPlayerIndex, duration, tempoScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SCALE << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16) | (u16)(tempoScale)) + +/** + * Reset the tempo of a sequence to the original tempo on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_RESET_TEMPO(seqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_RESET << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16)) + +/** + * ==== Audio Sequence Setup Commands ==== + * + * The setup commands are designed to wait to be executed. + * Up to 8 commands can be queued per `seqPlayerIndex`. + * These commands will only execute once that `seqPlayerIndex` is finished playing and is no longer enabled. + * They will often target a different player (`targetSeqPlayerIndex`) but not always. + */ + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration)) + +/** + * Setup a request to unqueue a seqPlayer once that same setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to unqueue once the same seqPlayer is disabled + * + * @bug this command was misimplemented and fails to unqueue. The command relies on `gActiveSeqs.seqId` for + * unqueueing, but seqId is reset before being used to unqueue. A simple fix is to unqueue based on + * `gActiveSeqs.prevSeqId` instead. + */ +#define SEQCMD_SETUP_UNQUEUE_SEQUENCE(setupSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * Setup a request to restart and play an active sequence currently playing on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to restart its active sequence + */ +#define SEQCMD_SETUP_RESTART_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTART_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16)) + +/** + * Setup a request to scale the tempo of a sequence by a multiplicative value on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SETUP_SCALE_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, tempoScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_SCALE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(tempoScale)) + +/** + * Setup a request to reset the tempo of a sequence to the original tempo on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_SETUP_RESET_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_RESET << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration)) + +/** + * Setup a request to play a sequence on a target seqPlayer once a setup seqPlayer is finished playing and disabled. + * This command is optionally paired with `SEQCMD_SETUP_SET_FADE_IN_TIMER` to set the fade in duration + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param seqId the id of the sequence to play, see `SeqId` + */ +#define SEQCMD_SETUP_PLAY_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_PLAY_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(seqId)) + +/** + * This command is an optional command before `SEQCMD_SETUP_PLAY_SEQUENCE` to set the fade in duration + * (see cmd above) + * + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration duration the sequence will fade in over + */ +#define SEQCMD_SETUP_SET_FADE_IN_TIMER(targetSeqPlayerIndex, fadeInDuration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER << 20) | \ + ((u8)(targetSeqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 8)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Specifically, it will only restore volume if the number of queued requests on the setup seqPlayer matches + * the number of sequences queued + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param numSeqRequests the number of sequence requests queued that must match the actual number of sequence requests + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, \ + numSeqRequests) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | \ + (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(numSeqRequests)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Allows `scaleIndex` to be specified. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param scaleIndex the scale index of a seqPlayer + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(setupSeqPlayerIndex, targetSeqPlayerIndex, scaleIndex, \ + duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | \ + (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(scaleIndex) << 8) | (u8)(duration)) + +/** + * Setup a request to disable (or reenable) specific channels on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(setupSeqPlayerIndex, targetSeqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(channelMask)) + +/** + * Queue a request to scale the frequency of an entire sequence on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFF, with 100 mapping to 1.0f + * + * @note The base value for frequency, 100, is 10 times smaller than other frequency commands. + * 200 will double the frequency (raise an octave), 50 will halve the frequency (lower an octave). + */ +#define SEQCMD_SETUP_SET_SEQPLAYER_FREQ(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(freqScale)) + +/** + * Queue a request to discard audio data by popping an entry from the persistent caches on the audio heap, + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param tableTypeFlag All tables with the flag `(tableTypeFlag & (1 << tableType))` will be discarded. Specifically: + * `(tableTypeFlag & 1)` will discard the `SEQUENCE_TABLE` + * `(tableTypeFlag & 2)` will discard the `FONT_TABLE` + * `(tableTypeFlag & 4)` will discard the `SAMPLE_TABLE` + */ +#define SEQCMD_SETUP_POP_PERSISTENT_CACHE(setupSeqPlayerIndex, tableTypeFlag) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)tableTypeFlag)) + +/** + * Discard all setup command requests on a seqPlayerIndex by resetting the setup command queue + * + * @param setupSeqPlayerIndex the index of the seqPlayer to disable all setup commands + */ +#define SEQCMD_RESET_SETUP_CMDS(setupSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * ==== Audio Sequence Global Commands ==== + * + * The global commands will apply to the entire audio system and all 4 sequence players + */ + +/** + * Change the sound mode of audio + * + * @param soundMode see the `SoundMode` enum + */ +#define SEQCMD_SET_SOUND_MODE(soundMode) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE << 8) | (soundMode)) + +/** + * Disable (or reenable) new sequences from starting + * + * @param isDisabled true to disable, false to enable + * + * @note this does not disable the sfx player + */ +#define SEQCMD_DISABLE_PLAY_SEQUENCES(isDisabled) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES << 8) | \ + (u16)(isDisabled)) + +#define SEQCMD_DISABLE_PLAY_SEQUENCES_2(isDisabled) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2 << 8) | \ + (u16)(isDisabled)) + +/** + * Restart the audio heap with the specified settings + * + * @param fadeReverb bitmask for reverb indices indicating which reverbs to fade leading into audio heap reset + * @param sfxChannelLayout index for different mappings between the 7 banks and the 16 channels + * @param specId index for the audio specifications to set high-level audio parameters + * + * @note: For sfxChannelLayout, There are 4 possible layouts indexed by 0-3. + * However, only index 0 is properly implemented. Other indices lead to bugs and softlocks. + */ +#define SEQCMD_RESET_AUDIO_HEAP(fadeReverb, sfxChannelLayout, specId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_RESET_AUDIO_HEAP << 28) | ((u8)(fadeReverb) << 16) | \ + ((u8)(sfxChannelLayout) << 8) | (u8)(specId)) + +#endif diff --git a/include/sequence.h b/include/sequence.h index 857609d4b..d8a9cd95a 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -1,8 +1,6 @@ #ifndef SEQUENCE_H #define SEQUENCE_H -#define NA_BGM_STOP 0x100000FF - #define NA_BGM_GENERAL_SFX 0x00 // General Sound Effects #define NA_BGM_AMBIENCE 0x01 // Ambient background noises #define NA_BGM_TERMINA_FIELD 0x02 // Termina Field @@ -133,12 +131,15 @@ #define NA_BGM_END_CREDITS_2 0x82 // The End/Credits II "STAFFROLL2" #define NA_BGM_DISABLED 0xFFFF +#define SEQ_FLAG_ASYNC 0x8000 + typedef enum { /* 0 */ SEQ_PLAYER_BGM_MAIN, /* 1 */ SEQ_PLAYER_FANFARE, /* 2 */ SEQ_PLAYER_SFX, /* 3 */ SEQ_PLAYER_BGM_SUB, /* 4 */ SEQ_PLAYER_AMBIENCE, + /* 5 */ SEQ_PLAYER_MAX, /* 0xFF */ SEQ_PLAYER_INVALID = 0xFF } SequencePlayerId; @@ -160,6 +161,14 @@ typedef enum { /* 0x7 */ CHANNEL_IO_PORT_7 } ChannelIOPort; +typedef enum { + /* 0 */ VOL_SCALE_INDEX_BGM_MAIN, + /* 1 */ VOL_SCALE_INDEX_FANFARE, + /* 2 */ VOL_SCALE_INDEX_SFX, + /* 3 */ VOL_SCALE_INDEX_BGM_SUB, + /* 4 */ VOL_SCALE_INDEX_MAX +} VolumeScaleIndex; // May be worth using SequencePlayerId instead + typedef enum { /* 0x0 */ AMBIENCE_CHANNEL_STREAM_0, /* 0x1 */ AMBIENCE_CHANNEL_CRITTER_0, @@ -174,7 +183,7 @@ typedef enum { /* 0xD */ AMBIENCE_CHANNEL_SOUND_MODE, /* 0xE */ AMBIENCE_CHANNEL_RAIN, /* 0xF */ AMBIENCE_CHANNEL_LIGHTNING -} AmbienceChannelIndex; // playerIndex = SEQ_PLAYER_AMBIENCE +} AmbienceChannelIndex; // seqPlayerIndex = SEQ_PLAYER_AMBIENCE typedef enum { /* 0x00 */ AMBIENCE_ID_00, @@ -198,7 +207,7 @@ typedef enum { /* 0x12 */ AMBIENCE_ID_12, /* 0x13 */ AMBIENCE_ID_13, /* 0xFF */ AMBIENCE_ID_DISABLED = 0xFF -} AmbienceId; // playerIndex = SEQ_PLAYER_AMBIENCE +} AmbienceId; // seqPlayerIndex = SEQ_PLAYER_AMBIENCE typedef enum { /* 0x00 */ AMBIENCE_STREAM_0, diff --git a/include/variables.h b/include/variables.h index 9ce8d04d5..745c019a8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -995,14 +995,9 @@ extern u8 gSfxChannelLayout; extern Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; -// extern UNK_TYPE1 D_801DB4C0; -// extern UNK_TYPE1 D_801DB4C4; -// extern UNK_TYPE1 D_801DB4C8; -// extern UNK_TYPE1 D_801DB4CC; extern u8 gAudioSpecId; -// extern UNK_TYPE1 D_801DB4D8; -// extern UNK_TYPE4 D_801DB4DC; -extern ReverbSettings* gReverbSettingsTable[]; +extern u8 gAudioHeapResetState; +extern ReverbSettings* gReverbSettingsTable[10]; extern AudioSpec gAudioSpecs[21]; // rodata @@ -2669,38 +2664,14 @@ extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD5E8; // extern UNK_TYPE1 D_801FD608; // extern UNK_TYPE1 D_801FD610; -// extern UNK_TYPE1 sSfxPlayerBank; -// extern UNK_TYPE1 sSfxItemBank; -// extern UNK_TYPE1 sSfxEnvironmentBank; -// extern UNK_TYPE1 sSfxEnemyBank; -// extern UNK_TYPE1 sSfxSystemBank; -// extern UNK_TYPE1 sSfxOcarinaBank; -// extern UNK_TYPE1 sSfxVoiceBank; -// extern SfxRequest sSfxRequests[0x100]; -// extern UNK_TYPE1 sSfxBankListEnd; -// extern UNK_TYPE1 sSfxBankFreeListStart; -// extern UNK_TYPE1 sSfxBankUnused; extern ActiveSfx gActiveSfx[7][3]; -// extern UNK_TYPE1 sCurSfxPlayerChannelIndex; -// extern UNK_TYPE1 gSfxBankMuted; -// extern UNK_TYPE1 sUnusedBankLerp; -// extern UNK_TYPE1 D_801FFD00; -// extern UNK_TYPE1 D_801FFD34; -// extern UNK_TYPE1 D_801FFD40; -// extern UNK_TYPE1 D_80200000; -// extern UNK_TYPE1 D_80200002; -// extern UNK_TYPE1 D_80200004; -// extern UNK_TYPE1 D_80200008; -// extern UNK_TYPE1 D_8020001E; -// extern UNK_TYPE1 D_802000C9; -// extern UNK_TYPE1 D_802000D4; +extern SeqRequest sSeqRequests[][5]; +extern u8 sNumSeqRequests[5]; +extern u32 sAudioSeqCmds[0xB0]; extern ActiveSequence gActiveSeqs[]; -// extern UNK_TYPE1 D_8020034A; -// extern UNK_TYPE1 D_80200B88; -// extern UNK_TYPE1 D_80200BBA; -// extern UNK_TYPE1 D_80200BCC; -// extern UNK_TYPE1 D_80200BCE; -// extern UNK_TYPE1 D_80200BD0; +extern u8 sResetAudioHeapTimer; +extern u16 sResetAudioHeapFadeReverbVolume; +extern u16 sResetAudioHeapFadeReverbVolumeStep; extern AudioContext gAudioCtx; // at 0x80200C70 extern AudioCustomUpdateFunction gAudioCustomUpdateFunction; extern AudioCustomSeqFunction gAudioCustomSeqFunction; diff --git a/include/z64.h b/include/z64.h index 6e8e72938..b91333288 100644 --- a/include/z64.h +++ b/include/z64.h @@ -20,6 +20,7 @@ #include "color.h" #include "ichain.h" #include "sequence.h" +#include "seqcmd.h" #include "sfx.h" #include "message_data_static.h" diff --git a/include/z64audio.h b/include/z64audio.h index ca54d2345..a37760566 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -11,6 +11,12 @@ #define SEQ_NUM_CHANNELS 16 #define SEQ_IO_VAL_NONE -1 +typedef enum { + /* 0 */ AUDIO_HEAP_RESET_STATE_NONE, + /* 1 */ AUDIO_HEAP_RESET_STATE_RESETTING, + /* 2 */ AUDIO_HEAP_RESET_STATE_RESETTING_ALT // Never set to +} AudioHeapResetState; + typedef enum { /* 0x00 */ AUDIO_CUSTOM_FUNCTION_SEQ_0, /* 0x01 */ AUDIO_CUSTOM_FUNCTION_SEQ_1, @@ -1090,50 +1096,50 @@ typedef struct { } AudioHeapInitSizes; // size = 0xC typedef struct { - /* 0x00 */ f32 unk_00; - /* 0x04 */ f32 unk_04; - /* 0x08 */ f32 unk_08; - /* 0x0C */ f32 unk_10; - /* 0x10 */ f32 unk_14; - /* 0x14 */ f32 unk_18; - /* 0x18 */ u16 unk_0C; - /* 0x1A */ u16 unk_1C; -} unk_50_s; // size = 0x1C + /* 0x00 */ f32 volCur; + /* 0x04 */ f32 volTarget; + /* 0x08 */ f32 volStep; + /* 0x0C */ f32 freqScaleCur; + /* 0x10 */ f32 freqScaleTarget; + /* 0x14 */ f32 freqScaleStep; + /* 0x18 */ u16 volTimer; + /* 0x1A */ u16 freqScaleTimer; +} ActiveSequenceChannelData; // size = 0x1C typedef struct { - /* 0x000 */ unk_50_s unk_50[0x10]; + /* 0x000 */ ActiveSequenceChannelData channelData[SEQ_NUM_CHANNELS]; /* 0x1C0 */ f32 volCur; /* 0x1C4 */ f32 volTarget; - /* 0x1C8 */ f32 unk_08; - /* 0x1CC */ u32 unk_14; - /* 0x1D0 */ f32 unk_1C; - /* 0x1D4 */ f32 unk_20; - /* 0x1D8 */ f32 unk_24; - /* 0x1DC */ u32 unk_2C[8]; - /* 0x1FC */ u32 unk_25C; - /* 0x200 */ u16 unk_0C; - /* 0x202 */ u16 unk_18; - /* 0x204 */ u16 unk_28; - /* 0x206 */ u16 unk_250; - /* 0x208 */ u16 unk_252; + /* 0x1C8 */ f32 volStep; + /* 0x1CC */ u32 tempoCmd; + /* 0x1D0 */ f32 tempoCur; + /* 0x1D4 */ f32 tempoTarget; + /* 0x1D8 */ f32 tempoStep; + /* 0x1DC */ u32 setupCmd[8]; // setup commands + /* 0x1FC */ u32 startAsyncSeqCmd; // temporarily stores the seqCmd used in SEQCMD_PLAY_SEQUENCE, to be called again once the font is reloaded in + /* 0x200 */ u16 volTimer; + /* 0x202 */ u16 tempoOriginal; + /* 0x204 */ u16 tempoTimer; + /* 0x206 */ u16 freqScaleChannelFlags; + /* 0x208 */ u16 volChannelFlags; /* 0x20A */ u16 seqId; - /* 0x20C */ u16 unk_256; - /* 0x20E */ u16 unk_258; - /* 0x210 */ u8 unk_260; - /* 0x211 */ u8 unk_261[0x1]; - /* 0x212 */ u8 volScales[0x4]; + /* 0x20C */ u16 prevSeqId; // last seqId played on a player + /* 0x20E */ u16 channelPortMask; + /* 0x210 */ u8 isWaitingForFonts; + /* 0x211 */ u8 fontId; + /* 0x212 */ u8 volScales[VOL_SCALE_INDEX_MAX]; /* 0x216 */ u8 volFadeTimer; /* 0x217 */ u8 fadeVolUpdate; - /* 0x218 */ u8 unk_4C; - /* 0x219 */ u8 unk_4D; - /* 0x21A */ u8 unk_4E; - /* 0x21B */ u8 unk_21B; + /* 0x218 */ u8 setupCmdTimer; + /* 0x219 */ u8 setupCmdNum; // number of setup commands + /* 0x21A */ u8 setupFadeTimer; + /* 0x21B */ u8 isSeqPlayerInit; } ActiveSequence; // size = 0x21C typedef struct { - /* 0x0 */ u8 unk_0; - /* 0x1 */ u8 unk_1; // importance? -} Struct_8016E320; // size = 0x02 + /* 0x0 */ u8 seqId; + /* 0x1 */ u8 priority; +} SeqRequest; // size = 0x02 typedef enum { /* 0 */ BANK_PLAYER, diff --git a/spec b/spec index 8c03e0389..325fffa4a 100644 --- a/spec +++ b/spec @@ -622,7 +622,6 @@ beginseg include "build/src/audio/sfx_params.o" include "build/src/audio/sfx.o" include "build/src/audio/sequence.o" - include "build/data/code/sequence.data.o" include "build/data/code/sequence.bss.o" include "build/src/audio/session_config.o" include "build/src/code/jpegutils.o" diff --git a/src/audio/code_8019AF00.c b/src/audio/code_8019AF00.c index 801e2b076..5af712e99 100644 --- a/src/audio/code_8019AF00.c +++ b/src/audio/code_8019AF00.c @@ -70,7 +70,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume); void Audio_StartMorningSceneSequence(u16 seqId); void Audio_StartSceneSequence(u16 seqId); -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); +void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); void func_801A4428(u8 reverbIndex); void func_801A3038(void); void Audio_PlayAmbience(u8 ambienceId); @@ -2734,8 +2734,7 @@ void AudioOcarina_SetOcarinaDisableTimer(u8 unused, u8 timer) { void AudioOcarina_SetInstrument(u8 ocarinaInstrumentId) { if ((sOcarinaInstrumentId != ocarinaInstrumentId) || (ocarinaInstrumentId == OCARINA_INSTRUMENT_DEFAULT)) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_SFX) << 24) | ((u32)(1) << 16) | - ((u32)(SFX_CHANNEL_OCARINA) << 8) | (u32)(ocarinaInstrumentId)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_SFX, SFX_CHANNEL_OCARINA, 1, ocarinaInstrumentId); sOcarinaInstrumentId = ocarinaInstrumentId; if (ocarinaInstrumentId == OCARINA_INSTRUMENT_OFF) { @@ -3303,7 +3302,10 @@ s32 AudioOcarina_MemoryGameNextNote(void) { sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos].length = 0; sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos + 1].pitch = OCARINA_PITCH_NONE; sOcarinaSongNotes[OCARINA_SONG_MEMORY_GAME][sOcarinaMemoryGameAppendPos + 1].length = 0; + + //! FAKE: if (1) {} + return false; } #undef OCARINA_SONG_MEMORY_GAME @@ -3407,8 +3409,7 @@ void AudioOcarina_SetCustomSequence(void) { // Called by unused function void AudioOcarina_PlayCustomSequence(void) { sRequestCustomSequence = true; - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_FANFARE) << 24) | ((u32)(0) << 0x10) | - (u32)(NA_BGM_DUNGEON_APPEAR)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, NA_BGM_DUNGEON_APPEAR); } // Unused @@ -3586,8 +3587,7 @@ s32 AudioOcarina_CreateCustomSequence(void) { void AudioOcarina_ResetInstrument(void) { if (sOcarinaInstrumentId != OCARINA_INSTRUMENT_OFF) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_SFX) << 24) | ((u32)(1) << 16) | - ((u32)(SFX_CHANNEL_OCARINA) << 8) | (u32)(0)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_SFX, SFX_CHANNEL_OCARINA, 1, 0); sOcarinaInstrumentId = OCARINA_INSTRUMENT_OFF; AudioOcarina_ResetAndMute(); } @@ -3629,7 +3629,7 @@ void Audio_Noop3(void) { } void Audio_Update(void) { - if ((func_801A9768() == 0) && (func_801A982C() == 0)) { + if ((AudioSeq_UpdateAudioHeapReset() == 0) && !AudioSeq_ResetReverb()) { AudioOcarina_SetCustomSequence(); AudioOcarina_Update(); func_801A5118(); @@ -3646,9 +3646,9 @@ void Audio_Update(void) { func_801A1290(); Audio_ResetRequestedSceneSeqId(); AudioSfx_ProcessRequests(); - func_801A89D0(); + AudioSeq_ProcessSeqCmds(); AudioSfx_ProcessActiveSfx(); - func_801A8D5C(); + AudioSeq_UpdateActiveSequences(); AudioSfx_ProcessSfxSettings(); AudioThread_ScheduleProcessCmds(); } @@ -3660,7 +3660,14 @@ void Audio_Noop4(s32 arg0) { void Audio_Noop5(s32 arg0, s32 arg1) { } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E110.s") +/** + * Queues a bgm sequence directly to the internal audio queue system. + * Skips the external audio command process + * Unused + */ +void Audio_PlayMainBgm(s8 seqId) { + AUDIOCMD_GLOBAL_INIT_SEQPLAYER(SEQ_PLAYER_BGM_MAIN, (u8)seqId, 1); +} f32 AudioSfx_ComputeVolume(u8 bankId, u8 entryIndex) { SfxBankEntry* bankEntry = &gSfxBanks[bankId][entryIndex]; @@ -4290,13 +4297,23 @@ f32 sBigBellsVolume[8] = { }; #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0124.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0184.s") +void Audio_SetBgmVolumeOff(void) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_FANFARE, 0, 10); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A01C4.s") +void Audio_SetBgmVolumeOn(void) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0x7F, 3); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_FANFARE, 0x7F, 3); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0204.s") +void func_801A0204(s8 seqId) { + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_BGM_MAIN, 2, (u8)seqId); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0238.s") +void Audio_SetMainBgmVolume(u8 targetVolume, u8 volumeFadeTimer) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, targetVolume, volumeFadeTimer); +} /** * Unused remnant from OoT's EnRiverSound @@ -4338,7 +4355,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume) { if (sGanonsTowerVol != targetVolume) { // Sets the volume - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, targetVolume, 2); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, targetVolume, 2); // Sets the filter cutoff of the form (lowPassFilterCutoff << 4) | (highPassFilter & 0xF). highPassFilter is // always set to 0 @@ -4350,8 +4367,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume) { lowPassFilterCutoff = (((targetVolume - 0x40) >> 2) + 1) << 4; } - Audio_QueueSeqCmd((8 << 28) | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u8)(4) << 16) | ((u8)(15) << 8) | - (u8)(lowPassFilterCutoff)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_BGM_MAIN, 15, 4, lowPassFilterCutoff); // Sets the reverb for (channelIndex = 0; channelIndex < ARRAY_COUNT(gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels); @@ -4399,14 +4415,14 @@ void Audio_UpdateRiverSoundVolumes(void) { if (sRiverSoundMainBgmLower == true) { if (sRiverSoundMainBgmCurrentVol != sRiverSoundMainBgmVol) { // lowers the volume for 1 frame - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, sRiverSoundMainBgmVol, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, sRiverSoundMainBgmVol, 10); sRiverSoundMainBgmCurrentVol = sRiverSoundMainBgmVol; sRiverSoundMainBgmRestore = true; } sRiverSoundMainBgmLower = false; } else if ((sRiverSoundMainBgmRestore == true) && !sAudioIsWindowOpen) { // restores the volume every frame - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, 0x7F, 10); sRiverSoundMainBgmCurrentVol = 0x7F; sRiverSoundMainBgmRestore = false; } @@ -4488,10 +4504,9 @@ void func_801A09D4(Vec3f* pos, f32 xzDistToPlayer) { volumeRel = ((1.0f - ((sRiverSoundXZDistToPlayer - 120.0f) / 280.0f)) * 0.9f) + 0.1f; } - for (channelIndex = 0; channelIndex < 16; channelIndex++) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { if (channelIndex != 9) { - Audio_QueueSeqCmd(((u32)(6) << 28) | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(2) << 16) | - ((u32)(channelIndex) << 8) | ((u8)(127.0f * volumeRel))); + SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, channelIndex, 2, (u8)(127.0f * volumeRel)); AUDIOCMD_CHANNEL_SET_PAN(SEQ_PLAYER_BGM_MAIN, channelIndex, pan); } } @@ -4527,8 +4542,8 @@ void Audio_SplitBgmChannels(s8 volumeSplit) { u8 i; u8 channelIndex; - if ((Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) && - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) && + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { for (i = 0; i < ARRAY_COUNT(sBgmPlayers); i++) { if (i == 0) { // Main Bgm SeqPlayer @@ -4556,7 +4571,7 @@ void Audio_SplitBgmChannels(s8 volumeSplit) { } } - Audio_QueueSeqCmd(0xA0000000 | ((u32)(sBgmPlayers[i]) << 24) | ((u32)(channelBits))); + SEQCMD_SET_CHANNEL_DISABLE_MASK(sBgmPlayers[i], channelBits); } } } @@ -4635,8 +4650,8 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) { Audio_SplitBgmChannels(targetVolume); } - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, targetVolume, 0); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F - targetVolume, 0); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, targetVolume, 0); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F - targetVolume, 0); } /** @@ -4650,12 +4665,12 @@ void Audio_ClearSariaBgm2(void) { void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne) { Audio_StartMorningSceneSequence(seqId); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | (u32)(dayMinusOne)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_BGM_MAIN, 4, dayMinusOne); } void Audio_StartMorningSceneSequence(u16 seqId) { if (seqId != NA_BGM_AMBIENCE) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_AMBIENCE) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 0); Audio_StartSceneSequence(seqId); Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1); } else { @@ -4669,8 +4684,7 @@ void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne) { Audio_PlayAmbience(AMBIENCE_ID_08); } else if ((seqId != NA_BGM_FINAL_HOURS) || (sPrevMainBgmSeqId == NA_BGM_DISABLED)) { Audio_StartSceneSequence(seqId); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | - (u32)(dayMinusOne)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_BGM_MAIN, 4, dayMinusOne); } sRequestedSceneSeqId = seqId; } @@ -4710,7 +4724,7 @@ void Audio_StartSceneSequence(u16 seqId) { } void Audio_UpdateSceneSequenceResumePoint(void) { - u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + u16 seqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); if ((seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME)) { if (sSeqResumePoint != SEQ_RESUME_POINT_NONE) { @@ -4723,55 +4737,95 @@ void Audio_UpdateSceneSequenceResumePoint(void) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A27E8.s") +// Unused +void Audio_PlayBgmForSongOfStorms(void) { + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_SONG_OF_STORMS) { + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_SONG_OF_STORMS | SEQ_FLAG_ASYNC); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A281C.s") +/** + * Specifically for SEQ_PLAYER_BGM_MAIN + */ +void Audio_ScaleTempoAndFreqForMainBgm(f32 freqTempoScale, u8 duration) { + if (freqTempoScale == 1.0f) { + SEQCMD_RESET_TEMPO(SEQ_PLAYER_BGM_MAIN, duration); + } else { + SEQCMD_SCALE_TEMPO(SEQ_PLAYER_BGM_MAIN, duration, freqTempoScale * 100.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A29D4.s") + SEQCMD_SET_SEQPLAYER_FREQ(SEQ_PLAYER_BGM_MAIN, duration, freqTempoScale * 1000.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2BB8.s") +void Audio_SetSeqTempoAndFreq(u8 seqPlayerIndex, f32 freqTempoScale, u8 duration) { + if (freqTempoScale == 1.0f) { + SEQCMD_RESET_TEMPO(seqPlayerIndex, duration); + } else { + SEQCMD_SCALE_TEMPO(seqPlayerIndex, duration, freqTempoScale * 100.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C20.s") + SEQCMD_SET_SEQPLAYER_FREQ(seqPlayerIndex, duration, freqTempoScale * 1000.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C44.s") +void Audio_PlaySubBgm(u16 seqId) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 0); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0, seqId); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0, 5); + + SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(SEQ_PLAYER_BGM_SUB, SEQ_PLAYER_BGM_MAIN, 3, 10); + SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_SUB, SEQ_PLAYER_BGM_MAIN, 0); +} + +void Audio_StopSubBgm(void) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0); +} + +// Unused remnant of OoT +void Audio_IncreaseTempoForTimedMinigame(void) { + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_TIMED_MINI_GAME) && + AudioSeq_IsSeqCmdNotQueued(SEQCMD_OP_PLAY_SEQUENCE << 28, SEQCMD_OP_MASK)) { + // Set tempo to be higher than the default tempo for th timed mini-game sequence + SEQCMD_SET_TEMPO(SEQ_PLAYER_BGM_MAIN, 5, 210); + } +} void Audio_PlaySequenceInCutscene(u16 seqId) { if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { Audio_PlayFanfare(seqId); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_FANFARE) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, seqId); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0, seqId); } else { Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, SEQ_IO_VAL_NONE); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 1, 0x7F, 0); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 0); - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_FANFARE, 0x7F, 0); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 0); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); } } void Audio_StopSequenceInCutscene(u16 seqId) { if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, 0); } else { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); } } s32 Audio_IsSequencePlaying(u8 seqId) { - u8 playerIndex = SEQ_PLAYER_BGM_MAIN; + u8 seqPlayerIndex = SEQ_PLAYER_BGM_MAIN; if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE) { - playerIndex = SEQ_PLAYER_FANFARE; + seqPlayerIndex = SEQ_PLAYER_FANFARE; } else if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { - playerIndex = SEQ_PLAYER_FANFARE; + seqPlayerIndex = SEQ_PLAYER_FANFARE; } - if (seqId == (Audio_GetActiveSequence(playerIndex) & 0xFF)) { + if (seqId == (AudioSeq_GetActiveSeqId(seqPlayerIndex) & 0xFF)) { return true; } else { return false; @@ -4779,7 +4833,7 @@ s32 Audio_IsSequencePlaying(u8 seqId) { } void Audio_PlayBgm_StorePrevBgm(u16 seqId) { - u16 curSeqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + u16 curSeqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); if (curSeqId == NA_BGM_DISABLED) { curSeqId = NA_BGM_GENERAL_SFX; @@ -4793,7 +4847,7 @@ void Audio_PlayBgm_StorePrevBgm(u16 seqId) { sPrevMainBgmSeqId = curSeqId; } - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | (u32)(seqId + 0x8000)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, seqId + SEQ_FLAG_ASYNC); } } @@ -4801,16 +4855,15 @@ void Audio_PlayBgm_StorePrevBgm(u16 seqId) { * To be used in conjunction with Audio_PlayBgm_StorePrevBgm */ void Audio_RestorePrevBgm(void) { - if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && - (sSeqFlags[Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) & 0xFF] & SEQ_FLAG_RESTORE)) { + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && + (sSeqFlags[AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF] & SEQ_FLAG_RESTORE)) { if ((sPrevMainBgmSeqId == NA_BGM_DISABLED) || (sPrevMainBgmSeqId == NA_BGM_GENERAL_SFX)) { - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); } else { if (sPrevMainBgmSeqId == NA_BGM_AMBIENCE) { sPrevMainBgmSeqId = sPrevAmbienceSeqId; } - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | - (u32)(sPrevMainBgmSeqId + 0x8000)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, sPrevMainBgmSeqId + SEQ_FLAG_ASYNC); } sPrevMainBgmSeqId = NA_BGM_DISABLED; } @@ -4818,7 +4871,7 @@ void Audio_RestorePrevBgm(void) { // Unused void Audio_PlayAmbience_StorePrevBgm(u8 ambienceId) { - u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + u16 seqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); if (seqId != NA_BGM_AMBIENCE) { sPrevMainBgmSeqId = seqId; @@ -4830,8 +4883,7 @@ void Audio_PlayAmbience_StorePrevBgm(u8 ambienceId) { // Unused void Audio_ForceRestorePreviousBgm(void) { if (sPrevMainBgmSeqId != NA_BGM_DISABLED) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | - (u32)(sPrevMainBgmSeqId + 0x8000)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, sPrevMainBgmSeqId + SEQ_FLAG_ASYNC); } sPrevMainBgmSeqId = NA_BGM_DISABLED; @@ -4847,16 +4899,16 @@ void Audio_ForceRestorePreviousBgm(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A31EC.s") -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData) { +void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData) { u16 flaggedSeqId; - Audio_QueueSeqCmd(0x70000000 | ((u32)(playerIndex) << 24) | ((u32)(ioPort) << 0x10) | (u32)(ioData)); + SEQCMD_SET_SEQPLAYER_IO(seqPlayerIndex, ioPort, ioData); if ((seqId & 0xFF) < 2) { flaggedSeqId = seqId; } else { flaggedSeqId = seqId | 0x8000; } - Audio_QueueSeqCmd(0x00000000 | ((u32)(playerIndex) << 24) | ((u32)(fadeInDuration) << 0x10) | (u32)(flaggedSeqId)); + SEQCMD_PLAY_SEQUENCE((u32)seqPlayerIndex, fadeInDuration, flaggedSeqId); } void Audio_SetSequenceMode(u8 seqMode) { @@ -4884,17 +4936,18 @@ void Audio_SetSequenceMode(u8 seqMode) { volumeFadeInTimer = gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume; } - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, volumeFadeInTimer); - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | - (u32)(NA_BGM_ENEMY | 0x800)); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, sBgmEnemyVolume, + volumeFadeInTimer); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 10, NA_BGM_ENEMY | 0x800); if (seqId >= NA_BGM_TERMINA_FIELD) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F - sBgmEnemyVolume, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F - sBgmEnemyVolume, + 10); Audio_SplitBgmChannels(sBgmEnemyVolume); } } else if ((sPrevSeqMode & 0x7F) == SEQ_MODE_ENEMY) { // If only sPrevSeqMode = SEQ_MODE_ENEMY (End) - Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((10) << 16)); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_SUB, 10); if (seqMode == SEQ_MODE_IGNORE) { volumeFadeOutTimer = 0; @@ -4902,7 +4955,7 @@ void Audio_SetSequenceMode(u8 seqMode) { volumeFadeOutTimer = 10; } - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, volumeFadeOutTimer); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, volumeFadeOutTimer); Audio_SplitBgmChannels(0); } @@ -4910,10 +4963,9 @@ void Audio_SetSequenceMode(u8 seqMode) { } else { if (seqMode == SEQ_MODE_ENEMY) { // If both seqMode = sPrevSeqMode = SEQ_MODE_ENEMY - if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == NA_BGM_DISABLED) && + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_DISABLED) && (seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_ENEMY)) { - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | - (u32)(NA_BGM_ENEMY | 0x800)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_SUB, 10, NA_BGM_ENEMY | 0x800); sPrevSeqMode = seqMode + 0x80; } } @@ -4935,7 +4987,7 @@ void Audio_SetSequenceMode(u8 seqMode) { } sPrevSeqMode = seqMode; - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(2) << 0x10) | (u32)(seqMode)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_BGM_MAIN, 2, seqMode); } } } @@ -4956,10 +5008,10 @@ void Audio_UpdateEnemyBgmVolume(f32 dist) { } sBgmEnemyVolume = ((350.0f - adjDist) * 127.0f) / 350.0f; - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, sBgmEnemyVolume, 10); if ((seqId >= NA_BGM_TERMINA_FIELD) && !(sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO)) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sBgmEnemyVolume), 10); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, (0x7F - sBgmEnemyVolume), 10); } } @@ -5032,7 +5084,8 @@ void Audio_ResetRequestedSceneSeqId(void) { sRequestedSceneSeqId = NA_BGM_DISABLED; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A44D4.s") +void Audio_ResetData(void); +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_ResetData.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A46F8.s") @@ -5046,13 +5099,15 @@ void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData) { u8 lastChannelIndex; u8 channelIndex; - if ((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) && func_801A8ABC(NA_BGM_AMBIENCE, 0xF00000FF)) { + if ((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) && + AudioSeq_IsSeqCmdNotQueued((SEQCMD_OP_PLAY_SEQUENCE << 28) | NA_BGM_AMBIENCE, + SEQCMD_OP_MASK | SEQCMD_SEQID_MASK)) { return; } // channelIndexRange = 01 on ioPort 1 if ((((channelIndexRange << 8) + (u32)ioPort) == ((1 << 8) | (u32)1)) && - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { D_801FD3A8 = 0; } @@ -5064,38 +5119,33 @@ void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData) { } for (channelIndex = firstChannelIndex; channelIndex <= lastChannelIndex; channelIndex++) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | - ((u32)(channelIndex) << 8) | (u32)(ioData)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, channelIndex, ioPort, ioData); } } void Audio_StartAmbience(u16 initChannelMask, u16 initMuteChannelMask) { u8 channelIndex; - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_0) << 0x10) | - (u32)(1)); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_4) << 0x10) | - (u32)((u8)(initChannelMask >> 8))); - Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_5) << 0x10) | - (u32)((u8)(initChannelMask & 0xFF))); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 1); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_AMBIENCE, SEQ_PLAYER_IO_PORT_0, 1); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_AMBIENCE, SEQ_PLAYER_IO_PORT_4, (u8)(initChannelMask >> 8)); + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_AMBIENCE, SEQ_PLAYER_IO_PORT_5, (u8)(initChannelMask & 0xFF)); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_MAIN, 0x7F, 1); - if ((Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_DISABLED) && - (Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_AMBIENCE)) { - Audio_StopSequence(SEQ_PLAYER_AMBIENCE, 0); + if ((AudioSeq_GetActiveSeqId(SEQ_PLAYER_AMBIENCE) != NA_BGM_DISABLED) && + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_AMBIENCE) != NA_BGM_AMBIENCE)) { + AudioSeq_StopSequence(SEQ_PLAYER_AMBIENCE, 0); AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); } - if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 1); + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_BGM_SUB, 0x7F, 1); } - Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(0) << 0x10) | (u32)(NA_BGM_AMBIENCE)); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_AMBIENCE, 0, NA_BGM_AMBIENCE); - for (channelIndex = 0; channelIndex < 16; channelIndex++) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { if (!(initMuteChannelMask & (1 << channelIndex)) && (initChannelMask & (1 << channelIndex))) { - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_1) << 16) | - ((u32)(channelIndex) << 8) | (u32)(1)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, channelIndex, CHANNEL_IO_PORT_1, 1); } } } @@ -5119,12 +5169,10 @@ void Audio_PlayAmbience(u8 ambienceId) { channelIndex = sAmbienceData[ambienceId].channelProperties[i++]; ioPort = sAmbienceData[ambienceId].channelProperties[i++]; ioData = sAmbienceData[ambienceId].channelProperties[i++]; - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | - ((u32)(channelIndex) << 8) | (u32)(ioData)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, channelIndex, ioPort, ioData); } - Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_7) << 16) | - ((u32)(AMBIENCE_CHANNEL_SOUND_MODE) << 8) | (u32)(sSoundMode)); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_AMBIENCE, AMBIENCE_CHANNEL_SOUND_MODE, CHANNEL_IO_PORT_7, sSoundMode); } } @@ -5155,7 +5203,7 @@ void AudioSfx_Init(u16 fadeTimer) { u8 channelIndex; AudioThread_ScheduleProcessCmds(); - Audio_StartSequence(SEQ_PLAYER_SFX, NA_BGM_GENERAL_SFX, 0x70, fadeTimer); + AudioSeq_StartSequence(SEQ_PLAYER_SFX, NA_BGM_GENERAL_SFX, 0x70, fadeTimer); for (channelIndex = 0; channelIndex < ARRAY_COUNT(sSfxChannelState); channelIndex++) { AUDIOCMD_CHANNEL_SET_SFX_STATE(SEQ_PLAYER_SFX, channelIndex, &sSfxChannelState[channelIndex]); @@ -5165,12 +5213,52 @@ void AudioSfx_Init(u16 fadeTimer) { AUDIOCMD_GLOBAL_SET_CUSTOM_FUNCTION(AUDIO_CUSTOM_FUNCTION_SEQ_1, Audio_SetAmbienceRandomBend); } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4D00.s") +void Audio_InitSound(void) { + Audio_ResetData(); + AudioOcarina_ResetStaffs(); + AudioSfx_ResetSfxChannelState(); + AudioSeq_ResetActiveSequencesAndVolume(); + AudioSfx_Reset(); + AudioVoice_ResetData(); + AudioSfx_Init(10); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4D50.s") +void Audio_ResetForAudioHeapStep3(void) { + AudioSfx_Init(1); + AUDIOCMD_GLOBAL_UNMUTE(AUDIOCMD_ALL_SEQPLAYERS, true); + AudioThread_ScheduleProcessCmds(); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + sIsFinalHoursOrSoaring = false; + sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX; + sMuteOnlySfxAndAmbienceSeq = false; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4DA4.s") +void Audio_ResetForAudioHeapStep2(void) { + Audio_ResetForAudioHeapStep3(); + if (gAudioSpecId < ARRAY_COUNT(gReverbSettingsTable)) { + AUDIOCMD_GLOBAL_SET_REVERB_DATA(1, REVERB_DATA_TYPE_SETTINGS, &gReverbSettingsTable[gAudioSpecId][1]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4DF4.s") +void Audio_ResetForAudioHeapStep1(s32 specId) { + gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_RESETTING; + Audio_ResetData(); + AudioOcarina_ResetStaffs(); + AudioSfx_ResetSfxChannelState(); + AudioSeq_ResetActiveSequences(); + AudioSfx_Reset(); + func_801A4FD8(); + if (gAudioSpecId == 0xB) { + AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | + (1 << BANK_OCARINA) | (1 << BANK_VOICE)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4E64.s") +void Audio_UnusedReset(void) { + AudioSeq_ResetActiveSequences(); + AUDIOCMD_GLOBAL_UNMUTE(AUDIOCMD_ALL_SEQPLAYERS, true); + Audio_ResetData(); + AudioSfx_ResetSfxChannelState(); + AudioSfx_Init(1); + func_801A4FD8(); +} diff --git a/src/audio/sequence.c b/src/audio/sequence.c index 613f1ef1d..7d37a0ae9 100644 --- a/src/audio/sequence.c +++ b/src/audio/sequence.c @@ -1,31 +1,922 @@ +/** + * @file sequence.c + * + * This file implements a set of high-level audio sequence commands that allow sequences to be modified in real-time. + * These commands are intended to interface external to the audio library. + * + * These commands are generated using `AudioSeq_QueueSeqCmd`, and a user-friendly interface for this function + * can be found in `seqcmd.h` + * + * These commands change sequences by generating internal audio commands `AudioThread_QueueCmd` which allows these + * sequence requests to be passed onto the audio thread. It is worth noting all functions in this file are + * called from the graph thread. + * + * These commands are not to be confused with the sequence instructions used by the sequences themselves + * which are a midi-based scripting language. + * + * Nor are these commands to be confused with the internal audio commands used to transfer requests from + * the graph thread to the audio thread. + */ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/Audio_StartSequence.s") +// Direct audio command (skips the queueing system) +#define SEQCMD_SET_SEQPLAYER_VOLUME_NOW(seqPlayerIndex, duration, volume) \ + AudioSeq_ProcessSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16) | ((u8)((volume)*127.0f))); -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/Audio_StopSequence.s") +u8 sSeqCmdWritePos = 0; +u8 sSeqCmdReadPos = 0; +u8 sStartSeqDisabled = 0; +u8 sSoundModeList[] = { + SOUNDMODE_STEREO, SOUNDMODE_HEADSET, SOUNDMODE_SURROUND_EXTERNAL, SOUNDMODE_MONO, SOUNDMODE_SURROUND, +}; +u8 gAudioSpecId = 0; +u8 gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_NONE; +u32 sResetAudioHeapSeqCmd = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A7D84.s") +void AudioSeq_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDuration) { + u8 channelIndex; + u16 skipTicks; + s32 pad; -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/Audio_QueueSeqCmd.s") + if (!sStartSeqDisabled || (seqPlayerIndex == SEQ_PLAYER_SFX)) { + seqArgs &= 0x7F; + if (seqArgs == 0x7F) { + // `fadeInDuration` interpreted as seconds, 60 is refresh rate and does not account for PAL + skipTicks = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.updatesPerFrame; + AUDIOCMD_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS(seqPlayerIndex, seqId, skipTicks); + } else { + // `fadeInDuration` interpreted as 1/30th of a second, does not account for change in refresh rate for PAL + AUDIOCMD_GLOBAL_INIT_SEQPLAYER(seqPlayerIndex, seqId, + (fadeInDuration * (u16)gAudioCtx.audioBufferParameters.updatesPerFrame) / 4); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A89D0.s") + gActiveSeqs[seqPlayerIndex].seqId = seqId | (seqArgs << 8); + gActiveSeqs[seqPlayerIndex].prevSeqId = seqId | (seqArgs << 8); + gActiveSeqs[seqPlayerIndex].isSeqPlayerInit = true; -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/Audio_GetActiveSequence.s") + if (gActiveSeqs[seqPlayerIndex].volCur != 1.0f) { + AUDIOCMD_SEQPLAYER_FADE_VOLUME_SCALE(seqPlayerIndex, gActiveSeqs[seqPlayerIndex].volCur); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A8ABC.s") + gActiveSeqs[seqPlayerIndex].tempoTimer = 0; + gActiveSeqs[seqPlayerIndex].tempoOriginal = 0; + gActiveSeqs[seqPlayerIndex].tempoCmd = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A8B14.s") + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur = 1.0f; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer = 0; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur = 1.0f; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A8B2C.s") + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags = 0; + gActiveSeqs[seqPlayerIndex].volChannelFlags = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/Audio_SetVolumeScale.s") +void AudioSeq_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration) { + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(seqPlayerIndex, + (fadeOutDuration * (u16)gAudioCtx.audioBufferParameters.updatesPerFrame) / 4); + gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A8D5C.s") +void AudioSeq_ProcessSeqCmd(u32 cmd) { + s32 priority; + s32 channelMaskEnable; + u16 channelMaskDisable; + u16 fadeTimer; + u16 val; + u8 oldSpecId; + u8 specId; + u8 fadeReverb; + u8 op; + u8 subOp; + u8 seqPlayerIndex; + u8 seqId; + u8 seqArgs; + u8 found; + u8 ioPort; + u8 duration; + u8 channelIndex; + u8 i; + f32 freqScaleTarget; + u32 outNumFonts; -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A9768.s") + op = cmd >> 28; + seqPlayerIndex = (cmd & SEQCMD_SEQPLAYER_MASK) >> 24; -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A982C.s") + switch (op) { + case SEQCMD_OP_PLAY_SEQUENCE: + // Play a new sequence + seqId = cmd & SEQCMD_SEQID_MASK; + seqArgs = (cmd & 0xFF00) >> 8; + // `fadeTimer` is only shifted 13 bits instead of 16 bits. + // `fadeTimer` continues to be scaled in `AudioSeq_StartSequence` + fadeTimer = (cmd & 0xFF0000) >> 13; + if (!gActiveSeqs[seqPlayerIndex].isWaitingForFonts && !sStartSeqDisabled) { + if (seqArgs < 0x80) { + AudioSeq_StartSequence(seqPlayerIndex, seqId, seqArgs, fadeTimer); + } else { + // Store the cmd to be called again once the fonts are loaded + // but changes the command so that next time, the (seqArgs < 0x80) case is taken + gActiveSeqs[seqPlayerIndex].startAsyncSeqCmd = + (cmd & ~(SEQ_FLAG_ASYNC | SEQCMD_ASYNC_ACTIVE)) + SEQCMD_ASYNC_ACTIVE; + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = true; + gActiveSeqs[seqPlayerIndex].fontId = *AudioThread_GetFontsForSequence(seqId, &outNumFonts); + AudioSeq_StopSequence(seqPlayerIndex, 1); -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A99B8.s") + if (gActiveSeqs[seqPlayerIndex].prevSeqId != NA_BGM_DISABLED) { + if (*AudioThread_GetFontsForSequence(seqId, &outNumFonts) != + *AudioThread_GetFontsForSequence(gActiveSeqs[seqPlayerIndex].prevSeqId & 0xFF, + &outNumFonts)) { + // Discard Seq Fonts + AUDIOCMD_GLOBAL_DISCARD_SEQ_FONTS((s32)seqId); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/sequence/func_801A9A74.s") + AUDIOCMD_GLOBAL_ASYNC_LOAD_FONT(*AudioThread_GetFontsForSequence(seqId, &outNumFonts), + (u8)((seqPlayerIndex + 1) & 0xFF)); + } + } + break; + + case SEQCMD_OP_STOP_SEQUENCE: + // Stop a sequence and disable the sequence player + fadeTimer = (cmd & 0xFF0000) >> 13; + AudioSeq_StopSequence(seqPlayerIndex, fadeTimer); + break; + + case SEQCMD_OP_QUEUE_SEQUENCE: + // Queue a sequence into `sSeqRequests` + seqId = cmd & SEQCMD_SEQID_MASK; + seqArgs = (cmd & 0xFF00) >> 8; + fadeTimer = (cmd & 0xFF0000) >> 13; + priority = seqArgs; + + // Checks if the requested sequence is first in the list of requests + // If it is already queued and first in the list, then play the sequence immediately + for (i = 0; i < sNumSeqRequests[seqPlayerIndex]; i++) { + if (sSeqRequests[seqPlayerIndex][i].seqId == seqId) { + if (i == 0) { + AudioSeq_StartSequence(seqPlayerIndex, seqId, seqArgs, fadeTimer); + } + return; + } + } + + // Searches the sequence requests for the first request that does not have a higher priority + // than the current incoming request + found = sNumSeqRequests[seqPlayerIndex]; + for (i = 0; i < sNumSeqRequests[seqPlayerIndex]; i++) { + if (priority >= sSeqRequests[seqPlayerIndex][i].priority) { + found = i; + i = sNumSeqRequests[seqPlayerIndex]; // "break;" + } + } + + // Check if the queue is full + if (sNumSeqRequests[seqPlayerIndex] < ARRAY_COUNT(sSeqRequests[seqPlayerIndex])) { + sNumSeqRequests[seqPlayerIndex]++; + } + + for (i = sNumSeqRequests[seqPlayerIndex] - 1; i != found; i--) { + // Move all requests of lower priority backwards 1 place in the queue + // If the queue is full, overwrite the entry with the lowest priority + sSeqRequests[seqPlayerIndex][i].priority = sSeqRequests[seqPlayerIndex][i - 1].priority; + sSeqRequests[seqPlayerIndex][i].seqId = sSeqRequests[seqPlayerIndex][i - 1].seqId; + } + + // Fill the newly freed space in the queue with the new request + sSeqRequests[seqPlayerIndex][found].priority = seqArgs; + sSeqRequests[seqPlayerIndex][found].seqId = seqId; + + // The sequence is first in queue, so start playing. + if (found == 0) { + AudioSeq_StartSequence(seqPlayerIndex, seqId, seqArgs, fadeTimer); + } + break; + + case SEQCMD_OP_UNQUEUE_SEQUENCE: + // Unqueue sequence + fadeTimer = (cmd & 0xFF0000) >> 13; + + found = sNumSeqRequests[seqPlayerIndex]; + for (i = 0; i < sNumSeqRequests[seqPlayerIndex]; i++) { + seqId = cmd & SEQCMD_SEQID_MASK; + if (sSeqRequests[seqPlayerIndex][i].seqId == seqId) { + found = i; + i = sNumSeqRequests[seqPlayerIndex]; // "break;" + } + } + + if (found != sNumSeqRequests[seqPlayerIndex]) { + // Move all requests of lower priority forward 1 place in the queue + for (i = found; i < sNumSeqRequests[seqPlayerIndex] - 1; i++) { + sSeqRequests[seqPlayerIndex][i].priority = sSeqRequests[seqPlayerIndex][i + 1].priority; + sSeqRequests[seqPlayerIndex][i].seqId = sSeqRequests[seqPlayerIndex][i + 1].seqId; + } + sNumSeqRequests[seqPlayerIndex]--; + } + + // If the sequence was first in queue (it is currently playing), + // Then stop the sequence and play the next sequence in the queue. + if (found == 0) { + AudioSeq_StopSequence(seqPlayerIndex, fadeTimer); + if (sNumSeqRequests[seqPlayerIndex] != 0) { + AudioSeq_StartSequence(seqPlayerIndex, sSeqRequests[seqPlayerIndex][0].seqId, + sSeqRequests[seqPlayerIndex][0].priority, fadeTimer); + } + } + break; + + case SEQCMD_OP_SET_SEQPLAYER_VOLUME: + // Transition volume to a target volume for an entire player + duration = (cmd & 0xFF0000) >> 15; + val = cmd & 0xFF; + if (duration == 0) { + duration++; + } + // Volume is scaled relative to 127 + gActiveSeqs[seqPlayerIndex].volTarget = (f32)val / 127.0f; + if (gActiveSeqs[seqPlayerIndex].volCur != gActiveSeqs[seqPlayerIndex].volTarget) { + gActiveSeqs[seqPlayerIndex].volStep = + (gActiveSeqs[seqPlayerIndex].volCur - gActiveSeqs[seqPlayerIndex].volTarget) / (f32)duration; + gActiveSeqs[seqPlayerIndex].volTimer = duration; + } + break; + + case SEQCMD_OP_SET_SEQPLAYER_FREQ: + // Transition freq scale to a target freq for all channels + duration = (cmd & 0xFF0000) >> 15; + val = cmd & 0xFFFF; + if (duration == 0) { + duration++; + } + // Frequency is scaled relative to 1000 + freqScaleTarget = (f32)val / 1000.0f; + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { + gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleTarget = freqScaleTarget; + gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleTimer = duration; + gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleStep = + (gActiveSeqs[seqPlayerIndex].channelData[i].freqScaleCur - freqScaleTarget) / (f32)duration; + } + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags = 0xFFFF; + break; + + case SEQCMD_OP_SET_CHANNEL_FREQ: + // Transition freq scale to a target for a specific channel + duration = (cmd & 0xFF0000) >> 15; + channelIndex = (cmd & 0xF000) >> 12; + val = cmd & 0xFFF; + if (duration == 0) { + duration++; + } + // Frequency is scaled relative to 1000 + freqScaleTarget = (f32)val / 1000.0f; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTarget = freqScaleTarget; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleStep = + (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur - freqScaleTarget) / (f32)duration; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer = duration; + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags |= 1 << channelIndex; + break; + + case SEQCMD_OP_SET_CHANNEL_VOLUME: + // Transition volume to a target volume for a specific channel + duration = (cmd & 0xFF0000) >> 15; + channelIndex = (cmd & 0xF00) >> 8; + val = cmd & 0xFF; + if (duration == 0) { + duration++; + } + // Volume is scaled relative to 127 + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget = (f32)val / 127.0f; + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur != + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volStep = + (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur - + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget) / + (f32)duration; + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer = duration; + gActiveSeqs[seqPlayerIndex].volChannelFlags |= 1 << channelIndex; + } + break; + + case SEQCMD_OP_SET_SEQPLAYER_IO: + // Set global io port + ioPort = (cmd & 0xFF0000) >> 16; + val = cmd & 0xFF; + AUDIOCMD_SEQPLAYER_SET_IO(seqPlayerIndex, ioPort, val); + break; + + case SEQCMD_OP_SET_CHANNEL_IO: + // Set io port if channel masked + channelIndex = (cmd & 0xF00) >> 8; + ioPort = (cmd & 0xFF0000) >> 16; + val = cmd & 0xFF; + if (!(gActiveSeqs[seqPlayerIndex].channelPortMask & (1 << channelIndex))) { + AUDIOCMD_CHANNEL_SET_IO(seqPlayerIndex, channelIndex, ioPort, val); + } + break; + + case SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK: + // Disable channel io specifically for `SEQCMD_OP_SET_CHANNEL_IO`. + // This can be bypassed by setting channel io through using `AUDIOCMD_CHANNEL_SET_IO` directly. + // This is accomplished by setting a channel mask. + gActiveSeqs[seqPlayerIndex].channelPortMask = cmd & 0xFFFF; + break; + + case SEQCMD_OP_SET_CHANNEL_DISABLE_MASK: + // Disable or Reenable channels + + // Disable channels + channelMaskDisable = cmd & 0xFFFF; + if (channelMaskDisable != 0) { + // Apply channel mask `channelMaskDisable` + AUDIOCMD_GLOBAL_SET_CHANNEL_MASK(seqPlayerIndex, channelMaskDisable); + // Disable channels + AUDIOCMD_CHANNEL_SET_MUTE(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, true); + } + + // Reenable channels + channelMaskEnable = channelMaskDisable ^ 0xFFFF; + if (channelMaskEnable != 0) { + // Apply channel mask `channelMaskEnable` + AUDIOCMD_GLOBAL_SET_CHANNEL_MASK(seqPlayerIndex, channelMaskEnable); + // Enable channels + AUDIOCMD_CHANNEL_SET_MUTE(seqPlayerIndex, AUDIOCMD_ALL_CHANNELS, false); + } + break; + + case SEQCMD_OP_TEMPO_CMD: + // Update a tempo using a sub-command system. + // Stores the cmd for processing elsewhere. + gActiveSeqs[seqPlayerIndex].tempoCmd = cmd; + break; + + case SEQCMD_OP_SETUP_CMD: + // Queue a sub-command to execute once the sequence is finished playing + subOp = (cmd & 0xF00000) >> 20; + if (subOp != SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS) { + // Ensure the maximum number of setup commands is not exceeded + if (gActiveSeqs[seqPlayerIndex].setupCmdNum < (ARRAY_COUNT(gActiveSeqs[seqPlayerIndex].setupCmd) - 1)) { + found = gActiveSeqs[seqPlayerIndex].setupCmdNum++; + if (found < ARRAY_COUNT(gActiveSeqs[seqPlayerIndex].setupCmd)) { + gActiveSeqs[seqPlayerIndex].setupCmd[found] = cmd; + // Adds a delay of 2 frames before executing any setup commands. + // This allows setup commands to be requested along with a new sequence on a seqPlayerIndex. + // This 2 frame delay ensures the player is enabled before its state is checked for + // the purpose of deciding if the setup commands should be run. + // Otherwise, the setup commands will be executed before the sequence starts, + // when the player is still disabled, instead of when the newly played sequence ends. + gActiveSeqs[seqPlayerIndex].setupCmdTimer = 2; + } + } + } else { + // `SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS` + // Discard all setup command requests on `seqPlayerIndex` + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + } + break; + + case SEQCMD_OP_GLOBAL_CMD: + // Apply a command that applies to all sequence players + subOp = (cmd & 0xF00) >> 8; + val = cmd & 0xFF; + switch (subOp) { + case SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE: + // Set sound mode + AUDIOCMD_GLOBAL_SET_SOUND_MODE(sSoundModeList[val]); + break; + + case SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES: + // Set sequence disabled in (sStartSeqDisabled & 1) bit + sStartSeqDisabled = (sStartSeqDisabled & (u8)~1) | (u8)(val & 1); + break; + + case SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2: + // Set sequence disabled in (sStartSeqDisabled & 2) bit + sStartSeqDisabled = (sStartSeqDisabled & (u8)~2) | (u8)((val & 1) << 1); + break; + } + break; + + case SEQCMD_OP_RESET_AUDIO_HEAP: + // Resets the audio heap based on the audio specifications, audio mode, and sfx channel layout + specId = cmd & 0xFF; + fadeReverb = (cmd & 0xFF0000) >> 16; + if (fadeReverb == 0) { + gSfxChannelLayout = (cmd & 0xFF00) >> 8; + oldSpecId = gAudioSpecId; + gAudioSpecId = specId; + AudioThread_ResetAudioHeap(specId); + Audio_ResetForAudioHeapStep1(oldSpecId); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + } else { + sResetAudioHeapSeqCmd = cmd; + sResetAudioHeapFadeReverbVolume = 0x7FFF; + sResetAudioHeapTimer = 20; + sResetAudioHeapFadeReverbVolumeStep = 0x666; + } + break; + } +} + +/** + * Add the sequence cmd to the `sAudioSeqCmds` queue + */ +void AudioSeq_QueueSeqCmd(u32 cmd) { + sAudioSeqCmds[sSeqCmdWritePos++] = cmd; +} + +void AudioSeq_ProcessSeqCmds(void) { + while (sSeqCmdWritePos != sSeqCmdReadPos) { + AudioSeq_ProcessSeqCmd(sAudioSeqCmds[sSeqCmdReadPos++]); + } +} + +u16 AudioSeq_GetActiveSeqId(u8 seqPlayerIndex) { + if (gActiveSeqs[seqPlayerIndex].isWaitingForFonts == true) { + return gActiveSeqs[seqPlayerIndex].startAsyncSeqCmd & SEQCMD_SEQID_MASK; + } + + if (gActiveSeqs[seqPlayerIndex].seqId != NA_BGM_DISABLED) { + return gActiveSeqs[seqPlayerIndex].seqId; + } + + return NA_BGM_DISABLED; +} + +s32 AudioSeq_IsSeqCmdNotQueued(u32 cmdVal, u32 cmdMask) { + u8 i; + + for (i = sSeqCmdReadPos; i != sSeqCmdWritePos; i++) { + if ((sAudioSeqCmds[i] & cmdMask) == cmdVal) { + return false; + } + } + + return true; +} + +// Unused +void AudioSeq_ResetSequenceRequests(u8 seqPlayerIndex) { + sNumSeqRequests[seqPlayerIndex] = 0; +} + +/** + * Check if the setup command is queued. If it is, then replace the command + * with `SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME`. + * Unused + */ +void AudioSeq_ReplaceSeqCmdSetupOpVolRestore(u8 seqPlayerIndex, u8 setupOpDisabled) { + u8 i; + + for (i = 0; i < gActiveSeqs[seqPlayerIndex].setupCmdNum; i++) { + u8 setupOp = (gActiveSeqs[seqPlayerIndex].setupCmd[i] & 0xF00000) >> 20; + + if (setupOp == setupOpDisabled) { + gActiveSeqs[seqPlayerIndex].setupCmd[i] = 0xFF000000; + } + } +} + +void AudioSeq_SetVolumeScale(u8 seqPlayerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer) { + f32 volScale; + u8 i; + + gActiveSeqs[seqPlayerIndex].volScales[scaleIndex] = targetVol & 0x7F; + + if (volFadeTimer != 0) { + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = true; + gActiveSeqs[seqPlayerIndex].volFadeTimer = volFadeTimer; + } else { + for (i = 0, volScale = 1.0f; i < VOL_SCALE_INDEX_MAX; i++) { + volScale *= gActiveSeqs[seqPlayerIndex].volScales[i] / 127.0f; + } + + SEQCMD_SET_SEQPLAYER_VOLUME_NOW(seqPlayerIndex, volFadeTimer, volScale); + } +} + +/** + * Update different commands and requests for active sequences + */ +void AudioSeq_UpdateActiveSequences(void) { + u32 tempoCmd; + u16 tempoPrev; + u16 seqId; + u16 channelMask; + u16 tempoTarget; + u8 setupOp; + u8 targetSeqPlayerIndex; + u8 setupVal2; + u8 setupVal1; + u8 tempoOp; + s32 pad[2]; + u32 retMsg; + f32 volume; + u8 tempoTimer; + u8 seqPlayerIndex; + u8 j; + u8 channelIndex; + + for (seqPlayerIndex = 0; seqPlayerIndex < SEQ_PLAYER_MAX; seqPlayerIndex++) { + + // The seqPlayer has finished initializing and is currently playing the active sequences + if (gActiveSeqs[seqPlayerIndex].isSeqPlayerInit && gAudioCtx.seqPlayers[seqPlayerIndex].enabled) { + gActiveSeqs[seqPlayerIndex].isSeqPlayerInit = false; + } + + // The seqPlayer is no longer playing the active sequences + if ((AudioSeq_GetActiveSeqId(seqPlayerIndex) != NA_BGM_DISABLED) && + !gAudioCtx.seqPlayers[seqPlayerIndex].enabled && (!gActiveSeqs[seqPlayerIndex].isSeqPlayerInit)) { + gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED; + } + + // Check if the requested sequences is waiting for fonts to load + if (gActiveSeqs[seqPlayerIndex].isWaitingForFonts) { + switch ((s32)AudioThread_GetExternalLoadQueueMsg(&retMsg)) { + case SEQ_PLAYER_BGM_MAIN + 1: + case SEQ_PLAYER_FANFARE + 1: + case SEQ_PLAYER_SFX + 1: + case SEQ_PLAYER_BGM_SUB + 1: + case SEQ_PLAYER_AMBIENCE + 1: + // The fonts have been loaded successfully. + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = false; + // Queue the same command that was stored previously, but without the 0x8000 + AudioSeq_ProcessSeqCmd(gActiveSeqs[seqPlayerIndex].startAsyncSeqCmd); + break; + case 0xFF: + // There was an error in loading the fonts + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = false; + break; + } + } + + // Update global volume + if (gActiveSeqs[seqPlayerIndex].fadeVolUpdate) { + volume = 1.0f; + for (j = 0; j < VOL_SCALE_INDEX_MAX; j++) { + volume *= (gActiveSeqs[seqPlayerIndex].volScales[j] / 127.0f); + } + + SEQCMD_SET_SEQPLAYER_VOLUME((u8)(seqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), + gActiveSeqs[seqPlayerIndex].volFadeTimer, (u8)(volume * 127.0f)); + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = false; + } + + if (gActiveSeqs[seqPlayerIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].volTimer--; + + if (gActiveSeqs[seqPlayerIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].volCur -= gActiveSeqs[seqPlayerIndex].volStep; + } else { + gActiveSeqs[seqPlayerIndex].volCur = gActiveSeqs[seqPlayerIndex].volTarget; + } + + AUDIOCMD_SEQPLAYER_FADE_VOLUME_SCALE(seqPlayerIndex, gActiveSeqs[seqPlayerIndex].volCur); + } + + // Process tempo + if (gActiveSeqs[seqPlayerIndex].tempoCmd != 0) { + tempoCmd = gActiveSeqs[seqPlayerIndex].tempoCmd; + tempoTimer = (tempoCmd & 0xFF0000) >> 15; + tempoTarget = tempoCmd & 0xFFF; + if (tempoTimer == 0) { + tempoTimer++; + } + + // Process tempo commands + if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) { + tempoPrev = gAudioCtx.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT; + tempoOp = (tempoCmd & 0xF000) >> 12; + switch (tempoOp) { + case SEQCMD_SUB_OP_TEMPO_SPEED_UP: + // Speed up tempo by `tempoTarget` amount + tempoTarget += tempoPrev; + break; + + case SEQCMD_SUB_OP_TEMPO_SLOW_DOWN: + // Slow down tempo by `tempoTarget` amount + if (tempoTarget < tempoPrev) { + tempoTarget = tempoPrev - tempoTarget; + } + break; + + case SEQCMD_SUB_OP_TEMPO_SCALE: + // Scale tempo by a multiplicative factor + tempoTarget = tempoPrev * (tempoTarget / 100.0f); + break; + + case SEQCMD_SUB_OP_TEMPO_RESET: + // Reset tempo to original tempo + tempoTarget = (gActiveSeqs[seqPlayerIndex].tempoOriginal != 0) + ? gActiveSeqs[seqPlayerIndex].tempoOriginal + : tempoPrev; + break; + + default: // `SEQCMD_SUB_OP_TEMPO_SET` + // `tempoTarget` is the new tempo + break; + } + + if (gActiveSeqs[seqPlayerIndex].tempoOriginal == 0) { + gActiveSeqs[seqPlayerIndex].tempoOriginal = tempoPrev; + } + + gActiveSeqs[seqPlayerIndex].tempoTarget = tempoTarget; + gActiveSeqs[seqPlayerIndex].tempoCur = gAudioCtx.seqPlayers[seqPlayerIndex].tempo / 0x30; + gActiveSeqs[seqPlayerIndex].tempoStep = + (gActiveSeqs[seqPlayerIndex].tempoCur - gActiveSeqs[seqPlayerIndex].tempoTarget) / tempoTimer; + gActiveSeqs[seqPlayerIndex].tempoTimer = tempoTimer; + gActiveSeqs[seqPlayerIndex].tempoCmd = 0; + } + } + + // Step tempo to target + if (gActiveSeqs[seqPlayerIndex].tempoTimer != 0) { + gActiveSeqs[seqPlayerIndex].tempoTimer--; + if (gActiveSeqs[seqPlayerIndex].tempoTimer != 0) { + gActiveSeqs[seqPlayerIndex].tempoCur -= gActiveSeqs[seqPlayerIndex].tempoStep; + } else { + gActiveSeqs[seqPlayerIndex].tempoCur = gActiveSeqs[seqPlayerIndex].tempoTarget; + } + + AUDIOCMD_SEQPLAYER_SET_TEMPO(seqPlayerIndex, gActiveSeqs[seqPlayerIndex].tempoCur); + } + + // Update channel volumes + if (gActiveSeqs[seqPlayerIndex].volChannelFlags != 0) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer--; + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur -= + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volStep; + } else { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur = + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volTarget; + gActiveSeqs[seqPlayerIndex].volChannelFlags ^= (1 << channelIndex); + } + + AUDIOCMD_CHANNEL_SET_VOL_SCALE(seqPlayerIndex, channelIndex, + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].volCur); + } + } + } + + // Update frequencies + if (gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags != 0) { + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer--; + if (gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTimer != 0) { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur -= + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleStep; + } else { + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur = + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleTarget; + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags ^= (1 << channelIndex); + } + + AUDIOCMD_CHANNEL_SET_FREQ_SCALE(seqPlayerIndex, channelIndex, + gActiveSeqs[seqPlayerIndex].channelData[channelIndex].freqScaleCur); + } + } + } + + // Process setup commands + if (gActiveSeqs[seqPlayerIndex].setupCmdNum != 0) { + // If there is a SeqCmd to reset the audio heap queued, then drop all setup commands + if (!AudioSeq_IsSeqCmdNotQueued(SEQCMD_OP_RESET_AUDIO_HEAP << 28, SEQCMD_OP_MASK)) { + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + break; + } + + // Only process setup commands once the timer reaches zero + if (gActiveSeqs[seqPlayerIndex].setupCmdTimer != 0) { + gActiveSeqs[seqPlayerIndex].setupCmdTimer--; + continue; + } + + // Only process setup commands if `seqPlayerIndex` if no longer playing + // i.e. the `seqPlayer` is no longer enabled + if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) { + continue; + } + + for (j = 0; j < gActiveSeqs[seqPlayerIndex].setupCmdNum; j++) { + setupOp = (gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xF00000) >> 20; + targetSeqPlayerIndex = (gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xF0000) >> 16; + setupVal2 = (gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFF00) >> 8; + setupVal1 = gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFF; + + switch (setupOp) { + case SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME: + // Restore `targetSeqPlayerIndex` volume back to normal levels + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, VOL_SCALE_INDEX_FANFARE, 0x7F, setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED: + // Restore `targetSeqPlayerIndex` volume back to normal levels, + // but only if the number of sequence queue requests from `sSeqRequests` + // exactly matches the argument to the command + if (setupVal1 == sNumSeqRequests[seqPlayerIndex]) { + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, VOL_SCALE_INDEX_FANFARE, 0x7F, setupVal2); + } + break; + + case SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE: + // Unqueue `seqPlayerIndex` from sSeqRequests + //! @bug this command does not work as intended as unqueueing + //! the sequence relies on `gActiveSeqs[seqPlayerIndex].seqId` + //! However, `gActiveSeqs[seqPlayerIndex].seqId` is reset before the sequence on + //! `seqPlayerIndex` is requested to stop, i.e. before the sequence is disabled and setup + //! commands (including this command) can run. A simple fix would have been to unqueue based on + //! `gActiveSeqs[seqPlayerIndex].prevSeqId` instead + SEQCMD_UNQUEUE_SEQUENCE((u8)(seqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), 0, + gActiveSeqs[seqPlayerIndex].seqId); + break; + + case SEQCMD_SUB_OP_SETUP_RESTART_SEQ: + // Restart the currently active sequence on `targetSeqPlayerIndex` with full volume. + // Sequence on `targetSeqPlayerIndex` must still be active to play (can be muted) + SEQCMD_PLAY_SEQUENCE((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), 1, + gActiveSeqs[targetSeqPlayerIndex].seqId); + gActiveSeqs[targetSeqPlayerIndex].fadeVolUpdate = true; + gActiveSeqs[targetSeqPlayerIndex].volScales[1] = 0x7F; + break; + + case SEQCMD_SUB_OP_SETUP_TEMPO_SCALE: + // Scale tempo by a multiplicative factor + SEQCMD_SCALE_TEMPO((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), setupVal2, + setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_TEMPO_RESET: + // Reset tempo to previous tempo + SEQCMD_RESET_TEMPO((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_PLAY_SEQ: + // Play the requested sequence + // Uses the fade timer set by `SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER` + seqId = gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFFFF; + SEQCMD_PLAY_SEQUENCE((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), + gActiveSeqs[targetSeqPlayerIndex].setupFadeTimer, seqId); + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, VOL_SCALE_INDEX_FANFARE, 0x7F, 0); + gActiveSeqs[targetSeqPlayerIndex].setupFadeTimer = 0; + break; + + case SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER: + // A command specifically to support `SEQCMD_SUB_OP_SETUP_PLAY_SEQ` + // Sets the fade timer for the sequence requested in `SEQCMD_SUB_OP_SETUP_PLAY_SEQ` + gActiveSeqs[seqPlayerIndex].setupFadeTimer = setupVal2; + break; + + case SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX: + // Restore the volume back to default levels + // Allows a `scaleIndex` to be specified. + AudioSeq_SetVolumeScale(targetSeqPlayerIndex, setupVal2, 0x7F, setupVal1); + break; + + case SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE: + // Discard audio data by popping one more audio caches from the audio heap + if (setupVal1 & (1 << SEQUENCE_TABLE)) { + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(SEQUENCE_TABLE); + } + if (setupVal1 & (1 << FONT_TABLE)) { + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(FONT_TABLE); + } + if (setupVal1 & (1 << SAMPLE_TABLE)) { + AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(SAMPLE_TABLE); + } + break; + + case SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK: + // Disable (or reenable) specific channels of `targetSeqPlayerIndex` + channelMask = gActiveSeqs[seqPlayerIndex].setupCmd[j] & 0xFFFF; + SEQCMD_SET_CHANNEL_DISABLE_MASK((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), + channelMask); + break; + + case SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ: + // Scale all channels of `targetSeqPlayerIndex` + SEQCMD_SET_SEQPLAYER_FREQ((u8)(targetSeqPlayerIndex + (SEQCMD_ASYNC_ACTIVE >> 24)), setupVal2, + setupVal1 * 10); + break; + + default: + break; + } + } + + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + } + } +} + +u8 AudioSeq_UpdateAudioHeapReset(void) { + if (gAudioHeapResetState != AUDIO_HEAP_RESET_STATE_NONE) { + if (gAudioHeapResetState == AUDIO_HEAP_RESET_STATE_RESETTING) { + if (func_80193C5C() == 1) { + gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_NONE; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, gSfxChannelLayout); + Audio_ResetForAudioHeapStep2(); + } + } else if (gAudioHeapResetState == AUDIO_HEAP_RESET_STATE_RESETTING_ALT) { + while (func_80193C5C() != 1) {} + gAudioHeapResetState = AUDIO_HEAP_RESET_STATE_NONE; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, gSfxChannelLayout); + Audio_ResetForAudioHeapStep2(); + } + } + + return gAudioHeapResetState; +} + +u8 AudioSeq_ResetReverb(void) { + u8 isReverbFading = false; + u8 fadeReverb = ((sResetAudioHeapSeqCmd & 0xFF0000) >> 16); + u8 reverbIndex = 0; + u8 specId; + + if (sResetAudioHeapSeqCmd != 0) { + if (sResetAudioHeapTimer--) { + while (fadeReverb != 0) { + if (fadeReverb & 1) { + AUDIOCMD_GLOBAL_SET_REVERB_DATA(reverbIndex, REVERB_DATA_TYPE_VOLUME, + sResetAudioHeapFadeReverbVolume); + AudioThread_ScheduleProcessCmds(); + } + reverbIndex++; + fadeReverb = fadeReverb >> 1; + } + + sResetAudioHeapFadeReverbVolume -= sResetAudioHeapFadeReverbVolumeStep; + isReverbFading = true; + } else { + while (fadeReverb != 0) { + if (fadeReverb & 1) { + AUDIOCMD_GLOBAL_SET_REVERB_DATA( + reverbIndex, REVERB_DATA_TYPE_SETTINGS, + (s32)(gReverbSettingsTable[(u8)(sResetAudioHeapSeqCmd & 0xFF)] + reverbIndex)); + AudioThread_ScheduleProcessCmds(); + } + reverbIndex++; + fadeReverb = fadeReverb >> 1; + } + + sResetAudioHeapSeqCmd = 0; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, gSfxChannelLayout); + Audio_ResetForAudioHeapStep3(); + } + } + + return isReverbFading; +} + +void AudioSeq_ResetActiveSequences(void) { + u8 seqPlayerIndex; + u8 scaleIndex; + + for (seqPlayerIndex = 0; seqPlayerIndex < SEQ_PLAYER_MAX; seqPlayerIndex++) { + sNumSeqRequests[seqPlayerIndex] = 0; + + gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED; + gActiveSeqs[seqPlayerIndex].prevSeqId = NA_BGM_DISABLED; + gActiveSeqs[seqPlayerIndex].tempoTimer = 0; + gActiveSeqs[seqPlayerIndex].tempoOriginal = 0; + gActiveSeqs[seqPlayerIndex].tempoCmd = 0; + gActiveSeqs[seqPlayerIndex].channelPortMask = 0; + gActiveSeqs[seqPlayerIndex].setupCmdNum = 0; + gActiveSeqs[seqPlayerIndex].setupFadeTimer = 0; + gActiveSeqs[seqPlayerIndex].freqScaleChannelFlags = 0; + gActiveSeqs[seqPlayerIndex].volChannelFlags = 0; + gActiveSeqs[seqPlayerIndex].isWaitingForFonts = false; + gActiveSeqs[seqPlayerIndex].isSeqPlayerInit = false; + + for (scaleIndex = 0; scaleIndex < VOL_SCALE_INDEX_MAX; scaleIndex++) { + gActiveSeqs[seqPlayerIndex].volScales[scaleIndex] = 0x7F; + } + + gActiveSeqs[seqPlayerIndex].volFadeTimer = 1; + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = true; + } +} + +void AudioSeq_ResetActiveSequencesAndVolume(void) { + u8 seqPlayerIndex; + u8 scaleIndex; + + for (seqPlayerIndex = 0; seqPlayerIndex < SEQ_PLAYER_MAX; seqPlayerIndex++) { + gActiveSeqs[seqPlayerIndex].volCur = 1.0f; + gActiveSeqs[seqPlayerIndex].volTimer = 0; + gActiveSeqs[seqPlayerIndex].fadeVolUpdate = false; + for (scaleIndex = 0; scaleIndex < VOL_SCALE_INDEX_MAX; scaleIndex++) { + gActiveSeqs[seqPlayerIndex].volScales[scaleIndex] = 0x7F; + } + } + AudioSeq_ResetActiveSequences(); +} diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 76597f5f3..537a9f394 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -102,8 +102,8 @@ void AudioSfx_MuteBanks(u16 muteMask) { void AudioSfx_LowerBgmVolume(u8 channelIndex) { sSfxChannelLowVolumeFlag |= (1 << channelIndex); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 2, 0x40, 0xF); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 2, 0x40, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_SFX, 0x40, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_SFX, 0x40, 0xF); } /** @@ -114,8 +114,8 @@ void AudioSfx_RestoreBgmVolume(u8 channelIndex) { sSfxChannelLowVolumeFlag &= ((1 << channelIndex) ^ 0xFFFF); if (sSfxChannelLowVolumeFlag == 0) { - Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 2, 0x7F, 0xF); - Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 2, 0x7F, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_SFX, 0x7F, 0xF); + AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_SFX, 0x7F, 0xF); } } diff --git a/src/audio/voice_internal.c b/src/audio/voice_internal.c index e09fdd68c..055b66ed1 100644 --- a/src/audio/voice_internal.c +++ b/src/audio/voice_internal.c @@ -37,6 +37,6 @@ UNK_TYPE func_801A51F0(UNK_TYPE arg0) { #pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5808.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5A10.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/AudioVoice_ResetData.s") #pragma GLOBAL_ASM("asm/non_matchings/code/voice_internal/func_801A5A1C.s") diff --git a/src/code/audio_thread_manager.c b/src/code/audio_thread_manager.c index eca7ddd83..45fbcb87e 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -80,7 +80,7 @@ void AudioMgr_ThreadEntry(void* arg) { Audio_Init(); AudioLoad_SetDmaHandler(DmaMgr_DmaHandler); - func_801A4D00(); + Audio_InitSound(); osSendMesg(&audioMgr->lockMsgQ, NULL, OS_MESG_BLOCK); IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptMsgQ); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index c3e3ecff0..2628658f6 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -396,9 +396,9 @@ void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCm u8 fadeTimer = cmd->endFrame - cmd->startFrame; if (cmd->type == 2) { - Audio_QueueSeqCmd((fadeTimer << 0x10) | 0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, fadeTimer); } else { - Audio_QueueSeqCmd((fadeTimer << 0x10) | NA_BGM_STOP); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, fadeTimer); } } } @@ -471,7 +471,7 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { break; case 7: - seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + seqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); break; case 8: @@ -492,7 +492,7 @@ void Cutscene_Command_FadeAmbienceSequence(PlayState* play, CutsceneContext* csC if (csCtx->frames == cmd->startFrame && csCtx->frames < cmd->endFrame) { u8 fadeTimer = cmd->endFrame - cmd->startFrame; - Audio_QueueSeqCmd((fadeTimer << 0x10) | 0x140000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, fadeTimer); } } diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 01eaf2cd8..4e24eb72e 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -73,7 +73,7 @@ void GameOver_Update(PlayState* play) { break; case GAMEOVER_DEATH_FADE_OUT: - if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { func_80169F78(&play->state); if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 5f5440a2f..cb4a296d4 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4324,7 +4324,7 @@ void Interface_DrawPerfectLetters(PlayState* play) { void Interface_StartMoonCrash(PlayState* play) { if (play->actorCtx.flags & ACTORCTX_FLAG_1) { - Audio_QueueSeqCmd(0xE0000100); + SEQCMD_DISABLE_PLAY_SEQUENCES(false); } gSaveContext.save.day = 4; diff --git a/src/code/z_play.c b/src/code/z_play.c index 52146a121..ea86b2e82 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -572,7 +572,7 @@ void Play_UpdateTransition(PlayState* this) { ((this->nextEntrance == ENTRANCE(TERMINA_FIELD, 2)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) || ((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20))) && (!func_800FE590(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) || - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) { + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) { func_801A4058(20); gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; @@ -585,7 +585,7 @@ void Play_UpdateTransition(PlayState* this) { } if (func_800FE590(this) && (Entrance_GetSceneId(this->nextEntrance + sceneLayer) >= 0) && - (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) { + (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) { func_801A41C8(20); } } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 1db125af2..1fa3ed54a 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -444,7 +444,7 @@ void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) { play->sequenceCtx.ambienceId = cmd->soundSettings.ambienceId; if (gSaveContext.seqId == (u8)NA_BGM_DISABLED || - Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) { + AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) { Audio_SetSpec(cmd->soundSettings.specId); } } diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 9bb3cdf75..d7fe81553 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -979,7 +979,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { } if (otherTwinmold->unk_0144 >= 10) { - Audio_QueueSeqCmd(NA_BGM_CLEAR_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_BOSS | SEQ_FLAG_ASYNC); } Actor_PlaySfx(&this->actor, NA_SE_EN_INBOSS_DEAD_OLD); @@ -1105,7 +1105,7 @@ void func_809DBFB4(Boss02* this, PlayState* play) { this->unk_0144 = 20; if (otherTwinmold->unk_0144 >= 10) { - Audio_QueueSeqCmd(0x100100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); } else { otherTwinmold->unk_0195 = 1; } @@ -1311,7 +1311,7 @@ void Boss02_Static_Update(Actor* thisx, PlayState* play) { if (sMusicStartTimer != 0) { sMusicStartTimer--; if (sMusicStartTimer == 0) { - Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC); } } } diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index a13e18ec1..4dd27f211 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -518,7 +518,7 @@ void Boss03_Init(Actor* thisx, PlayState* play2) { if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_56)) { this->actionFunc = func_809E344C; D_809E9842 = false; - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); } else { Boss03_SetupIntroCutscene(this, play); D_809E9842 = true; @@ -1305,7 +1305,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { this->actor.gravity = -1.5f; this->actor.speed = 20.0f; - Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC); Actor_PlaySfx(&this->actor, NA_SE_EN_KONB_JUMP_OLD); this->skelAnime.playSpeed = 1.0f; } @@ -1415,7 +1415,7 @@ void Boss03_SetupDeathCutscene(Boss03* this, PlayState* play) { this->actionFunc = Boss03_DeathCutscene; Animation_MorphToLoop(&this->skelAnime, &gGyorgFloppingAnim, -10.0f); this->floppingAnimLastFrame = Animation_GetLastFrame(&gGyorgFloppingAnim); - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); this->workTimer[WORK_TIMER_UNK0_C] = 0; this->unk_242 = 0; this->csState = 0; @@ -1558,7 +1558,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { case 1: if (this->unk_240 == 0x96) { - Audio_QueueSeqCmd(NA_BGM_CLEAR_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_BOSS | SEQ_FLAG_ASYNC); } Math_ApproachF(&this->unk_56C, 0.01f, 1.0f, 0.0005f); Math_ApproachF(&this->actor.scale.x, 0.01f, 0.05f, 0.001f); @@ -2084,7 +2084,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { if (D_809E9841 != 0) { D_809E9841--; if (D_809E9841 == 0) { - Audio_QueueSeqCmd(NA_BGM_BOSS | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_BOSS | SEQ_FLAG_ASYNC); } } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index f2f7a9ae5..423c70fc5 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -716,7 +716,7 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { break; case 1730: - Audio_QueueSeqCmd(0x141400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 20); break; case 1395: @@ -724,7 +724,7 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { break; case 1850: - Audio_QueueSeqCmd(0x42320000); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_SFX, 50, 0); break; case 2000: diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 2da9566ed..97bc517c9 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -673,7 +673,7 @@ void func_809C2730(EnAob01* this, PlayState* play) { void func_809C2788(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x20; if (func_809C25E4(this, play)) { - if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_HORSE_GOAL) { + if (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_HORSE_GOAL) { play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3; play->transitionType = TRANS_TYPE_64; diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 67c5bc0f0..3aad703de 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -699,7 +699,7 @@ void EnBaba_KnockedOver(EnBaba* this, PlayState* play) { } } else { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_40) && (DECR(this->sakonDeadTimer) == 0)) { - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); EnBaba_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } else { Actor_MoveWithGravity(&this->actor); diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 5b753ba54..b0c4102c2 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -292,7 +292,7 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { void func_809CD634(EnBji01* this, PlayState* play) { AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | (1 << BANK_OCARINA) | (1 << BANK_VOICE)); - Audio_QueueSeqCmd(0xE0000101); + SEQCMD_DISABLE_PLAY_SEQUENCES(true); play->nextEntrance = ENTRANCE(TERMINA_FIELD, 10); /* Telescope entrance */ gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = play->nextEntrance; func_80169EFC(&play->state); /* Load new entrance? */ @@ -346,13 +346,15 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { this->actor.params = SHIKASHI_TYPE_DEFAULT; func_809CCE98(this, play); break; + case ENTRANCE(ASTRAL_OBSERVATORY, 2): /* Telescope entrance */ this->actor.flags |= ACTOR_FLAG_10000; AudioSfx_MuteBanks(0); - Audio_QueueSeqCmd(0xE0000100); + SEQCMD_DISABLE_PLAY_SEQUENCES(false); this->actor.params = SHIKASHI_TYPE_LOOKED_THROUGH_TELESCOPE; func_809CCE98(this, play); break; + default: Actor_Kill(&this->actor); break; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index d76c39d38..373608dc4 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -851,7 +851,7 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { D_809171FC = 0; D_809171F6 = 10; - Audio_QueueSeqCmd(0x100100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); if (sLinkAge == 1) { if (gSaveContext.save.unk_EE4 & 0x7F) { @@ -3540,7 +3540,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_190 = 1.7f; this->unk_194 = 7000.0f; D_80917274 = 1; - Audio_QueueSeqCmd(0x881A); // Changed from 0x81A in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ENEMY | 0x800 | SEQ_FLAG_ASYNC); D_809171F6 = 0; if (this->unk_148 == 1) { @@ -3751,7 +3751,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } else { // Assignment of OoT's D_80B7E086 here removed in MM Rumble_Override(0.0f, 1, 3, 1); - Audio_QueueSeqCmd(0x100A00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10); } this->unk_150 = this->unk_152 = 0; @@ -3819,7 +3819,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } if (this->unk_172[0] == 90) { - Audio_QueueSeqCmd(0x8924); // changed from 0x924 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GET_HEART | 0x900 | SEQ_FLAG_ASYNC); D_8090CCFC = 40; if (this->unk_148 == 0) { @@ -3933,7 +3933,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { D_809101C4 = 520.0f; D_809101C0 = 195.0f; - Audio_QueueSeqCmd(0x100A00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10); D_809171F6 = 20; D_8090CD4C = 3; } @@ -5148,7 +5148,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { D_8090CD4C = 20; Rumble_Override(0.0f, 150, 10, 10); play_sound(NA_SE_SY_TRE_BOX_APPEAR); - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } if (D_8090CD50 != 0) { @@ -5356,7 +5356,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 22: if (D_8090CD50 == 30) { - Audio_QueueSeqCmd(0x8922); // changed from 0x922 to 0x8922 in MM + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GET_ITEM | 0x900 | SEQ_FLAG_ASYNC); } D_8090CD54 = 1; @@ -5638,15 +5638,15 @@ void EnFishing_DrawOwner(Actor* thisx, PlayState* play) { if (D_809171F6 == 0) { if (sLinkAge != 1) { - Audio_QueueSeqCmd(0x8019); // Changed from 0x19 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_EVENT | SEQ_FLAG_ASYNC); } else { - Audio_QueueSeqCmd(0x8027); // Changed from 0x27 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_MUSIC_BOX_HOUSE | SEQ_FLAG_ASYNC); } if (sLinkAge != 1) { - Audio_QueueSeqCmd(0x8019); // Changed from 0x19 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CLEAR_EVENT | SEQ_FLAG_ASYNC); } else { - Audio_QueueSeqCmd(0x8027); // Changed from 0x27 in OoT + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_MUSIC_BOX_HOUSE | SEQ_FLAG_ASYNC); } } } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 6aaf29cda..df3beb13b 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -538,7 +538,7 @@ void func_80962660(EnFu* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; this->unk_53C = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); if (this->unk_542 == 0) { if (this->unk_546 == 1) { func_80961EC8(play); @@ -789,14 +789,14 @@ void func_80962F4C(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x2888, &this->actor); this->unk_552 = 0x2888; } - func_801A2C20(); + Audio_StopSubBgm(); gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; this->unk_548 = 0; func_809632D0(this); } else { this->unk_548 = 0; - func_801A2C20(); + Audio_StopSubBgm(); gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index 0d9f668d6..d2aacf748 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -257,11 +257,11 @@ void func_80BC7068(EnGuruguru* this, PlayState* play) { } if ((this->unk268 != 0) && (this->textIdIndex >= 7)) { this->skelAnime.playSpeed = 2.0f; - func_801A29D4(3, 1.18921f, 2); + Audio_SetSeqTempoAndFreq(3, 1.18921f, 2); func_801A3B48(0); } else { if (this->skelAnime.playSpeed == 2.0f) { - func_801A29D4(3, 1.0f, 2); + Audio_SetSeqTempoAndFreq(3, 1.0f, 2); } if (this->unk268 == 0) { func_801A3B48(1); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 2a698528f..6d3e01952 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -2934,7 +2934,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { if (((play->interfaceCtx.minigameAmmo == 0) || (this->hbaFlags & 2)) && (this->hbaFlags & 4)) { this->hbaFlags &= ~4; - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); } if (this->hbaStarted == 0) { diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index e650ef6d3..5e7619cd2 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -248,7 +248,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { } if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(180)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; @@ -281,7 +281,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if ((this->unk_164 & 0x4000) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x40000)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; @@ -314,7 +314,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if ((this->unk_164 & 0x200000) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x02000000)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x02000000; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; @@ -343,7 +343,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { if ((this->unk_164 & 0x80) && (horseGameCheck != NULL) && (horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) && (horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x800)) { - Audio_QueueSeqCmd(0x8041); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x800; gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 183dc152b..f208ece37 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1653,7 +1653,7 @@ void func_80B4627C(EnInvadepoh* this, PlayState* play) { } else { func_80B454BC(this, play); func_80B452EC(this, play); - Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ALIEN_INVASION | SEQ_FLAG_ASYNC); func_80B46F88(this); } } else if (D_80B4E940 == 3) { @@ -1941,7 +1941,7 @@ void func_80B46EE8(EnInvadepoh* this, PlayState* play) { this->actionTimer--; if (this->actionTimer <= 0) { ActorCutscene_Stop(D_80B50404[0]); - Audio_QueueSeqCmd(NA_BGM_ALIEN_INVASION | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ALIEN_INVASION | SEQ_FLAG_ASYNC); func_80B46F88(this); } } diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 0cbe49fb9..8b3ec5956 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -284,7 +284,7 @@ void func_80C1410C(EnJgameTsn* this, PlayState* play) { Player* player = GET_PLAYER(play); player->stateFlags1 |= PLAYER_STATE1_20; - func_801A2BB8(0x25); + Audio_PlaySubBgm(0x25); play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; Interface_InitMinigame(play); SET_WEEKEVENTREG(WEEKEVENTREG_90_20); @@ -341,7 +341,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x109F; player->stateFlags1 |= PLAYER_STATE1_20; *this->unk_208[this->unk_218] &= ~OBJLUPYGAMELIFT_IGNITE_FIRE; - func_801A2C20(); + Audio_StopSubBgm(); func_80C14030(this); } else if ((player->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) || (player->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { @@ -350,7 +350,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x10A0; player->stateFlags1 |= PLAYER_STATE1_20; *this->unk_208[this->unk_218] &= ~OBJLUPYGAMELIFT_IGNITE_FIRE; - func_801A2C20(); + Audio_StopSubBgm(); func_80C14030(this); } @@ -359,7 +359,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { this->unk_300 = 0x10A1; player->stateFlags1 |= PLAYER_STATE1_20; *this->unk_208[this->unk_218] &= ~OBJLUPYGAMELIFT_IGNITE_FIRE; - func_801A2C20(); + Audio_StopSubBgm(); func_80C14030(this); } } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 6c8ea9fe8..fca1afc51 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -506,7 +506,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->subCamUp.x = -0.11f; this->picto.actor.draw = EnKaizoku_Draw; this->unk_598 = 0; - func_801A0238(0, 0xA); + Audio_SetMainBgmVolume(0, 0xA); this->unk_59C++; case 1: @@ -575,7 +575,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { Message_CloseTextbox(play); this->unk_598 = 0; this->unk_59C++; - func_801A0238(0x7F, 0); + Audio_SetMainBgmVolume(0x7F, 0); Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_13); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 35770e38c..d35e767c0 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -800,7 +800,7 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { if (currentDay == 3 && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { - func_801A2BB8(NA_BGM_SARIAS_SONG); + Audio_PlaySubBgm(NA_BGM_SARIAS_SONG); EnKakasi_SetupDanceNightAway(this); } } diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index 72e0f0757..38fc47610 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -731,7 +731,7 @@ void func_80AEAFA0(EnLiftNuts* this, PlayState* play) { } void func_80AEB114(EnLiftNuts* this) { - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); this->actionFunc = func_80AEB148; } diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 093fa3c30..69bcf41b3 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -730,8 +730,8 @@ void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play) { void EnMa4_SetupHorsebackGameEnd(EnMa4* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_08_01); this->actionFunc = EnMa4_HorsebackGameEnd; - Audio_QueueSeqCmd(NA_BGM_STOP); - Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); } void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 89a5327a8..1fc29eafc 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -373,7 +373,7 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { void func_80A6FBA0(EnMm3* this) { AudioSfx_MuteBanks((1 << BANK_PLAYER) | (1 << BANK_ITEM) | (1 << BANK_ENV) | (1 << BANK_ENEMY) | (1 << BANK_OCARINA) | (1 << BANK_VOICE)); - func_801A0238(0, 5); + Audio_SetMainBgmVolume(0, 5); SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT); CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED); this->actionFunc = func_80A6FBFC; @@ -400,7 +400,7 @@ void func_80A6FBFC(EnMm3* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { AudioSfx_MuteBanks(0); - func_801A0238(0x7F, 5); + Audio_SetMainBgmVolume(0x7F, 5); Message_StartTextbox(play, 0x2791, &this->actor); this->unk_2B4 = 0x2791; this->unk_2AC = 7; diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index cff2892f4..e772e12fa 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -257,7 +257,7 @@ void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; Message_StartTextbox(play, 0xE95, NULL); // An entrant made a false start func_800B7298(play, &this->actor, PLAYER_CSMODE_7); - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); this->actionFunc = EnMttag_PotentiallyRestartRace; } @@ -317,7 +317,7 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { if (DECR(this->timer) == 60) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; - Audio_QueueSeqCmd(NA_BGM_GORON_RACE | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_RACE | SEQ_FLAG_ASYNC); play->envCtx.unk_E4 = 0xFE; player->stateFlags1 &= ~PLAYER_STATE1_20; } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) { @@ -362,14 +362,14 @@ void EnMttag_Race(EnMttag* this, PlayState* play) { if (EnMttag_IsInFinishLine(playerPos)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; play_sound(NA_SE_SY_START_SHOT); - Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_GOAL | SEQ_FLAG_ASYNC); this->timer = 55; SET_EVENTINF(EVENTINF_11); this->actionFunc = EnMttag_RaceFinish; } else if (EnMttag_IsAnyRaceGoronOverFinishLine(this)) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; play_sound(NA_SE_SY_START_SHOT); - Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_GOAL | SEQ_FLAG_ASYNC); this->timer = 55; SET_EVENTINF(EVENTINF_12); this->actionFunc = EnMttag_RaceFinish; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index fd45820c1..52287f317 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -292,7 +292,7 @@ void func_8095ABA8(EnOwl* this) { void func_8095ABF0(EnOwl* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - Audio_QueueSeqCmd(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); func_8095AAD0(this, play); this->actor.flags &= ~ACTOR_FLAG_10000; } @@ -301,7 +301,7 @@ void func_8095ABF0(EnOwl* this, PlayState* play) { // Unused? void func_8095AC50(EnOwl* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - Audio_QueueSeqCmd(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); if ((this->unk_3DA % 64) == 0) { func_8095AAD0(this, play); } else { @@ -665,7 +665,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { case 0xBEE: Message_CloseTextbox(play); - Audio_QueueSeqCmd(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); EnOwl_ChangeMode(this, func_8095B9FC, func_8095C484, &this->skelAnime1, &object_owl_Anim_00CB94, 0.0f); this->eyeTexIndex = 0; @@ -681,7 +681,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { case 0xBEF: case 0xBF3: Message_CloseTextbox(play); - Audio_QueueSeqCmd(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); func_8095ACEC(this); this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.textId = 0xBF0; @@ -694,7 +694,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { case 0xBF5: Message_CloseTextbox(play); - Audio_QueueSeqCmd(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); this->actor.flags &= ~ACTOR_FLAG_10000; EnOwl_ChangeMode(this, func_8095B3DC, func_8095C484, &this->skelAnime1, &object_owl_Anim_00CB94, 0.0f); diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index a284f240a..c356a318b 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -586,7 +586,7 @@ void EnRacedog_CheckForFinish(EnRacedog* this) { this->raceStatus == RACEDOG_RACE_STATUS_AFTER_POINT_11) { sNumberOfDogsFinished++; if (sNumberOfDogsFinished == 1) { - Audio_QueueSeqCmd(NA_BGM_HORSE_GOAL | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_HORSE_GOAL | SEQ_FLAG_ASYNC); play_sound(NA_SE_SY_START_SHOT); } diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 150ff9455..5bffa0d83 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -1173,7 +1173,7 @@ void func_80BAD230(EnSuttari* this, PlayState* play) { this->textId = 0x2A31; Message_StartTextbox(play, this->textId, &this->actor); this->flags1 |= 0x4000; - Audio_QueueSeqCmd(NA_BGM_CHASE | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CHASE | SEQ_FLAG_ASYNC); this->actionFunc = func_80BAD380; } else { ActorCutscene_SetIntentToPlay(this->cutscenes[1]); @@ -1234,7 +1234,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_33_08); } this->actor.speed = 0.0f; - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); this->flags2 |= 4; EnSuttari_TriggerTransition(play, ENTRANCE(NORTH_CLOCK_TOWN, 7)); } else { @@ -1465,7 +1465,7 @@ void EnSuttari_Destroy(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; if ((play->sceneId == SCENE_BACKTOWN) && !(this->flags2 & 4)) { - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } Collider_DestroyCylinder(play, &this->collider); } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 3ac6d4cdb..b0c052b5c 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -404,7 +404,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) func_80123F2C(play, 80); this->shootingGameState = SG_GAME_STATE_RUNNING; this->actionFunc = EnSyatekiMan_Swamp_StartGame; - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); break; case 0xA32: // You have to try harder! @@ -762,7 +762,7 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) Interface_InitMinigame(play); func_80123F2C(play, 0x63); this->shootingGameState = SG_GAME_STATE_RUNNING; - func_801A2BB8(NA_BGM_TIMED_MINI_GAME); + Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME); this->actionFunc = EnSyatekiMan_Town_StartGame; break; @@ -1078,7 +1078,7 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { this->currentWave = 0; player->stateFlags1 |= PLAYER_STATE1_20; sHasSpawnedGuaysForThisWave = false; - func_801A2C20(); + Audio_StopSubBgm(); this->actionFunc = EnSyatekiMan_Swamp_EndGame; } else if ((this->currentWave == 4) && (this->wolfosFlags == 0) && (this->perGameVar2.bonusDekuScrubHitCounter == 2)) { @@ -1087,7 +1087,7 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { this->currentWave = 0; player->stateFlags1 |= PLAYER_STATE1_20; sHasSpawnedGuaysForThisWave = false; - func_801A2C20(); + Audio_StopSubBgm(); this->shootingGameState = SG_GAME_STATE_GIVING_BONUS; if (this->score == 2120) { Interface_SetPerfectLetters(play, PERFECT_LETTERS_TYPE_2); @@ -1355,7 +1355,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; sModFromLosingTime = 0; this->actor.draw = EnSyatekiMan_Draw; - func_801A2C20(); + Audio_StopSubBgm(); this->actionFunc = EnSyatekiMan_Town_EndGame; if (this->score == 50) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 8554505f0..dadfc5af4 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -773,7 +773,7 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { if (play->actorCtx.flags & ACTORCTX_FLAG_5) { this->unk_D8D = ActorCutscene_GetAdditionalCutscene(this->unk_D8D); } - Audio_QueueSeqCmd(NA_BGM_STOP | 0x10000); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); D_80A41D20 = 2; } else { func_80A3F73C(this, play); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 6f1c5ac54..2b57ecf51 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -806,7 +806,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B))) { this->unk_286 = 1; this->unk_27A = 39; - Audio_QueueSeqCmd(0x111400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); } if (DECR(this->unk_27A) == 0) { diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index ecfd9387c..0da7a17bb 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -472,7 +472,7 @@ void EnZod_SetupRehearse(EnZod* this, PlayState* play) { this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); ActorCutscene_SetIntentToPlay(this->actor.cutscene); gSaveContext.save.weekEventReg[79] |= 1; - Audio_QueueSeqCmd(NA_BGM_INDIGO_GO_SESSION | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_INDIGO_GO_SESSION | SEQ_FLAG_ASYNC); } } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index b68827c40..17c4a9f70 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -429,7 +429,7 @@ void func_80BD1DB8(EnZov* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_78_01); this->actionFunc = func_80BD1D94; play->msgCtx.msgLength = 0; - Audio_QueueSeqCmd(0x101400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); break; default: diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index af796da2c..8af30b3fd 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -60,8 +60,8 @@ void ObjDemo_Init(Actor* thisx, PlayState* play) { } void func_80983634(PlayState* play) { - if ((play->sceneId == SCENE_CASTLE) && (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_IKANA_CASTLE)) { - Audio_QueueSeqCmd(0x100100FF); + if ((play->sceneId == SCENE_CASTLE) && (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_IKANA_CASTLE)) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); } } @@ -89,7 +89,7 @@ void func_80983704(ObjDemo* this, PlayState* play) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } if (play->sceneId == SCENE_CASTLE) { - Audio_QueueSeqCmd(NA_BGM_IKANA_CASTLE | 0x8000); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_IKANA_CASTLE | SEQ_FLAG_ASYNC); } this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); if (this->actor.cutscene == -1) { diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index 2307fe2c4..1f42807c2 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -232,7 +232,7 @@ void func_80BA28DC(ObjNozoki* this, PlayState* play) { } else if (ActorCutscene_GetCurrentIndex() != this->unk_15F) { this->unk_15F = cs; this->dyna.actor.params &= ~OBJNOZOKI_400; - Audio_QueueSeqCmd(0x881A); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ENEMY | 0x800 | SEQ_FLAG_ASYNC); } return; } diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 09fab57d6..f06d13caf 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -222,7 +222,7 @@ s32 ObjUm_InitBandits(ObjUm* this, PlayState* play) { EnHorse* bandit2; spawnPoints = Lib_SegmentedToVirtual(path->points); - Audio_QueueSeqCmd(0x8000 | NA_BGM_CHASE); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CHASE | SEQ_FLAG_ASYNC); bandit1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPoints[0].x, spawnPoints[0].y, spawnPoints[0].z, 0, this->dyna.actor.shape.rot.y, 0, diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 183f6b069..ab34ebffe 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -30,7 +30,7 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; gSaveContext.hudVisibilityTimer = 0; - Audio_QueueSeqCmd(NA_BGM_STOP); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); gSaveContext.save.entrance = entrance; if (spawn != 0) { diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 9957b3696..8afe297a8 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -3857,7 +3857,7 @@ 0x8019E014:("Audio_Update",), 0x8019E0FC:("Audio_Noop4",), 0x8019E104:("Audio_Noop5",), - 0x8019E110:("func_8019E110",), + 0x8019E110:("Audio_PlayMainBgm",), 0x8019E14C:("AudioSfx_ComputeVolume",), 0x8019E324:("AudioSfx_ComputeReverb",), 0x8019E4B0:("AudioSfx_ComputePanSigned",), @@ -3901,10 +3901,10 @@ 0x801A0048:("Audio_PlaySfxForWaterfall",), 0x801A00EC:("Audio_StepFreqLerp",), 0x801A0124:("func_801A0124",), - 0x801A0184:("func_801A0184",), - 0x801A01C4:("func_801A01C4",), + 0x801A0184:("Audio_SetBgmVolumeOff",), + 0x801A01C4:("Audio_SetBgmVolumeOn",), 0x801A0204:("func_801A0204",), - 0x801A0238:("func_801A0238",), + 0x801A0238:("Audio_SetMainBgmVolume",), 0x801A026C:("Audio_SetGanonsTowerBgmVolumeLevel",), 0x801A0318:("Audio_SetGanonsTowerBgmVolume",), 0x801A0450:("Audio_LowerMainBgmVolume",), @@ -3943,12 +3943,12 @@ 0x801A25E4:("Audio_PlaySceneSequence",), 0x801A2670:("Audio_StartSceneSequence",), 0x801A2778:("Audio_UpdateSceneSequenceResumePoint",), - 0x801A27E8:("func_801A27E8",), - 0x801A281C:("func_801A281C",), - 0x801A29D4:("func_801A29D4",), - 0x801A2BB8:("func_801A2BB8",), - 0x801A2C20:("func_801A2C20",), - 0x801A2C44:("func_801A2C44",), + 0x801A27E8:("Audio_PlayBgmForSongOfStorms",), + 0x801A281C:("Audio_ScaleTempoAndFreqForMainBgm",), + 0x801A29D4:("Audio_SetSeqTempoAndFreq",), + 0x801A2BB8:("Audio_PlaySubBgm",), + 0x801A2C20:("Audio_StopSubBgm",), + 0x801A2C44:("Audio_IncreaseTempoForTimedMinigame",), 0x801A2C88:("Audio_PlaySequenceInCutscene",), 0x801A2D54:("Audio_StopSequenceInCutscene",), 0x801A2DE0:("Audio_IsSequencePlaying",), @@ -3994,7 +3994,7 @@ 0x801A4428:("func_801A4428",), 0x801A44A4:("Audio_PreNMI",), 0x801A44C4:("Audio_ResetRequestedSceneSeqId",), - 0x801A44D4:("func_801A44D4",), + 0x801A44D4:("Audio_ResetData",), 0x801A46F8:("func_801A46F8",), 0x801A4748:("func_801A4748",), 0x801A479C:("func_801A479C",), @@ -4004,11 +4004,11 @@ 0x801A4B80:("Audio_SetAmbienceRandomBend",), 0x801A4C30:("Audio_Init",), 0x801A4C54:("AudioSfx_Init",), - 0x801A4D00:("func_801A4D00",), - 0x801A4D50:("func_801A4D50",), - 0x801A4DA4:("func_801A4DA4",), - 0x801A4DF4:("func_801A4DF4",), - 0x801A4E64:("func_801A4E64",), + 0x801A4D00:("Audio_InitSound",), + 0x801A4D50:("Audio_ResetForAudioHeapStep3",), + 0x801A4DA4:("Audio_ResetForAudioHeapStep2",), + 0x801A4DF4:("Audio_ResetForAudioHeapStep1",), + 0x801A4E64:("Audio_UnusedReset",), 0x801A4EB0:("func_801A4EB0",), 0x801A4EB8:("func_801A4EB8",), 0x801A4FD8:("func_801A4FD8",), @@ -4028,7 +4028,7 @@ 0x801A54D0:("func_801A54D0",), 0x801A5680:("func_801A5680",), 0x801A5808:("func_801A5808",), - 0x801A5A10:("func_801A5A10",), + 0x801A5A10:("AudioVoice_ResetData",), 0x801A5A1C:("func_801A5A1C",), 0x801A5BD0:("AudioSfx_MuteBanks",), 0x801A5C28:("AudioSfx_LowerBgmVolume",), @@ -4052,21 +4052,21 @@ 0x801A787C:("AudioSfx_ProcessActiveSfx",), 0x801A78E4:("AudioSfx_IsPlaying",), 0x801A794C:("AudioSfx_Reset",), - 0x801A7B10:("Audio_StartSequence",), - 0x801A7D04:("Audio_StopSequence",), - 0x801A7D84:("func_801A7D84",), - 0x801A89A8:("Audio_QueueSeqCmd",), - 0x801A89D0:("func_801A89D0",), - 0x801A8A50:("Audio_GetActiveSequence",), - 0x801A8ABC:("func_801A8ABC",), - 0x801A8B14:("func_801A8B14",), - 0x801A8B2C:("func_801A8B2C",), - 0x801A8BD0:("Audio_SetVolumeScale",), - 0x801A8D5C:("func_801A8D5C",), - 0x801A9768:("func_801A9768",), - 0x801A982C:("func_801A982C",), - 0x801A99B8:("func_801A99B8",), - 0x801A9A74:("func_801A9A74",), + 0x801A7B10:("AudioSeq_StartSequence",), + 0x801A7D04:("AudioSeq_StopSequence",), + 0x801A7D84:("AudioSeq_ProcessSeqCmd",), + 0x801A89A8:("AudioSeq_QueueSeqCmd",), + 0x801A89D0:("AudioSeq_ProcessSeqCmds",), + 0x801A8A50:("AudioSeq_GetActiveSeqId",), + 0x801A8ABC:("AudioSeq_IsSeqCmdNotQueued",), + 0x801A8B14:("AudioSeq_ResetSequenceRequests",), + 0x801A8B2C:("AudioSeq_ReplaceSeqCmdSetupOpVolRestore",), + 0x801A8BD0:("AudioSeq_SetVolumeScale",), + 0x801A8D5C:("AudioSeq_UpdateActiveSequences",), + 0x801A9768:("AudioSeq_UpdateAudioHeapReset",), + 0x801A982C:("AudioSeq_ResetReverb",), + 0x801A99B8:("AudioSeq_ResetActiveSequences",), + 0x801A9A74:("AudioSeq_ResetActiveSequencesAndVolume",), 0x801A9B10:("JpegUtils_ProcessQuantizationTable",), 0x801A9B78:("JpegUtils_ParseHuffmanCodesLengths",), 0x801A9BFC:("JpegUtils_GetHuffmanCodes",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index bf6d8e8bb..aecdd1cc6 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -2401,14 +2401,14 @@ 0x801DB4A4:("gSfxDefaultPos","UNK_TYPE4","",0x4), 0x801DB4B0:("gSfxDefaultFreqAndVolScale","UNK_TYPE1","",0x1), 0x801DB4B8:("gSfxDefaultReverb","UNK_TYPE1","",0x1), - 0x801DB4C0:("D_801DB4C0","UNK_TYPE1","",0x1), - 0x801DB4C4:("D_801DB4C4","UNK_TYPE1","",0x1), - 0x801DB4C8:("D_801DB4C8","UNK_TYPE1","",0x1), - 0x801DB4CC:("D_801DB4CC","UNK_TYPE1","",0x1), + 0x801DB4C0:("sSeqCmdWritePos","UNK_TYPE1","",0x1), + 0x801DB4C4:("sSeqCmdReadPos","UNK_TYPE1","",0x1), + 0x801DB4C8:("sStartSeqDisabled","UNK_TYPE1","",0x1), + 0x801DB4CC:("sSoundModeList","UNK_TYPE1","",0x1), 0x801DB4D4:("gAudioSpecId","UNK_TYPE1","",0x1), - 0x801DB4D8:("D_801DB4D8","UNK_TYPE1","",0x1), - 0x801DB4DC:("D_801DB4DC","UNK_TYPE4","",0x4), - 0x801DB4E0:("D_801DB4E0","UNK_TYPE1","",0x1), + 0x801DB4D8:("gAudioHeapResetState","UNK_TYPE1","",0x1), + 0x801DB4DC:("sResetAudioHeapSeqCmd","UNK_TYPE4","",0x4), + 0x801DB4E0:("gReverbSettings","UNK_TYPE1","",0x1), 0x801DB528:("D_801DB528","UNK_TYPE1","",0x1), 0x801DB570:("D_801DB570","UNK_TYPE1","",0x1), 0x801DB5B8:("D_801DB5B8","UNK_TYPE1","",0x1), @@ -4331,9 +4331,9 @@ 0x801FFC80:("sCurSfxPlayerChannelIndex","UNK_TYPE1","",0x1), 0x801FFC84:("gSfxBankMuted","UNK_TYPE1","",0x1), 0x801FFC90:("sUnusedBankLerp","UNK_TYPE1","",0x1), - 0x801FFD00:("D_801FFD00","UNK_TYPE1","",0x1), - 0x801FFD34:("D_801FFD34","UNK_TYPE1","",0x1), - 0x801FFD40:("D_801FFD40","UNK_TYPE1","",0x1), + 0x801FFD00:("sSeqRequests","UNK_TYPE1","",0x1), + 0x801FFD34:("sNumSeqRequests","UNK_TYPE1","",0x1), + 0x801FFD40:("sAudioSeqCmds","UNK_TYPE1","",0x1), 0x80200000:("D_80200000","UNK_TYPE1","",0x1), 0x80200002:("D_80200002","UNK_TYPE1","",0x1), 0x80200004:("D_80200004","UNK_TYPE1","",0x1), @@ -4345,9 +4345,9 @@ 0x8020034A:("D_8020034A","UNK_TYPE1","",0x1), 0x80200B88:("D_80200B88","UNK_TYPE1","",0x1), 0x80200BBA:("D_80200BBA","UNK_TYPE1","",0x1), - 0x80200BCC:("D_80200BCC","UNK_TYPE1","",0x1), - 0x80200BCE:("D_80200BCE","UNK_TYPE1","",0x1), - 0x80200BD0:("D_80200BD0","UNK_TYPE1","",0x1), + 0x80200BCC:("sResetAudioHeapTimer","UNK_TYPE1","",0x1), + 0x80200BCE:("sResetAudioHeapFadeReverbVolume","UNK_TYPE1","",0x1), + 0x80200BD0:("sResetAudioHeapFadeReverbVolumeStep","UNK_TYPE1","",0x1), 0x80200C70:("gAudioCtx","AudioContext","",0x81F8), 0x80208E68:("gAudioCustomUpdateFunction","UNK_TYPE4","",0x4), 0x80208E6C:("gAudioCustomSeqFunction","UNK_TYPE4","",0x4), diff --git a/tools/namefixer.py b/tools/namefixer.py index d8c1e8bb2..853322f5c 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -171,14 +171,19 @@ wordReplace = { "func_800BBA88": "Enemy_StartFinishingBlow", "ShrinkWindow_Step": "ShrinkWindow_Update", "ShrinkWindow_Fini": "ShrinkWindow_Destroy", - "func_801A89A8": "Audio_QueueSeqCmd", + "func_801A89A8": "AudioSeq_QueueSeqCmd", + "Audio_QueueSeqCmd": "AudioSeq_QueueSeqCmd", + "func_801A0238": "Audio_SetMainBgmVolume", + "func_801A2C20": "Audio_StopSubBgm", + "func_801A2BB8": "Audio_PlaySubBgm", "func_8019F1C0": "Audio_PlaySfxAtPos", "func_801A5BD0": "AudioSfx_MuteBanks", "func_801A72CC": "AudioSfx_StopByPos", "Audio_StopSfxByPos": "AudioSfx_StopByPos", "Audio_StopSfxById": "AudioSfx_StopById", "func_801A3098": "Audio_PlayFanfare", - "func_801A8A50": "Audio_GetActiveSequence", + "func_801A8A50": "AudioSeq_GetActiveSeqId", + "Audio_GetActiveSequence": "AudioSeq_GetActiveSeqId", "func_801A2E54": "Audio_PlayBgm_StorePrevBgm", "func_801A2ED8": "Audio_RestorePrevBgm", "func_801A2544": "Audio_PlayMorningSceneSequence", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 2ec163e24..99723cafd 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -3373,7 +3373,7 @@ asm/non_matchings/code/code_8019AF00/Audio_Noop3.s,Audio_Noop3,0x8019E00C,0x2 asm/non_matchings/code/code_8019AF00/Audio_Update.s,Audio_Update,0x8019E014,0x3A asm/non_matchings/code/code_8019AF00/Audio_Noop4.s,Audio_Noop4,0x8019E0FC,0x2 asm/non_matchings/code/code_8019AF00/Audio_Noop5.s,Audio_Noop5,0x8019E104,0x3 -asm/non_matchings/code/code_8019AF00/func_8019E110.s,func_8019E110,0x8019E110,0xF +asm/non_matchings/code/code_8019AF00/Audio_PlayMainBgm.s,Audio_PlayMainBgm,0x8019E110,0xF asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeVolume.s,AudioSfx_ComputeVolume,0x8019E14C,0x76 asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeReverb.s,AudioSfx_ComputeReverb,0x8019E324,0x63 asm/non_matchings/code/code_8019AF00/AudioSfx_ComputePanSigned.s,AudioSfx_ComputePanSigned,0x8019E4B0,0x61 @@ -3417,10 +3417,10 @@ asm/non_matchings/code/code_8019AF00/Audio_PlaySfxForRiver.s,Audio_PlaySfxForRiv asm/non_matchings/code/code_8019AF00/Audio_PlaySfxForWaterfall.s,Audio_PlaySfxForWaterfall,0x801A0048,0x29 asm/non_matchings/code/code_8019AF00/Audio_StepFreqLerp.s,Audio_StepFreqLerp,0x801A00EC,0xE asm/non_matchings/code/code_8019AF00/func_801A0124.s,func_801A0124,0x801A0124,0x18 -asm/non_matchings/code/code_8019AF00/func_801A0184.s,func_801A0184,0x801A0184,0x10 -asm/non_matchings/code/code_8019AF00/func_801A01C4.s,func_801A01C4,0x801A01C4,0x10 +asm/non_matchings/code/code_8019AF00/Audio_SetBgmVolumeOff.s,Audio_SetBgmVolumeOff,0x801A0184,0x10 +asm/non_matchings/code/code_8019AF00/Audio_SetBgmVolumeOn.s,Audio_SetBgmVolumeOn,0x801A01C4,0x10 asm/non_matchings/code/code_8019AF00/func_801A0204.s,func_801A0204,0x801A0204,0xD -asm/non_matchings/code/code_8019AF00/func_801A0238.s,func_801A0238,0x801A0238,0xD +asm/non_matchings/code/code_8019AF00/Audio_SetMainBgmVolume.s,Audio_SetMainBgmVolume,0x801A0238,0xD asm/non_matchings/code/code_8019AF00/Audio_SetGanonsTowerBgmVolumeLevel.s,Audio_SetGanonsTowerBgmVolumeLevel,0x801A026C,0x2B asm/non_matchings/code/code_8019AF00/Audio_SetGanonsTowerBgmVolume.s,Audio_SetGanonsTowerBgmVolume,0x801A0318,0x4E asm/non_matchings/code/code_8019AF00/Audio_LowerMainBgmVolume.s,Audio_LowerMainBgmVolume,0x801A0450,0x7 @@ -3459,12 +3459,12 @@ asm/non_matchings/code/code_8019AF00/Audio_StartMorningSceneSequence.s,Audio_Sta asm/non_matchings/code/code_8019AF00/Audio_PlaySceneSequence.s,Audio_PlaySceneSequence,0x801A25E4,0x23 asm/non_matchings/code/code_8019AF00/Audio_StartSceneSequence.s,Audio_StartSceneSequence,0x801A2670,0x42 asm/non_matchings/code/code_8019AF00/Audio_UpdateSceneSequenceResumePoint.s,Audio_UpdateSceneSequenceResumePoint,0x801A2778,0x1C -asm/non_matchings/code/code_8019AF00/func_801A27E8.s,func_801A27E8,0x801A27E8,0xD -asm/non_matchings/code/code_8019AF00/func_801A281C.s,func_801A281C,0x801A281C,0x6E -asm/non_matchings/code/code_8019AF00/func_801A29D4.s,func_801A29D4,0x801A29D4,0x79 -asm/non_matchings/code/code_8019AF00/func_801A2BB8.s,func_801A2BB8,0x801A2BB8,0x1A -asm/non_matchings/code/code_8019AF00/func_801A2C20.s,func_801A2C20,0x801A2C20,0x9 -asm/non_matchings/code/code_8019AF00/func_801A2C44.s,func_801A2C44,0x801A2C44,0x11 +asm/non_matchings/code/code_8019AF00/Audio_PlayBgmForSongOfStorms.s,Audio_PlayBgmForSongOfStorms,0x801A27E8,0xD +asm/non_matchings/code/code_8019AF00/Audio_ScaleTempoAndFreqForMainBgm.s,Audio_ScaleTempoAndFreqForMainBgm,0x801A281C,0x6E +asm/non_matchings/code/code_8019AF00/Audio_SetSeqTempoAndFreq.s,Audio_SetSeqTempoAndFreq,0x801A29D4,0x79 +asm/non_matchings/code/code_8019AF00/Audio_PlaySubBgm.s,Audio_PlaySubBgm,0x801A2BB8,0x1A +asm/non_matchings/code/code_8019AF00/Audio_StopSubBgm.s,Audio_StopSubBgm,0x801A2C20,0x9 +asm/non_matchings/code/code_8019AF00/Audio_IncreaseTempoForTimedMinigame.s,Audio_IncreaseTempoForTimedMinigame,0x801A2C44,0x11 asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceInCutscene.s,Audio_PlaySequenceInCutscene,0x801A2C88,0x33 asm/non_matchings/code/code_8019AF00/Audio_StopSequenceInCutscene.s,Audio_StopSequenceInCutscene,0x801A2D54,0x23 asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s,Audio_IsSequencePlaying,0x801A2DE0,0x1D @@ -3510,7 +3510,7 @@ asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeExceptSystemAndOcarinaBan asm/non_matchings/code/code_8019AF00/func_801A4428.s,func_801A4428,0x801A4428,0x1F asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s,Audio_PreNMI,0x801A44A4,0x8 asm/non_matchings/code/code_8019AF00/Audio_ResetRequestedSceneSeqId.s,Audio_ResetRequestedSceneSeqId,0x801A44C4,0x4 -asm/non_matchings/code/code_8019AF00/func_801A44D4.s,func_801A44D4,0x801A44D4,0x89 +asm/non_matchings/code/code_8019AF00/Audio_ResetData.s,Audio_ResetData,0x801A44D4,0x89 asm/non_matchings/code/code_8019AF00/func_801A46F8.s,func_801A46F8,0x801A46F8,0x14 asm/non_matchings/code/code_8019AF00/func_801A4748.s,func_801A4748,0x801A4748,0x15 asm/non_matchings/code/code_8019AF00/func_801A479C.s,func_801A479C,0x801A479C,0x10 @@ -3520,11 +3520,11 @@ asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience.s,Audio_PlayAmbience,0x8 asm/non_matchings/code/code_8019AF00/Audio_SetAmbienceRandomBend.s,Audio_SetAmbienceRandomBend,0x801A4B80,0x2C asm/non_matchings/code/code_8019AF00/Audio_Init.s,Audio_Init,0x801A4C30,0x9 asm/non_matchings/code/code_8019AF00/AudioSfx_Init.s,AudioSfx_Init,0x801A4C54,0x2B -asm/non_matchings/code/code_8019AF00/func_801A4D00.s,func_801A4D00,0x801A4D00,0x14 -asm/non_matchings/code/code_8019AF00/func_801A4D50.s,func_801A4D50,0x801A4D50,0x15 -asm/non_matchings/code/code_8019AF00/func_801A4DA4.s,func_801A4DA4,0x801A4DA4,0x14 -asm/non_matchings/code/code_8019AF00/func_801A4DF4.s,func_801A4DF4,0x801A4DF4,0x1C -asm/non_matchings/code/code_8019AF00/func_801A4E64.s,func_801A4E64,0x801A4E64,0x13 +asm/non_matchings/code/code_8019AF00/Audio_InitSound.s,Audio_InitSound,0x801A4D00,0x14 +asm/non_matchings/code/code_8019AF00/Audio_ResetForAudioHeapStep3.s,Audio_ResetForAudioHeapStep3,0x801A4D50,0x15 +asm/non_matchings/code/code_8019AF00/Audio_ResetForAudioHeapStep2.s,Audio_ResetForAudioHeapStep2,0x801A4DA4,0x14 +asm/non_matchings/code/code_8019AF00/Audio_ResetForAudioHeapStep1.s,Audio_ResetForAudioHeapStep1,0x801A4DF4,0x1C +asm/non_matchings/code/code_8019AF00/Audio_UnusedReset.s,Audio_UnusedReset,0x801A4E64,0x13 asm/non_matchings/code/voice_external/func_801A4EB0.s,func_801A4EB0,0x801A4EB0,0x2 asm/non_matchings/code/voice_external/func_801A4EB8.s,func_801A4EB8,0x801A4EB8,0x48 asm/non_matchings/code/voice_external/func_801A4FD8.s,func_801A4FD8,0x801A4FD8,0x2A @@ -3544,7 +3544,7 @@ asm/non_matchings/code/voice_internal/func_801A54C4.s,func_801A54C4,0x801A54C4,0 asm/non_matchings/code/voice_internal/func_801A54D0.s,func_801A54D0,0x801A54D0,0x6C asm/non_matchings/code/voice_internal/func_801A5680.s,func_801A5680,0x801A5680,0x62 asm/non_matchings/code/voice_internal/func_801A5808.s,func_801A5808,0x801A5808,0x82 -asm/non_matchings/code/voice_internal/func_801A5A10.s,func_801A5A10,0x801A5A10,0x3 +asm/non_matchings/code/voice_internal/AudioVoice_ResetData.s,AudioVoice_ResetData,0x801A5A10,0x3 asm/non_matchings/code/voice_internal/func_801A5A1C.s,func_801A5A1C,0x801A5A1C,0x69 asm/non_matchings/code/code_801A5BD0/AudioSfx_MuteBanks.s,AudioSfx_MuteBanks,0x801A5BD0,0x16 asm/non_matchings/code/code_801A5BD0/AudioSfx_LowerBgmVolume.s,AudioSfx_LowerBgmVolume,0x801A5C28,0x19 @@ -3568,21 +3568,21 @@ asm/non_matchings/code/code_801A5BD0/AudioSfx_StepBankLerp.s,AudioSfx_StepBankLe asm/non_matchings/code/code_801A5BD0/AudioSfx_ProcessActiveSfx.s,AudioSfx_ProcessActiveSfx,0x801A787C,0x1A asm/non_matchings/code/code_801A5BD0/AudioSfx_IsPlaying.s,AudioSfx_IsPlaying,0x801A78E4,0x1A asm/non_matchings/code/code_801A5BD0/AudioSfx_Reset.s,AudioSfx_Reset,0x801A794C,0x71 -asm/non_matchings/code/sequence/Audio_StartSequence.s,Audio_StartSequence,0x801A7B10,0x7D -asm/non_matchings/code/sequence/Audio_StopSequence.s,Audio_StopSequence,0x801A7D04,0x20 -asm/non_matchings/code/sequence/func_801A7D84.s,func_801A7D84,0x801A7D84,0x309 -asm/non_matchings/code/sequence/Audio_QueueSeqCmd.s,Audio_QueueSeqCmd,0x801A89A8,0xA -asm/non_matchings/code/sequence/func_801A89D0.s,func_801A89D0,0x801A89D0,0x20 -asm/non_matchings/code/sequence/Audio_GetActiveSequence.s,Audio_GetActiveSequence,0x801A8A50,0x1B -asm/non_matchings/code/sequence/func_801A8ABC.s,func_801A8ABC,0x801A8ABC,0x16 -asm/non_matchings/code/sequence/func_801A8B14.s,func_801A8B14,0x801A8B14,0x6 -asm/non_matchings/code/sequence/func_801A8B2C.s,func_801A8B2C,0x801A8B2C,0x29 -asm/non_matchings/code/sequence/Audio_SetVolumeScale.s,Audio_SetVolumeScale,0x801A8BD0,0x63 -asm/non_matchings/code/sequence/func_801A8D5C.s,func_801A8D5C,0x801A8D5C,0x283 -asm/non_matchings/code/sequence/func_801A9768.s,func_801A9768,0x801A9768,0x31 -asm/non_matchings/code/sequence/func_801A982C.s,func_801A982C,0x801A982C,0x63 -asm/non_matchings/code/sequence/func_801A99B8.s,func_801A99B8,0x801A99B8,0x2F -asm/non_matchings/code/sequence/func_801A9A74.s,func_801A9A74,0x801A9A74,0x27 +asm/non_matchings/code/sequence/AudioSeq_StartSequence.s,AudioSeq_StartSequence,0x801A7B10,0x7D +asm/non_matchings/code/sequence/AudioSeq_StopSequence.s,AudioSeq_StopSequence,0x801A7D04,0x20 +asm/non_matchings/code/sequence/AudioSeq_ProcessSeqCmd.s,AudioSeq_ProcessSeqCmd,0x801A7D84,0x309 +asm/non_matchings/code/sequence/AudioSeq_QueueSeqCmd.s,AudioSeq_QueueSeqCmd,0x801A89A8,0xA +asm/non_matchings/code/sequence/AudioSeq_ProcessSeqCmds.s,AudioSeq_ProcessSeqCmds,0x801A89D0,0x20 +asm/non_matchings/code/sequence/AudioSeq_GetActiveSeqId.s,AudioSeq_GetActiveSeqId,0x801A8A50,0x1B +asm/non_matchings/code/sequence/AudioSeq_IsSeqCmdNotQueued.s,AudioSeq_IsSeqCmdNotQueued,0x801A8ABC,0x16 +asm/non_matchings/code/sequence/AudioSeq_ResetSequenceRequests.s,AudioSeq_ResetSequenceRequests,0x801A8B14,0x6 +asm/non_matchings/code/sequence/AudioSeq_ReplaceSeqCmdSetupOpVolRestore.s,AudioSeq_ReplaceSeqCmdSetupOpVolRestore,0x801A8B2C,0x29 +asm/non_matchings/code/sequence/AudioSeq_SetVolumeScale.s,AudioSeq_SetVolumeScale,0x801A8BD0,0x63 +asm/non_matchings/code/sequence/AudioSeq_UpdateActiveSequences.s,AudioSeq_UpdateActiveSequences,0x801A8D5C,0x283 +asm/non_matchings/code/sequence/AudioSeq_UpdateAudioHeapReset.s,AudioSeq_UpdateAudioHeapReset,0x801A9768,0x31 +asm/non_matchings/code/sequence/AudioSeq_ResetReverb.s,AudioSeq_ResetReverb,0x801A982C,0x63 +asm/non_matchings/code/sequence/AudioSeq_ResetActiveSequences.s,AudioSeq_ResetActiveSequences,0x801A99B8,0x2F +asm/non_matchings/code/sequence/AudioSeq_ResetActiveSequencesAndVolume.s,AudioSeq_ResetActiveSequencesAndVolume,0x801A9A74,0x27 asm/non_matchings/code/jpegutils/JpegUtils_ProcessQuantizationTable.s,JpegUtils_ProcessQuantizationTable,0x801A9B10,0x1A asm/non_matchings/code/jpegutils/JpegUtils_ParseHuffmanCodesLengths.s,JpegUtils_ParseHuffmanCodesLengths,0x801A9B78,0x21 asm/non_matchings/code/jpegutils/JpegUtils_GetHuffmanCodes.s,JpegUtils_GetHuffmanCodes,0x801A9BFC,0x1B From f3c811d29865e9445341fc3300a107b9e686e608 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 30 Mar 2023 20:26:35 +1100 Subject: [PATCH 09/29] `z_parameter`: Buttons (part 9) (#1192) * import button docs * cleanup * sync timer val * add flag comments * Update src/code/z_parameter.c Co-authored-by: Derek Hensley * Update src/code/z_parameter.c Co-authored-by: Derek Hensley * Update src/code/z_parameter.c Co-authored-by: Derek Hensley * fix merge master --------- Co-authored-by: Derek Hensley --- include/functions.h | 4 +- include/z64interface.h | 2 +- include/z64player.h | 2 +- include/z64save.h | 13 +- src/code/code_8012EC80.c | 2 +- src/code/z_parameter.c | 1303 ++++++++++++++++- src/code/z_player_lib.c | 6 +- .../ovl_kaleido_scope/z_kaleido_item.c | 6 +- .../ovl_kaleido_scope/z_kaleido_scope_NES.c | 4 +- tools/disasm/functions.txt | 24 +- tools/disasm/variables.txt | 6 +- tools/sizes/code_functions.csv | 24 +- 12 files changed, 1313 insertions(+), 83 deletions(-) diff --git a/include/functions.h b/include/functions.h index 793ac829b..f87ec4ff6 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1693,12 +1693,12 @@ void Interface_StartTimer(s16 timerId, s16 seconds); void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState); void Interface_NewDay(PlayState* play, s32 day); void Interface_SetHudVisibility(u16 hudVisibility); -void func_80110038(PlayState* play); +void Interface_UpdateButtonsPart2(PlayState* play); void Interface_SetSceneRestrictions(PlayState* play); void Interface_InitMinigame(PlayState* play); void Interface_LoadItemIconImpl(PlayState* play, u8 btn); void Interface_LoadItemIcon(PlayState* play, u8 btn); -void func_80112C0C(PlayState* play, u16 flag); +void Interface_UpdateButtonsAlt(PlayState* play, u16 flag); u8 Item_Give(PlayState* play, u8 item); u8 Item_CheckObtainability(u8 item); void Inventory_DeleteItem(s16 item, s16 slot); diff --git a/include/z64interface.h b/include/z64interface.h index 385f80835..e01baa425 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -134,7 +134,7 @@ typedef struct { /* 0x218 */ f32 aButtonRoll; /* 0x21C */ s16 unk_21C; /* 0x21E */ s16 bButtonDoAction; - /* 0x220 */ s16 unk_220; + /* 0x220 */ s16 tatlCalling; /* 0x222 */ s16 unk_222; /* 0x224 */ s16 unk_224; /* 0x226 */ s16 lifeColorChange; diff --git a/include/z64player.h b/include/z64player.h index 96abf00c8..456eba3eb 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -990,7 +990,7 @@ typedef struct Player { /* 0xB5D */ u8 unk_B5D; /* 0xB5E */ u8 unk_B5E; /* 0xB5F */ u8 unk_B5F; - /* 0xB60 */ u16 unk_B60; // blast mask timer? + /* 0xB60 */ u16 blastMaskTimer; /* 0xB62 */ s16 unk_B62; /* 0xB64 */ u8 unk_B64; /* 0xB65 */ u8 shockTimer; diff --git a/include/z64save.h b/include/z64save.h index 0037c5aa5..f6e9145df 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -313,7 +313,7 @@ typedef struct SaveContext { /* 0x0000 */ Save save; /* 0x100C */ u8 eventInf[8]; // "event_inf" /* 0x1014 */ u8 unk_1014; // "stone_set_flag" - /* 0x1015 */ u8 unk_1015; + /* 0x1015 */ u8 bButtonStatus; /* 0x1016 */ u16 jinxTimer; /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" /* 0x101A */ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status" @@ -572,8 +572,11 @@ typedef enum SunsSongState { #define WEEKEVENTREG_07_10 PACK_WEEKEVENTREG_FLAG(7, 0x10) #define WEEKEVENTREG_07_20 PACK_WEEKEVENTREG_FLAG(7, 0x20) #define WEEKEVENTREG_07_40 PACK_WEEKEVENTREG_FLAG(7, 0x40) + // Entrance cutscene watched to the prison where the deku princess is kept. Also set in door_warp1.c #define WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE_PRISON PACK_WEEKEVENTREG_FLAG(7, 0x80) + +// Related to Honey & Darling minigame #define WEEKEVENTREG_08_01 PACK_WEEKEVENTREG_FLAG(8, 0x01) #define WEEKEVENTREG_08_02 PACK_WEEKEVENTREG_FLAG(8, 0x02) #define WEEKEVENTREG_08_04 PACK_WEEKEVENTREG_FLAG(8, 0x04) @@ -1267,6 +1270,7 @@ typedef enum SunsSongState { // check if already healed Kamaro the Dancing Ghost #define WEEKEVENTREG_82_04 PACK_WEEKEVENTREG_FLAG(82, 0x04) +// Related to Swordsman's log minigame #define WEEKEVENTREG_82_08 PACK_WEEKEVENTREG_FLAG(82, 0x08) #define WEEKEVENTREG_82_10 PACK_WEEKEVENTREG_FLAG(82, 0x10) #define WEEKEVENTREG_82_20 PACK_WEEKEVENTREG_FLAG(82, 0x20) @@ -1290,6 +1294,7 @@ typedef enum SunsSongState { #define WEEKEVENTREG_84_10 PACK_WEEKEVENTREG_FLAG(84, 0x10) // Unconfirmed: "Obtained Fierce Deity's Mask?" +// Also related to moon child #define WEEKEVENTREG_84_20 PACK_WEEKEVENTREG_FLAG(84, 0x20) #define WEEKEVENTREG_84_40 PACK_WEEKEVENTREG_FLAG(84, 0x40) @@ -1354,6 +1359,8 @@ typedef enum SunsSongState { #define WEEKEVENTREG_90_04 PACK_WEEKEVENTREG_FLAG(90, 0x04) #define WEEKEVENTREG_90_08 PACK_WEEKEVENTREG_FLAG(90, 0x08) #define WEEKEVENTREG_90_10 PACK_WEEKEVENTREG_FLAG(90, 0x10) + +// Related to Fishermans's jumping minigame #define WEEKEVENTREG_90_20 PACK_WEEKEVENTREG_FLAG(90, 0x20) #define WEEKEVENTREG_90_40 PACK_WEEKEVENTREG_FLAG(90, 0x40) #define WEEKEVENTREG_90_80 PACK_WEEKEVENTREG_FLAG(90, 0x80) @@ -1493,11 +1500,15 @@ typedef enum SunsSongState { #define EVENTINF_32 0x32 #define EVENTINF_33 0x33 + +// Related to Deku playground minigame #define EVENTINF_34 0x34 #define EVENTINF_35 0x35 #define EVENTINF_36 0x36 #define EVENTINF_37 0x37 #define EVENTINF_40 0x40 + +// Related to swamp boat (non-minigame)? #define EVENTINF_41 0x41 #define EVENTINF_42 0x42 #define EVENTINF_43 0x43 diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index fb6f0743d..d120da618 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -474,7 +474,7 @@ u16 gSceneIdsPerRegion[REGION_MAX][27] = { s32 Inventory_GetBtnBItem(PlayState* play) { if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { return ITEM_NONE; - } else if (gSaveContext.unk_1015 == ITEM_NONE) { + } else if (gSaveContext.bButtonStatus == BTN_DISABLED) { return ITEM_NONE; } else if (CUR_FORM_EQUIP(EQUIP_SLOT_B) == ITEM_NONE) { if (play->interfaceCtx.unk_21C != 0) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index cb4a296d4..c008e3abc 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,4 +1,5 @@ #include "global.h" +#include "z64snap.h" #include "z64view.h" #include "interface/parameter_static/parameter_static.h" #include "interface/do_action_static/do_action_static.h" @@ -7,6 +8,8 @@ #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "overlays/actors/ovl_En_Mm3/z_en_mm3.h" +extern TexturePtr D_08095AC0; // gMagicArrowEquipEffectTex + typedef enum { /* 0 */ PICTO_BOX_STATE_OFF, // Not using the pictograph /* 1 */ PICTO_BOX_STATE_LENS, // Looking through the lens of the pictograph @@ -14,6 +17,11 @@ typedef enum { /* 3 */ PICTO_BOX_STATE_PHOTO } PictoBoxState; +// TODO extract this information from the texture definitions themselves +#define DO_ACTION_TEX_WIDTH 48 +#define DO_ACTION_TEX_HEIGHT 16 +#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex)) + typedef struct { /* 0x00 */ u8 scene; /* 0x01 */ u8 flags1; @@ -1021,7 +1029,7 @@ void Interface_SetHudVisibility(u16 hudVisibility) { void Interface_UpdateButtonAlphasByStatus(PlayState* play, s16 risingAlpha) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.bButtonStatus == BTN_DISABLED)) { if (interfaceCtx->bAlpha != 70) { interfaceCtx->bAlpha = 70; } @@ -1393,7 +1401,8 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { interfaceCtx->aAlpha = risingAlpha; } - if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || + (gSaveContext.bButtonStatus == ITEM_NONE)) { if (interfaceCtx->bAlpha != 70) { interfaceCtx->bAlpha = 70; } @@ -1772,10 +1781,736 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { } } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80110038.s") +/** + * A continuation of the if-else chain from Interface_UpdateButtonsPart1 + * Also used directly when opening the pause menu i.e. skips part 1 + */ +void Interface_UpdateButtonsPart2(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + s16 i; + s16 restoreHudVisibility = false; -void func_80111CB4(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80111CB4.s") + if (CHECK_EVENTINF(EVENTINF_41)) { + // Related to swamp boat (non-minigame)? + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if ((GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTO_BOX) || (msgCtx->msgMode != 0)) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (sPictoState == PICTO_BOX_STATE_OFF) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_20)) { + // Fishermans's jumping minigame + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_82_08)) { + // Swordsman's log minigame + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_20)) { + // Related to moon child + if (player->currentMask == PLAYER_MASK_FIERCE_DEITY) { + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if ((GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_FIERCE_DEITY) || + ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK))) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } + } + } else { + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_ZORA)) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + } + } else if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 6)) { + // Unknown cutscene + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (CHECK_EVENTINF(EVENTINF_34)) { + // Deku playground minigame + if (player->stateFlags3 & PLAYER_STATE3_1000000) { + if (gSaveContext.save.inventory.items[SLOT_NUT] == ITEM_NUT) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NUT; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } else { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + restoreHudVisibility = true; + } + + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + + if (restoreHudVisibility || (gSaveContext.hudVisibility != HUD_VISIBILITY_A_B_MINIMAP)) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + restoreHudVisibility = false; + } + } else if (player->stateFlags3 & PLAYER_STATE3_1000000) { + // Nuts on B (from flying as Deku Link) + if (gSaveContext.save.inventory.items[SLOT_NUT] == ITEM_NUT) { + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NUT) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NUT; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_ENABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + + if (restoreHudVisibility) { + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } + } else if (!gSaveContext.save.playerData.isMagicAcquired && (CUR_FORM == PLAYER_FORM_DEKU) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NUT)) { + // Nuts on B (as Deku Link) + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_FD; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } else if ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) && + (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE)) { + // Swimming underwater + if (CUR_FORM != PLAYER_FORM_ZORA) { + if ((player->currentMask == PLAYER_MASK_BLAST) && (player->blastMaskTimer == 0)) { + if (gSaveContext.bButtonStatus == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.bButtonStatus = BTN_ENABLED; + } else if ((interfaceCtx->bButtonDoAction == DO_ACTION_EXPLODE) && + (player->currentMask == PLAYER_MASK_BLAST)) { + if (gSaveContext.bButtonStatus != BTN_DISABLED) { + gSaveContext.bButtonStatus = BTN_DISABLED; + restoreHudVisibility = true; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (GET_CUR_FORM_BTN_ITEM(i) != ITEM_MASK_ZORA) { + if (Player_GetEnvironmentalHazard(play) == PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) { + if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK))) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_ENABLED; + restoreHudVisibility = true; + } + } + + if (restoreHudVisibility) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + } + + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + if (ActorCutscene_GetCurrentIndex() == -1) { + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } + } else if (player->stateFlags1 & PLAYER_STATE1_200000) { + // First person view + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (GET_CUR_FORM_BTN_ITEM(i) != ITEM_LENS) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } else { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (player->stateFlags1 & PLAYER_STATE1_2000) { + // Hanging from a ledge + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + restoreHudVisibility = true; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } else { + // End of special event cases + + // B button + if ((interfaceCtx->bButtonDoAction == DO_ACTION_EXPLODE) && (player->currentMask == PLAYER_MASK_BLAST) && + (player->blastMaskTimer != 0)) { + // Cooldown period for blast mask + if (gSaveContext.bButtonStatus != BTN_DISABLED) { + gSaveContext.bButtonStatus = BTN_DISABLED; + restoreHudVisibility = true; + } + } else { + // default to enabled + if (gSaveContext.bButtonStatus == BTN_DISABLED) { + gSaveContext.bButtonStatus = BTN_ENABLED; + restoreHudVisibility = true; + } + + // Apply B button restriction + if (interfaceCtx->restrictions.bButton == 0) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU)) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_ENABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = + ITEM_SWORD_KOKIRI + GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) - EQUIP_VALUE_SWORD_KOKIRI; + } + + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + restoreHudVisibility = true; + } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NONE) { + if (interfaceCtx->bButtonDoAction != 0) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + } + } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NONE) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + } else { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + } + } + } else if (interfaceCtx->restrictions.bButton != 0) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU)) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + } + + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + restoreHudVisibility = true; + } + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_DISABLED; + restoreHudVisibility = true; + } + } + } + + // C buttons + if (gSaveContext.save.playerForm == player->transformation) { + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + // Individual C button + if (!gPlayerFormItemRestrictions[(void)0, gSaveContext.save.playerForm][GET_CUR_FORM_BTN_ITEM(i)]) { + // Item not usable in current playerForm + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (player->actor.id != ACTOR_PLAYER) { + // Currently not playing as the main player + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (player->currentMask == PLAYER_MASK_GIANT) { + // Currently wearing Giant's Mask + if (GET_CUR_FORM_BTN_ITEM(i) != ITEM_MASK_GIANT) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_GIANT) { + // Giant's Mask is equipped + if (play->sceneId != SCENE_INISIE_BS) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_FIERCE_DEITY) { + // Fierce Deity's Mask is equipped + if ((play->sceneId != SCENE_MITURIN_BS) && (play->sceneId != SCENE_HAKUGIN_BS) && + (play->sceneId != SCENE_SEA_BS) && (play->sceneId != SCENE_INISIE_BS) && + (play->sceneId != SCENE_LAST_BS)) { + if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { + gSaveContext.buttonStatus[i] = BTN_DISABLED; + restoreHudVisibility = true; + } + } else if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else { + // End of special item cases. Apply restrictions to buttons + if (interfaceCtx->restrictions.tradeItems != 0) { + if (((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) || + ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) || + (GET_CUR_FORM_BTN_ITEM(i) == ITEM_OCARINA)) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (interfaceCtx->restrictions.tradeItems == 0) { + if (((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) || + ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) || + (GET_CUR_FORM_BTN_ITEM(i) == ITEM_OCARINA)) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (interfaceCtx->restrictions.masks != 0) { + if ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) { + if (!gSaveContext.buttonStatus[i]) { // == BTN_ENABLED + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (interfaceCtx->restrictions.masks == 0) { + if ((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (interfaceCtx->restrictions.pictoBox != 0) { + if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_PICTO_BOX) { + if (!gSaveContext.buttonStatus[i]) { // == BTN_ENABLED + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } else if (interfaceCtx->restrictions.pictoBox == 0) { + if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_PICTO_BOX) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { + restoreHudVisibility = true; + } + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + + if (interfaceCtx->restrictions.all != 0) { + if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_OCARINA) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTO_BOX)) { + + if ((gSaveContext.buttonStatus[i] == BTN_ENABLED)) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_DISABLED; + } + } + } else if (interfaceCtx->restrictions.all == 0) { + if (!((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MOON_TEAR) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_PENDANT_OF_MEMORIES)) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_BOTTLE) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_OBABA_DRINK)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_OCARINA) && + !((GET_CUR_FORM_BTN_ITEM(i) >= ITEM_MASK_DEKU) && + (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) && + (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTO_BOX)) { + + if ((gSaveContext.buttonStatus[i] == BTN_DISABLED)) { + restoreHudVisibility = true; + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } + } + } + } + } + } + + if (restoreHudVisibility && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF)) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } +} + +void Interface_UpdateButtonsPart1(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + s32 pad; + s32 restoreHudVisibility = false; + + if (gSaveContext.save.cutscene < 0xFFF0) { + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; + if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || + (!(CHECK_EVENTINF(EVENTINF_41)) && (play->unk_1887C >= 2))) { + // Riding Epona OR Honey & Darling minigame OR Horseback balloon minigame OR related to swamp boat + // (non-minigame?) + if ((player->stateFlags1 & PLAYER_STATE1_800000) && (player->currentMask == PLAYER_MASK_BLAST) && + (gSaveContext.bButtonStatus == BTN_DISABLED)) { + // Riding Epona with blast mask? + restoreHudVisibility = true; + gSaveContext.bButtonStatus = BTN_ENABLED; + } + + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + if ((player->transformation == PLAYER_FORM_DEKU) && CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01)) { + gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; + if (play->sceneId == SCENE_BOWLING) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; + } + + Interface_SetHudVisibility(HUD_VISIBILITY_B_MAGIC); + } else { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_BOW) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_BOMB) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_BOMBCHU)) { + gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B); + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; + if (play->sceneId == SCENE_BOWLING) { + if (CURRENT_DAY == 1) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMBCHU; + } else if (CURRENT_DAY == 2) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMB; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + } + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + + if (play->unk_1887C >= 2) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } else if (gSaveContext.save.inventory.items[SLOT_BOW] == ITEM_NONE) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; + } else { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE); + } + } + + if (play->transitionMode != TRANS_MODE_OFF) { + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && + (Cutscene_GetSceneLayer(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (CHECK_EVENTINF(EVENTINF_35))) { + Interface_SetHudVisibility(HUD_VISIBILITY_B_MINIMAP); + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_82_08) && + (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE)) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (play->unk_1887C >= 2) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01)) { + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if (player->stateFlags1 & PLAYER_STATE1_800000) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } + } + } else { + if (player->stateFlags1 & PLAYER_STATE1_800000) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } + + if (play->sceneId == SCENE_BOWLING) { + if (CURRENT_DAY == 1) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMBCHU; + } else if (CURRENT_DAY == 2) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMB; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + } + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + } + + if (play->unk_1887C >= 2) { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } else if (gSaveContext.save.inventory.items[SLOT_BOW] == ITEM_NONE) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; + } else { + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + restoreHudVisibility = true; + } + + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE); + + if (play->transitionMode != TRANS_MODE_OFF) { + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && + (Cutscene_GetSceneLayer(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (play->unk_1887C >= 2) { + Interface_SetHudVisibility(HUD_VISIBILITY_B); + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01)) { + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if (player->stateFlags1 & PLAYER_STATE1_800000) { + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } + } + } else if (sPictoState != PICTO_BOX_STATE_OFF) { + // Related to pictograph + if (sPictoState == PICTO_BOX_STATE_LENS) { + if (!(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) { + Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, + (u8*)((void)0, gSaveContext.pictoPhotoI5), + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); + interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; + restoreHudVisibility = true; + sPictoState = PICTO_BOX_STATE_OFF; + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { + play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON; + interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; + restoreHudVisibility = true; + sPictoState = PICTO_BOX_STATE_OFF; + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || (func_801A5100() == 1)) { + if (!(CHECK_EVENTINF(EVENTINF_41)) || + ((CHECK_EVENTINF(EVENTINF_41)) && (ActorCutscene_GetCurrentIndex() == -1))) { + play_sound(NA_SE_SY_CAMERA_SHUTTER); + SREG(89) = 1; + play->haltAllActors = true; + sPictoState = PICTO_BOX_STATE_SETUP_PHOTO; + sPictoPhotoBeingTaken = true; + } + } + } else if ((sPictoState >= PICTO_BOX_STATE_SETUP_PHOTO) && (Message_GetState(&play->msgCtx) == 4) && + Message_ShouldAdvance(play)) { + play->haltAllActors = false; + player->stateFlags1 &= ~PLAYER_STATE1_200; + Message_CloseTextbox(play); + if (play->msgCtx.choiceIndex != 0) { + func_8019F230(); + func_80115844(play, DO_ACTION_STOP); + Interface_SetHudVisibility(HUD_VISIBILITY_A_B); + sPictoState = PICTO_BOX_STATE_LENS; + REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); + } else { + func_8019F208(); + interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; + restoreHudVisibility = true; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + sPictoState = PICTO_BOX_STATE_OFF; + if (sPictoPhotoBeingTaken) { + Play_CompressI8ToI5((play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, + (u8*)((void)0, gSaveContext.pictoPhotoI5), + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); + Snap_RecordPictographedActors(play); + } + play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON; + SET_QUEST_ITEM(QUEST_PICTOGRAPH); + sPictoPhotoBeingTaken = false; + } + } + } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && + (gSaveContext.save.entrance == ENTRANCE(WATERFALL_RAPIDS, 1)) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + // Beaver race minigame + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); + } else if ((gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + // Goron race minigame + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP); + } else if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) { + // Related to pictograph + if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { + func_80115844(play, DO_ACTION_STOP); + Interface_SetHudVisibility(HUD_VISIBILITY_A_B); + sPictoState = PICTO_BOX_STATE_LENS; + } else { + Play_DecompressI5ToI8((u8*)((void)0, gSaveContext.pictoPhotoI5), + (play->pictoPhotoI8 != NULL) ? play->pictoPhotoI8 : D_801FBB90, + PICTO_PHOTO_WIDTH * PICTO_PHOTO_HEIGHT); + play->haltAllActors = true; + sPictoState = PICTO_BOX_STATE_SETUP_PHOTO; + } + } else { + // Continue processing the remaining cases + Interface_UpdateButtonsPart2(play); + } + } + + if (restoreHudVisibility) { + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } +} void Interface_SetSceneRestrictions(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; @@ -1823,7 +2558,40 @@ void Interface_InitMinigame(PlayState* play) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112C0C.s") +/** + * @param play PlayState + * @param flag 0 for default update, 1 for simplified update + */ +void Interface_UpdateButtonsAlt(PlayState* play, u16 flag) { + if (flag) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_FISHING_ROD) || + (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED)) { + if ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMB) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOMBCHU) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_FISHING_ROD)) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NONE) { + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + } + } + + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL_NO_MINIMAP_W_DISABLED); + } else { + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + Interface_UpdateButtonsPart1(play); + } +} s16 sAmmoRefillCounts[] = { 5, 10, 20, 30 }; // Sticks, nuts, bombs s16 sArrowRefillCounts[] = { 10, 30, 40, 50 }; @@ -3146,49 +3914,500 @@ void Magic_DrawMeter(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116FD8.s") +void Interface_SetPerspectiveView(PlayState* play, s32 topY, s32 bottomY, s32 leftX, s32 rightX) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Vec3f eye; + Vec3f at; + Vec3f up; -void func_801170B8(InterfaceContext* interfaceCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801170B8.s") + eye.x = eye.y = eye.z = 0.0f; + at.x = at.y = 0.0f; + at.z = -1.0f; + up.x = up.z = 0.0f; + up.y = 1.0f; -TexturePtr cUpLabelTextures[] = { - gTatlCUpENGTex, gTatlCUpENGTex, gTatlCUpGERTex, gTatlCUpFRATex, gTatlCUpESPTex, -}; -s16 startButtonLeftPos[] = { - // Remnant of OoT - 130, 136, 136, 136, 136, -}; -s16 D_801BFAF4[] = { 0x1D, 0x1B }; -s16 D_801BFAF8[] = { 0x1B, 0x1B }; + View_LookAt(&interfaceCtx->view, &eye, &at, &up); -void func_80117100(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117100.s") + interfaceCtx->viewport.topY = topY; + interfaceCtx->viewport.bottomY = bottomY; + interfaceCtx->viewport.leftX = leftX; + interfaceCtx->viewport.rightX = rightX; + View_SetViewport(&interfaceCtx->view, &interfaceCtx->viewport); -s16 D_801BFAFC[] = { 30, 24, 24, 24 }; + View_SetPerspective(&interfaceCtx->view, 60.0f, 10.0f, 60.0f); + View_ApplyPerspectiveToOverlay(&interfaceCtx->view); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117A20.s") +void Interface_SetOrthoView(InterfaceContext* interfaceCtx) { + SET_FULLSCREEN_VIEWPORT(&interfaceCtx->view); + View_ApplyOrthoToOverlay(&interfaceCtx->view); +} + +void Interface_DrawItemButtons(PlayState* play) { + static TexturePtr cUpLabelTextures[] = { + gTatlCUpENGTex, gTatlCUpENGTex, gTatlCUpGERTex, gTatlCUpFRATex, gTatlCUpESPTex, + }; + static s16 startButtonLeftPos[] = { + // Remnant of OoT + 130, 136, 136, 136, 136, + }; + static s16 D_801BFAF4[] = { 0x1D, 0x1B }; + static s16 D_801BFAF8[] = { 0x1B, 0x1B }; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + s16 temp; // Used as both an alpha value and a button index + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + // B Button Color & Texture + OVERLAY_DISP = Gfx_DrawTexRectIA8_DropShadow(OVERLAY_DISP, gButtonBackgroundTex, 0x20, 0x20, D_801BF9D4[0], + D_801BF9DC[0], D_801BFAF4[0], D_801BFAF4[0], D_801BF9E4[0] * 2, + D_801BF9E4[0] * 2, 100, 255, 120, interfaceCtx->bAlpha); + if (1) {} + gDPPipeSync(OVERLAY_DISP++); + + // C-Left Button Color & Texture + OVERLAY_DISP = Gfx_DrawRect_DropShadow(OVERLAY_DISP, D_801BF9D4[1], D_801BF9DC[1], D_801BFAF4[1], D_801BFAF4[1], + D_801BF9E4[1] * 2, D_801BF9E4[1] * 2, 255, 240, 0, interfaceCtx->cLeftAlpha); + // C-Down Button Color & Texture + OVERLAY_DISP = Gfx_DrawRect_DropShadow(OVERLAY_DISP, D_801BF9D8[0], D_801BF9E0[0], D_801BFAF8[0], D_801BFAF8[0], + D_801BF9E4[2] * 2, D_801BF9E4[2] * 2, 255, 240, 0, interfaceCtx->cDownAlpha); + // C-Right Button Color & Texture + OVERLAY_DISP = + Gfx_DrawRect_DropShadow(OVERLAY_DISP, D_801BF9D8[1], D_801BF9E0[1], D_801BFAF8[1], D_801BFAF8[1], + D_801BF9E4[3] * 2, D_801BF9E4[3] * 2, 255, 240, 0, interfaceCtx->cRightAlpha); + + if (!IS_PAUSE_STATE_GAMEOVER) { + if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { + OVERLAY_DISP = Gfx_DrawRect_DropShadow(OVERLAY_DISP, 0x88, 0x11, 0x16, 0x16, 0x5B6, 0x5B6, 0xFF, 0x82, 0x3C, + interfaceCtx->startAlpha); + // Start Button Texture, Color & Label + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->startAlpha); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, G_IM_FMT_IA, + DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSPTextureRectangle(OVERLAY_DISP++, 0x01F8, 0x0054, 0x02D4, 0x009C, G_TX_RENDERTILE, 0, 0, 0x04A6, 0x04A6); + } + } + + if (interfaceCtx->tatlCalling && (play->pauseCtx.state == PAUSE_STATE_OFF) && + (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->csCtx.state == 0) && + (sPictoState == PICTO_BOX_STATE_OFF)) { + if (sCUpInvisible == 0) { + // C-Up Button Texture, Color & Label (Tatl Text) + gDPPipeSync(OVERLAY_DISP++); + + if ((gSaveContext.hudVisibility == HUD_VISIBILITY_NONE) || + (gSaveContext.hudVisibility == HUD_VISIBILITY_NONE_ALT) || + (gSaveContext.hudVisibility == HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE) || + (msgCtx->msgMode != 0)) { + temp = 0; + } else if (player->stateFlags1 & PLAYER_STATE1_200000) { + temp = 70; + } else { + temp = interfaceCtx->aAlpha; + } + + OVERLAY_DISP = + Gfx_DrawRect_DropShadow(OVERLAY_DISP, 0xFE, 0x10, 0x10, 0x10, 0x800, 0x800, 0xFF, 0xF0, 0, temp); + + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, temp); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, cUpLabelTextures[gSaveContext.options.language], G_IM_FMT_IA, 32, 12, + 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + gSPTextureRectangle(OVERLAY_DISP++, 0x03DC, 0x0048, 0x045C, 0x0078, G_TX_RENDERTILE, 0, 0, 1 << 10, + 1 << 10); + } + + sCUpTimer--; + if (sCUpTimer == 0) { + sCUpInvisible ^= 1; + sCUpTimer = 10; + } + } + + gDPPipeSync(OVERLAY_DISP++); + + // Empty C Button Arrows + for (temp = EQUIP_SLOT_C_LEFT; temp <= EQUIP_SLOT_C_RIGHT; temp++) { + if (GET_CUR_FORM_BTN_ITEM(temp) > 0xF0) { + if (temp == EQUIP_SLOT_C_LEFT) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 240, 0, interfaceCtx->cLeftAlpha); + } else if (temp == EQUIP_SLOT_C_DOWN) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 240, 0, interfaceCtx->cDownAlpha); + } else { // EQUIP_SLOT_C_RIGHT + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 240, 0, interfaceCtx->cRightAlpha); + } + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, ((u8*)gButtonBackgroundTex + ((32 * 32) * (temp + 1))), + 0x20, 0x20, D_801BF9D4[temp], D_801BF9DC[temp], D_801BFAF4[temp], + D_801BFAF4[temp], D_801BF9E4[temp] * 2, D_801BF9E4[temp] * 2); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Interface_DrawItemIconTexture(PlayState* play, TexturePtr texture, s16 button) { + static s16 D_801BFAFC[] = { 30, 24, 24, 24 }; + + OPEN_DISPS(play->state.gfxCtx); + + gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSPTextureRectangle(OVERLAY_DISP++, D_801BF9D4[button] << 2, D_801BF9DC[button] << 2, + (D_801BF9D4[button] + D_801BFAFC[button]) << 2, (D_801BF9DC[button] + D_801BFAFC[button]) << 2, + G_TX_RENDERTILE, 0, 0, D_801BF9BC[button] << 1, D_801BF9BC[button] << 1); + + CLOSE_DISPS(play->state.gfxCtx); +} s16 D_801BFB04[] = { 0xA2, 0xE4, 0xFA, 0x110 }; s16 D_801BFB0C[] = { 0x23, 0x23, 0x33, 0x23 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117BD0.s") +void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { + u8 i; + u16 ammo; -void func_80118084(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118084.s") + OPEN_DISPS(play->state.gfxCtx); -void func_80118890(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118890.s") + i = ((void)0, GET_CUR_FORM_BTN_ITEM(button)); -void func_80118BA4(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118BA4.s") + if ((i == ITEM_STICK) || (i == ITEM_NUT) || (i == ITEM_BOMB) || (i == ITEM_BOW) || + ((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) || (i == ITEM_BOMBCHU) || (i == ITEM_POWDER_KEG) || + (i == ITEM_MAGIC_BEANS) || (i == ITEM_PICTO_BOX)) { -extern TexturePtr D_08095AC0; // gMagicArrowEquipEffectTex -s16 D_801BFB14[] = { 255, 100, 255, 0 }; // magicArrowEffectsR -s16 D_801BFB1C[] = { 0, 100, 255, 0 }; // magicArrowEffectsG -s16 D_801BFB24[] = { 0, 255, 100, 0 }; // magicArrowEffectsB + if ((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) { + i = ITEM_BOW; + } -void func_80119030(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80119030.s") + ammo = AMMO(i); + + if (i == ITEM_PICTO_BOX) { + if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { + ammo = 0; + } else { + ammo = 1; + } + } + + gDPPipeSync(OVERLAY_DISP++); + + if ((button == EQUIP_SLOT_B) && (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE)) { + ammo = play->interfaceCtx.minigameAmmo; + } else if ((button == EQUIP_SLOT_B) && (play->unk_1887C > 1)) { + ammo = play->unk_1887C - 1; + } else if (((i == ITEM_BOW) && (AMMO(i) == CUR_CAPACITY(UPG_QUIVER))) || + ((i == ITEM_BOMB) && (AMMO(i) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((i == ITEM_STICK) && (AMMO(i) == CUR_CAPACITY(UPG_STICKS))) || + ((i == ITEM_NUT) && (AMMO(i) == CUR_CAPACITY(UPG_NUTS))) || + ((i == ITEM_BOMBCHU) && (AMMO(i) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((i == ITEM_POWDER_KEG) && (ammo == 1)) || ((i == ITEM_PICTO_BOX) && (ammo == 1)) || + ((i == ITEM_MAGIC_BEANS) && (ammo == 20))) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, alpha); + } + + if ((u32)ammo == 0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, alpha); + } + + for (i = 0; ammo >= 10; i++) { + ammo -= 10; + } + + // Draw upper digit (tens) + if ((u32)i != 0) { + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, ((u8*)gAmmoDigit0Tex + ((8 * 8) * i)), 8, 8, + D_801BFB04[button], D_801BFB0C[button], 8, 8, 1 << 10, 1 << 10); + } + + // Draw lower digit (ones) + OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, ((u8*)gAmmoDigit0Tex + ((8 * 8) * ammo)), 8, 8, + D_801BFB04[button] + 6, D_801BFB0C[button], 8, 8, 1 << 10, 1 << 10); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Interface_DrawBButtonIcons(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + Player* player = GET_PLAYER(play); + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + if ((interfaceCtx->unk_222 == 0) && (player->stateFlags3 & PLAYER_STATE3_1000000)) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_DISABLED) { + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment, EQUIP_SLOT_B); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + Interface_DrawAmmoCount(play, EQUIP_SLOT_B, interfaceCtx->bAlpha); + } + } else if ((!interfaceCtx->unk_21C && (interfaceCtx->unk_222 == 0)) || + ((interfaceCtx->unk_21C && + ((BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) < ITEM_SWORD_KOKIRI) || + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) > ITEM_SWORD_GILDED)) && + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) && + (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NUT))) { + if ((player->transformation == PLAYER_FORM_FIERCE_DEITY) || (player->transformation == PLAYER_FORM_HUMAN)) { + if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment, EQUIP_SLOT_B); + if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || + (play->unk_1887C >= 2)) { + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + if ((play->sceneId != SCENE_SYATEKI_MIZU) && (play->sceneId != SCENE_SYATEKI_MORI) && + (play->sceneId != SCENE_BOWLING) && + ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || + (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0))) && + ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || !(CHECK_EVENTINF(EVENTINF_35))) && + (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80) || (play->unk_1887C != 100))) { + Interface_DrawAmmoCount(play, EQUIP_SLOT_B, interfaceCtx->bAlpha); + } + } + } + } + } else if (interfaceCtx->unk_222 != 0) { + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + 0x480, G_IM_FMT_IA, 48, 16, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + + D_801BF9B0 = 1024.0f / (D_801BF9B4[gSaveContext.options.language] / 100.0f); + + gSPTextureRectangle( + OVERLAY_DISP++, (D_801BF9C4[gSaveContext.options.language] * 4), + (D_801BF9C8[gSaveContext.options.language] * 4), ((D_801BF9C4[gSaveContext.options.language] + 0x30) << 2), + ((D_801BF9C8[gSaveContext.options.language] + 0x10) << 2), G_TX_RENDERTILE, 0, 0, D_801BF9B0, D_801BF9B0); + } else if (interfaceCtx->bButtonDoAction != DO_ACTION_NONE) { + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + 0x600, G_IM_FMT_IA, 48, 16, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + + D_801BF9B0 = 1024.0f / (D_801BF9B4[gSaveContext.options.language] / 100.0f); + + gSPTextureRectangle( + OVERLAY_DISP++, (D_801BF9C4[gSaveContext.options.language] * 4), + (D_801BF9C8[gSaveContext.options.language] * 4), ((D_801BF9C4[gSaveContext.options.language] + 0x30) << 2), + ((D_801BF9C8[gSaveContext.options.language] + 0x10) << 2), G_TX_RENDERTILE, 0, 0, D_801BF9B0, D_801BF9B0); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Draws the icons and ammo for each of the C buttons + */ +void Interface_DrawCButtonIcons(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + + // C-Left Button Icon & Ammo Count + if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) < ITEM_F0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x1000, EQUIP_SLOT_C_LEFT); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + Interface_DrawAmmoCount(play, EQUIP_SLOT_C_LEFT, interfaceCtx->cLeftAlpha); + } + + gDPPipeSync(OVERLAY_DISP++); + + // C-Down Button Icon & Ammo Count + if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) < ITEM_F0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x2000, EQUIP_SLOT_C_DOWN); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + Interface_DrawAmmoCount(play, EQUIP_SLOT_C_DOWN, interfaceCtx->cDownAlpha); + } + + gDPPipeSync(OVERLAY_DISP++); + + // C-Right Button Icon & Ammo Count + if (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) < ITEM_F0) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + Interface_DrawItemIconTexture(play, interfaceCtx->iconItemSegment + 0x3000, EQUIP_SLOT_C_RIGHT); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + Interface_DrawAmmoCount(play, EQUIP_SLOT_C_RIGHT, interfaceCtx->cRightAlpha); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Interface_DrawAButton(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + s16 aAlpha; + + OPEN_DISPS(play->state.gfxCtx); + + aAlpha = interfaceCtx->aAlpha; + + if (aAlpha > 100) { + aAlpha = 100; + } + + func_8012C8D4(play->state.gfxCtx); + + Interface_SetPerspectiveView(play, 25 + R_A_BTN_Y_OFFSET, 70 + R_A_BTN_Y_OFFSET, 192, 237); + + gSPClearGeometryMode(OVERLAY_DISP++, G_CULL_BOTH); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD); + + Matrix_Translate(0.0f, 0.0f, -38.0f, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_RotateXFApply(interfaceCtx->aButtonRoll / 10000.0f); + + // Draw A button Shadow + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPPipeSync(OVERLAY_DISP++); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, aAlpha); + + OVERLAY_DISP = Gfx_DrawTexQuadIA8(OVERLAY_DISP, gButtonBackgroundTex, 32, 32, 0); + + // Draw A Button Colored + gDPPipeSync(OVERLAY_DISP++); + Interface_SetPerspectiveView(play, 23 + R_A_BTN_Y_OFFSET, 68 + R_A_BTN_Y_OFFSET, 190, 235); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 200, 255, interfaceCtx->aAlpha); + gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); + + // Draw A Button Do-Action + gDPPipeSync(OVERLAY_DISP++); + Interface_SetPerspectiveView(play, 23 + R_A_BTN_Y_OFFSET, 68 + R_A_BTN_Y_OFFSET, 190, 235); + gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, + ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + + Matrix_Translate(0.0f, 0.0f, D_801BF9CC[gSaveContext.options.language] / 10.0f, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_RotateXFApply(interfaceCtx->aButtonRoll / 10000.0f); + gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[8], 4, 0); + + // Draw Action Label + if (((interfaceCtx->aButtonState <= A_BTN_STATE_1) || (interfaceCtx->aButtonState == A_BTN_STATE_3))) { + OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment, 3, DO_ACTION_TEX_WIDTH, + DO_ACTION_TEX_HEIGHT, 0); + } else { + OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE, 3, + DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +static s16 sMagicArrowEffectsR[] = { 255, 100, 255 }; +static s16 sMagicArrowEffectsG[] = { 0, 100, 255 }; +static s16 sMagicArrowEffectsB[] = { 0, 255, 100 }; + +void Interface_DrawPauseMenuEquippingIcons(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + PauseContext* pauseCtx = &play->pauseCtx; + s16 temp; + + OPEN_DISPS(play->state.gfxCtx); + + gDPPipeSync(OVERLAY_DISP++); + + // This is needed as `Interface_DrawPauseMenuEquippingIcons` is call immediately + // after `Interface_DrawAButton`, which sets the view to perspective mode + Interface_SetOrthoView(interfaceCtx); + + if ((pauseCtx->state == PAUSE_STATE_MAIN) && ((pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_MASK))) { + // Inventory Equip Effects + gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment); + func_8012C8D4(play->state.gfxCtx); + gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD); + gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = pauseCtx->equipAnimX / 10; + pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = + pauseCtx->cursorVtx[16].v.ob[0] + (pauseCtx->equipAnimScale / 10); + pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = pauseCtx->equipAnimY / 10; + pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = + pauseCtx->cursorVtx[16].v.ob[1] - (pauseCtx->equipAnimScale / 10); + + if (pauseCtx->equipTargetItem < 0xB5) { + // Normal Equip (icon goes from the inventory slot to the C button when equipping it) + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->equipAnimAlpha); + gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0); + gDPLoadTextureBlock(OVERLAY_DISP++, gItemIcons[pauseCtx->equipTargetItem], G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, + 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } else { + // Magic Arrow Equip Effect + temp = pauseCtx->equipTargetItem - 0xB5; + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicArrowEffectsR[temp], sMagicArrowEffectsG[temp], + sMagicArrowEffectsB[temp], pauseCtx->equipAnimAlpha); + + if ((pauseCtx->equipAnimAlpha > 0) && (pauseCtx->equipAnimAlpha < 255)) { + temp = (pauseCtx->equipAnimAlpha / 8) / 2; + pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = + pauseCtx->cursorVtx[16].v.ob[0] - temp; + pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = + pauseCtx->cursorVtx[16].v.ob[0] + temp * 2 + 32; + pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = + pauseCtx->cursorVtx[16].v.ob[1] + temp; + pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = + pauseCtx->cursorVtx[16].v.ob[1] - temp * 2 - 32; + } + + gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[16], 4, 0); + gDPLoadTextureBlock(OVERLAY_DISP++, &D_08095AC0, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } + + gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); + } + + CLOSE_DISPS(play->state.gfxCtx); +} /** * Draws either the analog three-day clock or the digital final-hours clock @@ -5083,7 +6302,7 @@ void Interface_Draw(PlayState* play) { if (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) { Interface_SetVertices(play); - func_801170B8(interfaceCtx); + Interface_SetOrthoView(interfaceCtx); // Draw Grandma's Story if (interfaceCtx->storyDmaStatus == STORY_DMA_DONE) { @@ -5300,16 +6519,16 @@ void Interface_Draw(PlayState* play) { func_8012C654(play->state.gfxCtx); - func_80117100(play); + Interface_DrawItemButtons(play); if (player->transformation == ((void)0, gSaveContext.save.playerForm)) { - func_80118084(play); + Interface_DrawBButtonIcons(play); } - func_80118890(play); + Interface_DrawCButtonIcons(play); - func_80118BA4(play); + Interface_DrawAButton(play); - func_80119030(play); + Interface_DrawPauseMenuEquippingIcons(play); // Draw either the minigame countdown or the three-day clock if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { @@ -5516,7 +6735,7 @@ void Interface_Update(PlayState* play) { // Update buttons if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { - func_80111CB4(play); + Interface_UpdateButtonsPart1(play); } } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 6e7d0222c..bff81e8c9 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -2169,15 +2169,15 @@ void Player_DrawBlastMask(PlayState* play, Player* player) { OPEN_DISPS(play->state.gfxCtx); - if (player->unk_B60 != 0) { + if (player->blastMaskTimer != 0) { s32 alpha; gSegments[0xA] = VIRTUAL_TO_PHYSICAL(player->maskObjectSegment); AnimatedMat_DrawOpa(play, Lib_SegmentedToVirtual(&object_mask_bakuretu_Matanimheader_0011F8)); - if (player->unk_B60 < 11) { - alpha = (player->unk_B60 / 10.0f) * 255; + if (player->blastMaskTimer <= 10) { + alpha = (player->blastMaskTimer / 10.0f) * 255; } else { alpha = 255; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index d1a358e75..474180826 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -241,9 +241,9 @@ void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx) { pauseCtx->cursorVtx[0].v.ob[1] = vtx[index].v.ob[1]; } -s16 sMagicArrowEffectsR[] = { 255, 100, 255 }; -s16 sMagicArrowEffectsG[] = { 0, 100, 255 }; -s16 sMagicArrowEffectsB[] = { 0, 255, 100 }; +static s16 sMagicArrowEffectsR[] = { 255, 100, 255 }; +static s16 sMagicArrowEffectsG[] = { 0, 100, 255 }; +static s16 sMagicArrowEffectsB[] = { 0, 255, 100 }; void KaleidoScope_DrawItemSelect(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index 4c3ca7ebb..721ca7a18 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -528,7 +528,7 @@ void KaleidoScope_UpdateOpening(PlayState* play) { if (pauseCtx->switchPageTimer == 64) { // Finished opening - func_80112C0C(play, 1); + Interface_UpdateButtonsAlt(play, 1); if (pauseCtx->cursorSpecialPos == 0) { gSaveContext.buttonStatus[EQUIP_SLOT_B] = D_801C6A98[pauseCtx->pageIndex][0]; @@ -1340,7 +1340,7 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = sUnpausedButtonStatus[EQUIP_SLOT_C_RIGHT]; gSaveContext.buttonStatus[EQUIP_SLOT_A] = sUnpausedButtonStatus[EQUIP_SLOT_A]; - func_80110038(play); + Interface_UpdateButtonsPart2(play); gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; Interface_SetHudVisibility(HUD_VISIBILITY_ALL); MsgEvent_SendNullTask(); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 8afe297a8..5ac01aab6 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2104,14 +2104,14 @@ 0x8010EF9C:("Interface_UpdateButtonAlphasByStatus",), 0x8010F0D4:("Interface_UpdateButtonAlphas",), 0x8010F1A8:("Interface_UpdateHudAlphas",), - 0x80110038:("func_80110038",), - 0x80111CB4:("func_80111CB4",), + 0x80110038:("Interface_UpdateButtonsPart2",), + 0x80111CB4:("Interface_UpdateButtonsPart1",), 0x801129E4:("Interface_SetSceneRestrictions",), 0x80112AF4:("Interface_Noop",), 0x80112AFC:("Interface_InitMinigame",), 0x80112B40:("Interface_LoadItemIconImpl",), 0x80112BE4:("Interface_LoadItemIcon",), - 0x80112C0C:("func_80112C0C",), + 0x80112C0C:("Interface_UpdateButtonsAlt",), 0x80112E80:("Item_Give",), 0x801143CC:("Item_CheckObtainabilityImpl",), 0x80114978:("Item_CheckObtainability",), @@ -2141,15 +2141,15 @@ 0x80116114:("Magic_FlashMeterBorder",), 0x80116348:("Magic_Update",), 0x80116918:("Magic_DrawMeter",), - 0x80116FD8:("func_80116FD8",), - 0x801170B8:("func_801170B8",), - 0x80117100:("func_80117100",), - 0x80117A20:("func_80117A20",), - 0x80117BD0:("func_80117BD0",), - 0x80118084:("func_80118084",), - 0x80118890:("func_80118890",), - 0x80118BA4:("func_80118BA4",), - 0x80119030:("func_80119030",), + 0x80116FD8:("Interface_SetPerspectiveView",), + 0x801170B8:("Interface_SetOrthoView",), + 0x80117100:("Interface_DrawItemButtons",), + 0x80117A20:("Interface_DrawItemIconTexture",), + 0x80117BD0:("Interface_DrawAmmoCount",), + 0x80118084:("Interface_DrawBButtonIcons",), + 0x80118890:("Interface_DrawCButtonIcons",), + 0x80118BA4:("Interface_DrawAButton",), + 0x80119030:("Interface_DrawPauseMenuEquippingIcons",), 0x80119610:("Interface_DrawClock",), 0x8011B4E0:("Interface_SetPerfectLetters",), 0x8011B5C0:("Interface_UpdatePerfectLettersType1",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index aecdd1cc6..7455f7c2c 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1136,9 +1136,9 @@ 0x801BFAFC:("D_801BFAFC","UNK_TYPE4","",0x4), 0x801BFB04:("D_801BFB04","UNK_TYPE1","",0x1), 0x801BFB0C:("D_801BFB0C","UNK_TYPE1","",0x1), - 0x801BFB14:("D_801BFB14","UNK_TYPE1","",0x1), - 0x801BFB1C:("D_801BFB1C","UNK_TYPE1","",0x1), - 0x801BFB24:("D_801BFB24","UNK_TYPE1","",0x1), + 0x801BFB14:("sMagicArrowEffectsR","UNK_TYPE1","",0x1), + 0x801BFB1C:("sMagicArrowEffectsG","UNK_TYPE1","",0x1), + 0x801BFB24:("sMagicArrowEffectsB","UNK_TYPE1","",0x1), 0x801BFB2C:("sThreeDayClockAlpha","UNK_TYPE2","",0x2), 0x801BFB30:("D_801BFB30","UNK_TYPE2","",0x2), 0x801BFB34:("D_801BFB34","UNK_TYPE2","",0x2), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 99723cafd..1d08b2962 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1618,14 +1618,14 @@ asm/non_matchings/code/z_parameter/Interface_SetHudVisibility.s,Interface_SetHud asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphasByStatus.s,Interface_UpdateButtonAlphasByStatus,0x8010EF9C,0x4E asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphas.s,Interface_UpdateButtonAlphas,0x8010F0D4,0x35 asm/non_matchings/code/z_parameter/Interface_UpdateHudAlphas.s,Interface_UpdateHudAlphas,0x8010F1A8,0x3A4 -asm/non_matchings/code/z_parameter/func_80110038.s,func_80110038,0x80110038,0x71F -asm/non_matchings/code/z_parameter/func_80111CB4.s,func_80111CB4,0x80111CB4,0x34C +asm/non_matchings/code/z_parameter/Interface_UpdateButtonsPart2.s,Interface_UpdateButtonsPart2,0x80110038,0x71F +asm/non_matchings/code/z_parameter/Interface_UpdateButtonsPart1.s,Interface_UpdateButtonsPart1,0x80111CB4,0x34C asm/non_matchings/code/z_parameter/Interface_SetSceneRestrictions.s,Interface_SetSceneRestrictions,0x801129E4,0x44 asm/non_matchings/code/z_parameter/Interface_Noop.s,Interface_Noop,0x80112AF4,0x2 asm/non_matchings/code/z_parameter/Interface_InitMinigame.s,Interface_InitMinigame,0x80112AFC,0x11 asm/non_matchings/code/z_parameter/Interface_LoadItemIconImpl.s,Interface_LoadItemIconImpl,0x80112B40,0x29 asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s,Interface_LoadItemIcon,0x80112BE4,0xA -asm/non_matchings/code/z_parameter/func_80112C0C.s,func_80112C0C,0x80112C0C,0x9D +asm/non_matchings/code/z_parameter/Interface_UpdateButtonsAlt.s,Interface_UpdateButtonsAlt,0x80112C0C,0x9D asm/non_matchings/code/z_parameter/Item_Give.s,Item_Give,0x80112E80,0x553 asm/non_matchings/code/z_parameter/Item_CheckObtainabilityImpl.s,Item_CheckObtainabilityImpl,0x801143CC,0x16B asm/non_matchings/code/z_parameter/Item_CheckObtainability.s,Item_CheckObtainability,0x80114978,0xA @@ -1655,15 +1655,15 @@ asm/non_matchings/code/z_parameter/Magic_UpdateAddRequest.s,Magic_UpdateAddReque asm/non_matchings/code/z_parameter/Magic_FlashMeterBorder.s,Magic_FlashMeterBorder,0x80116114,0x8D asm/non_matchings/code/z_parameter/Magic_Update.s,Magic_Update,0x80116348,0x174 asm/non_matchings/code/z_parameter/Magic_DrawMeter.s,Magic_DrawMeter,0x80116918,0x1B0 -asm/non_matchings/code/z_parameter/func_80116FD8.s,func_80116FD8,0x80116FD8,0x38 -asm/non_matchings/code/z_parameter/func_801170B8.s,func_801170B8,0x801170B8,0x12 -asm/non_matchings/code/z_parameter/func_80117100.s,func_80117100,0x80117100,0x248 -asm/non_matchings/code/z_parameter/func_80117A20.s,func_80117A20,0x80117A20,0x6C -asm/non_matchings/code/z_parameter/func_80117BD0.s,func_80117BD0,0x80117BD0,0x12D -asm/non_matchings/code/z_parameter/func_80118084.s,func_80118084,0x80118084,0x203 -asm/non_matchings/code/z_parameter/func_80118890.s,func_80118890,0x80118890,0xC5 -asm/non_matchings/code/z_parameter/func_80118BA4.s,func_80118BA4,0x80118BA4,0x123 -asm/non_matchings/code/z_parameter/func_80119030.s,func_80119030,0x80119030,0x178 +asm/non_matchings/code/z_parameter/Interface_SetPerspectiveView.s,Interface_SetPerspectiveView,0x80116FD8,0x38 +asm/non_matchings/code/z_parameter/Interface_SetOrthoView.s,Interface_SetOrthoView,0x801170B8,0x12 +asm/non_matchings/code/z_parameter/Interface_DrawItemButtons.s,Interface_DrawItemButtons,0x80117100,0x248 +asm/non_matchings/code/z_parameter/Interface_DrawItemIconTexture.s,Interface_DrawItemIconTexture,0x80117A20,0x6C +asm/non_matchings/code/z_parameter/Interface_DrawAmmoCount.s,Interface_DrawAmmoCount,0x80117BD0,0x12D +asm/non_matchings/code/z_parameter/Interface_DrawBButtonIcons.s,Interface_DrawBButtonIcons,0x80118084,0x203 +asm/non_matchings/code/z_parameter/Interface_DrawCButtonIcons.s,Interface_DrawCButtonIcons,0x80118890,0xC5 +asm/non_matchings/code/z_parameter/Interface_DrawAButton.s,Interface_DrawAButton,0x80118BA4,0x123 +asm/non_matchings/code/z_parameter/Interface_DrawPauseMenuEquippingIcons.s,Interface_DrawPauseMenuEquippingIcons,0x80119030,0x178 asm/non_matchings/code/z_parameter/Interface_DrawClock.s,Interface_DrawClock,0x80119610,0x7B4 asm/non_matchings/code/z_parameter/Interface_SetPerfectLetters.s,Interface_SetPerfectLetters,0x8011B4E0,0x38 asm/non_matchings/code/z_parameter/Interface_UpdatePerfectLettersType1.s,Interface_UpdatePerfectLettersType1,0x8011B5C0,0x108 From 34f9fb98863f5972588e6dccc8f8866096e19361 Mon Sep 17 00:00:00 2001 From: krm01 Date: Thu, 30 Mar 2023 02:57:26 -0700 Subject: [PATCH 10/29] [Doc] small, names for mayor dotour's eye and eyebrow textures (#1220) * some naming and tlut assignments to dt eye textures * update dotour overlays with new texture names * critical formatting fix --- assets/xml/objects/object_dt.xml | 16 ++++++++-------- .../actors/ovl_En_Ending_Hero/z_en_ending_hero.c | 16 ++++++++-------- .../ovl_En_Ending_Hero6/z_en_ending_hero6.c | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/assets/xml/objects/object_dt.xml b/assets/xml/objects/object_dt.xml index f1e62d59a..3acf0c442 100644 --- a/assets/xml/objects/object_dt.xml +++ b/assets/xml/objects/object_dt.xml @@ -28,8 +28,8 @@ - - + + @@ -37,15 +37,15 @@ - + - - - + + + - - + + diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c index 6cdf54d70..1786380ac 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c @@ -71,13 +71,13 @@ void EnEndingHero_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); } -static TexturePtr D_80C1E970[] = { - object_dt_Tex_007350, object_dt_Tex_009590, object_dt_Tex_009F90, object_dt_Tex_00A790, object_dt_Tex_00AB90, +static TexturePtr sEyeTextures[] = { + gDotourEyeShockTex, gDotourEyeOpenTex, gDotourEyeClosedTex, gDotourEyeLookDownTex, gDotourEyeSquintTex, }; -static TexturePtr D_80C1E984[] = { - object_dt_Tex_007750, - object_dt_Tex_00A390, - object_dt_Tex_00A490, +static TexturePtr sEyebrowTextures[] = { + gDotourEyebrowHighTex, + gDotourEyebrowMidTex, + gDotourEyebrowLowTex, }; void EnEndingHero_Draw(Actor* thisx, PlayState* play) { @@ -88,13 +88,13 @@ void EnEndingHero_Draw(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C1E970[this->unk242])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->unk242])); if (this->unk242 < 3) { index = this->unk242; } - gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1E984[index])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyebrowTextures[index])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c index 8f19fe9f8..06f973265 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c @@ -121,9 +121,9 @@ void EnEndingHero6_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } void EnEndingHero6_Draw(Actor* thisx, PlayState* play) { - static TexturePtr D_80C24280[] = { object_dt_Tex_007350, object_dt_Tex_009590, object_dt_Tex_009F90, - object_dt_Tex_00A790, object_dt_Tex_00AB90 }; - static TexturePtr D_80C24294[] = { object_dt_Tex_007750, object_dt_Tex_00A390, object_dt_Tex_00A490 }; + static TexturePtr sEyeTextures[] = { gDotourEyeShockTex, gDotourEyeOpenTex, gDotourEyeClosedTex, + gDotourEyeLookDownTex, gDotourEyeSquintTex }; + static TexturePtr sEyebrowTextures[] = { gDotourEyebrowHighTex, gDotourEyebrowMidTex, gDotourEyebrowLowTex }; s32 pad; EnEndingHero6* this = THIS; s32 index = 0; @@ -156,13 +156,13 @@ void EnEndingHero6_Draw(Actor* thisx, PlayState* play) { } if (this->npcIndex == 0) { - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C24280[this->eyeState])); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeState])); if (this->eyeState < 3) { index = this->eyeState; } - gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C24294[index])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyebrowTextures[index])); } SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, From d8064bb070b6acc449c761e00b68e41ea6175b26 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Thu, 30 Mar 2023 13:17:55 -0300 Subject: [PATCH 11/29] Effect table (#1209) * effect_ss_table.h * monkaBSS * format * Remove InitVars extern headers * Remove `const` from InitVars * cleanup * cleanup * format * bss * bss * bss --- include/initvars.h | 33 -------- include/segment_symbols.h | 32 -------- include/tables/effect_ss_table.h | 48 ++++++++++++ include/z64effect.h | 55 ++++--------- include/z64light.h | 1 + src/code/sched.c | 1 + src/code/z_bgcheck.c | 1 - src/code/z_demo.c | 1 - src/code/z_effect_soft_sprite_dlftbls.c | 78 +++++++------------ src/code/z_player_lib.c | 2 + .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 1 + src/overlays/actors/ovl_Boss_02/z_boss_02.c | 1 - src/overlays/actors/ovl_En_Bat/z_en_bat.c | 1 + .../actors/ovl_En_Fishing/z_en_fishing.c | 1 - src/overlays/actors/ovl_En_Test3/z_en_test3.c | 1 - .../actors/ovl_Obj_Driftice/z_obj_driftice.h | 2 - .../z_eff_en_ice_block.c | 2 +- .../z_eff_en_ice_block.h | 2 - .../ovl_Effect_Ss_Blast/z_eff_ss_blast.c | 2 +- .../ovl_Effect_Ss_Blast/z_eff_ss_blast.h | 2 - .../ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c | 2 +- .../ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h | 2 - .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c | 2 +- .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h | 2 - .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c | 2 +- .../ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h | 2 - .../ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c | 2 +- .../ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h | 2 - .../ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c | 2 +- .../ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h | 2 - .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c | 2 +- .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h | 2 - .../z_eff_ss_dt_bubble.c | 2 +- .../z_eff_ss_dt_bubble.h | 2 - .../ovl_Effect_Ss_Dust/z_eff_ss_dust.c | 2 +- .../ovl_Effect_Ss_Dust/z_eff_ss_dust.h | 2 - .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c | 2 +- .../ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h | 2 - .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c | 2 +- .../ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h | 2 - .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 2 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.h | 2 - .../z_eff_ss_fhg_flash.c | 2 +- .../z_eff_ss_fhg_flash.h | 2 - .../z_eff_ss_fire_tail.c | 2 +- .../z_eff_ss_fire_tail.h | 2 - .../ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c | 2 +- .../ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h | 2 - .../z_eff_ss_g_ripple.c | 2 +- .../z_eff_ss_g_ripple.h | 2 - .../ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c | 2 +- .../ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h | 2 - .../z_eff_ss_g_splash.c | 2 +- .../z_eff_ss_g_splash.h | 2 - .../ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c | 2 +- .../ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h | 2 - .../ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c | 2 +- .../ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h | 2 - .../z_eff_ss_ice_piece.c | 2 +- .../z_eff_ss_ice_piece.h | 2 - .../z_eff_ss_ice_smoke.c | 2 +- .../z_eff_ss_ice_smoke.h | 2 - .../ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c | 2 +- .../ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h | 2 - .../ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c | 2 +- .../z_eff_ss_kirakira.c | 2 +- .../z_eff_ss_kirakira.h | 2 - .../z_eff_ss_lightning.c | 2 +- .../z_eff_ss_lightning.h | 2 - .../effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c | 2 +- .../effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h | 2 - .../ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c | 2 +- .../ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h | 2 - .../z_eff_ss_solder_srch_ball.c | 2 +- .../z_eff_ss_solder_srch_ball.h | 2 - .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 2 +- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c | 2 +- .../ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h | 2 - 78 files changed, 127 insertions(+), 256 deletions(-) create mode 100644 include/tables/effect_ss_table.h diff --git a/include/initvars.h b/include/initvars.h index 50668a14c..554b0ff5d 100644 --- a/include/initvars.h +++ b/include/initvars.h @@ -1,39 +1,6 @@ #ifndef _INITVARS_H_ #define _INITVARS_H_ -extern EffectSsInit Effect_Ss_Dust_InitVars; -extern EffectSsInit Effect_Ss_Kirakira_InitVars; -extern EffectSsInit Effect_Ss_Bomb2_InitVars; -extern EffectSsInit Effect_Ss_Blast_InitVars; -extern EffectSsInit Effect_Ss_G_Spk_InitVars; -extern EffectSsInit Effect_Ss_D_Fire_InitVars; -extern EffectSsInit Effect_Ss_Bubble_InitVars; -extern EffectSsInit Effect_Ss_G_Ripple_InitVars; -extern EffectSsInit Effect_Ss_G_Splash_InitVars; -extern EffectSsInit Effect_Ss_G_Fire_InitVars; -extern EffectSsInit Effect_Ss_Lightning_InitVars; -extern EffectSsInit Effect_Ss_Dt_Bubble_InitVars; -extern EffectSsInit Effect_Ss_Hahen_InitVars; -extern EffectSsInit Effect_Ss_Stick_InitVars; -extern EffectSsInit Effect_Ss_Sibuki_InitVars; -extern EffectSsInit Effect_Ss_Stone1_InitVars; -extern EffectSsInit Effect_Ss_Hitmark_InitVars; -extern EffectSsInit Effect_Ss_Fhg_Flash_InitVars; -extern EffectSsInit Effect_Ss_K_Fire_InitVars; -extern EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars; -extern EffectSsInit Effect_Ss_Kakera_InitVars; -extern EffectSsInit Effect_Ss_Ice_Piece_InitVars; -extern EffectSsInit Effect_Ss_En_Ice_InitVars; -extern EffectSsInit Effect_Ss_Fire_Tail_InitVars; -extern EffectSsInit Effect_Ss_En_Fire_InitVars; -extern EffectSsInit Effect_Ss_Extra_InitVars; -extern EffectSsInit Effect_Ss_Dead_Db_InitVars; -extern EffectSsInit Effect_Ss_Dead_Dd_InitVars; -extern EffectSsInit Effect_Ss_Dead_Ds_InitVars; -extern EffectSsInit Effect_Ss_Ice_Smoke_InitVars; -extern EffectSsInit Effect_En_Ice_Block_InitVars; -extern EffectSsInit Effect_Ss_Sbn_InitVars; - extern TransitionInit TransitionFade_InitVars; extern TransitionInit TransitionTriforce_InitVars; extern TransitionInit TransitionWipe1_InitVars; diff --git a/include/segment_symbols.h b/include/segment_symbols.h index d8be24777..79601bc93 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -88,43 +88,11 @@ DECLARE_OVERLAY_SEGMENT(player_actor) #undef DEFINE_ACTOR_INTERNAL #undef DEFINE_ACTOR_UNSET -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dust) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Kirakira) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Bomb2) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Blast) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Spk) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_D_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Bubble) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Ripple) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Splash) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_G_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Lightning) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dt_Bubble) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Hahen) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Stick) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Sibuki) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Stone1) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Hitmark) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Fhg_Flash) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_K_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Solder_Srch_Ball) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Kakera) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Ice_Piece) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_En_Ice) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Fire_Tail) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_En_Fire) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Extra) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Db) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Dd) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Dead_Ds) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Ice_Smoke) -DECLARE_OVERLAY_SEGMENT(Effect_En_Ice_Block) DECLARE_OVERLAY_SEGMENT(fbdemo_triforce) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe1) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe3) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe4) DECLARE_OVERLAY_SEGMENT(fbdemo_wipe5) -DECLARE_OVERLAY_SEGMENT(Effect_Ss_Sbn) #define DEFINE_OBJECT(name, _enumValue) DECLARE_ROM_SEGMENT(name) #define DEFINE_OBJECT_UNSET(_enumValue) diff --git a/include/tables/effect_ss_table.h b/include/tables/effect_ss_table.h new file mode 100644 index 000000000..c51847995 --- /dev/null +++ b/include/tables/effect_ss_table.h @@ -0,0 +1,48 @@ +/** + * Effect Soft Sprite Table + * + * DEFINE_EFFECT_SS should be used for normal effects soft sprites + * - Argument 0: Name of the effect (without the ovl_ part) + * - Argument 1: Enum value for this effect + * + * DEFINE_EFFECT_SS_UNSET is needed to define empty entries from the original game + */ +/* 0x00 */ DEFINE_EFFECT_SS(Effect_Ss_Dust, EFFECT_SS_DUST) +/* 0x01 */ DEFINE_EFFECT_SS(Effect_Ss_Kirakira, EFFECT_SS_KIRAKIRA) +/* 0x02 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_02) +/* 0x03 */ DEFINE_EFFECT_SS(Effect_Ss_Bomb2, EFFECT_SS_BOMB2) +/* 0x04 */ DEFINE_EFFECT_SS(Effect_Ss_Blast, EFFECT_SS_BLAST) +/* 0x05 */ DEFINE_EFFECT_SS(Effect_Ss_G_Spk, EFFECT_SS_G_SPK) +/* 0x06 */ DEFINE_EFFECT_SS(Effect_Ss_D_Fire, EFFECT_SS_D_FIRE) +/* 0x07 */ DEFINE_EFFECT_SS(Effect_Ss_Bubble, EFFECT_SS_BUBBLE) +/* 0x08 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_08) +/* 0x09 */ DEFINE_EFFECT_SS(Effect_Ss_G_Ripple, EFFECT_SS_G_RIPPLE) +/* 0x0A */ DEFINE_EFFECT_SS(Effect_Ss_G_Splash, EFFECT_SS_G_SPLASH) +/* 0x0B */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_0B) +/* 0x0C */ DEFINE_EFFECT_SS(Effect_Ss_G_Fire, EFFECT_SS_G_FIRE) +/* 0x0D */ DEFINE_EFFECT_SS(Effect_Ss_Lightning, EFFECT_SS_LIGHTNING) +/* 0x0E */ DEFINE_EFFECT_SS(Effect_Ss_Dt_Bubble, EFFECT_SS_DT_BUBBLE) +/* 0x0F */ DEFINE_EFFECT_SS(Effect_Ss_Hahen, EFFECT_SS_HAHEN) +/* 0x10 */ DEFINE_EFFECT_SS(Effect_Ss_Stick, EFFECT_SS_STICK) +/* 0x11 */ DEFINE_EFFECT_SS(Effect_Ss_Sibuki, EFFECT_SS_SIBUKI) +/* 0x12 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_12) +/* 0x13 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_13) +/* 0x14 */ DEFINE_EFFECT_SS(Effect_Ss_Stone1, EFFECT_SS_STONE1) +/* 0x15 */ DEFINE_EFFECT_SS(Effect_Ss_Hitmark, EFFECT_SS_HITMARK) +/* 0x16 */ DEFINE_EFFECT_SS(Effect_Ss_Fhg_Flash, EFFECT_SS_FHG_FLASH) +/* 0x17 */ DEFINE_EFFECT_SS(Effect_Ss_K_Fire, EFFECT_SS_K_FIRE) +/* 0x18 */ DEFINE_EFFECT_SS(Effect_Ss_Solder_Srch_Ball, EFFECT_SS_SOLDER_SRCH_BALL) +/* 0x19 */ DEFINE_EFFECT_SS(Effect_Ss_Kakera, EFFECT_SS_KAKERA) +/* 0x1A */ DEFINE_EFFECT_SS(Effect_Ss_Ice_Piece, EFFECT_SS_ICE_PIECE) +/* 0x1B */ DEFINE_EFFECT_SS(Effect_Ss_En_Ice, EFFECT_SS_EN_ICE) +/* 0x1C */ DEFINE_EFFECT_SS(Effect_Ss_Fire_Tail, EFFECT_SS_FIRE_TAIL) +/* 0x1D */ DEFINE_EFFECT_SS(Effect_Ss_En_Fire, EFFECT_SS_EN_FIRE) +/* 0x1E */ DEFINE_EFFECT_SS(Effect_Ss_Extra, EFFECT_SS_EXTRA) +/* 0x1F */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_1F) +/* 0x20 */ DEFINE_EFFECT_SS(Effect_Ss_Dead_Db, EFFECT_SS_DEAD_DB) +/* 0x21 */ DEFINE_EFFECT_SS(Effect_Ss_Dead_Dd, EFFECT_SS_DEAD_DD) +/* 0x22 */ DEFINE_EFFECT_SS(Effect_Ss_Dead_Ds, EFFECT_SS_DEAD_DS) +/* 0x23 */ DEFINE_EFFECT_SS_UNSET(EFFECT_SS_UNSET_23) +/* 0x24 */ DEFINE_EFFECT_SS(Effect_Ss_Ice_Smoke, EFFECT_SS_ICE_SMOKE) +/* 0x25 */ DEFINE_EFFECT_SS(Effect_En_Ice_Block, EFFECT_EN_ICE_BLOCK) +/* 0x26 */ DEFINE_EFFECT_SS(Effect_Ss_Sbn, EFFECT_SS_SBN) diff --git a/include/z64effect.h b/include/z64effect.h index 387056941..d6ab8b3b5 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -2,6 +2,7 @@ #define Z64EFFECT_H #include "PR/ultratypes.h" +#include "libc/stdint.h" #include "color.h" #include "z64light.h" #include "z64math.h" @@ -9,6 +10,8 @@ struct GraphicsContext; struct PlayState; +struct Actor; +struct CollisionPoly; #define SPARK_COUNT 3 #define BLURE_COUNT 25 @@ -181,7 +184,7 @@ typedef struct { /* 0x08 */ Vec3s p2; /* 0x0E */ s16 life; /* 0x10 */ UNK_TYPE1 pad10[0x4]; - /* 0x14 */ CollisionPoly* colPoly; + /* 0x14 */ struct CollisionPoly* colPoly; } EffectTireMarkElement; // size = 0x18 typedef struct { @@ -265,7 +268,7 @@ typedef struct EffectSs { /* 0x28 */ EffectSsDrawFunc draw; /* 0x2C */ Vec3f vec; /* 0x38 */ void* gfx; - /* 0x3C */ Actor* actor; + /* 0x3C */ struct Actor* actor; /* 0x40 */ s16 regs[13]; // These are particle-specific /* 0x5A */ u16 flags; // bit 0: set if this entry is not considered free on a priority tie bit 1: ? bit 2: ? /* 0x5C */ s16 life; // -1 means this entry is free @@ -279,47 +282,15 @@ typedef struct { /* 0x8 */ s32 size; } EffectSsInfo; // size = 0xC -typedef enum { - /* 0x00 */ EFFECT_SS_DUST, - /* 0x01 */ EFFECT_SS_KIRAKIRA, - /* 0x02 */ EFFECT_SS_UNSET_02, // Deleted - /* 0x03 */ EFFECT_SS_BOMB2, - /* 0x04 */ EFFECT_SS_BLAST, - /* 0x05 */ EFFECT_SS_G_SPK, - /* 0x06 */ EFFECT_SS_D_FIRE, - /* 0x07 */ EFFECT_SS_BUBBLE, - /* 0x08 */ EFFECT_SS_UNSET_08, // Deleted - /* 0x09 */ EFFECT_SS_G_RIPPLE, - /* 0x0A */ EFFECT_SS_G_SPLASH, - /* 0x0B */ EFFECT_SS_UNSET_0B, - /* 0x0C */ EFFECT_SS_G_FIRE, - /* 0x0D */ EFFECT_SS_LIGHTNING, - /* 0x0E */ EFFECT_SS_DT_BUBBLE, - /* 0x0F */ EFFECT_SS_HAHEN, - /* 0x10 */ EFFECT_SS_STICK, - /* 0x11 */ EFFECT_SS_SIBUKI, - /* 0x12 */ EFFECT_SS_UNSET_12, // Deleted - /* 0x13 */ EFFECT_SS_UNSET_13, // Deleted - /* 0x14 */ EFFECT_SS_STONE1, - /* 0x15 */ EFFECT_SS_HITMARK, - /* 0x16 */ EFFECT_SS_FHG_FLASH, - /* 0x17 */ EFFECT_SS_K_FIRE, - /* 0x18 */ EFFECT_SS_SOLDER_SRCH_BALL, - /* 0x19 */ EFFECT_SS_KAKERA, - /* 0x1A */ EFFECT_SS_ICE_PIECE, - /* 0x1B */ EFFECT_SS_EN_ICE, - /* 0x1C */ EFFECT_SS_FIRE_TAIL, - /* 0x1D */ EFFECT_SS_EN_FIRE, - /* 0x1E */ EFFECT_SS_EXTRA, - /* 0x1F */ EFFECT_SS_UNSET_1F, // Deleted - /* 0x20 */ EFFECT_SS_DEAD_DB, - /* 0x21 */ EFFECT_SS_DEAD_DD, - /* 0x22 */ EFFECT_SS_DEAD_DS, - /* 0x23 */ EFFECT_SS_UNSET_23, // Deleted - /* 0x24 */ EFFECT_SS_ICE_SMOKE, - /* 0x25 */ EFFECT_EN_ICE_BLOCK, - /* 0x26 */ EFFECT_SS_SBN, +#define DEFINE_EFFECT_SS(_name, enumValue) enumValue, +#define DEFINE_EFFECT_SS_UNSET(enumValue) enumValue, + +typedef enum EffectSsType { + #include "tables/effect_ss_table.h" /* 0x27 */ EFFECT_SS_MAX } EffectSsType; +#undef DEFINE_EFFECT_SS +#undef DEFINE_EFFECT_SS_UNSET + #endif diff --git a/include/z64light.h b/include/z64light.h index 1881d6aa1..706df2f4d 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -4,6 +4,7 @@ #include "ultra64.h" #include "PR/gbi.h" #include "color.h" +#include "z64math.h" struct PlayState; diff --git a/src/code/sched.c b/src/code/sched.c index 927a48f66..5f9cdf236 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #define RSP_DONE_MSG 667 diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index c04fce680..ad04236fe 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "vt.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 2628658f6..499561623 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "z64quake.h" #include "z64rumble.h" diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c index e215cdee9..fff77feff 100644 --- a/src/code/z_effect_soft_sprite_dlftbls.c +++ b/src/code/z_effect_soft_sprite_dlftbls.c @@ -1,56 +1,34 @@ -#include "global.h" -#include "initvars.h" +#include "z64effect.h" +#include "segment_symbols.h" -#define EFFECT_SS_OVERLAY(name) \ - { \ - SEGMENT_ROM_START(ovl_##name), SEGMENT_ROM_END(ovl_##name), SEGMENT_START(ovl_##name), \ - SEGMENT_END(ovl_##name), NULL, &name##_InitVars, 1, \ - } +// Init Vars and linker symbol declarations (used in the table below) +#define DEFINE_EFFECT_SS(name, _enumValue) \ + extern EffectSsInit name##_InitVars; \ + DECLARE_OVERLAY_SEGMENT(name) -#define EFFECT_SS_OVERLAY_INTERNAL(name) \ - { 0, 0, NULL, NULL, NULL, &name##_InitVars, 1 } +#define DEFINE_EFFECT_SS_UNSET(_enumValue) -#define EFFECT_SS_OVERLAY_UNSET \ - { 0 } +#include "tables/effect_ss_table.h" + +#undef DEFINE_EFFECT_SS +#undef DEFINE_EFFECT_SS_UNSET + +#define DEFINE_EFFECT_SS(name, _enumValue) \ + { \ + SEGMENT_ROM_START(ovl_##name), \ + SEGMENT_ROM_END(ovl_##name), \ + SEGMENT_START(ovl_##name), \ + SEGMENT_END(ovl_##name), \ + NULL, \ + &name##_InitVars, \ + 1, \ + }, + +#define DEFINE_EFFECT_SS_UNSET(_enumValue) { 0 }, EffectSsOverlay gParticleOverlayTable[] = { - EFFECT_SS_OVERLAY(Effect_Ss_Dust), - EFFECT_SS_OVERLAY(Effect_Ss_Kirakira), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Bomb2), - EFFECT_SS_OVERLAY(Effect_Ss_Blast), - EFFECT_SS_OVERLAY(Effect_Ss_G_Spk), - EFFECT_SS_OVERLAY(Effect_Ss_D_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Bubble), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_G_Ripple), - EFFECT_SS_OVERLAY(Effect_Ss_G_Splash), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_G_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Lightning), - EFFECT_SS_OVERLAY(Effect_Ss_Dt_Bubble), - EFFECT_SS_OVERLAY(Effect_Ss_Hahen), - EFFECT_SS_OVERLAY(Effect_Ss_Stick), - EFFECT_SS_OVERLAY(Effect_Ss_Sibuki), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Stone1), - EFFECT_SS_OVERLAY(Effect_Ss_Hitmark), - EFFECT_SS_OVERLAY(Effect_Ss_Fhg_Flash), - EFFECT_SS_OVERLAY(Effect_Ss_K_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Solder_Srch_Ball), - EFFECT_SS_OVERLAY(Effect_Ss_Kakera), - EFFECT_SS_OVERLAY(Effect_Ss_Ice_Piece), - EFFECT_SS_OVERLAY(Effect_Ss_En_Ice), - EFFECT_SS_OVERLAY(Effect_Ss_Fire_Tail), - EFFECT_SS_OVERLAY(Effect_Ss_En_Fire), - EFFECT_SS_OVERLAY(Effect_Ss_Extra), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Dead_Db), - EFFECT_SS_OVERLAY(Effect_Ss_Dead_Dd), - EFFECT_SS_OVERLAY(Effect_Ss_Dead_Ds), - EFFECT_SS_OVERLAY_UNSET, - EFFECT_SS_OVERLAY(Effect_Ss_Ice_Smoke), - EFFECT_SS_OVERLAY(Effect_En_Ice_Block), - EFFECT_SS_OVERLAY(Effect_Ss_Sbn), +#include "tables/effect_ss_table.h" }; + +#undef DEFINE_EFFECT_SS +#undef DEFINE_EFFECT_SS_UNSET diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index bff81e8c9..a7004ad3c 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1,3 +1,5 @@ +#include "prevent_bss_reordering.h" + #include "global.h" #include "objects/gameplay_keep/gameplay_keep.h" diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index affb850f1..63c61e82f 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -4,6 +4,7 @@ * Description: Great Bay Temple - Waterwheels, push switches, gear shafts, and whirlpools */ +#include "prevent_bss_reordering.h" #include "z_bg_dblue_movebg.h" #include "objects/object_dblue_object/object_dblue_object.h" #include "overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h" diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index d7fe81553..003ba32e9 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -4,7 +4,6 @@ * Description: Twinmold */ -#include "prevent_bss_reordering.h" #include "z_boss_02.h" #include "z64rumble.h" #include "z64shrink_window.h" diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index 4a5473a11..61b060110 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -4,6 +4,7 @@ * Description: Bad Bat */ +#include "prevent_bss_reordering.h" #include "z_en_bat.h" #include "objects/object_bat/object_bat.h" diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 373608dc4..31d884c4d 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -4,7 +4,6 @@ * Description: Fishing Pond Elements (Owner, Fish, Props, Effects...) */ -#include "prevent_bss_reordering.h" #include "z_en_fishing.h" #include "z64rumble.h" #include "z64shrink_window.h" diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index dadfc5af4..8d1c726b7 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -4,7 +4,6 @@ * Description: Kafei */ -#include "prevent_bss_reordering.h" #include "z_en_test3.h" #include "objects/object_test3/object_test3.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h index 21e0f8f27..19627c3df 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h @@ -56,6 +56,4 @@ typedef struct ObjDriftice { /* 0x24C */ s32 unk_24C; } ObjDriftice; // size = 0x250 -extern ActorInit Obj_Driftice_InitVars; - #endif // Z_OBJ_DRIFTICE_H diff --git a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c index 09c2afb11..ef88015b7 100644 --- a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c +++ b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.c @@ -14,7 +14,7 @@ u32 EffectEnIceBlock_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectEnIceBlock_Update(PlayState* play, u32 index, EffectSs* this); void EffectEnIceBlock_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_En_Ice_Block_InitVars = { +EffectSsInit Effect_En_Ice_Block_InitVars = { EFFECT_EN_ICE_BLOCK, EffectEnIceBlock_Init, }; diff --git a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h index e5377b20f..2707d64c8 100644 --- a/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h +++ b/src/overlays/effects/ovl_Effect_En_Ice_Block/z_eff_en_ice_block.h @@ -11,6 +11,4 @@ typedef struct { /* 0x28 */ s16 scale; } EffectEnIceBlockInitParams; // size = 0x2C -extern const EffectSsInit Effect_En_Ice_Block_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c index c903bac6d..2d80b4161 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c @@ -26,7 +26,7 @@ u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Blast_InitVars = { +EffectSsInit Effect_Ss_Blast_InitVars = { EFFECT_SS_BLAST, EffectSsBlast_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h index 72a264c03..1e9087d85 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h @@ -15,6 +15,4 @@ typedef struct { /* 0x32 */ s16 life; } EffectSsBlastInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_Blast_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index d15151d49..b17a43fbe 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -26,7 +26,7 @@ void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this); void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this); void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Bomb2_InitVars = { +EffectSsInit Effect_Ss_Bomb2_InitVars = { EFFECT_SS_BOMB2, EffectSsBomb2_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h index 468e2c016..4a63bd4c8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h @@ -12,6 +12,4 @@ typedef struct { /* 0x28 */ u8 drawMode; } EffectSsBomb2InitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Bomb2_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index 3298b2ab3..a3d203992 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -17,7 +17,7 @@ u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this); void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Bubble_InitVars = { +EffectSsInit Effect_Ss_Bubble_InitVars = { EFFECT_SS_BUBBLE, EffectSsBubble_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h index 0916a95ca..9e57bc657 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h @@ -11,6 +11,4 @@ typedef struct { /* 0x18 */ f32 scale; } EffectSsBubbleInitParams; // size = 0x1C -extern const EffectSsInit Effect_Ss_Bubble_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 9d8eecfbc..d8394b159 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -21,7 +21,7 @@ u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_D_Fire_InitVars = { +EffectSsInit Effect_Ss_D_Fire_InitVars = { EFFECT_SS_D_FIRE, EffectSsDFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h index 2d657bc43..e72616b84 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h @@ -15,6 +15,4 @@ typedef struct { /* 0x30 */ s32 life; } EffectSsDFireInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_D_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c index 54963eb3b..543363ade 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c @@ -25,7 +25,7 @@ u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dead_Db_InitVars = { +EffectSsInit Effect_Ss_Dead_Db_InitVars = { EFFECT_SS_DEAD_DB, EffectSsDeadDb_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h index a1ac62167..58e46426f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h @@ -14,6 +14,4 @@ typedef struct { /* 0x30 */ s32 life; } EffectSsDeadDbInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_Dead_Db_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index 5e8a1e451..9f124d39e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -25,7 +25,7 @@ u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dead_Dd_InitVars = { +EffectSsInit Effect_Ss_Dead_Dd_InitVars = { EFFECT_SS_DEAD_DD, EffectSsDeadDd_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h index 9c9dcf28e..7d32c3284 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h @@ -23,6 +23,4 @@ typedef struct { /* 0x40 */ u8 type; } EffectSsDeadDdInitParams; // size = 0x44 -extern const EffectSsInit Effect_Ss_Dead_Dd_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index 7bf60c2a1..6243b4302 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -23,7 +23,7 @@ u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dead_Ds_InitVars = { +EffectSsInit Effect_Ss_Dead_Ds_InitVars = { EFFECT_SS_DEAD_DS, EffectSsDeadDs_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h index e04742296..b057f3f42 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h @@ -13,6 +13,4 @@ typedef struct { /* 0x2C */ s32 life; } EffectSsDeadDsInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Dead_Ds_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c index 4d009c00a..b6e3b747f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c @@ -39,7 +39,7 @@ static Color_RGBA8 sEnvColors[] = { { 150, 150, 150, 0 }, }; -const EffectSsInit Effect_Ss_Dt_Bubble_InitVars = { +EffectSsInit Effect_Ss_Dt_Bubble_InitVars = { EFFECT_SS_DT_BUBBLE, EffectSsDtBubble_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h index e572f4a2c..b5247eb0f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h @@ -23,6 +23,4 @@ typedef struct { /* 0x34 */ u8 customColor; } EffectSsDtBubbleInitParams; // size = 0x3C -extern const EffectSsInit Effect_Ss_Dt_Bubble_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index 7a2274a5d..10e8fbeed 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -28,7 +28,7 @@ void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDust_UpdateFire(PlayState* play, u32 index, EffectSs* this); void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Dust_InitVars = { +EffectSsInit Effect_Ss_Dust_InitVars = { EFFECT_SS_DUST, EffectSsDust_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h index 410a14352..b2b76e0be 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h @@ -26,6 +26,4 @@ typedef struct { /* 0x34 */ u8 updateMode; } EffectSsDustInitParams; // size = 0x38 -extern const EffectSsInit Effect_Ss_Dust_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index fab6f8788..9d78d4d71 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -24,7 +24,7 @@ u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_En_Fire_InitVars = { +EffectSsInit Effect_Ss_En_Fire_InitVars = { EFFECT_SS_EN_FIRE, EffectSsEnFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h index 9fb959824..0f17477b8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h @@ -15,6 +15,4 @@ typedef struct { /* 0x16 */ s16 bodyPart; } EffectSsEnFireInitParams; // size = 0x18 -extern const EffectSsInit Effect_Ss_En_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index 1108e61ce..21a0f1019 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -28,7 +28,7 @@ void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this); void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_En_Ice_InitVars = { +EffectSsInit Effect_Ss_En_Ice_InitVars = { EFFECT_SS_EN_ICE, EffectSsEnIce_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h index 46b162cc1..051e81983 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h @@ -20,6 +20,4 @@ typedef struct { /* 0x38 */ s16 type; } EffectSsEnIceInitParams; // size = 0x3C -extern const EffectSsInit Effect_Ss_En_Ice_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index bf21a8741..03522f5af 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -16,7 +16,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this); static s16 sScores[] = { 30, 60, 100 }; -const EffectSsInit Effect_Ss_Extra_InitVars = { +EffectSsInit Effect_Ss_Extra_InitVars = { EFFECT_SS_EXTRA, EffectSsExtra_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h index c278ec927..081570f62 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h @@ -17,6 +17,4 @@ typedef struct { /* 0x26 */ s16 scoreIdx; } EffectSsExtraInitParams; // size = 0x28 -extern const EffectSsInit Effect_Ss_Extra_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index b81ccf594..cd7c6d5bd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -19,7 +19,7 @@ u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { +EffectSsInit Effect_Ss_Fhg_Flash_InitVars = { EFFECT_SS_FHG_FLASH, EffectSsFhgFlash_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h index c464047b5..c2f231269 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h @@ -40,6 +40,4 @@ typedef struct { /* 0x2C */ u8 type; } EffectSsFhgFlashInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Fhg_Flash_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index da4de14d6..de464ae8d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -27,7 +27,7 @@ u32 EffectSsFireTail_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsFireTail_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Fire_Tail_InitVars = { +EffectSsInit Effect_Ss_Fire_Tail_InitVars = { EFFECT_SS_FIRE_TAIL, EffectSsFireTail_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h index 60fc2a6ef..a809e4ebc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h @@ -16,6 +16,4 @@ typedef struct { /* 0x30 */ s32 life; } EffectSsFireTailInitParams; // size = 0x34 -extern const EffectSsInit Effect_Ss_Fire_Tail_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c index 7bc2d6966..b41f35756 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c @@ -13,7 +13,7 @@ u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsGFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_G_Fire_InitVars = { +EffectSsInit Effect_Ss_G_Fire_InitVars = { EFFECT_SS_G_FIRE, EffectSsGFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h index 574abc976..cc02cae83 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h @@ -7,6 +7,4 @@ typedef struct { /* 0x00 */ Vec3f pos; } EffectSsGFireInitParams; // size = 0xC -extern const EffectSsInit Effect_Ss_G_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index b820d8168..24aadc0ec 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -27,7 +27,7 @@ u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initP void EffectSsGRipple_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGRipple_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_G_Ripple_InitVars = { +EffectSsInit Effect_Ss_G_Ripple_InitVars = { EFFECT_SS_G_RIPPLE, EffectSsGRipple_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h index 018fff6be..c746fbf28 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h @@ -10,6 +10,4 @@ typedef struct { /* 0x10 */ s16 life; } EffectSsGRippleInitParams; // size = 0x14 -extern const EffectSsInit Effect_Ss_G_Ripple_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c index f7b780883..ccc2951c6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c @@ -26,7 +26,7 @@ void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this); void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_G_Spk_InitVars = { +EffectSsInit Effect_Ss_G_Spk_InitVars = { EFFECT_SS_G_SPK, EffectSsGSpk_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h index c44bb9168..b952802d2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h @@ -20,6 +20,4 @@ typedef struct { /* 0x34 */ u8 updateMode; } EffectSsGSpkInitParams; // size = 0x38 -extern const EffectSsInit Effect_Ss_G_Spk_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c index 78bee9835..8d7647bfe 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c @@ -17,7 +17,7 @@ u32 EffectSsGSplash_Init(PlayState* play, u32 index, EffectSs* this, void* initP void EffectSsGSplash_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsGSplash_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_G_Splash_InitVars = { +EffectSsInit Effect_Ss_G_Splash_InitVars = { EFFECT_SS_G_SPLASH, EffectSsGSplash_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h index 7ea428400..9d3fbcd13 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h @@ -12,6 +12,4 @@ typedef struct { /* 0x14 */ Color_RGBA8 envColor; } EffectSsGSplashInitParams; // size = 0x18 -extern const EffectSsInit Effect_Ss_G_Splash_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c index b4d9ae6fb..e1a9371cd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c @@ -21,7 +21,7 @@ u32 EffectSsHahen_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsHahen_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsHahen_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Hahen_InitVars = { +EffectSsInit Effect_Ss_Hahen_InitVars = { EFFECT_SS_HAHEN, EffectSsHahen_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h index 9a73ac664..d962bf55f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h @@ -19,6 +19,4 @@ typedef struct { /* 0x2C */ s16 life; } EffectSsHahenInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Hahen_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c index f65e36c7d..36eb650f7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.c @@ -73,7 +73,7 @@ static TexturePtr sTextures[] = { gEffHitmarkWhiteMetal8Tex, }; -const EffectSsInit Effect_Ss_Hitmark_InitVars = { +EffectSsInit Effect_Ss_Hitmark_InitVars = { EFFECT_SS_HITMARK, EffectSsHitmark_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h index 6e38ab8d2..e513f0665 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h +++ b/src/overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h @@ -16,6 +16,4 @@ typedef struct { /* 0x08 */ Vec3f pos; } EffectSsHitmarkInitParams; // size = 0x14 -extern const EffectSsInit Effect_Ss_Hitmark_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 52561fea2..9efadc99e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -19,7 +19,7 @@ u32 EffectSsIcePiece_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Ice_Piece_InitVars = { +EffectSsInit Effect_Ss_Ice_Piece_InitVars = { EFFECT_SS_ICE_PIECE, EffectSsIcePiece_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h index 2bbe9e481..16ada036f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h @@ -11,6 +11,4 @@ typedef struct { /* 0x28 */ s32 life; } EffectSsIcePieceInitParams; // size = 0xC -extern const EffectSsInit Effect_Ss_Ice_Piece_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 41c9c818a..e1c2bc72d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -18,7 +18,7 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init void EffectSsIceSmoke_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Ice_Smoke_InitVars = { +EffectSsInit Effect_Ss_Ice_Smoke_InitVars = { EFFECT_SS_ICE_SMOKE, EffectSsIceSmoke_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h index bc6893311..e56678fb0 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h @@ -10,6 +10,4 @@ typedef struct { /* 0x24 */ s16 scale; } EffectSsIceSmokeInitParams; // size = 0x28 -extern const EffectSsInit Effect_Ss_Ice_Smoke_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index 4aa209639..17d7edc1e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -20,7 +20,7 @@ u32 EffectSsKFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsKFire_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_K_Fire_InitVars = { +EffectSsInit Effect_Ss_K_Fire_InitVars = { EFFECT_SS_K_FIRE, EffectSsKFire_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h index 23ed053c3..3cb53de39 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h @@ -11,6 +11,4 @@ typedef struct { /* 0x26 */ u8 type; } EffectSsKFireInitParams; // size = 0x28 -extern const EffectSsInit Effect_Ss_K_Fire_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index a84b450c1..e424c0b44 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -28,7 +28,7 @@ void EffectSsKakera_Draw(PlayState* play, u32 index, EffectSs* this); void EffectSsKakera_CheckForObject(EffectSs* this, PlayState* play); -const EffectSsInit Effect_Ss_Kakera_InitVars = { +EffectSsInit Effect_Ss_Kakera_InitVars = { EFFECT_SS_KAKERA, EffectSsKakera_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c index 97899ae68..540d9e505 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.c @@ -29,7 +29,7 @@ void func_80977E6C(PlayState* play, u32 index, EffectSs* this); void func_80977F28(PlayState* play, u32 index, EffectSs* this); void EffectSsKirakira_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Kirakira_InitVars = { +EffectSsInit Effect_Ss_Kirakira_InitVars = { EFFECT_SS_KIRAKIRA, EffectSsKirakira_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h index 66e73e0a5..e9513cc7a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h +++ b/src/overlays/effects/ovl_Effect_Ss_Kirakira/z_eff_ss_kirakira.h @@ -17,6 +17,4 @@ typedef struct { /* 0x38 */ u8 updateMode; } EffectSsKirakiraInitParams; // size = 0x3C -extern const EffectSsInit Effect_Ss_Kirakira_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 1f70b8064..9037b20f4 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -31,7 +31,7 @@ TexturePtr sLightningTextures[] = { gEffLightning5Tex, gEffLightning6Tex, gEffLightning7Tex, gEffLightning8Tex, }; -const EffectSsInit Effect_Ss_Lightning_InitVars = { +EffectSsInit Effect_Ss_Lightning_InitVars = { EFFECT_SS_LIGHTNING, EffectSsLightning_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h index 35ef380b9..07052e522 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h @@ -13,6 +13,4 @@ typedef struct { /* 0x1A */ s16 numBolts; } EffectSsLightningInitParams; // size = 0x1C -extern const EffectSsInit Effect_Ss_Lightning_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c index c5c058cc3..3402eb2b7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.c @@ -27,7 +27,7 @@ void EffectSsSbn_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsSbn_DrawSliding(PlayState* play, u32 index, EffectSs* this); void EffectSsSbn_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Sbn_InitVars = { +EffectSsInit Effect_Ss_Sbn_InitVars = { EFFECT_SS_SBN, EffectSsSbn_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h index 439ef88a0..9290d7948 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sbn/z_eff_ss_sbn.h @@ -9,6 +9,4 @@ typedef struct { /* 0x10 */ f32 scale; } EffectSsSbnInitParams; // size = 0x14 -extern const EffectSsInit Effect_Ss_Sbn_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index 4dbdc65a2..a9a190948 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -25,7 +25,7 @@ u32 EffectSsSibuki_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Sibuki_InitVars = { +EffectSsInit Effect_Ss_Sibuki_InitVars = { EFFECT_SS_SIBUKI, EffectSsSibuki_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h index 9efe7c77a..27e3780d2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h @@ -12,6 +12,4 @@ typedef struct { /* 0x28 */ s16 scale; } EffectSsSibukiInitParams; // size = 0x2C -extern const EffectSsInit Effect_Ss_Sibuki_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index 01224dd32..d6d6d1cbc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -15,7 +15,7 @@ u32 EffectSsSolderSrchBall_Init(PlayState* play, u32 index, EffectSs* this, void void EffectSsSolderSrchBall_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsSolderSrchBall_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = { +EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars = { EFFECT_SS_SOLDER_SRCH_BALL, EffectSsSolderSrchBall_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h index fb4fb4159..5c250a7af 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h @@ -15,6 +15,4 @@ typedef struct { /* 0x2C */ s16 flags; } EffectSsSolderSrchBallInitParams; // size = 0x30 -extern const EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars; - #endif diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index 1c6d53e7f..4f1aa5d91 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -16,7 +16,7 @@ u32 EffectSsStick_Init(PlayState* play, u32 index, EffectSs* this, void* initPar void EffectSsStick_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsStick_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Stick_InitVars = { +EffectSsInit Effect_Ss_Stick_InitVars = { EFFECT_SS_STICK, EffectSsStick_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index c64ad38c6..6e6b48156 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -15,7 +15,7 @@ u32 EffectSsStone1_Init(PlayState* play, u32 index, EffectSs* this, void* initPa void EffectSsStone1_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this); -const EffectSsInit Effect_Ss_Stone1_InitVars = { +EffectSsInit Effect_Ss_Stone1_InitVars = { EFFECT_SS_STONE1, EffectSsStone1_Init, }; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h index 365585a8e..b50868b81 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h @@ -8,6 +8,4 @@ typedef struct { /* 0x0C */ s32 reg0; } EffectSsStone1InitParams; // size = 0x10 -extern const EffectSsInit Effect_Ss_Stone1_InitVars; - #endif From d9493a5b99cbfa6c062e1d12839c6ffcabec0188 Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Thu, 30 Mar 2023 21:11:57 -0700 Subject: [PATCH 12/29] Update documentation to use updated Z64Utils release + updated directions (#1223) --- docs/tutorial/documenting.md | 12 ++++-------- .../images/z64utils_object_analyzer.png | Bin 11211 -> 0 bytes docs/tutorial/object_decomp.md | 2 +- docs/tutorial/object_decomp_example.md | 6 +++--- 4 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 docs/tutorial/images/z64utils_object_analyzer.png diff --git a/docs/tutorial/documenting.md b/docs/tutorial/documenting.md index e7e82e5e6..7ecd37ccb 100644 --- a/docs/tutorial/documenting.md +++ b/docs/tutorial/documenting.md @@ -327,17 +327,13 @@ the fourth element is the object (it is actually an enum, but the file itself ha ## Z64Utils -The latest release of Z64Utils can be downloaded from [https://github.com/Random06457/Z64Utils/releases]. To use it with MM, you also need a json file to fill in the file names: the latest version can be obtained from [https://github.com/Random06457/Z64Utils-Config]. It should work on Wine. Some graphics cards don't love it, but the 3D graphical part is only required for skeleton and animations. +The latest release of Z64Utils can be downloaded from [https://github.com/zeldaret/Z64Utils/releases]. It should work on Wine. Some graphics cards don't love it, but the 3D graphical part is only required for skeleton and animations. Having downloaded and unzipped it, open the baserom file. This will populate the main window with a list: ![Z64Utils' main window](images/z64utils_main.png) -Search for the object file, right-click and select "Open in Object Analyzer". It will ask you to choose a segment: this is the segment that the file is put on, and allows Z64Utils to resolve the segmented addresses it references into symbols. The json already knows it should be segment `6`, so just click okay. This will open this window: - -![Z64Utils' object analyzer window](images/z64utils_object_analyzer.png) - -Go to "Analysis -> Find Dlists" and press OK (the defaults are usually fine). This will automatically search for displaylists in the object, which are a sufficiently distinctive format to be easy to find. We want to see the other stuff in the object too, so also do "Analysis -> Analyze Dlists". This will populate the window with even more stuff: +Search for the object file, then either double-click it or right-click it and select "Open in Object Analyzer" to open it. It will ask you to choose a segment: this is the segment that the file is put on, and allows Z64Utils to resolve the segmented addresses it references into symbols. The json already knows it should be segment `6`, so just click okay. This will open this window; displaylists and other data will automatically be analyzed when the object is opened: ![Z64Utils, with an analyzed object](images/z64utils_object_analyzed.png) @@ -347,7 +343,7 @@ We will talk about what all these types of data are next time, but for now, all static void* D_80C106B0[4] = { object_bg_Tex_00F8F0, object_bg_Tex_00FCF0, object_bg_Tex_0100F0, object_bg_Tex_00FCF0 }; ``` -actually are. We know they are set on segment 8, so we need to find where the skeleton uses them. We know from `object_bg_Skel_011B60` that this is at `0x06011B60`, so scroll down to it, right-click on it, and choose "Open in Skeleton Viewer". Pick an animation that we know it uses (sometimes Z64Utils misidentifies other things for animations), such as `object_bg_Anim_000968`, and you will get this error: +actually are. We know they are set on segment 8, so we need to find where the skeleton uses them. We know from `object_bg_Skel_011B60` that this is at `0x06011B60`, so scroll down to it and either double-click on it or right-click on it and choose "Open in Skeleton Viewer". Pick an animation that we know it uses (sometimes Z64Utils misidentifies other things for animations), such as `object_bg_Anim_000968`, and you will get this error: ![Z64Utils, error when viewing skeleton](images/z64utils_skeleton_error.png) @@ -447,7 +443,7 @@ void EnRecepgirl_UnkLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { } ``` -It is used to do a rotation of whatever limb `5` is. (The `+=` is because `rot->x` is the base rotation of the limb, and we have to add the same thing to it every frame to keep the angle changed and constant.) We can use Z64Utils to : setting segment `8` to one of what we know now are the eye textures, we can view the model in the skeleton viewer. The limb numbers in the object are one smaller than those in the actor (the root limb is only a concept for the code, not the object), so we find limb 4: +It is used to do a rotation of whatever limb `5` is. (The `+=` is because `rot->x` is the base rotation of the limb, and we have to add the same thing to it every frame to keep the angle changed and constant.) We can use Z64Utils to figure this out: setting segment `8` to one of what we know now are the eye textures, we can view the model in the skeleton viewer. The limb numbers in the object are one smaller than those in the actor (the root limb is only a concept for the code, not the object), so we find limb 4: ![Z64Utils highlighting a limb](images/z64utils_skeleton_head.png) diff --git a/docs/tutorial/images/z64utils_object_analyzer.png b/docs/tutorial/images/z64utils_object_analyzer.png deleted file mode 100644 index 7a6adec3db39949df102c15383b018039df3e499..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11211 zcmeAS@N?(olHy`uVBq!ia0y~yVE)X&z+}L|#=yXE>bo^B0|NtFlDE4H0~q{t-d)eY zz`$AH5n0T@z;^_M8K-LVNi#4o#FV&3l(?i8Cl_TFlw{`TF+`b}gqCFH6muDx>Khv9 z8yOfGD(EN}np+tgSs55}`6p$iCYLBU<|XD-R;3mx=qf1XgN5Rg(v=i63=B<;T@4Hj zbPWtmP28N!4K(k4SyRBkpuphi;uum9_x5i6nx~bu*FSppWF{vCZTuIQ$$Wa6Zl~;l zpzH5^eY78j@7@+I*yMHk9LK#COYB29d^d`0OxxzNJ2+|0u`QEKCZ6aEn*2;ickNM@ zKZ3iMf3;71$RFjr?Q6f-G`-WCmd3yT{%6PYYP;v(=T@h^tKBbm{@KNwme22eemu|k z$)0nT#m_H2Jw4sJq4eGE_xp+;y6RU6F1+)9PP*LuJDPIYA=m8QCvW!tD_rV1NyT$g ziJ{RmRS;`eg5+nAfJ*F!o=T9wB)y1ZdsILyah>Eikkk_HYcu*r>j`Tl-i{R?OLS9MR7 z_g|`gI&*!={_oZE-`oA%`2XhL>+yfz-@P0^Oa2E~!^<4$-kl`_6a$|GcfgviJYr4LsJS?BPKc&>Yy}10;!LQMWm3JTZX1{yK@p4}5d%iH)ayMC7x%lOW z7k_&YyyaQhosWI%PapjH?%K!yvGx{k%2;pto7ZHd0W?Aect-?!#} zH0#w*{`lc#?p*u-&x)qST>p3e{-LkaR6K)T{(9a#`_?m)@?CXn{$E`G^VZVly1RwT zbC>tu{4T$~{?*FmyYBzJd;e|Sv%B`UYoD9%UG@8c{-4|L_WwCuf4%n4^!ly8ZydM3 zR{QDM@?G2aKRv#yJ^t^rcc=aBFV8!gv{?Pa;f-c;&YRUgESD{wed|%p?}b%1Ed2at zbMjVi+p)*`TA6eCwSDV;n?2usHgnq6qq#D7_a9EQvc3DkNd57j4+RB(cGP9)?K@X| zMb?*JdhdmeZ*1Dv?z$7pAAfDt<#$!HmwkO+xKi@-X}$fHHSc~K#M{41*JoI>Yu#x* z=SeD_p|{gk@B3bA|M6UTseau(@7>z@Kcw%n z-}~QvcYoE#=w1AEmuK(x|93&Z-?ROA^M2m>MVU5QV#f}L zDZePYU9<1U*qd5_SQ0{+i?Vg?wR|)@M^KoYio|@{m8qM!Xfi@ z`P}~;?+$rL%#Hti@$N^#v+nbMua~YlQ~okQBBp(3dBJbB>D9F#lMgOV{@wpff6n(W zyYwm<7t3oOe_ns3j-~S3%_pkcvuo$Brknondw=Lcti*)3ALj12^=AKir&33L3p9=X++uxa*}va+>fat(E-99O`Orh| z>DJaYRg&53Umu!p?>R{&bX~pPu9dld#pbj7e$?{*+&A~wpDlG)_J7+Qe|_&S{e8=R zzx@8M`h5Pq=_Wu&T>;Jp)yZB^pxy}oDX-+Z?1-1gJmny=R_SMi*5&9r9S zwsVzPvtMsMoB1xSJm*aQZ^Pe-{eK?Mf2Vi<`=ob&|Nr`Xx4pk_*Ze;Vx0l<0?b=>q z|3BFN_TQ`TtAf9q|Nqlp691##e_OoS{frs9)syx;nfr6+^Ph(=8c0aKZQf*m@zm)E zoBN4xcS!JV*;#1#=hn0Diwo`d%AL+TUNA?-*N)FFJMYf=U9oRd`J#Wm`!Q=;&HQO~ z^RLTpf3-``@_k|V^W8TdW%}t=KRmkN=;d{Jbqd?Qf6qHyUNcuLZjFR3-?Y2`H;2W( zTi33?`+WGkva$nV+cV$Qh#mX$C^yQY<{j&dgNe}UzfojUw9Yd{_Mw@ z+jshE|I_K&_g*{i@}Y;__2+)SHv0ZIsyg<1yuarpm8)5^7w$Wo`OfY1vEQ2xpIa2% z|8w8{KX3BO-v49&zhU?Pd(H1YUEjOrciVHD?Z1ybuS@=38vl9DyIA`_^WME&zVA-m z$)v^Q`tAN#jz3QP*ZJqcckTAN-=&xRJ_^47XQf;7r~YVztm%)xAF`j{o0zjN&BW#Q z{3-i$wyfC|`?hq)-DA^>H!T<2cfS0Gokiy5)bs0#?HRWJpHcfc@BN{l+n#TJvu~!! zp85U9-~UOjJo?u@_v+JkRX;YF%_}>7`-)uM?e}N&E0@>aEuFjD2b8h$AzmqY?e=@u zW53(Ey+8M@ulu_C?*D&R{=fWpx!vy4-(&wP_Wb^`Jim1P-_z^g{yQT7^Vhrdx<9pd zjidj6F4ng zhvdIHo0#M8G$V-`*yy5KHL527r)Mp`L^ox-LD@~*V?|FwmtL4 zwdA^r=-ZdKOt-eJI9i%}Z|igw&!D$y=asKp=YPGPc{k#HzxCG!>vSTv$)Tl%<~W1{-k@-Y}cn^YeWDzt81&#rJ(^&G5JTsd8}NkE8l-zyIF< z|2M+alpu`XuU{@rE8gSk~*Sr2ZF)~$GuJ_$GdAq~+a-a34EsxE7t@AE#dEBQ176C~pdt09?FWr{>@8e^| z+W%AEo%(w``PWC)bx&ECvd|L1qM`LsFjT&ib3tG|!iD3IZ1zSi$f zTcd4vH0iZ{#EfiFY?@-ef)X#%H2ja$A71| z^!LxMd;7!WaO0jgKQ>>9537&P(~~o=x?cC=Dxbhef}+dy!oA5`PV1O-zNXB zd-Cc{^|upeZ~l<3RjIG~q1?QF_f1=)9cRPyb^6@SEys}nQBuO@-^*V|b7Q{`bfJ8TOZV#E%^&@?T+iiCt}D9n<8GDw=KUVT6b0wf&U}Br=KNpTpK<>Ke?MmY z8}a{s_OU+?vY-Et+?n>{+i~CepnnM~_}jmH>ff~exPIN+m3McT?U?iN_}ldBi8s}m zZoMu$Ww`%c^0(%~8}jdDe|0ZLE^CmY8c{6GdH>4iSj~UtH`D%p`E}F%?e(6YCtt|# zoosJ@?e;_Kf4e^w*R$8X-2c(;$F8Nv=P&)3VZXEIVQIE~mc3Gp`y|h5dnXwIq_J5b(7yB<) zWBPVSbnd_VlfD=Jk|HLy^bX88f04+NMDp`<4{)IZDzWevWvOT8E5F^L>xrzrOC64FdzihMTtE?dj9wA8SD%v63^t{w42|cZQZ|i&9};W z>CX%dmOVdpZ$B3>Q%e<`7jfI*D$SnW3z43t>=Gp&oDDQF?hB;XTJY|sdJBq zh5g>MzqgX1LFU+>X>UJs?%4GC#;L6N-?tm`Gfa5=uJ>p3_1(?h(|36v=UaFGR?QE+ zug?n$_F6v;*Uv>apj!6x_I2_-Za+^vy!c_pyI%*F=Dl06wf+5#xpJS~+mCPmxM23a zZx`;rySn8!??v*w-s*p#fBo@;AHU9vYri=|{{FjfyZZa=W#Ydde*M^A zX%5d8)$N{JqkrF+b;Uldt-t-^33;0h{(bM`Pgw1-tG<)_}T(FJN@Ru;=>2K8Ok5d{n`B5{Wx=0S+rQZ z!;HNFhP&4O{W^Q!1H+&9*6j7wx_#^TwIyX|`v1k8*&AW@)7a=|w$^6x$!h(I{cDRa z!|mJi@6}anlV{J59qB565H4d^w|%c=&5yjlN8Y@7e{9Bn(_f`~PNpZ<{hQ3R+0fqh z@0aTrXT+D!4%xP~f30VCa-G46_WEtJj{iHEd@=d;oh@ho*52v?MIOKGormSmj_b<5 zUCsY~c1=pHRmd{uipcWpGyeBfF@ix?dGLOaB%; zT^`hyT=(#GY51*Y|Lk%>DXwpC?U_20fb*~3pP7H9Ca2=&@%Qd)e`Ng2-SUm|M}kJL z+x3G9XZ-iGFMho{@yzD50$^!!-Iqrf6U!?sDjsI#o%vqRx9#WWMbV zr}q2Z?FC2Fq>tBJ&%bihz3O@UiB%W(z4=f#LC1dn&;9B4|4R>_w(IT}USG>(_kG>- zAHVwai$5@b=wrY3_2ltI;e9{Iq&d{`C&zgC$)U%x^MRFs_ill<+l`l{`6 zwFzH-Pdxl^&yK6MzYaY4aPUJ!>95_TKmOgSEm*s&PyA`Y+;#tc|2(jG`?I?J|8DR4 zo$Os|1aj}3pZo``UtU{$msx#rlFhy2$|*nYH;2vrmnXZ=`){SqhYa(%G4AdBC5!)F zm9P8p;!SJ!moZVueI;{(K=;Md3gEPdE5akeOzcR#rpSzwT%pKZ`~W;`!}P(0pYh+`txbN`8;d?ean~nRJ(fJ zV^_GS-1(;o-g@ALm{zkTuLwHETZ@%8uLXoKTxX8+HZ z!dL5fc-W7g%y@D9&q?=<&yOG8bou_;!{u354@8#!cyjmh;lpq5?Tjmx)j##ns`l;o z4gdeX_`Umea`w@e)93zw@qO{fx+}I-Z(e-(aelR7y&^OMX4q#we7w84(K@y|)}Br6 zasJ(x?~gs)eP#afFRWb`yG2i*t1c{%?bXXSs|(-u$|`Qk;nH8fj$b~>obsXK=GTo| zUw!%eQ-AmQUzg?kf4Kj?FJpU4RxYnf(DAle?ZIMsNpLc$Im17Hh2Q;^Z@0ex=gS}e zb@GMqx&Qp+_Idy97Fzt-Le8o`@8`KcKc@BDi|u_`6b^~j`zMpLf7ssrx^e5LFRR~e z{+G?(|F~B_;H6CpDCbH*nl~~VPp&f5_l%1Dzv$#Xn2+v17ruJyY+b?4JvYybPgqh4 zbAayw8Av>WPsx`Hi`_&g~@ zg?J%QR{OWRx6*Uh3$QzSDm}F(ffCN)8Pk_2ks$QPnly{?x)@Q$9^0cb7m`Je?NJdu z2`VoV&v*w-1m_x>2pLL!=C}Lt;E>>KiO-WtAhA}F9yh5A9I*z^R9AX{$|FAc&9DI4 zV~iR2{WoEbyf+i3j<~R07q>U-jCW8g*oUNQcC$bG?;v~p=7J+?h>&|+{w)4mEVp}3 z(i!hdKTmnc*|lmo=%NRQ!SYg9_BQ z$*=(UU|0=HA=Hd<5|b_7)H6cO+Vd~;*dCRs;5zl=g+@btPgQV<5VN=H>Wt}2xWJh? z?&bS4-a)OCU8(?uX|JY`F)Xo)8&oR0vkI zjD`f>kZ|;0dYFNM>pN&I07kJq8g_WYZZy0gwfAT;p=mOy_Ru1xkUA8|1j84uVZt3@Ao*fXR0fmKxJOvdy603h|;ijeHFs5Hh)&-8^aaKTU1Ph z2g9C2{+p*Sfwsjjmq1(S#PxiRAHM&&C^>GD7P!;;0Uj23`_Ak4BXtxIsp0q=XjRd- z8qqnBt9aoH_Yz)H5xtD%@ILWB;-UoM1`-D&=&vy^`wVlzKIm-7a=Fh83=9YECW2>9 zSc{FG&8&RL9j!m-^V$10-yVtY-% Find Dlists" and press OK (the defaults are usually fine). This will only find display lists, so to find everything else in the obect, do "Analysis -> Analyze Dlists". We're looking for the skeleton, so scroll down to the SkeletonHeader, right-click it, and select "Open in Skeleton Viewer": +In the resulting window, you'll see displaylists, textures, and other assets. We're looking for the skeleton, so scroll down to the SkeletonHeader, then either double-click on it or right-click it and select "Open in Skeleton Viewer": ![Finding object_dns's SkeletonHeader in Z64Utils](images/z64utils_dns_skeletonheader.png) @@ -186,7 +186,7 @@ For some actors, there may be a few other things left to name that are directly gSPDisplayList(POLY_OPA_DISP++, &D_06002C48); ``` -In Z64Utils, scroll to find this display list, then right-click and select "Open in Dlist Viewer": +In Z64Utils, scroll to find this display list, then either double-click it or right-click it and select "Open in Dlist Viewer": ![Opening dlist_00002C48 in Z64Utils](images/z64utils_dns_display_list.png) From f39d412bfe940afef4e152ad863ecc79cb2b2bd3 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sat, 1 Apr 2023 21:10:00 -0300 Subject: [PATCH 13/29] Actors revert cleanup (#1221) * Revert "ovl_Bg_Keikoku_Spr OK (#111)" This reverts commit fed1b37da1dcab04124f27d32bec98275f7fe3f2. * Revert "z_bg_tobira01 OK (#168)" This reverts commit 54aef44a9e8b70591d1b626f21fa4d309cf7a595. * Revert "Bg_Lotus OK (#86)" This reverts commit d0af9587bae947909890c63a9f72f5bc5c107253. * Revert "Door_Spiral OK (from zel) (#87)" This reverts commit 6e4d156ad788f4add678481d38f6cfa5f35e33e2. * Revert "en_invadepoh OK (#200)" This reverts commit e1219e7351e0522327696006fd6577045f343ad5. * Revert "ovl_Item_B_Heart OK (#110)" This reverts commit f0cd2db05579c0237b2fa7836ac696de824844e1. * Revert "ovl_Obj_Boyo OK (#112)" This reverts commit 536a484f73f4a8a54611d8f4d692faa4bf572d3e. * more reverts and fix building * restore timeconv.py * restore func_800BFD84 --- spec | 22 +- .../ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c | 45 +- src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c | 158 +- src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h | 10 +- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.c | 86 +- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.h | 11 +- .../actors/ovl_Door_Spiral/z_door_spiral.c | 304 +- .../actors/ovl_Door_Spiral/z_door_spiral.h | 15 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 4963 ++--------------- .../actors/ovl_En_Invadepoh/z_en_invadepoh.h | 144 +- .../actors/ovl_En_Po_Fusen/z_en_po_fusen.c | 1 + .../actors/ovl_Item_B_Heart/z_item_b_heart.c | 98 +- .../actors/ovl_Item_B_Heart/z_item_b_heart.h | 3 +- src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c | 168 +- src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h | 20 +- tools/disasm/functions.txt | 22 +- tools/disasm/variables.txt | 29 +- undefined_syms.txt | 90 + 18 files changed, 648 insertions(+), 5541 deletions(-) diff --git a/spec b/spec index 325fffa4a..a10cb67ce 100644 --- a/spec +++ b/spec @@ -999,7 +999,8 @@ beginseg name "ovl_Item_B_Heart" compress include "build/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.o" - include "build/src/overlays/actors/ovl_Item_B_Heart/ovl_Item_B_Heart_reloc.o" + include "build/data/ovl_Item_B_Heart/ovl_Item_B_Heart.data.o" + include "build/data/ovl_Item_B_Heart/ovl_Item_B_Heart.reloc.o" endseg beginseg @@ -1034,7 +1035,8 @@ beginseg name "ovl_Bg_Keikoku_Spr" compress include "build/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.o" - include "build/src/overlays/actors/ovl_Bg_Keikoku_Spr/ovl_Bg_Keikoku_Spr_reloc.o" + include "build/data/ovl_Bg_Keikoku_Spr/ovl_Bg_Keikoku_Spr.data.o" + include "build/data/ovl_Bg_Keikoku_Spr/ovl_Bg_Keikoku_Spr.reloc.o" endseg beginseg @@ -2113,7 +2115,8 @@ beginseg name "ovl_Door_Spiral" compress include "build/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.o" - include "build/src/overlays/actors/ovl_Door_Spiral/ovl_Door_Spiral_reloc.o" + include "build/data/ovl_Door_Spiral/ovl_Door_Spiral.data.o" + include "build/data/ovl_Door_Spiral/ovl_Door_Spiral.reloc.o" endseg beginseg @@ -2141,7 +2144,8 @@ beginseg name "ovl_Obj_Boyo" compress include "build/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.o" - include "build/src/overlays/actors/ovl_Obj_Boyo/ovl_Obj_Boyo_reloc.o" + include "build/data/ovl_Obj_Boyo/ovl_Obj_Boyo.data.o" + include "build/data/ovl_Obj_Boyo/ovl_Obj_Boyo.reloc.o" endseg beginseg @@ -3334,7 +3338,8 @@ beginseg name "ovl_Bg_Lotus" compress include "build/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.o" - include "build/src/overlays/actors/ovl_Bg_Lotus/ovl_Bg_Lotus_reloc.o" + include "build/data/ovl_Bg_Lotus/ovl_Bg_Lotus.data.o" + include "build/data/ovl_Bg_Lotus/ovl_Bg_Lotus.reloc.o" endseg beginseg @@ -3593,7 +3598,8 @@ beginseg name "ovl_Bg_Tobira01" compress include "build/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.o" - include "build/src/overlays/actors/ovl_Bg_Tobira01/ovl_Bg_Tobira01_reloc.o" + include "build/data/ovl_Bg_Tobira01/ovl_Bg_Tobira01.data.o" + include "build/data/ovl_Bg_Tobira01/ovl_Bg_Tobira01.reloc.o" endseg beginseg @@ -3811,7 +3817,9 @@ beginseg name "ovl_En_Invadepoh" compress include "build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o" - include "build/src/overlays/actors/ovl_En_Invadepoh/ovl_En_Invadepoh_reloc.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.data.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.bss.o" + include "build/data/ovl_En_Invadepoh/ovl_En_Invadepoh.reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c b/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c index 8afd5d730..8246a0298 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c +++ b/src/overlays/actors/ovl_Bg_Keikoku_Spr/z_bg_keikoku_spr.c @@ -1,9 +1,3 @@ -/* - * File: z_bg_keikoku_spr.c - * Overlay: ovl_Bg_Keikoku_Spr - * Description: Termina Field Fountain Water - */ - #include "z_bg_keikoku_spr.h" #include "objects/object_keikoku_obj/object_keikoku_obj.h" @@ -16,7 +10,8 @@ void BgKeikokuSpr_Destroy(Actor* thisx, PlayState* play); void BgKeikokuSpr_Update(Actor* thisx, PlayState* play); void BgKeikokuSpr_Draw(Actor* thisx, PlayState* play); -ActorInit Bg_Keikoku_Spr_InitVars = { +/* +const ActorInit Bg_Keikoku_Spr_InitVars = { ACTOR_BG_KEIKOKU_SPR, ACTORCAT_PROP, FLAGS, @@ -25,38 +20,14 @@ ActorInit Bg_Keikoku_Spr_InitVars = { (ActorFunc)BgKeikokuSpr_Init, (ActorFunc)BgKeikokuSpr_Destroy, (ActorFunc)BgKeikokuSpr_Update, - (ActorFunc)BgKeikokuSpr_Draw, + (ActorFunc)BgKeikokuSpr_Draw }; +*/ -static InitChainEntry sInitChain[] = { - ICHAIN_F32(uncullZoneForward, 3000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Init.s") -void BgKeikokuSpr_Init(Actor* thisx, PlayState* play) { - Actor_ProcessInitChain(thisx, sInitChain); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Destroy.s") -void BgKeikokuSpr_Destroy(Actor* thisx, PlayState* play) { -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Update.s") -void BgKeikokuSpr_Update(Actor* thisx, PlayState* play) { -} - -void BgKeikokuSpr_Draw(Actor* thisx, PlayState* play) { - s32 pad; - - OPEN_DISPS(play->state.gfxCtx); - - AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0001F8)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000100); - AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0003F8)); - gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000300); - AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_keikoku_obj_Matanimheader_0005F8)); - gSPDisplayList(POLY_XLU_DISP++, object_keikoku_obj_DL_000500); - - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Keikoku_Spr/BgKeikokuSpr_Draw.s") diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c index 20be54a2f..765b58dbd 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c @@ -1,9 +1,3 @@ -/* - * File: z_bg_lotus.c - * Overlay: ovl_Bg_Lotus - * Description: Southern Swamp Lilypads - */ - #include "z_bg_lotus.h" #include "objects/object_lotus/object_lotus.h" @@ -16,11 +10,8 @@ void BgLotus_Destroy(Actor* thisx, PlayState* play); void BgLotus_Update(Actor* thisx, PlayState* play); void BgLotus_Draw(Actor* thisx, PlayState* play); -void BgLotus_Wait(BgLotus* this, PlayState* play); -void BgLotus_Sink(BgLotus* this, PlayState* play); -void BgLotus_WaitToAppear(BgLotus* this, PlayState* play); - -ActorInit Bg_Lotus_InitVars = { +/* +const ActorInit Bg_Lotus_InitVars = { ACTOR_BG_LOTUS, ACTORCAT_BG, FLAGS, @@ -29,147 +20,22 @@ ActorInit Bg_Lotus_InitVars = { (ActorFunc)BgLotus_Init, (ActorFunc)BgLotus_Destroy, (ActorFunc)BgLotus_Update, - (ActorFunc)BgLotus_Draw, + (ActorFunc)BgLotus_Draw }; +*/ -static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Init.s") -void BgLotus_Init(Actor* thisx, PlayState* play) { - BgLotus* this = THIS; - s32 pad; - s32 bgId; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Destroy.s") - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(play, &this->dyna, &gLilyPadCol); - this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &thisx->floorPoly, &bgId, - &this->dyna.actor, &this->dyna.actor.world.pos); - this->timer2 = 96; - this->dyna.actor.world.rot.y = (s32)Rand_Next() >> 0x10; - this->actionFunc = BgLotus_Wait; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6830.s") -void BgLotus_Destroy(Actor* thisx, PlayState* play) { - BgLotus* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD68DC.s") - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6A88.s") -void BgLotus_SetScaleXZ(BgLotus* this) { - f32 scale; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6B68.s") - if (this->dyna.actor.params == 0) { - scale = sin_rad(this->timer * 0.7853982f) * ((0.014f * ((f32)this->timer / 8)) + 0.01f); - this->dyna.actor.scale.x = (1.0f + scale) * 0.1f; - this->dyna.actor.scale.z = (1.0f - scale) * 0.1f; - } -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Update.s") -void BgLotus_Wait(BgLotus* this, PlayState* play) { - f32 moveDist; // distance for the xz position of the lilypad to move - - this->timer2--; - - moveDist = sin_rad(this->timer2 * 0.06544985f) * 6.0f; - - if (this->dyna.actor.params == 0) { - this->dyna.actor.world.pos.x = - (Math_SinS(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.x; - this->dyna.actor.world.pos.z = - (Math_CosS(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.z; - - if (this->timer2 == 0) { - this->timer2 = 96; - this->dyna.actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x12); - } - } - - if (this->height < this->dyna.actor.floorHeight) { - this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - } else { - this->dyna.actor.world.pos.y = this->height; - - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { - if (this->hasSpawnedRipples == 0) { - EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 1000, 1400, 0); - EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 1000, 1400, 8); - this->timer = 40; - } - if (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) { - this->timer = 40; - this->dyna.actor.flags |= ACTOR_FLAG_10; - this->actionFunc = BgLotus_Sink; - return; - } - - this->hasSpawnedRipples = 1; - } else { - this->hasSpawnedRipples = 0; - } - } - - if (this->timer > 0) { - this->timer--; - } - - BgLotus_SetScaleXZ(this); -} - -void BgLotus_Sink(BgLotus* this, PlayState* play) { - if (this->height < this->dyna.actor.world.pos.y) { - this->dyna.actor.world.pos.y = this->height; - } - - this->dyna.actor.world.pos.y -= 1.0f; - - if (this->dyna.actor.world.pos.y <= this->dyna.actor.floorHeight) { - this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; - this->timer = 0; - } - - if (this->timer > 0) { - this->timer--; - BgLotus_SetScaleXZ(this); - } else { - if (Math_StepToF(&this->dyna.actor.scale.x, 0, 0.0050000003539f)) { - this->dyna.actor.draw = NULL; - this->timer = 100; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); - this->actionFunc = BgLotus_WaitToAppear; - } - - this->dyna.actor.scale.z = this->dyna.actor.scale.x; - } -} - -void BgLotus_WaitToAppear(BgLotus* this, PlayState* play) { - if (this->timer > 0) { - this->timer--; - } else if ((this->dyna.actor.xzDistToPlayer > 100.0f) && (this->dyna.actor.projectedPos.z < 0.0f)) { - this->dyna.actor.draw = BgLotus_Draw; - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); - Actor_SetScale(&this->dyna.actor, 0.1f); - this->dyna.actor.world.pos.y = CLAMP_MIN(this->height, this->dyna.actor.floorHeight); - this->dyna.actor.flags &= ~ACTOR_FLAG_10; - this->timer2 = 96; - this->actionFunc = BgLotus_Wait; - this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; - this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; - } -} - -void BgLotus_Update(Actor* thisx, PlayState* play) { - BgLotus* this = THIS; - s32 pad; - WaterBox* waterBox; - - WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, - &this->height, &waterBox); - this->actionFunc(this, play); -} - -void BgLotus_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, gLilyPadDL); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Draw.s") diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h index 540c21b0e..61d340a49 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.h @@ -5,15 +5,9 @@ struct BgLotus; -typedef void (*BgLotusActionFunc)(struct BgLotus*, PlayState*); - typedef struct BgLotus { - /* 0x000 */ DynaPolyActor dyna; - /* 0x15C */ BgLotusActionFunc actionFunc; - /* 0x160 */ f32 height; - /* 0x164 */ u8 hasSpawnedRipples; - /* 0x166 */ s16 timer; - /* 0x168 */ s16 timer2; + /* 0x000 */ Actor actor; + /* 0x144 */ char unk_144[0x28]; } BgLotus; // size = 0x16C #endif // Z_BG_LOTUS_H diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index a1c4f1d27..17722bda2 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -16,7 +16,8 @@ void BgTobira01_Destroy(Actor* thisx, PlayState* play); void BgTobira01_Update(Actor* thisx, PlayState* play); void BgTobira01_Draw(Actor* thisx, PlayState* play); -ActorInit Bg_Tobira01_InitVars = { +/* +const ActorInit Bg_Tobira01_InitVars = { ACTOR_BG_TOBIRA01, ACTORCAT_PROP, FLAGS, @@ -27,85 +28,14 @@ ActorInit Bg_Tobira01_InitVars = { (ActorFunc)BgTobira01_Update, (ActorFunc)BgTobira01_Draw, }; +*/ -void BgTobira01_Open(BgTobira01* this, PlayState* play) { - Player* player = GET_PLAYER(play); - s16 cutsceneId = this->dyna.actor.cutscene; - s16 prevTimer; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/func_80B12430.s") - if (this->playCutscene) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - } else if (ActorCutscene_GetCanPlayNext(cutsceneId)) { - ActorCutscene_StartAndSetUnkLinkFields(cutsceneId, &this->dyna.actor); - SET_WEEKEVENTREG(WEEKEVENTREG_88_40); - this->playCutscene = false; - } else { - ActorCutscene_SetIntentToPlay(cutsceneId); - } - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) && (this->timer == 0) && (play->actorCtx.unk_1F4.timer != 0) && - (play->actorCtx.unk_1F4.unk_00 == 0) && - (SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 6)) { - this->playCutscene = true; - this->unk_16C = 0; // this variable is not used anywhere else - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Init.s") - prevTimer = this->timer; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Destroy.s") - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40)) { - this->timer++; - } else { - this->timer--; - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Update.s") - this->timer = CLAMP(this->timer, 0, 60); - - if (this->timer != prevTimer) { - if (1) {} - Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG); - this->dyna.actor.world.pos.y = (this->yOffset = (this->timer * (5.0f / 3.0f)) + this->dyna.actor.home.pos.y); - this->timer2 = 180; - } - - if (!(player->stateFlags1 & PLAYER_STATE1_40) && CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) && - (DECR(this->timer2) == 0)) { - CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40); - } -} - -void BgTobira01_Init(Actor* thisx, PlayState* play) { - BgTobira01* this = THIS; - s32 pad; - - DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(play, &this->dyna, &object_spot11_obj_Colheader_0011C0); - CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40); - Actor_SetScale(&this->dyna.actor, 1.0f); - this->timer2 = gSaveContext.save.isNight; - this->timer = 0; - this->actionFunc = BgTobira01_Open; -} - -void BgTobira01_Destroy(Actor* thisx, PlayState* play) { - BgTobira01* this = THIS; - s32 pad; - - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); -} - -void BgTobira01_Update(Actor* thisx, PlayState* play) { - BgTobira01* this = THIS; - s32 pad; - - this->actionFunc(this, play); -} - -void BgTobira01_Draw(Actor* thisx, PlayState* play) { - OPEN_DISPS(play->state.gfxCtx); - - func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_spot11_obj_DL_000088); - - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Draw.s") diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h index 14a5e1b8e..9ddd0233d 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.h @@ -5,16 +5,9 @@ struct BgTobira01; -typedef void (*BgTobira01ActionFunc)(struct BgTobira01*, struct PlayState*); - typedef struct BgTobira01 { - /* 0x000 */ DynaPolyActor dyna; - /* 0x15C */ BgTobira01ActionFunc actionFunc; - /* 0x160 */ s16 timer; - /* 0x162 */ s16 timer2; - /* 0x164 */ f32 yOffset; - /* 0x168 */ s32 playCutscene; - /* 0x16C */ s32 unk_16C; // unused besides being set to 0 + /* 0x000 */ Actor actor; + /* 0x144 */ char unk_144[0x2C]; } BgTobira01; // size = 0x170 #endif // Z_BG_TOBIRA01_H diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index 541e3de23..6c7d32152 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -16,58 +16,13 @@ #define THIS ((DoorSpiral*)thisx) -typedef enum { - /* 0 */ SPIRAL_OVERWORLD, // does not display anything as there is not a DL in GAMEPLAY_KEEP for it - /* 1 */ SPIRAL_DUNGEON, - /* 2 */ SPIRAL_WOODFALL_TEMPLE, - /* 3 */ SPIRAL_WOODFALL_TEMPLE_ALT, // SPIRAL_WOODFALL_TEMPLE but with positional lights enabled? - /* 4 */ SPIRAL_SNOWHEAD_TEMPLE, - /* 5 */ SPIRAL_STONE_TOWER, - /* 6 */ SPIRAL_IKANA_CASTLE, - /* 7 */ SPIRAL_DAMPES_HOUSE -} SpiralType; - -typedef enum { - /* 0 */ SPIRAL_OBJECT_OVERWORLD, - /* 1 */ SPIRAL_OBJECT_DUNGEON, - /* 2 */ SPIRAL_OBJECT_WOODFALL, - /* 3 */ SPIRAL_OBJECT_SNOWHEAD, - /* 4 */ SPIRAL_OBJECT_STONE_TOWER, - /* 5 */ SPIRAL_OBJECT_DAMPES_HOUSE, - /* 6 */ SPIRAL_OBJECT_IKANA_CASTLE -} SpiralObjectType; - -typedef struct { - /* 0x00 */ Gfx* spiralDL[2]; // one displaylist for downward spiral, and one for upward - /* 0x08 */ s32 unk8; // unused - /* 0x0C */ u8 unkC; // unused - /* 0x0D */ u8 unkD; // unused - /* 0x0E */ u8 spiralWidth; - /* 0x0F */ u8 spiralHeight; -} SpiralInfo; - -// Maps SpiralObjectType to SpiralType -typedef struct { - /* 0x00 */ s16 objectBankId; - /* 0x02 */ u8 spiralType; -} SpiralObjectInfo; - -// Maps scenes to SpiralObjectType -typedef struct { - /* 0x00 */ s16 sceneId; - /* 0x02 */ u8 objectType; -} SpiralSceneInfo; - void DoorSpiral_Init(Actor* thisx, PlayState* play); void DoorSpiral_Destroy(Actor* thisx, PlayState* play); void DoorSpiral_Update(Actor* thisx, PlayState* play); void DoorSpiral_Draw(Actor* thisx, PlayState* play); -void DoorSpiral_WaitForObject(DoorSpiral* this, PlayState* play); -void DoorSpiral_Wait(DoorSpiral* this, PlayState* play); -void DoorSpiral_PlayerClimb(DoorSpiral* this, PlayState* play); - -ActorInit Door_Spiral_InitVars = { +/* +const ActorInit Door_Spiral_InitVars = { ACTOR_DOOR_SPIRAL, ACTORCAT_DOOR, FLAGS, @@ -76,257 +31,30 @@ ActorInit Door_Spiral_InitVars = { (ActorFunc)DoorSpiral_Init, (ActorFunc)DoorSpiral_Destroy, (ActorFunc)DoorSpiral_Update, - (ActorFunc)DoorSpiral_Draw, + (ActorFunc)DoorSpiral_Draw }; +*/ -// Parameters for each staircase, indexed with SpiralType -static SpiralInfo sSpiralInfo[] = { - { { NULL, NULL }, 0, 130, 12, 50, 15 }, // SPIRAL_OVERWORLD - { { gameplay_dangeon_keep_DL_0219E0, gameplay_dangeon_keep_DL_01D980 }, 0, 130, 12, 50, 15 }, // SPIRAL_DUNGEON - { { object_numa_obj_DL_004448, object_numa_obj_DL_0007A8 }, 0, 130, 12, 50, 15 }, // SPIRAL_WOODFALL_TEMPLE - { { object_numa_obj_DL_0051B8, object_numa_obj_DL_0014C8 }, 0, 130, 12, 50, 15 }, // SPIRAL_WOODFALL_TEMPLE_ALT - { { object_hakugin_obj_DL_009278, object_hakugin_obj_DL_006128 }, 0, 130, 12, 50, 15 }, // SPIRAL_SNOWHEAD_TEMPLE - { { object_ikana_obj_DL_013EA8, object_ikana_obj_DL_012B70 }, 0, 130, 12, 50, 15 }, // SPIRAL_STONE_TOWER - { { object_ikninside_obj_DL_000EA0, object_ikninside_obj_DL_000590 }, 0, 130, 12, 50, 15 }, // SPIRAL_IKANA_CASTLE - { { object_danpei_object_DL_002110, object_danpei_object_DL_0012C0 }, 0, 130, 12, 50, 15 }, // SPIRAL_DAMPES_HOUSE -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2B60.s") -// Defines which object bank a staircase should use, and its index to `sSpiralInfo` -static SpiralObjectInfo sSpiralObjectInfo[] = { - { GAMEPLAY_KEEP, SPIRAL_OVERWORLD }, { GAMEPLAY_DANGEON_KEEP, SPIRAL_DUNGEON }, - { OBJECT_NUMA_OBJ, SPIRAL_WOODFALL_TEMPLE }, { OBJECT_HAKUGIN_OBJ, SPIRAL_SNOWHEAD_TEMPLE }, - { OBJECT_IKANA_OBJ, SPIRAL_STONE_TOWER }, { OBJECT_DANPEI_OBJECT, SPIRAL_DAMPES_HOUSE }, - { OBJECT_IKNINSIDE_OBJ, SPIRAL_IKANA_CASTLE }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2B70.s") -/** - * Sets the actor's action function - */ -void DoorSpiral_SetupAction(DoorSpiral* this, DoorSpiralActionFunc actionFunc) { - this->actionFunc = actionFunc; - this->unk14A = 0; // set but never used -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2BF8.s") -/** - * Sets this->spiralType, which is derived from `sSpiralObjectInfo`, and is used as an index to `sSpiralInfo`. - */ -s32 DoorSpiral_SetSpiralType(DoorSpiral* this, PlayState* play) { - SpiralObjectInfo* doorObjectInfo = &sSpiralObjectInfo[this->objectType]; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Init.s") - this->spiralType = doorObjectInfo->spiralType; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Destroy.s") - if ((this->spiralType == SPIRAL_DAMPES_HOUSE) || - ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && play->roomCtx.curRoom.enablePosLights)) { - if (this->spiralType == SPIRAL_WOODFALL_TEMPLE) { - this->spiralType = SPIRAL_WOODFALL_TEMPLE_ALT; - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2DB0.s") - this->actor.flags |= ACTOR_FLAG_10000000; - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2E08.s") - DoorSpiral_SetupAction(this, DoorSpiral_Wait); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2EA0.s") - return 0; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A2FF8.s") -/** - * Gets the object type to be used as an index to `sSpiralObjectInfo`. - * It first checks `sSpiralSceneInfo`, but if the current scene is not found it will fall back to the default spiral - * (overworld or dungeon). - */ -s32 DoorSpiral_GetObjectType(PlayState* play) { - // Defines which object type should be used for specific scenes - static SpiralSceneInfo spiralSceneInfo[] = { - { SCENE_MITURIN, SPIRAL_OBJECT_WOODFALL }, { SCENE_HAKUGIN, SPIRAL_OBJECT_SNOWHEAD }, - { SCENE_INISIE_N, SPIRAL_OBJECT_STONE_TOWER }, { SCENE_INISIE_R, SPIRAL_OBJECT_STONE_TOWER }, - { SCENE_DANPEI2TEST, SPIRAL_OBJECT_DAMPES_HOUSE }, { SCENE_IKNINSIDE, SPIRAL_OBJECT_IKANA_CASTLE }, - { SCENE_CASTLE, SPIRAL_OBJECT_IKANA_CASTLE }, - }; - SpiralSceneInfo* sceneInfo = spiralSceneInfo; - s32 i; - s32 type; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/func_809A3098.s") - for (i = 0; i < ARRAY_COUNT(spiralSceneInfo); sceneInfo++, i++) { - if (play->sceneId == sceneInfo->sceneId) { - break; - } - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Update.s") - type = i; - - if (type < ARRAY_COUNT(spiralSceneInfo)) { - type = sceneInfo->objectType; - } else { - // Set the type based on if link is in a dungeon scene, or the overworld - type = (Object_GetIndex(&play->objectCtx, GAMEPLAY_DANGEON_KEEP) >= 0) ? SPIRAL_OBJECT_DUNGEON - : SPIRAL_OBJECT_OVERWORLD; - } - - return type; -} - -static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP), -}; - -void DoorSpiral_Init(Actor* thisx, PlayState* play) { - DoorSpiral* this = THIS; - s32 pad; - s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx); - s8 objBankId; - - if (this->actor.room != play->doorCtx.transitionActorList[transition].sides[0].room) { - Actor_Kill(&this->actor); - return; - } - - Actor_ProcessInitChain(&this->actor, sInitChain); - this->unk145 = DOORSPIRAL_GET_UNK145(thisx); // set but never used - this->orientation = DOORSPIRAL_GET_ORIENTATION(thisx); - this->objectType = DoorSpiral_GetObjectType(play); - objBankId = Object_GetIndex(&play->objectCtx, sSpiralObjectInfo[this->objectType].objectBankId); - this->bankIndex = objBankId; - - if (objBankId < 0) { - Actor_Kill(&this->actor); - return; - } - - DoorSpiral_SetupAction(this, DoorSpiral_WaitForObject); - Actor_SetFocus(&this->actor, 60.0f); -} - -void DoorSpiral_Destroy(Actor* thisx, PlayState* play) { - s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx); - - play->doorCtx.transitionActorList[transition].id *= -1; -} - -/** - * Waits for the required object to be loaded. - */ -void DoorSpiral_WaitForObject(DoorSpiral* this, PlayState* play) { - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - DoorSpiral_SetSpiralType(this, play); - } -} - -/** - * Finds the distance between the stairs and the player. - */ -f32 DoorSpiral_GetDistFromPlayer(PlayState* play, DoorSpiral* this, f32 yOffset, f32 spiralWidth, f32 spiralHeight) { - Player* player = GET_PLAYER(play); - Vec3f target; - Vec3f offset; - - target.x = player->actor.world.pos.x; - target.y = player->actor.world.pos.y + yOffset; - target.z = player->actor.world.pos.z; - - Actor_OffsetOfPointInActorCoords(&this->actor, &offset, &target); - - if ((spiralWidth < fabsf(offset.x)) || (spiralHeight < fabsf(offset.y))) { - return FLT_MAX; - } - - return offset.z; -} - -/** - * Checks if the player should climb the stairs. - */ -s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, PlayState* play) { - Player* player = GET_PLAYER(play); - - if (!Player_InCsMode(play)) { - SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType]; - f32 dist = DoorSpiral_GetDistFromPlayer(play, this, 0.0f, spiralInfo->spiralWidth, spiralInfo->spiralHeight); - - if (fabsf(dist) < 64.0f) { - s16 angle = player->actor.shape.rot.y - this->actor.shape.rot.y; - - if (dist > 0.0f) { - angle = 0x8000 - angle; - } - - if (ABS_ALT(angle) < 0x3000) { - return (dist >= 0.0f) ? 1.0f : -1.0f; - } - } - } - - return 0; -} - -/** - * Wait for the player to interact with the stairs. - */ -void DoorSpiral_Wait(DoorSpiral* this, PlayState* play) { - Player* player; - s32 transition; - - if (this->shouldClimb) { - DoorSpiral_SetupAction(this, DoorSpiral_PlayerClimb); - } else if (DoorSpiral_PlayerShouldClimb(this, play)) { - player = GET_PLAYER(play); - - player->doorType = PLAYER_DOORTYPE_STAIRCASE; - player->doorDirection = this->orientation; - player->doorActor = &this->actor; - transition = DOORSPIRAL_GET_TRANSITION_ID(&this->actor); - player->doorNext = ((u16)play->doorCtx.transitionActorList[transition].params) >> 10; - - func_80122F28(player); - } -} - -/** - * Player is climbing the stairs. - */ -void DoorSpiral_PlayerClimb(DoorSpiral* this, PlayState* play) { - Player* player = GET_PLAYER(play); - - if (!(player->stateFlags1 & PLAYER_STATE1_20000000)) { - DoorSpiral_SetupAction(this, DoorSpiral_WaitForObject); - this->shouldClimb = 0; - } -} - -void DoorSpiral_Update(Actor* thisx, PlayState* play) { - DoorSpiral* this = THIS; - s32 pad; - Player* player = GET_PLAYER(play); - - if (!(player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_80 | PLAYER_STATE1_400 | PLAYER_STATE1_10000000)) || - (this->actionFunc == DoorSpiral_WaitForObject)) { - this->actionFunc(this, play); - } -} - -void DoorSpiral_Draw(Actor* thisx, PlayState* play) { - s32 pad; - DoorSpiral* this = THIS; - - if (this->actor.objBankIndex == this->bankIndex) { - SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType]; - Gfx* dList; - - // Set the model to render based on the orientation of the stairs (upward or downward) - dList = spiralInfo->spiralDL[this->orientation]; - - if (dList != NULL) { - OPEN_DISPS(play->state.gfxCtx); - - func_8012C28C(play->state.gfxCtx); - - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, spiralInfo->spiralDL[this->orientation]); - - CLOSE_DISPS(play->state.gfxCtx); - } - } -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Door_Spiral/DoorSpiral_Draw.s") diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h index 0f3e32a39..701b38639 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.h @@ -5,22 +5,9 @@ struct DoorSpiral; -#define DOORSPIRAL_GET_ORIENTATION(thisx) (((thisx)->params >> 7) & 0x1) -#define DOORSPIRAL_GET_UNK145(thisx) (((thisx)->params >> 8) & 0x3) -#define DOORSPIRAL_GET_TRANSITION_ID(thisx) ((u16)(thisx)->params >> 10) - -typedef void (*DoorSpiralActionFunc)(struct DoorSpiral*, PlayState*); - typedef struct DoorSpiral { /* 0x000 */ Actor actor; - /* 0x144 */ u8 shouldClimb; // Flag used to determine if the player should climb the stairs - /* 0x145 */ u8 unk145; - /* 0x146 */ u8 orientation; // Upward or downward staircase - /* 0x147 */ u8 objectType; // Index to list of objects - /* 0x148 */ u8 spiralType; // Type of skin the staircase should use - /* 0x149 */ s8 bankIndex; // Object bank to use - /* 0x14A */ s8 unk14A; - /* 0x14C */ DoorSpiralActionFunc actionFunc; + /* 0x144 */ char unk_144[0xC]; } DoorSpiral; // size = 0x150 #endif // Z_DOOR_SPIRAL_H diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index f208ece37..e29a91b4b 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1,17 +1,4 @@ -/* - * File: z_en_invadepoh.c - * Overlay: ovl_En_Invadepoh - * Description: Ranch nighttime actors - */ -#include "prevent_bss_reordering.h" #include "z_en_invadepoh.h" -#include "overlays/actors/ovl_En_Door/z_en_door.h" -#include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_ma1/object_ma1.h" -#include "objects/object_ma2/object_ma2.h" -#include "objects/object_dog/object_dog.h" -#include "objects/object_cow/object_cow.h" -#include "objects/object_uch/object_uch.h" #define FLAGS (ACTOR_FLAG_10) @@ -21,164 +8,8 @@ void EnInvadepoh_Init(Actor* thisx, PlayState* play); void EnInvadepoh_Destroy(Actor* thisx, PlayState* play); void EnInvadepoh_Update(Actor* thisx, PlayState* play); -void func_80B46DA8(EnInvadepoh* this); -void func_80B46DC8(EnInvadepoh* this, PlayState* play); -void func_80B46E20(EnInvadepoh* this); -void func_80B46E44(EnInvadepoh* this, PlayState* play); -void func_80B46EC0(EnInvadepoh* this); -void func_80B46EE8(EnInvadepoh* this, PlayState* play); -void func_80B46F88(EnInvadepoh* this); -void func_80B46FA8(EnInvadepoh* this, PlayState* play); -void func_80B47064(EnInvadepoh* this); -void func_80B47084(EnInvadepoh* this, PlayState* play); -void func_80B470E0(EnInvadepoh* this); -void func_80B47108(EnInvadepoh* this, PlayState* play); -void func_80B471C0(EnInvadepoh* this); -void func_80B471E0(EnInvadepoh* this, PlayState* play); -void func_80B47248(EnInvadepoh* this); -void func_80B47268(EnInvadepoh* this, PlayState* play); -void func_80B47298(EnInvadepoh* this, PlayState* play); -void func_80B47304(EnInvadepoh* this); -void func_80B47324(EnInvadepoh* this, PlayState* play); -void func_80B473E4(EnInvadepoh* this, PlayState* play); -void func_80B474DC(EnInvadepoh* this, PlayState* play); -void func_80B47600(EnInvadepoh* this, PlayState* play); -void func_80B477B4(EnInvadepoh* this, PlayState* play); -void func_80B48324(EnInvadepoh* this, PlayState* play); -void func_80B4ACF0(EnInvadepoh* this, PlayState* play); -void func_80B4AD3C(EnInvadepoh* this); -void func_80B4AD60(EnInvadepoh* this, PlayState* play); -void func_80B4ADB8(EnInvadepoh* this); -void func_80B4ADCC(EnInvadepoh* this, PlayState* play); -void func_80B4AEC0(EnInvadepoh* this); -void func_80B4AEDC(EnInvadepoh* this, PlayState* play); -void func_80B4AF80(EnInvadepoh* this); -void func_80B4AF94(EnInvadepoh* this, PlayState* play); -void func_80B4B024(EnInvadepoh* this); -void func_80B4B048(EnInvadepoh* this, PlayState* play); -void func_80B4B484(EnInvadepoh* this, PlayState* play); -void func_80B4B510(EnInvadepoh* this); -void func_80B4B564(EnInvadepoh* this, PlayState* play); -void func_80B4B724(EnInvadepoh* this); -void func_80B4B768(EnInvadepoh* this, PlayState* play); -void func_80B4B820(EnInvadepoh* this); -void func_80B4B864(EnInvadepoh* this, PlayState* play); -void func_80B48374(EnInvadepoh* this); -void func_80B483CC(EnInvadepoh* this, PlayState* play); -void func_80B49A00(EnInvadepoh* this, PlayState* play); -void func_80B4994C(EnInvadepoh* this, PlayState* play); -void func_80B497EC(EnInvadepoh* this, PlayState* play); -void func_80B49628(EnInvadepoh* this); -void func_80B49670(EnInvadepoh* this, PlayState* play); -void func_80B49454(EnInvadepoh* this, PlayState* play); -void func_80B4934C(EnInvadepoh* this, PlayState* play); -void func_80B491EC(EnInvadepoh* this); -void func_80B49228(EnInvadepoh* this, PlayState* play); -void func_80B49C38(EnInvadepoh* this, PlayState* play); -void func_80B49DFC(EnInvadepoh* this, PlayState* play); -void func_80B4A350(EnInvadepoh* this, PlayState* play); -void func_80B4A5E4(EnInvadepoh* this, PlayState* play); -void func_80B4A67C(EnInvadepoh* this, PlayState* play); -void func_80B4A81C(EnInvadepoh* this, PlayState* play); -void func_80B4BC4C(EnInvadepoh* this, PlayState* play); -void func_80B4C058(EnInvadepoh* this, PlayState* play); -void func_80B4C218(EnInvadepoh* this, PlayState* play); -void func_80B4C730(EnInvadepoh* this, PlayState* play); -void func_80B4CB0C(EnInvadepoh* this, PlayState* play); -void func_80B4CCCC(EnInvadepoh* this, PlayState* play); -void func_80B4D480(EnInvadepoh* this, PlayState* play); -void func_80B47568(EnInvadepoh* this); -void func_80B478F4(EnInvadepoh* this, PlayState* play); -void func_80B47938(EnInvadepoh* this); -void func_80B479E8(EnInvadepoh* this, PlayState* play); -void func_80B4843C(EnInvadepoh* this); -void func_80B484EC(EnInvadepoh* this, PlayState* play); -void func_80B48588(EnInvadepoh* this); -void func_80B48610(EnInvadepoh* this, PlayState* play); -void func_80B48848(EnInvadepoh* this, PlayState* play); -void func_80B47278(EnInvadepoh* this); -void func_80B48AD4(EnInvadepoh* this, PlayState* play); -void func_80B48E4C(EnInvadepoh* this, PlayState* play); -void func_80B49404(EnInvadepoh* this); -void func_80B4A570(EnInvadepoh* this); -void func_80B4C1BC(EnInvadepoh* this); -void func_80B4D290(EnInvadepoh* this, PlayState* play); -void func_80B4CC70(EnInvadepoh* this); -void func_80B4770C(EnInvadepoh* this); -void func_80B48948(EnInvadepoh* this); -void func_80B49904(EnInvadepoh* this); -void func_80B499BC(EnInvadepoh* this); -void func_80B492FC(EnInvadepoh* this); -void func_80B4627C(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play); -void func_80B468B4(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitDog(EnInvadepoh* this, PlayState* play); -void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play); -void func_80B46BB0(EnInvadepoh* this, PlayState* play); -void func_80B46BC0(EnInvadepoh* this, PlayState* play); -void func_80B46C08(EnInvadepoh* this, PlayState* play); -void func_80B46C34(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C7C(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C50(EnInvadepoh* this, PlayState* play); -void func_80B46C94(EnInvadepoh* this, PlayState* play); -void func_80B46CC0(EnInvadepoh* this, PlayState* play); -void func_80B46CF4(EnInvadepoh* this, PlayState* play); -void func_80B46D28(EnInvadepoh* this, PlayState* play); -void func_80B4D670(Actor* thisx, PlayState* play); -void func_80B47BAC(Actor* thisx, PlayState* play); -void func_80B47D30(Actor* thisx, PlayState* play); -void func_80B47FA8(Actor* thisx, PlayState* play); -void func_80B48060(Actor* thisx, PlayState* play); -void func_80B481C4(Actor* thisx, PlayState* play); -void func_80B4827C(Actor* thisx, PlayState* play); -void func_80B48620(Actor* thisx, PlayState* play); -void func_80B48FB0(Actor* thisx, PlayState* play); -void func_80B49F88(Actor* thisx, PlayState* play); -void func_80B4A9C8(Actor* thisx, PlayState* play); -void func_80B4B0C4(Actor* thisx, PlayState* play); -void func_80B4CE54(Actor* thisx, PlayState* play); -void func_80B4B8BC(Actor* thisx, PlayState* play); -void func_80B4C3A0(Actor* thisx, PlayState* play); -void func_80B49B1C(Actor* thisx, PlayState* play); -void func_80B4E158(Actor* thisx, PlayState* play); -void func_80B4E3F0(Actor* thisx, PlayState* play); -void func_80B4D9B4(Actor* thisx, PlayState* play); -void func_80B4E1B0(Actor* thisx, PlayState* play); -void func_80B4E324(Actor* thisx, PlayState* play); -void func_80B4BA84(Actor* thisx, PlayState* play); -void func_80B4E660(Actor* thisx, PlayState* play); -void func_80B4C5C0(Actor* thisx, PlayState* play); -void func_80B4E7BC(Actor* thisx, PlayState* play); -void func_80B4A1B8(Actor* thisx, PlayState* play); -void func_80B4ABDC(Actor* thisx, PlayState* play); -void func_80B4D054(Actor* thisx, PlayState* play); -void func_80B4DB14(Actor* thisx, PlayState* play); -void func_80B4D760(Actor* thisx, PlayState* play); -void func_80B4A168(Actor* thisx, PlayState* play); -void func_80B4873C(Actor* thisx, PlayState* play); -void func_80B490F0(Actor* thisx, PlayState* play); -void func_80B4AB8C(Actor* thisx, PlayState* play); -void func_80B4B218(Actor* thisx, PlayState* play); -void func_80B4BA30(Actor* thisx, PlayState* play); -void func_80B4C568(Actor* thisx, PlayState* play); -void func_80B4CFFC(Actor* thisx, PlayState* play); -void func_80B46184(unkStruct80B50350* unkStruct); -s32 func_80B450C0(f32* x1, f32* z1, f32 x2, f32 z2, f32 speed); -s32 func_80B4516C(EnInvadepoh* this); -void func_80B45A4C(EnInvadePohStruct* s, unkstructInvadepoh4** u); -void func_80B45A94(EnInvadePohStruct* s, unkstructInvadepoh4** u); -void func_80B45B1C(EnInvadePohStruct* s, unkstructInvadepoh4** u); - -extern s32 D_801BDA9C; - -ActorInit En_Invadepoh_InitVars = { +/* +const ActorInit En_Invadepoh_InitVars = { ACTOR_EN_INVADEPOH, ACTORCAT_PROP, FLAGS, @@ -189,4414 +20,492 @@ ActorInit En_Invadepoh_InitVars = { (ActorFunc)EnInvadepoh_Update, (ActorFunc)NULL, }; +*/ -static ColliderCylinderInit sCylinderInitAlien = { - { - COLTYPE_HIT3, - AT_ON | AT_TYPE_ENEMY, - AC_ON | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK4, - { 0xF7CFFFFF, 0x00, 0x04 }, - { 0x00003820, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_ON, - OCELEM_ON, - }, - { 40, 95, 10, { 0, 0, 0 } }, -}; - -static ColliderCylinderInit sCylinderInitRomaniAndCremia = { - { - COLTYPE_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK0, - { 0x00000000, 0x00, 0x00 }, - { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_NONE, - OCELEM_ON, - }, - { 18, 46, 0, { 0, 0, 0 } }, -}; - -static ColliderCylinderInit sCylinderInitDog = { - { - COLTYPE_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK1, - { 0x00000000, 0x00, 0x00 }, - { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_NONE, - OCELEM_ON, - }, - { 13, 19, 0, { 0, 0, 0 } }, -}; - -static Vec3f D_80B4E934 = { 216.0f, -20.0f, 1395.0f }; - -static s32 D_80B4E940 = 0; - -static TexturePtr sRomaniEyeTextures[] = { - gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, -}; - -static TexturePtr sRomaniMouthTextures[] = { - gRomaniMouthHappyTex, - gRomaniMouthFrownTex, - gRomaniMouthHangingOpenTex, - gRomaniMouthSmileTex, -}; - -static s8 D_80B4E968 = 0; - -static TexturePtr sCremiaEyeTextures[] = { - gCremiaEyeOpenTex, gCremiaEyeHalfTex, gCremiaEyeClosedTex, gCremiaEyeHappyTex, gCremiaEyeAngryTex, gCremiaEyeSadTex, -}; - -static TexturePtr sCremiaMouthTextures[] = { - gCremiaMouthNormalTex, - gCremiaMouthSlightSmileTex, - gCremiaMouthFrownTex, - gCremiaMouthHangingOpenTex, -}; - -static s8 D_80B4E994 = 0; - -static s8 D_80B4E998 = 0; - -static s8 D_80B4E99C[] = { 0 }; - -static s8 D_80B4E9A0[] = { 0, 1, 2, 0 }; - -static s8 D_80B4E9A4[] = { 0, 1, 2, 1, 0 }; - -static s8 D_80B4E9AC[] = { 0, 1, 2, 2, 1, 0 }; - -static s8 D_80B4E9B4[] = { - 0, 1, 2, 1, 0, 1, 2, 0, -}; - -static s8 D_80B4E9BC[] = { 1 }; - -static s8 D_80B4E9C0[] = { 3 }; - -static unkstructInvadepoh0 D_80B4E9C4 = { D_80B4E99C, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B439B0.s") -static unkstructInvadepoh0 D_80B4E9CC = { D_80B4E9A0, 4 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A24.s") -static unkstructInvadepoh0 D_80B4E9D4 = { D_80B4E9A4, 5 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A74.s") -static unkstructInvadepoh0 D_80B4E9DC = { D_80B4E9AC, 6 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43A9C.s") -static unkstructInvadepoh0 D_80B4E9E4 = { D_80B4E9B4, 8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AB0.s") -static unkstructInvadepoh0 D_80B4E9EC = { D_80B4E9BC, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43AF0.s") -static unkstructInvadepoh0 D_80B4E9F4 = { D_80B4E9C0, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43B80.s") -static unkstructInvadepoh2 D_80B4E9FC = { 0, &D_80B4E9C4 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43BC8.s") -static unkstructInvadepoh1 D_80B4EA04[] = { - { 2, 0.5f }, - { 3, 0.9f }, - { 4, 0.97f }, - { 5, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43DD4.s") -static unkstructInvadepoh1 D_80B4EA24[] = { - { 1, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43E6C.s") -static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3C }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F0C.s") -static unkstructInvadepoh3 D_80B4EA40 = { - 1, - &D_80B4E9CC, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B43F70.s") -static unkstructInvadepoh3 D_80B4EA50 = { - 1, - &D_80B4E9D4, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44024.s") -static unkstructInvadepoh3 D_80B4EA60 = { - 1, - &D_80B4E9DC, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4407C.s") -static unkstructInvadepoh3 D_80B4EA70 = { - 1, - &D_80B4E9E4, - 1, - D_80B4EA24, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B440B8.s") -static unkstructInvadepoh2 D_80B4EA80 = { - 0, - &D_80B4E9EC, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44234.s") -static unkstructInvadepoh2 D_80B4EA88 = { - 0, - &D_80B4E9F4, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B442E4.s") -static void* D_80B4EA90[] = { - &D_80B4E9FC, &D_80B4EA2C, &D_80B4EA40, &D_80B4EA50, &D_80B4EA60, &D_80B4EA70, &D_80B4EA80, &D_80B4EA88, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B443A0.s") -static s8 D_80B4EAB0[] = { 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444BC.s") -static s8 D_80B4EAB4[] = { 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B444F4.s") -static s8 D_80B4EAB8[] = { 2 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44514.s") -static s8 D_80B4EABC[] = { 3 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44540.s") -static unkstructInvadepoh0 D_80B4EAC0 = { D_80B4EAB0, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44570.s") -static unkstructInvadepoh0 D_80B4EAC8 = { D_80B4EAB4, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44620.s") -static unkstructInvadepoh0 D_80B4EAD0 = { D_80B4EAB8, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44640.s") -static unkstructInvadepoh0 D_80B4EAD8 = { D_80B4EABC, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44664.s") -static unkstructInvadepoh2 D_80B4EAE0 = { 0, &D_80B4EAC0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44690.s") -static unkstructInvadepoh2 D_80B4EAE8 = { 0, &D_80B4EAC8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B446D0.s") -static unkstructInvadepoh2 D_80B4EAF0 = { 0, &D_80B4EAD0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44700.s") -static unkstructInvadepoh2 D_80B4EAF8 = { 0, &D_80B4EAD8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B447C0.s") -static void* D_80B4EB00[] = { - &D_80B4EAE0, - &D_80B4EAE8, - &D_80B4EAF0, - &D_80B4EAF8, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44A90.s") -static s8 D_80B4EB10[] = { 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B78.s") -static s8 D_80B4EB14[] = { 0, 1, 2, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44B84.s") -static s8 D_80B4EB18[] = { 0, 1, 2, 1, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C24.s") -static s8 D_80B4EB20[] = { 0, 1, 2, 2, 1, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44C80.s") -static s8 D_80B4EB28[] = { 0, 1, 2, 1, 0, 1, 2, 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44E90.s") -static unkstructInvadepoh0 D_80B4EB30 = { D_80B4EB10, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44EFC.s") -static unkstructInvadepoh0 D_80B4EB38 = { D_80B4EB14, 4 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44F58.s") -static unkstructInvadepoh0 D_80B4EB40 = { D_80B4EB18, 5 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B44FEC.s") -static unkstructInvadepoh0 D_80B4EB48 = { D_80B4EB20, 6 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45080.s") -static unkstructInvadepoh0 D_80B4EB50 = { D_80B4EB28, 8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B450C0.s") -static unkstructInvadepoh2 D_80B4EB58 = { 0, &D_80B4EB30 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4516C.s") -static unkstructInvadepoh1 D_80B4EB60[] = { - { 2, 0.5f }, - { 3, 0.9f }, - { 4, 0.95f }, - { 5, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B451A0.s") -static unkstructInvadepoh1 D_80B4EB80[] = { - { 1, 1.0f }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B452EC.s") -static unkstructInvadepoh4 D_80B4EB88 = { 2, &D_80B4EB30, 4, D_80B4EB60, 0x28, 0x3C }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B453F4.s") -static unkstructInvadepoh3 D_80B4EB9C = { - 1, - &D_80B4EB38, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45460.s") -static unkstructInvadepoh3 D_80B4EBAC = { - 1, - &D_80B4EB40, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B454BC.s") -static unkstructInvadepoh3 D_80B4EBBC = { - 1, - &D_80B4EB48, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45518.s") -static unkstructInvadepoh3 D_80B4EBCC = { - 1, - &D_80B4EB50, - 1, - D_80B4EB80, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45550.s") -static void* D_80B4EBDC[] = { - &D_80B4EB58, &D_80B4EB88, &D_80B4EB9C, &D_80B4EBAC, &D_80B4EBBC, &D_80B4EBCC, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4560C.s") -static s8 D_80B4EBF4[] = { 0 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45648.s") -static unkstructInvadepoh0 D_80B4EBF8 = { D_80B4EBF4, 1 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B456A8.s") -static unkstructInvadepoh2 D_80B4EC00 = { 0, &D_80B4EBF8 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B457A0.s") -static void* D_80B4EC08[] = { &D_80B4EC00 }; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B458D8.s") -static void (*D_80B4EC0C[])(struct EnInvadePohStruct*, unkstructInvadepoh4** arg1) = { - func_80B45A4C, - func_80B45A94, - func_80B45B1C, -}; - -static Color_RGBA8 D_80B4EC18 = { 255, 255, 200, 255 }; - -static Color_RGBA8 D_80B4EC1C = { 255, 200, 0, 0 }; - -static void (*D_80B4EC20[])(struct unkStruct80B50350*) = { func_80B46184 }; - -static InitChainEntry D_80B4EC24[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 600, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainParentCow[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainChildCow[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainRomani[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static InitChainEntry D_80B4EC68[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE), ICHAIN_VEC3S(shape.rot, 0, ICHAIN_CONTINUE), - ICHAIN_F32(terminalVelocity, -100, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainDog[] = { - ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 50, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 50, ICHAIN_CONTINUE), - ICHAIN_F32(gravity, -3, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 4, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 7, ICHAIN_STOP), -}; - -static InitChainEntry sInitChainCremia[] = { - ICHAIN_F32(uncullZoneForward, 20000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 150, ICHAIN_CONTINUE), - ICHAIN_F32(targetArrowOffset, 1500, ICHAIN_CONTINUE), - ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP), -}; - -static EnInvadepohInitFunc D_80B4ECB0[] = { - func_80B4627C, - EnInvadepoh_InitAlien, - EnInvadepoh_InitParentCow, - EnInvadepoh_InitChildCow, - EnInvadepoh_InitRomani, - EnInvadepoh_InitRomani, - func_80B468B4, - EnInvadepoh_InitRomani, - EnInvadepoh_InitRomani, - EnInvadepoh_InitRomani, - EnInvadepoh_InitDog, - EnInvadepoh_InitCremia, - EnInvadepoh_InitRomani, - EnInvadepoh_InitAlien, -}; - -static EnInvadepohDestroyFunc D_80B4ECE8[] = { - func_80B46BB0, func_80B46BC0, func_80B46C08, func_80B46C34, func_80B46C50, func_80B46C50, func_80B46C7C, - func_80B46C50, func_80B46C50, func_80B46C50, func_80B46C94, func_80B46CC0, func_80B46CF4, func_80B46D28, -}; - -static s16 D_80B4ED20[] = { - 130, 125, 115, 100, 80, 78, 76, 74, -}; - -static Vec3f D_80B4ED30[] = { - { 0.01f, 0.01f, 0.01f }, { 0.02f, 0.01f, 0.005f }, { -0.01f, 0.0f, 0.0f }, - { 0.01f, 0.01f, 0.01f }, { 0.005f, 0.01f, 0.02f }, -}; - -static Vec3f D_80B4ED6C[] = { - { 0.0005f, 0.0279999990016f, 0.01f }, { -0.01f, 0.0f, 0.0f }, { -0.01f, 0.0f, 0.0f }, - { 0.016f, 0.0004f, 0.01f }, { -0.01f, 0.0f, 0.0f }, { 0.0005f, 0.0005f, 0.0005f }, - { 0.0002f, 0.0002f, 0.0002f }, -}; - -static s16 D_80B4EDC0[] = { 0xE0C0, 0xE890, 0xD508 }; - -static s16 D_80B4EDC8[] = { - -1800, - -1000, - 0, - 2000, -}; - -static Vec3f D_80B4EDD0[] = { - { -1813.0f, 374.0f, 1900.0f }, { 2198.0f, 153.0f, 3365.0f }, { -1434.0f, 262.0f, 3365.0f }, - { -393.0f, 396.0f, 1084.0f }, { 0.0f, 1500.0f, 0.0f }, -}; - -static unkstruct80B4EE0C D_80B4EE0C[] = { - { 0.08f, 0x02BC, 0xFFF6 }, - { 0.09f, 0x012C, 0xFFFB }, - { 0.05f, 0x0190, 0x0000 }, -}; - -static Vec3f D_80B4EE24 = { - 2000.0f, - 1000.0f, - 0.0f, -}; - -static Vec3f D_80B4EE30 = { - 400.0f, - 270.0f, - 0.0f, -}; - -MtxF D_80B502A0; -MtxF D_80B502E0; -EnInvadepoh* D_80B50320[8]; -u8 D_80B50340[8]; -UNK_TYPE1 D_80B50348; -unkStruct80B50350 D_80B50350[10]; -EnInvadepoh* D_80B503F0; -EnInvadepoh* D_80B503F4; -EnInvadepoh* D_80B503F8; -AnimatedMaterial* sAlienEyeBeamTexAnim; -AnimatedMaterial* sAlienEmptyTexAnim; -s16 D_80B50404[3]; -EnInvadepoh* D_80B5040C; - -void func_80B439B0(s32 arg0, s32 arg1) { - arg1 -= 0x1AAA; - if (arg1 < 0) { - arg1 = 0; - } - - if (!(arg0 & 1)) { - gSaveContext.save.unk_E88[arg0 >> 1] = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) | (arg1 & 0xFFFF); - } else { - gSaveContext.save.unk_E88[arg0 >> 1] = - (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF) | ((arg1 & 0xFFFF) << 0x10); - } -} - -s32 func_80B43A24(s32 arg0) { - u32 phi_v1; - - if ((arg0 & 1) == 0) { - phi_v1 = gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF; - } else { - phi_v1 = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) >> 0x10; - } - return phi_v1 + 0x1AAA; -} - -void func_80B43A74(s32 arg0) { - gSaveContext.save.unk_E88[4] = (gSaveContext.save.unk_E88[4] & ~0xFF) | (arg0 & 0xFF); -} - -s32 func_80B43A9C(void) { - return (gSaveContext.save.unk_E88[4] >> 0) & 0xFF; -} - -s32 func_80B43AB0(void) { - s32 retVal = func_80B43A9C(); - - if (retVal < 0xC) { - retVal++; - func_80B43A74(retVal); - } - return retVal; -} - -void func_80B43AF0(s32 arg0) { - s32 currentTime = gSaveContext.save.time; - - if (((CURRENT_DAY == 1) && (currentTime >= CLOCK_TIME(2, 30))) && (currentTime < CLOCK_TIME(5, 15))) { - s32 adjustment = (0xC - func_80B43A9C()) * 25.0f; - - func_80B439B0(arg0, currentTime + adjustment); - } -} - -s32 func_80B43B80(EnInvadepoh* this) { - s32 i; - s32 temp = this->endPoint - 1; - - for (i = 0; i < temp; i++) { - if (this->unk37C[i] > this->clockTime) { - break; - } - } - - return i; -} - -void func_80B43BC8(EnInvadepoh* this, s8* arg1, Vec3f* arg2) { - s32 temp_s5 = this->endPoint; - f32 pathTotalDistInv = 1.0f / this->pathTotalDist; - Vec3s* phi_s0 = &this->pathPoints[1]; - Vec3s* phi_s1 = &this->pathPoints[0]; - f32 new_var; - Vec3f sp70; - s32 phi_s2; - f32 temp_f0; - f32 temp_f12; - f32 temp_f14; - f32 temp_f6; - f32 phi_f20 = 0.0f; - f32 phi_f24 = 0.0f; - - for (phi_s2 = 0; phi_s2 < temp_s5; phi_s2++) { - sp70.x = phi_s0->x - phi_s1->x; - sp70.y = phi_s0->y - phi_s1->y; - sp70.z = phi_s0->z - phi_s1->z; - new_var = Math3D_Vec3fMagnitude(&sp70); - temp_f14 = phi_f20 + new_var; - temp_f12 = temp_f14 * pathTotalDistInv; - - if (this->clockTime <= temp_f12) { - temp_f6 = temp_f12 - phi_f24; - *arg1 = phi_s2; - temp_f0 = (this->clockTime - phi_f24) / temp_f6; - arg2->x = (temp_f0 * sp70.x) + phi_s1->x; - arg2->y = (temp_f0 * sp70.y) + phi_s1->y; - arg2->z = (temp_f0 * sp70.z) + phi_s1->z; - return; - } - - phi_s1 = phi_s0; - phi_s0++; - phi_f20 = temp_f14; - phi_f24 = temp_f12; - } - - *arg1 = temp_s5; - arg2->x = this->pathPoints[temp_s5].x; - arg2->y = this->pathPoints[temp_s5].y; - arg2->z = this->pathPoints[temp_s5].z; -} - -void func_80B43DD4(EnInvadepoh* this, s16 arg1, s16 arg2) { - s32 pad; - Vec3s* arr = &this->pathPoints[this->pathIndex]; - s32 pad2; - Vec3f sp30; - Vec3f sp24; - - if (this->pathIndex != this->endPoint) { - Math_Vec3s_ToVec3f(&sp30, &arr[0]); - Math_Vec3s_ToVec3f(&sp24, &arr[1]); - Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp30, &sp24) + arg2, arg1); - } -} - -void func_80B43E6C(EnInvadepoh* this, s16 arg1, s16 arg2, s16 arg3) { - s32 pad; - Vec3s* arr = &this->pathPoints[this->pathIndex]; - s32 pad2; - Vec3f sp38; - Vec3f sp2C; - - if (this->pathIndex != this->endPoint) { - Math_Vec3s_ToVec3f(&sp38, &arr[0]); - Math_Vec3s_ToVec3f(&sp2C, &arr[1]); - Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp38, &sp2C), arg1, arg2, arg3); - } -} - -void func_80B43F0C(EnInvadepoh* this) { - s32 pad; - Vec3s* arr = &this->pathPoints[this->pathIndex]; - s32 pad2; - Vec3f sp28; - Vec3f sp1C; - - Math_Vec3s_ToVec3f(&sp28, &arr[0]); - Math_Vec3s_ToVec3f(&sp1C, &arr[1]); - this->actor.shape.rot.y = Math_Vec3f_Yaw(&sp28, &sp1C); -} - -f32 EnInvadepoh_GetTotalPathLength(EnInvadepoh* this) { - f32 distance; - s32 pad; - Vec3f sp54; - Vec3f pathPointF; - Vec3s* pathPoint; - f32 totalDistance; - s32 i; - s32 temp_s4; - - temp_s4 = this->endPoint + 1; - pathPoint = this->pathPoints; - totalDistance = 0.0f; - Math_Vec3s_ToVec3f(&pathPointF, pathPoint); - pathPoint++; - for (i = 1; i < temp_s4; i++) { - Math_Vec3f_Copy(&sp54, &pathPointF); - Math_Vec3s_ToVec3f(&pathPointF, pathPoint); - distance = Math3D_Distance(&sp54, &pathPointF); - pathPoint++; - totalDistance += distance; - } - - return totalDistance; -} - -void func_80B44024(EnInvadepoh* this, PlayState* play) { - Path* path = &play->setupPathList[(this->actor.params >> 8) & 0x7F]; - - this->endPoint = path->count - 1; - this->pathPoints = Lib_SegmentedToVirtual(path->points); -} - -void EnInvadepoh_SetPathPointToWorldPos(EnInvadepoh* this, s32 pathIndex) { - Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[pathIndex]); -} - -s32 func_80B440B8(EnInvadepoh* this, f32 arg1, f32 arg2) { - Vec3s* temp_a3 = &this->pathPoints[this->pathIndex + 1]; - Vec3s* sp48 = &this->pathPoints[this->pathIndex]; - f32 new_var; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; - f32 sp30; - f32 sp2C; - f32 temp_f12_2; - s32 pad1; - s32 pad2; - s16 sp1E; - - if (this->pathIndex >= this->endPoint) { - return false; - } - - sp40 = temp_a3->x - sp48->x; - sp3C = temp_a3->z - sp48->z; - sp1E = Math_Atan2S_XY(sp3C, sp40); - sp38 = Math_CosS(sp1E); - sp34 = Math_SinS(sp1E); - sp30 = this->actor.world.pos.x - sp48->x; - sp2C = this->actor.world.pos.z - sp48->z; - - if ((arg1 - arg2) < fabsf((sp30 * sp38) - (sp2C * sp34))) { - return false; - } - - temp_f12_2 = (sp2C * sp38) + (sp30 * sp34); - new_var = Math3D_XZLength(sp40, sp3C); - - if ((temp_f12_2 < 0.0f) || (new_var < temp_f12_2)) { - return false; - } - - return true; -} - -s32 func_80B44234(EnInvadepoh* this, Vec3f* vec) { - f32 distance; - s8 temp_s3 = this->endPoint; - f32 min = FLT_MAX; - Vec3f sp48; - s32 i; - s32 ret = 0; - Vec3s* arr; - - for (i = 0, arr = this->pathPoints; i < temp_s3; i++, arr++) { - Math_Vec3s_ToVec3f(&sp48, arr); - distance = Math3D_Vec3fDistSq(&sp48, vec); - if (distance < min) { - min = distance; - ret = i; - } - } - - return ret; -} - -void func_80B442E4(EnInvadepoh* this) { - s32 temp_v1_2 = ((void)0, (s32)gSaveContext.save.time) - func_80B43A24(this->actor.params & 7); - - if (D_80B4E940 == 1) { - this->clockTime = 0.0f; - } else if (D_80B4E940 == 2) { - if (temp_v1_2 < 0) { - this->clockTime = 0.0f; - } else { - this->clockTime = temp_v1_2 * 0.00027777779f; - if (this->clockTime > 1.0f) { - this->clockTime = 1.0f; - } - } - } - - this->pathIndex = func_80B43B80(this); -} - -void func_80B443A0(EnInvadepoh* this) { - f32 pathTotalDistInv; - s8 temp_s5; - Vec3s* phi_s1; - Vec3f sp70; - Vec3f sp64; - f32* phi_s0; - f32 phi_f20; - s32 i; - - temp_s5 = this->endPoint; - pathTotalDistInv = 1.0f / this->pathTotalDist; - phi_f20 = 0.0f; - phi_s1 = this->pathPoints; - Math_Vec3s_ToVec3f(&sp64, phi_s1); - phi_s1++; - phi_s0 = this->unk37C; - - for (i = 1; i < temp_s5; i++, phi_s1++, phi_s0++) { - Math_Vec3f_Copy(&sp70, &sp64); - Math_Vec3s_ToVec3f(&sp64, phi_s1); - phi_f20 += Math3D_Distance(&sp70, &sp64); - *phi_s0 = phi_f20 * pathTotalDistInv; - if (*phi_s0 < 0.0f) { - *phi_s0 = 0.0f; - } else if (*phi_s0 > 1.0f) { - *phi_s0 = 1.0f; - } - } -} - -void func_80B444BC(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); - func_80B443A0(this); -} - -void func_80B444F4(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); -} - -void func_80B44514(EnInvadepoh* this) { - this->pathIndex++; - if (this->pathIndex >= this->endPoint) { - this->pathIndex = 0; - } -} - -void func_80B44540(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); -} - -void func_80B44570(EnInvadepoh* this) { - s32 currentTime = gSaveContext.save.time; - - if ((currentTime < CLOCK_TIME(2, 0)) || (currentTime >= CLOCK_TIME(6, 0))) { - this->clockTime = 0.0f; - } else if ((currentTime >= CLOCK_TIME(2, 15)) && (currentTime < CLOCK_TIME(6, 0))) { - this->clockTime = 1.0f; - } else { - f32 new_var = (currentTime - 0x1555) * 0.0014641288f; - - this->clockTime = new_var; - this->clockTime = CLAMP(this->clockTime, 0.0f, 1.0f); - } -} - -void func_80B44620(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); -} - -void func_80B44640(EnInvadepoh* this) { - if (this->pathIndex < this->endPoint) { - this->pathIndex++; - } -} - -void func_80B44664(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->direction = DIRECTION_FORWARD; -} - -void func_80B44690(EnInvadepoh* this) { - this->pathIndex += this->direction; - if (this->pathIndex >= this->endPoint) { - this->pathIndex = 0; - } else if (this->pathIndex < 0) { - this->pathIndex = this->endPoint - 1; - } -} - -void func_80B446D0(EnInvadepoh* this, PlayState* play) { - func_80B44024(this, play); - this->pathTotalDist = EnInvadepoh_GetTotalPathLength(this); -} - -void func_80B44700(EnInvadepoh* this) { - s32 currentTime = gSaveContext.save.time; - s32 new_var4 = 0xFFFF2AAB; - - if ((currentTime < CLOCK_TIME(20, 0)) && (currentTime >= CLOCK_TIME(6, 0))) { - this->clockTime = 0.0f; - } else if ((currentTime > 0xD7E0) || (currentTime < CLOCK_TIME(6, 0))) { - this->clockTime = 1.0f; - } else { - f32 new_var = 0.00153374229558f; - - this->clockTime = (currentTime + new_var4) * new_var; - this->clockTime = CLAMP(this->clockTime, 0.0f, 1.0f); - } -} - -void func_80B447C0(EnInvadepoh* this, PlayState* play) { - s32 pad1; - Vec3s* sp60; - s32 pad2; - Vec3f sp50; - Vec3f sp44; - f32 sp40 = this->actor.world.pos.y; - f32 sp3C; - s32 pad3; - f32 sp34; - f32 sp30; - f32 sp2C; - f32 phi_f2; - - sp60 = &this->pathPoints[this->pathIndex]; - if (this->pathIndex <= 0) { - sp3C = 0.0f; - } else { - sp3C = this->unk37C[this->pathIndex - 1]; - } - - if (this->pathIndex < (this->endPoint - 1)) { - phi_f2 = this->unk37C[this->pathIndex]; - } else { - phi_f2 = 1.0f; - } - - if ((phi_f2 - sp3C) < 0.001f) { - Math_Vec3s_ToVec3f(&this->curPathPos, sp60); - } else { - sp34 = this->clockTime - sp3C; - sp30 = phi_f2 - this->clockTime; - sp2C = 1.0f / (phi_f2 - sp3C); - Math_Vec3s_ToVec3f(&sp50, &sp60[0]); - Math_Vec3s_ToVec3f(&sp44, &sp60[1]); - this->curPathPos.x = ((sp50.x * sp30) + (sp44.x * sp34)) * sp2C; - this->curPathPos.y = ((sp50.y * sp30) + (sp44.y * sp34)) * sp2C; - this->curPathPos.z = ((sp50.z * sp30) + (sp44.z * sp34)) * sp2C; - } - - Math_Vec3f_Copy(&this->actor.world.pos, &this->curPathPos); - func_800B4AEC(play, &this->actor, 0.0f); - if (this->actor.floorHeight > BGCHECK_Y_MIN + 1) { - if (sp40 < this->actor.floorHeight) { - if (this->actor.velocity.y < 0.0f) { - this->actor.velocity.y = 0.0f; - } else { - this->actor.velocity.y += 2.0f; - this->actor.velocity.y = CLAMP_MAX(this->actor.velocity.y, 30.0f); - } - this->actor.world.pos.y = this->actor.velocity.y + sp40; - if (this->actor.world.pos.y > this->actor.floorHeight) { - this->actor.world.pos.y = this->actor.floorHeight; - } - } else { - if (this->actor.velocity.y > 0.0f) { - this->actor.velocity.y = 0.0f; - } else { - this->actor.velocity.y -= 2.0f; - } - - this->actor.world.pos.y = this->actor.velocity.y + sp40; - if (this->actor.world.pos.y < this->actor.floorHeight) { - this->actor.world.pos.y = this->actor.floorHeight; - this->actor.velocity.y = CLAMP_MIN(this->actor.velocity.y, -30.0f); - } - } - } else { - this->actor.world.pos.y = sp40; - } -} - -void func_80B44A90(EnInvadepoh* this, PlayState* play) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->actor.velocity.y *= 0.3f; - this->actor.speed *= 0.8f; - } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - this->actor.velocity.y *= 0.8f; - this->actor.speed *= 0.3f; - } else { - this->actor.velocity.y *= 0.8f; - this->actor.speed *= 0.8f; - } - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 40.0f, 0.0f, 5); -} - -void func_80B44B78(EnInvadepoh* this) { -} - -s32 func_80B44B84(EnInvadepoh* this, PlayState* play, f32 speed, f32 arg3) { - s32 pad; - Vec3s* pathPoint = &this->pathPoints[this->pathIndex + 1]; - s32 retVal = func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, pathPoint->x, pathPoint->z, speed); - - func_800B4AEC(play, &this->actor, arg3); - func_80B4516C(this); - return retVal; -} - -void func_80B44C24(EnInvadepoh* this, PlayState* play) { - s32 pad; - f32 worldPosY = this->actor.world.pos.y; - - func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); - this->actor.world.pos.y = worldPosY; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); -} - -s32 func_80B44C80(EnInvadepoh* this, PlayState* play) { - s32 pad[6]; - Vec3s* temp_a2 = &this->pathPoints[this->pathIndex]; - f32 temp_f0; - Vec3f sp6C; - Vec3f sp60; - f32 temp_f0_2; - Vec3s* temp_v0_2; - f32 temp_f0_3; - f32 temp_f12; - f32 temp_f2; - f32 temp_f14; - f32 sp44; - s32 sp40 = 0; - s32 temp_v1 = this->pathIndex + this->direction; - s32 phi_v0; - - if (temp_v1 >= this->endPoint) { - temp_v1 = 0; - } else if (temp_v1 < 0) { - temp_v1 = this->endPoint - 1; - } - - temp_v0_2 = &this->pathPoints[temp_v1]; - - temp_f0 = temp_a2->x; - temp_f2 = temp_a2->z; - temp_f12 = temp_v0_2->x; - temp_f14 = temp_v0_2->z; - sp6C.x = temp_f12 - temp_f0; - sp6C.y = 0.0f; - sp6C.z = temp_f14 - temp_f2; - sp60.x = temp_f12 - this->actor.world.pos.x; - sp60.y = 0.0f; - sp60.z = temp_f14 - this->actor.world.pos.z; - temp_f0_3 = temp_f0 - this->actor.world.pos.x; - temp_f0_2 = temp_f2 - this->actor.world.pos.z; - - if (this->actor.speed > 0.0f) { - if (Math3D_AngleBetweenVectors(&sp6C, &sp60, &sp44) != 0) { - sp40 = 1; - } else if (sp44 <= 0.0f) { - sp40 = 1; - } - } - - Math_SmoothStepToS(&this->actor.world.rot.y, - Math_Atan2S_XY(((sp60.z + temp_f0_2) * 0.9f) + sp6C.z, ((sp60.x + temp_f0_3) * 0.9f) + sp6C.x), - 4, 0xFA0, 0x64); - Actor_MoveWithGravity(&this->actor); - if (func_80B440B8(this, 50.0f, 15.0f)) { - phi_v0 = 4; - } else { - phi_v0 = 5; - } - - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, phi_v0); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); - return sp40; -} - -void func_80B44E90(EnInvadepoh* this, PlayState* play) { - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 0.0f, 5); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1F40, 0x64); -} - -void func_80B44EFC(EnInvadepoh* this, PlayState* play) { - s32 pad; - f32 worldPosY = this->actor.world.pos.y; - - func_80B43BC8(this, &this->pathIndex, &this->actor.world.pos); - this->actor.world.pos.y = worldPosY; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); -} - -void func_80B44F58(void) { - s32 i; - TexturePtr* iter; - - if (!D_80B4E968) { - D_80B4E968 = true; - for (i = 0, iter = sRomaniEyeTextures; i < ARRAY_COUNT(sRomaniEyeTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - - for (i = 0, iter = sRomaniMouthTextures; i < ARRAY_COUNT(sRomaniMouthTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - } -} - -void func_80B44FEC(void) { - s32 i; - TexturePtr* iter; - - if (!D_80B4E994) { - D_80B4E994 = true; - for (i = 0, iter = sCremiaEyeTextures; i < ARRAY_COUNT(sCremiaEyeTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - - for (i = 0, iter = sCremiaMouthTextures; i < ARRAY_COUNT(sCremiaMouthTextures); i++, iter++) { - *iter = Lib_SegmentedToVirtual(*iter); - } - } -} - -void func_80B45080(void) { - sAlienEmptyTexAnim = Lib_SegmentedToVirtual(gAlienEmptyTexAnim); - sAlienEyeBeamTexAnim = Lib_SegmentedToVirtual(gAlienEyeBeamTexAnim); -} - -s32 func_80B450C0(f32* x1, f32* z1, f32 x2, f32 z2, f32 speed) { - f32 deltaX = x2 - *x1; - f32 deltaZ = z2 - *z1; - f32 temp_f0 = Math3D_XZLength(deltaX, deltaZ); - - if (speed < temp_f0) { - f32 temp_f2 = speed / temp_f0; - *x1 += (temp_f2 * deltaX); - *z1 += (temp_f2 * deltaZ); - return false; - } else { - *x1 = x2; - *z1 = z2; - return true; - } -} - -s32 func_80B4516C(EnInvadepoh* this) { - if (this->actor.floorHeight > BGCHECK_Y_MIN + 1) { - this->actor.world.pos.y = this->actor.floorHeight; - return true; - } - return false; -} - -void func_80B451A0(EnInvadepoh* this, PlayState* play) { - s32 currentTime; - s32 temp_v0_2; - s32 i; - s32 phi_s1_3; - - if (D_80B4E940 == 0) { - if (CURRENT_DAY <= 0) { - D_80B4E940 = 1; - } else if (CURRENT_DAY == 1) { - currentTime = gSaveContext.save.time; - if ((currentTime < CLOCK_TIME(2, 30)) || (currentTime >= CLOCK_TIME(6, 0))) { - D_80B4E940 = 1; - } else if (currentTime < CLOCK_TIME(5, 15)) { - phi_s1_3 = CLOCK_TIME(5, 15); - for (i = 0; i < this->unk379; i++) { - temp_v0_2 = func_80B43A24(i); - if (temp_v0_2 < phi_s1_3) { - phi_s1_3 = temp_v0_2; - } - } - - if (currentTime < (phi_s1_3 + 0xE11)) { - D_80B4E940 = 2; - } - - if (i) {} // required - } - } - - if (D_80B4E940 == 0) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - D_80B4E940 = 3; - } else { - D_80B4E940 = 4; - } - } - } -} - -void func_80B452EC(EnInvadepoh* this, PlayState* play) { - s32 phi_s2 = (this->actor.params >> 8) & 0x7F; - s32 i; - - for (i = 0; i < this->unk379; i++) { - D_80B50320[i] = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - (i & 7) | ((phi_s2 << 8) & 0x7F00) | 0x10); - if (phi_s2 != 0xFF) { - Path* path = &play->setupPathList[phi_s2]; - phi_s2 = path->unk1; - } - } -} - -void func_80B453F4(EnInvadepoh* this, PlayState* play, s32 arg2) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, (arg2 & 7) | 0x20); -} - -void func_80B45460(EnInvadepoh* this, PlayState* play) { - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, this->actor.home.pos.x, - this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0, 0x40); -} - -void func_80B454BC(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = (EnInvadepoh*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INVADEPOH, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x60); -} - -void EnInvadepoh_SetSysMatrix(Vec3f* vec) { - MtxF* sysMatrix = Matrix_GetCurrent(); - - sysMatrix->xw = vec->x; - sysMatrix->yw = vec->y; - sysMatrix->zw = vec->z; -} - -s32 func_80B45550(EnInvadepoh* this, PlayState* play, f32 range, s32 arg3) { - s32 pad; - Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_DOOR].first; - s32 retVal = false; - - while (actorIterator != NULL) { - if ((actorIterator->id == ACTOR_EN_DOOR) && (actorIterator->update != NULL) && - (actorIterator->room == this->actor.room) && - Math3D_Vec3fDistSq(&actorIterator->world.pos, &this->actor.world.pos) < range) { - ((EnDoor*)actorIterator)->unk_1A7 = arg3; - retVal = true; - break; - } - actorIterator = actorIterator->next; - } - return retVal; -} - -void EnInvadepoh_SetTextID(EnInvadepoh* this, PlayState* play, u16 arg2) { - this->textId = arg2; - Message_StartTextbox(play, arg2, &this->actor); -} - -void func_80B45648(EnInvadepoh* this) { - s32 i; - s16 cs = this->actor.cutscene; - - for (i = 0; i < 3; i++) { - D_80B50404[i] = cs; - cs = ActorCutscene_GetAdditionalCutscene(cs); - } -} - -s32 func_80B456A8(PlayState* play, Vec3f* worldPos) { - Vec3f projectedPos; - f32 invW; - - Actor_GetProjectedPos(play, worldPos, &projectedPos, &invW); - if (((projectedPos.z > 1.0f) && (fabsf(projectedPos.x * invW) < 1.0f)) && (fabsf(projectedPos.y * invW) < 1.0f)) { - s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW); - s32 screenPosY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); - s32 wZ = (s32)(projectedPos.z * invW * 16352.0f) + 16352; - s32 zBuf = func_80178A94(screenPosX, screenPosY); - if (wZ < zBuf) { - return true; - } - } - - return false; -} - -void func_80B457A0(EnInvadepoh* this) { - f32 distanceSquared; - f32 phi_f20 = FLT_MAX; - s32 i; - s32 phi_s5 = -1; - - for (i = 0; i < this->unk379; i++) { - if ((D_80B50320[i] != NULL) && D_80B50320[i]->drawAlien) { - distanceSquared = Math3D_Vec3fDistSq(&D_80B50320[i]->actor.world.pos, &this->actor.world.pos); - if (distanceSquared < phi_f20) { - phi_f20 = distanceSquared; - phi_s5 = i; - } - } - D_80B50340[i] &= ~2; - } - - D_80B50348 = 0; - if (phi_f20 <= SQ(2000.0f)) { - D_80B50340[phi_s5] |= 2; - if (phi_f20 <= SQ(340.0f)) { - D_80B50348 = 1; - } - } -} - -EnInvadepoh* func_80B458D8(void) { - s32 i; - - for (i = 0; i < 8; i++) { - if (D_80B50340[i] & 2) { - return D_80B50320[i]; - } - } - - return NULL; -} - -s8 func_80B45980(unkstructInvadepoh1* arg0, s32 arg1) { - f32 rand = Rand_ZeroOne(); - s32 i; - unkstructInvadepoh1* ptr = arg0; - - arg1--; - for (i = 0; i < arg1; i++, ptr++) { - if (ptr->unk04 >= rand) { - break; - } - } - - return (arg0 + i)->unk00; -} - -void func_80B459E8(EnInvadePohStruct* s, unkstructInvadepoh4* u) { - s->unk4 = u->unk00; - s->unk8 = u; - s->unkE = 0; - s->unkF = *u->unk04->unk00; - if (s->unk4 == 2) { - s->unkC = Rand_S16Offset(u->unk10, u->unk12); - } -} - -void func_80B45A4C(EnInvadePohStruct* s, unkstructInvadepoh4** u) { - unkstructInvadepoh4* new_var = s->unk8; - unkstructInvadepoh0* temp_v1 = new_var->unk04; - - if (s->unkE < (temp_v1->unk04 - 1)) { - s->unkE++; - s->unkF = temp_v1->unk00[s->unkE]; - } -} - -void func_80B45A94(EnInvadePohStruct* s, unkstructInvadepoh4** u) { - unkstructInvadepoh0* temp_v1 = s->unk8->unk04; - unkstructInvadepoh1* temp_a0; - - if (s->unkE < (temp_v1->unk04 - 1)) { - s->unkE++; - s->unkF = temp_v1->unk00[s->unkE]; - } else { - func_80B459E8(s, u[func_80B45980(s->unk8->unk0C, s->unk8->unk08)]); - } -} - -void func_80B45B1C(EnInvadePohStruct* s, unkstructInvadepoh4** u) { - unkstructInvadepoh0* temp_v1 = s->unk8->unk04; - unkstructInvadepoh1* temp_a0; - - if (s->unkE < (temp_v1->unk04 - 1)) { - s->unkE++; - s->unkF = temp_v1->unk00[s->unkE]; - } else if (s->unkC > 0) { - s->unkC--; - } else { - func_80B459E8(s, u[func_80B45980(s->unk8->unk0C, s->unk8->unk08)]); - } -} - -void func_80B45BB8(EnInvadePohStruct* s) { - if ((s->unk0 != 0) && (s->unk8 != 0)) { - D_80B4EC0C[s->unk4](s, (unkstructInvadepoh4**)s->unk0); - } -} - -void func_80B45C04(AlienBehaviorInfo* substruct, void* arg1[], s32 arg2, void* arg3[], s32 arg4, Vec3s* arg5, s16 arg6, - f32 arg7, f32 arg8, f32 arg9) { - unkstructInvadepoh4* temp_v0; - - Math_Vec3s_Copy(&substruct->unk26, arg5); - substruct->unk2C = arg6; - substruct->unk30 = arg7; - substruct->unk38 = arg8; - substruct->unk3C = arg9; - if (arg1 != NULL) { - temp_v0 = arg1[arg2]; - substruct->unk0.unk0 = (unkstructInvadepoh4*)arg1; - substruct->unk0.unk4 = temp_v0->unk00; - substruct->unk0.unkC = 0; - substruct->unk0.unkE = 0; - substruct->unk0.unk8 = temp_v0; - substruct->unk0.unkF = *temp_v0->unk04->unk00; - } - if (arg3 != NULL) { - temp_v0 = arg3[arg4]; - substruct->unk10.unk0 = (unkstructInvadepoh4*)arg3; - substruct->unk10.unk4 = temp_v0->unk00; - substruct->unk10.unkC = 0; - substruct->unk10.unkE = 0; - substruct->unk10.unk8 = temp_v0; - substruct->unk10.unkF = *temp_v0->unk04->unk00; - } -} - -void func_80B45CE0(AlienBehaviorInfo* substruct) { - Vec3f sp3C; - Vec3s sp34; - s16 step; - - sp34.x = substruct->unk26.x - substruct->unk20.x; - sp34.y = substruct->unk26.y - substruct->unk20.y; - sp34.z = substruct->unk26.z - substruct->unk20.z; - Math_Vec3s_ToVec3f(&sp3C, &sp34); - Math_Vec3f_Scale(&sp3C, substruct->unk30); - Math_Vec3f_ToVec3s(&sp34, &sp3C); - sp34.x = ABS(sp34.x); - sp34.y = ABS(sp34.y); - sp34.z = ABS(sp34.z); - sp34.x = CLAMP_MAX(sp34.x, substruct->unk2C); - sp34.y = CLAMP_MAX(sp34.y, substruct->unk2C); - sp34.z = CLAMP_MAX(sp34.z, substruct->unk2C); - Math_ScaledStepToS(&substruct->unk20.x, substruct->unk26.x, sp34.x); - Math_ScaledStepToS(&substruct->unk20.y, substruct->unk26.y, sp34.y); - Math_ScaledStepToS(&substruct->unk20.z, substruct->unk26.z, sp34.z); - Math_StepToF(&substruct->unk34, substruct->unk38, substruct->unk3C); - - if (substruct->unk40 != substruct->unk42) { - step = substruct->unk42 - substruct->unk40; - step *= substruct->unk44; - step = ABS(step); - step = CLAMP(step, 100, substruct->unk48); - Math_ScaledStepToS(&substruct->unk40, substruct->unk42, step); - } - func_80B45BB8(&substruct->unk0); - func_80B45BB8(&substruct->unk10); -} - -void func_80B45EC8(EnInvadepoh* this, PlayState* play, s32 arg2) { - s16 phi_s0 = 0; - Vec3f spA8; - Vec3f sp9C; - Vec3f sp90; - f32 temp_f20; - s32 i; - - for (i = 0; i < arg2; i++) { - phi_s0 += (s16)(65536.0f / arg2); - - temp_f20 = (Rand_ZeroOne() * 0.5f) + 0.5f; - spA8.x = Math_SinS(phi_s0) * temp_f20; - spA8.z = Math_CosS(phi_s0) * temp_f20; - - sp9C.x = ((Rand_ZeroOne() * 16.0f) + (spA8.x * 30.0f)) - 8.0f; - sp9C.y = -8.0f; - sp9C.z = ((Rand_ZeroOne() * 16.0f) + (spA8.z * 30.0f)) - 8.0f; - - sp90.x = sp9C.x * -0.025f; - sp90.y = sp9C.y * -0.025f; - sp90.z = sp9C.z * -0.025f; - - spA8.x = (spA8.x * 100.0f) + this->actor.world.pos.x; - spA8.y = ((Rand_ZeroOne() * 180.0f) + this->actor.world.pos.y) - 90.0f; - spA8.z = (spA8.z * 100.0f) + this->actor.world.pos.z; - - EffectSsKirakira_SpawnDispersed(play, &spA8, &sp9C, &sp90, &D_80B4EC18, &D_80B4EC1C, 6000, -40); - } -} - -s32 func_80B46118(Vec3f* actorPos) { - unkStruct80B50350* phi_v1; - s32 i; - - for (phi_v1 = D_80B50350, i = 0; i < 10; phi_v1++, i++) { - if (phi_v1->unk1 <= 0) { - phi_v1->unk0 = 0; - phi_v1->unk1 = 40; - Math_Vec3f_Copy(&phi_v1->unk4, actorPos); - phi_v1->unk2 = 0; - return true; - } - } - return false; -} - -void func_80B46184(unkStruct80B50350* unkStruct) { - if (unkStruct->unk1 > 20) { - if (unkStruct->unk2 < 125) { - unkStruct->unk2 += 10; - } else { - unkStruct->unk2 = 135; - } - } else if (unkStruct->unk2 > 13) { - unkStruct->unk2 -= 13; - - } else { - unkStruct->unk2 = 0; - } -} - -s32 func_80B461DC(void) { - s32 phi_s4 = false; - unkStruct80B50350* phi_s0; - s32 i; - - for (phi_s0 = D_80B50350, i = 0; i < 10; phi_s0++, i++) { - if (phi_s0->unk1 > 0) { - D_80B4EC20[phi_s0->unk0](phi_s0); - phi_s0->unk1--; - phi_s4 = true; - } - } - return phi_s4; -} - -void func_80B4627C(EnInvadepoh* this, PlayState* play) { - s32 invadepohType; - s32 i; - - this->actor.flags |= ACTOR_FLAG_20; - invadepohType = (this->actor.params >> 8) & 0x7F; - - for (i = 1; i < 8; i++) { - Path* path = &play->setupPathList[invadepohType]; - invadepohType = path->unk1; - if (invadepohType == 0xFF) { - break; - } - } - - this->unk379 = i; - func_80B451A0(this, play); - func_80B45648(this); - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_SWITCH); - - if (D_80B4E940 == 1) { - func_80B46DA8(this); - } else if (D_80B4E940 == 2) { - if (gSaveContext.save.time < CLOCK_TIME(2, 31)) { - func_80B46DA8(this); - } else { - func_80B454BC(this, play); - func_80B452EC(this, play); - SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ALIEN_INVASION | SEQ_FLAG_ASYNC); - func_80B46F88(this); - } - } else if (D_80B4E940 == 3) { - if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 6)) { - func_80B471C0(this); - - } else if (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 7)) { - func_80B47248(this); - } else { - func_80B47248(this); - } - } else if (D_80B4E940 == 4) { - func_80B47304(this); - } -} - -void EnInvadepoh_InitAlien(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, D_80B4EC24); - Collider_InitCylinder(play, &this->collider); - ActorShape_Init(&this->actor.shape, 6800.0f, ActorShadow_DrawWhiteCircle, 150.0f); - this->actor.shape.shadowAlpha = 140; - this->actor.flags = (ACTOR_FLAG_10 | ACTOR_FLAG_1000 | ACTOR_FLAG_80000000); - if (INVADEPOH_TYPE(&this->actor) == TYPE_ALIEN_CARRYING_COW) { - this->actor.update = func_80B4D670; - this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; - } else { - this->actor.update = func_80B47BAC; - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitAlien); - this->actor.colChkInfo.mass = 40; - } - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_UCH); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitParentCow(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, sInitChainParentCow); - this->actor.update = func_80B47FA8; - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_INVADEPOH, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x30); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitChildCow(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, sInitChainChildCow); - this->actor.update = func_80B481C4; - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_COW); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitRomani(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 temp = INVADEPOH_TYPE(&this->actor); - - Actor_ProcessInitChain(&this->actor, sInitChainRomani); - - this->actor.targetMode = (temp == 7 || temp == 0xC) ? 3 : 6; - - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(play, &this->collider); - if (temp != 4) { - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - } - if (temp == 4) { - this->actor.update = func_80B48620; - } else if (temp == 5) { - this->actor.update = func_80B48FB0; - this->actor.flags = (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10); - } else if (temp == 7) { - this->actor.update = func_80B49F88; - } else if (temp == 8) { - this->actor.update = func_80B4A9C8; - } else if (temp == 9) { - this->actor.update = func_80B4B0C4; - } else { - this->actor.update = func_80B4CE54; - } - - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA1); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } - - if (temp == 5) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - Actor_Kill(&this->actor); - return; - } - } else if (temp == 7) { - if (gSaveContext.save.time < CLOCK_TIME(6, 0) && gSaveContext.save.time >= CLOCK_TIME(2, 15)) { - Actor_Kill(&this->actor); - return; - } - } else if (temp != 8) { - if (temp == 9) { - if (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 6)) { - Actor_Kill(&this->actor); - return; - } - } else if (temp == 0xC) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - Actor_Kill(&this->actor); - } - D_80B503F4 = this; - } - } -} - -void func_80B468B4(EnInvadepoh* this, PlayState* play) { - Actor_ProcessInitChain(&this->actor, D_80B4EC68); - this->actor.update = func_80B49B1C; - this->actor.draw = func_80B4E3F0; - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { - this->actor.world.pos.x += D_80B4E934.x; - this->actor.world.pos.y += D_80B4E934.y + 3000.0f; - this->actor.world.pos.z += D_80B4E934.z; - func_80B491EC(this); - } else if (D_80B4E940 == 2) { - this->actor.world.pos.y += 1500.0f; - func_80B49628(this); - } else { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitDog(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, sInitChainDog); - this->actor.update = func_80B4B8BC; - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitDog); - this->actor.colChkInfo.mass = 80; - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 24.0f); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_DOG); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } -} - -void EnInvadepoh_InitCremia(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Actor_ProcessInitChain(&this->actor, sInitChainCremia); - this->actor.update = func_80B4C3A0; - func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_NPC); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInitRomaniAndCremia); - this->actor.colChkInfo.mass = MASS_HEAVY; - ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 18.0f); - this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MA2); - if (this->bankIndex < 0) { - Actor_Kill(&this->actor); - } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - Actor_Kill(&this->actor); - } - D_80B503F8 = this; -} - -void EnInvadepoh_Init(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - D_80B4ECB0[INVADEPOH_TYPE(&this->actor)](this, play); -} - -void func_80B46BB0(EnInvadepoh* this, PlayState* play) { -} - -void func_80B46BC0(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 invadepohType = this->actor.params & 7; - - Collider_DestroyCylinder(play, &this->collider); - D_80B50320[invadepohType] = 0; -} - -void func_80B46C08(EnInvadepoh* this, PlayState* play) { - if (this->actor.parent != NULL) { - this->actor.parent->child = NULL; - } - - if (this->actor.child != NULL) { - this->actor.child->parent = NULL; - } -} - -void func_80B46C34(EnInvadepoh* this, PlayState* play) { - if (this->actor.parent != NULL) { - this->actor.parent->child = NULL; - } -} - -void func_80B46C50(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); -} - -void func_80B46C7C(EnInvadepoh* this, PlayState* play) { - D_80B503F0 = NULL; -} - -void func_80B46C94(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); -} - -void func_80B46CC0(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - D_80B503F8 = NULL; -} - -void func_80B46CF4(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - D_80B503F4 = NULL; -} - -void func_80B46D28(EnInvadepoh* this, PlayState* play) { - Collider_DestroyCylinder(play, &this->collider); - if (!this) {} // required to match - if (this->actor.child != NULL) { - this->actor.child->parent = NULL; - } -} - -void EnInvadepoh_Destroy(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - D_80B4ECE8[INVADEPOH_TYPE(&this->actor)](this, play); -} - -void func_80B46DA8(EnInvadepoh* this) { - D_80B4E940 = 1; - this->actionFunc = func_80B46DC8; -} - -void func_80B46DC8(EnInvadepoh* this, PlayState* play) { - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 30))) { - func_80B454BC(this, play); - func_80B452EC(this, play); - func_80B46E20(this); - } -} - -void func_80B46E20(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionTimer = 2; - this->actionFunc = func_80B46E44; -} - -void func_80B46E44(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer > 0) { - this->actionTimer--; - } else if (ActorCutscene_GetCanPlayNext(D_80B50404[0])) { - ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[0], &this->actor); - func_80B46EC0(this); - } else { - ActorCutscene_SetIntentToPlay(D_80B50404[0]); - } -} - -void func_80B46EC0(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionTimer = 160; - this->actionFunc = func_80B46EE8; -} - -void func_80B46EE8(EnInvadepoh* this, PlayState* play) { - s32 i; - - for (i = 0; i < 8; i++) { - if (this->actionTimer == D_80B4ED20[i]) { - D_80B50340[i] |= 1; - } - } - - this->actionTimer--; - if (this->actionTimer <= 0) { - ActorCutscene_Stop(D_80B50404[0]); - SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ALIEN_INVASION | SEQ_FLAG_ASYNC); - func_80B46F88(this); - } -} - -void func_80B46F88(EnInvadepoh* this) { - D_80B4E940 = 2; - this->actionFunc = func_80B46FA8; -} - -void func_80B46FA8(EnInvadepoh* this, PlayState* play) { - s32 i; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(5, 15))) { - SET_WEEKEVENTREG(WEEKEVENTREG_22_01); - func_80B47064(this); - } else { - func_80B457A0(this); - for (i = 0; i < this->unk379; i++) { - if ((D_80B50320[i] != NULL) && (D_80B50320[i]->unk38A != 0)) { - func_80B47278(this); - break; - } - } - } -} - -void func_80B47064(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = func_80B47084; -} - -void func_80B47084(EnInvadepoh* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(D_80B50404[1])) { - ActorCutscene_StartAndSetUnkLinkFields(D_80B50404[1], &this->actor); - func_80B470E0(this); - } else { - ActorCutscene_SetIntentToPlay(D_80B50404[1]); - } -} - -void func_80B470E0(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionTimer = 110; - this->actionFunc = func_80B47108; -} - -void func_80B47108(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer == 100) { - Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); - } - this->actionTimer--; - if (this->actionTimer <= 0) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 6); - gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_73; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - D_801BDAA0 = 1; - D_801BDA9C = 0; - func_80B47248(this); - } -} - -void func_80B471C0(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = func_80B471E0; -} - -void func_80B471E0(EnInvadepoh* this, PlayState* play) { - if (D_80B4E998) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 7); - gSaveContext.nextCutsceneIndex = 0; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_72; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - func_80B47248(this); - } -} - -void func_80B47248(EnInvadepoh* this) { - D_80B4E940 = 3; - this->actionFunc = func_80B47268; -} - -void func_80B47268(EnInvadepoh* this, PlayState* play) { -} - -void func_80B47278(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = func_80B47298; -} - -void func_80B47298(EnInvadepoh* this, PlayState* play) { - play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); - gSaveContext.nextCutsceneIndex = 0xFFF3; - play->transitionTrigger = TRANS_TRIGGER_START; - play->transitionType = TRANS_TYPE_72; - gSaveContext.nextTransitionType = TRANS_TYPE_72; - SET_WEEKEVENTREG(WEEKEVENTREG_89_10); - func_80B47304(this); -} - -void func_80B47304(EnInvadepoh* this) { - D_80B4E940 = 4; - this->actionFunc = func_80B47324; -} - -void func_80B47324(EnInvadepoh* this, PlayState* play) { -} - -void EnInvadepoh_Update(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - this->actionFunc(this, play); - if (func_80B461DC()) { - this->actor.draw = func_80B4D9B4; - } else { - this->actor.draw = NULL; - } -} - -void func_80B47380(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->actor.flags &= ~ACTOR_FLAG_80000000; - this->alienAlpha = 0; - this->actor.draw = NULL; - this->drawAlien = false; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actionFunc = func_80B473E4; -} - -void func_80B473E4(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - if (D_80B50340[this->actor.params & 7] & 1) { - Actor_SetScale(&this->actor, 0.01f); - func_80B4516C(this); - func_80B46118(&this->actor.world.pos); - func_80B47568(this); - } -} - -void func_80B47478(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->actor.flags &= ~ACTOR_FLAG_80000000; - this->alienAlpha = 0; - this->actor.draw = NULL; - this->drawAlien = false; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actionFunc = func_80B474DC; -} - -void func_80B474DC(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - if (this->clockTime > 0.0f) { - Actor_SetScale(&this->actor, 0.01f); - func_80B4516C(this); - func_80B46118(&this->actor.world.pos); - func_80B47568(this); - } -} - -void func_80B47568(EnInvadepoh* this) { - Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - this->alienAlpha = 0; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B47600; -} - -void func_80B47600(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - if (this->clockTime >= 0.9999f) { - this->unk38A = 1; - } - if (this->alienAlpha > 248) { - this->alienAlpha = 255; - } else { - this->alienAlpha += 6; - } - if (this->alienAlpha > 128) { - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - } - if (this->alienAlpha == 255) { - if (this->alienBeamAlpha >= 245) { - this->alienBeamAlpha = 255; - func_80B4770C(this); - } else { - this->alienBeamAlpha += 10; - } - } -} - -void func_80B4770C(EnInvadepoh* this) { - if (this->skelAnime.animation != &gAlienFloatAnim) { - Animation_MorphToLoop(&this->skelAnime, &gAlienFloatAnim, -6.0f); - } - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B477B4; -} - -void func_80B477B4(EnInvadepoh* this, PlayState* play) { - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43DD4(this, 800, 0); - func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - if (this->clockTime >= 0.9999f) { - this->unk38A = 1; - } -} - -void func_80B47830(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 |= OC1_ON; - Animation_PlayLoop(&this->skelAnime, &gAlienJerkingAnim); - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 0; - this->actionTimer = 8; - this->counter = 0; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B478F4; -} - -void func_80B478F4(EnInvadepoh* this, PlayState* play) { - func_80B44A90(this, play); - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B47938(this); - } -} - -void func_80B47938(EnInvadepoh* this) { - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->collider.base.ocFlags1 &= ~OC1_ON; - Animation_PlayLoop(&this->skelAnime, &gAlienDeathAnim); - this->actor.flags &= ~ACTOR_FLAG_1; - this->actionTimer = 10; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->actor.flags |= ACTOR_FLAG_80000000; - this->actionFunc = func_80B479E8; -} - -void func_80B479E8(EnInvadepoh* this, PlayState* play) { - s16 unk2F2; - u32 index; - - func_80B44B78(this); - if (this->counter < 5) { - if (D_80B4ED30[this->counter].x > 0.0f) { - this->drawAlien = true; - this->alienBeamAlpha = 255; - Math_Vec3f_Copy(&this->actor.scale, &D_80B4ED30[this->counter]); - } else { - this->drawAlien = false; - this->alienBeamAlpha = 0; - } - } else { - this->drawAlien = false; - this->alienBeamAlpha = 0; - } - - unk2F2 = this->counter; - if ((unk2F2 >= 2) && (unk2F2 < 9)) { - index = unk2F2 - 2; - if (D_80B4ED6C[index].x > 0.0f) { - this->drawAlienDeathEffect = true; - Math_Vec3f_Copy(&this->alienDeathEffectScale, &D_80B4ED6C[index]); - } else { - this->drawAlienDeathEffect = false; - } - } else { - this->drawAlienDeathEffect = false; - } - - this->counter++; - if (this->actionTimer == 8) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, this->actor.world.pos.y - 10.0f, - this->actor.world.pos.z, 0, 0, 3, CLEAR_TAG_SMOKE); - } - - if (this->actionTimer == 8) { - Enemy_StartFinishingBlow(play, &this->actor); - } - - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B43AF0(this->actor.params & 7); - func_80B43AB0(); - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_30); - func_80B47478(this); - } -} - -void func_80B47BAC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B45080(); - this->actor.update = func_80B47D30; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienFloatAnim, this->jointTable, this->morphTable, - ALIEN_LIMB_MAX); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.125f; - func_80B444BC(this, play); - func_80B442E4(this); - func_80B447C0(this, play); - func_80B43F0C(this); - func_80B4516C(this); - if (D_80B4E940 == 1 || gSaveContext.save.time < CLOCK_TIME(2, 31)) { - func_80B47380(this); - } else if (D_80B4E940 == 2) { - if (this->clockTime >= 0.0001f) { - func_80B4770C(this); - } else { - func_80B47568(this); - } - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B47D30(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (D_80B4E940 == 3) { - if ((this->actionFunc == func_80B477B4) || (this->actionFunc == func_80B47600)) { - thisx->speed = 0.0f; - thisx->velocity.y = 0.0f; - thisx->gravity = 0.0f; - func_80B47830(this); - } else if ((this->actionFunc == func_80B474DC) || (this->actionFunc == func_80B473E4)) { - Actor_Kill(&this->actor); - return; - } - } else if (this->collider.base.acFlags & AC_HIT) { - Actor* acAttached = this->collider.base.ac; - - thisx->speed = acAttached->speed * 0.5f; - thisx->speed = CLAMP(thisx->speed, -60.0f, 60.0f); - thisx->world.rot.y = acAttached->world.rot.y; - thisx->gravity = 0.0f; - thisx->velocity.y = acAttached->velocity.y * 0.5f; - thisx->velocity.y = CLAMP(thisx->velocity.y, -30.0f, 30.0f); - SoundSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 50, NA_SE_EN_INVADER_DEAD); - func_80B47830(this); - } - - this->actionFunc(this, play); - if (thisx->draw != NULL) { - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - } - - Collider_UpdateCylinder(&this->actor, &this->collider); - if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.atFlags &= ~AT_HIT; - } - - if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.acFlags &= ~AC_HIT; - } - - if (this->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } else { - this->collider.base.ocFlags1 &= ~OC1_HIT; - } -} - -void func_80B47FA8(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, thisx); - this->actor.update = func_80B48060; - this->actor.draw = func_80B4E158; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowSkel, NULL, this->jointTable, this->morphTable, COW_LIMB_MAX); - Animation_PlayLoop(&this->skelAnime, &gCowMooAnim); - } -} - -void func_80B48060(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - s32 temp; - s32 pad2; - MtxF unkMtx; - - if (D_80B503F0 == NULL || this->actor.parent == NULL) { - Actor_Kill(&this->actor); - return; - } - - temp = this->actor.params & 7; - SkelAnime_Update(&this->skelAnime); - Math_ScaledStepToS(&this->actor.shape.rot.x, D_80B4EDC0[temp], 0x32); - if (this->actor.child != NULL) { - Matrix_Push(); - Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - &this->actor.shape.rot); - Matrix_Translate(0, 57.0f, -36.0f, MTXMODE_APPLY); - Matrix_RotateXS(this->actor.shape.rot.x * -0.7f, MTXMODE_APPLY); - Matrix_RotateZS(this->actor.shape.rot.z * -0.7f, MTXMODE_APPLY); - Matrix_MultZero(&this->actor.child->world.pos); - Matrix_Get(&unkMtx); - Matrix_MtxFToYXZRot(&unkMtx, &this->actor.child->shape.rot, false); - Matrix_Pop(); - } -} - -void func_80B481C4(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - this->actor.update = func_80B4827C; - this->actor.draw = func_80B4E1B0; - SkelAnime_InitFlex(play, &this->skelAnime, &gCowTailSkel, NULL, this->jointTable, this->morphTable, - COW_TAIL_LIMB_MAX); - Animation_PlayLoop(&this->skelAnime, &gCowTailSwishAnim); - } -} - -void func_80B4827C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (D_80B503F0 == NULL || this->actor.parent == NULL) { - Actor_Kill(&this->actor); - return; - } - - SkelAnime_Update(&this->skelAnime); -} - -void func_80B482D4(EnInvadepoh* this) { - this->actionTimer = 40; - Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - this->actor.draw = NULL; - this->actionFunc = func_80B48324; -} - -void func_80B48324(EnInvadepoh* this, PlayState* play) { - this->actionTimer--; - if (this->actionTimer <= 0) { - EnInvadepoh_SetTextID(this, play, 0x332F); - this->actor.draw = func_80B4E324; - func_80B48374(this); - } -} - -void func_80B48374(EnInvadepoh* this) { - this->actionTimer = 60; - Animation_MorphToLoop(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B483CC; -} - -void func_80B483CC(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer == 20) { - f32 unkFloat = 0.1f; - - this->behaviorInfo.unk26.x = 2000; - this->behaviorInfo.unk26.y = 0; - this->behaviorInfo.unk26.z = 0; - this->behaviorInfo.unk30 = unkFloat; - this->behaviorInfo.unk2C = 1000; - } - - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B4843C(this); - } -} - -void func_80B4843C(EnInvadepoh* this) { - this->behaviorInfo.unk26.x = 3000; - this->behaviorInfo.unk26.y = 0; - this->behaviorInfo.unk26.z = 0; - this->behaviorInfo.unk30 = 0.24f; - this->behaviorInfo.unk2C = 3000; - this->behaviorInfo.unk42 = 15000; - this->behaviorInfo.unk44 = 0.1f; - this->behaviorInfo.unk48 = 2000; - this->actionTimer = 50; - Animation_Change(&this->skelAnime, &gRomaniRunAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -5.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B484EC; -} - -void func_80B484EC(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer == 40) { - this->behaviorInfo.unk26.y = 7000; - } else if (this->actionTimer == 30) { - this->behaviorInfo.unk26.y = -7000; - } else if (this->actionTimer == 20) { - this->behaviorInfo.unk26.y = 7000; - } else if (this->actionTimer == 10) { - this->behaviorInfo.unk26.y = 0; - } - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B48588(this); - } -} - -void func_80B48588(EnInvadepoh* this) { - this->behaviorInfo.unk26.x = 0; - this->behaviorInfo.unk26.y = 0; - this->behaviorInfo.unk26.z = 0; - this->behaviorInfo.unk30 = 0.24f; - this->behaviorInfo.unk2C = 5000; - this->behaviorInfo.unk42 = 0; - this->behaviorInfo.unk44 = 0.28f; - this->behaviorInfo.unk48 = 7000; - Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actor.draw = func_80B4E324; - this->actionFunc = func_80B48610; -} - -void func_80B48610(EnInvadepoh* this, PlayState* play) { -} - -void func_80B48620(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B4873C; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 5000, 0.05f, 0.3f, 0.12f); - Animation_PlayLoop(&this->skelAnime, &gRomaniIdleAnim); - func_80B482D4(this); - } -} - -void func_80B4873C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - if (this->actor.parent == NULL) { - Actor_Kill(&this->actor); - return; - } - this->actionFunc(this, play); - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(substruct); - if (substruct->unk40 != 0) { - this->actor.shape.rot.x = -substruct->unk40; - } -} - -void func_80B487B4(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - u32 new_var; - - this->actionTimer = Rand_S16Offset(150, 250); - new_var = Rand_Next(); - substruct->unk26.x = D_80B4EDC8[new_var >> 0x1E]; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - this->actionFunc = func_80B48848; -} - -void func_80B48848(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speed, 1.6f, 0.1f); - if (func_80B44B84(this, play, this->actor.speed, 50.0f)) { - func_80B44514(this); - this->behaviorInfo.unk4C = 0xC8; - this->actor.speed *= 0.25f; - } else { - Math_StepToS(&this->behaviorInfo.unk4C, 0x7D0, 0x46); - } - func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x46); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B48948(this); - } -} - -void func_80B48948(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - f32 rand = Rand_ZeroOne(); - - this->actionTimer = Rand_S16Offset(150, 150); - if (rand < 0.5f) { - this->rand = 0; - Math_Vec3s_Copy(&substruct->unk26, &gZeroVec3s); - substruct->unk30 = 0.1f; - substruct->unk2C = 1000; - } else if (rand < 0.75f) { - this->rand = 1; - substruct->unk26.x = Rand_S16Offset(0, 2000); - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.06f; - substruct->unk2C = 1000; - } else if (rand < 0.8f) { - this->rand = 2; - substruct->unk26.x = Rand_S16Offset(-2000, 2000); - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.05f; - substruct->unk2C = 1000; - } else { - this->rand = 3; - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = Rand_S16Offset(-2500, 5000); - substruct->unk30 = 0.04f; - substruct->unk2C = 1000; - } - - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = func_80B48AD4; -} - -void func_80B48AD4(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player; - s16 new_var3; - s16 temp_v1; - s32 temp_v1_3; - - Math_StepToF(&this->actor.speed, 0.0f, 0.2f); - if (func_80B44B84(this, play, this->actor.speed, 50.0f)) { - func_80B44514(this); - } - - if (this->rand == 0) { - s32 requiredScopeTemp; - - if ((this->actor.xzDistToPlayer < 350.0f) && ((play->gameplayFrames & 0x60) != 0)) { - player = GET_PLAYER(play); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -2500, 2500); - new_var3 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = new_var3 * 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - } - } else { - substruct->unk26.x = 0; - substruct->unk26.y = 0; - } - - if (this->actionTimer > 0) { - temp_v1_3 = this->actionTimer & 0x1F; - if ((temp_v1_3 == 0) && (Rand_ZeroOne() < 0.3f)) { - temp_v1_3 = (s32)Rand_Next() % 4; - if (temp_v1_3 != this->rand) { - this->rand = temp_v1_3; - if (this->rand == 0) { - Math_Vec3s_Copy(&substruct->unk26, &gZeroVec3s); - substruct->unk30 = 0.07f; - } else if (this->rand == 1) { - substruct->unk26.x = Rand_S16Offset(1000, 1000); - substruct->unk26.y = Rand_S16Offset(-1000, 2000); - substruct->unk26.z = Rand_S16Offset(-800, 1600); - substruct->unk30 = 0.06f; - } else if (this->rand == 2) { - substruct->unk26.x = Rand_S16Offset(-2000, 1000); - substruct->unk26.y = Rand_S16Offset(-1000, 2000); - substruct->unk26.z = Rand_S16Offset(-800, 1600); - substruct->unk30 = 0.05f; - } else { - substruct->unk26.x = Rand_S16Offset(-1000, 2000); - substruct->unk26.y = Rand_S16Offset(-2000, 4000); - substruct->unk26.z = Rand_S16Offset(-2000, 4000); - substruct->unk30 = 0.04f; - } - } - } - - this->actionTimer--; - } else { - func_80B487B4(this); - } -} - -void func_80B48DE4(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - this->actor.speed = 0.0f; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - substruct->unk30 = 0.05f; - substruct->unk2C = 1200; - this->actionFunc = func_80B48E4C; -} - -void func_80B48E4C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 50); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 35); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff * 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B48948(this); - } -} - -void func_80B48FB0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B490F0; - this->actor.draw = func_80B4E324; - this->actor.textId = 0x3330; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniIdleAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 6, D_80B4EB00, 2, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B444F4(this, play); - EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - func_80B487B4(this); - } -} - -void func_80B490F0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B48DE4(this); - } - this->actionFunc(this, play); - if (sp2C) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B48E4C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B491EC(EnInvadepoh* this) { - this->scaleFactorAdj = 0.0f; - this->scaleStep = 0.0f; - this->unk3AA = 0; - this->actor.gravity = -15.0f; - this->scaleTarget = 1.0f; - this->actionFunc = func_80B49228; -} - -void func_80B49228(EnInvadepoh* this, PlayState* play) { - s32 pad; - f32 temp_f0; - - Actor_UpdateVelocityWithGravity(&this->actor); - this->actor.velocity.y *= 0.97f; - temp_f0 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + D_80B4E934.y + 300.0f, 0.7f, - fabsf(this->actor.velocity.y), 1.0f); - func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); - if (fabsf(temp_f0) < 1.0f) { - func_80B45EC8(this, play, 50); - func_80B492FC(this); - } -} - -void func_80B492FC(EnInvadepoh* this) { - this->actor.velocity.y *= 0.1f; - this->actionTimer = 20; - this->scaleTarget = 0.3f; - this->scaleStep = 0.03f; - this->unk3AA = 3000; - this->actionFunc = func_80B4934C; -} - -void func_80B4934C(EnInvadepoh* this, PlayState* play) { - f32 temp = this->actor.home.pos.y + D_80B4E934.y + 300.0f; - - if (this->actor.world.pos.y < temp) { - this->actor.gravity = 3.0f; - } else { - this->actor.gravity = -2.0f; - } - this->actor.velocity.y *= 0.96f; - Actor_MoveWithGravity(&this->actor); - func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); - this->actionTimer--; - if (this->actionTimer <= 0) { - func_80B49404(this); - } -} - -void func_80B49404(EnInvadepoh* this) { - this->actionTimer = 120; - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->unk3AC = 0; - this->counter = 0; - this->actor.gravity = 33.0f; - this->actionFunc = func_80B49454; -} - -void func_80B49454(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - s32 pad2; - - if (this->counter < 25) { - this->counter++; - } else { - this->counter = 0; - this->unk3AC++; - this->unk3AC = CLAMP_MAX(this->unk3AC, 4); - this->actor.gravity = 33.0f; - func_80B45EC8(this, play, 20); - } - - Math_Vec3f_Sum(&D_80B4EDD0[this->unk3AC], &this->actor.home.pos, &sp30); - if (Math3D_Vec3fDistSq(&this->actor.world.pos, &sp30) < SQ(400.0f)) { - this->actor.speed *= 0.8f; - } else { - Math_StepToF(&this->actor.speed, 170.0f, 21.0f); - this->actor.speed *= 0.98f; - } - if (func_80B450C0(&this->actor.world.pos.x, &this->actor.world.pos.z, sp30.x, sp30.z, this->actor.speed)) { - this->actor.speed = 0.0f; - } - if (sp30.y < this->actor.world.pos.y) { - Math_StepToF(&this->actor.gravity, -12.0f, 7.0f); - } else { - Math_StepToF(&this->actor.gravity, 5.0f, 4.0f); - } - this->actor.velocity.y += this->actor.gravity; - this->actor.velocity.y *= 0.97f; - this->actor.world.pos.y += this->actor.velocity.y; - func_800B9010(&this->actor, NA_SE_EV_UFO_APPEAR - SFX_FLAG); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B49628(this); - } -} - -void func_80B49628(EnInvadepoh* this) { - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actor.velocity.y *= 0.8f; - this->actionFunc = func_80B49670; -} - -void func_80B49670(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - - sp30.x = this->actor.home.pos.x; - sp30.y = this->actor.home.pos.y + 1500.0f; - sp30.z = this->actor.home.pos.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 0xA, 0xBB8, 0x64); - if ((play->gameplayFrames % 64) < 14) { - Math_StepToF(&this->actor.speed, 5.0f, 1.0f); - } else { - this->actor.speed *= 0.97f; - } - if (sp30.y < this->actor.world.pos.y) { - this->actor.gravity = -0.5f; - } else { - this->actor.gravity = 2.0f; - } - this->actor.velocity.y *= 0.97f; - Actor_MoveWithGravity(&this->actor); - if (D_80B4E940 == 3) { - func_80B499BC(this); - } -} - -void func_80B497A4(EnInvadepoh* this) { - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actionTimer = 35; - this->actor.gravity = -1.5f; - this->actionFunc = func_80B497EC; -} - -void func_80B497EC(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - - sp30.x = this->actor.home.pos.x + D_80B4E934.x; - sp30.y = this->actor.home.pos.y + D_80B4E934.y + 400.0f; - sp30.z = this->actor.home.pos.z + D_80B4E934.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); - Math_StepToF(&this->actor.speed, 70.0f, 3.0f); - if (sp30.y < this->actor.world.pos.y) { - this->actor.gravity = -2.0f; - } else { - this->actor.gravity = 2.0f; - } - this->actor.velocity.y *= 0.97f; - Actor_MoveWithGravity(&this->actor); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B49904(this); - } -} - -void func_80B49904(EnInvadepoh* this) { - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actionTimer = 60; - this->actor.gravity = 1.0f; - this->actionFunc = func_80B4994C; -} - -void func_80B4994C(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speed, 150.0f, 4.0f); - this->actor.velocity.y *= 0.95f; - Actor_MoveWithGravity(&this->actor); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - Actor_Kill(&this->actor); - } -} - -void func_80B499BC(EnInvadepoh* this) { - this->actionTimer = 40; - this->scaleTarget = 0.2f; - this->scaleStep = 0.01f; - this->unk3AA = 3000; - this->actor.speed = 0.0f; - this->actionFunc = func_80B49A00; -} - -void func_80B49A00(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp30; - - sp30.x = this->actor.home.pos.x; - sp30.y = this->actor.home.pos.y + 800.0f; - sp30.z = this->actor.home.pos.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp30), 4, 0x1F40, 0x64); - Math_StepToF(&this->actor.speed, 30.0f, 3.0f); - this->actor.velocity.y *= 0.98f; - if (sp30.y < this->actor.world.pos.y) { - this->actor.gravity = -0.5f; - } else { - this->actor.gravity = 2.0f; - } - Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B497A4(this); - } -} - -void func_80B49B1C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - f32 scale; - - this->actionFunc(this, play); - this->scaleAdjAngle += this->unk3AA; - Math_StepToF(&this->scaleFactorAdj, this->scaleTarget, this->scaleStep); - scale = Math_SinS(this->scaleAdjAngle) * this->scaleFactorAdj + 1.0f; - Actor_SetScale(&this->actor, 0.27f * scale); - Math_StepToS(&this->unk306, 600, 8); - this->actor.world.rot.y += this->unk306; - this->unk304 += 600; -} - -void func_80B49BD0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - this->actionFunc = func_80B49C38; -} - -void func_80B49C38(EnInvadepoh* this, PlayState* play) { - s32 pad; - s32 temp_v0_2; - - func_80B44570(this); - func_80B44C24(this, play); - func_80B43E6C(this, 6, 2000, 100); - if (1) {} - if (this->pathIndex == 0 || (this->pathIndex + 1) == this->endPoint) { - if (this->unk378 == 0) { - temp_v0_2 = func_800FE620(play); - if (temp_v0_2 > 0) { - temp_v0_2 = (R_TIME_SPEED * -16.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); - } - } - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (this->clockTime >= 0.9999f) { - Actor_Kill(&this->actor); - } -} - -void func_80B49DA0(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - this->behaviorInfo.unk4C = 0; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->actionFunc = func_80B49DFC; -} - -void func_80B49DFC(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 500); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f); - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - SET_WEEKEVENTREG(WEEKEVENTREG_54_10); - this->actor.textId = 0x332E; - } - func_80B49BD0(this); - } -} - -void func_80B49F88(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03, 0.3, 0.03); - func_80B44540(this, play); - func_80B44570(this); - func_80B44C24(this, play); - func_80B43F0C(this); - func_80B4516C(this); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { - this->actor.textId = 0x332E; - } else { - this->actor.textId = 0x332D; - } - - } else { - this->actor.textId = 0x332C; - } - - if (sp38 >= CLOCK_TIME(18, 0) || sp38 < CLOCK_TIME(2, 0)) { - this->actor.update = func_80B4A168; - this->actor.draw = NULL; - } else if ((sp38 < CLOCK_TIME(6, 0)) && (sp38 >= CLOCK_TIME(2, 0)) && (sp38 < CLOCK_TIME(2, 15))) { - this->actor.update = func_80B4A1B8; - this->actor.draw = func_80B4E324; - func_80B49BD0(this); - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B4A168(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 0))) { - this->actor.update = func_80B4A1B8; - this->actor.draw = func_80B4E324; - func_80B49BD0(this); - } -} - -void func_80B4A1B8(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B49DA0(this); - } - this->actionFunc(this, play); - if (sp2C && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B49DFC) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4A2C0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 1500; - this->actionTimer = Rand_S16Offset(200, 200); - this->unk304 = this->actor.shape.rot.y; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4A350; -} - -void func_80B4A350(EnInvadepoh* this, PlayState* play) { - s16 temp_v0; - s16 temp_v1_2; - s16 diff; - Vec3f sp44; - s16 sp42; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - if ((play->gameplayFrames % 256) == 0) { - Math_Vec3s_ToVec3f(&sp44, this->pathPoints); - sp42 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp44); - temp_v0 = Rand_S16Offset(-0x1F40, 0x3E80); - this->unk304 = temp_v0 + sp42; - this->behaviorInfo.unk4C = 0; - } - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk304, 6, this->behaviorInfo.unk4C, 40); - if (this->actor.xzDistToPlayer < 300.0f) { - Player* player = GET_PLAYER(play); - - temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1_2 *= 0.85f; - temp_v1_2 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1_2, -0x9C4, 0x9C4); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1_2 = diff; - temp_v1_2 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1_2, -0x1F40, 0x1F40); - if ((play->gameplayFrames % 256) == 0) { - substruct->unk26.z = Rand_S16Offset(-0x5DC, 0xBB8); - } - } else { - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - } - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B4A570(this); - } -} - -void func_80B4A570(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToPlayOnce(&this->skelAnime, &gRomaniLookAroundAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4A5E4; -} - -void func_80B4A5E4(EnInvadepoh* this, PlayState* play) { - if (this->animPlayFlag) { - func_80B4A2C0(this); - } -} - -void func_80B4A614(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, 0.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - this->actionFunc = func_80B4A67C; -} - -void func_80B4A67C(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speed, 5.0f, 1.0f); - if (func_80B44B84(this, play, this->actor.speed, 50.0f)) { - func_80B44640(this); - this->behaviorInfo.unk4C = 0x5DC; - this->actor.speed *= 0.5f; - } else { - Math_StepToS(&this->behaviorInfo.unk4C, 0x190, 0x32); - } - func_80B43E6C(this, 6, this->behaviorInfo.unk4C, 0x32); - if (this->pathIndex == 0) { - if (this->unk378 == 0) { - this->unk378 = func_80B45550(this, play, SQ(80.0f), -0xF); - } - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (this->pathIndex == this->endPoint) { - func_80B4A2C0(this); - } -} - -void func_80B4A7C0(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - this->behaviorInfo.unk4C = 0; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - this->actionFunc = func_80B4A81C; -} - -void func_80B4A81C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 500); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f); - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - - if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x332D) { - SET_WEEKEVENTREG(WEEKEVENTREG_54_10); - this->actor.textId = 0x332E; - } - if (this->pathIndex == this->endPoint) { - func_80B4A2C0(this); - } else { - func_80B4A614(this); - } - } -} - -void func_80B4A9C8(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad[2]; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 1, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B44620(this, play); - if ((sp38 < CLOCK_TIME(2, 15)) || (sp38 >= CLOCK_TIME(6, 0))) { - this->pathIndex = 0; - this->actor.update = func_80B4AB8C; - } else { - this->pathIndex = this->endPoint; - this->actor.update = func_80B4ABDC; - this->actor.draw = func_80B4E324; - func_80B4A2C0(this); - } - - EnInvadepoh_SetPathPointToWorldPos(this, this->pathIndex); - func_80B43F0C(this); - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_21_20)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_10)) { - this->actor.textId = 0x332E; - } else { - this->actor.textId = 0x332D; - } - } else { - this->actor.textId = 0x332C; - } - } -} - -void func_80B4AB8C(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && (gSaveContext.save.time >= CLOCK_TIME(2, 15))) { - this->actor.update = func_80B4ABDC; - this->actor.draw = func_80B4E324; - func_80B4A614(this); - } -} - -void func_80B4ABDC(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B4A7C0(this); - } - this->actionFunc(this, play); - if (sp2C) { - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4A81C) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 100.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4ACDC(EnInvadepoh* this) { - this->actionFunc = func_80B4ACF0; -} - -void func_80B4ACF0(EnInvadepoh* this, PlayState* play) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { - this->actor.draw = func_80B4E324; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - func_80B4AD3C(this); - } -} - -void func_80B4AD3C(EnInvadepoh* this) { - this->actor.flags |= ACTOR_FLAG_10000; - this->actionFunc = func_80B4AD60; -} - -void func_80B4AD60(EnInvadepoh* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_SetTextID(this, play, 0x3331); - func_80B4ADB8(this); - } else { - func_800B8614(&this->actor, play, 2000.0f); - } -} - -void func_80B4ADB8(EnInvadepoh* this) { - this->actionFunc = func_80B4ADCC; -} - -void func_80B4ADCC(EnInvadepoh* this, PlayState* play) { - if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - if (this->textId == 0x3331) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_22_02)) { - EnInvadepoh_SetTextID(this, play, 0x3334); - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); - return; - } - EnInvadepoh_SetTextID(this, play, 0x3333); - return; - } - if (this->textId == 0x3333) { - func_80B4AEC0(this); - } else if (this->textId == 0x3334) { - Message_CloseTextbox(play); - func_80B4B024(this); - } - } -} - -void func_80B4AEC0(EnInvadepoh* this) { - this->actionTimer = 2; - this->actionFunc = func_80B4AEDC; -} - -void func_80B4AEDC(EnInvadepoh* this, PlayState* play) { - if (this->actionTimer > 0) { - this->actionTimer--; - if (this->actionTimer == 0) { - Message_CloseTextbox(play); - } - } - if (Actor_HasParent(&this->actor, play)) { - this->actor.parent = NULL; - SET_WEEKEVENTREG(WEEKEVENTREG_22_02); - func_80B4AF80(this); - } else { - Actor_OfferGetItem(&this->actor, play, GI_MILK_BOTTLE, 2000.0f, 2000.0f); - } -} - -void func_80B4AF80(EnInvadepoh* this) { - this->actionFunc = func_80B4AF94; -} - -void func_80B4AF94(EnInvadepoh* this, PlayState* play) { - if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - EnInvadepoh_SetTextID(this, play, 0x3334); - func_80151BB4(play, 0x1E); - func_80151BB4(play, 0x1D); - func_80151BB4(play, 5); - func_80B4ADB8(this); - } else { - func_800B85E0(&this->actor, play, 2000.0f, PLAYER_IA_MINUS1); - } -} - -void func_80B4B024(EnInvadepoh* this) { - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - this->actionFunc = func_80B4B048; -} - -void func_80B4B048(EnInvadepoh* this, PlayState* play) { - if (play->msgCtx.unk120B1 == 0) { - if (play->msgCtx.msgMode == 0) { - D_80B4E998 = 1; - } else if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || - (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { - D_80B4E998 = 1; - } - } -} - -void func_80B4B0C4(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - AlienBehaviorInfo* substruct; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - this->actor.update = func_80B4B218; - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, 0.0f); - substruct = &this->behaviorInfo; - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 2000, 0.08f, 0.3f, 0.03f); - substruct->unk30 = 0.08f; - substruct->unk2C = 0x7D0; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - func_80B4ACDC(this); - } -} - -void func_80B4B218(Actor* thisx, PlayState* play) { - s16 diff; - EnInvadepoh* this = THIS; - s16 temp_v1; - s32 sp38 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - Player* player; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - this->actionFunc(this, play); - if (sp38 && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - player = GET_PLAYER(play); - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f); - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - func_80B45CE0(substruct); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4B3DC(EnInvadepoh* this) { - s32 pad; - - if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 7.0f)) { - Actor_PlaySfx(&this->actor, NA_SE_EV_MONKEY_WALK); - } -} - -void func_80B4B430(EnInvadepoh* this) { - Animation_MorphToLoop(&this->skelAnime, &gDogWalkAnim, -6.0f); - this->actionTimer = Rand_S16Offset(50, 80); - this->actionFunc = func_80B4B484; -} - -void func_80B4B484(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speed, 1.1f, 0.5f); - if (func_80B44C80(this, play)) { - func_80B44690(this); - } - func_80B4B3DC(this); - if (this->unk3BC >= 0) { - this->actionTimer = 0; - } - - if (this->actionTimer > 0) { - this->actionTimer--; - } else { - func_80B4B510(this); - } -} - -void func_80B4B510(EnInvadepoh* this) { - Animation_MorphToLoop(&this->skelAnime, &gDogRunAnim, -6.0f); - this->actionTimer = Rand_S16Offset(50, 200); - this->actionFunc = func_80B4B564; -} - -void func_80B4B564(EnInvadepoh* this, PlayState* play) { - s32 pad; - Vec3f sp28; - f32 temp_f0; - - Math_StepToF(&this->actor.speed, 3.8f, 0.45f); - - if (this->unk3BC >= 0) { - Math_Vec3s_ToVec3f(&sp28, &this->pathPoints[this->unk3BC]); - temp_f0 = Math3D_Vec3fDistSq(&this->actor.world.pos, &sp28); - if (temp_f0 < SQ(80.0f)) { - this->actor.speed *= 0.85f; - } else if (temp_f0 < SQ(150.0f)) { - this->actor.speed *= 0.93f; - } else if (temp_f0 < SQ(250.0f)) { - this->actor.speed *= 0.96f; - } - if (this->pathIndex == this->unk3BC || temp_f0 < SQ(50.0f)) { - this->actionTimer = 0; - } - } - func_80B4B3DC(this); - if (func_80B44C80(this, play)) { - func_80B44690(this); - } - - if (this->actionTimer > 0) { - this->actionTimer--; - } else if (this->unk3BC >= 0) { - if ((D_80B50348 == 0) && (Rand_ZeroOne() < 0.4f)) { - Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_GROAN); - } - func_80B4B724(this); - } else { - func_80B4B430(this); - } -} - -void func_80B4B724(EnInvadepoh* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gDogBarkAnim, -6.0f); - this->actionFunc = func_80B4B768; -} - -void func_80B4B768(EnInvadepoh* this, PlayState* play) { - s32 pad; - - Math_StepToF(&this->actor.speed, 0.0f, 1.0f); - Math_SmoothStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &D_80B5040C->actor), 5, 0x1388, - 0x64); - func_80B44E90(this, play); - if (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 19.0f)) { - Actor_PlaySfx(&this->actor, NA_SE_EV_SMALL_DOG_ANG_BARK); - } - if (this->animPlayFlag) { - func_80B4B510(this); - } -} - -void func_80B4B820(EnInvadepoh* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gDogJumpAnim, -6.0f); - this->actionFunc = func_80B4B864; -} - -void func_80B4B864(EnInvadepoh* this, PlayState* play) { - Math_StepToF(&this->actor.speed, 0.5f, 1.0f); - func_80B44E90(this, play); - if (this->animPlayFlag) { - func_80B4B510(this); - } -} - -void func_80B4B8BC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 pad; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - SkelAnime_InitFlex(play, &this->skelAnime, &gDogSkel, &gDogWalkAnim, this->jointTable, this->morphTable, - DOG_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, 0, 0, 0, 0, &gZeroVec3s, 3000, 0.1f, 0.0f, 0.0f); - func_80B44664(this, play); - EnInvadepoh_SetPathPointToWorldPos(this, 0); - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - Math_Vec3f_Copy(&this->curPathPos, &this->actor.world.pos); - if (D_80B4E940 == 2) { - this->actor.update = func_80B4BA84; - this->actor.draw = func_80B4E660; - this->actor.flags |= ACTOR_FLAG_1; - func_80B4B430(this); - } else if (D_80B4E940 == 1) { - this->actor.update = func_80B4BA30; - } else { - Actor_Kill(&this->actor); - if (!this) {} - } - } -} - -void func_80B4BA30(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (D_80B4E940 == 2) { - this->actor.update = func_80B4BA84; - this->actor.draw = func_80B4E660; - this->actor.flags |= ACTOR_FLAG_1; - func_80B4B430(this); - } -} - -void func_80B4BA84(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - s32 temp_v0_3; - s32 sp34 = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 temp_v1_2; - s32 sp2C; - s32 temp_v0_2; - s32 phi_v0; - - D_80B5040C = func_80B458D8(); - if (D_80B5040C == NULL) { - temp_v0_2 = this->unk3BC >= 0; - this->unk3BC = -1; - if (temp_v0_2) { - func_80B4B820(this); - } - } else { - sp2C = this->unk3BC; - this->unk3BC = func_80B44234(this, &D_80B5040C->actor.world.pos); - if (sp2C != this->unk3BC) { - phi_v0 = this->unk3BC - this->pathIndex; - if (phi_v0 < 0) { - phi_v0 += this->endPoint; - } - - if ((this->endPoint >> 1) < phi_v0) { - this->direction = DIRECTION_BACKWARD; - } else if (phi_v0 < (this->endPoint >> 1)) { - this->direction = DIRECTION_FORWARD; - } - } - } - - this->actionFunc(this, play); - this->animPlayFlag = SkelAnime_Update(&this->skelAnime); - if (sp34 && (this->actor.update != NULL)) { - func_80B45CE0(&this->behaviorInfo); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4BBE0(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gCremiaWalkAnim, -6.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 800; - - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4BC4C; -} - -void func_80B4BC4C(EnInvadepoh* this, PlayState* play) { - s8 temp_v0; - s16 diff; - EnInvadepoh* temp_t6 = D_80B503F4; - s16 temp_v1_2; - s32 temp_v1; - AlienBehaviorInfo* substruct = &this->behaviorInfo; - s16 temp_a0; - s16 sp40; - - if (temp_t6 != NULL) { - temp_v0 = temp_t6->pathIndex; - if (temp_v0 == 0) { - this->xzPosAdjFactor = 40.0f; - this->unk304 = -0x8000; - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - - } else if (temp_v0 < (temp_t6->endPoint - 1)) { - this->xzPosAdjFactor = 40.0f; - Math_ScaledStepToS(&this->unk304, -0x4800, 0xC8); - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - Math_StepToF(&this->xzPosAdjFactor, 5.0f, 3.0f); - Math_ScaledStepToS(&this->unk304, -0x8000, 0x12C); - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - temp_a0 = this->unk304 + temp_t6->actor.world.rot.y; - this->actor.world.pos.x = (Math_SinS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.x; - this->actor.world.pos.y = temp_t6->actor.world.pos.y; - this->actor.world.pos.z = (Math_CosS(temp_a0) * this->xzPosAdjFactor) + temp_t6->actor.world.pos.z; - func_800B4AEC(play, &this->actor, 50.0f); - func_80B4516C(this); - Math_StepToS(&this->behaviorInfo.unk4C, 0xBB8, 0x1F5); - if (Math3D_Vec3fDistSq(&this->actor.prevPos, &this->actor.world.pos) > SQ(0.01f)) { - Math_SmoothStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.prevPos, &this->actor.world.pos), - 3, this->behaviorInfo.unk4C, 0x1F4); - } - temp_v1 = (play->gameplayFrames + 0x14) % 128; - if ((temp_v1 & 0x40) != 0) { - sp40 = Math_Vec3f_Yaw(&this->actor.world.pos, &temp_t6->actor.world.pos); - if (temp_v1 == 64) { - this->behaviorInfo.unk4C = 0; - } - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp40, 6, this->behaviorInfo.unk4C, 40); - temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &temp_t6->actor.focus.pos); - temp_v1_2 *= 0.85f; - temp_v1_2 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1_2, -3000, 3000); - diff = BINANG_SUB(sp40, this->actor.shape.rot.y); - temp_v1_2 = diff; - temp_v1_2 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1_2, -8000, 8000); - } - } - - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); - } - if (gSaveContext.save.time > CLOCK_TIME(20, 15)) { - Actor_Kill(&this->actor); - } else if ((temp_t6 != NULL) && (temp_t6->actionFunc == func_80B4CB0C)) { - func_80B4C1BC(this); - } -} - -void func_80B4BFFC(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4C058; -} - -void func_80B4C058(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2500, 450); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->behaviorInfo.unk4C, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - - if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B4BBE0(this); - } -} - -void func_80B4C1BC(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gCremiaIdleAnim, -6.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4C218; -} - -void func_80B4C218(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - Actor* temp_v0; - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 200); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - - if (D_80B503F4 == NULL) { - func_80B4BBE0(this); - } else if ((D_80B503F4 != NULL) && (D_80B503F4->actionFunc != func_80B4CB0C)) { - func_80B4BBE0(this); - } -} - -void func_80B4C3A0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - s32 pad[2]; - s32 currentTime = gSaveContext.save.time; - - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44FEC(); - SkelAnime_InitFlex(play, &this->skelAnime, &gCremiaSkel, &gCremiaWalkAnim, this->jointTable, this->morphTable, - CREMIA_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EBDC, 1, D_80B4EC08, 0, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - this->actor.textId = 0x33CD; - if (currentTime < 0xD5A0) { - this->unk304 = -0x8000; - this->xzPosAdjFactor = 40.0f; - } else if (currentTime >= 0xD7D4) { - this->unk304 = -0x4800; - this->xzPosAdjFactor = 20.0f; - } else { - this->unk304 = -0x8000; - this->xzPosAdjFactor = 40.0f; - } - - if ((currentTime >= CLOCK_TIME(6, 0)) && (currentTime < 0xD573)) { - this->actor.update = func_80B4C568; - this->actor.draw = NULL; - } else if ((currentTime >= 0xD573) && (currentTime < CLOCK_TIME(20, 15))) { - this->actor.update = func_80B4C5C0; - this->actor.draw = func_80B4E7BC; - func_80B4BBE0(this); - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B4C568(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time >= 0xD573) && (gSaveContext.save.time < CLOCK_TIME(20, 15))) { - this->actor.update = func_80B4C5C0; - this->actor.draw = func_80B4E7BC; - func_80B4BBE0(this); - } -} - -void func_80B4C5C0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 6); - func_80B4BFFC(this); - } - this->actionFunc(this, play); - if (sp2C && (this->actor.update != NULL)) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4C058) && !isTalking && this->actor.isTargeted) { - func_800B8614(&this->actor, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4C6C8(EnInvadepoh* this) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - - Animation_MorphToLoop(&this->skelAnime, &gRomaniWalkAnim, -10.0f); - substruct->unk26.x = 0; - substruct->unk26.y = 0; - substruct->unk26.z = 0; - substruct->unk30 = 0.1f; - substruct->unk2C = 0x320; - this->actionFunc = func_80B4C730; -} - -void func_80B4C730(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - EnInvadepoh* sp68 = D_80B503F8; - s32 phi_a2; - s32 temp_v1_3; - s16 temp_v1_4; - s32 temp_v0_2; - Vec3f sp4C; - Vec3f sp40; - s16 diff; - s16 pad; - s16 sp3A; - s16 pad2; - - func_80B44700(this); - func_80B44EFC(this, play); - func_80B43E6C(this, 6, 2000, 100); - phi_a2 = ((this->pathIndex < this->endPoint) ? this->pathIndex : this->endPoint - 1); - - Math_Vec3s_ToVec3f(&sp4C, &this->pathPoints[phi_a2]); - Math_Vec3s_ToVec3f(&sp40, &this->pathPoints[phi_a2 + 1]); - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&sp4C, &sp40), 5, 0x7D0, 0x64); - if ((this->pathIndex == 0) || ((this->pathIndex + 1) == this->endPoint)) { - if (this->unk378 == 0) { - temp_v0_2 = func_800FE620(play); - if (temp_v0_2 > 0) { - temp_v0_2 = (R_TIME_SPEED * -23.0f / temp_v0_2) - 0.5f; - this->unk378 = func_80B45550(this, play, SQ(80.0f), temp_v0_2); - } - } - - this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - } else { - this->unk378 = 0; - this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); - } - - temp_v1_3 = play->gameplayFrames % 128; - if ((temp_v1_3 & 0x40) != 0) { - sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp68->actor.world.pos); - if (temp_v1_3 == 64) { - this->behaviorInfo.unk4C = 0; - } - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); - Math_SmoothStepToS(&this->actor.shape.rot.y, sp3A, 6, this->behaviorInfo.unk4C, 40); - temp_v1_4 = Math_Vec3f_Pitch(&this->actor.focus.pos, &sp68->actor.focus.pos); - temp_v1_4 *= 0.85f; - temp_v1_4 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1_4, -3000, 3000); - diff = BINANG_SUB(sp3A, this->actor.shape.rot.y); - temp_v1_4 = diff; - temp_v1_4 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1_4, -8000, 8000); - } - - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40) && - (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 7.0f))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_ROMANI_WALK); - } - - if (this->clockTime >= 0.9999f) { - Actor_Kill(&this->actor); - return; - } - - if ((sp68 != NULL) && (sp68->actionFunc == func_80B4C058)) { - func_80B4CC70(this); - } -} - -void func_80B4CAB0(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 4000; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4CB0C; -} - -void func_80B4CB0C(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 3000, 500); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos)); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (Actor_TextboxIsClosing(&this->actor, play)) { - func_80B4C6C8(this); - } -} - -void func_80B4CC70(EnInvadepoh* this) { - this->behaviorInfo.unk30 = 0.08f; - this->behaviorInfo.unk2C = 2000; - Animation_MorphToLoop(&this->skelAnime, &gRomaniIdleAnim, -10.0f); - this->behaviorInfo.unk4C = 0; - this->actionFunc = func_80B4CCCC; -} - -void func_80B4CCCC(EnInvadepoh* this, PlayState* play) { - AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 diff; - - Math_StepToS(&this->behaviorInfo.unk4C, 2000, 200); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); - temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); - temp_v1 *= 0.85f; - temp_v1 -= this->actor.shape.rot.x; - substruct->unk26.x = CLAMP(temp_v1, -0xBB8, 0xBB8); - diff = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); - temp_v1 = diff; - temp_v1 *= 0.7f; - substruct->unk26.y = CLAMP(temp_v1, -0x1F40, 0x1F40); - if (D_80B503F8 == NULL) { - func_80B4C6C8(this); - } else if ((D_80B503F8 != NULL) && (D_80B503F8->actionFunc != func_80B4C058)) { - func_80B4C6C8(this); - } -} - -void func_80B4CE54(Actor* thisx, PlayState* play) { - s32 pad[2]; - EnInvadepoh* this = THIS; - s32 sp38; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - sp38 = gSaveContext.save.time; - - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B44F58(); - SkelAnime_InitFlex(play, &this->skelAnime, &gRomaniSkel, &gRomaniWalkAnim, this->jointTable, this->morphTable, - ROMANI_LIMB_MAX); - func_80B45C04(&this->behaviorInfo, D_80B4EA90, 1, D_80B4EB00, 3, &gZeroVec3s, 100, 0.03f, 0.3f, 0.03f); - func_80B446D0(this, play); - this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B44700(this); - func_80B44EFC(this, play); - func_80B43F0C(this); - func_80B4516C(this); - this->actor.textId = 0x33CE; - if ((sp38 >= CLOCK_TIME(6, 0)) && (sp38 < CLOCK_TIME(20, 0))) { - this->actor.update = func_80B4CFFC; - this->actor.draw = NULL; - } else if ((sp38 >= 0xD555) && (sp38 < 0xD7E1)) { - this->actor.update = func_80B4D054; - this->actor.draw = func_80B4E324; - func_80B4C6C8(this); - } else { - Actor_Kill(&this->actor); - } - } -} - -void func_80B4CFFC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (gSaveContext.save.time < 0xD7E1)) { - this->actor.update = func_80B4D054; - this->actor.draw = func_80B4E324; - func_80B4C6C8(this); - } -} - -void func_80B4D054(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 sp2C = CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_40); - s32 isTalking = Actor_ProcessTalkRequest(&this->actor, &play->state); - - if (isTalking) { - func_80151BB4(play, 5); - func_80B4CAB0(this); - } - this->actionFunc(this, play); - if (sp2C && this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_80B45CE0(&this->behaviorInfo); - if ((this->actionFunc != func_80B4CB0C) && !isTalking && this->actor.isTargeted) { - func_800B8614(thisx, play, 350.0f); - } - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - } -} - -void func_80B4D15C(EnInvadepoh* this) { - s32 pad; - s32 temp_v1 = this->actor.params & 7; - unkstruct80B4EE0C* temp_v0; - - Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = ((this->actor.params & 7) * this->skelAnime.endFrame) * 0.25f; - this->alienAlpha = 255; - this->actor.draw = func_80B4DB14; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - temp_v0 = &D_80B4EE0C[temp_v1]; - this->velocityStep = temp_v0->unk00; - this->unk304 = temp_v1 * 0x5555; - this->actor.world.pos.x = this->actor.home.pos.x + (Math_SinS(this->unk304) * 80.0f); - this->actor.world.pos.y = this->actor.home.pos.y; - this->actor.world.pos.z = this->actor.home.pos.z + (Math_CosS(this->unk304) * 80.0f); - this->actor.shape.rot.y = this->unk304 + 0x4000; - this->behaviorInfo.unk4C = temp_v0->unk04; - this->behaviorInfo.unk4E = temp_v0->unk06; - this->actionFunc = func_80B4D290; - this->actor.velocity.y = 0.0f; -} - -void func_80B4D290(EnInvadepoh* this, PlayState* play) { - Actor* temp_v1; - f32 sp28; - - if (D_80B503F0 == NULL) { - Actor_Kill(&this->actor); - return; - } - - Math_StepToF(&this->actor.velocity.y, 15.0f, this->velocityStep); - sp28 = Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 850.0f, 0.2f, this->actor.velocity.y, - 0.01f); - this->unk304 += 0x2BC; - this->actor.world.pos.x = this->actor.home.pos.x + Math_SinS(this->unk304) * 80.0f; - this->actor.world.pos.z = this->actor.home.pos.z + Math_CosS(this->unk304) * 80.0f; - this->behaviorInfo.unk4C += this->behaviorInfo.unk4E; - this->actor.shape.rot.y += this->behaviorInfo.unk4C; - temp_v1 = this->actor.child; - - if (this->actor.child != NULL) { - this->actor.child->world.pos.x = this->actor.world.pos.x; - temp_v1->world.pos.y = this->actor.world.pos.y - 38.0f; - temp_v1->world.pos.z = this->actor.world.pos.z; - temp_v1->shape.rot.y = this->actor.shape.rot.y; - } - - if (sp28 < 5.0f) { - Actor_Kill(&this->actor); - } -} - -void func_80B4D3E4(EnInvadepoh* this) { - Animation_PlayLoop(&this->skelAnime, &gAlienHoldingCowAnim); - this->skelAnime.curFrame = (this->actor.params & 7) * this->skelAnime.endFrame * 0.25f; - this->alienAlpha = 255; - this->actor.draw = NULL; - this->drawAlien = true; - this->drawAlienDeathEffect = false; - this->alienBeamAlpha = 255; - this->unk306 = 400; - this->unk304 = 0; - this->actionTimer = 200; - this->actor.velocity.y = 0.0f; - this->actionFunc = func_80B4D480; -} - -void func_80B4D480(EnInvadepoh* this, PlayState* play) { - f32 target; - s32 pad2; - s32 sp2C = false; - f32 new_var3; - - if (this->actionTimer > 0) { - this->actionTimer--; - } - - if (this->actionTimer > 160) { - this->actor.draw = NULL; - } else { - this->actor.draw = func_80B4DB14; - if (1) {} - if ((this->actionTimer < 105) && (this->actionTimer >= 100)) { - this->actor.gravity = -1.0f; - Math_SmoothStepToS(&this->actor.shape.rot.x, 0x2000, 8, 0x320, 0x28); - } else { - this->actor.gravity = 0.7f; - Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 8, 0x320, 0x28); - } - - this->actor.velocity.y += this->actor.gravity; - this->actor.velocity.y *= 0.92f; - if (this->actionTimer > 80) { - this->actor.world.pos.y += this->actor.velocity.y; - } else { - target = (this->actor.home.pos.y + 850.0f); - sp2C = Math_StepToF(&this->actor.world.pos.y, target, fabsf(this->actor.velocity.y)); - } - - new_var3 = (this->unk304 * -0.06f + this->unk306); - new_var3 *= 0.98f; - this->unk306 = new_var3; - this->actor.shape.rot.y += this->unk306; - - if (this->actor.child != NULL) { - Actor* temp_v1 = this->actor.child; - - temp_v1->world.pos.x = this->actor.world.pos.x; - temp_v1->world.pos.y = this->actor.world.pos.y - 30.0f; - temp_v1->world.pos.z = this->actor.world.pos.z; - temp_v1->shape.rot.y = this->actor.shape.rot.y; - } - } - - if ((this->actionTimer <= 0) || sp2C) { - Actor_Kill(&this->actor); - } -} - -void func_80B4D670(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - s32 invadepohType; - - if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { - invadepohType = this->actor.params & 7; - this->actor.objBankIndex = this->bankIndex; - Actor_SetObjectDependency(play, &this->actor); - func_80B45080(); - this->actor.update = func_80B4D760; - SkelAnime_InitFlex(play, &this->skelAnime, &gAlienSkel, &gAlienHoldingCowAnim, this->jointTable, - this->morphTable, ALIEN_LIMB_MAX); - if (invadepohType < 3) { - func_80B453F4(this, play, invadepohType); - func_80B4D15C(this); - } else { - func_80B45460(this, play); - func_80B4D3E4(this); - } - } -} - -void func_80B4D760(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - this->actionFunc(this, play); - if (this->actor.update != NULL) { - SkelAnime_Update(&this->skelAnime); - func_800B9010(&this->actor, NA_SE_EN_FOLLOWERS_BEAM_PRE - SFX_FLAG); - } -} - -void func_80B4D7B8(PlayState* play) { - u32 temp_s5; - u32 temp_s6; - unkStruct80B50350* phi_s2; - s32 i; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); - for (phi_s2 = D_80B50350, i = 0; i < 10; phi_s2++, i++) { - if (phi_s2->unk1 > 0) { - temp_s5 = (play->gameplayFrames + ((0x10 * i) & 0xFF)) & 0x7F; - temp_s6 = (u8)(play->gameplayFrames * -0xF); - Matrix_Translate(phi_s2->unk4.x, phi_s2->unk4.y, phi_s2->unk4.z, MTXMODE_NEW); - Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, phi_s2->unk2); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, 0, temp_s5, 0, 0x20, 0x40, 1, 0, temp_s6, 0x20, 0x40)); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_02E510); - } - } - CLOSE_DISPS(play->state.gfxCtx); -} - -void func_80B4D9B4(Actor* thisx, PlayState* play) { - func_80B4D7B8(play); -} - -s32 func_80B4D9D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { - return false; -} - -void func_80B4D9F4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - EnInvadepoh* this = THIS; - - if ((limbIndex == 12) && (this->alienBeamAlpha != 0)) { - Matrix_Push(); - Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); - Matrix_RotateYS(-0x3830, MTXMODE_APPLY); - Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502A0); - Matrix_Pop(); - } else if ((limbIndex == 13) && (this->alienBeamAlpha != 0)) { - Matrix_Push(); - Matrix_RotateZS(-0x53ED, MTXMODE_APPLY); - Matrix_RotateYS(-0x47D0, MTXMODE_APPLY); - Matrix_Scale(1.0f, 1.0f, 1.5f, MTXMODE_APPLY); - Matrix_Get(&D_80B502E0); - Matrix_Pop(); - } - if (limbIndex == 11) { - Matrix_MultVec3f(&D_80B4EE24, &this->actor.focus.pos); - } -} - -void func_80B4DB14(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - Gfx* gfx; - GraphicsContext* spCC = play->state.gfxCtx; - - OPEN_DISPS(spCC); - func_8012C2DC(spCC); - Matrix_Push(); - if (this->drawAlien) { - Gfx* new_var6; - Gfx* spBC; - GraphicsContext* spB8; - - if (this->alienAlpha == 255) { - func_8012C28C(play->state.gfxCtx); - AnimatedMat_Draw(play, sAlienEmptyTexAnim); - Scene_SetRenderModeXlu(play, 0, 1); - gDPSetEnvColor(spCC->polyOpa.p++, 0, 0, 0, 255); - spCC->polyOpa.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, - spCC->polyOpa.p); - } else { - AnimatedMat_Draw(play, sAlienEmptyTexAnim); - Scene_SetRenderModeXlu(play, 1, 2); - gDPSetEnvColor(spCC->polyXlu.p++, 0, 0, 0, this->alienAlpha); - spCC->polyXlu.p = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - this->skelAnime.dListCount, func_80B4D9D8, func_80B4D9F4, &this->actor, - spCC->polyXlu.p); - } - - if (this->alienBeamAlpha != 0) { - AnimatedMat_Draw(play, sAlienEyeBeamTexAnim); - spB8 = play->state.gfxCtx; - gfx = spBC = spB8->polyXlu.p; - gDPPipeSync(spBC++); - gDPSetPrimColor(spBC++, 0, 255, 240, 180, 100, 60); - gDPSetEnvColor(spBC++, 255, 255, 255, this->alienBeamAlpha * (150.0f / 255.0f)); - Matrix_Mult(&D_80B502A0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spBC++, gAlienEyeBeamDL); - Matrix_Mult(&D_80B502E0, MTXMODE_NEW); - gSPMatrix(spBC++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spBC++, gAlienEyeBeamDL); - spB8->polyXlu.p = spBC; - } - } - - if (this->drawAlienDeathEffect) { - Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 68.0f, this->actor.world.pos.z, - &this->actor.shape.rot); - Matrix_Scale(this->alienDeathEffectScale.x, this->alienDeathEffectScale.y, this->alienDeathEffectScale.z, - MTXMODE_APPLY); - gSPMatrix(spCC->polyXlu.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(spCC->polyXlu.p++, gAlienDeathFlashDL); - } - - if (this->drawAlien) { - Vec3f sp80; - Vec3f sp74; - s32 alpha2; - GraphicsContext* sp6C = play->state.gfxCtx; - u32 pad; - - gfx = sp6C->polyXlu.p; - gfx = func_8012C868(gfx); - gDPSetDither(gfx++, G_CD_NOISE); - gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, - 0); - Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(60.0f, &sp80); - sp74.x = thisx->world.pos.x + sp80.x; - sp74.y = thisx->world.pos.y + sp80.y + 68.0f; - sp74.z = thisx->world.pos.z + sp80.z; - Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); - Matrix_Scale(0.25f, 0.25f, 0.25f, MTXMODE_APPLY); - alpha2 = this->alienAlpha * (100.0f / 255.0f); - gSPDisplayList(gfx++, gameplay_keep_DL_029CB0); - gDPSetPrimColor(gfx++, 0, 0, 240, 180, 100, alpha2); - gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfx++, gameplay_keep_DL_029CF0); - sp6C->polyXlu.p = gfx; - if ((this->alienAlpha > 128) && func_80B456A8(play, &sp74)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp74, 10.0f, 9.0f, 0, 0); - } - } - - Matrix_Pop(); - CLOSE_DISPS(spCC); -} - -s32 func_80B4E120(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 5) { - EnInvadepoh* this = THIS; - rot->x -= this->actor.shape.rot.x; - } - return false; -} - -void func_80B4E158(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - func_8012C5B0(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E120, NULL, &this->actor); -} - -void func_80B4E1B0(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - func_8012C5B0(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, - NULL, &this->actor); -} - -s32 func_80B4E200(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == ROMANI_LIMB_HEAD) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += this->behaviorInfo.unk20.y; - rot->y += this->behaviorInfo.unk20.z; - rot->z += this->behaviorInfo.unk20.x; - } else if (limbIndex == ROMANI_LIMB_TORSO) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y); - rot->z += this->behaviorInfo.unk40; - } - return false; -} - -void func_80B4E2AC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == ROMANI_LIMB_LEFT_HAND) { - OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); - CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == ROMANI_LIMB_HEAD) { - Matrix_MultVec3f(&D_80B4EE30, &this->actor.focus.pos); - } -} - -void func_80B4E324(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sRomaniMouthTextures[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, sRomaniEyeTextures[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E200, func_80B4E2AC, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} - -void func_80B4E3F0(Actor* thisx, PlayState* play) { - s32 pad; - EnInvadepoh* this = THIS; - Vec3f sp5C; - - Matrix_Push(); - Matrix_Mult(&play->billboardMtxF, MTXMODE_NEW); - Matrix_MultVecZ(200.0f, &sp5C); - Matrix_Pop(); - sp5C.x += thisx->world.pos.x; - sp5C.y += thisx->world.pos.y; - sp5C.z += thisx->world.pos.z; - EnInvadepoh_SetSysMatrix(&sp5C); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_RotateZS(this->unk304, MTXMODE_APPLY); - OPEN_DISPS(play->state.gfxCtx); - func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(POLY_XLU_DISP++, 0xFF, 0x80, 255, 255, 0, 180); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 50, 0, 0); - gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); - if (func_80B456A8(play, &sp5C)) { - func_800F9824(play, &play->envCtx, &play->view, play->state.gfxCtx, sp5C, 20.0f, 9.0f, 0, 0); - } - - CLOSE_DISPS(play->state.gfxCtx); -} - -s32 func_80B4E5B0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if ((limbIndex == DOG_LIMB_HEAD) || (limbIndex == DOG_LIMB_RIGHT_FACE_HAIR) || - (limbIndex == DOG_LIMB_LEFT_FACE_HAIR)) { - EnInvadepoh* this = THIS; - - rot->x += this->behaviorInfo.unk20.x; - rot->y += this->behaviorInfo.unk20.y; - rot->z += this->behaviorInfo.unk20.z; - } - - return false; -} - -void func_80B4E61C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == DOG_LIMB_HEAD) { - Matrix_MultVecY(20.0f, &this->actor.focus.pos); - } -} - -void func_80B4E660(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 200, 0); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E5B0, func_80B4E61C, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} - -s32 func_80B4E6E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if (limbIndex == 9) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += this->behaviorInfo.unk20.y; - rot->y += this->behaviorInfo.unk20.z; - rot->z += this->behaviorInfo.unk20.x; - } else if (limbIndex == 2) { - EnInvadepoh* this = THIS; // both of these needed to match - - rot->x += (s16)(this->behaviorInfo.unk34 * this->behaviorInfo.unk20.y); - } - return false; -} - -void func_80B4E784(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - EnInvadepoh* this = THIS; - - if (limbIndex == 9) { - Matrix_MultZero(&this->actor.focus.pos); - } -} - -void func_80B4E7BC(Actor* thisx, PlayState* play) { - EnInvadepoh* this = THIS; - - OPEN_DISPS(play->state.gfxCtx); - func_8012C28C(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x09, sCremiaMouthTextures[this->behaviorInfo.unk10.unkF]); - gSPSegment(POLY_OPA_DISP++, 0x08, sCremiaEyeTextures[this->behaviorInfo.unk0.unkF]); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B4E6E4, func_80B4E784, &this->actor); - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45980.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B459E8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A4C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45A94.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45B1C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45BB8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45C04.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45CE0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B45EC8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46118.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46184.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B461DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4627C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46414.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46520.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B465CC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46644.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B468B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B469C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46A80.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Init.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46BC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C08.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C34.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C50.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C7C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46C94.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46CF4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46D28.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Destroy.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DA8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46DC8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E20.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46E44.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46EE8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46F88.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B46FA8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47064.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47084.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B470E0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47108.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B471E0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47248.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47268.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47278.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47298.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47304.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47324.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/EnInvadepoh_Update.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47380.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B473E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47478.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B474DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47568.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47600.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4770C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B477B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47830.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B478F4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47938.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B479E8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47BAC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47D30.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B47FA8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48060.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B481C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4827C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B482D4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48324.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48374.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B483CC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4843C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B484EC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48588.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48610.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48620.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4873C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B487B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48848.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48948.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48AD4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48DE4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48E4C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B48FB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B490F0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B491EC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49228.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B492FC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4934C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49404.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49454.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49628.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49670.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497A4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B497EC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49904.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4994C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B499BC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49A00.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49B1C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49BD0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49C38.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DA0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49DFC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B49F88.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A168.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A1B8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A2C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A350.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A570.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A5E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A614.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A67C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A7C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A81C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4A9C8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AB8C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ABDC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACDC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ACF0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD3C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AD60.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADB8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4ADCC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEC0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AEDC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF80.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4AF94.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B024.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B048.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B0C4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B218.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B3DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B430.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B484.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B510.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B564.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B724.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B768.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B820.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B864.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4B8BC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA30.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BA84.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BBE0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BC4C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4BFFC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C058.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C1BC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C218.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C3A0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C568.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C5C0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C6C8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4C730.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CAB0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CB0C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CC70.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CCCC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CE54.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4CFFC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D054.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D15C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D290.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D3E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D480.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D670.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D760.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D7B8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9B4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9D8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4D9F4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4DB14.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E120.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E158.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E1B0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E200.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E2AC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E324.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E3F0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E5B0.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E61C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E660.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E6E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E784.s") + +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invadepoh/func_80B4E7BC.s") diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h index 061d9c326..54253ad03 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.h @@ -5,151 +5,9 @@ struct EnInvadepoh; -typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh*, PlayState*); -typedef void (*EnInvadepohDestroyFunc)(struct EnInvadepoh*, PlayState*); -typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh*, PlayState*); - -#define INVADEPOH_TYPE(thisx) (((thisx)->params >> 4) & 0xF) - -typedef enum{ - /* 0 */ TYPE_UNK0, - /* 1 */ TYPE_ALIEN, - /* 2 */ TYPE_PARENT_COW, - /* 3 */ TYPE_CHILD_COW, - /* 4 */ TYPE_ROMANI, - /* 5 */ TYPE_ROMANI1, - /* 6 */ TYPE_UNK6, - /* 7 */ TYPE_ROMANI2, - /* 8 */ TYPE_ROMANI3, - /* 9 */ TYPE_ROMANI4, - /* 10 */ TYPE_DOG, - /* 11 */ TYPE_CREMIA, - /* 12 */ TYPE_ROMANI5, - /* 13 */ TYPE_ALIEN_CARRYING_COW -} EnInvadepohType; - -typedef enum { - /* -1 */ DIRECTION_BACKWARD = -1, - /* 1 */ DIRECTION_FORWARD = 1, -} EnInvadepohDirection; - -typedef struct unkStruct80B50350 { - /* 0x0 */ s8 unk0; - /* 0x1 */ s8 unk1; - /* 0x2 */ u8 unk2; - /* 0x4 */ Vec3f unk4; -} unkStruct80B50350; // size = 0x10; - -typedef struct { - /* 0x0 */ s8* unk00; - /* 0x4 */ s8 unk04; -} unkstructInvadepoh0; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk00; - /* 0x4 */ f32 unk04; -} unkstructInvadepoh1; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk00; - /* 0x4 */ unkstructInvadepoh0* unk04; -} unkstructInvadepoh2; // size = 0x8 - -typedef struct { - /* 0x0 */ s8 unk0; - /* 0x4 */ unkstructInvadepoh0* unk4; - /* 0x8 */ s8 unk8; - /* 0xC */ unkstructInvadepoh1* unkC; -} unkstructInvadepoh3; // size = 0x10 - -typedef struct { - /* 0x00 */ s8 unk00; - /* 0x04 */ unkstructInvadepoh0* unk04; - /* 0x08 */ s8 unk08; - /* 0x0C */ unkstructInvadepoh1* unk0C; - /* 0x10 */ s16 unk10; - /* 0x12 */ s16 unk12; -} unkstructInvadepoh4; // size = 0x14 - -typedef struct { - /* 0x0 */ f32 unk00; - /* 0x4 */ s16 unk04; - /* 0x6 */ s16 unk06; -} unkstruct80B4EE0C; // size = 0x8 - -typedef struct EnInvadePohStruct { - /* 0x0 */ unkstructInvadepoh4* unk0; - /* 0x4 */ s8 unk4; - /* 0x8 */ unkstructInvadepoh4* unk8; - /* 0xC */ s16 unkC; - /* 0xE */ s8 unkE; - /* 0xF */ s8 unkF; -} EnInvadePohStruct; // size = 0x10; - -typedef struct AlienBehaviorInfo { - /* 0x00 */ EnInvadePohStruct unk0; - /* 0x10 */ EnInvadePohStruct unk10; - /* 0x20 */ Vec3s unk20; - /* 0x26 */ Vec3s unk26; - /* 0x2C */ s16 unk2C; - /* 0x2E */ u16 unk2E; - /* 0x30 */ f32 unk30; - /* 0x34 */ f32 unk34; - /* 0x38 */ f32 unk38; - /* 0x3C */ f32 unk3C; - /* 0x40 */ s16 unk40; - /* 0x42 */ s16 unk42; - /* 0x44 */ f32 unk44; - /* 0x48 */ s16 unk48; - /* 0x4A */ UNK_TYPE1 unk4A[0x2]; - /* 0x4C */ s16 unk4C; - /* 0x4E */ s16 unk4E; -} AlienBehaviorInfo; // size = 0x50 - typedef struct EnInvadepoh { /* 0x000 */ Actor actor; - /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[23]; - /* 0x212 */ Vec3s morphTable[23]; - /* 0x29C */ s8 animPlayFlag; - /* 0x2A0 */ ColliderCylinder collider; - /* 0x2EC */ EnInvadepohActionFunc actionFunc; - /* 0x2F0 */ s16 actionTimer; - /* 0x2F2 */ s16 counter; // general counter variable - /* 0x2F4 */ s8 bankIndex; - /* 0x2F8 */ f32 xzPosAdjFactor; - /* 0x2FC */ UNK_TYPE unk2FC; // unused - /* 0x300 */ f32 velocityStep; - /* 0x304 */ s16 unk304; // angle of some sort - /* 0x306 */ s16 unk306; - /* 0x308 */ s8 endPoint; - /* 0x309 */ s8 pathIndex; - /* 0x30A */ s8 direction; // only ever 1 or -1 - /* 0x30C */ Vec3s* pathPoints; - /* 0x310 */ f32 pathTotalDist; - /* 0x314 */ Vec3f curPathPos; - /* 0x320 */ f32 clockTime; - /* 0x324 */ AlienBehaviorInfo behaviorInfo; - /* 0x374 */ s8 rand; - /* 0x376 */ u16 textId; - /* 0x378 */ s8 unk378; - /* 0x379 */ s8 unk379; - /* 0x37C */ f32 unk37C[3]; - /* 0x388 */ s8 unk388; // unused - /* 0x389 */ u8 alienAlpha; - /* 0x38A */ s8 unk38A; // bool - /* 0x38B */ s8 drawAlien; - /* 0x38C */ s8 drawAlienDeathEffect; - /* 0x38D */ u8 alienBeamAlpha; - /* 0x390 */ Vec3f alienDeathEffectScale; - /* 0x39C */ f32 scaleFactorAdj; - /* 0x3A0 */ f32 scaleTarget; - /* 0x3A4 */ f32 scaleStep; - /* 0x3A8 */ s16 scaleAdjAngle; - /* 0x3AA */ s16 unk3AA; - /* 0x3AC */ s8 unk3AC; // index for D_80B4EDD0 - /* 0x3AD */ UNK_TYPE1 unk3AD[0xF]; - /* 0x3BC */ s8 unk3BC; + /* 0x144 */ char unk_144[0x27C]; } EnInvadepoh; // size = 0x3C0 #endif // Z_EN_INVADEPOH_H diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index 145c0507d..ac717641b 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -229,6 +229,7 @@ void EnPoFusen_IncrementRomaniPop(EnPoFusen* this) { if ((parent != NULL) && (parent->id == ACTOR_EN_MA4)) { EnMa4* romani = (EnMa4*)parent; + romani->poppedBalloonCounter++; } diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index f4a46eeae..c41f45579 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -1,9 +1,3 @@ -/* - * File: z_item_b_heart.c - * Overlay: ovl_Item_B_Heart - * Description: Heart Container - */ - #include "z_item_b_heart.h" #include "objects/object_gi_hearts/object_gi_hearts.h" @@ -16,9 +10,8 @@ void ItemBHeart_Destroy(Actor* thisx, PlayState* play); void ItemBHeart_Update(Actor* thisx, PlayState* play); void ItemBHeart_Draw(Actor* thisx, PlayState* play); -void func_808BCF54(ItemBHeart* this, PlayState* play); - -ActorInit Item_B_Heart_InitVars = { +/* +const ActorInit Item_B_Heart_InitVars = { ACTOR_ITEM_B_HEART, ACTORCAT_BOSS, FLAGS, @@ -27,89 +20,16 @@ ActorInit Item_B_Heart_InitVars = { (ActorFunc)ItemBHeart_Init, (ActorFunc)ItemBHeart_Destroy, (ActorFunc)ItemBHeart_Update, - (ActorFunc)ItemBHeart_Draw, + (ActorFunc)ItemBHeart_Draw }; +*/ -static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F_DIV1000(scale, 0, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Init.s") -void ItemBHeart_Init(Actor* thisx, PlayState* play) { - ItemBHeart* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Destroy.s") - if (Flags_GetCollectible(play, 0x1F)) { - Actor_Kill(&this->actor); - return; - } +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Update.s") - Actor_ProcessInitChain(&this->actor, sInitChain); - ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.8f); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/func_808BCF54.s") - if (this->actor.params == 0x23) { - this->unk_168 = 0.1f; - } else { - this->unk_168 = 1.0f; - } - - this->actor.world.pos.y += (20.0f * this->unk_168); -} - -void ItemBHeart_Destroy(Actor* thisx, PlayState* play) { -} - -void ItemBHeart_Update(Actor* thisx, PlayState* play) { - ItemBHeart* this = THIS; - - func_808BCF54(this, play); - - if (!(this->unk_168 < 0.5f)) { - if (Actor_HasParent(&this->actor, play)) { - Flags_SetCollectible(play, 0x1F); - Actor_Kill(&this->actor); - return; - } - - Actor_OfferGetItem(&this->actor, play, GI_HEART_CONTAINER, 30.0f, 80.0f); - } -} - -void func_808BCF54(ItemBHeart* this, PlayState* play) { - this->actor.shape.rot.y += 0x400; - Math_ApproachF(&this->unk_164, 0.4f, 0.1f, 0.01f); - Actor_SetScale(&this->actor, this->unk_164 * this->unk_168); -} - -void ItemBHeart_Draw(Actor* thisx, PlayState* play) { - ItemBHeart* this = THIS; - Actor* blueWarpActor; - u8 flag = false; - - OPEN_DISPS(play->state.gfxCtx); - - blueWarpActor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; - - while (blueWarpActor != NULL) { - if ((blueWarpActor->id == ACTOR_DOOR_WARP1) && (blueWarpActor->projectedPos.z > this->actor.projectedPos.z)) { - flag = true; - break; - } - blueWarpActor = blueWarpActor->next; - } - - if (flag || thisx->world.rot.y != 0) { - func_8012C2DC(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, gGiHeartBorderDL); - gSPDisplayList(POLY_XLU_DISP++, gGiHeartContainerDL); - } else { - func_8012C28C(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gGiHeartBorderDL); - gSPDisplayList(POLY_OPA_DISP++, gGiHeartContainerDL); - } - - CLOSE_DISPS(play->state.gfxCtx); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Item_B_Heart/ItemBHeart_Draw.s") diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h index f7ff62fa9..4e3126e25 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h @@ -7,8 +7,7 @@ struct ItemBHeart; typedef struct ItemBHeart { /* 0x000 */ Actor actor; - /* 0x144 */ UNK_TYPE1 unk_144[0x20]; - /* 0x164 */ f32 unk_164; + /* 0x144 */ UNK_TYPE1 unk_144[0x24]; /* 0x168 */ f32 unk_168; } ItemBHeart; // size = 0x16C diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index cc5e1caf1..e5e53000a 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -1,13 +1,4 @@ -/* - * File: z_obj_boyo.c - * Overlay: ovl_Obj_Boyo - * Description: Unused Bumper - */ - #include "z_obj_boyo.h" -#include "overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h" -#include "overlays/actors/ovl_En_Bom/z_en_bom.h" -#include "objects/object_boyo/object_boyo.h" #define FLAGS (ACTOR_FLAG_10) @@ -18,7 +9,8 @@ void ObjBoyo_Destroy(Actor* thisx, PlayState* play2); void ObjBoyo_Update(Actor* thisx, PlayState* play2); void ObjBoyo_Draw(Actor* thisx, PlayState* play); -ActorInit Obj_Boyo_InitVars = { +/* +const ActorInit Obj_Boyo_InitVars = { ACTOR_OBJ_BOYO, ACTORCAT_PROP, FLAGS, @@ -27,158 +19,22 @@ ActorInit Obj_Boyo_InitVars = { (ActorFunc)ObjBoyo_Init, (ActorFunc)ObjBoyo_Destroy, (ActorFunc)ObjBoyo_Update, - (ActorFunc)ObjBoyo_Draw, + (ActorFunc)ObjBoyo_Draw }; +*/ -static ColliderCylinderInit sCylinderInit = { - { - COLTYPE_NONE, - AT_NONE, - AC_ON | AC_HARD | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEMTYPE_UNK0, - { 0x00000000, 0x00, 0x00 }, - { 0x01CBFFBE, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_ON, - OCELEM_ON, - }, - { 60, 140, 0, { 0, 0, 0 } }, -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Init.s") -static InitChainEntry sInitChain[] = { - ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneScale, 300, ICHAIN_CONTINUE), - ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), -}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Destroy.s") -void ObjBoyo_Init(Actor* thisx, PlayState* play) { - ObjBoyo* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5DC0.s") - Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->collider); - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->unk_190 = Lib_SegmentedToVirtual(object_boyo_Matanimheader_000E88); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5DE0.s") -void ObjBoyo_Destroy(Actor* thisx, PlayState* play2) { - PlayState* play = play2; - ObjBoyo* this = THIS; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5E14.s") - Collider_DestroyCylinder(play, &this->collider); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/func_809A5E24.s") -void ObjBoyo_UpdatePlayerBumpValues(ObjBoyo* this, Player* target) { - target->unk_B80 = 30.0f; - target->unk_B84 = this->actor.yawTowardsPlayer; -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Update.s") -void ObjBoyo_UpdatePirateBumpValues(ObjBoyo* src, EnKaizoku* target) { - target->unk_2F0 = 30.0f; - target->unk_2F4 = Actor_WorldYawTowardActor(&src->actor, &target->picto.actor); -} - -void ObjBoyo_UpdateBombBumpValues(ObjBoyo* src, EnBom* target) { - target->timer = 0; -} - -BumperCollideInfo sBumperCollideInfo[] = { - { ACTOR_PLAYER, (BumperCollideActorFunc)ObjBoyo_UpdatePlayerBumpValues }, - { ACTOR_EN_KAIZOKU, (BumperCollideActorFunc)ObjBoyo_UpdatePirateBumpValues }, - { ACTOR_EN_BOM, (BumperCollideActorFunc)ObjBoyo_UpdateBombBumpValues }, -}; - -Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, PlayState* play, s32* num) { - Actor* collideActor; - BumperCollideInfo* collideInfo; - s32 i; - - if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { - *num = 0; - return &GET_PLAYER(play)->actor; - } - - if (this->collider.base.ocFlags1 & OC2_UNK1) { - for (collideActor = this->collider.base.oc, collideInfo = &sBumperCollideInfo[1], i = 1; i < 3; - collideInfo++, i++) { - if (collideInfo->id == collideActor->id) { - *num = i; - return collideActor; - } - } - } - - return NULL; -} - -void ObjBoyo_Update(Actor* thisx, PlayState* play2) { - PlayState* play = play2; - ObjBoyo* this = THIS; - Actor* target; - s32 num; - - target = ObjBoyo_GetCollidedActor(this, play, &num); - - if (target != NULL) { - sBumperCollideInfo[num].actorCollideFunc(this, (void*)target); - this->unk_194 = 100; - this->unk_196 = 3; - this->unk_198 = 0.01f; - this->unk_19C = this->unk_1A0 = 0.03f; - this->unk_1A4 = 0x3F40; - this->unk_1A6 = 2000; - this->unk_1A8 = 0; - this->unk_1AA = 0x2DF7; - this->unk_1AC = 600; - } - - if (this->unk_194 > 0) { - this->unk_194 -= this->unk_196; - this->unk_1AA += this->unk_1AC; - this->unk_1A8 += this->unk_1AA; - - this->actor.scale.x = this->actor.scale.z = - (Math_CosS(this->unk_1A8 + this->unk_1A4) * this->unk_194 * this->unk_19C * this->unk_198) + 0.1f; - this->actor.scale.y = - (Math_CosS(this->unk_1A8 + this->unk_1A6) * this->unk_194 * this->unk_1A0 * this->unk_198) + 0.1f; - } else { - Actor_SetScale(&this->actor, 0.1f); - - if (this->collider.base.acFlags & AC_HIT) { - this->unk_194 = 30; - this->unk_196 = 2; - this->unk_198 = 0.033333335f; - this->unk_19C = 0.012f; - this->unk_1A0 = 0.006f; - this->unk_1A4 = 0x3F40; - this->unk_1A6 = 2000; - this->unk_1A8 = 0; - this->unk_1AA = 15000; - this->unk_1AC = 1600; - } - } - - this->collider.base.acFlags &= ~AC_HIT; - this->collider.base.ocFlags1 &= ~OC1_HIT; - this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - - if (thisx->xzDistToPlayer < 2000.0f) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - } -} - -void ObjBoyo_Draw(Actor* thisx, PlayState* play) { - ObjBoyo* this = THIS; - - AnimatedMat_Draw(play, this->unk_190); - Gfx_DrawDListOpa(play, object_boyo_DL_000300); -} +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Boyo/ObjBoyo_Draw.s") diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h index dcff2a893..feb95dcd1 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.h @@ -5,27 +5,9 @@ struct ObjBoyo; -typedef void (*BumperCollideActorFunc)(struct ObjBoyo*, void*); - -typedef struct { - /* 0x0 */ s16 id; - /* 0x4 */ BumperCollideActorFunc actorCollideFunc; -} BumperCollideInfo; // size = 0x8 - typedef struct ObjBoyo { /* 0x000 */ Actor actor; - /* 0x144 */ ColliderCylinder collider; - /* 0x190 */ AnimatedMaterial* unk_190; - /* 0x194 */ s16 unk_194; - /* 0x196 */ s16 unk_196; - /* 0x198 */ f32 unk_198; - /* 0x19C */ f32 unk_19C; - /* 0x1A0 */ f32 unk_1A0; - /* 0x1A4 */ s16 unk_1A4; - /* 0x1A6 */ s16 unk_1A6; - /* 0x1A8 */ s16 unk_1A8; - /* 0x1AA */ s16 unk_1AA; - /* 0x1AC */ s16 unk_1AC; + /* 0x144 */ char unk_144[0x6C]; } ObjBoyo; // size = 0x1B0 #endif // Z_OBJ_BOYO_H diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 5ac01aab6..01917fd8c 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -8682,7 +8682,7 @@ 0x809A20FC:("EnMm2_WaitForRead",), 0x809A2194:("EnMm2_Update",), 0x809A21B8:("EnMm2_Draw",), - 0x809A2B60:("DoorSpiral_SetupAction",), + 0x809A2B60:("func_809A2B60",), 0x809A2B70:("func_809A2B70",), 0x809A2BF8:("func_809A2BF8",), 0x809A2C78:("DoorSpiral_Init",), @@ -13735,9 +13735,9 @@ 0x80B43DD4:("func_80B43DD4",), 0x80B43E6C:("func_80B43E6C",), 0x80B43F0C:("func_80B43F0C",), - 0x80B43F70:("EnInvadepoh_GetTotalPathDistance",), + 0x80B43F70:("func_80B43F70",), 0x80B44024:("func_80B44024",), - 0x80B4407C:("EnInvadepoh_SetPathPointToWorldPos",), + 0x80B4407C:("func_80B4407C",), 0x80B440B8:("func_80B440B8",), 0x80B44234:("func_80B44234",), 0x80B442E4:("func_80B442E4",), @@ -13771,9 +13771,9 @@ 0x80B453F4:("func_80B453F4",), 0x80B45460:("func_80B45460",), 0x80B454BC:("func_80B454BC",), - 0x80B45518:("EnInvadepoh_SetSysMatrix",), + 0x80B45518:("func_80B45518",), 0x80B45550:("func_80B45550",), - 0x80B4560C:("EnInvadepoh_SetTextID",), + 0x80B4560C:("func_80B4560C",), 0x80B45648:("func_80B45648",), 0x80B456A8:("func_80B456A8",), 0x80B457A0:("func_80B457A0",), @@ -13791,13 +13791,13 @@ 0x80B46184:("func_80B46184",), 0x80B461DC:("func_80B461DC",), 0x80B4627C:("func_80B4627C",), - 0x80B46414:("EnInvadepoh_InitAlien",), - 0x80B46520:("EnInvadepoh_InitParentCow",), - 0x80B465CC:("EnInvadepoh_InitChildCow",), - 0x80B46644:("EnInvadepoh_InitRomani",), + 0x80B46414:("func_80B46414",), + 0x80B46520:("func_80B46520",), + 0x80B465CC:("func_80B465CC",), + 0x80B46644:("func_80B46644",), 0x80B468B4:("func_80B468B4",), - 0x80B469C4:("EnInvadepoh_InitDog",), - 0x80B46A80:("EnInvadepoh_InitCremia",), + 0x80B469C4:("func_80B469C4",), + 0x80B46A80:("func_80B46A80",), 0x80B46B74:("EnInvadepoh_Init",), 0x80B46BB0:("func_80B46BB0",), 0x80B46BC0:("func_80B46BC0",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 7455f7c2c..0b44baae3 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -9511,7 +9511,7 @@ 0x809A6150:("Obj_Boyo_InitVars","UNK_TYPE1","",0x1), 0x809A6170:("D_809A6170","UNK_TYPE1","",0x1), 0x809A619C:("D_809A619C","UNK_TYPE1","",0x1), - 0x809A61B0:("sBumperCollideInfo","UNK_TYPE1","",0x1), + 0x809A61B0:("D_809A61B0","UNK_TYPE1","",0x1), 0x809A61B4:("D_809A61B4","UNK_TYPE2","",0x2), 0x809A61D0:("D_809A61D0","f32","",0x4), 0x809A61D4:("D_809A61D4","f32","",0x4), @@ -14328,11 +14328,11 @@ 0x80B4E934:("D_80B4E934","UNK_TYPE4","",0x4), 0x80B4E938:("D_80B4E938","f32","",0x4), 0x80B4E940:("D_80B4E940","UNK_TYPE4","",0x4), - 0x80B4E944:("sRomaniEyeTextures","UNK_TYPE4","",0x4), - 0x80B4E958:("sRomaniMouthTextures","UNK_TYPE4","",0x4), + 0x80B4E944:("D_80B4E944","UNK_TYPE4","",0x4), + 0x80B4E958:("D_80B4E958","UNK_TYPE4","",0x4), 0x80B4E968:("D_80B4E968","UNK_TYPE1","",0x1), - 0x80B4E96C:("sCremiaEyeTextures","UNK_TYPE4","",0x4), - 0x80B4E984:("sCremiaMouthTextures","UNK_TYPE4","",0x4), + 0x80B4E96C:("D_80B4E96C","UNK_TYPE4","",0x4), + 0x80B4E984:("D_80B4E984","UNK_TYPE4","",0x4), 0x80B4E994:("D_80B4E994","UNK_TYPE1","",0x1), 0x80B4E998:("D_80B4E998","UNK_TYPE1","",0x1), 0x80B4E99C:("D_80B4E99C","UNK_TYPE1","",0x1), @@ -14418,6 +14418,21 @@ 0x80B4EE0C:("D_80B4EE0C","UNK_TYPE1","",0x1), 0x80B4EE24:("D_80B4EE24","UNK_TYPE1","",0x1), 0x80B4EE30:("D_80B4EE30","UNK_TYPE1","",0x1), + 0x80B4EE40:("D_80B4EE40","f32","",0x4), + 0x80B4EE44:("D_80B4EE44","f32","",0x4), + 0x80B4EE48:("D_80B4EE48","f32","",0x4), + 0x80B4EE4C:("D_80B4EE4C","f32","",0x4), + 0x80B4EE50:("D_80B4EE50","f32","",0x4), + 0x80B4EE54:("D_80B4EE54","f32","",0x4), + 0x80B4EE58:("D_80B4EE58","f32","",0x4), + 0x80B4EE5C:("D_80B4EE5C","f32","",0x4), + 0x80B4EE60:("D_80B4EE60","f32","",0x4), + 0x80B4EE64:("D_80B4EE64","f32","",0x4), + 0x80B4EE68:("D_80B4EE68","f32","",0x4), + 0x80B4EE6C:("D_80B4EE6C","f32","",0x4), + 0x80B4EE70:("D_80B4EE70","f32","",0x4), + 0x80B4EE74:("D_80B4EE74","f32","",0x4), + 0x80B4EE78:("D_80B4EE78","f32","",0x4), 0x80B4EE7C:("D_80B4EE7C","f32","",0x4), 0x80B4EE80:("D_80B4EE80","f32","",0x4), 0x80B4EE84:("D_80B4EE84","f32","",0x4), @@ -14558,8 +14573,8 @@ 0x80B503F0:("D_80B503F0","UNK_TYPE4","",0x4), 0x80B503F4:("D_80B503F4","UNK_TYPE4","",0x4), 0x80B503F8:("D_80B503F8","UNK_TYPE4","",0x4), - 0x80B503FC:("sAlienEyeBeamTexAnim","UNK_TYPE4","",0x4), - 0x80B50400:("sAlienEmptyTexAnim","UNK_TYPE4","",0x4), + 0x80B503FC:("D_80B503FC","UNK_TYPE4","",0x4), + 0x80B50400:("D_80B50400","UNK_TYPE4","",0x4), 0x80B50404:("D_80B50404","UNK_TYPE2","",0x2), 0x80B50406:("D_80B50406","UNK_TYPE2","",0x2), 0x80B5040A:("D_80B5040A","UNK_TYPE1","",0x1), diff --git a/undefined_syms.txt b/undefined_syms.txt index 1809e1600..f0578ff16 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -574,6 +574,22 @@ D_06001680 = 0x06001680; D_06000288 = 0x06000288; +// ovl_Bg_Keikoku_Spr + +D_06000100 = 0x06000100; +D_060001F8 = 0x060001F8; +D_060003F8 = 0x060003F8; +D_06000500 = 0x06000500; +D_060005F8 = 0x060005F8; + +/* ovl_Bg_Lotus */ +D_06000A20 = 0x06000A20; +D_06000040 = 0x06000040; + +/* ovl_Bg_Tobira01 */ +D_060011C0 = 0x060011C0; +D_06000088 = 0x06000088; + // ovl_Boss_01 D_06000C44 = 0x06000C44; @@ -724,6 +740,21 @@ D_060129F0 = 0x060129F0; D_06002D30 = 0x06002D30; D_06011458 = 0x06011458; +// ovl_Door_Spiral + +D_06000590 = 0x06000590; +D_060007A8 = 0x060007A8; +D_06000EA0 = 0x06000EA0; +D_060012C0 = 0x060012C0; +D_060014C8 = 0x060014C8; +D_06002110 = 0x06002110; +D_06004448 = 0x06004448; +D_060051B8 = 0x060051B8; +D_06006128 = 0x06006128; +D_06009278 = 0x06009278; +D_06012B70 = 0x06012B70; +D_06013EA8 = 0x06013EA8; + // ovl_Eff_Stk D_06008920 = 0x06008920; @@ -830,6 +861,55 @@ D_0600A344 = 0x0600A344; D_06001EFC = 0x06001EFC; D_0600A808 = 0x0600A808; +// ovl_En_Invadepoh + +D_06000080 = 0x06000080; +D_060003B0 = 0x060003B0; +D_06000550 = 0x06000550; +D_06000560 = 0x06000560; +D_06000608 = 0x06000608; +D_060006C8 = 0x060006C8; +D_06000720 = 0x06000720; +D_06000998 = 0x06000998; +D_06001560 = 0x06001560; +D_06001674 = 0x06001674; +D_06001BD8 = 0x06001BD8; +D_06001D80 = 0x06001D80; +D_060021C8 = 0x060021C8; +D_06002A8C = 0x06002A8C; +D_06004010 = 0x06004010; +D_06004264 = 0x06004264; +D_06004C30 = 0x06004C30; +D_06004E50 = 0x06004E50; +D_06004E98 = 0x06004E98; +D_06007328 = 0x06007328; +D_060080F0 = 0x060080F0; +D_06009E58 = 0x06009E58; +D_0600A174 = 0x0600A174; +D_0600FFC8 = 0x0600FFC8; +D_060107C8 = 0x060107C8; +D_06010FC8 = 0x06010FC8; +D_060117C8 = 0x060117C8; +D_06011AD8 = 0x06011AD8; +D_06011FC8 = 0x06011FC8; +D_060122D8 = 0x060122D8; +D_060127C8 = 0x060127C8; +D_06012AD8 = 0x06012AD8; +D_06012BC8 = 0x06012BC8; +D_06012FC8 = 0x06012FC8; +D_060132D8 = 0x060132D8; +D_060133C8 = 0x060133C8; +D_06013928 = 0x06013928; +D_06013AD8 = 0x06013AD8; +D_06014088 = 0x06014088; +D_060142D8 = 0x060142D8; +D_06014AD8 = 0x06014AD8; +D_06014ED8 = 0x06014ED8; +D_060152D8 = 0x060152D8; +D_06015C28 = 0x06015C28; +D_060156D8 = 0x060156D8; +D_06016720 = 0x06016720; + // ovl_En_Invadepoh_Demo D_06000080 = 0x06000080; @@ -1010,6 +1090,16 @@ D_06000D94 = 0x06000D94; D_06007650 = 0x06007650; D_0600D658 = 0x0600D658; +// ovl_Item_B_Heart + +D_06001290 = 0x06001290; +D_06001470 = 0x06001470; + +// ovl_Obj_Boyo + +D_06000300 = 0x06000300; +D_06000E88 = 0x06000E88; + // ovl_Obj_Mine D_06000030 = 0x06000030; From 4faad208c6a30bd696b7c78f255900b905354e1b Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:09:00 +1000 Subject: [PATCH 14/29] Introduce `SaveContext.gameMode` enum (#1198) * gamemode enum * owl save * trailing enum comma --- include/z64save.h | 8 ++++++++ src/code/z_demo.c | 9 +++++---- src/code/z_parameter.c | 4 ++-- src/code/z_play.c | 15 ++++++++------- src/overlays/actors/ovl_En_Light/z_en_light.c | 2 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 2 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 2 +- src/overlays/gamestates/ovl_daytelop/z_daytelop.c | 2 +- src/overlays/gamestates/ovl_opening/z_opening.c | 2 +- src/overlays/gamestates/ovl_title/z_title.c | 2 +- 10 files changed, 29 insertions(+), 19 deletions(-) diff --git a/include/z64save.h b/include/z64save.h index f6e9145df..afabcce34 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -406,6 +406,14 @@ typedef enum SunsSongState { /* 3 */ SUNSSONG_SPECIAL // time does not advance, but signals the song was played. used for freezing redeads } SunsSongState; +typedef enum { + /* 0 */ GAMEMODE_NORMAL, + /* 1 */ GAMEMODE_TITLE_SCREEN, + /* 2 */ GAMEMODE_FILE_SELECT, + /* 3 */ GAMEMODE_END_CREDITS, + /* 4 */ GAMEMODE_OWL_SAVE +} GameMode; + // linkAge still exists in MM, but is always set to 0 (always adult) // There are remnants of these macros from OOT, but they are essentially useless #define LINK_IS_CHILD (gSaveContext.save.linkAge == 1) diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 499561623..08d56de69 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -558,7 +558,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* Audio_SetCutsceneFlag(false); gSaveContext.cutsceneTransitionControl = 1; - if ((gSaveContext.gameMode != 0) && (csCtx->frames != cmd->startFrame)) { + if ((gSaveContext.gameMode != GAMEMODE_NORMAL) && (csCtx->frames != cmd->startFrame)) { gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; } @@ -567,7 +567,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* play->nextEntrance = play->csCtx.sceneCsList[play->csCtx.currentCsIndex].nextEntrance; gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; - if (gSaveContext.gameMode != 1) { + if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) { Scene_SetExitFade(play); } else { D_801BB12C++; @@ -1416,7 +1416,7 @@ void func_800EDA04(PlayState* play, CutsceneContext* csCtx) { } gSaveContext.save.cutscene = 0; - gSaveContext.gameMode = 0; + gSaveContext.gameMode = GAMEMODE_NORMAL; ActorCutscene_Stop(0x7F); Audio_SetCutsceneFlag(false); csCtx->state = CS_STATE_0; @@ -1469,7 +1469,8 @@ void func_800EDBE0(PlayState* play) { SceneTableEntry* sp24; s32 temp_v0_3; - if (((gSaveContext.gameMode == 0) || (gSaveContext.gameMode == 1)) && (gSaveContext.respawnFlag <= 0)) { + if (((gSaveContext.gameMode == GAMEMODE_NORMAL) || (gSaveContext.gameMode == GAMEMODE_TITLE_SCREEN)) && + (gSaveContext.respawnFlag <= 0)) { sp2A = func_800F21CC(); if (sp2A != -1) { temp_v0_3 = func_800F2138(sp2A); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index c008e3abc..be5cc01bc 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3701,7 +3701,7 @@ void Magic_Update(PlayState* play) { // Add magic until magicFillTarget is reached gSaveContext.save.playerData.magic += 0x10; - if ((gSaveContext.gameMode == 0) && (gSaveContext.sceneLayer < 4)) { + if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (gSaveContext.sceneLayer < 4)) { play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG); } @@ -4482,7 +4482,7 @@ void Interface_DrawClock(PlayState* play) { if (R_TIME_SPEED != 0) { if ((msgCtx->msgMode == 0) || ((play->actorCtx.flags & ACTORCTX_FLAG_1) && !Play_InCsMode(play)) || (msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) || - (gSaveContext.gameMode == 3)) { + (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) { if (!FrameAdvance_IsEnabled(&play->state) && !Environment_IsTimeStopped() && (gSaveContext.save.day < 4)) { /** * Changes Clock's transparancy depending if Player is moving or not and possibly other things diff --git a/src/code/z_play.c b/src/code/z_play.c index ea86b2e82..08309b32f 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -689,10 +689,10 @@ void Play_UpdateTransition(PlayState* this) { D_801D0D54 = false; } - if (gSaveContext.gameMode == 4) { + if (gSaveContext.gameMode == GAMEMODE_OWL_SAVE) { STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState)); - } else if (gSaveContext.gameMode != 2) { + } else if (gSaveContext.gameMode != GAMEMODE_FILE_SELECT) { STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState)); gSaveContext.save.entrance = this->nextEntrance; @@ -700,7 +700,7 @@ void Play_UpdateTransition(PlayState* this) { if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { gSaveContext.minigameStatus = MINIGAME_STATUS_END; } - } else { // 2 + } else { // GAMEMODE_FILE_SELECT STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, FileSelect_Init, sizeof(FileSelectState)); } @@ -946,7 +946,7 @@ void Play_UpdateMain(PlayState* this) { } Play_UpdateTransition(this); if (gTransitionTileState != TRANS_TILE_READY) { - if ((gSaveContext.gameMode == 0) && + if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (((this->msgCtx.msgMode == 0)) || ((this->msgCtx.currentTextId == 0xFF) && (this->msgCtx.msgMode == 0x42) && (this->msgCtx.unk12020 == 0x41)) || @@ -1076,7 +1076,7 @@ void Play_PostWorldDraw(PlayState* this) { KaleidoScopeCall_Draw(this); } - if (gSaveContext.gameMode == 0) { + if (gSaveContext.gameMode == GAMEMODE_NORMAL) { Interface_Draw(this); } @@ -2202,7 +2202,8 @@ void Play_Init(GameState* thisx) { func_800EDDB0(this); - if (((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 1)) || (gSaveContext.save.cutscene >= 0xFFF0)) { + if (((gSaveContext.gameMode != GAMEMODE_NORMAL) && (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN)) || + (gSaveContext.save.cutscene >= 0xFFF0)) { gSaveContext.unk_3DC0 = 0; Magic_Reset(this); gSaveContext.sceneLayer = (gSaveContext.save.cutscene & 0xF) + 1; @@ -2263,7 +2264,7 @@ void Play_Init(GameState* thisx) { this->haltAllActors = false; this->unk_18844 = false; - if (gSaveContext.gameMode != 1) { + if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) { if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) { this->transitionType = (Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) + sceneLayer) >> 7) & 0x7F; diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index b1aa2f76b..830484996 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -52,7 +52,7 @@ void EnLight_Init(Actor* thisx, PlayState* play) { EnLight* this = THIS; if (!ENLIGHT_GET_4000(&this->actor)) { - if ((gSaveContext.gameMode == 3) || ENLIGHT_GET_2000(&this->actor)) { + if ((gSaveContext.gameMode == GAMEMODE_END_CREDITS) || ENLIGHT_GET_2000(&this->actor)) { Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, ((this->actor.params < 0) ? 1 : 40) + (s32)this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 180, -1); diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 4a8ce8731..513964338 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -388,7 +388,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { D_801BB12C = 0; } play_sound(NA_SE_SY_PIECE_OF_HEART); - gSaveContext.gameMode = 2; // Go to FileChoose + gSaveContext.gameMode = GAMEMODE_FILE_SELECT; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; play->nextEntrance = ENTRANCE(CUTSCENE, 0); diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 0e09b2e68..180bc59d4 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -315,7 +315,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { if (CURRENT_DAY == 0) { if (gSaveContext.save.time < CLOCK_TIME(6, 1)) { gSaveContext.save.time = CLOCK_TIME(6, 0); - gSaveContext.gameMode = 0; + gSaveContext.gameMode = GAMEMODE_NORMAL; STOP_GAMESTATE(&play->state); SET_NEXT_GAMESTATE(&play->state, DayTelop_Init, sizeof(DayTelopState)); this->unk_144 = 1; diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index a9e738561..845baa3cb 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -73,7 +73,7 @@ void DayTelop_Update(DayTelopState* this, GameState* thisx) { this->transitionCountdown--; if (this->transitionCountdown == 0) { if (gSaveContext.save.day < 9) { - gSaveContext.gameMode = 0; + gSaveContext.gameMode = GAMEMODE_NORMAL; } else { gSaveContext.nextCutsceneIndex = 0xFFF6; gSaveContext.save.day = 1; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index c56cc4bbb..7edfb8e78 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -13,7 +13,7 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { static s32 sOpeningCutscenes[] = { 0xFFFA, 0xFFFA }; CLEAR_EVENTINF(EVENTINF_17); - gSaveContext.gameMode = 1; + gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; Sram_InitNewSave(); diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index f3ee9102f..01e29668e 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -132,7 +132,7 @@ void ConsoleLogo_Main(GameState* thisx) { if (this->exit) { gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; - gSaveContext.gameMode = 1; + gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; STOP_GAMESTATE(&this->state); SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState)); From 255c4599bf847013d323d7ec7b6db81c072bdd1b Mon Sep 17 00:00:00 2001 From: Blythe Date: Fri, 14 Apr 2023 23:56:23 -0500 Subject: [PATCH 15/29] ovl_En_Slime & object_slime OK and documented (#1175) * decomped init, draw * started slime * finished func decomp en_slime * object_slime and en_slime updates * updated a few names * finished up some naming * en_slime and object_slime OK and documented * slime xml cleanup * Code cleanup round 1 * Cleanup 1 - missed a note * Fixed improper use of bgcheck flags * Some cleanup * Namefix, name cleanup * Function name cleanup, misc cleanup * More name cleanup (pre-merge) * Update color filter flag constants * Tidying --------- Co-authored-by: Blythe Hospelhorn <35576053+bhospelhorn@users.noreply.github.com> --- assets/xml/objects/object_slime.xml | 23 +- spec | 4 +- src/overlays/actors/ovl_En_Slime/z_en_slime.c | 1273 +++++++++++++++-- src/overlays/actors/ovl_En_Slime/z_en_slime.h | 34 +- tools/disasm/functions.txt | 74 +- tools/disasm/variables.txt | 28 +- 6 files changed, 1263 insertions(+), 173 deletions(-) diff --git a/assets/xml/objects/object_slime.xml b/assets/xml/objects/object_slime.xml index f17633eff..c8516e45f 100644 --- a/assets/xml/objects/object_slime.xml +++ b/assets/xml/objects/object_slime.xml @@ -1,14 +1,17 @@  + - - - - - - - - - - + + + + + + + + + + + + diff --git a/spec b/spec index a10cb67ce..dcf76f66b 100644 --- a/spec +++ b/spec @@ -2558,9 +2558,7 @@ beginseg name "ovl_En_Slime" compress include "build/src/overlays/actors/ovl_En_Slime/z_en_slime.o" - include "build/data/ovl_En_Slime/ovl_En_Slime.data.o" - include "build/data/ovl_En_Slime/ovl_En_Slime.bss.o" - include "build/data/ovl_En_Slime/ovl_En_Slime.reloc.o" + include "build/src/overlays/actors/ovl_En_Slime/ovl_En_Slime_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 2b8e5f4c6..55d6cd8e0 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -10,30 +10,62 @@ #define THIS ((EnSlime*)thisx) +#define ICE_BLOCK_TIMER_MAX 254 +#define ICE_BLOCK_UNUSED (ICE_BLOCK_TIMER_MAX + 1) + +typedef enum EnSlimeEyeTexture { + /* 0 */ EN_SLIME_EYETEX_OPEN, + /* 1 */ EN_SLIME_EYETEX_HALF, + /* 2 */ EN_SLIME_EYETEX_CLOSED, + /* 3 */ EN_SLIME_EYETEX_HALF2, + /* 4 */ EN_SLIME_EYETEX_MAX +} EnSlimeEyeTexture; + +typedef enum EnSlimeDamageEffect { + /* 0x0 */ EN_SLIME_DMGEFF_NORMAL, + /* 0x1 */ EN_SLIME_DMGEFF_STUN, + /* 0x3 */ EN_SLIME_DMGEFF_FREEZE = 0x3, + /* 0x4 */ EN_SLIME_DMGEFF_LIGHT, + /* 0x5 */ EN_SLIME_DMGEFF_ELECTRIC, + /* 0xE */ EN_SLIME_DMGEFF_HOOKSHOT = 0xE, + /* 0xF */ EN_SLIME_DMGEFF_BLUNT, +} EnSlimeDamageEffect; + void EnSlime_Init(Actor* thisx, PlayState* play); void EnSlime_Destroy(Actor* thisx, PlayState* play); void EnSlime_Update(Actor* thisx, PlayState* play); void EnSlime_Draw(Actor* thisx, PlayState* play); -void func_80A2F140(EnSlime* this, PlayState* play); -void func_80A2F1A4(EnSlime* this, PlayState* play); -void func_80A2F418(EnSlime* this, PlayState* play); -void func_80A2F6CC(EnSlime* this, PlayState* play); -void func_80A2F8E0(EnSlime* this, PlayState* play); -void func_80A2FA88(EnSlime* this, PlayState* play); -void func_80A2FBA0(EnSlime* this, PlayState* play); -void func_80A2FE38(EnSlime* this, PlayState* play); -void func_80A30344(EnSlime* this, PlayState* play); -void func_80A304B8(EnSlime* this, PlayState* play); -void func_80A30820(EnSlime* this, PlayState* play); -void func_80A30944(EnSlime* this, PlayState* play); -void func_80A30A20(EnSlime* this, PlayState* play); -void func_80A30AE4(EnSlime* this, PlayState* play); -void func_80A30C2C(EnSlime* this, PlayState* play); -void func_80A30CEC(EnSlime* this, PlayState* play); +void EnSlime_SetupInitializeIdle(EnSlime* this); +void EnSlime_InitializeIdle(EnSlime* this, PlayState* play); +void EnSlime_SetupIdle(EnSlime* this); +void EnSlime_Idle(EnSlime* this, PlayState* play); +void EnSlime_SetupMoveInDirection(EnSlime* this); +void EnSlime_MoveInDirection(EnSlime* this, PlayState* play); +void EnSlime_SetupMoveToHome(EnSlime* this); +void EnSlime_MoveToHome(EnSlime* this, PlayState* play); +void EnSlime_SetupTurnToPlayer(EnSlime* this); +void EnSlime_TurnToPlayer(EnSlime* this, PlayState* play); +void EnSlime_SetupJump(EnSlime* this); +void EnSlime_Jump(EnSlime* this, PlayState* play); +void EnSlime_SetupLand(EnSlime* this); +void EnSlime_Land(EnSlime* this, PlayState* play); +void EnSlime_ReactToBluntHit(EnSlime* this, PlayState* play); +void EnSlime_Damaged(EnSlime* this, PlayState* play); +void EnSlime_SetupDead(EnSlime* this); +void EnSlime_Dead(EnSlime* this, PlayState* play); +void EnSlime_SpawnIceBlock(EnSlime* this, PlayState* play); +void EnSlime_SetupIceBlock(EnSlime* this); +void EnSlime_IceBlock(EnSlime* this, PlayState* play); +void EnSlime_Stun(EnSlime* this, PlayState* play); +void EnSlime_SetupIceBlockThaw(EnSlime* this); +void EnSlime_IceBlockThaw(EnSlime* this, PlayState* play); +void EnSlime_SetupWaitForRevive(EnSlime* this); +void EnSlime_WaitForRevive(EnSlime* this, PlayState* play); +void EnSlime_SetupRevive(EnSlime* this); +void EnSlime_Revive(EnSlime* this, PlayState* play); -#if 0 -ActorInit En_Slime_InitVars = { +const ActorInit En_Slime_InitVars = { ACTOR_EN_SLIME, ACTORCAT_ENEMY, FLAGS, @@ -45,146 +77,1171 @@ ActorInit En_Slime_InitVars = { (ActorFunc)EnSlime_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A31AF0 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_HARD, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 22, 35, 0, { 0, 0, 0 } }, }; -// static DamageTable sDamageTable = { -static DamageTable D_80A31B1C = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(3, 0x0), - /* Horse trample */ DMG_ENTRY(1, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0xE), - /* Goron punch */ DMG_ENTRY(0, 0xF), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(0, 0xF), - /* Fire arrow */ DMG_ENTRY(2, 0x0), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(1, 0x0), - /* Deku bubble */ DMG_ENTRY(0, 0xF), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(1, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(0, 0xF), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, EN_SLIME_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(3, EN_SLIME_DMGEFF_NORMAL), + /* Horse trample */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Explosives */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Zora boomerang */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Normal arrow */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* Hookshot */ DMG_ENTRY(0, EN_SLIME_DMGEFF_HOOKSHOT), + /* Goron punch */ DMG_ENTRY(0, EN_SLIME_DMGEFF_BLUNT), + /* Sword */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Goron pound */ DMG_ENTRY(0, EN_SLIME_DMGEFF_BLUNT), + /* Fire arrow */ DMG_ENTRY(2, EN_SLIME_DMGEFF_NORMAL), + /* Ice arrow */ DMG_ENTRY(2, EN_SLIME_DMGEFF_FREEZE), + /* Light arrow */ DMG_ENTRY(2, EN_SLIME_DMGEFF_LIGHT), + /* Goron spikes */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Deku spin */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Deku bubble */ DMG_ENTRY(0, EN_SLIME_DMGEFF_BLUNT), + /* Deku launch */ DMG_ENTRY(2, EN_SLIME_DMGEFF_NORMAL), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, EN_SLIME_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(1, EN_SLIME_DMGEFF_ELECTRIC), + /* Normal shield */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* Light ray */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* Thrown object */ DMG_ENTRY(0, EN_SLIME_DMGEFF_BLUNT), + /* Zora punch */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Spin attack */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), + /* Sword beam */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* Normal Roll */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* Unblockable */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_SLIME_DMGEFF_NORMAL), + /* Powder Keg */ DMG_ENTRY(1, EN_SLIME_DMGEFF_NORMAL), }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A31B3C = { 1, 22, 35, 60 }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 22, 35, 60 }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A31B54[] = { +static TexturePtr sEyeTextures[] = { + gChuchuEyeOpenTex, + gChuchuEyeHalfTex, + gChuchuEyeClosedTex, + gChuchuEyeHalfTex, +}; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(gravity, -2, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_STOP), }; -#endif +static s32 sTexturesDesegmented = false; -extern ColliderCylinderInit D_80A31AF0; -extern DamageTable D_80A31B1C; -extern CollisionCheckInfoInit D_80A31B3C; -extern InitChainEntry D_80A31B54[]; +static Color_RGBA8 sBubblePrimColor = { 255, 255, 255, 255 }; +static Color_RGBA8 sBubbleEnvColor = { 150, 150, 150, 0 }; +static Vec3f sBubbleAccel = { 0.0f, -0.8f, 0.0f }; -extern UNK_TYPE D_060004C0; -extern UNK_TYPE D_06000828; +static Color_RGBA8 sPrimColors[] = { + { 255, 255, 255, 255 }, + { 255, 255, 0, 255 }, + { 255, 255, 200, 255 }, + { 225, 200, 255, 255 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/EnSlime_Init.s") +static Color_RGBA8 sEnvColors[] = { + { 140, 255, 195, 255 }, + { 50, 255, 0, 255 }, + { 255, 180, 0, 255 }, + { 255, 50, 155, 255 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/EnSlime_Destroy.s") +static Vec3f sLimbPosOffsets[EN_SLIME_LIMBPOS_COUNT] = { + { 2000.0f, 2000.0f, 0.0f }, { -1500.0f, 2500.0f, -500.0f }, { -500.0f, 1000.0f, 2500.0f }, + { 0.0f, 4000.0f, 0.0f }, { 0.0f, 2000.0f, -2000.0f }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2EFAC.s") +AnimatedMaterial* sSlimeTexAnim; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F028.s") +void EnSlime_Init(Actor* thisx, PlayState* play) { + EnSlime* this = THIS; + s32 reviveTimeSeconds; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F0A8.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 38.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F110.s") + this->iceBlockTimer = ICE_BLOCK_UNUSED; + this->eyeTexIndex = EN_SLIME_EYETEX_OPEN; + this->wobbleRot.y = 0.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F140.s") + // Sets maximum distance chuchu will move from its home before turning around. + if (this->actor.shape.rot.x <= 0) { + this->distLimit = 30000.0f; + } else { + this->distLimit = this->actor.shape.rot.x * 40.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F180.s") + this->actor.shape.rot.x = 0; + reviveTimeSeconds = EN_SLIME_GET_REVIVE_TIME(&this->actor); + this->actor.shape.rot.z = 0; + this->actor.params &= 0xFF; + if (reviveTimeSeconds == 0xFF) { + reviveTimeSeconds = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F1A4.s") + // Upper byte of actorParams at init is # of seconds past 10s to revive. + this->reviveTime = (reviveTimeSeconds * 20) + 200; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F354.s") + // Update addresses of texture assets (if another instance hasn't already) + if (!sTexturesDesegmented) { + for (i = 0; i < EN_SLIME_EYETEX_MAX; i++) { + sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); + } + sSlimeTexAnim = Lib_SegmentedToVirtual(gChuchuSlimeFlowTexAnim); + sTexturesDesegmented = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F418.s") + // Set hint IDs and drop item icon depending on chuchu color + if (EN_SLIME_GET_TYPE(&this->actor) == EN_SLIME_TYPE_YELLOW) { + this->itemDropTex = Lib_SegmentedToVirtual(gDropArrows1Tex); + this->actor.hintId = TATL_HINT_ID_YELLOW_CHUCHU; + } else if (EN_SLIME_GET_TYPE(&this->actor) == EN_SLIME_TYPE_GREEN) { + this->itemDropTex = Lib_SegmentedToVirtual(gDropMagicSmallTex); + this->actor.hintId = TATL_HINT_ID_GREEN_CHUCHU; + } else if (EN_SLIME_GET_TYPE(&this->actor) == EN_SLIME_TYPE_RED) { + this->itemDropTex = Lib_SegmentedToVirtual(gDropRecoveryHeartTex); + this->actor.hintId = TATL_HINT_ID_RED_CHUCHU; + } else { + this->actor.hintId = TATL_HINT_ID_BLUE_CHUCHU; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F684.s") + // Sets actor scale and initial action func + EnSlime_SetupInitializeIdle(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F6CC.s") +void EnSlime_Destroy(Actor* thisx, PlayState* play) { + EnSlime* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F8B4.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F8E0.s") +/** + * Upon immobilization via ice arrow (for chuchu types outside of blue), + * initialize ice visual effects before chuchu enters immobile state. + */ +void EnSlime_Freeze(EnSlime* this) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + this->drawDmgEffScale = 0.4f; + this->collider.base.colType = COLTYPE_HIT3; + this->drawDmgEffFrozenSteamScale = 0.6f; + this->drawDmgEffAlpha = 1.0f; + this->timer = 80; + this->actor.flags &= ~ACTOR_FLAG_400; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_XLU, 80); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2F9A0.s") +/** + * If stunned ice effect is active (ie. non-blue chuchu was frozen by ice arrow), + * initialize thaw and spawn thawing effect. + */ +void EnSlime_Thaw(EnSlime* this, PlayState* play) { + if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + this->drawDmgEffType = 0; // So it's not triggered again until Freeze has been called again. + this->collider.base.colType = COLTYPE_NONE; + this->drawDmgEffAlpha = 0.0f; + Actor_SpawnIceEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.2f, 0.2f); + this->actor.flags |= ACTOR_FLAG_200; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2FA88.s") +/** + * If blink animation is in progress, advance to next frame. + * If eyes are open, randomly (5% chance) initialize new blink cycle. + */ +void EnSlime_Blink(EnSlime* this) { + if (this->eyeTexIndex != EN_SLIME_EYETEX_OPEN) { + this->eyeTexIndex++; + if (this->eyeTexIndex == EN_SLIME_EYETEX_MAX) { + this->eyeTexIndex = EN_SLIME_EYETEX_OPEN; + } + } else if (Rand_ZeroOne() < 0.05f) { + this->eyeTexIndex = EN_SLIME_EYETEX_HALF; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2FB60.s") +/** + * Set the actor's initial scale and action function. + */ +void EnSlime_SetupInitializeIdle(EnSlime* this) { + this->actor.scale.x = 0.008f; + this->actor.scale.z = 0.008f; + this->actor.scale.y = 0.011f; + this->actionFunc = EnSlime_InitializeIdle; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2FBA0.s") +/** + * Once actor touches the ground, it starts its idle behavior. + * This function is only called right after the actor is first initialized. + * It is not set as the action function again. + */ +void EnSlime_InitializeIdle(EnSlime* this, PlayState* play) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.flags &= ~ACTOR_FLAG_10; + EnSlime_SetupIdle(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2FD94.s") +/** + * Set or restore idle action state. + * Sets timer to 25 and cycles to SitIdle action. + */ +void EnSlime_SetupIdle(EnSlime* this) { + this->timer = 25; + this->actor.speed = 0.0f; + this->actionFunc = EnSlime_Idle; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A2FE38.s") +/** + * Sit idle for one frame, updating rotation and scale to give + * the actor an amorphous, oozing effect. + * Chuchu will engage player if player is visible and + * close enough to it. + */ +void EnSlime_Idle(EnSlime* this, PlayState* play) { + f32 timerFactor; + f32 scale; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30018.s") + this->timer--; + timerFactor = sqrtf(this->timer) * 0.2f; + EnSlime_Blink(this); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30344.s") + scale = ((sin_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.13f * timerFactor)) + 1.0f) * 0.01f; + this->actor.scale.x = scale; + this->actor.scale.z = scale; + if (this->timer < 24) { + this->actor.scale.y = ((cos_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * timerFactor)) + 1.0f) * 0.01f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30454.s") + this->actor.shape.rot.x = randPlusMinusPoint5Scaled(0x200) * timerFactor; + this->actor.shape.rot.z = randPlusMinusPoint5Scaled(0x200) * timerFactor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A304B8.s") + // If player is not wearing the stone mask, is within 280 units of the chuchu, + // and the chuchu is facing the player, initialize chase/attack cycle. + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < 280.0f) && + Actor_IsFacingPlayer(&this->actor, 0x5000)) { + EnSlime_SetupTurnToPlayer(this); + } else if (this->timer == 0) { + // Start moving (remaining idle) + EnSlime_SetupMoveInDirection(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A3072C.s") +/** + * Reset the action timer (to 120), then select a new direction for + * chuchu to move. + */ +void EnSlime_SetupMoveInDirection(EnSlime* this) { + this->timer = 120; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30778.s") + // If actor is more than 120 units from its home, set the new direction to be towards its home. + // Otherwise, the new direction to move is pretty much random. + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 120.0f) { + this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); + } else if (Rand_ZeroOne() < 0.7f) { + this->idleRotY = (s32)randPlusMinusPoint5Scaled(0x4000) + this->actor.shape.rot.y; + } + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = EnSlime_MoveInDirection; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30820.s") +/** + * While moving idle, update rotation, speed, scale in a sinusoidal fashion to + * give oozing effect. + * If actor has hit a wall or is too far from home, turn around. + * Chuchu will engage player during idle movement if player is visible and + * close enough to it. + */ +void EnSlime_MoveInDirection(EnSlime* this, PlayState* play) { + f32 sinFactor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30924.s") + EnSlime_Blink(this); + this->timer--; + Math_ApproachS(&this->actor.shape.rot.y, this->idleRotY, 4, 0x100); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30944.s") + // If actor is touching a wall, set target rotation to match wall where it is touching. + // If actor is more than 120 units from its home, turn around to face home. + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->idleRotY = this->actor.wallYaw; + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 120.0f) { + this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A309C8.s") + // Update actor scale, xz speed, and rotation to provide amorphous effect + sinFactor = fabsf(sin_rad(this->timer * (M_PI / 24))); + Math_StepToF(&this->actor.scale.z, ((0.15f * sinFactor) + 1.0f) * 0.01f, 0.0002f); + Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * sinFactor)) * 0.01f, 0.0002f); + Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * sinFactor)) * 0.01f, 0.0002f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30A20.s") + this->actor.speed = (0.8f * sinFactor) + 0.2f; + this->actor.shape.rot.x = 0x800 * sinFactor; + this->actor.world.rot.y = this->actor.shape.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30A90.s") + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > this->distLimit) { + // If actor is too far from home, start return home cycle + EnSlime_SetupMoveToHome(this); + } else if ((Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < 280.0f) && + (Actor_IsFacingPlayer(&this->actor, 0x5000))) { + // If player is close enough to chuchu while not wearing the stone mask, and the chuchu is facing player, + // initialize attack cycle + EnSlime_SetupTurnToPlayer(this); + } else if (this->timer == 0) { + // If move timer runs out, restart idle cycle (sit in place for 25 frames) + EnSlime_SetupIdle(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30AE4.s") +/** + * Reset the action timer (to 24), then set the target y angle to face home. + */ +void EnSlime_SetupMoveToHome(EnSlime* this) { + this->timer = 24; + this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = EnSlime_MoveToHome; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30BE0.s") +/** + * While moving towards home point, update rotation, speed, scale + * in a sinusoidal fashion to give oozing effect. + * If actor has hit a wall, turn around. + * Once it is close enough to home point, return to idle cycle. + * Chuchu will not engage player while the return home cycle is active. + */ +void EnSlime_MoveToHome(EnSlime* this, PlayState* play) { + f32 timerFactor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30C2C.s") + EnSlime_Blink(this); + this->timer--; + Math_ApproachS(&this->actor.shape.rot.y, this->idleRotY, 4, 0x400); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + // If hit wall, turn around. + this->idleRotY = this->actor.wallYaw; + } else { + this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30C68.s") + timerFactor = fabsf(sin_rad(this->timer * (M_PI / 24))); + Math_StepToF(&this->actor.scale.z, ((0.15f * timerFactor) + 1.0f) * 0.01f, 0.0002f); + Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * timerFactor)) * 0.01f, 0.0002f); + Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * timerFactor)) * 0.01f, 0.0002f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30CEC.s") + this->actor.speed = (0.8f * timerFactor) + 0.2f; + this->actor.shape.rot.x = 0x800 * timerFactor; + this->actor.world.rot.y = this->actor.shape.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/func_80A30F98.s") + // Reset timer for use calculating wobble/ooze amount for frame + if (this->timer == 0) { + this->timer = 24; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/EnSlime_Update.s") + // Only return to idle once actor is close enough to home point. + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < (this->distLimit * 0.8f)) { + EnSlime_SetupIdle(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Slime/EnSlime_Draw.s") +void EnSlime_SetupTurnToPlayer(EnSlime* this) { + this->actor.shape.rot.x = 0; + this->actor.shape.rot.z = 0; + this->timer = 8; + this->actionFunc = EnSlime_TurnToPlayer; + this->actor.speed = 0.0f; +} + +/** + * Update actor angle and ooze effect as chuchu initially + * turns to face player. + */ +void EnSlime_TurnToPlayer(EnSlime* this, PlayState* play) { + f32 factorY; + f32 scaleXZ; + + this->timer--; + EnSlime_Blink(this); + Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0x1000); + if (this->timer >= 0) { + factorY = 8 - this->timer; + scaleXZ = ((factorY * 0.04f) + 1.0f) * 0.01f; + this->actor.scale.x = scaleXZ; + this->actor.scale.y = (1.0f - (factorY * 0.05f)) * 0.01f; + this->actor.scale.z = scaleXZ; + } + if (this->timer < -2) { + EnSlime_SetupJump(this); + } +} + +/** + * If fewer than 120 units from the player, start a larger attack lunge. + * Otherwise, hop forward. + */ +void EnSlime_SetupJump(EnSlime* this) { + if (this->actor.xzDistToPlayer > 120.0f) { + this->actor.velocity.y = 11.0f; + this->actor.speed = 5.0f; + this->actor.gravity = -2.0f; + } else { + this->actor.velocity.y = 18.0f; + this->actor.speed = 7.0f; + this->actor.gravity = -3.5f; + } + this->actor.world.rot.y = this->actor.shape.rot.y; + this->timer = 12; + this->eyeTexIndex = EN_SLIME_EYETEX_OPEN; + Math_StepToF(&this->actor.scale.x, 0.008f, 0.0025f); + Math_StepToF(&this->actor.scale.y, 0.011f, 0.0025f); + this->actor.scale.z = this->actor.scale.x; + Actor_PlaySfx(&this->actor, NA_SE_EN_SLIME_JUMP); + this->actionFunc = EnSlime_Jump; +} + +/** + * Check for collision and whether actor has stopped falling. + * Update actor scale for slime effect. + * If collision, knockback actor. If actor has stopped moving + * in Y direction, initialize landing action. + */ +void EnSlime_Jump(EnSlime* this, PlayState* play) { + this->timer--; + if (this->collider.base.atFlags & AT_HIT) { + if (this->actor.speed > 0.0f) { + this->actor.speed *= -1.2f; + this->collider.base.atFlags &= ~AT_HIT; + } + } + Math_StepToF(&this->actor.scale.x, 0.008f, 0.0025f); + Math_StepToF(&this->actor.scale.y, 0.011f, 0.0025f); + this->actor.scale.z = this->actor.scale.x; + if ((this->actor.velocity.y < 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + EnSlime_SetupLand(this); + } +} + +void EnSlime_SetupLand(EnSlime* this) { + this->timer = 15; + this->actor.scale.x = 0.0132f; + this->actor.scale.y = 0.0074399994f; + this->actor.scale.z = 0.0132f; + this->actor.speed = 0.0f; + this->actionFunc = EnSlime_Land; +} + +/** + * Update scale/rot for ooze jiggle effect (XZ), update Y scale + * to make it appear as though chuchu is compressing. + * If > 12 frames have passed since jump start, check again if player + * is in range and restart engage/jump cycle if so. + * If too far from home, initialize return home cycle + * (takes priority over player engage check). + * Otherwise if timer is up, return to idle. + */ +void EnSlime_Land(EnSlime* this, PlayState* play) { + f32 scaleY; + f32 rotXZ; + f32 scaleXZ; + + EnSlime_Blink(this); + this->timer--; + scaleY = ((this->timer / 5) + 1) * 1.6f; + rotXZ = sqrtf(this->timer) * 0.2f; + scaleXZ = ((cos_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * scaleY)) + 1.0f) * 0.01f; + this->actor.scale.x = scaleXZ; + this->actor.scale.z = scaleXZ; + if (this->timer < 15) { + this->actor.scale.y = (1.0f - (sin_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.04f * scaleY))) * 0.01f; + } + this->actor.shape.rot.x = randPlusMinusPoint5Scaled(0x200) * rotXZ; + this->actor.shape.rot.z = randPlusMinusPoint5Scaled(0x200) * rotXZ; + + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > this->distLimit) { + EnSlime_SetupMoveToHome(this); + } else if ((Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.xzDistToPlayer < 280.0f) && + (this->timer < 12)) { + EnSlime_SetupTurnToPlayer(this); + } else if (this->timer == 0) { + EnSlime_SetupIdle(this); + } +} + +/** + * Initialize reaction to receiving a blunt hit (such as with Goron Punch etc.) + * Chuchu does not take damage, but appears slide backwards. + */ +void EnSlime_SetupReactToBluntHit(EnSlime* this) { + this->actor.speed = 10.0f; + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } + this->collider.base.acFlags &= ~AC_ON; + this->timer = 30; + Actor_PlaySfx(&this->actor, NA_SE_EN_SLIME_DEFENCE); + if (this->collider.base.ac != NULL) { + this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000; + } else { + this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; + } + this->actionFunc = EnSlime_ReactToBluntHit; +} + +/** + * Update reaction to receiving a blunt hit (such as with Goron Punch etc.) + * Update XZ speed and jiggle effect + * AC_ON flag is off until 15 frames of reaction remain. + * When timer is up, chuchu will choose whether to engage player, return home, + * or return to idle. + * If chuchu is too far from home, returning home will take precedence. + */ +void EnSlime_ReactToBluntHit(EnSlime* this, PlayState* play) { + f32 timerFactor; + f32 scale; + + EnSlime_Blink(this); + this->timer--; + Math_StepToF(&this->actor.speed, 0.0f, 1.0f); + timerFactor = sqrtf(this->timer); + if (this->timer < 30) { + scale = ((cos_rad(this->timer * (2.0f * M_PI / 5.0f)) * (0.08f * timerFactor)) + 1.0f) * 0.01f; + this->actor.scale.x = scale; + this->actor.scale.z = scale; + } + if (this->timer == 15) { + this->collider.base.acFlags |= AC_ON; + } + this->actor.scale.y = ((sin_rad((f32)this->timer * (2.0f * M_PI / 5.0f)) * (0.07f * timerFactor)) + 1.0f) * 0.01f; + this->actor.shape.rot.x = randPlusMinusPoint5Scaled(0x200) * timerFactor; + this->actor.shape.rot.z = randPlusMinusPoint5Scaled(0x200) * timerFactor; + + if (this->timer == 0) { + if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > this->distLimit) { + EnSlime_SetupMoveToHome(this); + } else if ((this->actor.xzDistToPlayer < 280.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { + EnSlime_SetupTurnToPlayer(this); + } else { + EnSlime_SetupIdle(this); + } + } +} + +/** + * Spawn bubbles & splash, start actor rebuff wobble, + * push actor, and play sfx. + */ +void EnSlime_SetupDamaged(EnSlime* this, PlayState* play, s32 arg2) { + s32 i; + Vec3f effectVelocity; + Vec3f effectPos; + f32 ySin; + f32 yCos; + + this->collider.base.acFlags &= ~AC_ON; + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_XLU, 20); + this->timer = 20; + this->actor.speed = 10.0f; + if (arg2 == true) { + // This function changes actor's world Y rotation? + func_800BE504(&this->actor, &this->collider); + } + + this->eyeTexIndex = EN_SLIME_EYETEX_OPEN; + Actor_SetScale(&this->actor, 0.01f); + this->wobbleRot.x = Rand_ZeroOne() * (M_PI * 2.0f); + this->wobbleRot.z = Rand_ZeroOne() * (M_PI * 2.0f); + ySin = Math_SinS(this->actor.world.rot.y) * 10.0f; + yCos = Math_CosS(this->actor.world.rot.y) * 10.0f; + effectPos.x = this->actor.world.pos.x + ySin; + effectPos.y = this->actor.world.pos.y + 20.0f; + effectPos.z = this->actor.world.pos.z + yCos; + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 550); + + for (i = 0; i < 10; i++) { + effectPos.x = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.x + ySin; + effectPos.y = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.y + 40.0f; + effectPos.z = randPlusMinusPoint5Scaled(40.0f) + this->actor.world.pos.z + yCos; + + effectVelocity.x = ((Rand_ZeroOne() * 3.5f) + 1.0f) * -Math_SinS(this->actor.world.rot.y); + effectVelocity.z = ((Rand_ZeroOne() * 3.5f) + 1.0f) * -Math_CosS(this->actor.world.rot.y); + + effectVelocity.y = (Rand_ZeroOne() * 6.0f) + 2.0f; + EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &effectVelocity, &sBubbleAccel, &sBubblePrimColor, + &sBubbleEnvColor, Rand_S16Offset(40, 20), 20, 0); + } + + if (this->actor.colChkInfo.health == 0) { + Actor_PlaySfx(&this->actor, NA_SE_EN_SLIME_DEAD); + } else { + Actor_PlaySfx(&this->actor, NA_SE_EN_SLIME_DAMAGE); + } + this->actionFunc = EnSlime_Damaged; +} + +/** + * Update reaction to taking damage. + * Updates the rebuff wobble. + * Once timer drops to 0, actor initializes death cycle, re-engages player, or returns to idle. + */ +void EnSlime_Damaged(EnSlime* this, PlayState* play) { + this->timer--; + Math_StepToF(&this->actor.speed, 0.0f, 1.0f); + if ((this->timer % 5) == 0) { + this->wobbleRot.x = Rand_ZeroOne() * (M_PI * 2.0f); + this->wobbleRot.z = Rand_ZeroOne() * (M_PI * 2.0f); + } + if (this->timer == 0) { + if (this->actor.colChkInfo.health != 0) { + this->collider.base.acFlags |= AC_ON; + if ((this->actor.xzDistToPlayer < 280.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { + EnSlime_SetupTurnToPlayer(this); + } else { + EnSlime_SetupIdle(this); + } + } else { + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_SLIME_BREAK); + EnSlime_SetupDead(this); + } + } +} + +/** + * Disable AC_ON flag, make actor stop moving, and shrink the actor. + */ +void EnSlime_SetupDead(EnSlime* this) { + this->collider.base.acFlags &= ~AC_ON; + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } + Actor_SetScale(&this->actor, 0.01f); + this->actor.speed = 0.0f; + this->actionFunc = EnSlime_Dead; +} + +/** + * Spawn random effects (bubbles, splash) for death sequence. + * If chuchu is red, green, or yellow, spawn item drop. + * Shrink actor scale to 0. + * Call SetupWaitForRevive function for cleanup. + */ +void EnSlime_Dead(EnSlime* this, PlayState* play) { + s32 i; + Vec3f velocity; + Vec3f effectPos; + f32 randFloat; + s32 randSign; + + if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.002f)) { + effectPos.x = this->actor.world.pos.x; + effectPos.y = this->actor.world.pos.y + 20.0f; + effectPos.z = this->actor.world.pos.z; + EffectSsGSplash_Spawn(play, &effectPos, NULL, NULL, 1, 800); + + for (i = 0; i < 15; i++) { + randFloat = Rand_ZeroOne(); + randSign = Rand_ZeroOne() < 0.5f ? -1 : 1; + velocity.x = randSign * ((randFloat * 2.5f) + 2.0f); + + randFloat = Rand_ZeroOne(); + randSign = Rand_ZeroOne() < 0.5f ? -1 : 1; + velocity.z = randSign * ((randFloat * 2.5f) + 2.0f); + + velocity.y = (Rand_ZeroOne() * 6.0f) + 2.0f; + EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &velocity, &sBubbleAccel, &sBubblePrimColor, + &sBubbleEnvColor, Rand_S16Offset(40, 20), 20, 0); + } + + if (this->actor.params == EN_SLIME_TYPE_YELLOW) { + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_ARROWS_10); + } else if (this->actor.params == EN_SLIME_TYPE_GREEN) { + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_MAGIC_SMALL); + } else if (this->actor.params == EN_SLIME_TYPE_RED) { + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RECOVERY_HEART); + } + EnSlime_SetupWaitForRevive(this); + } + this->actor.scale.y = this->actor.scale.x; + this->actor.scale.z = this->actor.scale.x; +} + +/** + * Calculate a new "current" position value that is a multiple of 60 + * away from the "home" position. + * This is for use by blue chuchus frozen into an ice block so that + * their position is a multiple of the ice block size. + */ +f32 EnSlime_SnapIceBlockPosition(f32 currentPosition, f32 homePosition) { + s32 dist = currentPosition - homePosition; + + if (dist > 0) { + dist += 30; + } else { + dist -= 30; + } + + return ((dist / 60) * 60.0f) + homePosition; +} + +/** + * Prepare actor for ice block to spawn around it. + * The actor will stop moving, have AC_ON cleared, + * and target position will be snapped to + * a multiple of the size of an ice block. + */ +void EnSlime_SetupSpawnIceBlock(EnSlime* this) { + this->collider.base.acFlags &= ~AC_ON; + this->actor.flags &= ~ACTOR_FLAG_1; + this->drawDmgEffAlpha = 0.0f; + this->actor.speed = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.gravity = 0.0f; + this->iceBlockSnapPos.x = EnSlime_SnapIceBlockPosition(this->actor.world.pos.x, this->actor.home.pos.x); + this->iceBlockSnapPos.z = EnSlime_SnapIceBlockPosition(this->actor.world.pos.z, this->actor.home.pos.z); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, COLORFILTER_INTENSITY_FLAG | 255, + COLORFILTER_BUFFLAG_XLU, 10); + this->eyeTexIndex = EN_SLIME_EYETEX_OPEN; + this->iceBlockTimer = ICE_BLOCK_TIMER_MAX; + this->actionFunc = EnSlime_SpawnIceBlock; +} + +/** + * Attempt to move the chuchu to snapped position and + * spawn an ice block actor as a child of the chuchu actor. + * If ice block spawn fails, chuchu returns to idle. + */ +void EnSlime_SpawnIceBlock(EnSlime* this, PlayState* play) { + s32 stepCheck; + + stepCheck = Math_StepToF(&this->actor.world.pos.x, this->iceBlockSnapPos.x, 10.0f); + stepCheck &= Math_StepToF(&this->actor.world.pos.z, this->iceBlockSnapPos.z, 10.0f); + + this->actor.colorFilterTimer = 10; + if (stepCheck) { + this->actor.child = + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_ICEBLOCK, this->actor.world.pos.x, + this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, 0); + if (this->actor.child != NULL) { + this->actor.child->cutscene = this->actor.cutscene; + EnSlime_SetupIceBlock(this); + } else { + this->actor.colorFilterTimer = 0; + this->collider.base.acFlags |= AC_ON; + this->iceBlockTimer = ICE_BLOCK_UNUSED; + this->actor.flags |= ACTOR_FLAG_1; + this->actor.gravity = -2.0f; + EnSlime_SetupIdle(this); + } + } +} + +void EnSlime_SetupIceBlock(EnSlime* this) { + this->actor.flags |= ACTOR_FLAG_10; + this->actionFunc = EnSlime_IceBlock; +} + +/** + * Decrement the ice block timer, or if it has hit zero, + * check to see if the ice block child actor link has been broken + * or if the block has shrunk sufficiently. + * If timer is up and ice block is sufficiently "gone", init thaw. + */ +void EnSlime_IceBlock(EnSlime* this, PlayState* play) { + if (this->iceBlockTimer == 0) { + if ((this->actor.child == NULL) || (this->actor.child->update == NULL) || + !(this->actor.child->scale.y >= 0.1f)) { + EnSlime_SetupIceBlockThaw(this); + } + } else { + this->actor.colorFilterTimer = 10; + if ((this->iceBlockTimer - 5) < 0) { + this->iceBlockTimer = 0; + } else { + this->iceBlockTimer -= 5; + } + } +} + +void EnSlime_SetupStun(EnSlime* this) { + this->actor.speed = 0.0f; + func_800BE504(&this->actor, &this->collider); + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } + this->actionFunc = EnSlime_Stun; +} + +/** + * Check the actor's timer to see whether stun has worn off. + * If so, either react to damage and initialize death, or start + * idly wobbling in a new direction. + */ +void EnSlime_Stun(EnSlime* this, PlayState* play) { + this->timer--; + if (this->timer == 0) { + EnSlime_Thaw(this, play); + if (this->actor.colChkInfo.health == 0) { + EnSlime_SetupDamaged(this, play, false); + } else { + this->actor.world.rot.y = this->actor.shape.rot.y; + EnSlime_SetupMoveInDirection(this); + } + } +} + +void EnSlime_SetupIceBlockThaw(EnSlime* this) { + this->actor.colorFilterTimer = 0; + this->actor.gravity = -2.0f; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_GRAY, COLORFILTER_INTENSITY_FLAG | 255, + COLORFILTER_BUFFLAG_XLU, 10); + this->actionFunc = EnSlime_IceBlockThaw; +} + +/** + * Update the actor's ice block timer to match state of ice block. + * When it reaches the "unset" value (255), return actor to idle. + */ +void EnSlime_IceBlockThaw(EnSlime* this, PlayState* play) { + s32 iceBlockTimerAdj; + + this->actor.colorFilterTimer = 10; + if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { + iceBlockTimerAdj = (0.1f - this->actor.child->scale.y) * 10.0f * 255.0f; + this->iceBlockTimer = CLAMP(iceBlockTimerAdj, 0, ICE_BLOCK_UNUSED); + } else { + this->actor.child = NULL; + iceBlockTimerAdj = this->iceBlockTimer + 10; + this->iceBlockTimer = CLAMP_MAX(iceBlockTimerAdj, ICE_BLOCK_UNUSED); + } + + if (this->iceBlockTimer == ICE_BLOCK_UNUSED) { + this->collider.base.acFlags |= AC_ON; + this->actor.flags |= ACTOR_FLAG_1; + this->actor.flags &= ~ACTOR_FLAG_10; + EnSlime_SetupIdle(this); + } +} + +/** + * Set speed to zero, and make undrawable. + * Initialize revive timer. + */ +void EnSlime_SetupWaitForRevive(EnSlime* this) { + this->actor.draw = NULL; + this->actor.flags |= ACTOR_FLAG_10; + this->drawDmgEffAlpha = 0.0f; + this->actor.gravity = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.speed = 0.0f; + this->collider.base.ocFlags1 &= ~OC1_ON; + this->timer = this->reviveTime; + this->actionFunc = EnSlime_WaitForRevive; +} + +/** + * Decrement the revival timer, or if it is zero, + * initialize revive. + */ +void EnSlime_WaitForRevive(EnSlime* this, PlayState* play) { + if (this->timer == 0) { + EnSlime_SetupRevive(this); + } else { + this->timer--; + } +} + +/** + * Re-enable drawing, reset the actor's health and home, + * and setup and initialize revive action. + */ +void EnSlime_SetupRevive(EnSlime* this) { + this->actor.draw = EnSlime_Draw; + this->actor.colChkInfo.health = sColChkInfoInit.health; + this->iceBlockTimer = ICE_BLOCK_UNUSED; + Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); + this->timer = 0; + this->actor.colorFilterTimer = 0; + this->actor.home.rot.y = this->actor.yawTowardsPlayer; + Actor_PlaySfx(&this->actor, NA_SE_EN_SLIME_SURFACE); + this->actor.gravity = -2.0f; + this->actionFunc = EnSlime_Revive; +} + +/** + * Update bubbling back up effect. After 21 frames, OC1_ON is set. + * After 28 frames, AC_ON is set and actor returns to idle movement. + */ +void EnSlime_Revive(EnSlime* this, PlayState* play) { + f32 rescaleFactor1; + f32 rescaleFactor2; + + this->timer++; + if (this->timer == 28) { + this->actor.flags &= ~ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_1; + this->collider.base.acFlags |= AC_ON; + this->actor.shape.rot.y = this->actor.home.rot.y; + EnSlime_SetupMoveInDirection(this); + } else { + if (this->timer < 12) { + rescaleFactor1 = this->timer * 0.0008333333f; // This is about 1/1200, but (1.0f/1200.0f) does not match + this->reviveScale.x = rescaleFactor1; + this->reviveScale.z = rescaleFactor1; + this->reviveScale.y = 2.0f * rescaleFactor1; + this->reviveRotY = this->timer * (0x4000 / 10.0f); + } else if (this->timer < 20) { + rescaleFactor1 = (this->timer - 12) * (1.0f / 1600.0f); + rescaleFactor2 = 0.01f + rescaleFactor1; + this->reviveScale.x = rescaleFactor2; + this->reviveScale.z = rescaleFactor2; + this->reviveScale.y = 2.0f * (0.01f - rescaleFactor1); + this->reviveRotY = this->timer * (0x4000 / 10.0f); + } else if (this->timer < 24) { + rescaleFactor1 = (this->timer - 20) * 0.0033333332f; // This is about 1/300 + rescaleFactor2 = 0.015f - rescaleFactor1; + this->reviveScale.x = rescaleFactor2; + this->reviveScale.z = rescaleFactor2; + this->reviveScale.y = (2.0f * rescaleFactor1) + 0.01f; + Actor_SetScale(&this->actor, 1.5f * rescaleFactor1); + this->reviveRotY = ((23 - this->timer) * 7281.778f) + 10922.667f; + this->actor.shape.rot.y = (28 - this->timer) * (f32)0x1000; + } else { + Actor_SetScale(&this->actor, (((28 - this->timer) * 0.1f) + 1.0f) * 0.01f); + Math_Vec3f_Copy(&this->reviveScale, &gZeroVec3f); + this->actor.shape.rot.y = (28 - this->timer) * (f32)0x1000; + } + + if (this->timer == 21) { + this->collider.base.ocFlags1 |= OC1_ON; + } + + this->reviveRotY += this->actor.home.rot.y; + this->actor.shape.rot.y += this->actor.home.rot.y; + } +} + +/** + * Check actor AC hit since last update. If hit, initialize appropriate action cycle. + */ +void EnSlime_UpdateDamage(EnSlime* this, PlayState* play) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + + if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || + !(this->collider.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { + + EnSlime_Thaw(this, play); + if ((this->actor.params == EN_SLIME_TYPE_BLUE) && + (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_FREEZE)) { + // Blue chuchus take no damage from ice arrows. + this->actor.colChkInfo.damage = 0; + } + + if (Actor_ApplyDamage(&this->actor) == 0) { + Actor_SetDropFlag(&this->actor, &this->collider.info); + Enemy_StartFinishingBlow(play, &this->actor); + this->actor.flags &= ~ACTOR_FLAG_1; + } + + if (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_BLUNT) { + EnSlime_SetupReactToBluntHit(this); + } else if (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_STUN) { + this->timer = 40; + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 40); + Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); + EnSlime_SetupStun(this); + } else if (this->actor.colChkInfo.damageEffect != EN_SLIME_DMGEFF_HOOKSHOT) { + if (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_FREEZE) { + if (this->actor.params == EN_SLIME_TYPE_BLUE) { + EnSlime_SetupSpawnIceBlock(this); + } else { + EnSlime_Freeze(this); + if (this->actor.colChkInfo.health == 0) { + this->timer = 3; + this->collider.base.acFlags &= ~AC_ON; + } + EnSlime_SetupStun(this); + } + } else { + if (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_LIGHT) { + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffScale = 0.4f; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->collider.info.bumper.hitPos.x, + this->collider.info.bumper.hitPos.y, this->collider.info.bumper.hitPos.z, 0, 0, 0, + CLEAR_TAG_LARGE_LIGHT_RAYS); + } else if (this->actor.colChkInfo.damageEffect == EN_SLIME_DMGEFF_ELECTRIC) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE; + this->drawDmgEffAlpha = 4.0f; + this->drawDmgEffScale = 0.4f; + } + EnSlime_SetupDamaged(this, play, true); + } + } + } + } +} + +void EnSlime_Update(Actor* thisx, PlayState* play) { + EnSlime* this = THIS; + s32 pad; + Player* player = GET_PLAYER(play); + + EnSlime_UpdateDamage(this, play); + this->actionFunc(this, play); + + // Note: Does not match if you use this->actor instead of thisx + thisx->shape.shadowAlpha = this->iceBlockTimer; + if (this->iceBlockTimer == ICE_BLOCK_UNUSED) { + if (thisx->scale.y > 0.0001f) { + thisx->targetArrowOffset = 60.0f / thisx->scale.y; + } + + if (this->collider.base.ocFlags1 & OC1_ON) { + Actor_MoveWithGravity(thisx); + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 35.0f, 40.0f, 0x1D); + } + + Collider_UpdateCylinder(thisx, &this->collider); + this->collider.dim.radius = sCylinderInit.dim.radius * (100.0f * thisx->scale.z); + this->collider.dim.height = sCylinderInit.dim.height * (100.0f * thisx->scale.y); + + if (this->actionFunc == EnSlime_Jump) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } + + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + + if (player->stateFlags3 & PLAYER_STATE3_100) { + this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; + } else { + this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; + } + + if (this->collider.base.ocFlags1 & OC1_ON) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + } + + Actor_SetFocus(thisx, 15.0f); + if (this->drawDmgEffAlpha > 0.0f) { + if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); + this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.2f; + this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.4f); + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.4f, 0.01f)) { + func_800B9010(thisx, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + } + } + } +} + +void EnSlime_Draw(Actor* thisx, PlayState* play) { + s32 i; + EnSlime* this = THIS; + Vec3f wobbleScale; + Color_RGBA8* primColor; + Color_RGBA8* envColor; + s32 pad; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + func_8012C2DC(play->state.gfxCtx); + func_800B8118(&this->actor, play, 0); + if (this->iceBlockTimer != ICE_BLOCK_UNUSED) { + gSPSegment(POLY_XLU_DISP++, 10, D_801AEFA0); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 170, 255, 255, 255, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 150, 255, 255, this->iceBlockTimer); + } else { + primColor = &sPrimColors[this->actor.params]; + envColor = &sEnvColors[this->actor.params]; + AnimatedMat_Draw(play, sSlimeTexAnim); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 100, primColor->r, primColor->g, primColor->b, primColor->a); + gDPSetEnvColor(POLY_XLU_DISP++, envColor->r, envColor->g, envColor->b, 255); + } + + if (this->actionFunc == EnSlime_Damaged) { + wobbleScale.x = 1.0f - (sin_rad((f32)this->timer * (M_PI / 2.0f)) * 0.3f); + wobbleScale.y = (sin_rad((f32)this->timer * (M_PI / 2.0f)) * 0.3f) + 1.0f; + wobbleScale.z = 1.0f - (cos_rad((f32)this->timer * (M_PI / 2.0f)) * 0.3f); + + Matrix_RotateXFApply(this->wobbleRot.x); + Matrix_RotateZF(this->wobbleRot.z, MTXMODE_APPLY); + Matrix_Scale(wobbleScale.x, wobbleScale.y, wobbleScale.z, MTXMODE_APPLY); + Matrix_RotateZF(-this->wobbleRot.z, MTXMODE_APPLY); + Matrix_RotateXFApply(-this->wobbleRot.x); + } + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gChuchuBodyDL); + + if (this->iceBlockTimer == ICE_BLOCK_UNUSED) { + // Ice block is not active + Scene_SetRenderModeXlu(play, 0, 1); + + gSPSegment(POLY_OPA_DISP++, 9, (u32)sEyeTextures[this->eyeTexIndex]); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 30, 70, 255); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gChuchuEyesDL); + + } else { + Scene_SetRenderModeXlu(play, 1, 2); + gSPSegment(POLY_XLU_DISP++, 9, (u32)sEyeTextures[this->eyeTexIndex]); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gChuchuEyesDL); + } + + for (i = 0; i < EN_SLIME_LIMBPOS_COUNT; i++) { + Matrix_MultVec3f(&sLimbPosOffsets[i], &this->limbPos[i]); + } + + if (this->actionFunc == EnSlime_Revive) { + Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); + Matrix_RotateYS(this->reviveRotY, MTXMODE_APPLY); + Matrix_Scale(this->reviveScale.x, this->reviveScale.y, this->reviveScale.z, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gChuchuPuddleDL); + } + + if ((this->actor.params != EN_SLIME_TYPE_BLUE) && (this->actor.scale.x > 0.0f)) { + POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); + + Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + (2000.0f * this->actor.scale.y), + this->actor.world.pos.z, MTXMODE_NEW); + Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); + + gSPSegment(POLY_OPA_DISP++, 8, (u32)this->itemDropTex); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gItemDropDL); + } + + Actor_DrawDamageEffects(play, &this->actor, this->limbPos, ARRAY_COUNT(this->limbPos), this->drawDmgEffScale, + this->drawDmgEffFrozenSteamScale, this->drawDmgEffAlpha, this->drawDmgEffType); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.h b/src/overlays/actors/ovl_En_Slime/z_en_slime.h index 0381a592a..0a40a117e 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.h +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.h @@ -2,6 +2,13 @@ #define Z_EN_SLIME_H #include "global.h" +#include "objects/object_slime/object_slime.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define EN_SLIME_LIMBPOS_COUNT 5 + +#define EN_SLIME_GET_TYPE(thisx) ((thisx)->params) +#define EN_SLIME_GET_REVIVE_TIME(thisx) ((((thisx)->params) >> 8) & 0xFF) struct EnSlime; @@ -10,7 +17,32 @@ typedef void (*EnSlimeActionFunc)(struct EnSlime*, PlayState*); typedef struct EnSlime { /* 0x000 */ Actor actor; /* 0x144 */ EnSlimeActionFunc actionFunc; - /* 0x148 */ char unk_148[0xC0]; + /* 0x148 */ u8 iceBlockTimer; + /* 0x149 */ u8 eyeTexIndex; + /* 0x14A */ u8 drawDmgEffType; + /* 0x14C */ s16 timer; + /* 0x14E */ s16 idleRotY; + /* 0x150 */ s16 reviveRotY; + /* 0x152 */ s16 reviveTime; + /* 0x154 */ union { + Vec3f iceBlockSnapPos; + Vec3f wobbleRot; + }; + /* 0x160 */ TexturePtr itemDropTex; + /* 0x164 */ f32 drawDmgEffAlpha; + /* 0x168 */ f32 drawDmgEffScale; + /* 0x16C */ f32 drawDmgEffFrozenSteamScale; + /* 0x170 */ f32 distLimit; + /* 0x174 */ Vec3f reviveScale; + /* 0x180 */ Vec3f limbPos[EN_SLIME_LIMBPOS_COUNT]; + /* 0x1BC */ ColliderCylinder collider; } EnSlime; // size = 0x208 +typedef enum EnSlimeType { + /* 0 */ EN_SLIME_TYPE_BLUE, + /* 1 */ EN_SLIME_TYPE_GREEN, + /* 2 */ EN_SLIME_TYPE_YELLOW, + /* 3 */ EN_SLIME_TYPE_RED, +} EnSlimeType; + #endif // Z_EN_SLIME_H diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 01917fd8c..c9f7ab6cd 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -10126,43 +10126,43 @@ 0x80A2EBE8:("DmSa_Draw",), 0x80A2EDA0:("EnSlime_Init",), 0x80A2EF80:("EnSlime_Destroy",), - 0x80A2EFAC:("func_80A2EFAC",), - 0x80A2F028:("func_80A2F028",), - 0x80A2F0A8:("func_80A2F0A8",), - 0x80A2F110:("func_80A2F110",), - 0x80A2F140:("func_80A2F140",), - 0x80A2F180:("func_80A2F180",), - 0x80A2F1A4:("func_80A2F1A4",), - 0x80A2F354:("func_80A2F354",), - 0x80A2F418:("func_80A2F418",), - 0x80A2F684:("func_80A2F684",), - 0x80A2F6CC:("func_80A2F6CC",), - 0x80A2F8B4:("func_80A2F8B4",), - 0x80A2F8E0:("func_80A2F8E0",), - 0x80A2F9A0:("func_80A2F9A0",), - 0x80A2FA88:("func_80A2FA88",), - 0x80A2FB60:("func_80A2FB60",), - 0x80A2FBA0:("func_80A2FBA0",), - 0x80A2FD94:("func_80A2FD94",), - 0x80A2FE38:("func_80A2FE38",), - 0x80A30018:("func_80A30018",), - 0x80A30344:("func_80A30344",), - 0x80A30454:("func_80A30454",), - 0x80A304B8:("func_80A304B8",), - 0x80A3072C:("func_80A3072C",), - 0x80A30778:("func_80A30778",), - 0x80A30820:("func_80A30820",), - 0x80A30924:("func_80A30924",), - 0x80A30944:("func_80A30944",), - 0x80A309C8:("func_80A309C8",), - 0x80A30A20:("func_80A30A20",), - 0x80A30A90:("func_80A30A90",), - 0x80A30AE4:("func_80A30AE4",), - 0x80A30BE0:("func_80A30BE0",), - 0x80A30C2C:("func_80A30C2C",), - 0x80A30C68:("func_80A30C68",), - 0x80A30CEC:("func_80A30CEC",), - 0x80A30F98:("func_80A30F98",), + 0x80A2EFAC:("EnSlime_Freeze",), + 0x80A2F028:("EnSlime_Thaw",), + 0x80A2F0A8:("EnSlime_Blink",), + 0x80A2F110:("EnSlime_SetupInitializeIdle",), + 0x80A2F140:("EnSlime_InitializeIdle",), + 0x80A2F180:("EnSlime_SetupIdle",), + 0x80A2F1A4:("EnSlime_Idle",), + 0x80A2F354:("EnSlime_SetupMoveInDirection",), + 0x80A2F418:("EnSlime_MoveInDirection",), + 0x80A2F684:("EnSlime_SetupMoveToHome",), + 0x80A2F6CC:("EnSlime_MoveToHome",), + 0x80A2F8B4:("EnSlime_SetupTurnToPlayer",), + 0x80A2F8E0:("EnSlime_TurnToPlayer",), + 0x80A2F9A0:("EnSlime_SetupJump",), + 0x80A2FA88:("EnSlime_Jump",), + 0x80A2FB60:("EnSlime_SetupLand",), + 0x80A2FBA0:("EnSlime_Land",), + 0x80A2FD94:("EnSlime_SetupReactToBluntHit",), + 0x80A2FE38:("EnSlime_ReactToBluntHit",), + 0x80A30018:("EnSlime_SetupDamaged",), + 0x80A30344:("EnSlime_Damaged",), + 0x80A30454:("EnSlime_SetupDead",), + 0x80A304B8:("EnSlime_Dead",), + 0x80A3072C:("EnSlime_SnapIceBlockPosition",), + 0x80A30778:("EnSlime_SetupSpawnIceBlock",), + 0x80A30820:("EnSlime_SpawnIceBlock",), + 0x80A30924:("EnSlime_SetupIceBlock",), + 0x80A30944:("EnSlime_IceBlock",), + 0x80A309C8:("EnSlime_SetupStun",), + 0x80A30A20:("EnSlime_Stun",), + 0x80A30A90:("EnSlime_SetupIceBlockThaw",), + 0x80A30AE4:("EnSlime_IceBlockThaw",), + 0x80A30BE0:("EnSlime_SetupWaitForRevive",), + 0x80A30C2C:("EnSlime_WaitForRevive",), + 0x80A30C68:("EnSlime_SetupRevive",), + 0x80A30CEC:("EnSlime_Revive",), + 0x80A30F98:("EnSlime_UpdateDamage",), 0x80A311E8:("EnSlime_Update",), 0x80A3148C:("EnSlime_Draw",), 0x80A32210:("EnPr_Init",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 0b44baae3..133034f3a 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -11152,19 +11152,19 @@ 0x80A2ECE0:("Dm_Sa_InitVars","UNK_TYPE1","",0x1), 0x80A2ED00:("sAnimationInfo","UNK_TYPE1","",0x1), 0x80A2ED20:("D_80A2ED20","f32","",0x4), - 0x80A31AD0:("En_Slime_InitVars","UNK_TYPE1","",0x1), - 0x80A31AF0:("D_80A31AF0","UNK_TYPE1","",0x1), - 0x80A31B1C:("D_80A31B1C","UNK_TYPE1","",0x1), - 0x80A31B3C:("D_80A31B3C","UNK_TYPE1","",0x1), - 0x80A31B44:("D_80A31B44","UNK_TYPE4","",0x4), - 0x80A31B54:("D_80A31B54","UNK_TYPE1","",0x1), - 0x80A31B5C:("D_80A31B5C","UNK_TYPE4","",0x4), - 0x80A31B60:("D_80A31B60","UNK_TYPE1","",0x1), - 0x80A31B64:("D_80A31B64","UNK_TYPE1","",0x1), - 0x80A31B68:("D_80A31B68","UNK_TYPE1","",0x1), - 0x80A31B74:("D_80A31B74","UNK_TYPE1","",0x1), - 0x80A31B84:("D_80A31B84","UNK_TYPE1","",0x1), - 0x80A31B94:("D_80A31B94","UNK_TYPE1","",0x1), + 0x80A31AD0:("En_Slime_InitVars","ActorInit","",0x1), + 0x80A31AF0:("sCylinderInit","ColliderCylinderInit","",0x1), + 0x80A31B1C:("sDamageTable","DamageTable","",0x1), + 0x80A31B3C:("sColChkInfoInit","CollisionCheckInfoInit","",0x1), + 0x80A31B44:("sEyeTextures","TexturePtr","",0x4), + 0x80A31B54:("sInitChain","InitChainEntry","",0x1), + 0x80A31B5C:("sTexturesDesegmented","s32","",0x1), + 0x80A31B60:("sBubblePrimColor","Color_RGBA8","",0x1), + 0x80A31B64:("sBubbleEnvColor","Color_RGBA8","",0x1), + 0x80A31B68:("sBubbleAccel","Vec3f","",0x1), + 0x80A31B74:("sPrimColors","Color_RGBA8","",0x4), + 0x80A31B84:("sEnvColors","Color_RGBA8","",0x4), + 0x80A31B94:("sLimbPosOffsets","Vec3f","",0x5), 0x80A31BD0:("D_80A31BD0","f32","",0x4), 0x80A31BD4:("D_80A31BD4","f32","",0x4), 0x80A31BD8:("D_80A31BD8","f32","",0x4), @@ -11249,7 +11249,7 @@ 0x80A31D14:("D_80A31D14","f32","",0x4), 0x80A31D18:("D_80A31D18","f32","",0x4), 0x80A31D1C:("D_80A31D1C","f32","",0x4), - 0x80A32200:("D_80A32200","UNK_TYPE1","",0x1), + 0x80A32200:("sSlimeTexAnim","AnimatedMaterial*","",0x1), 0x80A338A0:("D_80A338A0","UNK_TYPE1","",0x1), 0x80A338C0:("D_80A338C0","UNK_TYPE1","",0x1), 0x80A338D4:("En_Pr_InitVars","UNK_TYPE1","",0x1), From 8efba39749a90191d03ec4a046cb11d6ac9d2198 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Tue, 18 Apr 2023 09:42:08 -0700 Subject: [PATCH 16/29] z_viszbuf (code_801420C0) OK (#1211) * first pass * Match * variables.txt * Update include/functions.h Co-authored-by: Anghelo Carvajal --------- Co-authored-by: angie --- include/functions.h | 9 +++--- include/variables.h | 2 +- include/z64.h | 6 ++-- spec | 2 +- src/code/code_801420C0.c | 7 ---- src/code/game.c | 58 ++++++++++++++++------------------ src/code/z_viszbuf.c | 56 ++++++++++++++++++++++++++++++++ tools/disasm/files.txt | 2 +- tools/disasm/functions.txt | 6 ++-- tools/disasm/variables.txt | 2 +- tools/sizes/code_functions.csv | 6 ++-- 11 files changed, 101 insertions(+), 55 deletions(-) delete mode 100644 src/code/code_801420C0.c create mode 100644 src/code/z_viszbuf.c diff --git a/include/functions.h b/include/functions.h index f87ec4ff6..aff5ae5a1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2133,9 +2133,10 @@ void VisMono_Destroy(VisMono* this); // void VisMono_DesaturateDList(Gfx* gfx); void VisMono_Draw(VisMono* this, Gfx** gfxp); // void VisMono_DrawOld(VisMono* this); -void func_801420C0(void* arg0); -void func_801420F4(void* arg0); -void func_80142100(void* arg0, Gfx** gfx, u32 arg2); + +void VisZbuf_Init(VisZbuf* this); +void VisZbuf_Destroy(VisZbuf* this); +void VisZbuf_Draw(VisZbuf* this, Gfx** gfxP, void* zbuffer); // void func_80147520(void); void func_80147564(PlayState* play); @@ -2374,7 +2375,7 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon void Game_UpdateFramerateVariables(s32 divisor); void Game_SetFramerateDivisor(GameState* gameState, s32 divisor); -void GameState_SetFBFilter(Gfx** gfx, u32 arg1); +void GameState_SetFBFilter(Gfx** gfx, void* zbuffer); void Game_Nop80173534(GameState* gameState); void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx); void GameState_SetFrameBuffer(GraphicsContext* gfxCtx); diff --git a/include/variables.h b/include/variables.h index 745c019a8..90063b774 100644 --- a/include/variables.h +++ b/include/variables.h @@ -2440,7 +2440,7 @@ extern u8 sMotionBlurStatus; extern UNK_TYPE1 D_801F7FF0; extern struct_801F8010 D_801F8010; -extern struct_801F8020 D_801F8020; +extern VisZbuf sVisZbuf; extern VisMono sMonoColors; extern UNK_TYPE1 D_801F8048; extern FaultAddrConvClient sGraphFaultAddrConvClient; diff --git a/include/z64.h b/include/z64.h index b91333288..331077723 100644 --- a/include/z64.h +++ b/include/z64.h @@ -755,9 +755,9 @@ typedef struct { typedef struct { /* 0x0 */ u32 useRgba; /* 0x4 */ u32 setScissor; - /* 0x8 */ Color_RGBA8 primColor; - /* 0xC */ Color_RGBA8 envColor; -} struct_801F8020; // size = 0x10 + /* 0x8 */ Color_RGBA8_u32 primColor; + /* 0xC */ Color_RGBA8_u32 envColor; +} VisZbuf; // size = 0x10 typedef struct { /* 0x00 */ u32 unk_00; diff --git a/spec b/spec index dcf76f66b..417609b6f 100644 --- a/spec +++ b/spec @@ -527,7 +527,7 @@ beginseg include "build/data/code/code_80140CE0.data.o" include "build/src/code/code_80140E80.o" include "build/src/code/z_vismono.o" - include "build/src/code/code_801420C0.o" + include "build/src/code/z_viszbuf.o" include "build/src/code/z_vr_box.o" include "build/src/code/z_vr_box_draw.o" include "build/src/code/z_sram_NES.o" diff --git a/src/code/code_801420C0.c b/src/code/code_801420C0.c deleted file mode 100644 index 63c96571e..000000000 --- a/src/code/code_801420C0.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801420C0/func_801420C0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801420C0/func_801420F4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801420C0/func_80142100.s") diff --git a/src/code/game.c b/src/code/game.c index 4a4be5291..3ff4f9962 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -22,7 +22,7 @@ void Game_SetFramerateDivisor(GameState* gameState, s32 divisor) { Game_UpdateFramerateVariables(divisor); } -void GameState_SetFBFilter(Gfx** gfx, u32 arg1) { +void GameState_SetFBFilter(Gfx** gfx, void* zbuffer) { Gfx* dlist = *gfx; if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) { @@ -31,33 +31,29 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) { D_801F8010.color.g = R_FB_FILTER_PRIM_COLOR(1); D_801F8010.color.b = R_FB_FILTER_PRIM_COLOR(2); D_801F8010.color.a = R_FB_FILTER_A; - func_80140D10(&D_801F8010, &dlist, arg1); - } else { - if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { - D_801F8020.useRgba = (R_FB_FILTER_TYPE == 6); - D_801F8020.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - D_801F8020.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - D_801F8020.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - D_801F8020.primColor.a = R_FB_FILTER_A; - D_801F8020.envColor.r = R_FB_FILTER_ENV_COLOR(0); - D_801F8020.envColor.g = R_FB_FILTER_ENV_COLOR(1); - D_801F8020.envColor.b = R_FB_FILTER_ENV_COLOR(2); - D_801F8020.envColor.a = R_FB_FILTER_A; - func_80142100(&D_801F8020, &dlist, arg1); - } else { - if (R_FB_FILTER_TYPE == 7) { - sMonoColors.unk_00 = 0; - sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sMonoColors.primColor.a = R_FB_FILTER_A; - sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0); - sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1); - sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2); - sMonoColors.envColor.a = R_FB_FILTER_A; - VisMono_Draw(&sMonoColors, &dlist); - } - } + func_80140D10(&D_801F8010, &dlist, zbuffer); + } else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { + sVisZbuf.useRgba = (R_FB_FILTER_TYPE == 6); + sVisZbuf.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sVisZbuf.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sVisZbuf.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sVisZbuf.primColor.a = R_FB_FILTER_A; + sVisZbuf.envColor.r = R_FB_FILTER_ENV_COLOR(0); + sVisZbuf.envColor.g = R_FB_FILTER_ENV_COLOR(1); + sVisZbuf.envColor.b = R_FB_FILTER_ENV_COLOR(2); + sVisZbuf.envColor.a = R_FB_FILTER_A; + VisZbuf_Draw(&sVisZbuf, &dlist, zbuffer); + } else if (R_FB_FILTER_TYPE == 7) { + sMonoColors.unk_00 = 0; + sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sMonoColors.primColor.a = R_FB_FILTER_A; + sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0); + sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1); + sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2); + sMonoColors.envColor.a = R_FB_FILTER_A; + VisMono_Draw(&sMonoColors, &dlist); } *gfx = dlist; @@ -76,7 +72,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { gSPDisplayList(OVERLAY_DISP++, nextDisplayList); if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) { - GameState_SetFBFilter(&nextDisplayList, (u32)gfxCtx->zbuffer); + GameState_SetFBFilter(&nextDisplayList, gfxCtx->zbuffer); } if (R_ENABLE_ARENA_DBG < 0) { @@ -215,7 +211,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g init(gameState); func_80140CE0(&D_801F8010); - func_801420C0(&D_801F8020); + VisZbuf_Init(&sVisZbuf); VisMono_Init(&sMonoColors); func_80140898(&D_801F8048); func_801773A0(&D_801F7FF0); @@ -237,7 +233,7 @@ void GameState_Destroy(GameState* gameState) { Rumble_Destroy(); func_801773C4(&D_801F7FF0); func_80140D04(&D_801F8010); - func_801420F4(&D_801F8020); + VisZbuf_Destroy(&sVisZbuf); VisMono_Destroy(&sMonoColors); func_80140900(&D_801F8048); THA_Destroy(&gameState->heap); diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c new file mode 100644 index 000000000..9970a1e1b --- /dev/null +++ b/src/code/z_viszbuf.c @@ -0,0 +1,56 @@ +#include "global.h" + +#define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (D_801FBBCC * G_IM_SIZ_16b_BYTES)) + +void VisZbuf_Init(VisZbuf* this) { + this->useRgba = false; + this->setScissor = false; + this->primColor.r = 255; + this->primColor.g = 255; + this->primColor.b = 255; + this->primColor.a = 255; + this->envColor.r = 0; + this->envColor.g = 0; + this->envColor.b = 0; + this->envColor.a = 255; +} + +void VisZbuf_Destroy(VisZbuf* this) { +} + +void VisZbuf_Draw(VisZbuf* this, Gfx** gfxP, void* zbuffer) { + Gfx* gfx = *gfxP; + s32 height = VISZBUF_ZBUFFRAG_HEIGHT; + s32 y; + s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA; + + if (zbuffer == NULL) { + return; + } + + gDPPipeSync(gfx++); + if (this->setScissor == true) { + gSPDisplayList(gfx++, D_0E000000.setScissor); + } + + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2); + gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + + for (y = 0; y < (D_801FBBCE - height) + 1; y += height) { + gDPLoadTextureTile(gfx++, zbuffer, fmt, G_IM_SIZ_16b, D_801FBBCC, 0, 0, y, D_801FBBCC - 1, (y + height) - 1, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + gSPTextureRectangle(gfx++, 0, y << 2, D_801FBBCC << 2, (y + height) << 2, G_TX_RENDERTILE, 0, y << 5, 1 << 10, + 1 << 10); + } + + gDPPipeSync(gfx++); + *gfxP = gfx; +} diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 81701e140..372557384 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -431,7 +431,7 @@ 0x80140CE0 : "code_80140CE0", 0x80140E80 : "code_80140E80", 0x801418B0 : "z_vismono", - 0x801420C0 : "code_801420C0", + 0x801420C0 : "z_viszbuf", 0x80142440 : "z_vr_box", 0x801435A0 : "z_vr_box_draw", 0x80143A10 : "z_sram_NES", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index c9f7ab6cd..aa6770307 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2775,9 +2775,9 @@ 0x80141C34:("VisMono_DesaturateDList",), 0x80141E60:("VisMono_Draw",), 0x8014204C:("VisMono_DrawOld",), - 0x801420C0:("func_801420C0",), - 0x801420F4:("func_801420F4",), - 0x80142100:("func_80142100",), + 0x801420C0:("VisZbuf_Init",), + 0x801420F4:("VisZbuf_Destroy",), + 0x80142100:("VisZbuf_Draw",), 0x80142440:("func_80142440",), 0x80143148:("func_80143148",), 0x801431E8:("Skybox_Setup",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 133034f3a..38aa66512 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4067,7 +4067,7 @@ 0x801F6FE8:("sSlowlyStack","u8","[4096]",0x1000), 0x801F7FF0:("D_801F7FF0","UNK_TYPE1","",0x1), 0x801F8010:("D_801F8010","struct_801F8010","",0x10), - 0x801F8020:("D_801F8020","struct_801F8020","",0x10), + 0x801F8020:("sVisZbuf","VisZbuf","",0x10), 0x801F8030:("sMonoColors","VisMono","",0x18), 0x801F8048:("D_801F8048","UNK_TYPE1","",0x1), 0x801F80D0:("sGraphFaultAddrConvClient","FaultAddrConvClient","",0xc), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 1d08b2962..a18086d38 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2289,9 +2289,9 @@ asm/non_matchings/code/z_vismono/VisMono_DesaturateTLUT.s,VisMono_DesaturateTLUT asm/non_matchings/code/z_vismono/VisMono_DesaturateDList.s,VisMono_DesaturateDList,0x80141C34,0x8B asm/non_matchings/code/z_vismono/VisMono_Draw.s,VisMono_Draw,0x80141E60,0x7B asm/non_matchings/code/z_vismono/VisMono_DrawOld.s,VisMono_DrawOld,0x8014204C,0x1D -asm/non_matchings/code/code_801420C0/func_801420C0.s,func_801420C0,0x801420C0,0xD -asm/non_matchings/code/code_801420C0/func_801420F4.s,func_801420F4,0x801420F4,0x3 -asm/non_matchings/code/code_801420C0/func_80142100.s,func_80142100,0x80142100,0xD0 +asm/non_matchings/code/z_viszbuf/VisZbuf_Init.s,VisZbuf_Init,0x801420C0,0xD +asm/non_matchings/code/z_viszbuf/VisZbuf_Destroy.s,VisZbuf_Destroy,0x801420F4,0x3 +asm/non_matchings/code/z_viszbuf/VisZbuf_Draw.s,VisZbuf_Draw,0x80142100,0xD0 asm/non_matchings/code/z_vr_box/func_80142440.s,func_80142440,0x80142440,0x342 asm/non_matchings/code/z_vr_box/func_80143148.s,func_80143148,0x80143148,0x28 asm/non_matchings/code/z_vr_box/Skybox_Setup.s,Skybox_Setup,0x801431E8,0x4F From 3dd7a5a3993c5ef49921364a2402baa028461288 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Tue, 18 Apr 2023 14:21:01 -0400 Subject: [PATCH 17/29] Add --convert-statics=global-with-filename (#1217) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3a488dc84..892d0355b 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump ASM_PROC := python3 tools/asm-processor/build.py -ASM_PROC_FLAGS := --input-enc=utf-8 --output-enc=euc-jp +ASM_PROC_FLAGS := --input-enc=utf-8 --output-enc=euc-jp --convert-statics=global-with-filename IINC := -Iinclude -Isrc -Iassets -Ibuild -I. From 44b04292cd7fa1b15facb8db18df9d3d2a321969 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 19 Apr 2023 04:49:36 +1000 Subject: [PATCH 18/29] Match `DynaPoly_ExpandSRT` (#1203) * match DynaPoly_ExpandSRT * name variables * oops --- include/variables.h | 2 +- src/code/z_bgcheck.c | 307 ++++++++++++++++++------------------- tools/disasm/variables.txt | 2 +- 3 files changed, 155 insertions(+), 156 deletions(-) diff --git a/include/variables.h b/include/variables.h index 90063b774..4ef96eab2 100644 --- a/include/variables.h +++ b/include/variables.h @@ -2259,7 +2259,7 @@ extern char D_801ED950[80]; extern char D_801ED9A0[80]; extern Vec3f D_801ED9F0[3]; extern Vec3f D_801EDA18[3]; -extern MtxF D_801EDA40; +extern MtxF sModelToWorldMtxF; extern Vec3f D_801EDA80[3]; extern char D_801EDAA8[80]; extern char D_801EDAF8[80]; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index ad04236fe..c0bfe8047 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -89,7 +89,7 @@ char D_801ED9A0[80]; char D_801EDAA8[80]; char D_801EDAF8[80]; -MtxF D_801EDA40; +MtxF sModelToWorldMtxF; void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast); @@ -954,12 +954,12 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte s32 BgCheck_CheckLineAgainstSSList(StaticLineTest* arg0) { CollisionPoly* polyList; s32 result; - Vec3f polyIntersect; // sp7C + Vec3f polyIntersect; SSNode* curNode; u8* checkedPoly; f32 minY; f32 distSq; - BgLineVsPolyTest test; // sp50 + BgLineVsPolyTest test; s16 polyId; result = false; @@ -2855,38 +2855,28 @@ void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPo } } -#ifdef NON_MATCHING /** * original name: DynaPolyInfo_expandSRT */ void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, s32* waterBoxStartIndex) { Actor* actor; - s32 pad; - s32 pad2; - f32 numVtxInverse; s32 i; - Vec3f pos; // sp170 + s32 j; + s32 wi; + f32 numVtxInverse; + Vec3f pos; Sphere16* sphere; Vec3s* dVtxList; Vec3s* point; - Vec3f newCenterPoint; // sp158 - + Vec3f newCenterPoint; f32 newRadiusSq; CollisionHeader* pbgdata; - Vec3f newVtx; // sp144 - Vec3f vtxA; // sp138 - Vec3f vtxB; // sp12C - Vec3f vtxC; // sp120 + Vec3f newVtx; + Vec3f vtxA; + Vec3f vtxB; + Vec3f vtxC; Vec3f newNormal; - s32 wi; - Vec3f spB8; // waterbox ? - Vec3f spAC; - Vec3f spA0; // waterbox ? - Vec3f sp94; - Vec3f sp88; // waterbox ? - Vec3f sp7C; - WaterBox* waterBox; pbgdata = dyna->bgActors[bgId].colHeader; sphere = &dyna->bgActors[bgId].boundingSphere; @@ -2897,12 +2887,15 @@ void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s pos = actor->world.pos; pos.y += actor->shape.yOffset * actor->scale.y; + //! FAKE: + if (pbgdata && pbgdata) {} + ScaleRotPos_SetValue(&dyna->bgActors[bgId].curTransform, &actor->scale, &actor->shape.rot, &pos); if (dyna->bgActorFlags[bgId] & 4) { return; } - // if(&pos){} // fake but considerably improves match. commented out to stop warnings + if (*waterBoxStartIndex + pbgdata->numWaterBoxes > DYNA_WATERBOX_MAX) { sprintf(D_801EDAA8, "water_poly Error:[MoveBG OSUGI!!!]"); sprintf(D_801EDAF8, "num = %d > %d\n", *waterBoxStartIndex + pbgdata->numWaterBoxes, DYNA_WATERBOX_MAX); @@ -2951,139 +2944,145 @@ void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s *polyStartIndex += pbgdata->numPolygons; *vtxStartIndex += pbgdata->numVertices; *waterBoxStartIndex += pbgdata->numWaterBoxes; - } else { - SkinMatrix_SetScaleRotateYRPTranslate( - &D_801EDA40, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y, - dyna->bgActors[bgId].curTransform.scale.z, dyna->bgActors[bgId].curTransform.rot.x, - dyna->bgActors[bgId].curTransform.rot.y, dyna->bgActors[bgId].curTransform.rot.z, - dyna->bgActors[bgId].curTransform.pos.x, dyna->bgActors[bgId].curTransform.pos.y, - dyna->bgActors[bgId].curTransform.pos.z); - - if ((pbgdata->numVertices != 0) && (pbgdata->numPolygons != 0)) { - s32 j; - numVtxInverse = 1.0f / pbgdata->numVertices; - newCenterPoint.x = newCenterPoint.y = newCenterPoint.z = 0.0f; - for (i = 0; i < pbgdata->numVertices; i++) { - Vec3f vtx; // spF4 - Vec3f vtxT; // spE8 Vtx after mtx transform - - Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]); - SkinMatrix_Vec3fMtxFMultXYZ(&D_801EDA40, &vtx, &vtxT); - BgCheck_Vec3fToVec3s(&dyna->vtxList[*vtxStartIndex + i], &vtxT); - - if (i == 0) { - dyna->bgActors[bgId].minY = dyna->bgActors[bgId].maxY = vtxT.y; - } else if (vtxT.y < dyna->bgActors[bgId].minY) { - dyna->bgActors[bgId].minY = vtxT.y; - } else if (dyna->bgActors[bgId].maxY < vtxT.y) { - dyna->bgActors[bgId].maxY = vtxT.y; - } - newCenterPoint.x += vtxT.x; - newCenterPoint.y += vtxT.y; - newCenterPoint.z += vtxT.z; - } - - newCenterPoint.x *= numVtxInverse; - newCenterPoint.y *= numVtxInverse; - newCenterPoint.z *= numVtxInverse; - sphere->center.x = newCenterPoint.x; - sphere->center.y = newCenterPoint.y; - sphere->center.z = newCenterPoint.z; - newRadiusSq = -100.0f; - - for (i = 0, j = *vtxStartIndex; i < pbgdata->numVertices; i++, j++) { - f32 radiusSq; - - newVtx.x = dyna->vtxList[j].x; - newVtx.y = dyna->vtxList[j].y; - newVtx.z = dyna->vtxList[j].z; - radiusSq = Math3D_Vec3fDistSq(&newVtx, &newCenterPoint); - if (newRadiusSq < radiusSq) { - newRadiusSq = radiusSq; - } - } - - sphere->radius = sqrtf(newRadiusSq) * 1.1f; - - for (i = 0; i < pbgdata->numPolygons; i++) { - CollisionPoly* newPoly = &dyna->polyList[*polyStartIndex + i]; - f32 newNormMagnitude; - u32 vIA; - u32 vIB; - u32 vIC; - - *newPoly = pbgdata->polyList[i]; - - vIA = (COLPOLY_VTX_INDEX(newPoly->flags_vIA) + *vtxStartIndex); - vIB = (COLPOLY_VTX_INDEX(newPoly->flags_vIB) + *vtxStartIndex); - vIC = newPoly->vIC + *vtxStartIndex; - - newPoly->flags_vIA = vIA | ((*newPoly).flags_vIA & 0xE000); - newPoly->flags_vIB = vIB | ((*newPoly).flags_vIB & 0xE000); - newPoly->vIC = vIC; - dVtxList = dyna->vtxList; - vtxA.x = dVtxList[vIA].x; - vtxA.y = dVtxList[vIA].y; - vtxA.z = dVtxList[vIA].z; - vtxB.x = dVtxList[vIB].x; - vtxB.y = dVtxList[vIB].y; - vtxB.z = dVtxList[vIB].z; - vtxC.x = dVtxList[vIC].x; - vtxC.y = dVtxList[vIC].y; - vtxC.z = dVtxList[vIC].z; - Math3D_SurfaceNorm(&vtxA, &vtxB, &vtxC, &newNormal); - newNormMagnitude = Math3D_Vec3fMagnitude(&newNormal); - - if (!IS_ZERO(newNormMagnitude)) { - newNormal.x *= (1.0f / newNormMagnitude); - newNormal.y *= (1.0f / newNormMagnitude); - newNormal.z *= (1.0f / newNormMagnitude); - newPoly->normal.x = COLPOLY_SNORMAL(newNormal.x); - newPoly->normal.y = COLPOLY_SNORMAL(newNormal.y); - newPoly->normal.z = COLPOLY_SNORMAL(newNormal.z); - } - - newPoly->dist = func_80086D24(-DOTXYZ(newNormal, vtxA)); - if (newNormal.y > 0.5f) { - s16 polyId = *polyStartIndex + i; - - DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.floor, &polyId); - } else if (newNormal.y < -0.8f) { - s16 polyId = *polyStartIndex + i; - - DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.ceiling, &polyId); - } else { - s16 polyId = *polyStartIndex + i; - - DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.wall, &polyId); - } - } - } - - if (pbgdata->numWaterBoxes > 0) { - for (wi = 0; wi < pbgdata->numWaterBoxes; wi++) { - Math_Vec3s_ToVec3f(&spB8, &pbgdata->waterBoxes[wi].minPos); - Math_Vec3f_Copy(&spA0, &spB8); - spA0.x += pbgdata->waterBoxes[wi].xLength; - Math_Vec3f_Copy(&sp88, &spB8); - sp88.z += pbgdata->waterBoxes[wi].zLength; - SkinMatrix_Vec3fMtxFMultXYZ(&D_801EDA40, &spB8, &spAC); - SkinMatrix_Vec3fMtxFMultXYZ(&D_801EDA40, &spA0, &sp94); - SkinMatrix_Vec3fMtxFMultXYZ(&D_801EDA40, &sp88, &sp7C); - waterBox = &dyna->waterBoxList.boxes[*waterBoxStartIndex + wi]; - BgCheck_CalcWaterboxDimensions(&spAC, &sp94, &sp7C, &waterBox->minPos, &waterBox->xLength, - &waterBox->zLength); - waterBox->properties = pbgdata->waterBoxes[wi].properties; - } - } - *polyStartIndex += pbgdata->numPolygons; - *vtxStartIndex += pbgdata->numVertices; - *waterBoxStartIndex += pbgdata->numWaterBoxes; + return; } + + SkinMatrix_SetScaleRotateYRPTranslate( + &sModelToWorldMtxF, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y, + dyna->bgActors[bgId].curTransform.scale.z, dyna->bgActors[bgId].curTransform.rot.x, + dyna->bgActors[bgId].curTransform.rot.y, dyna->bgActors[bgId].curTransform.rot.z, + dyna->bgActors[bgId].curTransform.pos.x, dyna->bgActors[bgId].curTransform.pos.y, + dyna->bgActors[bgId].curTransform.pos.z); + + if ((pbgdata->numVertices != 0) && (pbgdata->numPolygons != 0)) { + f32 radiusSq; + + numVtxInverse = 1.0f / pbgdata->numVertices; + newCenterPoint.x = newCenterPoint.y = newCenterPoint.z = 0.0f; + for (i = 0; i < pbgdata->numVertices; i++) { + Vec3f vtx; + Vec3f vtxT; // Vtx after mtx transform + s32 pad; + + Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]); + SkinMatrix_Vec3fMtxFMultXYZ(&sModelToWorldMtxF, &vtx, &vtxT); + BgCheck_Vec3fToVec3s(&dyna->vtxList[*vtxStartIndex + (u32)i], &vtxT); + + if (i == 0) { + dyna->bgActors[bgId].minY = dyna->bgActors[bgId].maxY = vtxT.y; + } else if (vtxT.y < dyna->bgActors[bgId].minY) { + dyna->bgActors[bgId].minY = vtxT.y; + } else if (dyna->bgActors[bgId].maxY < vtxT.y) { + dyna->bgActors[bgId].maxY = vtxT.y; + } + newCenterPoint.x += vtxT.x; + newCenterPoint.y += vtxT.y; + newCenterPoint.z += vtxT.z; + } + + newCenterPoint.x *= numVtxInverse; + newCenterPoint.y *= numVtxInverse; + newCenterPoint.z *= numVtxInverse; + sphere->center.x = newCenterPoint.x; + sphere->center.y = newCenterPoint.y; + sphere->center.z = newCenterPoint.z; + newRadiusSq = -100.0f; + + for (i = 0, j = *vtxStartIndex; i < pbgdata->numVertices; i++, j++) { + newVtx.x = dyna->vtxList[j].x; + newVtx.y = dyna->vtxList[j].y; + newVtx.z = dyna->vtxList[j].z; + radiusSq = Math3D_Vec3fDistSq(&newVtx, &newCenterPoint); + if (newRadiusSq < radiusSq) { + newRadiusSq = radiusSq; + } + } + + sphere->radius = sqrtf(newRadiusSq) * 1.1f; + + for (i = 0; i < pbgdata->numPolygons; i++) { + CollisionPoly* newPoly = &dyna->polyList[*polyStartIndex + i]; + f32 newNormMagnitude; + u32 vIA; + u32 vIB; + u32 vIC; + + *newPoly = pbgdata->polyList[i]; + + vIA = (COLPOLY_VTX_INDEX(newPoly->flags_vIA) + *vtxStartIndex); + vIB = (COLPOLY_VTX_INDEX(newPoly->flags_vIB) + *vtxStartIndex); + vIC = newPoly->vIC + *vtxStartIndex; + + newPoly->flags_vIA = vIA | (newPoly->flags_vIA & 0xE000); + newPoly->flags_vIB = vIB | (newPoly->flags_vIB & 0xE000); + newPoly->vIC = vIC; + dVtxList = dyna->vtxList; + vtxA.x = dVtxList[vIA].x; + vtxA.y = dVtxList[vIA].y; + vtxA.z = dVtxList[vIA].z; + vtxB.x = dVtxList[vIB].x; + vtxB.y = dVtxList[vIB].y; + vtxB.z = dVtxList[vIB].z; + vtxC.x = dVtxList[vIC].x; + vtxC.y = dVtxList[vIC].y; + vtxC.z = dVtxList[vIC].z; + Math3D_SurfaceNorm(&vtxA, &vtxB, &vtxC, &newNormal); + newNormMagnitude = Math3D_Vec3fMagnitude(&newNormal); + + if (!IS_ZERO(newNormMagnitude)) { + newNormal.x *= 1.0f / newNormMagnitude; + newNormal.y *= 1.0f / newNormMagnitude; + newNormal.z *= 1.0f / newNormMagnitude; + newPoly->normal.x = COLPOLY_SNORMAL(newNormal.x); + newPoly->normal.y = COLPOLY_SNORMAL(newNormal.y); + newPoly->normal.z = COLPOLY_SNORMAL(newNormal.z); + } + + newPoly->dist = func_80086D24(-DOTXYZ(newNormal, vtxA)); + if (newNormal.y > 0.5f) { + s16 polyId = *polyStartIndex + i; + + DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.floor, &polyId); + } else if (newNormal.y < -0.8f) { + s16 polyId = *polyStartIndex + i; + + DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.ceiling, &polyId); + } else { + s16 polyId = *polyStartIndex + i; + + DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.wall, &polyId); + } + } + } + + if (pbgdata->numWaterBoxes > 0) { + for (wi = 0; wi < pbgdata->numWaterBoxes; wi++) { + WaterBox* waterBox; + Vec3f modelMinPos; + Vec3f worldMinPos; + Vec3f modelMinPosXOffset; + Vec3f worldMinPosXOffset; + Vec3f modelMinPosZOffset; + Vec3f worldMinPosZOffset; + + Math_Vec3s_ToVec3f(&modelMinPos, &pbgdata->waterBoxes[wi].minPos); + Math_Vec3f_Copy(&modelMinPosXOffset, &modelMinPos); + modelMinPosXOffset.x += pbgdata->waterBoxes[wi].xLength; + Math_Vec3f_Copy(&modelMinPosZOffset, &modelMinPos); + modelMinPosZOffset.z += pbgdata->waterBoxes[wi].zLength; + SkinMatrix_Vec3fMtxFMultXYZ(&sModelToWorldMtxF, &modelMinPos, &worldMinPos); + SkinMatrix_Vec3fMtxFMultXYZ(&sModelToWorldMtxF, &modelMinPosXOffset, &worldMinPosXOffset); + SkinMatrix_Vec3fMtxFMultXYZ(&sModelToWorldMtxF, &modelMinPosZOffset, &worldMinPosZOffset); + waterBox = &dyna->waterBoxList.boxes[*waterBoxStartIndex + wi]; + BgCheck_CalcWaterboxDimensions(&worldMinPos, &worldMinPosXOffset, &worldMinPosZOffset, &waterBox->minPos, + &waterBox->xLength, &waterBox->zLength); + waterBox->properties = pbgdata->waterBoxes[wi].properties; + } + } + *polyStartIndex += pbgdata->numPolygons; + *vtxStartIndex += pbgdata->numVertices; + *waterBoxStartIndex += pbgdata->numWaterBoxes; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/DynaPoly_ExpandSRT.s") -#endif void BgCheck_ResetFlagsIfLoadedActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor) { DynaPolyActor* dynaActor; diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 38aa66512..dc5f57f8c 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -3862,7 +3862,7 @@ 0x801ED9A0:("D_801ED9A0","char","[80]",0x50), 0x801ED9F0:("D_801ED9F0","Vec3f","[3]",0x24), 0x801EDA18:("D_801EDA18","Vec3f","[3]",0x24), - 0x801EDA40:("D_801EDA40","MtxF","",0x40), + 0x801EDA40:("sModelToWorldMtxF","MtxF","",0x40), 0x801EDA80:("D_801EDA80","Vec3f","[3]",0x24), 0x801EDAA8:("D_801EDAA8","char","[80]",0x50), 0x801EDAF8:("D_801EDAF8","char","[80]",0x50), From a67d086addc1d0e226c28cadf58dda5e637d58ba Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 19 Apr 2023 06:02:56 +1000 Subject: [PATCH 19/29] Defines for flags passed to `Actor_UpdateBgCheckInfo` (#1197) * add flags * add comment * small fix --------- Co-authored-by: angie --- include/functions.h | 2 +- include/z64actor.h | 15 +++++++ src/code/z_actor.c | 42 +++++++++---------- src/code/z_en_item00.c | 4 +- .../actors/ovl_Bg_Icicle/z_bg_icicle.c | 2 +- .../ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c | 5 ++- .../ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c | 2 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 2 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 3 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 5 ++- src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c | 2 +- src/overlays/actors/ovl_Dm_Al/z_dm_al.c | 2 +- src/overlays/actors/ovl_Dm_An/z_dm_an.c | 2 +- src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c | 2 +- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c | 2 +- src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c | 2 +- src/overlays/actors/ovl_En_Ah/z_en_ah.c | 2 +- .../ovl_En_Akindonuts/z_en_akindonuts.c | 2 +- src/overlays/actors/ovl_En_Am/z_en_am.c | 4 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 2 +- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 4 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 6 +-- src/overlays/actors/ovl_En_Baba/z_en_baba.c | 2 +- src/overlays/actors/ovl_En_Baguo/z_en_baguo.c | 4 +- .../actors/ovl_En_Baisen/z_en_baisen.c | 4 +- src/overlays/actors/ovl_En_Bat/z_en_bat.c | 8 ++-- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 3 +- .../actors/ovl_En_Bba_01/z_en_bba_01.c | 2 +- .../actors/ovl_En_Bbfall/z_en_bbfall.c | 3 +- src/overlays/actors/ovl_En_Bee/z_en_bee.c | 4 +- .../actors/ovl_En_Bigpamet/z_en_bigpamet.c | 4 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 2 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 4 +- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 2 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 6 ++- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 4 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 2 +- .../actors/ovl_En_Bombers/z_en_bombers.c | 4 +- .../actors/ovl_En_Bombers2/z_en_bombers2.c | 4 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 8 +++- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 4 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 4 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 3 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 3 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 2 +- .../actors/ovl_En_Cne_01/z_en_cne_01.c | 2 +- .../actors/ovl_En_Col_Man/z_en_col_man.c | 4 +- src/overlays/actors/ovl_En_Cow/z_en_cow.c | 2 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 3 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 4 +- .../actors/ovl_En_Daiku2/z_en_daiku2.c | 4 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 5 ++- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 4 +- .../ovl_En_Demo_heishi/z_en_demo_heishi.c | 4 +- src/overlays/actors/ovl_En_Dg/z_en_dg.c | 2 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 4 +- src/overlays/actors/ovl_En_Dno/z_en_dno.c | 6 +-- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 2 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 4 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 4 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 3 +- .../ovl_En_Ending_Hero/z_en_ending_hero.c | 4 +- .../ovl_En_Ending_Hero2/z_en_ending_hero2.c | 4 +- .../ovl_En_Ending_Hero3/z_en_ending_hero3.c | 4 +- .../ovl_En_Ending_Hero4/z_en_ending_hero4.c | 4 +- .../ovl_En_Ending_Hero5/z_en_ending_hero5.c | 4 +- .../ovl_En_Ending_Hero6/z_en_ending_hero6.c | 4 +- .../actors/ovl_En_Estone/z_en_estone.c | 3 +- src/overlays/actors/ovl_En_Famos/z_en_famos.c | 4 +- src/overlays/actors/ovl_En_Fg/z_en_fg.c | 7 ++-- .../actors/ovl_En_Firefly/z_en_firefly.c | 3 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 22 +++++----- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 2 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 3 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 9 ++-- .../actors/ovl_En_Floormas/z_en_floormas.c | 4 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- .../actors/ovl_En_Fu_Mato/z_en_fu_mato.c | 6 ++- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 2 +- .../actors/ovl_En_Gamelupy/z_en_gamelupy.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 3 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 3 +- src/overlays/actors/ovl_En_Geg/z_en_geg.c | 2 +- src/overlays/actors/ovl_En_Gg/z_en_gg.c | 3 +- src/overlays/actors/ovl_En_Giant/z_en_giant.c | 2 +- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 3 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 3 +- .../ovl_En_Grasshopper/z_en_grasshopper.c | 4 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 2 +- .../ovl_En_Guard_Nuts/z_en_guard_nuts.c | 4 +- .../actors/ovl_En_Guruguru/z_en_guruguru.c | 4 +- .../actors/ovl_En_Hakurock/z_en_hakurock.c | 3 +- .../actors/ovl_En_Heishi/z_en_heishi.c | 4 +- src/overlays/actors/ovl_En_Hg/z_en_hg.c | 2 +- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.c | 4 +- .../actors/ovl_En_Hint_Skb/z_en_hint_skb.c | 4 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 7 +++- .../z_en_horse_link_child.c | 4 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 2 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 4 +- src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- .../actors/ovl_En_Insect/z_en_insect.c | 12 +++--- .../z_en_invisible_ruppe.c | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 8 +++- src/overlays/actors/ovl_En_Ja/z_en_ja.c | 2 +- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 3 +- src/overlays/actors/ovl_En_Js/z_en_js.c | 2 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 4 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 3 +- src/overlays/actors/ovl_En_Kame/z_en_kame.c | 4 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 10 +++-- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 5 ++- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 8 +++- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 3 +- .../actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c | 4 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 4 +- .../actors/ovl_En_Ma_Yto/z_en_ma_yto.c | 2 +- .../actors/ovl_En_Ma_Yts/z_en_ma_yts.c | 2 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 4 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 2 +- src/overlays/actors/ovl_En_Mkk/z_en_mkk.c | 4 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 4 +- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 2 +- .../actors/ovl_En_Mushi2/z_en_mushi2.c | 3 +- src/overlays/actors/ovl_En_Muto/z_en_muto.c | 4 +- .../actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c | 2 +- .../actors/ovl_En_Nimotsu/z_en_nimotsu.c | 2 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 4 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 3 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 2 +- .../actors/ovl_En_Onpuman/z_en_onpuman.c | 2 +- src/overlays/actors/ovl_En_Ot/z_en_ot.c | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 4 +- .../actors/ovl_En_Pamera/z_en_pamera.c | 4 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 4 +- src/overlays/actors/ovl_En_Paper/z_en_paper.c | 2 +- .../actors/ovl_En_Peehat/z_en_peehat.c | 2 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 4 +- .../actors/ovl_En_Po_Fusen/z_en_po_fusen.c | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 2 +- src/overlays/actors/ovl_En_Pp/z_en_pp.c | 4 +- src/overlays/actors/ovl_En_Pr/z_en_pr.c | 4 +- src/overlays/actors/ovl_En_Pr2/z_en_pr2.c | 8 +++- src/overlays/actors/ovl_En_Prz/z_en_prz.c | 4 +- src/overlays/actors/ovl_En_Pst/z_en_pst.c | 2 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 2 +- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.c | 2 +- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 6 ++- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 3 +- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 4 +- src/overlays/actors/ovl_En_Rg/z_en_rg.c | 4 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 4 +- src/overlays/actors/ovl_En_Ru/z_en_ru.c | 2 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 3 +- src/overlays/actors/ovl_En_Rz/z_en_rz.c | 2 +- .../actors/ovl_En_S_Goro/z_en_s_goro.c | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 2 +- .../actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c | 2 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 2 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 4 +- .../actors/ovl_En_Snowman/z_en_snowman.c | 8 +++- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 2 +- src/overlays/actors/ovl_En_St/z_en_st.c | 2 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 2 +- .../ovl_En_Stone_heishi/z_en_stone_heishi.c | 4 +- .../ovl_En_Stop_heishi/z_en_stop_heishi.c | 4 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 4 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 4 +- .../ovl_En_Syateki_Wf/z_en_syateki_wf.c | 2 +- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 2 +- .../ovl_En_Talk_Gibud/z_en_talk_gibud.c | 4 +- .../actors/ovl_En_Tanron2/z_en_tanron2.c | 2 +- .../actors/ovl_En_Tanron3/z_en_tanron3.c | 2 +- .../actors/ovl_En_Tanron5/z_en_tanron5.c | 4 +- .../actors/ovl_En_Tanron6/z_en_tanron6.c | 4 +- src/overlays/actors/ovl_En_Tg/z_en_tg.c | 2 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 3 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 7 ++-- src/overlays/actors/ovl_En_Tite/z_en_tite.h | 2 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 4 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 2 +- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 2 +- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 2 +- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 2 +- src/overlays/actors/ovl_En_Tsn/z_en_tsn.c | 2 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 4 +- src/overlays/actors/ovl_En_Vm/z_en_vm.c | 3 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 4 +- .../ovl_En_Water_Effect/z_en_water_effect.c | 4 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 4 +- src/overlays/actors/ovl_En_Wiz/z_en_wiz.c | 4 +- .../actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c | 4 +- src/overlays/actors/ovl_En_Yb/z_en_yb.c | 2 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 2 +- src/overlays/actors/ovl_En_Zob/z_en_zob.c | 2 +- src/overlays/actors/ovl_En_Zod/z_en_zod.c | 2 +- src/overlays/actors/ovl_En_Zog/z_en_zog.c | 2 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 2 +- src/overlays/actors/ovl_En_Zos/z_en_zos.c | 2 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 2 +- src/overlays/actors/ovl_En_Zov/z_en_zov.c | 2 +- src/overlays/actors/ovl_En_Zow/z_en_zow.c | 2 +- src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c | 2 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 2 +- .../actors/ovl_Obj_Armos/z_obj_armos.c | 12 +++--- .../actors/ovl_Obj_Armos/z_obj_armos.h | 2 +- .../ovl_Obj_Bigicicle/z_obj_bigicicle.c | 2 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 2 +- .../ovl_Obj_Flowerpot/z_obj_flowerpot.c | 3 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 2 +- .../ovl_Obj_Grass_Carry/z_obj_grass_carry.c | 4 +- .../actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c | 4 +- .../ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c | 4 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 12 ++++-- .../ovl_Obj_Lupygamelift/z_obj_lupygamelift.c | 2 +- .../actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c | 14 +++---- .../actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h | 2 +- .../ovl_Obj_Snowball2/z_obj_snowball2.c | 9 ++-- src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c | 3 +- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c | 2 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 13 ++++-- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 3 +- 230 files changed, 544 insertions(+), 323 deletions(-) diff --git a/include/functions.h b/include/functions.h index aff5ae5a1..b9b3b682b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -667,7 +667,7 @@ s32 Actor_IsFacingAndNearPlayer(Actor* actor, f32 range, s16 maxAngleDiff); s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s16 maxAngleDiff); void Actor_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* downwardSlopeYaw); -void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, u32 flags); +void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, f32 ceilingCheckHeight, u32 updBgCheckInfoFlags); Hilite* Hilite_DrawOpa(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx); void func_800B8050(Actor* actor, PlayState* play, s32 flag); void func_800B8118(Actor* actor, PlayState* play, s32 flag); diff --git a/include/z64actor.h b/include/z64actor.h index 86ea6e22c..5e9c35cf4 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -134,6 +134,7 @@ typedef struct { /* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDrawOpa } ActorShape; // size = 0x30 +// Flags for bgCheckFlags #define BGCHECKFLAG_GROUND (1 << 0) // Standing on the ground #define BGCHECKFLAG_GROUND_TOUCH (1 << 1) // Has touched the ground (only active for 1 frame) #define BGCHECKFLAG_GROUND_LEAVE (1 << 2) // Has left the ground (only active for 1 frame) @@ -148,6 +149,20 @@ typedef struct { #define BGCHECKFLAG_PLAYER_800 (1 << 11) // #define BGCHECKFLAG_PLAYER_1000 (1 << 12) // +// Flags for Actor_UpdateBgCheckInfo +#define UPDBGCHECKINFO_FLAG_1 (1 << 0) // check wall +#define UPDBGCHECKINFO_FLAG_2 (1 << 1) // check ceiling +#define UPDBGCHECKINFO_FLAG_4 (1 << 2) // check floor and water +#define UPDBGCHECKINFO_FLAG_8 (1 << 3) +#define UPDBGCHECKINFO_FLAG_10 (1 << 4) +#define UPDBGCHECKINFO_FLAG_20 (1 << 5) // unused +#define UPDBGCHECKINFO_FLAG_40 (1 << 6) // disable water ripples +#define UPDBGCHECKINFO_FLAG_80 (1 << 7) +#define UPDBGCHECKINFO_FLAG_100 (1 << 8) +#define UPDBGCHECKINFO_FLAG_200 (1 << 9) +#define UPDBGCHECKINFO_FLAG_400 (1 << 10) // check water +#define UPDBGCHECKINFO_FLAG_800 (1 << 11) + typedef struct Actor { /* 0x000 */ s16 id; // Actor ID /* 0x002 */ u8 category; // Actor category. Refer to the corresponding enum for values diff --git a/src/code/z_actor.c b/src/code/z_actor.c index d3eea4ebe..db01bb345 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1502,12 +1502,12 @@ void Actor_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* *downwardSlopeYaw = Math_Atan2S_XY(slopeNormal->z, slopeNormal->x); } -s32 func_800B761C(Actor* actor, f32 arg1, s32 arg2) { +s32 func_800B761C(Actor* actor, f32 arg1, s32 updBgCheckInfoFlags) { if (actor->bgCheckFlags & BGCHECKFLAG_GROUND) { actor->bgCheckFlags &= ~BGCHECKFLAG_GROUND; actor->bgCheckFlags |= BGCHECKFLAG_GROUND_LEAVE; - if ((actor->velocity.y < 0.0f) && (arg2 & 0x10)) { + if ((actor->velocity.y < 0.0f) && (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_10)) { actor->velocity.y = 0.0f; } return false; @@ -1516,16 +1516,16 @@ s32 func_800B761C(Actor* actor, f32 arg1, s32 arg2) { return true; } -s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) { +s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 updBgCheckInfoFlags) { f32 distToFloor; s32 bgId; - pos->y += (flags & 0x800) ? 10.0f : 50.0f; + pos->y += (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_800) ? 10.0f : 50.0f; actor->floorHeight = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &actor->floorPoly, &bgId, actor, pos); actor->bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_GROUND_LEAVE | BGCHECKFLAG_GROUND_STRICT); if (actor->floorHeight <= BGCHECK_Y_MIN) { - return func_800B761C(actor, BGCHECK_Y_MIN, flags); + return func_800B761C(actor, BGCHECK_Y_MIN, updBgCheckInfoFlags); } distToFloor = actor->floorHeight - actor->world.pos.y; @@ -1551,9 +1551,9 @@ s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) { if (actor->velocity.y <= 0.0f) { if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { actor->bgCheckFlags |= BGCHECKFLAG_GROUND_TOUCH; - } else if ((flags & 8) && (actor->gravity < 0.0f)) { + } else if ((updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_8) && (actor->gravity < 0.0f)) { actor->velocity.y = -4.0f; - } else if (!(flags & 0x100)) { + } else if (!(updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_100)) { actor->velocity.y = 0.0f; } @@ -1561,14 +1561,14 @@ s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) { BgCheck2_AttachToMesh(&play->colCtx, actor, (s32)actor->floorBgId); } } else { - return func_800B761C(actor, distToFloor, flags); + return func_800B761C(actor, distToFloor, updBgCheckInfoFlags); } return true; } void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, f32 wallCheckRadius, - f32 ceilingCheckHeight, u32 flags) { + f32 ceilingCheckHeight, u32 updBgCheckInfoFlags) { f32 sp94 = actor->world.pos.y - actor->prevPos.y; s32 pad; Vec3f pos; @@ -1577,21 +1577,21 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, actor->floorBgId, actor); } - if (flags & 1) { + if (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_1) { s32 bgId; actor->bgCheckFlags &= ~BGCHECKFLAG_PLAYER_1000; - if ((!(flags & 0x80) && + if ((!(updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_80) && (BgCheck_EntitySphVsWall3(&play->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight))) || - ((flags & 0x80) && + ((updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_80) && (BgCheck_EntitySphVsWall4(&play->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius, &actor->wallPoly, &bgId, actor, wallCheckHeight)))) { CollisionPoly* sp7C = actor->wallPoly; actor->bgCheckFlags |= BGCHECKFLAG_WALL; - if ((flags & 0x200) && (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_1000) && ((s32)sp7C->normal.y > 0) && - (sqrtf(SQXYZ(actor->colChkInfo.displacement)) < 10.0f)) { + if ((updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_200) && (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_1000) && + ((s32)sp7C->normal.y > 0) && (sqrtf(SQXYZ(actor->colChkInfo.displacement)) < 10.0f)) { actor->bgCheckFlags &= ~BGCHECKFLAG_WALL; } else if (actor->bgCheckFlags & BGCHECKFLAG_WALL) { Math_Vec3f_Copy(&actor->world.pos, &pos); @@ -1606,7 +1606,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, pos.x = actor->world.pos.x; pos.z = actor->world.pos.z; - if (flags & 2) { + if (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_2) { f32 y; pos.y = actor->prevPos.y + 4.0f; @@ -1618,12 +1618,12 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, actor->bgCheckFlags &= ~BGCHECKFLAG_CEILING; } } - if (flags & 4) { + if (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_4) { WaterBox* waterbox; f32 y; pos.y = actor->prevPos.y; - func_800B7678(play, actor, &pos, flags); + func_800B7678(play, actor, &pos, updBgCheckInfoFlags); y = actor->world.pos.y; if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &y, &waterbox)) { @@ -1632,7 +1632,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); } else if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) { actor->bgCheckFlags |= (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); - if (!(flags & 0x40)) { + if (!(updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_40)) { Vec3f sp64; sp64.x = actor->world.pos.x; @@ -1652,7 +1652,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, } } - if (flags & 0x400) { + if (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_400) { WaterBox* waterbox; f32 y = actor->world.pos.y; @@ -1663,7 +1663,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); } else if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) { actor->bgCheckFlags |= (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); - if (!(flags & 0x40)) { + if (!(updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_40)) { Vec3f sp50; sp50.x = actor->world.pos.x; @@ -3726,7 +3726,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 actor->world.pos.x += dx; actor->world.pos.z += dz; - Actor_UpdateBgCheckInfo(play, actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Math_Vec3f_Copy(&actor->world.pos, &actorPos); ret = actor->bgCheckFlags & BGCHECKFLAG_GROUND; diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 3d78f00df..0c19236dc 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -507,7 +507,9 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { if (this->actor.gravity != 0.0f) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 15.0f, 15.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 15.0f, 15.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->actor.floorHeight <= BGCHECK_Y_MIN) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index 5a16e6845..eabd3f3fe 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -183,7 +183,7 @@ void BgIcicle_Fall(BgIcicle* this, PlayState* play) { } else { Actor_MoveWithGravity(&this->dyna.actor); this->dyna.actor.world.pos.y += 40.0f; - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->dyna.actor.world.pos.y -= 40.0f; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index 9fa7077f8..aead34d28 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -226,7 +226,7 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) { actorBelow = DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId); if (actorBelow == NULL) { Actor_MoveWithGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); @@ -250,7 +250,8 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) { wallCheckRadius = CLAMP_MIN(wallCheckRadius, 2.0f); Actor_MoveWithGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, wallCheckRadius, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, wallCheckRadius, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } Actor_SetFocus(&this->dyna.actor, 40.0f); diff --git a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c index 7bc3e8544..c55cd4e01 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c @@ -281,7 +281,7 @@ void BgKin2Picture_Fall(BgKin2Picture* this, PlayState* play) { } Actor_MoveWithGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_StepToS(&this->step, 0x7D0, 0x78); diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 003ba32e9..1454fefa3 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -993,7 +993,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { this->unk_0B1C[i].y += this->unk_0164; Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.1f, 0.07f); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, UPDBGCHECKINFO_FLAG_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_0144 = 23; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 4dd27f211..4e15e8f7a 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -1993,7 +1993,8 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { Math_ApproachS(&this->actor.shape.rot.z, 0, 0xA, 0x800); this->actor.world.pos.y -= 100.0f; this->actor.prevPos.y -= 100.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actor.world.pos.y += 100.0f; this->actor.prevPos.y += 100.0f; } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 709ef43f8..6a6bc0c1d 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -197,7 +197,7 @@ void Boss04_Init(Actor* thisx, PlayState* play2) { this->unk_6F0 = this->unk_6E0 + ((this->unk_6E4 - this->unk_6E0) * 0.5f); this->actor.world.pos.x = this->unk_6E8; this->actor.world.pos.z = this->unk_6F0; - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, UPDBGCHECKINFO_FLAG_4); if ((KREG(64) != 0) || CHECK_EVENTINF(EVENTINF_60)) { func_809ECD00(this, play); @@ -709,7 +709,8 @@ void Boss04_Update(Actor* thisx, PlayState* play2) { Actor_MoveWithGravity(&this->actor); this->actor.world.pos.y -= 100.0f; this->actor.prevPos.y -= 100.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 100.0f, 120.0f, 200.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 100.0f, 120.0f, 200.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actor.world.pos.y += 100.0f; this->actor.prevPos.y += 100.0f; } diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index 1a1f4ae22..ccf41077d 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -181,7 +181,7 @@ void DmAh_Update(Actor* thisx, PlayState* play) { func_80C1D6E0(this, play); SkelAnime_Update(&this->skelAnime); func_80C1D458(this); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } static Vec3f D_80C1DE14 = { 1000.0f, 0.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c index f81713731..2d1e58678 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c @@ -93,7 +93,7 @@ void DmAl_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } s32 DmAl_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* rot, Vec3s* pos, Actor* thisx) { diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index d536425b0..555a04cc5 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -264,7 +264,7 @@ void DmAn_Update(Actor* thisx, PlayState* play) { func_80C1C410(this, play); func_80C1C5B4(this); } - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } Vec3f D_80C1D2C8 = { 450.0f, 700.0f, -760.0f }; diff --git a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c index b9c4cb33c..cfd804410 100644 --- a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c +++ b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c @@ -56,7 +56,7 @@ void DmBal_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_bal_Skel_00A6D0, &object_bal_Anim_0005FC, this->jointTable, this->morphTable, OBJECT_BAL_LIMB_MAX); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->timer = 60; this->eyeIndex = 0; this->keepEyesShut = false; diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index 5321abc92..177a21394 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -264,7 +264,7 @@ void DmGm_Update(Actor* thisx, PlayState* play) { func_80C24360(this, play); func_80C24504(this); } - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } Vec3f D_80C25218 = { 450.0f, 700.0f, -760.0f }; diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index 98f7bac48..e9fa1cddd 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -87,7 +87,7 @@ void DmNb_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } void DmNb_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index 5ea851023..d9fbeb6f0 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -557,7 +557,7 @@ void EnAh_Update(Actor* thisx, PlayState* play) { func_8013C964(&this->actor, play, radius, height, PLAYER_IA_NONE, this->unk_2D8 & 7); if (!(this->unk_2D8 & 0x10)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } func_80BD2BA4(this, play); } diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index d22c2d258..442ed1831 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -150,7 +150,7 @@ void func_80BECC7C(EnAkindonuts* this, PlayState* play) { } if (this->unk_32C & 2) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 73d9ffc57..31d137299 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -509,7 +509,9 @@ void EnAm_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Actor_SetFocus(&this->actor, 64.0f); Collider_UpdateCylinder(&this->actor, &this->enemyCollider); Collider_UpdateCylinder(&this->actor, &this->interactCollider); diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index b2a6456bc..6d6488383 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -291,7 +291,7 @@ void EnAni_Update(Actor* thisx, PlayState* play) { } Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); if (this->actor.xzDistToPlayer < 100.0f && !(this->stateFlags & ANI_STATE_CLIMBING)) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->chestRot, this->actor.focus.pos); diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index 630d0e599..bb3e2f23a 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -366,7 +366,9 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->actionFunc == EnAttackNiw_EnterViewFromOffscreen) { Actor_MoveWithoutGravity(&this->actor); diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index ff865d99f..3b2895983 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -273,7 +273,7 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { this->collider.dim.height *= 1.2f; this->collider.dim.yShift *= 1.2f; } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 22.0f)) { this->unk_374 |= 0x100; this->unk_376 |= 0x100; @@ -1660,9 +1660,9 @@ void EnAz_Update(Actor* thisx, PlayState* play2) { this->unk_39C = 0; } if (!(this->unk_374 & 0x1000)) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 0x400); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_400); this->unk_374 &= ~0x1000; } Collider_UpdateCylinder(&this->actor, &this->collider); diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 3aad703de..5296260f9 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -748,7 +748,7 @@ void EnBaba_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); EnBaba_UpdateModel(this, play); } diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c index 9a71c1864..14f4112eb 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c @@ -392,7 +392,9 @@ void EnBaguo_Update(Actor* thisx, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->action != NEJIRON_ACTION_INACTIVE) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c index 3021ffbd2..5479d6c1e 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -252,7 +252,9 @@ void EnBaisen_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Actor_SetScale(&this->actor, 0.01f); if (this->unk290) { func_80BE871C(this); diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index 61b060110..9e2d8abe2 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -480,13 +480,15 @@ void EnBat_Update(Actor* thisx, PlayState* play) { } if (this->actionFunc == EnBat_DiveAttack) { - Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else if ((this->actionFunc != EnBat_FlyIdle) || ((this->actor.xzDistToPlayer < 400.0f) && (this->actor.projectedPos.z > 0.0f))) { if (this->paramFlags & BAD_BAT_PARAMFLAG_0) { - Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else { - Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 15.0f, 50.0f, UPDBGCHECKINFO_FLAG_4); } } else { Math_Vec3f_Copy(&this->actor.prevPos, &prevPos); diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index c58344400..071515919 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -585,7 +585,8 @@ void EnBb_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((this->actionFunc != EnBb_Dead) && (this->actionFunc != EnBb_WaitForRevive)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 40.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); this->collider.dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.dim.worldSphere.center.y = this->actor.world.pos.y + 15.0f; diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 1b9538146..b751a50d5 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -244,7 +244,7 @@ void EnBba01_Update(Actor* thisx, PlayState* play) { EnBba01_TestIsTalking(this, play); this->enHy.actionFunc(&this->enHy, play); - Actor_UpdateBgCheckInfo(play, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->enHy.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); EnBba01_UpdateModel(this, play); func_809CC270(this, play); } diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index 9b04d1e80..9e99d4fba 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -600,7 +600,8 @@ void EnBbfall_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != EnBbfall_Dead) { Actor_MoveWithGravity(&this->actor); if (this->isBgCheckCollisionEnabled) { - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 20.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); } for (i = ARRAY_COUNT(this->flamePos) - 1; i >= 2; i--) { diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.c b/src/overlays/actors/ovl_En_Bee/z_en_bee.c index ad45c3a66..80ad3e7a2 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.c +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.c @@ -271,7 +271,9 @@ void EnBee_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index 74fbbfc51..a78731e29 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -759,7 +759,9 @@ void EnBigpamet_Update(Actor* thisx, PlayState* play) { if ((this->actionFunc != func_80A281DC) && (this->actionFunc != func_80A282C8)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 50.0f, 60.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 50.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); func_80A276F4(this); Actor_SetFocus(&this->actor, 25.0f); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index db124dc97..30f857a89 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -1174,7 +1174,7 @@ void EnBigpo_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); } if (this->actionFunc == EnBigpo_LanternFalling) { - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 27.0f, 60.0f, UPDBGCHECKINFO_FLAG_4); } if (this->actor.draw == EnBigpo_DrawScoopSoul) { diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 803aafc3b..5eed1b1d5 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -2838,7 +2838,9 @@ void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play) { Actor_MoveWithoutGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 40.0f, 80.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 40.0f, 80.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); this->gekkoCollider.dim.pos.x = (s16)this->actor.world.pos.x; this->gekkoCollider.dim.pos.z = (s16)this->actor.world.pos.z; if (this->gekkoCollider.base.acFlags & AC_ON) { diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index b0c4102c2..6cdca73a7 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -373,7 +373,7 @@ void EnBji01_Update(Actor* thisx, PlayState* play) { s32 pad; this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); SkelAnime_Update(&this->skelAnime); if (this->blinkTimer-- <= 0) { diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index bdc59540b..a99e9063c 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -450,7 +450,7 @@ void EnBom_Update(Actor* thisx, PlayState* play) { this->unk_1FC--; Math_ApproachZeroF(&thisx->speed, 1.0f, 1.0f); Actor_MoveWithGravity(thisx); - Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, 4); + Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, UPDBGCHECKINFO_FLAG_4); if (this->unk_1FC == 0) { if (this->isPowderKeg) { gSaveContext.powderKegTimer = 0; @@ -476,7 +476,9 @@ void EnBom_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, thisx, 35.0f, 10.0f, 36.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (thisx->params == BOMB_TYPE_BODY) { static Vec3us D_80872ED4[] = { { 40, 20, 100 }, diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 8481b88a9..7217dbc65 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -630,7 +630,9 @@ void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { this->unk_2F2 = (s32)Rand_ZeroFloat(60.0f) + 20; } } - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 40e93b861..a652e574f 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -177,7 +177,7 @@ void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) { } else if (Actor_HasNoParent(&this->actor, play)) { player = GET_PLAYER(play); Math_Vec3f_Copy(&this->actor.world.pos, &player->actor.world.pos); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actor.shape.rot.y = player->actor.shape.rot.y; this->actor.flags |= ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index f96809878..5086513db 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -487,7 +487,9 @@ void EnBombers_Update(Actor* thisx, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); this->actor.uncullZoneForward = 500.0f; Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index d479e0745..0c3bdf745 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -400,7 +400,9 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->unk_2AC == 0) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } Math_Vec3f_Copy(&this->actor.world.pos, &sp34); } diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index ea9ab2e22..2493d819b 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -336,7 +336,9 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { if (this->actor.gravity != 0.0f) { DREG(6) = 1; - Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 10.0f, 0.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 10.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); DREG(6) = 0; } @@ -355,7 +357,9 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_BOUND); Actor_MoveWithGravity(&this->actor); DREG(6) = 1; - Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 10.0f, 0.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 10.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); DREG(6) = 0; this->actor.speed *= 0.7f; this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 8f3b4d3f3..611c6144b 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -1044,7 +1044,9 @@ void EnBomjima_Update(Actor* thisx, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); this->actor.uncullZoneForward = 500.0f; Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index c8de769c7..fc11e86c1 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -858,7 +858,9 @@ void EnBomjimb_Update(Actor* thisx, PlayState* play2) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 4e6d3ae3a..6beedbdf8 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -612,7 +612,8 @@ void EnBox_Update(Actor* thisx, PlayState* play) { } if (!(this->movementFlags & ENBOX_MOVE_IMMOBILE)) { Actor_MoveWithGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } Actor_SetFocus(&this->dyna.actor, 40.0f); if ((this->getItemId == GI_ICE_TRAP) && (this->actionFunc == EnBox_Open) && (this->skelAnime.curFrame > 45.0f) && diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index db6019b99..f08c3d413 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -392,7 +392,8 @@ void EnBubble_Update(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 16.0f, 16.0f, 0.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 16.0f, 16.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->actor.shape.yOffset); } diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index e75d11bc6..15d087ea7 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -463,7 +463,7 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { } // Initialize flash effect - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 30.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 30.0f, 100.0f, UPDBGCHECKINFO_FLAG_4); pos = this->actor.world.pos; EnClearTag_CreateFlashEffect(this, &pos, sFlashMaxScale[thisx->params], this->actor.floorHeight); diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 876914a2a..7fc741ebe 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -234,7 +234,7 @@ void EnCne01_Update(Actor* thisx, PlayState* play) { EnCne01_TestIsTalking(this, play); this->enHy.actionFunc(&this->enHy, play); - Actor_UpdateBgCheckInfo(play, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->enHy.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); EnCne01_UpdateModel(this, play); func_809CB4A0(this, play); } diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c index 13ff0ce10..6f7d32de1 100644 --- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c +++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c @@ -222,7 +222,9 @@ void EnColMan_Update(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, this->scale); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 30.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 1de5d137e..beed3fb26 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -340,7 +340,7 @@ void EnCow_Update(Actor* thisx, PlayState* play2) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (SkelAnime_Update(&this->skelAnime)) { if (this->skelAnime.animation == &gCowChewAnim) { diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 2bbee66d5..623d12f0e 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -507,7 +507,8 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { height = 0.0f; Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f * scale, 25.0f * scale, 50.0f * scale, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); } else { height = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index b68634f81..b988155c7 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -278,7 +278,9 @@ void EnDaiku_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->unk_260, this->unk_266, 1, 0xBB8, 0); Math_SmoothStepToS(&this->unk_25E, this->unk_264, 1, 0xBB8, 0); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); this->actor.uncullZoneForward = 650.0f; Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index e93cf4493..d8a8a78e8 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -453,7 +453,9 @@ void EnDaiku2_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, 65.0f); Actor_MoveWithGravity(&this->actor); Math_ApproachF(&this->unk_260, this->unk_264, 0.3f, 2.0f); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); func_80BE7600(this, play); diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index d38f23224..e969abffa 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1186,9 +1186,10 @@ void EnDekubaba_Update(Actor* thisx, PlayState* play) { if (this->actionFunc == EnDekubaba_PrunedSomersaultDie) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->size * 15.0f, 10.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->size * 15.0f, 10.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else if (this->actionFunc != EnDekubaba_DeadStickDrop) { - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->boundFloor == NULL) { this->boundFloor = this->actor.floorPoly; } diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index b9e48e6db..2496a4cc2 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -643,7 +643,9 @@ void EnDekunuts_Update(Actor* thisx, PlayState* play) { func_808BE73C(this, play); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->collider.dim.radius, this->collider.dim.height, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->collider.base.acFlags & AC_ON) { diff --git a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c index 0d7de9cf1..986953d0f 100644 --- a/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c +++ b/src/overlays/actors/ovl_En_Demo_heishi/z_en_demo_heishi.c @@ -160,7 +160,9 @@ void EnDemoheishi_Update(Actor* thisx, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Actor_SetScale(&this->actor, 0.01f); EnDemoheishi_SetHeadRotation(this); diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index 9b513ef67..3545ec951 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -237,7 +237,7 @@ void EnDg_UpdateCollision(EnDg* this, PlayState* play) { Collider_ResetCylinderOC(play, &this->collider.base); } - Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } void EnDg_GetFloorRot(EnDg* this, Vec3f* floorRot) { diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 9c9c46e07..3ccf3fb6d 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -1356,7 +1356,9 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, 0x5D); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_40); if (this->actionFunc != func_8089C7B8) { if ((this->actor.depthInWater > 0.0f) && (this->actor.depthInWater < 10.0f)) { if (!((play->gameplayFrames % 4) & 1)) { diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index aad29992a..d42e2e233 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -235,7 +235,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) { this->morphTable, DEKU_BUTLER_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); - Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Animation_Change(&this->skelAnime, sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation), sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].mode, @@ -762,7 +762,7 @@ void func_80A72C04(EnDno* this, PlayState* play) { } void func_80A72CF8(EnDno* this, PlayState* play) { - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, this->actor.world.pos.x + 80.0f, this->actor.floorHeight, this->actor.world.pos.z, 0, 0, 0, 0x201); } @@ -960,7 +960,7 @@ void EnDno_Update(Actor* thisx, PlayState* play) { func_80A73408(this, play); this->actionFunc(this, play); if (this->unk_3B0 & 4) { - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 11240f27b..745987344 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -457,7 +457,7 @@ void EnDnp_Update(Actor* thisx, PlayState* play) { func_80B3CD1C(this); func_80B3CEC0(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); sp2C = this->collider.dim.radius + 50; sp28 = this->collider.dim.height + 30; if ((this->unk_322 & 0x400) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 131a27d74..0c5227bd4 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -455,7 +455,7 @@ void EnDnq_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); func_80A52B68(this, play); SkelAnime_Update(&this->skelAnime); - Actor_UpdateBgCheckInfo(play, &this->picto.actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->unk_394 = this->picto.actor.xzDistToPlayer; func_80A52C6C(this, play); func_8013C964(&this->picto.actor, play, this->unk_390, fabsf(this->picto.actor.playerHeightRel) + 1.0f, diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index d21448217..7a540ad49 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -550,7 +550,7 @@ void EnDns_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); func_8092C934(this); func_8092C86C(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_8013C964(&this->actor, play, 80.0f, 40.0f, PLAYER_IA_NONE, this->unk_2C6 & 7); Actor_SetFocus(&this->actor, 34.0f); func_8092C6FC(this, play); diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 52870a787..bc7841ddc 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -1024,7 +1024,9 @@ void EnDodongo_Update(Actor* thisx, PlayState* play2) { EnDodongo_UpdateDamage(this, play); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 60.0f, 70.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index 21ce6d52e..e3f5eaea8 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -1294,7 +1294,9 @@ void EnEgol_Update(Actor* thisx, PlayState* play) { Math_SmoothStepToS(&this->eyelidRot, this->eyelidRotTarget, 1, 0x7D0, 0); EnEgol_CollisionCheck(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 50.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 50.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->action != EYEGORE_ACTION_DEAD) { //! @bug This should be ||, not &&. As is, the check always succeeds. if (!((this->action == EYEGORE_ACTION_DAMAGED) && (this->action == EYEGORE_ACTION_DYING))) { diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 65cc04d84..28b086fbb 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -499,7 +499,8 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); func_80ACCBB8(this, play); if (Player_GetMask(play) == PLAYER_MASK_GREAT_FAIRY) { if (!(this->strayFairyFlags & STRAY_FAIRY_FLAG_GREAT_FAIRYS_MASK_EQUIPPED)) { diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c index 1786380ac..2996ccc23 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c @@ -68,7 +68,9 @@ void EnEndingHero_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } static TexturePtr sEyeTextures[] = { diff --git a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c index 2650ad156..0cc20358a 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c +++ b/src/overlays/actors/ovl_En_Ending_Hero2/z_en_ending_hero2.c @@ -61,7 +61,9 @@ void EnEndingHero2_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } void EnEndingHero2_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c index 8dcc12199..aba7c4488 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c +++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c @@ -61,7 +61,9 @@ void EnEndingHero3_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } void EnEndingHero3_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c index 333bbc918..39e920b9e 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c +++ b/src/overlays/actors/ovl_En_Ending_Hero4/z_en_ending_hero4.c @@ -61,7 +61,9 @@ void EnEndingHero4_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } void EnEndingHero4_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c index ee62798f1..ddf866f94 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c +++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c @@ -62,7 +62,9 @@ void EnEndingHero5_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } Gfx* D_80C23BF0[] = { object_daiku_DL_0070C0, object_daiku_DL_006FB0, object_daiku_DL_006E80, object_daiku_DL_006D70, diff --git a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c index 06f973265..5324518de 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c +++ b/src/overlays/actors/ovl_En_Ending_Hero6/z_en_ending_hero6.c @@ -101,7 +101,9 @@ void EnEndingHero6_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } void EnEndingHero6_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.c b/src/overlays/actors/ovl_En_Estone/z_en_estone.c index 72ac311a7..8eff94e4b 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.c +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.c @@ -174,7 +174,8 @@ void EnEstone_Update(Actor* thisx, PlayState* play2) { Actor_MoveWithGravity(&this->actor); if ((this->timer == 0) && !this->inactive) { - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 50.0f, 100.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } if (!this->inactive) { Collider_UpdateCylinder(&this->actor, &this->collider); diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 932d937ee..1fc83d8a1 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -766,7 +766,9 @@ void EnFamos_Update(Actor* thisx, PlayState* play) { } if (this->flippedTimer >= 0) { - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 80.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 80.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if ((this->actionFunc == EnFamos_Attack) && (this->animatedMaterialIndex != FAMOS_ANIMATED_MAT_NORMAL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.pos.y -= 60.0f; diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 90f90cf74..868c43533 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -338,14 +338,15 @@ void EnFg_Update(Actor* thisx, PlayState* play) { s32 flagSet; flag = this->actor.flags; - flagSet = ((flag & 0x2000) == 0x2000); + flagSet = CHECK_FLAG_ALL(flag, ACTOR_FLAG_2000); if (1) {} if (!flagSet) { - flagSet = ((flag & 0x8000) == 0x8000); + flagSet = CHECK_FLAG_ALL(flag, ACTOR_FLAG_8000); if (1) {} if (!flagSet) { this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, BASE_REG(16, 0), BASE_REG(16, 1), 0.0f, 0x5); + Actor_UpdateBgCheckInfo(play, &this->actor, sREG(0), sREG(1), 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 357887c97..bc4e3d743 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -703,7 +703,8 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 15.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 15.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); this->collider.dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.dim.worldSphere.center.y = (s32)this->actor.world.pos.y + 10; this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 2f54e4dcb..b70ce1ae7 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -264,7 +264,7 @@ void func_8091DEE4(EnFish* this) { this->actor.gravity = 0.0f; this->actor.terminalVelocity = 0.0f; this->unk_240 = Rand_S16Offset(5, D_8091FACC[this->unk_278]); - this->unk_248 = 0; + this->updBgCheckInfoFlags = 0; this->unk_26E = 400; this->unk_272 = 400; this->unk_268 = 0; @@ -314,7 +314,7 @@ void func_8091E070(EnFish* this) { phi_a1 = D_8091FAD4[this->unk_278]; } this->unk_240 = Rand_S16Offset(15, phi_a1); - this->unk_248 = 0; + this->updBgCheckInfoFlags = 0; this->unk_26E = 400; this->unk_272 = 400; this->unk_26C = 0; @@ -361,7 +361,7 @@ void func_8091E2E0(EnFish* this) { this->actor.gravity = 0.0f; this->actor.terminalVelocity = 0.0f; this->unk_240 = Rand_S16Offset(10, 40); - this->unk_248 = 0; + this->updBgCheckInfoFlags = 0; this->unk_26E = 400; this->unk_272 = 400; this->unk_268 = 0; @@ -440,7 +440,7 @@ void func_8091E5EC(EnFish* this) { this->unk_26C = 0; func_8091D660(this); this->unk_240 = Rand_S16Offset(10, 30); - this->unk_248 = 0; + this->updBgCheckInfoFlags = 0; this->unkFunc = func_8091E658; } @@ -493,7 +493,7 @@ void func_8091E810(EnFish* this) { this->actor.terminalVelocity = -10.0f; this->actor.shape.yOffset = 0.0f; func_8091D6C4(this); - this->unk_248 = 5; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4; this->unkFunc = func_8091E880; this->unk_24C = 0.0f; this->unk_240 = 300; @@ -551,7 +551,7 @@ void func_8091E9A4(EnFish* this) { this->actor.shape.yOffset = 300.0f; func_8091D6C4(this); this->unkFunc = func_8091EAF0; - this->unk_248 = 5; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4; this->unk_24C = 0.0f; if (sp24 && (this->actor.draw != NULL)) { Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); @@ -612,7 +612,7 @@ void func_8091ECF4(EnFish* this) { this->unk_240 = 200; func_8091D660(this); this->unkFunc = func_8091ED70; - this->unk_248 = 5; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4; this->unk_24C = 0.0f; } @@ -677,7 +677,7 @@ void func_8091EF30(EnFish* this) { this->unk_240 = 15; this->unk_279 = 10; this->unkFunc = func_8091EFE8; - this->unk_248 = 5; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4; this->unk_24C = 0.0f; } @@ -772,7 +772,7 @@ void func_8091F344(EnFish* this) { this->actor.gravity = 0.0f; this->actor.terminalVelocity = 0.0f; this->unk_240 = Rand_S16Offset(5, 35); - this->unk_248 = 1; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1; this->unk_268 = 0; this->unk_26C = 0; this->unk_26E = 1500; @@ -856,7 +856,7 @@ void func_8091F5A4(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); func_8091D7C4(this); Actor_MoveWithGravity(&this->actor); - if (this->unk_248 != 0) { + if (this->updBgCheckInfoFlags != 0) { u32 temp = (play->sceneId != SCENE_LABO); phi_f0 = BREG(1) + 10.0f; @@ -864,7 +864,7 @@ void func_8091F5A4(Actor* thisx, PlayState* play) { if (temp) { phi_f0 = 6.0f; } - Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, phi_f0, 0.0f, this->unk_248); + Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, phi_f0, 0.0f, this->updBgCheckInfoFlags); } if ((this->actor.xzDistToPlayer < 70.0f) && (this->unkFunc != func_8091EFE8)) { diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.h b/src/overlays/actors/ovl_En_Fish/z_en_fish.h index 528eeb40c..d3941906c 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -26,7 +26,7 @@ typedef struct EnFish { /* 0x242 */ s16 unk_242; /* 0x244 */ s16 unk_244; /* 0x246 */ s16 unk_246; - /* 0x248 */ s32 unk_248; + /* 0x248 */ s32 updBgCheckInfoFlags; /* 0x24C */ f32 unk_24C; /* 0x250 */ f32 unk_250; /* 0x254 */ f32 unk_254; diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index a53393284..47244f9d3 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -987,7 +987,8 @@ void EnFish2_Update(Actor* thisx, PlayState* play2) { this->unk_33C = 25.0f - ((this->unk_330 - 0.01f) * 1000.0f); Actor_SetScale(&this->actor, this->unk_330); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0, 15.0f, 10.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 0, 15.0f, 10.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); if (this->actor.params != 2) { this->unk_2D4 = this->actor.floorHeight + (this->unk_330 * 1000.0f); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 31d884c4d..36ac5c2f8 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -2230,7 +2230,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { Vec3f sp80 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, 0x43); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_40); this->actor.world.pos = sp80; if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { @@ -2494,7 +2495,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { sp58 = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos = sLurePos; - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, 0x44); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); this->actor.world.pos = sp58; D_80917278.y += -0.5f; @@ -4096,7 +4098,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->actor.prevPos.y -= spD8; this->actor.velocity.y = -1.0f; if (KREG(90) == 0) { // Check added in MM - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 100.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); } this->actor.world.pos.y += spD8; this->actor.prevPos.y += spD8; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index c99a1680c..680f4f830 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -1104,7 +1104,9 @@ void EnFloormas_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->actor.scale.x * 3000.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, this->actor.scale.x * 3000.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); if (this->actionFunc == func_808D1650) { this->actor.flags |= ACTOR_FLAG_1000000; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index df3beb13b..1f122ae92 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -1337,7 +1337,7 @@ void EnFu_Update(Actor* thisx, PlayState* play) { func_809642E0(this, play); Actor_MoveWithGravity(&this->actor); func_8096209C(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); SkelAnime_Update(&this->skelAnime); func_80961D7C(play); func_809640D8(this, play); diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c index 88a2c63b2..9e3c19473 100644 --- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c +++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c @@ -185,7 +185,8 @@ void func_80ACE718(EnFuMato* this, PlayState* play) { this->dyna.actor.velocity.y += this->dyna.actor.gravity; Actor_UpdatePos(&this->dyna.actor); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if ((this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->dyna.actor.world.pos.y < -500.0f)) { Vec3f sp3C = { 0.0f, 0.0f, 0.0f }; @@ -329,7 +330,8 @@ void func_80ACECFC(EnFuMato* this, PlayState* play) { } if (this->unk_302 == 1) { - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80ACEB2C(this); } diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index f9ee51391..fe4e6636b 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -824,7 +824,7 @@ void EnFz_Update(Actor* thisx, PlayState* play) { Math_StepToF(&this->actor.speed, this->unk_BBC, 0.2f); Actor_MoveWithGravity(&this->actor); if (this->unk_BCC != 0) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } D_809347AC[this->unk_BD6](this); diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c index 8882ab94e..9f45748df 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c @@ -171,7 +171,7 @@ void EnGamelupy_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 0xC); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8); func_80AF6B40(this, play); } diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index d94267b38..dd53d9ea8 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -375,7 +375,8 @@ void EnGe1_Update(Actor* thisx, PlayState* play) { if (!(this->stateFlags & GERUDO_WHITE_STATE_DISABLE_MOVEMENT)) { Actor_MoveWithGravity(&this->picto.actor); } - Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); this->torsoRot.x = this->torsoRot.y = this->torsoRot.z = 0; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 54836f071..3753ccf5c 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -699,7 +699,8 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { if (!(this->stateFlags & GERUDO_PURPLE_STATE_DISABLE_MOVEMENT)) { Actor_MoveWithGravity(&this->picto.actor); } - Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 40.0f, 25.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index 04353d954..44cf5215e 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -217,7 +217,7 @@ void func_80BB178C(EnGeg* this, PlayState* play) { if (collider != NULL) { CollisionCheck_SetOC(play, &play->colChkCtx, collider); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index a2ece1010..b27d60302 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -144,7 +144,8 @@ void func_80B35108(EnGg* this, PlayState* play) { this->collider.dim.pos.z = this->actor.world.pos.z; CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 30.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); } void func_80B351A4(EnGg* this) { diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index 078c136b9..d62f9e6df 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -449,7 +449,7 @@ void EnGiant_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->blinkTimer == 0) { blinkTimerTemp = 0; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 3c4ea82f0..c1375d650 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -240,7 +240,8 @@ void func_80B507A0(EnGk* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 30.0f, 30.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); } s32 func_80B50854(EnGk* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 4c0dd92d9..86dcead70 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -1714,7 +1714,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) { func_8013C964(&this->actor, play, this->unk_3B4, 30.0f, PLAYER_IA_NONE, this->unk_3A4 & 7); if ((this->unk_258 != 3) && (this->unk_258 != 5) && (this->unk_258 != 8)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } func_8094E1DC(this, play); } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 3f6fee765..02ee6d342 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1937,7 +1937,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) { if ((ENGO_GET_F(&this->actor) != ENGO_F_8) && (ENGO_GET_F(&this->actor) != ENGO_F_2) && (ENGO_GET_F(&this->actor) != ENGO_F_1)) { - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } func_80A122EC(this); diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 312e1a9d9..b429c7e4b 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -1485,7 +1485,8 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { switch (ENGOROIWA_GET_400(&this->actor)) { case ENGOROIWA_400_1: - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); break; case ENGOROIWA_400_0: diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index a67c6475d..2bd6fec69 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -920,7 +920,9 @@ void EnGrasshopper_Update(Actor* thisx, PlayState* play) { Math_ApproachZeroF(&this->damagedVelocity.y, 1.0f, 2.0f); Math_ApproachZeroF(&this->damagedVelocity.z, 1.0f, 2.0f); if ((this->action != EN_GRASSHOPPER_ACTION_FALL) && (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } this->actor.shape.rot.z = this->actor.world.rot.z; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index aea9d4ac3..e427dedc3 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -842,7 +842,7 @@ s32 func_809995A4(EnGs* this, PlayState* play) { } if (this->unk_19D == 4) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 3); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); if (this->actor.bgCheckFlags & (BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) { Vec3f sp54; diff --git a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c index 56ad07592..f5925f524 100644 --- a/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c +++ b/src/overlays/actors/ovl_En_Guard_Nuts/z_en_guard_nuts.c @@ -345,7 +345,9 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if ((this->state != GUARD_NUTS_BURROWED_STATE) && (this->state != GUARD_NUTS_UNK_STATE)) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index d2aacf748..a6f5f98b3 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -363,7 +363,9 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Math_SmoothStepToS(&this->headXRot, this->headXRotTarget, 1, 3000, 0); Math_SmoothStepToS(&this->headZRot, this->headZRotTarget, 1, 1000, 0); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c index dc5610896..44e42d01a 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c @@ -323,7 +323,8 @@ void EnHakurock_Update(Actor* thisx, PlayState* play) { rockParams = this->actor.params; if ((rockParams == EN_HAKUROCK_TYPE_BOULDER) || (rockParams == EN_HAKUROCK_TYPE_UNK_2)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider.dim.radius, 0.0f, 0x85); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider.dim.radius, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_80); if (this->actor.floorHeight == BGCHECK_Y_MIN) { func_80B21FFC(this); } else { diff --git a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c index f4e40b6c8..5fa9f5ea2 100644 --- a/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c +++ b/src/overlays/actors/ovl_En_Heishi/z_en_heishi.c @@ -156,7 +156,9 @@ void EnHeishi_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 29); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Actor_SetScale(&this->actor, 0.01f); if (this->shouldSetHeadRotation) { EnHeishi_SetHeadRotation(this); diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index eb41fc045..4b610de8f 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -428,7 +428,7 @@ void EnHg_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnHg_UpdateCollision(this, play); EnHg_WaitForPlayerAction(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 25.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); EnHg_PlayRedeadSfx(this, play); } diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index fa14a3cdb..c3052e80f 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -423,7 +423,9 @@ void EnHiddenNuts_Update(Actor* thisx, PlayState* play) { if (this->unk_21A >= 4) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 40.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } Collider_UpdateCylinder(&this->actor, &this->collider); diff --git a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c index 6e1f3b90c..09a110dbf 100644 --- a/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c +++ b/src/overlays/actors/ovl_En_Hint_Skb/z_en_hint_skb.c @@ -838,7 +838,9 @@ void EnHintSkb_Update(Actor* thisx, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); func_80C21250(this, play); func_80C20D64(this, play); func_80C21320(this, play); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 6d3e01952..59fea362a 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3739,9 +3739,12 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if ((this->actor.params != ENHORSE_4) && (this->actor.params != ENHORSE_5) && (this->actor.params != ENHORSE_19) && (this->actor.params != ENHORSE_20) && (this->actor.params != ENHORSE_18)) { - Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 35.0f, 100.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 35.0f, 100.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } else { - Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 35.0f, 100.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 35.0f, 100.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 0335085bd..8c77bb2a0 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -529,7 +529,9 @@ void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) { D_808DFF30[this->unk_144](this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 6f3a192c2..8ecc26857 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -282,7 +282,7 @@ void EnHs_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (SkelAnime_Update(&this->skelAnime)) { this->skelAnime.curFrame = 0.0f; diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index 43f39a4b9..fde467ddc 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -952,7 +952,7 @@ void EnIg_Update(Actor* thisx, PlayState* play) { func_80BF15EC(this); func_8013C964(&this->actor, play, 60.0f, 30.0f, PLAYER_IA_NONE, this->unk_3D0 & 7); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80BF1354(this, play); } } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index fb9267e8e..5c1244faa 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -870,7 +870,9 @@ void EnIk_Update(Actor* thisx, PlayState* play2) { } this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); this->actor.focus.rot.y = this->actor.shape.rot.y; CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); if (this->invincibilityFrames == 0) { diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index bf7552947..e3d183fe4 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -1468,7 +1468,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) { this->unk4AC &= ~0x40; } this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_808F3414(this, play); func_808F32A0(this, play); } diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 65696795b..866f1d1b8 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -442,7 +442,7 @@ void func_8091B984(EnInsect* this, PlayState* play) { void EnInsect_Update(Actor* thisx, PlayState* play) { EnInsect* this = THIS; - s32 phi_v0; + s32 updBgCheckInfoFlags; if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (&this->actor != this->actor.child)) { this->actor.child = NULL; @@ -470,14 +470,14 @@ void EnInsect_Update(Actor* thisx, PlayState* play) { } } - phi_v0 = 0; + updBgCheckInfoFlags = 0; if (this->unk_30C & 1) { - phi_v0 = 4; + updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_4; } - if (phi_v0 != 0) { - phi_v0 |= 0x40; - Actor_UpdateBgCheckInfo(play, &this->actor, 8.0f, 5.0f, 0.0f, phi_v0); + if (updBgCheckInfoFlags != 0) { + updBgCheckInfoFlags |= UPDBGCHECKINFO_FLAG_40; + Actor_UpdateBgCheckInfo(play, &this->actor, 8.0f, 5.0f, 0.0f, updBgCheckInfoFlags); } if (Actor_HasParent(&this->actor, play)) { diff --git a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c index 489431bdf..d2aceba29 100644 --- a/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c +++ b/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.c @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { void func_80C258A0(EnInvisibleRuppe* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } void func_80C2590C(EnInvisibleRuppe* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 040081b5c..e90ddcafd 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -541,7 +541,9 @@ void func_8095E95C(EnIshi* this, PlayState* play) { func_8095E14C(this); func_8095E180(&this->actor.velocity, D_8095F6C8[ENISHI_GET_1(&this->actor)]); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | + UPDBGCHECKINFO_FLAG_80); } else { sp30.x = this->actor.world.pos.x; sp30.y = this->actor.world.pos.y + 20.0f; @@ -648,7 +650,9 @@ void func_8095EBDC(EnIshi* this, PlayState* play) { Actor_UpdatePos(&this->actor); this->actor.shape.rot.x += D_8095F690; this->actor.shape.rot.y += D_8095F694; - Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | + UPDBGCHECKINFO_FLAG_80); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c index 39a28c4bd..1c65efed8 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -389,7 +389,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) { if (this->unk_1D8.unk_00 != 2) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } func_80BC1984(this, play); } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index f2f2569c4..c8202a9e2 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -194,7 +194,8 @@ void EnJg_UpdateCollision(EnJg* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 30.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); } s16 EnJg_GetWalkingYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ) { diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 371757e44..f6056664f 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -1015,7 +1015,7 @@ void EnJs_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index fca1afc51..0cfe7ae75 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -2028,7 +2028,9 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { Math_ApproachZeroF(&this->unk_2F0, 1.0f, 5.0f); } - Actor_UpdateBgCheckInfo(play, &this->picto.actor, 35.0f, 40.0f, 35.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 35.0f, 40.0f, 35.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->picto.actor, &this->bodyCollider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if ((this->unk_2D0 < 2) && (this->action != KAIZOKU_ACTION_0)) { diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index d35e767c0..7af84b5e4 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -1136,7 +1136,8 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->picto.actor); - Actor_UpdateBgCheckInfo(play, &this->picto.actor, 50.0f, 50.0f, 100.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 50.0f, 50.0f, 100.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (this->picto.actor.draw != NULL) { Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c index b508adecf..0a9689b17 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -716,7 +716,9 @@ void EnKame_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 60.0f, 40.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 60.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (this->actor.shape.shadowDraw != NULL) { Actor_SetFocus(&this->actor, 25.0f); diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index ba1cf165c..0390e1459 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -163,7 +163,7 @@ void EnKanban_Init(Actor* thisx, PlayState* play) { this->bounceX = 1; this->partFlags = 0xFFFF; - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, UPDBGCHECKINFO_FLAG_4); func_80954960(this); } } @@ -433,7 +433,8 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 10.0f, 50.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 10.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); tempX = this->actor.world.pos.x; tempY = this->actor.world.pos.y; @@ -442,7 +443,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { tempWaterDepth = this->actor.depthInWater; this->actor.world.pos.z += ((this->actor.world.pos.y - this->actor.floorHeight) * -50.0f) / 100.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, UPDBGCHECKINFO_FLAG_4); func_80954960(this); this->actor.world.pos.x = tempX; @@ -709,7 +710,8 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); if (this->actor.speed != 0.0f) { - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.speed *= -0.5f; if (this->spinVel.y > 0) { diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 80e5ca0fc..0c0078fd3 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -602,9 +602,10 @@ void EnKarebaba_Update(Actor* thisx, PlayState* play2) { if (this->actionFunc != EnKarebaba_Dead) { if (this->actionFunc == EnKarebaba_Dying) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 10.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 10.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else { - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->boundFloor == 0) { this->boundFloor = this->actor.floorPoly; } diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index efce38ad8..ee7e0fe84 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -125,7 +125,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) { Path* path = &play->setupPathList[ENKENDOJS_GET_FF00(&this->actor)]; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 1f411bd39..4432fcf6d 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -519,7 +519,9 @@ void EnKusa_LiftedUp(EnKusa* this, PlayState* play) { EnKusa_UpdateVelY(this); EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.005f); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | + UPDBGCHECKINFO_FLAG_80); this->actor.gravity = -3.2f; } else { pos.x = this->actor.world.pos.x; @@ -604,7 +606,9 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { this->actor.shape.rot.y += rotSpeedY; EnKusa_RandScaleVecToZero(&this->actor.velocity, 0.05f); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | + UPDBGCHECKINFO_FLAG_80); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 49fa4a98a..e178e7a4e 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -271,7 +271,8 @@ s32 func_80A5BA58(EnKusa2* this, PlayState* play) { } void func_80A5BAFC(EnKusa2* this, PlayState* play) { - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 35.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 35.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); } void func_80A5BB40(EnKusa2* this, PlayState* play, s32 arg2) { diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index 38fc47610..5b2028486 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -218,7 +218,7 @@ void EnLiftNuts_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->actor.floorBgId != BGCHECK_SCENE) { DynaPolyActor* bgActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); @@ -975,7 +975,7 @@ void EnLiftNuts_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actionFunc(this, play); func_80AEBB30(this, play); - Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80AE9BCC(this, play); if (func_80AE9B4C(0, 2)) { diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 69bcf41b3..0a1ec063a 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -190,7 +190,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &D_80AC00DC); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = 0; @@ -298,7 +298,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Actor_MoveWithGravity(&this->actor); if (this->skelAnime.animation == &gRomaniRunAnim) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 4.0f)) { diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 9117e55a3..89f1582ba 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -174,7 +174,7 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit2); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (EnMaYto_TryFindRomani(this, play) == 1) { EnMaYto_SetupKeepLookingForRomani(this); diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index b52378a5a..1987fa72a 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -235,7 +235,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { this->collider.dim.radius = 40; } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Actor_SetScale(&this->actor, 0.01f); this->interactInfo.talkState = NPC_TALK_STATE_IDLE; diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index e5855004f..3808c9cfc 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -573,7 +573,9 @@ void EnMinifrog_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 12.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 12.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); this->actor.focus.rot.y = this->actor.shape.rot.y; diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index ced5f991b..054f39c81 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -445,7 +445,7 @@ void EnMk_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index 7da0b46e3..4f1ddc660 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -415,7 +415,9 @@ void EnMkk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->actor.params == 0) { func_80A4E84C(this); } diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index cc2e5803e..ad25aa70c 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -200,7 +200,9 @@ void EnMm_Update(Actor* thisx, PlayState* play) { Collider_ResetCylinderAC(play, &this->collider.base); this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 20.0f, 31); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); Actor_SetFocus(&this->actor, 20.0f); } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 1fc29eafc..291fa83ce 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -92,7 +92,7 @@ void EnMm3_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actor.parent = NULL; this->actor.targetMode = 0; this->unk_1DC = 1; diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index b5bc6610e..88e69021f 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -439,7 +439,8 @@ void func_80A69388(EnMushi2* this) { } void func_80A69424(EnMushi2* this, PlayState* play) { - Actor_UpdateBgCheckInfo(play, &this->actor, 8.0f, 9.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 8.0f, 9.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); } s32 func_80A69468(EnMushi2* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index 49d37330b..7c9d1e9b2 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -272,7 +272,9 @@ void EnMuto_Update(Actor* thisx, PlayState* play2) { Math_SmoothStepToS(&this->headRot.x, this->headRotTarget.x, 1, 0x3E8, 0); Math_SmoothStepToS(&this->waistRot.y, this->waistRotTarget.y, 1, 0xBB8, 0); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); this->actor.uncullZoneForward = 500.0f; diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c index 562217efd..960767b11 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c @@ -604,7 +604,7 @@ void EnNeoReeba_UpdatePosition(EnNeoReeba* this, PlayState* play) { Math_ApproachZeroF(&this->velToTarget.x, 1.0f, 2.0f); Math_ApproachZeroF(&this->velToTarget.z, 1.0f, 2.0f); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c index 9c91d7092..807bbd849 100644 --- a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c +++ b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c @@ -53,7 +53,7 @@ static ColliderCylinderInit sCylinderInit = { void EnNimotsu_UpdateCollision(EnNimotsu* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } void EnNimotsu_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 274ddbc49..bded43eda 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -812,7 +812,9 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, this->unk308); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); // if cucco is off the map if (this->actor.floorHeight <= BGCHECK_Y_MIN || this->actor.floorHeight >= BGCHECK_Y_MAX) { diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 193334ff1..15e65b6ce 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -136,7 +136,8 @@ void EnNutsball_Update(Actor* thisx, PlayState* play2) { Actor_MoveWithoutGravity(&this->actor); Math_Vec3f_Copy(&worldPos, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 5.0f, 10.0f, 0x7); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 5.0f, 10.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (func_800C9A4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId) & 0x30) { diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 8c1947267..b11e8c408 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -457,7 +457,7 @@ void EnNwc_Update(Actor* thisx, PlayState* play) { EnNwc* this = THIS; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); if (this->hasGrownUp & 1) { this->actor.objBankIndex = this->niwObjectIndex; diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c index 0518e9457..929a3c90d 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c @@ -172,6 +172,6 @@ void EnOnpuman_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index ed5078864..b98fb8971 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -948,7 +948,7 @@ void EnOt_Update(Actor* thisx, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 10.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->actor.world.pos.y <= this->actor.floorHeight + 50.0f) { this->actor.world.pos.y = this->actor.floorHeight + 50.0f; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 52287f317..fb4c54c3d 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -894,7 +894,7 @@ void EnOwl_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); func_8095C568(this); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.update != NULL) { @@ -1077,7 +1077,7 @@ void func_8095CCF4(Actor* thisx, PlayState* play) { } this->actor.world.pos.y -= 1.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_3DA = (this->unk_3DA >> 3) * 7; if (this->unk_3DC > 0) { diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 36605afcb..966f21354 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -338,7 +338,7 @@ void func_80BD8B70(EnPamera* this, PlayState* play) { func_80BD8CCC(this); } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actor.world.pos.y += this->actor.gravity; } @@ -382,7 +382,7 @@ void func_80BD8DB0(EnPamera* this, PlayState* play) { func_80BD9338(this, play); func_80BD8A38(this); } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actor.world.pos.y += this->actor.gravity; } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 50cae4844..4172457f1 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -1343,7 +1343,9 @@ void EnPametfrog_Update(Actor* thisx, PlayState* play) { if (this->actor.gravity < -0.1f) { Actor_MoveWithGravity(&this->actor); arg3 = this->actionFunc == EnPametfrog_FallInAir ? 3.0f : 15.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, arg3, 3.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, arg3, 3.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } else if (this->freezeTimer == 0) { Actor_MoveWithoutGravity(&this->actor); this->actor.floorHeight = this->actor.world.pos.y; diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.c b/src/overlays/actors/ovl_En_Paper/z_en_paper.c index a3f158cbd..7659b524b 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.c +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.c @@ -47,7 +47,7 @@ void EnPaper_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->timer = 70; this->windForce = sUnitVecZ; - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); EnPaper_SetupSpreadConfettiGroup(this); } diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 6b4d3269b..2f4678b8d 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -750,7 +750,7 @@ void EnPeehat_Update(Actor* thisx, PlayState* play2) { func_8089874C(this, play); } Actor_MoveWithGravity(thisx); - Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 30.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, thisx, 25.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index f1f34b6be..81f6c8b09 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -2042,7 +2042,7 @@ void func_80AFA5FC(EnPm* this, PlayState* play) { void func_80AFA724(EnPm* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMAN_WALK); } @@ -2089,7 +2089,7 @@ void EnPm_Update(Actor* thisx, PlayState* play) { func_80AF8AC8(this); func_8013C964(&this->actor, play, this->unk_368, 30.0f, this->unk_394, this->unk_356 & 7); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80AF7F68(this, play); } } diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index ac717641b..beffe3bb8 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -111,7 +111,7 @@ void EnPoFusen_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->anime, &gPoeBalloonSkel, &gPoeBalloonEmptyAnim, this->jointTable, this->morphTable, POE_BALLOON_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 0x4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (!EnPoFusen_CheckParent(this, play)) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 3545d2f8c..35a972dfc 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -978,7 +978,7 @@ void EnPoSisters_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); if (this->poSisterFlags & POE_SISTERS_FLAG_UPDATE_BGCHECK_INFO) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else { checkPos.x = this->actor.world.pos.x; checkPos.y = this->actor.world.pos.y + 10.0f; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 997e91e8a..1c29c90c6 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -588,7 +588,7 @@ void func_80B2DD2C(EnPoh* this, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); } void func_80B2DDF8(EnPoh* this, s32 arg1) { diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c index 20c0dc1d8..5d1d6935e 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -1424,7 +1424,9 @@ void EnPp_Update(Actor* thisx, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 40.0f, 40.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 40.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (this->action != EN_PP_ACTION_BODY_PART_MOVE) { this->actor.shape.rot.y = this->actor.world.rot.y; } diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index 388388c53..ab47e693f 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -536,7 +536,9 @@ void EnPr_Update(Actor* thisx, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 30.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); if (this->unk_206 != 7) { diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index 2328ba87c..a1c2f3f4d 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -171,7 +171,9 @@ void EnPr2_Init(Actor* thisx, PlayState* play) { func_80A751B4(this); } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 20.0f, 20.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 20.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (!(this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH))) { Actor_Kill(&this->actor); @@ -661,7 +663,9 @@ void EnPr2_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, 10.0f); func_80A755D8(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0, 10.0f, 20.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 0, 10.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (this->unk_1D6) { s32 i; diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c index d4a48cfd2..e34ffe1f6 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -441,7 +441,9 @@ void EnPrz_Update(Actor* thisx, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 10.0f, 10.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 10.0f, 10.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->unk_1EA != 7) { Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.c b/src/overlays/actors/ovl_En_Pst/z_en_pst.c index c49852746..cef354c70 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.c +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.c @@ -393,7 +393,7 @@ void EnPst_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 0; Actor_SetScale(&this->actor, 0.02f); this->actionFunc = EnPst_FollowSchedule; - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } void EnPst_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index c356a318b..c2e4b4afd 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -259,7 +259,7 @@ void EnRacedog_UpdateCollision(EnRacedog* this, PlayState* play) { this->collider.dim.pos.y = this->actor.world.pos.y; this->collider.dim.pos.z = this->actor.world.pos.z; CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } /** diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index dd0225f0c..405ed1838 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -1071,7 +1071,7 @@ void EnRailSkb_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); func_80B72190(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); func_80B72970(this, play); if ((this->actionFunc != func_80B710E4) && (this->actionFunc != func_80B7114C) && diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 27da7017c..2e85f081d 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -901,9 +901,11 @@ void EnRailgibud_MoveGrabbedPlayerAwayFromWall(EnRailgibud* this, PlayState* pla Vec3f targetPos; if ((this->actionFunc == EnRailgibud_Grab) && (this->grabState != EN_RAILGIBUD_GRAB_RELEASE)) { - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 1); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, UPDBGCHECKINFO_FLAG_1); } else { - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } if ((this->actionFunc == EnRailgibud_Grab) && (this->grabState == EN_RAILGIBUD_GRAB_START) && diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index 63ef35aab..8c6871965 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -853,7 +853,8 @@ void EnRat_Update(Actor* thisx, PlayState* play) { this->actor.floorHeight = this->actor.world.pos.y; } else { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 30.0f, 60.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 30.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); } if (SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index dacfb6e2b..b8e8e4139 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -1280,7 +1280,9 @@ void EnRd_Update(Actor* thisx, PlayState* play) { } if ((this->actor.shape.rot.x == 0) && (this->action != EN_RD_ACTION_GRABBING) && (this->actor.speed != 0.0f)) { - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } if (this->action == EN_RD_ACTION_ATTEMPTING_PLAYER_STUN) { diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 190af1a8a..79b861477 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -786,7 +786,9 @@ void EnRg_Update(Actor* thisx, PlayState* play) { func_80BF4024(this, play); } - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->actor.floorHeight <= BGCHECK_Y_MIN) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 3e193ce79..85086d228 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -807,7 +807,9 @@ void EnRr_Update(Actor* thisx, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider1.dim.radius, 0.0f, 0x5D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider1.dim.radius, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_40); func_808FB794(this, play); if (this->unk_1FC > 0) { diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 0f8c45872..47d05f8ab 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -250,7 +250,7 @@ void EnRu_Update(Actor* thisx, PlayState* play) { EnRu* this = THIS; this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); EnRu_UpdateModel(this, play); EnRu_UpdateCollider(this, play); } diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index cf62faf71..19d6611d6 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -130,7 +130,8 @@ s32 EnRuppecrow_UpdateCollision(EnRuppecrow* this, PlayState* play) { this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 25.0f, 50.0f, 0x07); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 25.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); return true; } diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index 23b6419ab..fe5562f14 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -653,7 +653,7 @@ void EnRz_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index f3af8a510..debcc77b9 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -1328,7 +1328,7 @@ void EnSGoro_Update(Actor* thisx, PlayState* play) { EnSGoro* this = (EnSGoro*)thisx; this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->loadedObjIndex].segment); SkelAnime_Update(&this->skelAnime); if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) { diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 6b2304b19..b34ee8c64 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -375,7 +375,7 @@ void EnSb_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, 20.0f); Actor_MoveWithGravity(&this->actor); this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); EnSb_UpdateDamage(this, play); if (player->stateFlags1 & PLAYER_STATE1_8000000) { Collider_UpdateCylinder(&this->actor, &this->collider); diff --git a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c index da7c85f63..be449e0a3 100644 --- a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c +++ b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c @@ -67,7 +67,7 @@ static ColliderCylinderInit sCylinderInit = { void EnScRuppe_UpdateCollision(EnScRuppe* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } s32 func_80BD697C(s16 ruppeIndex) { diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 63a713358..52ba17d22 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -163,7 +163,7 @@ void func_80BCAE78(EnScopenuts* this, PlayState* play) { } if (this->unk_328 & 2) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 03aa4ab19..174dace1d 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -118,7 +118,7 @@ void func_80ADADD0(EnSellnuts* this, PlayState* play) { } if (this->unk_338 & 1) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 09cee41f2..f6e311d61 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -1062,7 +1062,9 @@ void EnSkb_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); func_809964DC(this, play); func_80996AD0(this, play); func_80996D68(this, play); diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index 640bd2a26..a083d6ded 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -1037,7 +1037,9 @@ void EnSnowman_Update(Actor* thisx, PlayState* play) { wallCheckRadius = this->collider.dim.radius; } - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, wallCheckRadius, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, wallCheckRadius, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if ((this->actor.floorPoly != NULL) && ((this->actor.floorPoly->normal.y * SHT_MINV) < 0.7f)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); if (!this->turningOnSteepSlope) { @@ -1111,7 +1113,9 @@ void EnSnowman_UpdateSnowball(Actor* thisx, PlayState* play) { this->actor.shape.rot.x += 0xF00; Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, this->collider.dim.radius * 0.6f, - this->collider.dim.height - this->collider.dim.yShift, 0x1F); + this->collider.dim.height - this->collider.dim.yShift, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 18031242c..06831bbb1 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -849,7 +849,7 @@ void EnSsh_Update(Actor* thisx, PlayState* play) { } else { SkelAnime_Update(&this->skelAnime); Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 987558e3f..994a455a6 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -878,7 +878,7 @@ void EnSt_Update(Actor* thisx, PlayState* play) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { SkelAnime_Update(&this->skelAnime); } - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else if (this->unk_312 < 20) { s16 idx = (this->unk_312 % 2) ? -1 : 1; diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 9048a1d0f..3ff396920 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -677,7 +677,7 @@ void EnSth_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c index 93e68a83f..f75c54d37 100644 --- a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c +++ b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c @@ -433,7 +433,9 @@ void EnStoneheishi_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Actor_SetScale(&this->actor, 0.01f); if ((CHECK_WEEKEVENTREG(WEEKEVENTREG_41_40) || (play->actorCtx.lensMaskSize == 100)) && diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c index edbf581f9..3716f18d0 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c @@ -545,7 +545,9 @@ void EnStopheishi_Update(Actor* thisx, PlayState* play) { Math_SmoothStepToS(&this->headRotZ, this->pitchToPlayer, 1, 0x7D0, 0); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); Actor_SetScale(&this->actor, 0.01f); this->actor.uncullZoneForward = 500.0f; Math_Vec3f_Copy(&this->actor.focus.pos, &this->headWorldPos); diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 5bffa0d83..dc68a07c7 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -205,9 +205,9 @@ void EnSuttari_UpdateCollider(EnSuttari* this, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if ((this->flags1 & 1) && (this->actionFunc != func_80BADE14)) { - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } else { - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 30.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index e76bc85a5..bcf380cba 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -896,7 +896,7 @@ void func_808DA89C(EnSw* this, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } } @@ -1130,7 +1130,7 @@ void func_808DB2E0(EnSw* this, PlayState* play) { Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.velocity.y += this->actor.gravity; Actor_UpdatePos(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } void EnSw_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index a4407dcc2..8a3a65ed2 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -425,7 +425,7 @@ void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index abd7c100c..6c020e7e6 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -553,7 +553,7 @@ void EnTab_Update(Actor* thisx, PlayState* play) { func_8013C964(&this->actor, play, radius, height, PLAYER_IA_NONE, this->unk_2FC & 7); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80BE0620(this, play); } } diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index 386e80a1f..035b04983 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -1111,7 +1111,9 @@ void EnTalkGibud_MoveGrabbedPlayerAwayFromWall(EnTalkGibud* this, PlayState* pla Player* player = GET_PLAYER(play); Vec3f targetPos; - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, 29); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if (this->actionFunc == EnTalkGibud_Grab && this->grabState == EN_TALK_GIBUD_GRAB_START && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { targetPos = player->actor.world.pos; diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index 56384193e..2d1c29970 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -155,7 +155,7 @@ void EnTanron2_Init(Actor* thisx, PlayState* play) { this->unk_14C = -this->unk_14C; } - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, UPDBGCHECKINFO_FLAG_4); this->actor.floorHeight += 20.0f; this->unk_148 = Rand_ZeroFloat(32.0f); } diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index bc8fee2fd..c3d62e166 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -404,7 +404,7 @@ void EnTanron3_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 20.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 20.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); // The fish has either just entered or just exited the water, so create a splash effect if (((this->actor.prevPos.y < this->waterSurfaceYPos) && (this->waterSurfaceYPos <= this->actor.world.pos.y)) || diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index e285869a5..0e5b8a0f5 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -203,7 +203,7 @@ void EnTanron5_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } else { - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, UPDBGCHECKINFO_FLAG_4); this->actor.world.pos.y = this->actor.floorHeight + -20.0f; } } @@ -417,7 +417,7 @@ void func_80BE5818(Actor* thisx, PlayState* play2) { if (this->actor.speed > 0.02f) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, UPDBGCHECKINFO_FLAG_4); } if (ENTANRON5_GET(&this->actor) < ENTANRON5_110) { diff --git a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c index 4faa072f9..875f36a61 100644 --- a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c +++ b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c @@ -91,7 +91,9 @@ void EnTanron6_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } void EnTanron6_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index 0b7a5c3f3..ed048288e 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -162,7 +162,7 @@ void EnTg_Update(Actor* thisx, PlayState* play) { EnTg* this = THIS; this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); EnTg_UpdateSkelAnime(this, play); EnTg_UpdateHearts(play, this->effects, ARRAY_COUNT(this->effects)); EnTg_UpdateCollider(this, play); diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 674059f1a..491d94227 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -1020,7 +1020,8 @@ void EnThiefbird_Update(Actor* thisx, PlayState* play2) { Actor_MoveWithGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 25.0f, 50.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 25.0f, 50.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); if (this->actionFunc == func_80C1193C) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index f6a5b1ae4..5b77c1399 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -147,7 +147,8 @@ void EnTite_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; - this->unk_2C0 = 0x1D; + this->updBgCheckInfoFlags = + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10; if (!D_80896B60) { for (i = 0; i < ARRAY_COUNT(D_80896B24); i++) { @@ -178,7 +179,7 @@ void EnTite_Init(Actor* thisx, PlayState* play) { } if (this->actor.params == ENTITE_MINUS_2) { - this->unk_2C0 |= 0x40; + this->updBgCheckInfoFlags |= UPDBGCHECKINFO_FLAG_40; this->actor.colChkInfo.health = 3; } } @@ -1062,7 +1063,7 @@ void EnTite_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != func_808951B8) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 40.0f, 20.0f, this->unk_2C0); + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 40.0f, 20.0f, this->updBgCheckInfoFlags); func_808963B4(this, play); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index 4b87634a3..57d8ef3e3 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -27,7 +27,7 @@ typedef struct EnTite { /* 0x2BB */ u8 drawDmgEffType; /* 0x2BC */ s16 unk_2BC; /* 0x2BE */ s16 unk_2BE; - /* 0x2C0 */ s32 unk_2C0; + /* 0x2C0 */ s32 updBgCheckInfoFlags; /* 0x2C4 */ f32 drawDmgEffAlpha; /* 0x2C8 */ f32 drawDmgEffScale; /* 0x2CC */ f32 drawDmgEffFrozenSteamScale; diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index dd122ed8c..849214aba 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -1270,7 +1270,7 @@ void func_80AEF2D8(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); func_80AEC460(this); } @@ -1310,7 +1310,7 @@ void EnTk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if ((this->unk_2B0 == 0) && (func_800C9B40(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 12)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 75f966a3c..ccf7c5e13 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -101,7 +101,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play) { this->actor.gravity = -1.0f; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 70.0f, 0x05); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 70.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if (this->framesUntilNextState == 0) { remainingFrames = 0; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index 44f2e7d3e..7e76bbfcc 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -792,7 +792,7 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); if (play->sceneId != SCENE_20SICHITAI) { - Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } Actor_SetFocus(&this->actor, 90.0f); diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index eac370ebf..7ab20a77c 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -1155,7 +1155,7 @@ void EnTru_Init(Actor* thisx, PlayState* play) { } this->actionFunc = func_80A87FD0; - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } void EnTru_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 64f936bbd..bd36be072 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -435,7 +435,7 @@ void EnTruMt_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 0; Actor_SetScale(&this->actor, 0.008f); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->unk_328 = 0; this->actor.room = -1; diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index 87ae0791a..aaa022f7a 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -567,7 +567,7 @@ void EnTsn_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); SkelAnime_Update(&this->skelAnime); if (this->unk_220 & 1) { diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 48d7b4330..340618db7 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -289,7 +289,9 @@ void EnTuboTrap_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 10.0f, 20.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 10.0f, 20.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); Actor_SetFocus(&this->actor, 0.0f); if (this->actor.projectedPos.z < 811.0f) { diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index aae20d26d..505df7f11 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -386,7 +386,8 @@ void func_808CCCF0(EnVm* this, PlayState* play) { this->unk_216 += 0x5DC; this->unk_218 += 0x9C4; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 40.0f, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); this->unk_214--; if (this->unk_214 == 1) { diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 63a97dab9..11860c20d 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -629,7 +629,9 @@ void EnWallmas_Update(Actor* thisx, PlayState* play) { } if (this->actionFunc != EnWallmas_Drop) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 25.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); } if ((this->actionFunc != EnWallmas_Die) && (this->actionFunc != EnWallmas_Drop)) { diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index f1400d69b..159b7444e 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -158,7 +158,7 @@ void EnWaterEffect_Update(Actor* thisx, PlayState* play2) { this->unk_DC4++; if ((this->unk_DC4 % 32) == 0) { if (Rand_ZeroOne() < 0.5f) { - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, UPDBGCHECKINFO_FLAG_4); sp88.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; sp88.y = this->actor.world.pos.y; sp88.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; @@ -420,7 +420,7 @@ void func_80A59C04(Actor* thisx, PlayState* play2) { this->unk_DC4++; if (this->unk_DC6 == 0) { this->unk_DC6 = Rand_ZeroFloat(150.0f) + 100.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 10.0f, 40.0f, UPDBGCHECKINFO_FLAG_4); sp74.x = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.x; sp74.y = this->actor.world.pos.y; sp74.z = randPlusMinusPoint5Scaled(50.0f) + this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 4ed6b6a7d..7d38f370f 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -1485,7 +1485,9 @@ void EnWf_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); func_80993738(this, play); if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c index 26f126e72..ac8375c24 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -1151,7 +1151,9 @@ void EnWiz_Damaged(EnWiz* this, PlayState* play) { Math_SmoothStepToS(&this->platformLightAlpha, this->targetPlatformLightAlpha, 20, 50, 10); Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 40.0f, 40.0f, 0x1F); + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 40.0f, 40.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | + UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } void EnWiz_SetupDead(EnWiz* this) { diff --git a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c index bf63fcc3c..bad93b685 100644 --- a/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c +++ b/src/overlays/actors/ovl_En_Wiz_Fire/z_en_wiz_fire.c @@ -573,7 +573,9 @@ void EnWizFire_Update(Actor* thisx, PlayState* play2) { DECR(this->steamSpawnTimer); DECR(this->poolTimer); - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 5.0f, 10, 0x1D); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 5.0f, 10, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | + UPDBGCHECKINFO_FLAG_10); if ((this->hitByIceArrow || sPoolHitByIceArrow) && (this->steamSpawnTimer == 0)) { Vec3f accel; diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index 7a751c7ce..b6c05815e 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -406,7 +406,7 @@ void EnYb_Update(Actor* thisx, PlayState* play) { } if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_1)) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 0e282656c..aed16b874 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -280,7 +280,7 @@ void EnZo_Update(Actor* thisx, PlayState* play) { EnZo* this = THIS; this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); EnZo_LookAtPlayer(this, play); EnZo_PlayWalkingSound(this, play); EnZo_UpdateCollider(this, play); diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index 895c5c032..263272464 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -711,7 +711,7 @@ void EnZob_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index 0da7a17bb..1ef62420b 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -527,7 +527,7 @@ void EnZod_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); EnZod_UpdateInstruments(this); diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 1935d627e..349724cb3 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -956,7 +956,7 @@ void EnZog_Update(Actor* thisx, PlayState* play) { EnZog* this = THIS; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if (Cutscene_CheckActorAction(play, 0x1D7) && (ENZOG_GET_F(&this->actor) != ENZOG_F_2)) { this->actionFunc = func_80B9461C; this->actor.shape.yOffset = 0.0f; diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index cc391c0b1..44a705539 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -244,7 +244,7 @@ void func_80B31C40(EnZoraegg* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); Math_Vec3f_Copy(&this->actor.focus.pos, &this->actor.world.pos); this->actor.focus.pos.y += 10.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } Actor* func_80B31CB4(PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index c538457e8..3898e754c 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -701,7 +701,7 @@ void EnZos_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 30.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 30.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index ce5625b83..1eb6b020b 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -1316,7 +1316,7 @@ void EnZot_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 30.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); this->unk_2F2 &= ~0x40; if (SkelAnime_Update(&this->skelAnime) && (this->unk_2F0 != 0)) { diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index 17c4a9f70..5a93d91cc 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -476,7 +476,7 @@ void EnZov_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->picto.actor); Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->picto.actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->picto.actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index e68a11038..638fa0263 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -547,7 +547,7 @@ void EnZow_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 30.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 15.0f, 30.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if (this->unk_2CE != 0) { this->unk_2CA &= ~2; diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c index a552e35ab..c4e861ff6 100644 --- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c +++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c @@ -115,7 +115,7 @@ void MirRay2_Update(Actor* thisx, PlayState* play) { } else { func_80AF3FE0(this, play); if (MIRRAY2_GET_F(thisx) != 1) { - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_4); this->actor.shape.shadowAlpha = 0x50; } else { func_80AF3F70(this); diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 532daec90..c32fb582d 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -257,7 +257,7 @@ void ObjAqua_Update(Actor* thisx, PlayState* play) { } this->actor.velocity.y *= 0.9f; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 4.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 12.0f, 4.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); if (this->actionFunc != func_80ACBDFC) { Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = this->actor.scale.x * 3000.0f; diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c index 05544da0e..79a877803 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c @@ -227,7 +227,7 @@ void ObjArmos_Destroy(Actor* thisx, PlayState* play) { void func_809A54B4(ObjArmos* this) { this->actionFunc = func_809A54E0; - this->unk_24C = 4; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_4; this->unk_266[1] = 0; this->unk_266[2] = 0; this->unk_266[3] = 0; @@ -260,7 +260,7 @@ void func_809A54E0(ObjArmos* this, PlayState* play) { void func_809A5610(ObjArmos* this) { this->actionFunc = func_809A562C; - this->unk_24C = 5; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4; } void func_809A562C(ObjArmos* this, PlayState* play) { @@ -304,7 +304,7 @@ void func_809A562C(ObjArmos* this, PlayState* play) { void func_809A57D8(ObjArmos* this) { this->actionFunc = func_809A57F4; - this->unk_24C = 4; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_4; } void func_809A57F4(ObjArmos* this, PlayState* play) { @@ -322,12 +322,12 @@ void ObjArmos_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - if (this->unk_24C != 0) { - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 30.0f, 0.0f, this->unk_24C); + if (this->updBgCheckInfoFlags != 0) { + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 30.0f, 0.0f, this->updBgCheckInfoFlags); if ((this->actionFunc == func_809A54E0) && (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId) == NULL)) { - this->unk_24C = 0; + this->updBgCheckInfoFlags = 0; } this->unk_250.x = (Math_SinS(this->dyna.actor.shape.rot.y) * -9.0f) + this->dyna.actor.world.pos.x; diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h index 2e9453005..177cc8e66 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.h @@ -28,7 +28,7 @@ typedef struct ObjArmos { /* 0x1A0 */ Vec3s jointTable[OBJECT_AM_LIMB_MAX]; /* 0x1F4 */ Vec3s morphTable[OBJECT_AM_LIMB_MAX]; /* 0x248 */ ObjArmosActionFunc actionFunc; - /* 0x24C */ u32 unk_24C; + /* 0x24C */ u32 updBgCheckInfoFlags; /* 0x250 */ Vec3f unk_250; /* 0x25C */ f32* unk_25C; /* 0x260 */ f32 unk_260; diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c index 04871bae5..1146175fd 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -238,7 +238,7 @@ void func_80AE9258(ObjBigicicle* this, PlayState* play) { ObjIcePoly* icePoly; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index f37a15a80..957ac1433 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -475,7 +475,7 @@ void func_8098DEA0(ObjComb* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); this->actor.shape.rot.x += this->unk_1AE; this->actor.shape.rot.y += this->unk_1B0; - Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 12.0f, 0.0f, 5); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index a5c66629a..cc818c883 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -384,7 +384,8 @@ void func_80A1C554(ObjFlowerpot* this) { } void func_80A1C5E8(ObjFlowerpot* this, PlayState* play) { - Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); } void func_80A1C62C(ObjFlowerpot* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index e7ddf5038..021c253ce 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -157,7 +157,7 @@ void ObjGhaka_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 1); CollisionHeader_GetVirtual(&object_ghaka_Colheader_003CD0, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->dyna.actor.floorPoly == 0) { Actor_Kill(&this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c index e649664f3..e46c5da44 100644 --- a/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c +++ b/src/overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.c @@ -103,7 +103,9 @@ void func_809AAF18(ObjGrassCarry* this) { } void func_809AAF58(ObjGrassCarry* this, PlayState* play) { - Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | + UPDBGCHECKINFO_FLAG_80); } void func_809AAF9C(Vec3f* arg0, s16 arg1, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index dcd1dad4e..582d0a235 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -123,7 +123,7 @@ void ObjHakaisi_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->dyna.actor); } - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->dyna.actor.floorPoly == NULL) { Actor_Kill(&this->dyna.actor); @@ -423,7 +423,7 @@ void func_80B1544C(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } void func_80B154A0(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c index 4d5845d45..26191e397 100644 --- a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c +++ b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.c @@ -211,7 +211,7 @@ void ObjKendoKanban_Init(Actor* thisx, PlayState* play) { Collider_SetTrisVertices(&this->colliderTris, i, &vertices[0], &vertices[1], &vertices[2]); } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->boardFragments = OBJKENDOKANBAN_GET_BOARD_FRAGMENTS(&this->actor); this->actor.gravity = -2.0f; @@ -380,7 +380,7 @@ void ObjKendoKanban_HandlePhysics(ObjKendoKanban* this, PlayState* play) { Matrix_Pop(); } - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { // When on the ground, apply some friction. diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 8dbff17b2..5b15d0ecc 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -252,7 +252,8 @@ void func_80926B40(ObjKibako* this) { void func_80926B54(ObjKibako* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) { this->actor.draw = ObjKibako_Draw; this->actor.objBankIndex = this->bankIndex; @@ -293,7 +294,8 @@ void ObjKibako_Idle(ObjKibako* this, PlayState* play) { } else { Actor_MoveWithGravity(&this->actor); func_809262BC(this); - Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 28.0f)) { this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; @@ -349,7 +351,8 @@ void ObjKibako_Held(ObjKibako* this, PlayState* play) { ObjKibako_SetupThrown(this); this->actor.flags &= ~ACTOR_FLAG_4000000; } - Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); } else { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 20.0f; @@ -406,7 +409,8 @@ void ObjKibako_Thrown(ObjKibako* this, PlayState* play) { Math_StepToS(&D_8092738C, D_80927388, 0xA0); this->actor.shape.rot.x = (s16)(this->actor.shape.rot.x + D_80927384); this->actor.shape.rot.y = (s16)(this->actor.shape.rot.y + D_8092738C); - Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c index 7be450b3b..8d6ae9f71 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c @@ -53,7 +53,7 @@ void ObjLupygamelift_Init(Actor* thisx, PlayState* play) { this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.rot.z = 0; this->timer = 0; - Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawSquare, 0.0f); DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_LoadMesh(play, &this->dyna, &object_raillift_Colheader_0048D0); diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c index 51eadfadc..d5f0c902c 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c @@ -244,7 +244,7 @@ void func_809A3A48(ObjPzlblock* this) { this->unk_16E[2] = 0; this->unk_16E[3] = 0; this->unk_16E[0] = 0; - this->unk_160 = 4; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_4; } void func_809A3A74(ObjPzlblock* this, PlayState* play) { @@ -275,7 +275,7 @@ void func_809A3A74(ObjPzlblock* this, PlayState* play) { void func_809A3BA4(ObjPzlblock* this) { this->actionFunc = func_809A3BC0; - this->unk_160 = 5; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4; } void func_809A3BC0(ObjPzlblock* this, PlayState* play) { @@ -313,7 +313,7 @@ void func_809A3BC0(ObjPzlblock* this, PlayState* play) { void func_809A3D1C(ObjPzlblock* this) { this->actionFunc = func_809A3D38; - this->unk_160 = 4; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_4; } void func_809A3D38(ObjPzlblock* this, PlayState* play) { @@ -328,7 +328,7 @@ void ObjPzlblock_Update(Actor* thisx, PlayState* play) { ObjPzlblock* this = THIS; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (Object_IsLoaded(&play->objectCtx, this->unk_17A)) { ObjPzlblockStruct* sp2C = &D_809A4060[OBJPZLBLOCK_GET_1000(&this->dyna.actor)]; @@ -348,12 +348,12 @@ void func_809A3E58(Actor* thisx, PlayState* play) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; - if (this->unk_160 != 0) { - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, this->unk_160); + if (this->updBgCheckInfoFlags != 0) { + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 15.0f, 30.0f, 0.0f, this->updBgCheckInfoFlags); if (((this->actionFunc == func_809A3A74) || (this->actionFunc == func_809A3D38)) && (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !DynaPoly_GetActor(&play->colCtx, this->dyna.actor.floorBgId)) { - this->unk_160 = 0; + this->updBgCheckInfoFlags = 0; } } } diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h index 27a038860..5cf67efcc 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.h @@ -15,7 +15,7 @@ typedef void (*ObjPzlblockActionFunc)(struct ObjPzlblock*, PlayState*); typedef struct ObjPzlblock { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjPzlblockActionFunc actionFunc; - /* 0x160 */ s32 unk_160; + /* 0x160 */ s32 updBgCheckInfoFlags; /* 0x164 */ f32* unk_164; /* 0x168 */ f32 unk_168; /* 0x16C */ s16 unk_16C; diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index f5c39f0b8..ec05294d1 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -374,7 +374,8 @@ void func_80B39C9C(ObjSnowball2* this, PlayState* play) { if (this->unk_1AD == 0) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { this->unk_1AD = 1; @@ -422,7 +423,8 @@ void func_80B39FA8(ObjSnowball2* this, PlayState* play) { this->actor.velocity.y *= 0.4f; this->actor.gravity = -2.8f; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); func_80B3A0D8(this); } else { sp30.x = this->actor.world.pos.x; @@ -510,7 +512,8 @@ void func_80B3A13C(ObjSnowball2* this, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x45); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); this->actor.shape.rot.x += this->unk_1A8; this->actor.shape.rot.y += this->unk_1AA; func_80B38E20(this); diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c index 490ade729..c6ed2cc2c 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c @@ -244,7 +244,8 @@ void func_809A48AC(ObjToge* this, PlayState* play) { } Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, D_809A4D0C[OBJTOGE_GET_4000(&this->actor)] * 30.0f, 0.0f, 0x81); + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, D_809A4D0C[OBJTOGE_GET_4000(&this->actor)] * 30.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_80); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_198[this->unk_194]); diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index a61fb6f64..94e9c85c1 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -324,7 +324,7 @@ void ObjTokeidai_ExteriorGear_Collapse(ObjTokeidai* this, PlayState* play) { this->actor.shape.rot.x += 0x50; this->actor.shape.rot.z += 0x50; Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 99b7e3532..7b4fcf574 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -431,7 +431,7 @@ void func_80928914(ObjTsubo* this) { void func_80928928(ObjTsubo* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; func_809289B4(this); @@ -493,7 +493,8 @@ void func_809289E4(ObjTsubo* this, PlayState* play) { } else { if (!this->unk_195) { Actor_MoveWithGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0x44); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId) == NULL)) { this->unk_195 = true; @@ -532,7 +533,9 @@ void func_80928D80(ObjTsubo* this, PlayState* play) { this->actor.room = play->roomCtx.curRoom.num; Actor_MoveWithGravity(&this->actor); this->actor.flags &= ~ACTOR_FLAG_4000000; - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | + UPDBGCHECKINFO_FLAG_80); func_80928E74(this); } else { pos.x = this->actor.world.pos.x; @@ -605,7 +608,9 @@ void func_80928F18(ObjTsubo* this, PlayState* play) { Math_StepToS(&D_8092950C, D_80929508, 150); this->actor.shape.rot.x += D_80929504; this->actor.shape.rot.y += D_8092950C; - Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); + Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | + UPDBGCHECKINFO_FLAG_80); Collider_UpdateCylinder(&this->actor, &this->cylinderCollider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinderCollider.base); CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinderCollider.base); diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index f06d13caf..ac938752a 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -1713,7 +1713,8 @@ void ObjUm_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); this->unk_350++; - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); + Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, + UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); if (this->donkey != NULL) { this->donkey->actor.world.pos.x = this->dyna.actor.world.pos.x; From 823746d49530318331f29af92fa924a15f2482a1 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Tue, 18 Apr 2023 13:34:58 -0700 Subject: [PATCH 20/29] Angle Conversions (#1216) * Angle Conversions * Format * namefixer * Renames in ObjHsStump_Appear * Format * once more * Explicit cast in EnSsh * Update src/overlays/actors/ovl_En_Fishing/z_en_fishing.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- include/z64math.h | 27 ++++++++++--- src/code/sys_math.c | 4 +- src/code/sys_math_atan.c | 2 +- src/code/sys_matrix.c | 4 +- src/code/z_olib.c | 12 +++--- src/code/z_quake.c | 6 +-- src/code/z_sub_s.c | 8 ++-- src/libultra/gu/position.c | 2 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 5 +-- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 2 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 4 +- .../ovl_En_Akindonuts/z_en_akindonuts.c | 2 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 4 +- .../actors/ovl_En_Bombal/z_en_bombal.c | 2 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 4 +- src/overlays/actors/ovl_En_Dg/z_en_dg.c | 4 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 4 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 2 +- .../actors/ovl_En_Estone/z_en_estone.c | 6 +-- .../actors/ovl_En_Fishing/z_en_fishing.c | 38 +++++++++---------- src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 2 +- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 2 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 12 +++--- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 4 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 2 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 2 +- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 2 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 4 +- .../actors/ovl_En_Scopecrow/z_en_scopecrow.c | 2 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 2 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 2 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 2 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 4 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 6 +-- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 4 +- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 2 +- .../actors/ovl_En_Warp_tag/z_en_warp_tag.c | 7 ++-- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 6 +-- src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c | 2 +- .../actors/ovl_Obj_HsStump/z_obj_hsstump.c | 17 ++++----- .../ovl_Obj_Warpstone/z_obj_warpstone.c | 4 +- .../z_eff_ss_fire_tail.c | 2 +- .../z_eff_ss_solder_srch_ball.c | 2 +- tools/namefixer.py | 4 ++ 44 files changed, 128 insertions(+), 112 deletions(-) diff --git a/include/z64math.h b/include/z64math.h index 62b6432e8..d47a01a64 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -114,13 +114,28 @@ typedef struct { #define IS_ZERO(f) (fabsf(f) < 0.008f) +// Casting a float to an integer, when the float value is larger than what the integer type can hold, +// leads to undefined behavior. For example (f32)0x8000 doesn't fit in a s16, so it cannot be cast to s16. +// This isn't an issue with IDO, but is one with for example GCC. +// A partial workaround is to cast to s32 then s16, hoping all binang values used will fit a s32. +#define TRUNCF_BINANG(f) (s16)(s32)(f) + // Angle conversion macros -#define DEG_TO_BINANG(degrees) (s16)((degrees) * (0x8000 / 180.0f)) -#define RADF_TO_BINANG(radf) (s16)((radf) * (0x8000 / M_PI)) -#define RADF_TO_DEGF(radf) ((radf) * (180.0f / M_PI)) -#define DEGF_TO_RADF(degf) ((degf) * (M_PI / 180.0f)) -#define BINANG_TO_RAD(binang) ((f32)binang * (M_PI / 0x8000)) -#define BINANG_TO_RAD_ALT(binang) (((f32)binang / 0x8000) * M_PI) +#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f)) +#define DEG_TO_BINANG(degrees) TRUNCF_BINANG((degrees) * (0x8000 / 180.0f)) +#define DEG_TO_BINANG_ALT(degrees) TRUNCF_BINANG(((degrees) / 180.0f) * 0x8000) +#define DEG_TO_BINANG_ALT2(degrees) TRUNCF_BINANG(((degrees) * 0x10000) / 360.0f) +#define DEG_TO_BINANG_ALT3(degrees) ((degrees) * (0x8000 / 180.0f)) + +#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PI)) +#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / M_PI)) +#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / M_PI) * 0x8000) +#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / M_PI) + +#define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000)) +#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000)) +#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * M_PI) +#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000) // Angle arithmetic macros #define BINANG_ROT180(angle) ((s16)(angle + 0x8000)) diff --git a/src/code/sys_math.c b/src/code/sys_math.c index da4ccc9d2..7fd7e9dea 100644 --- a/src/code/sys_math.c +++ b/src/code/sys_math.c @@ -66,7 +66,7 @@ f32 pow_int(f32 base, s32 exp) { * Takes an angle in radians and returns the sine. */ f32 sin_rad(f32 rad) { - return sins(RADF_TO_BINANG(rad)) * SHT_MINV; + return sins(RAD_TO_BINANG(rad)) * SHT_MINV; } // Rename to Math_CosF @@ -74,7 +74,7 @@ f32 sin_rad(f32 rad) { * Takes an angle in radians and returns the cosine. */ f32 cos_rad(f32 rad) { - return coss(RADF_TO_BINANG(rad)) * SHT_MINV; + return coss(RAD_TO_BINANG(rad)) * SHT_MINV; } /** diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c index 72383b6b9..ef05676f5 100644 --- a/src/code/sys_math_atan.c +++ b/src/code/sys_math_atan.c @@ -127,7 +127,7 @@ s16 Math_Atan2S(f32 y, f32 x) { } f32 Math_Atan2F(f32 y, f32 x) { - return Math_Atan2S(y, x) * (M_PI / 0x8000); + return BINANG_TO_RAD(Math_Atan2S(y, x)); } // Match the OoT implementation of Math_Atan2S diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 63857676e..de8da3def 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -444,8 +444,8 @@ void Matrix_RotateXFApply(f32 x) { if (x != 0.0f) { cmf = sCurrentMatrix; - sin = sins(RADF_TO_BINANG(x)) * SHT_MINV; - cos = coss(RADF_TO_BINANG(x)) * SHT_MINV; + sin = sins(RAD_TO_BINANG(x)) * SHT_MINV; + cos = coss(RAD_TO_BINANG(x)) * SHT_MINV; tempY = cmf->xy; tempZ = cmf->xz; diff --git a/src/code/z_olib.c b/src/code/z_olib.c index 2b6b8d139..ad0c2b35c 100644 --- a/src/code/z_olib.c +++ b/src/code/z_olib.c @@ -123,14 +123,14 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) { if ((dist == 0.0f) && (vec->y == 0.0f)) { sph.pitch = 0; } else { - sph.pitch = CAM_DEG_TO_BINANG(RADF_TO_DEGF(func_80086B30(dist, vec->y))); + sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(dist, vec->y))); } sph.r = sqrtf(SQ(vec->y) + distSquared); if ((vec->x == 0.0f) && (vec->z == 0.0f)) { sph.yaw = 0; } else { - sph.yaw = CAM_DEG_TO_BINANG(RADF_TO_DEGF(func_80086B30(vec->x, vec->z))); + sph.yaw = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(vec->x, vec->z))); } *dest = sph; @@ -220,8 +220,8 @@ Vec3f* OLib_Vec3fDiffDegF(Vec3f* dest, Vec3f* a, Vec3f* b) { OLib_Vec3fDiffRad(&anglesRad, a, b); - anglesDegrees.x = RADF_TO_DEGF(anglesRad.x); - anglesDegrees.y = RADF_TO_DEGF(anglesRad.y); + anglesDegrees.x = RAD_TO_DEG(anglesRad.x); + anglesDegrees.y = RAD_TO_DEG(anglesRad.y); anglesDegrees.z = 0.0f; *dest = anglesDegrees; @@ -238,8 +238,8 @@ Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b) { OLib_Vec3fDiffRad(&anglesRad, a, b); - anglesBinAng.x = CAM_DEG_TO_BINANG(RADF_TO_DEGF(anglesRad.x)); - anglesBinAng.y = CAM_DEG_TO_BINANG(RADF_TO_DEGF(anglesRad.y)); + anglesBinAng.x = CAM_DEG_TO_BINANG(RAD_TO_DEG(anglesRad.x)); + anglesBinAng.y = CAM_DEG_TO_BINANG(RAD_TO_DEG(anglesRad.y)); anglesBinAng.z = 0.0f; *dest = anglesBinAng; diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 8a6b9d73a..e1e12bbf1 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -825,9 +825,9 @@ void Distortion_Update(void) { screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep); View_SetDistortionOrientation(&sDistortionRequest.play->view, - Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor), - Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor), - Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor)); + Math_CosS(depthPhase) * (DEG_TO_RAD(rotX) * xyScaleFactor), + Math_SinS(depthPhase) * (DEG_TO_RAD(rotY) * xyScaleFactor), + Math_SinS(screenPlanePhase) * (DEG_TO_RAD(rotZ) * zScaleFactor)); View_SetDistortionScale(&sDistortionRequest.play->view, (Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f, (Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f, diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 6650f41a7..210d6c36f 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -577,7 +577,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) { diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); if (((px * actor->world.pos.x) + (pz * actor->world.pos.z) + d) > 0.0f) { reached = true; } @@ -1023,13 +1023,13 @@ s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f3 f32 step; f32 prevRotStep; - step = (f32)(target - *rot) * (360.0f / (f32)0x10000); + step = BINANG_TO_DEG(target - *rot); step *= gFramerateDivisorHalf; prevRotStep = step; if (step >= 0.0f) { step /= slowness; step = CLAMP(step, stepMin, stepMax); - *rot += (s16)((step * (f32)0x10000) / 360.0f); + *rot += DEG_TO_BINANG_ALT2(step); if (prevRotStep < stepMin) { *rot = target; } @@ -1039,7 +1039,7 @@ s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f3 } else { step = (step / slowness) * -1.0f; step = CLAMP(step, stepMin, stepMax); - *rot -= (s16)((step * (f32)0x10000) / 360.0f); + *rot -= DEG_TO_BINANG_ALT2(step); if (-stepMin < prevRotStep) { *rot = target; } diff --git a/src/libultra/gu/position.c b/src/libultra/gu/position.c index 95bd65fe3..4af6dadc4 100644 --- a/src/libultra/gu/position.c +++ b/src/libultra/gu/position.c @@ -5,7 +5,7 @@ * Creates a rotation/parallel translation modelling matrix (floating point) */ void guPositionF(f32 mf[4][4], f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z) { - static f32 D_80134D00 = M_PI / 180.0; + static f32 D_80134D00 = M_PI / 180.0f; f32 sinr, sinp, sinh; f32 cosr, cosp, cosh; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 63c61e82f..1ffba6755 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -408,7 +408,7 @@ void func_80A2A444(BgDblueMovebg* this, PlayState* play) { sp20 = Math_StepToS(&this->unk_18A, 900, this->unk_188); temp_v0 = this->unk_18A * this->unk_17E; this->dyna.actor.shape.rot.y = - (s32)((this->unk_18C + temp_v0) * 0.1f * (0x10000 / 360.0f)) + this->dyna.actor.home.rot.y; + (s32)DEG_TO_BINANG_ALT3((this->unk_18C + temp_v0) * 0.1f) + this->dyna.actor.home.rot.y; if ((player->stateFlags2 & PLAYER_STATE2_10) && (this->unk_184 > 0.0f)) { player->actor.world.pos.x = @@ -495,8 +495,7 @@ void func_80A2A7F8(BgDblueMovebg* this, PlayState* play) { sp28 = Math_StepToS(&this->unk_18A, 900, this->unk_188); sp26 = this->unk_18A * this->unk_17E; - this->dyna.actor.shape.rot.y = - (s32)((this->unk_18C + sp26) * 0.1f * (0x10000 / 360.0f)) + this->dyna.actor.home.rot.y; + this->dyna.actor.shape.rot.y = (s32)DEG_TO_BINANG_ALT3((this->unk_18C + sp26) * 0.1f) + this->dyna.actor.home.rot.y; if ((player->stateFlags2 & PLAYER_STATE2_10) && (this->unk_184 > 0.0f)) { player->actor.world.pos.x = diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 4e15e8f7a..be76f63b2 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -2440,7 +2440,7 @@ void Boss03_DrawEffects(PlayState* play) { Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); if (eff->type == GYORG_EFFECT_DROPLET) { - Matrix_RotateYF(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD(Camera_GetInputDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); } else { // GYORG_EFFECT_SPLASH Matrix_ReplaceRotation(&play->billboardMtxF); } diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index f499b7e20..629f49398 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -572,7 +572,7 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) { } Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -644,7 +644,7 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) { Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 442ed1831..87f39a510 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -179,7 +179,7 @@ s32 func_80BECD10(EnAkindonuts* this, Path* path, s32 arg2) { phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { sp50 = true; } diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 3b2895983..2878d1fc6 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -1835,7 +1835,7 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) { } else { Matrix_Push(); Matrix_Translate(0.0f, 2000.0f, -2000.0f, MTXMODE_APPLY); - Matrix_RotateZS(D_80A993D0[this->unk_384].z * (0x10000 / 360.0f), MTXMODE_APPLY); + Matrix_RotateZS(DEG_TO_BINANG(D_80A993D0[this->unk_384].z), MTXMODE_APPLY); Matrix_Scale(D_80A993AC[this->unk_384].x, D_80A993AC[this->unk_384].y, 0.0f, MTXMODE_APPLY); if (this->unk_374 & 0x800) { gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_PrimColor(play->state.gfxCtx, 0x80, 255, 255, 255, 255)); @@ -1846,7 +1846,7 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) { gSPDisplayList(POLY_XLU_DISP++, gBeaverYoungerBrotherTailVortexDL); Matrix_Pop(); Matrix_Translate(0.0f, 2000.0f, -2100.0f, MTXMODE_APPLY); - Matrix_RotateZS(D_80A993D0[this->unk_384].z * (0x10000 / 360.0f), MTXMODE_APPLY); + Matrix_RotateZS(DEG_TO_BINANG(D_80A993D0[this->unk_384].z), MTXMODE_APPLY); Matrix_Scale(D_80A993D0[this->unk_384].x, D_80A993D0[this->unk_384].y, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBeaverYoungerBrotherTailSplashDL); diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index cccddedfd..c8c8b8ed3 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -269,7 +269,7 @@ void EnBombal_DrawEffects(EnBombal* this, PlayState* play) { gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleModelDL); diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index f08c3d413..1c0c2cfc4 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -410,9 +410,9 @@ void EnBubble_Draw(Actor* thisx, PlayState* play) { Math_SmoothStepToF(&this->modelEllipticity, 0.08f, 0.2f, 1000.0f, 0.0f); Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->modelWidth + 1.0f, this->modelHeight + 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF((f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD((f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY); Matrix_Scale(this->modelEllipticity + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(-(f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(-(f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBubbleDL); diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index 3545ec951..a173834c7 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -281,7 +281,7 @@ s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) { diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; } - func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; @@ -310,7 +310,7 @@ s16 EnDg_GetYRotation(Path* path, s32 index, Vec3f* pos, f32* distSq) { *distSq = SQ(diffX) + SQ(diffZ); - return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); + return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); } /** diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index e3f5eaea8..8172ded90 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -767,8 +767,8 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) { * rotToNorm.x = func_80086B30(nz, ny) * 0x8000 / M_PI; * rotToNorm.z = func_80086B30(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI; */ - rotToNorm.x = -func_80086B30(-nz * ny, 1.0f) * 0x8000 / M_PI; - rotToNorm.z = func_80086B30(-nx * ny, 1.0f) * 0x8000 / M_PI; + rotToNorm.x = RAD_TO_BINANG_ALT2(-func_80086B30(-nz * ny, 1.0f)); + rotToNorm.z = RAD_TO_BINANG_ALT2(func_80086B30(-nx * ny, 1.0f)); if ((this->actor.world.pos.y - 50.0f) <= player->actor.world.pos.y) { EnEgol_SpawnEffect(this, &hitPos, &rotToNorm, 100, 0.02f, EYEGORE_EFFECT_IMPACT); diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 33a819b20..7450e3427 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -284,7 +284,7 @@ void EnEncount2_DrawEffects(EnEncount2* this, PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(play->state.frames * 20.0f), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL); } diff --git a/src/overlays/actors/ovl_En_Estone/z_en_estone.c b/src/overlays/actors/ovl_En_Estone/z_en_estone.c index 8eff94e4b..4081bd8e7 100644 --- a/src/overlays/actors/ovl_En_Estone/z_en_estone.c +++ b/src/overlays/actors/ovl_En_Estone/z_en_estone.c @@ -195,9 +195,9 @@ void EnEstone_Draw(Actor* thisx, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateXFApply(this->rot.x * (M_PI / 180.0f)); - Matrix_RotateYF(this->rot.y * (M_PI / 180.0f), MTXMODE_APPLY); - Matrix_RotateZF(this->rot.z * (M_PI / 180.0f), MTXMODE_APPLY); + Matrix_RotateXFApply(DEG_TO_RAD(this->rot.x)); + Matrix_RotateYF(DEG_TO_RAD(this->rot.y), MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(this->rot.z), MTXMODE_APPLY); Matrix_Scale(this->scale, this->scale, this->scale, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 36ac5c2f8..af0456d57 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -1325,9 +1325,9 @@ void EnFishing_DrawEffects(FishingEffect* effect, PlayState* play) { effect = firstEffect; if (effect->type == FS_EFF_OWNER_HAT) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_RotateYF((sEffOwnerHatRot.y * M_PI) / 32768, MTXMODE_APPLY); - Matrix_RotateXFApply((sEffOwnerHatRot.x * M_PI) / 32768); - Matrix_RotateZF((sEffOwnerHatRot.z * M_PI) / 32768, MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.y), MTXMODE_APPLY); + Matrix_RotateXFApply(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.x)); + Matrix_RotateZF(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.z), MTXMODE_APPLY); Matrix_Scale(effect->unk_30, effect->unk_30, effect->unk_30, MTXMODE_APPLY); Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXFApply(M_PI / 2); @@ -1659,7 +1659,7 @@ void EnFishing_UpdateSinkingLure(PlayState* play) { } if (D_8090CD14 == 5) { - Matrix_RotateYF(player->actor.shape.rot.y * (M_PI / 32768), MTXMODE_NEW); + Matrix_RotateYF(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW); sp94.x = 5.0f; sp94.y = 0.0f; sp94.z = 3.0f; @@ -1772,7 +1772,7 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) sLurePos = sFishingHookedFish->fishMouthPos; if ((D_8090CD14 == 5) && (D_80917206 == 2)) { - Matrix_RotateYF(player->actor.shape.rot.y * (M_PI / 32768), MTXMODE_NEW); + Matrix_RotateYF(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW); posSrc.x = 2.0f; posSrc.y = 0.0f; posSrc.z = 0.0f; @@ -2457,9 +2457,9 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { } Math_ApproachZeroF(&D_809101B4, 1.0f, 0.3f); - Math_ApproachS(&D_809101B8, (D_809101B0 * 32768.0f) / M_PI, 3, spDC); + Math_ApproachS(&D_809101B8, RAD_TO_BINANG_ALT2(D_809101B0), 3, spDC); - sLureRot.y = (D_809101B8 / 32768.0f) * M_PI; + sLureRot.y = BINANG_TO_RAD_ALT(D_809101B8); sp90.x = 0.0f; sp90.y = 0.0f; @@ -2715,7 +2715,7 @@ void func_809038A4(EnFishing* this, Input* input) { sp24 = SQ(sp34.x) + SQ(sp34.y) + SQ(sp34.z); if ((D_8090CD14 == 3) && (this->unk_19A == 0) && (D_8090CD0C == 0)) { - Matrix_RotateYF((-this->actor.shape.rot.y / 32768.0f) * M_PI, MTXMODE_NEW); + Matrix_RotateYF(BINANG_TO_RAD_ALT(-this->actor.shape.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&sp34, &sp28); if ((sp28.z > 0.0f) || (this->unk_1A4 < 40.0f)) { @@ -3600,8 +3600,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { for (spA2 = 0; spA2 < 100; spA2++) { - Matrix_RotateYF(randPlusMinusPoint5Scaled(2.3561945f) + - (((this->actor.yawTowardsPlayer + 0x8000) / 32768.0f) * M_PI), + Matrix_RotateYF(randPlusMinusPoint5Scaled(0.75f * M_PI) + + BINANG_TO_RAD_ALT(this->actor.yawTowardsPlayer + 0x8000), MTXMODE_NEW); Matrix_MultVec3f(&sp10C, &sp100); @@ -3805,7 +3805,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { sp10C.y = 10.0f; sp10C.z = 50.0f; } - Matrix_RotateYF((player->actor.shape.rot.y / 32768.0f) * M_PI, MTXMODE_NEW); + Matrix_RotateYF(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&sp10C, &sSubCamEye); sSubCamEye.x += player->actor.world.pos.x; @@ -4228,20 +4228,20 @@ void EnFishing_DrawFish(Actor* thisx, PlayState* play) { func_8012C28C(play->state.gfxCtx); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateYF(((this->unk_15A + this->actor.shape.rot.y) / 32768.0f) * M_PI, MTXMODE_APPLY); - Matrix_RotateXFApply(((this->unk_158 + this->actor.shape.rot.x) / 32768.0f) * M_PI); - Matrix_RotateZF(((this->unk_15C + this->actor.shape.rot.z) / 32768.0f) * M_PI, MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD_ALT(this->unk_15A + this->actor.shape.rot.y), MTXMODE_APPLY); + Matrix_RotateXFApply(BINANG_TO_RAD_ALT(this->unk_158 + this->actor.shape.rot.x)); + Matrix_RotateZF(BINANG_TO_RAD_ALT(this->unk_15C + this->actor.shape.rot.z), MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); if (this->unk_148 == 0) { - Matrix_RotateYF((this->unk_164 * (M_PI / 32768)) - (M_PI / 2), MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD(this->unk_164) - (M_PI / 2), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, this->unk_164 * 10.0f * 0.01f, MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFishing_FishOverrideLimbDraw, EnFishing_FishPostLimbDraw, &this->actor); } else { Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY); - Matrix_RotateYF(this->unk_164 * (M_PI / 32768), MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD(this->unk_164), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -3000.0f, MTXMODE_APPLY); Matrix_RotateYF(-(M_PI / 2), MTXMODE_APPLY); @@ -4411,7 +4411,7 @@ void EnFishing_DrawPondProps(PlayState* play) { if (prop->shouldDraw) { Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, 1.0f, prop->scale, MTXMODE_APPLY); - Matrix_RotateYF(prop->lilyPadAngle * (M_PI / 32768), MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD(prop->lilyPadAngle), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 20.0f, MTXMODE_APPLY); Matrix_RotateYF(prop->rotY, MTXMODE_APPLY); @@ -4663,8 +4663,8 @@ void EnFishing_DrawGroupFishes(PlayState* play) { if (fish->shouldDraw) { Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW); - Matrix_RotateYF(((f32)fish->unk_3E * M_PI) / 32768.0f, MTXMODE_APPLY); - Matrix_RotateXFApply((-(f32)fish->unk_3C * M_PI) / 32768.0f); + Matrix_RotateYF(BINANG_TO_RAD_ALT2(fish->unk_3E), MTXMODE_APPLY); + Matrix_RotateXFApply(BINANG_TO_RAD_ALT2(-(f32)fish->unk_3C)); Matrix_Scale(fish->unk_2C * scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index d30dd6bd8..2ae04a6ec 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -310,7 +310,7 @@ s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_) { phi_f14 = points[arg2 + 1].z - points[arg2 - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index c1375d650..45dd9f749 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -374,7 +374,7 @@ s32 func_80B50C78(EnGk* this, Path* path, s32 arg2_) { phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index e427dedc3..b01427406 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -349,8 +349,8 @@ f32 func_80998334(EnGs* this, PlayState* play, f32* arg2, f32* arg3, s16* arg4, if (arg9 == 0) { sp2C = Math_SmoothStepToF(arg2, *arg3, arg5, arg6, arg7); - this->unk_1B0[0].x = (sinf(DEGF_TO_RADF((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2) + 1.0f; - this->unk_1B0[0].y = 1.0f - (sinf(DEGF_TO_RADF((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2); + this->unk_1B0[0].x = (sinf(DEG_TO_RAD((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2) + 1.0f; + this->unk_1B0[0].y = 1.0f - (sinf(DEG_TO_RAD((*arg4 % arg8) * (1.0f / arg8) * 360.0f)) * *arg2); (*arg4)++; } return sp2C; @@ -648,7 +648,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { if (this->unk_19D == 1) { Math_SmoothStepToF(&this->unk_1E4, this->unk_1E8, 1.0f, 0.1f, 0.001f); sp48 = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 1.0f, this->unk_1E4, 0.001f); - this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f)); + this->unk_19E[0].y += (s32)DEG_TO_BINANG_ALT3(this->unk_1DC); if (sp48 == 0.0f) { this->unk_1D4 = 0; this->unk_19D = 2; @@ -656,7 +656,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { } if (this->unk_19D == 2) { - this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f)); + this->unk_19E[0].y += (s32)DEG_TO_BINANG_ALT3(this->unk_1DC); if (this->unk_1D4++ > 40) { this->unk_1DC = this->unk_1B0[0].y - 1.0f; this->unk_1E0 = 1.5f; @@ -725,8 +725,8 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { sp40 = Math_SmoothStepToF(&this->unk_1EC, this->unk_1F0, 0.8f, 0.02f, 0.001f); this->unk_1B0[0].x = this->unk_1E4 + 1.0f; this->unk_1B0[0].y = this->unk_1DC + 1.0f; - this->unk_1B0[0].x += sinf(DEGF_TO_RADF((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC; - this->unk_1B0[0].y += sinf(DEGF_TO_RADF((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC; + this->unk_1B0[0].x += sinf(DEG_TO_RAD((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC; + this->unk_1B0[0].y += sinf(DEG_TO_RAD((this->unk_1D4 % 10) * 0.1f * 360.0f)) * this->unk_1EC; this->unk_1D4++; if ((sp48 == 0.0f) && (sp44 == 0.0f) && (sp40 == 0.0f)) { this->unk_216 = 0; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index c8202a9e2..4ef7ee42a 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -215,7 +215,7 @@ s16 EnJg_GetWalkingYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ *distSQ = SQ(diffX) + SQ(diffZ); - return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); + return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); } s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) { @@ -242,7 +242,7 @@ s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) { diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; } - func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 1c29c90c6..95bd2d474 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -1005,7 +1005,7 @@ void func_80B2F37C(Actor* thisx, PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 170, 255, this->unk_197); gDPSetEnvColor(POLY_XLU_DISP++, this->unk_194, this->unk_195, this->unk_196, 255); - Matrix_RotateYF((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_po_DL_003850); diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index c2e4b4afd..c97a0362a 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -288,7 +288,7 @@ s16 EnRacedog_GetYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ) } *distSQ = SQ(diffX) + SQ(diffZ); - return RADF_TO_BINANG(Math_Atan2F_XY(diffZRand, diffXRand)); + return RAD_TO_BINANG(Math_Atan2F_XY(diffZRand, diffXRand)); } void EnRacedog_GetFloorRot(EnRacedog* this, Vec3f* floorRot) { diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index 8c6871965..39a240e01 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -331,7 +331,7 @@ void EnRat_ChooseDirection(EnRat* this) { } angle = CLAMP(angle, -0x800, 0x800); - Matrix_RotateAxisF(angle * (M_PI / 0x8000), &this->axisUp, MTXMODE_NEW); + Matrix_RotateAxisF(BINANG_TO_RAD(angle), &this->axisUp, MTXMODE_NEW); Matrix_MultVec3f(&this->axisForwards, &newAxisForwards); Math_Vec3f_Copy(&this->axisForwards, &newAxisForwards); Math3D_CrossProduct(&this->axisUp, &this->axisForwards, &this->axisLeft); diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 19d6611d6..eaf54000f 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -163,7 +163,7 @@ s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIn } } - func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } @@ -198,7 +198,7 @@ s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 } } - func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); + func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index da4614d24..b6bd75d83 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -192,7 +192,7 @@ s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) { phi_fa1 = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x); if (((this->actor.world.pos.x * sp3C.z) + (sp3C.y * this->actor.world.pos.z) + sp3C.x) > 0.0f) { ret = true; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 52ba17d22..c7ccaec9a 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -654,7 +654,7 @@ s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_) { phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { sp50 = true; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 174dace1d..c02120532 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -916,7 +916,7 @@ s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2) { pointY = points[var + 1].z - points[var - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(pointX, pointY)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(pointX, pointY)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; } diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index e1ebc505c..a716545bd 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -1286,7 +1286,7 @@ s16 EnSob1_GetDistSqAndOrient(Path* path, s32 pointIndex, Vec3f* pos, f32* distS diffZ = 0.0f; } *distSq = SQ(diffX) + SQ(diffZ); - return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); + return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); } void EnSob1_GetCutscenes(EnSob1* this) { diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 06831bbb1..71eade542 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -419,7 +419,7 @@ void EnSsh_Sway(EnSsh* this) { } temp_f20 = (this->swayTimer * (1.0f / 6)); - swayAngle = Math_SinS(this->swayAngle) * (temp_f20 * (0x10000 / 360.0f)); + swayAngle = (f32)DEG_TO_BINANG_ALT3(temp_f20) * Math_SinS(this->swayAngle); temp_f20 = this->actor.world.pos.y - this->ceilingPos.y; swayVecBase.x = Math_SinS(swayAngle) * temp_f20; @@ -428,7 +428,7 @@ void EnSsh_Sway(EnSsh* this) { Matrix_Push(); Matrix_Translate(this->ceilingPos.x, this->ceilingPos.y, this->ceilingPos.z, MTXMODE_NEW); - Matrix_RotateYF(this->actor.world.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_APPLY); Matrix_MultVec3f(&swayVecBase, &swayVec); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index dc68a07c7..ad40c241c 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -563,7 +563,7 @@ s16 EnSuttari_GetDistSqAndOrient(Path* path, s32 index, Vec3f* pos, f32* distSq) } *distSq = SQ(diffX) + SQ(diffZ); - return RADF_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); + return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); } s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) { @@ -589,7 +589,7 @@ s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) { sp54 = sp5C[index + 1].x - sp5C[index - 1].x; sp48 = sp5C[index + 1].z - sp5C[index - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; } @@ -619,7 +619,7 @@ s32 func_80BAB8F4(EnSuttari* this, Path* path, s32 arg2) { sp54 = sp5C[index - 1].x - sp5C[index + 1].x; sp48 = sp5C[index - 1].z - sp5C[index + 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; } diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index 7e76bbfcc..cdf1c6483 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -592,7 +592,7 @@ s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2) { phi_f14 = points[arg + 1].z - points[arg - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { ret = true; @@ -615,7 +615,7 @@ s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3) { phi_f12 = 0.0f; } *arg3 = SQ(phi_f14) + SQ(phi_f12); - return RADF_TO_BINANG(Math_Atan2F_XY(phi_f12, phi_f14)); + return RAD_TO_BINANG(Math_Atan2F_XY(phi_f12, phi_f14)); } f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index bd36be072..9928146b1 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -301,7 +301,7 @@ s32 func_80B76600(EnTruMt* this, Path* path, s32 arg2) { phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z; } - func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&sp30, RAD_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { sp50 = true; } diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index 99fa30977..3f15ff8c8 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -208,10 +208,9 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { // why are we getting player home rotation from the room data? doesnt player have home.rot.y? // especially because we are converting from deg to binang, but isnt home.rot.y already in binang?? - Play_SetRespawnData( - &play->state, 0, entrance, play->setupEntranceList[playerSpawnIndex].room, playerParams, - &newRespawnPos, - ((((playerActorEntry->rot.y >> 7) & 0x1FF) / 180.0f) * 32768.0f)); // DEG_TO_BINANG ? + Play_SetRespawnData(&play->state, 0, entrance, play->setupEntranceList[playerSpawnIndex].room, + playerParams, &newRespawnPos, + DEG_TO_BINANG_ALT((playerActorEntry->rot.y >> 7) & 0x1FF)); func_80169EFC(&play->state); gSaveContext.respawnFlag = -5; diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index dd9f84ae0..d05c68571 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -119,7 +119,7 @@ u32 func_80BB9A1C(ObjChan* this, f32 arg1) { sp20 = Math_SinS(this->unk1D4) * this->unk1D0; temp_f6 = (Math_CosS(this->unk1D4) * 0.03834952f * this->unk1D0) + arg1; if (temp_f6 != 0.0f) { - this->unk1D4 = RADF_TO_BINANG(func_80086B30(sp20 * 0.03834952f, temp_f6)); + this->unk1D4 = RAD_TO_BINANG(func_80086B30(sp20 * 0.03834952f, temp_f6)); } else if (sp20 >= 0.0f) { this->unk1D4 = 0x4000; } else { @@ -175,7 +175,7 @@ void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { for (i = 0; i < 5; i++) { ObjChan_CalculatePotPosition(&childPos, &childRot, &this->actor.world.pos, &this->actor.shape.rot, - (s32)(i * 360.0f / 5.0f * (65536.0f / 360.0f)) + this->rotation); + (s32)DEG_TO_BINANG_ALT3(i * 360.0f / 5.0f) + this->rotation); temp_v0 = (ObjChan*)Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_OBJ_CHAN, childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, childRot.z, (this->actor.params & 0xFFF) | 0x1000, this->actor.cutscene, @@ -251,7 +251,7 @@ void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) { temp = this->pots[i]; if (temp != NULL) { ObjChan_CalculatePotPosition(&sp60, &sp58, &this->actor.world.pos, &this->actor.shape.rot, - (s32)(i * 360.0f / 5.0f * (65536.0f / 360.0f)) + this->rotation); + (s32)DEG_TO_BINANG_ALT3(i * 360.0f / 5.0f) + this->rotation); Math_Vec3f_Copy(&temp->actor.world.pos, &sp60); Math_Vec3s_Copy(&temp->actor.shape.rot, &this->actor.shape.rot); temp->actor.shape.rot.y = this->rotation; diff --git a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c index bdff9b3bc..836a70ba9 100644 --- a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c +++ b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c @@ -288,7 +288,7 @@ void ObjDora_UpdateCollision(ObjDora* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); itemDrop = Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE); itemDrop->world.rot.y = this->actor.world.rot.y; - itemDrop->world.rot.y += (s32)(Rand_Centered() * 90.0f * (0x10000 / 360.0f)); + itemDrop->world.rot.y += (s32)DEG_TO_BINANG_ALT3(Rand_Centered() * 90.0f); itemDrop->velocity.y = 5.0f; itemDrop->gravity = -1.0f; this->rupeeDropTimer = 40; diff --git a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c index ae047f029..b7b1bf92e 100644 --- a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c +++ b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c @@ -89,14 +89,14 @@ void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) { } if (this->framesAppeared <= 10) { if (this->framesAppeared == 0) { + s32 pad; s32 i; - f32 angleDeg; s16 numDirections = 4; Vec3f iceSmokePosOffset; Vec3f iceSmokeVelOffset; - s16 offsetAngle; + s16 iceSmokeAngle; Vec3f iceSmokeVel; - f32 angleBrad; + f32 baseAngle; Vec3f iceSmokePos; iceSmokePosOffset.x = 1.0f; @@ -107,14 +107,13 @@ void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) { iceSmokeVelOffset.y = 0.5f; iceSmokeVelOffset.z = 0.0f; - angleDeg = (360.0f / numDirections); - angleBrad = (s32)(angleDeg * (0x10000 / 360.0f)); + baseAngle = (s32)DEG_TO_BINANG_ALT3(360.0f / numDirections); for (i = 0; i < numDirections; i++) { - offsetAngle = i * angleBrad; - Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.world.pos, offsetAngle, &iceSmokePosOffset, + iceSmokeAngle = i * baseAngle; + Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.world.pos, iceSmokeAngle, &iceSmokePosOffset, &iceSmokePos); - Lib_Vec3f_TranslateAndRotateY(&gZeroVec3f, offsetAngle, &iceSmokeVelOffset, &iceSmokeVel); + Lib_Vec3f_TranslateAndRotateY(&gZeroVec3f, iceSmokeAngle, &iceSmokeVelOffset, &iceSmokeVel); EffectSsIceSmoke_Spawn(play, &iceSmokePos, &iceSmokeVel, &sIceSmokeAccel, 100); } } @@ -123,7 +122,7 @@ void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) { Math_SmoothStepToF(&this->dyna.actor.scale.x, 18.0f * 0.01f, 1.0f, 0.01f, 0.001f); Actor_SetScale(&this->dyna.actor, this->dyna.actor.scale.x); } - if (this->dyna.actor.scale.x == 18.0f * 0.01f) { + if (this->dyna.actor.scale.x == (18.0f * 0.01f)) { this->isHidden = false; func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); ObjHsStump_SetupIdle(this, play); diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index 905002784..b7eef869d 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -179,11 +179,11 @@ void ObjWarpstone_Draw(Actor* thisx, PlayState* play2) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, this->dyna.actor.home.rot.x); gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255); - Matrix_RotateZF((((play->gameplayFrames * 1500) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY); + Matrix_RotateZF(BINANG_TO_RAD_ALT2((play->gameplayFrames * 1500) & 0xFFFF), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); - Matrix_RotateZF((~((play->gameplayFrames * 1200) & 0xFFFF) * M_PI) / 0x8000, MTXMODE_APPLY); + Matrix_RotateZF(BINANG_TO_RAD_ALT2(~((play->gameplayFrames * 1200) & 0xFFFF)), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index de464ae8d..1742b03fd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -107,7 +107,7 @@ void EffectSsFireTail_Draw(PlayState* play, u32 index, EffectSs* this) { temp2 = Math_SinS(yawDiff); dist = Math_Vec3f_DistXZ(&scale, &this->vec) / (this->rReg10 * 0.1f); Matrix_RotateYS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(temp2 * this->rReg2 * dist), MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(temp2 * this->rReg2 * dist), MTXMODE_APPLY); temp2 = 1.0f - ((f32)(this->life + 1) / this->rLifespan); temp2 = 1.0f - SQ(temp2); scale.x = scale.y = scale.z = temp2 * (this->rScale * (0.001f * 0.01f)); diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index d6d6d1cbc..cd0ea0fad 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -60,7 +60,7 @@ void EffectSsSolderSrchBall_Draw(PlayState* play, u32 index, EffectSs* this) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, 255); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - Matrix_RotateZF(DEGF_TO_RADF(20.0f * play->state.frames), MTXMODE_APPLY); + Matrix_RotateZF(DEG_TO_RAD(20.0f * play->state.frames), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL); diff --git a/tools/namefixer.py b/tools/namefixer.py index 853322f5c..1c38d8359 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -874,6 +874,10 @@ wordReplace = { "ICHAIN_F32_DIV1000(minVelocityY,": "ICHAIN_F32_DIV1000(terminalVelocity,", "ICHAIN_F32(minVelocityY,": "ICHAIN_F32(terminalVelocity,", + "RADF_TO_BINANG": "RAD_TO_BINANG", + "RADF_TO_DEGF": "RAD_TO_DEG", + "DEGF_TO_RADF": "DEG_TO_RAD", + "ACTORCTX_FLAG_2": "ACTORCTX_FLAG_PICTO_BOX_ON", "ACTOR_FLAG_100": "ACTOR_FLAG_TALK_REQUESTED", From 4647ebb91b9646d92d85929814815e48fa6e44ac Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Tue, 18 Apr 2023 17:50:34 -0400 Subject: [PATCH 21/29] `stackcheck.h` (#1204) * stackcheck.h * warning * Update src/boot_O2/stackcheck.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/boot_O2/stackcheck.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/boot_O2/stackcheck.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * stack * format * bss * review * review --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- include/functions.h | 5 ---- include/stackcheck.h | 26 +++++++++++++++++ include/variables.h | 4 +-- include/z64.h | 16 ----------- src/boot_O2/stackcheck.c | 57 ++++++++++++++++++++------------------ src/boot_O2_g3/boot_main.c | 12 ++++---- src/boot_O2_g3/fault.c | 1 + src/boot_O2_g3/idle.c | 2 +- src/boot_O2_g3/irqmgr.c | 1 + src/boot_O2_g3/z_std_dma.c | 1 + src/code/PreRender.c | 1 + src/code/main.c | 1 + src/code/sched.c | 1 + src/code/sys_flashrom.c | 7 +++-- src/code/sys_slowly.c | 1 + tools/disasm/variables.txt | 6 ++-- 16 files changed, 79 insertions(+), 63 deletions(-) create mode 100644 include/stackcheck.h diff --git a/include/functions.h b/include/functions.h index b9b3b682b..5d7c5364f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -122,11 +122,6 @@ s8 PadUtils_GetRelYImpl(Input* input); s8 PadUtils_GetRelX(Input* input); s8 PadUtils_GetRelY(Input* input); void PadUtils_UpdateRelXY(Input* input); -void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, const char* name); -void StackCheck_Cleanup(StackEntry* entry); -StackStatus StackCheck_GetState(StackEntry* entry); -u32 StackCheck_CheckAll(void); -u32 StackCheck_Check(StackEntry* entry); void MtxConv_F2L(Mtx* mtx, MtxF* mf); void MtxConv_L2F(MtxF* mtx, Mtx* mf); diff --git a/include/stackcheck.h b/include/stackcheck.h new file mode 100644 index 000000000..aeb55df28 --- /dev/null +++ b/include/stackcheck.h @@ -0,0 +1,26 @@ +#ifndef STACKCHECK_H +#define STACKCHECK_H + +#include "ultra64.h" + +typedef enum StackStatus { + /* 0 */ STACK_STATUS_OK, + /* 1 */ STACK_STATUS_WARNING, + /* 2 */ STACK_STATUS_OVERFLOW +} StackStatus; + +typedef struct StackEntry { + /* 0x00 */ struct StackEntry* next; + /* 0x04 */ struct StackEntry* prev; + /* 0x08 */ void* head; + /* 0x0C */ void* tail; + /* 0x10 */ u32 initValue; + /* 0x14 */ s32 minSpace; + /* 0x18 */ const char* name; +} StackEntry; // size = 0x1C + +void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 initValue, s32 minSpace, const char* name); +void StackCheck_Cleanup(StackEntry* entry); +u32 StackCheck_Check(StackEntry* entry); + +#endif diff --git a/include/variables.h b/include/variables.h index 4ef96eab2..b90fadcc6 100644 --- a/include/variables.h +++ b/include/variables.h @@ -37,8 +37,7 @@ extern FaultDrawer* sFaultDrawContext; extern FaultDrawer sFaultDrawerDefault; extern s32 gLoadLogSeverity; extern s32 gLoad2LogSeverity; -extern StackEntry* sStackInfoListStart; -extern StackEntry* sStackInfoListEnd; + // extern UNK_TYPE1 sGfxPrintFontTLUT; // extern UNK_TYPE1 sGfxPrintRainbowTLUT; // extern UNK_TYPE1 sGfxPrintRainbowData; @@ -2451,6 +2450,7 @@ extern OSTime sGraphTaskStartTime; extern u32 gSegments[NUM_SEGMENTS]; extern SchedContext gSchedContext; + extern OSThread gGraphThread; extern PadMgr gPadMgr; diff --git a/include/z64.h b/include/z64.h index 331077723..f7c4ad29b 100644 --- a/include/z64.h +++ b/include/z64.h @@ -576,22 +576,6 @@ typedef struct { /* 0x47F */ UNK_TYPE1 pad47F[0x1]; } PadMgr; // size = 0x480 -typedef struct StackEntry { - /* 0x00 */ struct StackEntry* next; - /* 0x04 */ struct StackEntry* prev; - /* 0x08 */ u32 head; - /* 0x0C */ u32 tail; - /* 0x10 */ u32 initValue; - /* 0x14 */ s32 minSpace; - /* 0x18 */ const char* name; -} StackEntry; // size = 0x1C - -typedef enum { - STACK_STATUS_OK = 0, - STACK_STATUS_WARNING = 1, - STACK_STATUS_OVERFLOW = 2 -} StackStatus; - #define OS_SC_RETRACE_MSG 1 #define OS_SC_DONE_MSG 2 #define OS_SC_NMI_MSG 3 // name is made up, 3 is OS_SC_RDP_DONE_MSG in the original sched.c diff --git a/src/boot_O2/stackcheck.c b/src/boot_O2/stackcheck.c index 20e56f480..edd1e3a30 100644 --- a/src/boot_O2/stackcheck.c +++ b/src/boot_O2/stackcheck.c @@ -1,18 +1,19 @@ -#include "global.h" +#include "stackcheck.h" +#include "libc/stdbool.h" +#include "libc/stdint.h" StackEntry* sStackInfoListStart = NULL; StackEntry* sStackInfoListEnd = NULL; -void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, +void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 initValue, s32 minSpace, const char* name) { - StackEntry* iter; - u32* addr; - - if (!entry) { + if (entry == NULL) { sStackInfoListStart = NULL; } else { - entry->head = (u32)stackTop; - entry->tail = (u32)stackBottom; + StackEntry* iter; + + entry->head = stackBottom; + entry->tail = stackTop; entry->initValue = initValue; entry->minSpace = minSpace; entry->name = name; @@ -32,13 +33,14 @@ void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 i } sStackInfoListEnd = entry; - if (!sStackInfoListStart) { + if (sStackInfoListStart == NULL) { sStackInfoListStart = entry; } if (entry->minSpace != -1) { - addr = (u32*)entry->head; - while ((u32)addr < entry->tail) { + u32* addr = entry->head; + + while (addr < (u32*)entry->tail) { *addr++ = entry->initValue; } } @@ -46,13 +48,13 @@ void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 i } void StackCheck_Cleanup(StackEntry* entry) { - u32 inconsistency = 0; // unused variable needed to match + u32 inconsistency = false; - if (!entry->prev) { + if (entry->prev == NULL) { if (entry == sStackInfoListStart) { sStackInfoListStart = entry->next; } else { - inconsistency = 1; + inconsistency = true; } } else { entry->prev->next = entry->next; @@ -62,7 +64,7 @@ void StackCheck_Cleanup(StackEntry* entry) { if (entry == sStackInfoListEnd) { sStackInfoListEnd = entry->prev; } else { - inconsistency = 1; + inconsistency = true; } } @@ -71,22 +73,22 @@ void StackCheck_Cleanup(StackEntry* entry) { StackStatus StackCheck_GetState(StackEntry* entry) { u32* last; - u32 used; - u32 free; - s32 status; + size_t used; + size_t free; + StackStatus status; - for (last = (u32*)entry->head; (u32)last < entry->tail; last++) { + for (last = entry->head; last < (u32*)entry->tail; last++) { if (entry->initValue != *last) { break; } } - used = entry->tail - (u32)last; - free = (u32)last - entry->head; + used = (uintptr_t)entry->tail - (uintptr_t)last; + free = (uintptr_t)last - (uintptr_t)entry->head; if (free == 0) { status = STACK_STATUS_OVERFLOW; - } else if (free < (u32)entry->minSpace && entry->minSpace != -1) { + } else if ((free < (size_t)entry->minSpace) && (entry->minSpace != -1)) { status = STACK_STATUS_WARNING; } else { status = STACK_STATUS_OK; @@ -95,13 +97,14 @@ StackStatus StackCheck_GetState(StackEntry* entry) { return status; } -u32 StackCheck_CheckAll() { +u32 StackCheck_CheckAll(void) { u32 ret = 0; StackEntry* iter = sStackInfoListStart; - while (iter) { - u32 state = StackCheck_GetState(iter); - if (state) { + while (iter != NULL) { + StackStatus state = StackCheck_GetState(iter); + + if (state != STACK_STATUS_OK) { ret = 1; } iter = iter->next; @@ -111,7 +114,7 @@ u32 StackCheck_CheckAll() { } u32 StackCheck_Check(StackEntry* entry) { - if (!entry) { + if (entry == NULL) { return StackCheck_CheckAll(); } else { return StackCheck_GetState(entry); diff --git a/src/boot_O2_g3/boot_main.c b/src/boot_O2_g3/boot_main.c index 061458a1d..6a561992b 100644 --- a/src/boot_O2_g3/boot_main.c +++ b/src/boot_O2_g3/boot_main.c @@ -1,22 +1,22 @@ #include "prevent_bss_reordering.h" #include "global.h" #include "stack.h" +#include "stackcheck.h" StackEntry sBootStackInfo; OSThread sIdleThread; -STACK(sIdleThreadStack, 0x400); +STACK(sIdleStack, 0x400); StackEntry sIdleStackInfo; -STACK(sBootThreadStack, 0x400); +STACK(sBootStack, 0x400); void bootproc(void) { - StackCheck_Init(&sBootStackInfo, sBootThreadStack, STACK_TOP(sBootThreadStack), 0, -1, "boot"); + StackCheck_Init(&sBootStackInfo, sBootStack, STACK_TOP(sBootStack), 0, -1, "boot"); osMemSize = osGetMemSize(); func_800818F4(); osInitialize(); osUnmapTLBAll(); gCartHandle = osCartRomInit(); - StackCheck_Init(&sIdleStackInfo, sIdleThreadStack, STACK_TOP(sIdleThreadStack), 0, 0x100, "idle"); - osCreateThread(&sIdleThread, Z_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, STACK_TOP(sIdleThreadStack), - Z_PRIORITY_IDLE); + StackCheck_Init(&sIdleStackInfo, sIdleStack, STACK_TOP(sIdleStack), 0, 0x100, "idle"); + osCreateThread(&sIdleThread, Z_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, STACK_TOP(sIdleStack), Z_PRIORITY_IDLE); osStartThread(&sIdleThread); } diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c index 134b120dc..5e4f8e24a 100644 --- a/src/boot_O2_g3/fault.c +++ b/src/boot_O2_g3/fault.c @@ -2,6 +2,7 @@ #include "global.h" #include "stack.h" #include "vt.h" +#include "stackcheck.h" extern FaultThreadStruct* sFaultContext; extern f32 D_8009BE54; diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index 40bcf5d0e..2b8a88728 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -1,7 +1,7 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "stack.h" #include "buffers.h" +#include "stackcheck.h" u8 D_80096B20 = 1; vu8 gViConfigUseDefault = 1; diff --git a/src/boot_O2_g3/irqmgr.c b/src/boot_O2_g3/irqmgr.c index 152c69b89..424451a5b 100644 --- a/src/boot_O2_g3/irqmgr.c +++ b/src/boot_O2_g3/irqmgr.c @@ -1,4 +1,5 @@ #include "global.h" +#include "stackcheck.h" vs32 gIrqMgrResetStatus = 0; volatile OSTime sIrqMgrResetTime = 0; diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index dd34d9e87..00d894f74 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -1,6 +1,7 @@ #include "prevent_bss_reordering.h" #include "global.h" #include "stack.h" +#include "stackcheck.h" u32 sDmaMgrDmaBuffSize = 0x2000; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 075f941d4..172659cf7 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -1,6 +1,7 @@ #include "global.h" #include "slowly.h" #include "stack.h" +#include "stackcheck.h" /** * Assigns the "save" values in PreRender diff --git a/src/code/main.c b/src/code/main.c index c4a80f1ea..7fbb5ba39 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -7,6 +7,7 @@ #include "global.h" #include "buffers.h" #include "stack.h" +#include "stackcheck.h" extern OSMesgQueue sSiIntMsgQ; extern OSMesg sSiIntMsgBuf[1]; diff --git a/src/code/sched.c b/src/code/sched.c index 5f9cdf236..c2630677c 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "stackcheck.h" #define RSP_DONE_MSG 667 #define RDP_DONE_MSG 668 diff --git a/src/code/sys_flashrom.c b/src/code/sys_flashrom.c index e9ea6e21e..0db0b8744 100644 --- a/src/code/sys_flashrom.c +++ b/src/code/sys_flashrom.c @@ -1,5 +1,6 @@ #include "global.h" #include "stack.h" +#include "stackcheck.h" #include "system_malloc.h" // extern UNK_TYPE1 D_801FBE10; @@ -7,10 +8,10 @@ // extern UNK_TYPE1 D_801FBE2C; // extern UNK_TYPE4 D_801FBE30; extern STACK(sSysFlashromStack, 0x1000); -extern StackEntry sys_flashromStackEntry; -extern OSThread sys_flashromOSThread; +extern StackEntry sSysFlashromStackInfo; +extern OSThread sSysFlashromThread; extern s80185D40 D_801FD008; -extern OSMesg D_801FD034; +extern OSMesg D_801FD034[1]; #pragma GLOBAL_ASM("asm/non_matchings/code/sys_flashrom/func_801857C0.s") diff --git a/src/code/sys_slowly.c b/src/code/sys_slowly.c index 29ac0db78..754c5d472 100644 --- a/src/code/sys_slowly.c +++ b/src/code/sys_slowly.c @@ -10,6 +10,7 @@ */ #include "slowly.h" #include "global.h" +#include "stackcheck.h" void Slowly_Main(SlowlyMgr* slowly) { slowly->status |= SLOWLY_STATUS_STARTED; diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index dc5f57f8c..4dab18e3b 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -289,7 +289,7 @@ 0x80099520:("sIdleThread","OSThread","",0x1b0), 0x800996D0:("sIdleThreadStack","u8","[1024]",0x400), 0x80099AD0:("sIdleStackInfo","StackEntry","",0x1c), - 0x80099AF0:("sBootThreadStack","u8","[1024]",0x400), + 0x80099AF0:("sBootStack","u8","[1024]",0x400), 0x80099EF0:("gIrqMgr","IrqMgr","",0x280), 0x8009A170:("sIrqMgrStack","u8","[1280]",0x500), 0x8009A670:("sIrqMgrStackInfo","StackEntry","",0x1c), @@ -4216,8 +4216,8 @@ 0x801FBE2C:("D_801FBE2C","UNK_TYPE1","",0x1), 0x801FBE30:("D_801FBE30","UNK_TYPE4","",0x4), 0x801FBE38:("sSysFlashromStack","u8","[4096]",0x1000), - 0x801FCE38:("sys_flashromStackEntry","StackEntry","",0x1c), - 0x801FCE58:("sys_flashromOSThread","OSThread","",0x1b0), + 0x801FCE38:("sSysFlashromStackInfo","StackEntry","",0x1c), + 0x801FCE58:("sSysFlashromThread","OSThread","",0x1b0), 0x801FD008:("D_801FD008","s80185D40","",0x2c), 0x801FD034:("D_801FD034","OSMesg","",0x4), 0x801FD040:("D_801FD040","s32","",0x10), From 38d21bbe9753568ff3c708ec602d037aca6a0f27 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Tue, 18 Apr 2023 18:14:36 -0400 Subject: [PATCH 22/29] Name some `SurfaceType_` functions (#1155) * enums * renaming functions * fixes * SurfaceType_IsSoft * type fixing * format * Update src/code/z_bgcheck.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/code/z_bgcheck.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * review Co-authored-by: engineer124 * SurfaceType_GetFloorEffect Co-authored-by: Dragorn421 * format * bss * cleanups * extra material docs * cleanup * cleanups * Remove Bg prefix * minor fixes * Remove BG_ * SURFACE_MATERIAL_DIRT_SHALLOW * format * bss * bss * review Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * format * format again * bug * format * namefixer * bss * bss * bss * review --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: engineer124 Co-authored-by: Dragorn421 --- include/functions.h | 158 ---------- include/sfx.h | 2 + include/ultra64/thread.h | 20 +- include/z64bgcheck.h | 293 +++++++++++++++++- src/boot_O2_g3/fault.c | 4 +- src/boot_O2_g3/irqmgr.c | 2 +- src/boot_O2_g3/z_std_dma.c | 1 - src/code/sched.c | 1 - src/code/z_actor.c | 17 +- src/code/z_bgcheck.c | 199 +++++------- src/code/z_en_hy_code.c | 11 +- src/code/z_message.c | 2 +- src/code/z_play.c | 1 + src/code/z_quake.c | 16 +- src/libultra/io/pimgr.c | 2 +- .../ovl_Bg_Ikana_Block/z_bg_ikana_block.c | 4 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 4 +- .../actors/ovl_En_Bbfall/z_en_bbfall.c | 4 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 20 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- src/overlays/actors/ovl_En_Famos/z_en_famos.c | 4 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 6 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 11 +- src/overlays/actors/ovl_En_In/z_en_in.c | 8 +- src/overlays/actors/ovl_En_Kame/z_en_kame.c | 7 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 10 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 3 +- .../actors/ovl_En_Mushi2/z_en_mushi2.c | 5 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 5 +- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 3 +- src/overlays/actors/ovl_En_Ru/z_en_ru.c | 11 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 2 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 11 +- src/overlays/actors/ovl_En_Test/z_en_test.h | 2 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 9 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 11 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 9 +- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 11 +- src/overlays/actors/ovl_En_Zog/z_en_zog.c | 6 +- .../actors/ovl_Obj_Iceblock/z_obj_iceblock.c | 3 +- .../actors/ovl_Obj_Nozoki/z_obj_nozoki.c | 1 - .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 6 +- .../ovl_Obj_Skateblock/z_obj_skateblock.c | 3 +- .../ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c | 23 +- tools/disasm/functions.txt | 26 +- tools/disasm/variables.txt | 5 + tools/namefixer.py | 19 +- tools/sizes/code_functions.csv | 26 +- 52 files changed, 559 insertions(+), 458 deletions(-) diff --git a/include/functions.h b/include/functions.h index 5d7c5364f..ac6ad65dd 100644 --- a/include/functions.h +++ b/include/functions.h @@ -776,164 +776,6 @@ void* ActorOverlayTable_FaultAddrConv(void* address, void* param); void ActorOverlayTable_Init(void); void ActorOverlayTable_Cleanup(void); -void SSNode_SetValue(SSNode* node, s16* polyIndex, u16 next); -void SSList_SetNull(SSList* ssList); -void SSNodeList_SetSSListHead(SSNodeList* list, SSList* ssList, s16* polyIndex); -void DynaSSNodeList_SetSSListHead(DynaSSNodeList* list, SSList* ssList, s16* polyIndex); -void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list); -void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes); -void DynaSSNodeList_ResetCount(DynaSSNodeList* list); -u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* list); -void BgCheck_Vec3sToVec3f(Vec3s* src, Vec3f* dest); -void BgCheck_Vec3fToVec3s(Vec3s* dest, Vec3f* src); -f32 func_800BFD84(CollisionPoly *poly, f32 arg1, f32 arg2); -s32 func_800BFDEC(CollisionPoly* polyA, CollisionPoly* polyB, u32* outVtxId0, u32* outVtxId1); -s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vertices); -void CollisionPoly_GetNormalF(CollisionPoly* poly, f32* nx, f32* ny, f32* nz); -void func_800C0094(CollisionPoly* poly, f32 tx, f32 ty, f32 tz, MtxF* dest); -f32 CollisionPoly_GetPointDistanceFromPlane(CollisionPoly* poly, Vec3f* point); -void CollisionPoly_GetVerticesByBgId(CollisionPoly* poly, s32 bgId, CollisionContext* colCtx, Vec3f* dest); -s32 CollisionPoly_SphVsPoly(CollisionPoly* poly, Vec3s* vtxList, Vec3f* center, f32 radius); -void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, CollisionPoly* polyList, Vec3s* vtxList, s16 polyId); -void StaticLookup_AddPoly(StaticLookup* lookup, CollisionContext* colCtx, CollisionPoly* polyList, Vec3s* vtxList, s16 index); -void BgCheck_GetSubdivisionMinBounds(CollisionContext* colCtx, Vec3f* pos, s32* sx, s32* sy, s32* sz); -void BgCheck_GetSubdivisionMaxBounds(CollisionContext* colCtx, Vec3f* pos, s32* sx, s32* sy, s32* sz); -void BgCheck_GetPolySubdivisionBounds(CollisionContext* colCtx, Vec3s* vtxList, CollisionPoly* polyList, s32* subdivMinX, s32* subdivMinY, s32* subdivMinZ, s32* subdivMaxX, s32* subdivMaxY, s32* subdivMaxZ, s16 polyId); -s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* polyList, Vec3s* vtxList, s16 polyId); -u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLookup* lookupTbl); -s32 BgCheck_IsSmallMemScene(PlayState* play); -s32 BgCheck_TryGetCustomMemsize(s32 sceneId, u32* memSize); -void BgCheck_SetSubdivisionDimension(f32 min, s32 subdivAmount, f32* max, f32* subdivLength, f32* subdivLengthInv); -s32 BgCheck_GetSpecialSceneMaxObjects(PlayState* play, s32* maxNodes, s32* maxPolygons, s32* maxVertices); -void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader* colHeader); -void BgCheck_SetContextFlags(CollisionContext* colCtx, u32 flags); -void BgCheck_UnsetContextFlags(CollisionContext* colCtx, u32 flags); -CollisionHeader* BgCheck_GetCollisionHeader(CollisionContext* colCtx, s32 bgId); -f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 checkDist, s32 arg9); -f32 BgCheck_CameraRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor2_1(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor3(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor5(CollisionContext* colCtx, CollisionPoly** outPoly, s32* outBgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor5_2(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor5_3(PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor6(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos, f32 checkDist); -f32 BgCheck_EntityRaycastFloor7(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); -f32 BgCheck_AnyRaycastFloor1(CollisionContext* colCtx, CollisionPoly* outPoly, Vec3f* pos); -f32 BgCheck_AnyRaycastFloor2(CollisionContext* colCtx, CollisionPoly* outPoly, s32* bgId, Vec3f* pos); -f32 BgCheck_CameraRaycastFloor2(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor8(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); -f32 BgCheck_EntityRaycastFloor9(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); -s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor, f32 checkHeight, u8 argA); -s32 BgCheck_EntitySphVsWall1(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, f32 checkHeight); -s32 BgCheck_EntitySphVsWall2(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, f32 checkHeight); -s32 BgCheck_EntitySphVsWall3(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor, f32 checkHeight); -s32 BgCheck_EntitySphVsWall4(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor, f32 checkHeight); -s32 BgCheck_CheckCeilingImpl(CollisionContext* colCtx, u16 xpFlags, f32* outY, Vec3f* pos, f32 checkHeight, CollisionPoly** outPoly, s32* outBgId, Actor* actor); -s32 BgCheck_AnyCheckCeiling(CollisionContext* colCtx, f32* outY, Vec3f* pos, f32 checkHeight); -s32 BgCheck_EntityCheckCeiling(CollisionContext* colCtx, f32* outY, Vec3f* pos, f32 checkHeight, CollisionPoly** outPoly, s32* outBgId, Actor* actor); -s32 BgCheck_CameraLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); -s32 BgCheck_CameraLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); -s32 BgCheck_EntityLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); -s32 BgCheck_EntityLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId, Actor* actor); -s32 BgCheck_EntityLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId, Actor* actor, f32 checkDist); -s32 BgCheck_ProjectileLineTest(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); -s32 BgCheck_AnyLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkOneFace); -s32 BgCheck_AnyLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace); -s32 BgCheck_AnyLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); -s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* center, f32 radius, Actor* actor, u16 bciFlags); -s32 BgCheck_SphVsFirstPoly(CollisionContext* colCtx, Vec3f* center, f32 radius); -s32 BgCheck_SphVsFirstWall(CollisionContext* colCtx, Vec3f* center, f32 radius); -void SSNodeList_Init(SSNodeList* this); -void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys); -SSNode* SSNodeList_GetNextNode(SSNodeList* this); -u16 SSNodeList_GetNextNodeIdx(SSNodeList* this); -void ScaleRotPos_Init(ScaleRotPos* srp); -void ScaleRotPos_SetValue(ScaleRotPos* srp, Vec3f* scale, Vec3s* rot, Vec3f* pos); -s32 ScaleRotPos_IsEqual(ScaleRotPos* a, ScaleRotPos* b); -void DynaLookup_ResetLists(DynaLookup* dynaLookup); -void DynaLookup_Reset(DynaLookup* dynaLookup); -void DynaLookup_ResetVtxStartIndex(u16* vtxStartIndex); -void DynaLookup_ResetWaterBoxStartIndex(u16* waterBoxStartIndex); -void BgActor_Init(PlayState* play, BgActor* bgActor); -void BgActor_SetActor(BgActor* bgActor, Actor* actor, CollisionHeader* colHeader); -s32 BgActor_IsTransformUnchanged(BgActor* bgActor); -void DynaPoly_NullPolyList(CollisionPoly** polyList); -void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys); -void DynaPoly_NullVtxList(Vec3s** vtxList); -void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx); -void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList); -void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes); -void DynaPoly_SetBgActorPrevTransform(PlayState* play, BgActor* bgActor); -s32 DynaPoly_IsBgIdBgActor(s32 bgId); -void DynaPoly_Init(PlayState* play, DynaCollisionContext* dyna); -void DynaPoly_Alloc(PlayState* play, DynaCollisionContext* dyna); -s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); -DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId); -void func_800C62BC(PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C6314(PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C636C(PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C63C4(PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C641C(PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C6474(PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C6554(PlayState* play, DynaCollisionContext* dyna); -void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPos, Vec3s* minPosOut, s16* xLength, s16* zLength); -void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, s32* waterBoxStartIndex); -void BgCheck_ResetFlagsIfLoadedActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor); -void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna); -void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertices, s32* numWaterBoxes); -void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyna); -void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader); -void CollisionHeader_GetVirtual(CollisionHeader* colHeader, CollisionHeader** dest); -void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play); - -u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u16 BgCheck_GetBgCamSettingImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId); -u16 BgCheck_GetBgCamSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u16 BgCheck_GetBgCamCountImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId); -u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId); -Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); - -u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 func_800C99D4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 func_800C99FC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 func_800C9A24(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 func_800C9A4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 func_800C9A7C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 func_800C9AB0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 func_800C9AE4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 func_800C9B18(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 func_800C9B40(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 func_800C9B68(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 func_800C9BB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u16 SurfaceType_GetSfx(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 func_800C9C24(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 arg3); -u32 SurfaceType_GetSlope(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 SurfaceType_GetLightSettingIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); -s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 WaterBox_GetSurface1_2(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceCheckDist, WaterBox** outWaterBox, s32* bgId); -f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId); -u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId); -void WaterBox_GetSceneBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox); -u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox); -s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); -s32 func_800CA9D0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); -s32 func_800CAA14(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); void BgCheck2_UpdateActorPosition(CollisionContext* colCtx, s32 bgId, Actor* actor); void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 bgId, Actor* actor); void BgCheck2_AttachToMesh(CollisionContext* colCtx, Actor* actor, s32 bgId); diff --git a/include/sfx.h b/include/sfx.h index 33c79abf4..b55fbb357 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -16,6 +16,8 @@ #define SFX_FLAG_MASK 0xC00 #define SFX_FLAG 0x800 +#define NA_SE_NONE 0 + // ------------ PLAYER ------------ #define NA_SE_PL_WALK_GROUND 0x800 diff --git a/include/ultra64/thread.h b/include/ultra64/thread.h index f3cd68890..62cbdcd1b 100644 --- a/include/ultra64/thread.h +++ b/include/ultra64/thread.h @@ -54,16 +54,16 @@ typedef struct { } __OSThreadprofile; // size = 0x10 typedef struct OSThread { - /*0x00*/ struct OSThread* next; - /*0x04*/ OSPri priority; - /*0x08*/ struct OSThread** queue; - /*0x0C*/ struct OSThread* tlnext; - /*0x10*/ u16 state; - /*0x12*/ u16 flags; - /*0x14*/ OSId id; - /*0x18*/ s32 fp; - /*0x1C*/ __OSThreadprofile* thprof; - /*0x20*/ __OSThreadContext context; + /* 0x00 */ struct OSThread* next; + /* 0x04 */ OSPri priority; + /* 0x08 */ struct OSThread** queue; + /* 0x0C */ struct OSThread* tlnext; + /* 0x10 */ u16 state; + /* 0x12 */ u16 flags; + /* 0x14 */ OSId id; + /* 0x18 */ s32 fp; + /* 0x1C */ __OSThreadprofile* thprof; + /* 0x20 */ __OSThreadContext context; } OSThread; // size = 0x1B0 #endif diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index ad56599b5..c6210b2c1 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -48,11 +48,6 @@ struct DynaPolyActor; #define COLPOLY_IGNORE_ENTITY (1 << 1) #define COLPOLY_IGNORE_PROJECTILES (1 << 2) -// Surface Types -#define COLPOLY_SURFACE_GROUND 0 -#define COLPOLY_SURFACE_SAND 1 -#define COLPOLY_SURFACE_SNOW 14 - // CollisionContext flags #define BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW 1 @@ -114,6 +109,120 @@ typedef struct { // 0x0000_00FF = bgCam index } WaterBox; // size = 0x10 +typedef enum FloorType { + /* 0 */ FLOOR_TYPE_0, + /* 1 */ FLOOR_TYPE_1, + /* 2 */ FLOOR_TYPE_2, + /* 3 */ FLOOR_TYPE_3, + /* 4 */ FLOOR_TYPE_4, + /* 5 */ FLOOR_TYPE_5, + /* 6 */ FLOOR_TYPE_6, + /* 7 */ FLOOR_TYPE_7, + /* 8 */ FLOOR_TYPE_8, + /* 9 */ FLOOR_TYPE_9, + /* 10 */ FLOOR_TYPE_10, + /* 11 */ FLOOR_TYPE_11, + /* 12 */ FLOOR_TYPE_12, + /* 13 */ FLOOR_TYPE_13, + /* 14 */ FLOOR_TYPE_14, + /* 15 */ FLOOR_TYPE_15 +} FloorType; + +typedef enum WallType { + /* 0 */ WALL_TYPE_0, + /* 1 */ WALL_TYPE_1, + /* 2 */ WALL_TYPE_2, + /* 3 */ WALL_TYPE_3, + /* 4 */ WALL_TYPE_4, + /* 5 */ WALL_TYPE_5, + /* 6 */ WALL_TYPE_6, + /* 7 */ WALL_TYPE_7, + /* 8 */ WALL_TYPE_8, + /* 9 */ WALL_TYPE_9, + /* 10 */ WALL_TYPE_10, + /* 11 */ WALL_TYPE_11, + /* 12 */ WALL_TYPE_12, + /* 32 */ WALL_TYPE_MAX = 32 +} WallType; + +#define WALL_FLAG_0 (1 << 0) +#define WALL_FLAG_1 (1 << 1) +#define WALL_FLAG_2 (1 << 2) +#define WALL_FLAG_3 (1 << 3) +#define WALL_FLAG_4 (1 << 4) +#define WALL_FLAG_5 (1 << 5) +#define WALL_FLAG_6 (1 << 6) + +// SurfaceType can leave footsteps imprints in the material +#define MATERIAL_PROPERTY_SOFT_IMPRINT (1 << 0) + +typedef enum FloorProperty { + /* 0 */ FLOOR_PROPERTY_0, + /* 1 */ FLOOR_PROPERTY_1, + /* 2 */ FLOOR_PROPERTY_2, + /* 5 */ FLOOR_PROPERTY_5 = 5, + /* 6 */ FLOOR_PROPERTY_6, + /* 7 */ FLOOR_PROPERTY_7, + /* 8 */ FLOOR_PROPERTY_8, + /* 9 */ FLOOR_PROPERTY_9, + /* 11 */ FLOOR_PROPERTY_11 = 11, + /* 12 */ FLOOR_PROPERTY_12, + /* 13 */ FLOOR_PROPERTY_13 +} FloorProperty; + +typedef enum SurfaceSfxOffset { + /* 0 */ SURFACE_SFX_OFFSET_DIRT, + /* 1 */ SURFACE_SFX_OFFSET_SAND, + /* 2 */ SURFACE_SFX_OFFSET_STONE, + /* 3 */ SURFACE_SFX_OFFSET_DIRT_SHALLOW, + /* 4 */ SURFACE_SFX_OFFSET_WATER_SHALLOW, + /* 5 */ SURFACE_SFX_OFFSET_WATER_DEEP, + /* 6 */ SURFACE_SFX_OFFSET_TALL_GRASS, + /* 7 */ SURFACE_SFX_OFFSET_LAVA, // MAGMA? + /* 8 */ SURFACE_SFX_OFFSET_GRASS, + /* 9 */ SURFACE_SFX_OFFSET_CARPET, + /* 10 */ SURFACE_SFX_OFFSET_WOOD, + /* 11 */ SURFACE_SFX_OFFSET_BRIDGE, // WOOD_PLANK? + /* 12 */ SURFACE_SFX_OFFSET_VINE, // METAL? + /* 13 */ SURFACE_SFX_OFFSET_DIRT_DEEP, + /* 14 */ SURFACE_SFX_OFFSET_SNOW, + /* 15 */ SURFACE_SFX_OFFSET_ICE +} SurfaceSfxOffset; + +typedef enum SurfaceMaterial { + /* 0 */ SURFACE_MATERIAL_DIRT, + /* 1 */ SURFACE_MATERIAL_SAND, + /* 2 */ SURFACE_MATERIAL_STONE, + /* 3 */ SURFACE_MATERIAL_DIRT_SHALLOW, + /* 4 */ SURFACE_MATERIAL_WATER_SHALLOW, + /* 5 */ SURFACE_MATERIAL_WATER_DEEP, + /* 6 */ SURFACE_MATERIAL_TALL_GRASS, + /* 7 */ SURFACE_MATERIAL_LAVA, // MAGMA? + /* 8 */ SURFACE_MATERIAL_GRASS, + /* 9 */ SURFACE_MATERIAL_BRIDGE, // WOOD_PLANK? + /* 10 */ SURFACE_MATERIAL_WOOD, + /* 11 */ SURFACE_MATERIAL_DIRT_SOFT, + /* 12 */ SURFACE_MATERIAL_ICE, + /* 13 */ SURFACE_MATERIAL_CARPET, + /* 14 */ SURFACE_MATERIAL_SNOW, + /* 15 */ SURFACE_MATERIAL_MAX +} SurfaceMaterial; + +typedef enum FloorEffect { + /* 0 */ FLOOR_EFFECT_0, + /* 1 */ FLOOR_EFFECT_1, + /* 2 */ FLOOR_EFFECT_2, + /* 3 */ FLOOR_EFFECT_3 +} FloorEffect; + +typedef enum ConveyorSpeed { + /* 0 */ CONVEYOR_SPEED_DISABLED, + /* 1 */ CONVEYOR_SPEED_SLOW, + /* 2 */ CONVEYOR_SPEED_MEDIUM, + /* 3 */ CONVEYOR_SPEED_FAST, + /* 4 */ CONVEYOR_SPEED_MAX +} ConveyorSpeed; + typedef struct { /* 0x0 */ u32 data[2]; @@ -219,14 +328,14 @@ typedef struct { } DynaCollisionContext; // size = 0x1418 typedef struct { - /* 0x00 */ CollisionHeader* colHeader; // scene's static collision - /* 0x04 */ Vec3f minBounds; // minimum coordinates of collision bounding box - /* 0x10 */ Vec3f maxBounds; // maximum coordinates of collision bounding box - /* 0x1C */ Vec3i subdivAmount; // x, y, z subdivisions of the scene's static collision - /* 0x28 */ Vec3f subdivLength; // x, y, z subdivision worldspace lengths - /* 0x34 */ Vec3f subdivLengthInv; // inverse of subdivision length - /* 0x40 */ StaticLookup* lookupTbl; // 3d array of length subdivAmount - /* 0x44 */ SSNodeList polyNodes; + /* 0x0000 */ CollisionHeader* colHeader; // scene's static collision + /* 0x0004 */ Vec3f minBounds; // minimum coordinates of collision bounding box + /* 0x0010 */ Vec3f maxBounds; // maximum coordinates of collision bounding box + /* 0x001C */ Vec3i subdivAmount; // x, y, z subdivisions of the scene's static collision + /* 0x0028 */ Vec3f subdivLength; // x, y, z subdivision worldspace lengths + /* 0x0034 */ Vec3f subdivLengthInv; // inverse of subdivision length + /* 0x0040 */ StaticLookup* lookupTbl; // 3d array of length subdivAmount + /* 0x0044 */ SSNodeList polyNodes; /* 0x0050 */ DynaCollisionContext dyna; /* 0x1468 */ u32 memSize; // Size of all allocated memory plus CollisionContext /* 0x146C */ u32 flags; // bit 0 reverses conveyor direction (i.e. water flow in Great Bay Temple) @@ -317,4 +426,162 @@ typedef struct { /* 0x8 */ s32 nodeListMax; // if -1, dynamically compute max nodes } BgCheckSceneSubdivisionEntry; // size = 0xC +void SSNode_SetValue(SSNode* node, s16* polyIndex, u16 next); +void SSList_SetNull(SSList* ssList); +void SSNodeList_SetSSListHead(SSNodeList* list, SSList* ssList, s16* polyIndex); +void DynaSSNodeList_SetSSListHead(DynaSSNodeList* list, SSList* ssList, s16* polyIndex); +void DynaSSNodeList_Init(struct PlayState* play, DynaSSNodeList* list); +void DynaSSNodeList_Alloc(struct PlayState* play, DynaSSNodeList* list, u32 numNodes); +void DynaSSNodeList_ResetCount(DynaSSNodeList* list); +u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* list); +void BgCheck_Vec3sToVec3f(Vec3s* src, Vec3f* dest); +void BgCheck_Vec3fToVec3s(Vec3s* dest, Vec3f* src); +f32 func_800BFD84(CollisionPoly *poly, f32 arg1, f32 arg2); +s32 func_800BFDEC(CollisionPoly* polyA, CollisionPoly* polyB, u32* outVtxId0, u32* outVtxId1); +s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vertices); +void CollisionPoly_GetNormalF(CollisionPoly* poly, f32* nx, f32* ny, f32* nz); +void func_800C0094(CollisionPoly* poly, f32 tx, f32 ty, f32 tz, MtxF* dest); +f32 CollisionPoly_GetPointDistanceFromPlane(CollisionPoly* poly, Vec3f* point); +void CollisionPoly_GetVerticesByBgId(CollisionPoly* poly, s32 bgId, CollisionContext* colCtx, Vec3f* dest); +s32 CollisionPoly_SphVsPoly(CollisionPoly* poly, Vec3s* vtxList, Vec3f* center, f32 radius); +void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, CollisionPoly* polyList, Vec3s* vtxList, s16 polyId); +void StaticLookup_AddPoly(StaticLookup* lookup, CollisionContext* colCtx, CollisionPoly* polyList, Vec3s* vtxList, s16 index); +void BgCheck_GetSubdivisionMinBounds(CollisionContext* colCtx, Vec3f* pos, s32* sx, s32* sy, s32* sz); +void BgCheck_GetSubdivisionMaxBounds(CollisionContext* colCtx, Vec3f* pos, s32* sx, s32* sy, s32* sz); +void BgCheck_GetPolySubdivisionBounds(CollisionContext* colCtx, Vec3s* vtxList, CollisionPoly* polyList, s32* subdivMinX, s32* subdivMinY, s32* subdivMinZ, s32* subdivMaxX, s32* subdivMaxY, s32* subdivMaxZ, s16 polyId); +s32 BgCheck_PolyIntersectsSubdivision(Vec3f* min, Vec3f* max, CollisionPoly* polyList, Vec3s* vtxList, s16 polyId); +u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, struct PlayState* play, StaticLookup* lookupTbl); +s32 BgCheck_IsSmallMemScene(struct PlayState* play); +s32 BgCheck_TryGetCustomMemsize(s32 sceneId, u32* memSize); +void BgCheck_SetSubdivisionDimension(f32 min, s32 subdivAmount, f32* max, f32* subdivLength, f32* subdivLengthInv); +s32 BgCheck_GetSpecialSceneMaxObjects(struct PlayState* play, s32* maxNodes, s32* maxPolygons, s32* maxVertices); +void BgCheck_Allocate(CollisionContext* colCtx, struct PlayState* play, CollisionHeader* colHeader); +void BgCheck_SetContextFlags(CollisionContext* colCtx, u32 flags); +void BgCheck_UnsetContextFlags(CollisionContext* colCtx, u32 flags); +CollisionHeader* BgCheck_GetCollisionHeader(CollisionContext* colCtx, s32 bgId); +f32 BgCheck_RaycastFloorImpl(struct PlayState* play, CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* pos, Actor* actor, u32 arg7, f32 checkDist, s32 arg9); +f32 BgCheck_CameraRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor1(CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor2(struct PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor2_1(struct PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor3(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor5(CollisionContext* colCtx, CollisionPoly** outPoly, s32* outBgId, Actor* actor, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor5_2(struct PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor5_3(struct PlayState* play, CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor6(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos, f32 checkDist); +f32 BgCheck_EntityRaycastFloor7(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); +f32 BgCheck_AnyRaycastFloor1(CollisionContext* colCtx, CollisionPoly* outPoly, Vec3f* pos); +f32 BgCheck_AnyRaycastFloor2(CollisionContext* colCtx, CollisionPoly* outPoly, s32* bgId, Vec3f* pos); +f32 BgCheck_CameraRaycastFloor2(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor8(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Actor* actor, Vec3f* pos); +f32 BgCheck_EntityRaycastFloor9(CollisionContext* colCtx, CollisionPoly** outPoly, s32* bgId, Vec3f* pos); +s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor, f32 checkHeight, u8 argA); +s32 BgCheck_EntitySphVsWall1(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, f32 checkHeight); +s32 BgCheck_EntitySphVsWall2(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, f32 checkHeight); +s32 BgCheck_EntitySphVsWall3(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor, f32 checkHeight); +s32 BgCheck_EntitySphVsWall4(CollisionContext* colCtx, Vec3f* posResult, Vec3f* posNext, Vec3f* posPrev, f32 radius, CollisionPoly** outPoly, s32* outBgId, Actor* actor, f32 checkHeight); +s32 BgCheck_CheckCeilingImpl(CollisionContext* colCtx, u16 xpFlags, f32* outY, Vec3f* pos, f32 checkHeight, CollisionPoly** outPoly, s32* outBgId, Actor* actor); +s32 BgCheck_AnyCheckCeiling(CollisionContext* colCtx, f32* outY, Vec3f* pos, f32 checkHeight); +s32 BgCheck_EntityCheckCeiling(CollisionContext* colCtx, f32* outY, Vec3f* pos, f32 checkHeight, CollisionPoly** outPoly, s32* outBgId, Actor* actor); +s32 BgCheck_CameraLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_CameraLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_EntityLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_EntityLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId, Actor* actor); +s32 BgCheck_EntityLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId, Actor* actor, f32 checkDist); +s32 BgCheck_ProjectileLineTest(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_AnyLineTest1(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkOneFace); +s32 BgCheck_AnyLineTest2(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace); +s32 BgCheck_AnyLineTest3(CollisionContext* colCtx, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** outPoly, s32 checkWall, s32 checkFloor, s32 checkCeil, s32 checkOneFace, s32* bgId); +s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* center, f32 radius, Actor* actor, u16 bciFlags); +s32 BgCheck_SphVsFirstPoly(CollisionContext* colCtx, Vec3f* center, f32 radius); +s32 BgCheck_SphVsFirstWall(CollisionContext* colCtx, Vec3f* center, f32 radius); +void SSNodeList_Init(SSNodeList* this); +void SSNodeList_Alloc(struct PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys); +SSNode* SSNodeList_GetNextNode(SSNodeList* this); +u16 SSNodeList_GetNextNodeIdx(SSNodeList* this); +void ScaleRotPos_Init(ScaleRotPos* srp); +void ScaleRotPos_SetValue(ScaleRotPos* srp, Vec3f* scale, Vec3s* rot, Vec3f* pos); +s32 ScaleRotPos_IsEqual(ScaleRotPos* a, ScaleRotPos* b); +void DynaLookup_ResetLists(DynaLookup* dynaLookup); +void DynaLookup_Reset(DynaLookup* dynaLookup); +void DynaLookup_ResetVtxStartIndex(u16* vtxStartIndex); +void DynaLookup_ResetWaterBoxStartIndex(u16* waterBoxStartIndex); +void BgActor_Init(struct PlayState* play, BgActor* bgActor); +void BgActor_SetActor(BgActor* bgActor, Actor* actor, CollisionHeader* colHeader); +s32 BgActor_IsTransformUnchanged(BgActor* bgActor); +void DynaPoly_NullPolyList(CollisionPoly** polyList); +void DynaPoly_AllocPolyList(struct PlayState* play, CollisionPoly** polyList, s32 numPolys); +void DynaPoly_NullVtxList(Vec3s** vtxList); +void DynaPoly_AllocVtxList(struct PlayState* play, Vec3s** vtxList, s32 numVtx); +void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList); +void DynaPoly_AllocWaterBoxList(struct PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes); +void DynaPoly_SetBgActorPrevTransform(struct PlayState* play, BgActor* bgActor); +s32 DynaPoly_IsBgIdBgActor(s32 bgId); +void DynaPoly_Init(struct PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_Alloc(struct PlayState* play, DynaCollisionContext* dyna); +s32 DynaPoly_SetBgActor(struct PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); +DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId); +void func_800C62BC(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C6314(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C636C(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C63C4(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C641C(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C6474(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void func_800C6554(struct PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_DeleteBgActor(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPos, Vec3s* minPosOut, s16* xLength, s16* zLength); +void DynaPoly_ExpandSRT(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, s32* waterBoxStartIndex); +void BgCheck_ResetFlagsIfLoadedActor(struct PlayState* play, DynaCollisionContext* dyna, Actor* actor); +void DynaPoly_Setup(struct PlayState* play, DynaCollisionContext* dyna); +void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertices, s32* numWaterBoxes); +void DynaPoly_UpdateBgActorTransforms(struct PlayState* play, DynaCollisionContext* dyna); +void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader); +void CollisionHeader_GetVirtual(CollisionHeader* colHeader, CollisionHeader** dest); +void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, struct PlayState* play); + +u32 SurfaceType_GetBgCamIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u16 BgCheck_GetBgCamSettingImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId); +u16 BgCheck_GetBgCamSetting(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u16 BgCheck_GetBgCamCountImpl(CollisionContext* colCtx, u32 bgCamIndex, s32 bgId); +u16 BgCheck_GetBgCamCount(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +Vec3s* BgCheck_GetBgCamFuncDataImpl(CollisionContext* colCtx, s32 bgCamIndex, s32 bgId); +Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); + +u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +FloorType SurfaceType_GetFloorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 func_800C99FC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_GetWallFlags(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_CheckWallFlag0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_CheckWallFlag1(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +FloorProperty SurfaceType_GetFloorProperty2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +FloorProperty SurfaceType_GetFloorProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 SurfaceType_IsSoft(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +SurfaceMaterial SurfaceType_GetMaterial(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u16 SurfaceType_GetSfxOffset(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_HasMaterialProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 propertyType); +FloorEffect SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 SurfaceType_GetLightSettingIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +ConveyorSpeed SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 WaterBox_GetSurfaceImpl(struct PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); +s32 WaterBox_GetSurface1(struct PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); +s32 WaterBox_GetSurface1_2(struct PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); +s32 WaterBox_GetSurface2(struct PlayState* play, CollisionContext* colCtx, Vec3f* pos, f32 surfaceCheckDist, WaterBox** outWaterBox, s32* bgId); +f32 func_800CA568(CollisionContext* colCtx, s32 waterBoxId, s32 bgId); +u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 bgId); +void WaterBox_GetSceneBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox); +u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox); +s32 func_800CA6F0(struct PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox, s32* bgId); +s32 func_800CA9D0(struct PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox); +s32 func_800CAA14(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); + #endif diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c index 5e4f8e24a..2c8f4a667 100644 --- a/src/boot_O2_g3/fault.c +++ b/src/boot_O2_g3/fault.c @@ -802,8 +802,8 @@ void Fault_ThreadEntry(void* arg) { u32 pad; OSThread* faultedThread; - osSetEventMesg(10, &sFaultContext->queue, (OSMesg)1); - osSetEventMesg(12, &sFaultContext->queue, (OSMesg)2); + osSetEventMesg(OS_EVENT_CPU_BREAK, &sFaultContext->queue, (OSMesg)1); + osSetEventMesg(OS_EVENT_FAULT, &sFaultContext->queue, (OSMesg)2); while (1) { do { osRecvMesg(&sFaultContext->queue, &msg, OS_MESG_BLOCK); diff --git a/src/boot_O2_g3/irqmgr.c b/src/boot_O2_g3/irqmgr.c index 424451a5b..1f1e94ab4 100644 --- a/src/boot_O2_g3/irqmgr.c +++ b/src/boot_O2_g3/irqmgr.c @@ -161,7 +161,7 @@ void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) { irqmgr->lastPrenmiTime = 0; osCreateMesgQueue(&irqmgr->irqQueue, (OSMesg*)irqmgr->irqBuffer, ARRAY_COUNT(irqmgr->irqBuffer)); - osSetEventMesg(0xE, &irqmgr->irqQueue, (OSMesg)0x29D); + osSetEventMesg(OS_EVENT_PRENMI, &irqmgr->irqQueue, (OSMesg)0x29D); osViSetEvent(&irqmgr->irqQueue, (OSMesg)0x29A, retraceCount); osCreateThread(&irqmgr->thread, Z_THREAD_ID_IRQMGR, IrqMgr_ThreadEntry, irqmgr, stack, pri); diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index 00d894f74..bbf8e4bed 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "stack.h" #include "stackcheck.h" diff --git a/src/code/sched.c b/src/code/sched.c index c2630677c..98b005ba1 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "stackcheck.h" diff --git a/src/code/z_actor.c b/src/code/z_actor.c index db01bb345..b58f6700a 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -234,8 +234,9 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) { if (distToFloor <= 10.0f) { actor->shape.feetFloorFlags |= spB8; - if ((actor->depthInWater < 0.0f) && (bgId == 0x32) && ((actor->shape.unk_17 & spB8) != 0)) { - if (func_800C9C24(&play->colCtx, poly, bgId, 1)) { + if ((actor->depthInWater < 0.0f) && (bgId == BGCHECK_SCENE) && (actor->shape.unk_17 & spB8)) { + if (SurfaceType_HasMaterialProperty(&play->colCtx, poly, bgId, + MATERIAL_PROPERTY_SOFT_IMPRINT)) { SkinMatrix_MtxFCopy(&sp13C, &spFC); SkinMatrix_MulYRotation(&spFC, actor->shape.rot.y); EffFootmark_Add(play, &spFC, actor, i, feetPosPtr, (actor->shape.shadowScale * 0.3f), @@ -2183,20 +2184,20 @@ void Actor_PlaySfx(Actor* actor, u16 sfxId) { } void func_800B8EF4(PlayState* play, Actor* actor) { - u32 sfxId; + SurfaceSfxOffset surfaceSfxOffset; if (actor->bgCheckFlags & BGCHECKFLAG_WATER) { if (actor->depthInWater < 20.0f) { - sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW; } else { - sfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP; } } else { - sfxId = SurfaceType_GetSfx(&play->colCtx, actor->floorPoly, actor->floorBgId); + surfaceSfxOffset = SurfaceType_GetSfxOffset(&play->colCtx, actor->floorPoly, actor->floorBgId); } Audio_PlaySfxAtPos(&actor->projectedPos, NA_SE_EV_BOMB_BOUND); - Audio_PlaySfxAtPos(&actor->projectedPos, sfxId + SFX_FLAG); + Audio_PlaySfxAtPos(&actor->projectedPos, NA_SE_PL_WALK_GROUND + surfaceSfxOffset); } void func_800B8F98(Actor* actor, u16 sfxId) { @@ -2248,7 +2249,7 @@ void func_800B9098(Actor* actor) { } s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 bgId, Vec3f* arg4) { - if (func_800C99D4(&play->colCtx, polygon, bgId) == 8) { + if (SurfaceType_GetFloorType(&play->colCtx, polygon, bgId) == FLOOR_TYPE_8) { return true; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index c0bfe8047..de0d5d12a 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -6,44 +6,51 @@ #define DYNA_RAYCAST_WALLS 2 #define DYNA_RAYCAST_CEILINGS 4 -u32 sWallFlags[32] = { - 0, 1, 3, 5, 8, 16, 32, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +u32 sWallFlags[WALL_TYPE_MAX] = { + 0, // WALL_TYPE_0 + WALL_FLAG_0, // WALL_TYPE_1 + WALL_FLAG_0 | WALL_FLAG_1, // WALL_TYPE_2 + WALL_FLAG_0 | WALL_FLAG_2, // WALL_TYPE_3 + WALL_FLAG_3, // WALL_TYPE_4 + WALL_FLAG_4, // WALL_TYPE_5 + WALL_FLAG_5, // WALL_TYPE_6 + WALL_FLAG_6, // WALL_TYPE_7 }; -u16 sSurfaceTypeSfx[] = { - /* 0x00 */ NA_SE_PL_WALK_GROUND - SFX_FLAG, - /* 0x01 */ NA_SE_PL_WALK_SAND - SFX_FLAG, - /* 0x02 */ NA_SE_PL_WALK_CONCRETE - SFX_FLAG, - /* 0x03 */ NA_SE_PL_WALK_DIRT - SFX_FLAG, - /* 0x04 */ NA_SE_PL_WALK_WATER0 - SFX_FLAG, - /* 0x05 */ NA_SE_PL_WALK_WATER1 - SFX_FLAG, - /* 0x06 */ NA_SE_PL_WALK_WATER2 - SFX_FLAG, - /* 0x07 */ NA_SE_PL_WALK_MAGMA - SFX_FLAG, - /* 0x08 */ NA_SE_PL_WALK_GRASS - SFX_FLAG, - /* 0x09 */ NA_SE_PL_WALK_GLASS - SFX_FLAG, - /* 0x0A */ NA_SE_PL_WALK_LADDER - SFX_FLAG, - /* 0x0B */ NA_SE_PL_WALK_GROUND - SFX_FLAG, - /* 0x0C */ NA_SE_PL_WALK_ICE - SFX_FLAG, - /* 0x0D */ NA_SE_PL_WALK_IRON - SFX_FLAG, - /* 0x0E */ NA_SE_PL_WALK_SNOW - SFX_FLAG +u16 sSurfaceSfxOffsets[SURFACE_MATERIAL_MAX] = { + SURFACE_SFX_OFFSET_DIRT, // SURFACE_MATERIAL_DIRT + SURFACE_SFX_OFFSET_SAND, // SURFACE_MATERIAL_SAND + SURFACE_SFX_OFFSET_STONE, // SURFACE_MATERIAL_STONE + SURFACE_SFX_OFFSET_DIRT_SHALLOW, // SURFACE_MATERIAL_DIRT_SHALLOW + SURFACE_SFX_OFFSET_WATER_SHALLOW, // SURFACE_MATERIAL_WATER_SHALLOW + SURFACE_SFX_OFFSET_WATER_DEEP, // SURFACE_MATERIAL_WATER_DEEP + SURFACE_SFX_OFFSET_TALL_GRASS, // SURFACE_MATERIAL_TALL_GRASS + SURFACE_SFX_OFFSET_LAVA, // SURFACE_MATERIAL_LAVA + SURFACE_SFX_OFFSET_GRASS, // SURFACE_MATERIAL_GRASS + SURFACE_SFX_OFFSET_BRIDGE, // SURFACE_MATERIAL_BRIDGE + SURFACE_SFX_OFFSET_WOOD, // SURFACE_MATERIAL_WOOD + SURFACE_SFX_OFFSET_DIRT, // SURFACE_MATERIAL_DIRT_SOFT + SURFACE_SFX_OFFSET_ICE, // SURFACE_MATERIAL_ICE + SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET + SURFACE_SFX_OFFSET_SNOW, // SURFACE_MATERIAL_SNOW }; -u8 D_801B46C0[] = { - /* 0x00 */ 1, - /* 0x01 */ 1, - /* 0x02 */ 0, - /* 0x03 */ 1, - /* 0x04 */ 0, - /* 0x05 */ 0, - /* 0x06 */ 0, - /* 0x07 */ 0, - /* 0x08 */ 0, - /* 0x09 */ 0, - /* 0x0A */ 0, - /* 0x0B */ 0, - /* 0x0C */ 0, - /* 0x0D */ 0, - /* 0x0E */ 1 +u8 sSurfaceMaterialProperties[SURFACE_MATERIAL_MAX] = { + MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_DIRT + MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_SAND + 0, // SURFACE_MATERIAL_STONE + MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_DIRT_SHALLOW + 0, // SURFACE_MATERIAL_WATER_SHALLOW + 0, // SURFACE_MATERIAL_WATER_DEEP + 0, // SURFACE_MATERIAL_TALL_GRASS + 0, // SURFACE_MATERIAL_LAVA + 0, // SURFACE_MATERIAL_GRASS + 0, // SURFACE_MATERIAL_BRIDGE + 0, // SURFACE_MATERIAL_WOOD + 0, // SURFACE_MATERIAL_DIRT_SOFT + 0, // SURFACE_MATERIAL_ICE + 0, // SURFACE_MATERIAL_CARPET + MATERIAL_PROPERTY_SOFT_IMPRINT, // SURFACE_MATERIAL_SNOW }; s16 sSmallMemSceneIds[] = { @@ -51,9 +58,9 @@ s16 sSmallMemSceneIds[] = { }; typedef struct { - s16 sceneId; - u32 memSize; -} BgCheckSceneMemEntry; + /* 0x0 */ s16 sceneId; + /* 0x4 */ u32 memSize; +} BgCheckSceneMemEntry; // size = 0x8 BgCheckSceneMemEntry sSceneMemList[] = { { SCENE_00KEIKOKU, 0xC800 }, @@ -1734,7 +1741,7 @@ f32 BgCheck_RaycastFloorImpl(PlayState* play, CollisionContext* colCtx, u16 xpFl } } - if ((yIntersect != BGCHECK_Y_MIN) && func_800C9B68(colCtx, *outPoly, *outBgId)) { + if ((yIntersect != BGCHECK_Y_MIN) && SurfaceType_IsSoft(colCtx, *outPoly, *outBgId)) { yIntersect -= 1.0f; } return yIntersect; @@ -3204,7 +3211,8 @@ f32 BgCheck_RaycastFloorDynaList(DynaRaycast* dynaRaycast, u32 listType) { (COLPOLY_VIA_FLAG_TEST(polyList[id].flags_vIB, 4) && (((dynaRaycast->actor != NULL) && (dynaRaycast->actor->category != ACTORCAT_PLAYER)) || ((dynaRaycast->actor == NULL) && (dynaRaycast->xpFlags != COLPOLY_IGNORE_CAMERA)))) || - ((dynaRaycast->unk_24 & 0x20) && func_800C9B68(dynaRaycast->colCtx, &polyList[id], dynaRaycast->unk1C))) { + ((dynaRaycast->unk_24 & 0x20) && + SurfaceType_IsSoft(dynaRaycast->colCtx, &polyList[id], dynaRaycast->unk1C))) { if (curNode->next == SS_NULL) { break; } else { @@ -4187,17 +4195,11 @@ Vec3s* BgCheck_GetBgCamFuncData(CollisionContext* colCtx, CollisionPoly* poly, s return BgCheck_GetBgCamFuncDataImpl(colCtx, SurfaceType_GetBgCamIndex(colCtx, poly, bgId), bgId); } -/** - * SurfaceType Get Scene Exit Index - */ u32 SurfaceType_GetSceneExitIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 8 & 0x1F; } -/** - * SurfaceType Get ? Property (& 0x0003_E000) - */ -u32 func_800C99D4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +FloorType SurfaceType_GetFloorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 13 & 0x1F; } @@ -4208,126 +4210,85 @@ u32 func_800C99FC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 18 & 7; } -/** - * SurfaceType Get Wall Property (Internal) - */ -u32 func_800C9A24(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +WallType SurfaceType_GetWallType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 21 & 0x1F; } -/** - * SurfaceType Get Wall Flags - */ -s32 func_800C9A4C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - return sWallFlags[func_800C9A24(colCtx, poly, bgId)]; +s32 SurfaceType_GetWallFlags(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { + return sWallFlags[SurfaceType_GetWallType(colCtx, poly, bgId)]; } -/** - * SurfaceType Is Wall Flag (1 << 0) Set - */ -s32 func_800C9A7C(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - return (func_800C9A4C(colCtx, poly, bgId) & 1) ? true : false; +s32 SurfaceType_CheckWallFlag0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { + return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_0) ? true : false; } -/** - * SurfaceType Is Wall Flag (1 << 1) Set - */ -s32 func_800C9AB0(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - return (func_800C9A4C(colCtx, poly, bgId) & 2) ? true : false; +s32 SurfaceType_CheckWallFlag1(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { + return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_1) ? true : false; } -/** - * SurfaceType Is Wall Flag (1 << 2) Set - */ -s32 func_800C9AE4(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - return (func_800C9A4C(colCtx, poly, bgId) & 4) ? true : false; +s32 SurfaceType_CheckWallFlag2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { + return (SurfaceType_GetWallFlags(colCtx, poly, bgId) & WALL_FLAG_2) ? true : false; } -u32 func_800C9B18(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +FloorProperty SurfaceType_GetFloorProperty2(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF; } -/** - * SurfaceType Get Floor Property - */ -u32 func_800C9B40(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +FloorProperty SurfaceType_GetFloorProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 26 & 0xF; } -/** - * SurfaceType Is Floor Minus 1 - */ -u32 func_800C9B68(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +u32 SurfaceType_IsSoft(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 30 & 1; } -/** - * SurfaceType Is Horse Blocked - */ u32 SurfaceType_IsHorseBlocked(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 0) >> 31 & 1; } -u32 func_800C9BB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +SurfaceMaterial SurfaceType_GetMaterial(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 1) & 0xF; } -/** - * SurfaceType Get Poly Sfx - */ -u16 SurfaceType_GetSfx(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - s32 id = func_800C9BB8(colCtx, poly, bgId); +u16 SurfaceType_GetSfxOffset(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { + SurfaceMaterial surfaceMaterial = SurfaceType_GetMaterial(colCtx, poly, bgId); - if ((id < 0) || (id > 14)) { - return NA_SE_PL_WALK_GROUND - SFX_FLAG; + if ((surfaceMaterial < 0) || (surfaceMaterial >= ARRAY_COUNT(sSurfaceSfxOffsets))) { + return SURFACE_SFX_OFFSET_DIRT; } - return sSurfaceTypeSfx[id]; + + return sSurfaceSfxOffsets[surfaceMaterial]; } /** - * SurfaceType Get ? (same indexer as Get Poly Sfx) + * Checks if the material has the bitwise propertyType */ -s32 func_800C9C24(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 arg3) { - s32 id = func_800C9BB8(colCtx, poly, bgId); +s32 SurfaceType_HasMaterialProperty(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId, s32 propertyType) { + SurfaceMaterial surfaceMaterial = SurfaceType_GetMaterial(colCtx, poly, bgId); - if ((id < 0) || (id > 14)) { + if ((surfaceMaterial < 0) || (surfaceMaterial >= ARRAY_COUNT(sSurfaceMaterialProperties))) { return 0; } - return D_801B46C0[id] & arg3; + + return sSurfaceMaterialProperties[surfaceMaterial] & propertyType; } -/** - * SurfaceType get terrain slope surface - */ -u32 SurfaceType_GetSlope(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +FloorEffect SurfaceType_GetFloorEffect(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 4 & 3; } -/** - * SurfaceType get surface lighting setting - */ u32 SurfaceType_GetLightSettingIndex(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 6 & 0x1F; } -/** - * SurfaceType get echo - */ u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 11 & 0x3F; } -/** - * SurfaceType Is Hookshot Surface - */ u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 17 & 1; } -/** - * CollisionPoly is ignored by entities - * Returns true if poly is ignored by entities, else false - */ s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 flags; @@ -4338,10 +4299,6 @@ s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* pol return !!flags; } -/** - * CollisionPoly is ignored by projectiles - * Returns true if poly is ignored by projectiles, else false - */ s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 flags; @@ -4384,10 +4341,7 @@ s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return !!flags; } -/** - * SurfaceType Get Conveyor Surface Speed - */ -u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +ConveyorSpeed SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return SurfaceType_GetData(colCtx, poly, bgId, 1) >> 18 & 7; } @@ -4405,9 +4359,6 @@ u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* po return data & 0x3F; } -/** - * SurfaceType is Wall Damage - */ u32 SurfaceType_IsWallDamage(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { return (SurfaceType_GetData(colCtx, poly, bgId, 1) & 0x8000000) ? true : false; } diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index 2f508bb94..674f4bfa4 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -250,19 +250,20 @@ void EnHy_UpdateCollider(EnHy* enHy, PlayState* play) { s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold) { u8 wasLeftFootOnGround = enHy->isLeftFootOnGround; u8 wasRightFootOnGround = enHy->isRightFootOnGround; - s32 waterSfxId; + SurfaceSfxOffset surfaceSfxOffset; u16 sfxId; u8 isFootOnGround; if (enHy->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (enHy->actor.depthInWater < 20.0f) { - waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW; } else { - waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP; } - sfxId = waterSfxId + SFX_FLAG; + sfxId = NA_SE_PL_WALK_GROUND + surfaceSfxOffset; } else { - sfxId = SurfaceType_GetSfx(&play->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG; + sfxId = NA_SE_PL_WALK_GROUND + + SurfaceType_GetSfxOffset(&play->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId); } enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(play, &enHy->leftFootPos, distAboveThreshold); diff --git a/src/code/z_message.c b/src/code/z_message.c index 01e4a366d..8681967e6 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -106,7 +106,7 @@ void Message_CloseTextbox(PlayState* play) { msgCtx->stateTimer = 2; msgCtx->msgMode = 0x43; msgCtx->unk12020 = 0; - play_sound(NA_SE_PL_WALK_GROUND - SFX_FLAG); + play_sound(NA_SE_NONE); } } diff --git a/src/code/z_play.c b/src/code/z_play.c index 08309b32f..178802486 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "buffers.h" #include "z64debug_display.h" diff --git a/src/code/z_quake.c b/src/code/z_quake.c index e1e12bbf1..d8d526ca3 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -477,13 +477,13 @@ void Distortion_ClearType(s32 type) { /** * Checks that the bg surface is an underwater conveyor type and if so, returns the conveyor speed */ -s32 Distortion_GetUnderwaterCurrentSpeed(Player* player) { +ConveyorSpeed Distortion_GetUnderwaterCurrentSpeed(Player* player) { if (!SurfaceType_IsFloorConveyor(&sDistortionRequest.play->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { return SurfaceType_GetConveyorSpeed(&sDistortionRequest.play->colCtx, player->actor.floorPoly, player->actor.floorBgId); } - return 0; + return CONVEYOR_SPEED_DISABLED; } void Distortion_Update(void) { @@ -709,21 +709,21 @@ void Distortion_Update(void) { rotZ = 0.3f; switch (Distortion_GetUnderwaterCurrentSpeed(player)) { - case 3: + case CONVEYOR_SPEED_FAST: xScale = -0.06f; yScale = 0.1f; zScale = 0.03f; speed = 0.33f; break; - case 2: + case CONVEYOR_SPEED_MEDIUM: xScale = -0.06f; yScale = 0.1f; zScale = 0.03f; speed = 0.33f; break; - case 1: + case CONVEYOR_SPEED_SLOW: xScale = -0.06f; yScale = 0.1f; zScale = 0.03f; @@ -759,21 +759,21 @@ void Distortion_Update(void) { rotY = 0.0f; rotZ = 0.0f; switch (Distortion_GetUnderwaterCurrentSpeed(player)) { - case 3: + case CONVEYOR_SPEED_FAST: xScale = 0.12f; yScale = 0.12f; zScale = 0.08f; speed = 0.18f; break; - case 2: + case CONVEYOR_SPEED_MEDIUM: xScale = 0.12f; yScale = 0.12f; zScale = 0.08f; speed = 0.12f; break; - case 1: + case CONVEYOR_SPEED_SLOW: xScale = 0.12f; yScale = 0.12f; zScale = 0.08f; diff --git a/src/libultra/io/pimgr.c b/src/libultra/io/pimgr.c index fefffd653..63cc7ba66 100644 --- a/src/libultra/io/pimgr.c +++ b/src/libultra/io/pimgr.c @@ -19,7 +19,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC if (!__osPiAccessQueueEnabled) { __osPiCreateAccessQueue(); } - osSetEventMesg(8, &D_8009E3D0, (OSMesg)0x22222222); + osSetEventMesg(OS_EVENT_PI, &D_8009E3D0, (OSMesg)0x22222222); oldPri = -1; myPri = osGetThreadPri(NULL); if (myPri < pri) { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c index b6206ecb7..5f35aaa4d 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c @@ -336,8 +336,8 @@ void func_80B7F398(BgIkanaBlock* this, PlayState* play) { if (func_80B7EE70(this, play)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); Actor_PlaySfx(&this->dyna.actor, - SurfaceType_GetSfx(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) + - SFX_FLAG); + NA_SE_PL_WALK_GROUND + SurfaceType_GetSfxOffset(&play->colCtx, this->dyna.actor.floorPoly, + this->dyna.actor.floorBgId)); func_80B7F0A4(this); } } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 423c70fc5..83bdfe71a 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -648,7 +648,7 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) { case 72: case 77: case 79: - Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER2); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_TALL_GRASS); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_WALK); break; diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 57fa310e1..01df27715 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -47,8 +47,8 @@ void func_808BAAF4(DoorWarp1* this, PlayState* play); void func_808BABF4(DoorWarp1* this, PlayState* play); void func_808BB8D4(DoorWarp1* this, PlayState* play, s32 arg2); -static s16 D_808BC000; -static f32 D_808BC004; +s16 D_808BC000; +f32 D_808BC004; ActorInit Door_Warp1_InitVars = { ACTOR_DOOR_WARP1, diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index 9e99d4fba..a1e2798df 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -211,9 +211,9 @@ void EnBbfall_Thaw(EnBbfall* this, PlayState* play) { */ s32 EnBbfall_IsTouchingLava(EnBbfall* this, PlayState* play) { if (!SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { - u32 floorType = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + FloorType floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { + if ((floorType == FLOOR_TYPE_2) || (floorType == FLOOR_TYPE_3) || (floorType == FLOOR_TYPE_9)) { return true; } } diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index a99e9063c..4ebdbe916 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -230,7 +230,7 @@ void EnBom_Move(EnBom* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 0.08f); } else { Vec3f* sp58; - u32 sp54 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + FloorType floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); Vec3f slopeNormal; s16 downwardSlopeYaw; f32 sp40; @@ -239,11 +239,11 @@ void EnBom_Move(EnBom* this, PlayState* play) { sp58 = &D_80872E68[this->isPowderKeg]; - if (sp54 == 5) { + if (floorType == FLOOR_TYPE_5) { sp58 = &D_80872E68[2]; } - if ((sp54 == 4) || (sp54 == 14) || (sp54 == 15)) { + if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) { s16 sp36; Math_ApproachF(&this->actor.shape.yOffset, 0.0f, 0.1f, 50.0f); @@ -262,8 +262,8 @@ void EnBom_Move(EnBom* this, PlayState* play) { sp3C += 3.0f * slopeNormal.z; sp38 = sqrtf(SQ(sp40) + SQ(sp3C)); - if ((sp38 < this->actor.speed) || - (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { + if ((sp38 < this->actor.speed) || (SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, + this->actor.floorBgId) == FLOOR_EFFECT_1)) { if (sp38 > 16.0f) { this->actor.speed = 16.0f; } else { @@ -286,7 +286,7 @@ void EnBom_Move(EnBom* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, this->isPowderKeg ? NA_SE_EV_TRE_BOX_BOUND : NA_SE_EV_BOMB_BOUND); if (this->actor.velocity.y < sp58->y) { - if ((sp54 == 4) || (sp54 == 14) || (sp54 == 15)) { + if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) { this->actor.velocity.y = 0.0f; } else { this->actor.velocity.y = this->actor.velocity.y * sp58->z; @@ -327,7 +327,7 @@ void EnBom_Explode(EnBom* this, PlayState* play) { static Color_RGBA8 D_80872E90 = { 185, 140, 70, 255 }; static Color_RGBA8 D_80872E94 = { 255, 255, 255, 255 }; s32 i; - s32 temp_s0; + FloorType floorType; f32 temp_f20; s32 pad; f32 spCC; @@ -394,11 +394,11 @@ void EnBom_Explode(EnBom* this, PlayState* play) { spB4.y = this->actor.world.pos.y + 500.0f; spB4.z = this->actor.world.pos.z + spC0.z; if (BgCheck_EntityRaycastFloor3(&play->colCtx, &spB0, &spAC, &spB4) != BGCHECK_Y_MIN) { - temp_s0 = func_800C99D4(&play->colCtx, spB0, spAC); + floorType = SurfaceType_GetFloorType(&play->colCtx, spB0, spAC); temp_f20 = BgCheck_EntityRaycastFloor1(&play->colCtx, &spB0, &spB4); - if ((temp_s0 == 4) || (temp_s0 == 15) || (temp_s0 == 14)) { - if (temp_s0 == 4) { + if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_15) || (floorType == FLOOR_TYPE_14)) { + if (floorType == FLOOR_TYPE_4) { sp84 = D_80872E90; sp80 = D_80872E90; } else { diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index a652e574f..175ac69a8 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -193,7 +193,7 @@ void EnBomChu_WaitForRelease(EnBomChu* this, PlayState* play) { s32 EnBomChu_IsOnCollisionPoly(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, CollisionPoly** poly, s32* bgId) { if ((BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, poly, true, true, true, true, bgId)) && - (!(func_800C9A4C(&play->colCtx, *poly, *bgId) & 0x30))) { + !(SurfaceType_GetWallFlags(&play->colCtx, *poly, *bgId) & (WALL_FLAG_4 | WALL_FLAG_5))) { return true; } diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index bc7841ddc..a57814337 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -358,7 +358,7 @@ void func_80876930(EnDodongo* this, PlayState* play, Vec3f* arg2) { s16 temp2; f32 temp3; - if (func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == COLPOLY_SURFACE_SNOW) { + if (SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == SURFACE_MATERIAL_SNOW) { sp80 = &D_8087932C; sp7C = &D_80879330; } else { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 13075fd55..fd800c27f 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1090,7 +1090,7 @@ void func_8088EFA4(EnElf* this, PlayState* play) { } } else if ((arrayPointerActor != NULL) && (player->targetedActor != NULL)) { u8 temp = this->unk_269; - u16 targetSfxId = this->unk_269 == 0 ? NA_SE_PL_WALK_GROUND - SFX_FLAG : NA_SE_PL_WALK_GROUND - SFX_FLAG; + u16 targetSfxId = (this->unk_269 == 0) ? NA_SE_NONE : NA_SE_NONE; if (!temp) { Actor_PlaySfx(&this->actor, targetSfxId); diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 1fc83d8a1..3d68d34d7 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -500,7 +500,7 @@ void EnFamos_Chase(EnFamos* this, PlayState* play) { this->actor.world.rot.x = -Actor_WorldPitchTowardPoint(&this->actor, &abovePlayerPos); Math_StepToF(&this->actor.speed, 6.0f, 0.5f); - surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = SurfaceType_GetFloorProperty2(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((this->actor.xzDistToPlayer < 30.0f) && (this->actor.floorHeight > BGCHECK_Y_MIN) && // close enough (surfaceType != 0xC && surfaceType != 0xD)) { EnFamos_SetupAttackAim(this); @@ -543,7 +543,7 @@ void EnFamos_Attack(EnFamos* this, PlayState* play) { this->emblemCollider.base.acFlags &= ~AC_ON; } - surfaceType = func_800C9B18(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + surfaceType = SurfaceType_GetFloorProperty2(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); hitFloor = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND; if (hitFloor || (this->actor.floorHeight == BGCHECK_Y_MIN) || (surfaceType == 0xC) || (surfaceType == 0xD)) { this->collider1.base.atFlags &= ~AT_ON; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index af0456d57..e91632700 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -2445,7 +2445,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { sLureRot.x = 0.0f; if (CHECK_BTN_ALL(input->press.button, BTN_B)) { D_809101C0 += 6.0f; - Audio_PlaySfxAtPos(&D_8090D614, NA_SE_PL_WALK_SAND); + Audio_PlaySfxAtPos(&D_8090D614, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND); } } else { if (D_809101C0 > 150.0f) { diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index b429c7e4b..b07d1f2c7 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -1431,7 +1431,7 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { Vec3f sp50; f32 sp4C; s32 sp48 = true; - u32 temp_v0_2; + FloorType floorType; CollisionPoly* tmp; if (!(player->stateFlags1 & @@ -1453,9 +1453,9 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { if (this->actor.flags & ACTOR_FLAG_40) { tmp = this->actor.floorPoly; if (tmp != NULL) { - temp_v0_2 = func_800C99D4(&play->colCtx, tmp, this->actor.floorBgId); + floorType = SurfaceType_GetFloorType(&play->colCtx, tmp, this->actor.floorBgId); - if ((temp_v0_2 == 14) || (temp_v0_2 == 15)) { + if ((floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) { if (!(this->unk_1E5 & 0x40)) { sp50.x = this->actor.world.pos.x; sp50.y = this->actor.floorHeight; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 59fea362a..4b5878110 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3472,7 +3472,7 @@ s32 EnHorse_CalcFloorHeight(EnHorse* this, PlayState* play, Vec3f* pos, Collisio if ((COLPOLY_GET_NORMAL((*polyFloor)->normal.y) < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, *polyFloor, *bgId) || - (func_800C99D4(&play->colCtx, *polyFloor, *bgId) == 7)) { + (SurfaceType_GetFloorType(&play->colCtx, *polyFloor, *bgId) == FLOOR_TYPE_7)) { return 3; // Horse blocked surface } @@ -3619,7 +3619,7 @@ void EnHorse_CheckFloors(EnHorse* this, PlayState* play) { if ((ny < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) || - (func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 7)) { + (SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == FLOOR_TYPE_7)) { if (this->actor.speed >= 0.0f) { EnHorse_ObstructMovement(this, play, 4, galloping); } else { @@ -3891,7 +3891,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { temp_f0 = COLPOLY_GET_NORMAL(obstacleFloor->normal.y); if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || - (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { + (SurfaceType_GetFloorType(&play->colCtx, obstacleFloor, bgId) == FLOOR_TYPE_7)) { if ((Math_CosS(sp7E) < 0.9f) && (movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; @@ -3954,7 +3954,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { temp_f0 = COLPOLY_GET_NORMAL(obstacleFloor->normal.y); if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || - (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { + (SurfaceType_GetFloorType(&play->colCtx, obstacleFloor, bgId) == FLOOR_TYPE_7)) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; @@ -4122,7 +4122,8 @@ s32 EnHorse_UpdateConveyors(EnHorse* this, PlayState* play) { s16 conveyorDir; if ((this->actor.floorPoly == NULL) || (&this->actor != player->rideActor) || - !SurfaceType_GetConveyorSpeed(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { + (SurfaceType_GetConveyorSpeed(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == + CONVEYOR_SPEED_DISABLED)) { return false; } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index e3d183fe4..27c8de507 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -169,12 +169,12 @@ s32 func_808F3178(EnIn* this, PlayState* play) { u8 tmp; this->unk260 = tmp = SubS_IsFloorAbove(play, &this->unk248, -6.0f); - if (this->unk260 != 0 && prevUnk260 == 0 && tmp) { - Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_CONCRETE); + if ((this->unk260 != 0) && (prevUnk260 == 0) && tmp) { + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE); } this->unk261 = tmp = SubS_IsFloorAbove(play, &this->unk254, -6.0f); - if (this->unk261 != 0 && prevUnk261 == 0 && tmp) { - Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_CONCRETE); + if ((this->unk261 != 0) && (prevUnk261 == 0) && tmp) { + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_STONE); } return 0; diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c index 0a9689b17..9777c7433 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -289,11 +289,12 @@ void func_80AD75A8(EnKame* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed >= 3.0f)) { if ((play->gameplayFrames % 2) == 0) { - u32 temp_v0 = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + SurfaceMaterial surfaceMaterial = + SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if ((temp_v0 == 0) || (temp_v0 == 1)) { + if ((surfaceMaterial == SURFACE_MATERIAL_DIRT) || (surfaceMaterial == SURFACE_MATERIAL_SAND)) { func_800B1210(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, 550, 100); - } else if (temp_v0 == 14) { + } else if (surfaceMaterial == SURFACE_MATERIAL_SNOW) { func_800B0DE0(play, &this->actor.world.pos, &D_80AD8E5C, &gZeroVec3f, &D_80AD8E54, &D_80AD8E58, 550, 100); } diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 0390e1459..c4ef32e31 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -209,7 +209,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { Vec3f offset; EnKanban* piece; EnKanban* signpost; - s32 temp_v0_18; + FloorType floorType; f32 phi_f0; s32 pad2; @@ -517,11 +517,11 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { } if (onGround) { - temp_v0_18 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if ((temp_v0_18 == 15) || (temp_v0_18 == 14)) { + if ((floorType == FLOOR_TYPE_15) || (floorType == FLOOR_TYPE_14)) { this->unk_197 = 1; - } else if (temp_v0_18 == 5) { + } else if (floorType == FLOOR_TYPE_5) { this->unk_197 = -1; } @@ -623,7 +623,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play) { if (bounced) { if (this->unk_197 > 0) { - Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_SNOW); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SNOW); } else { Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); } diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index ad25aa70c..3aef8341a 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -149,7 +149,8 @@ void func_80965DB4(EnMm* this, PlayState* play) { temp_f2 = sqrtf(SQ(temp_f14) + SQ(temp_f12)); if ((temp_f2 < this->actor.speed) || - (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1)) { + (SurfaceType_GetFloorEffect(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == + FLOOR_EFFECT_1)) { this->actor.speed = CLAMP_MAX(temp_f2, 16.0f); this->actor.world.rot.y = Math_Atan2S_XY(temp_f12, temp_f14); } diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index 88e69021f..99783d77d 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -1089,8 +1089,9 @@ void func_80A6B0D8(EnMushi2* this, PlayState* play) { s32 sp44 = 0; if (this->poly != NULL) { - u32 temp_v0 = func_800C99D4(&play->colCtx, this->poly, this->polyBgId); - if ((temp_v0 == 5) || (temp_v0 == 14) || (temp_v0 == 15)) { + FloorType floorType = SurfaceType_GetFloorType(&play->colCtx, this->poly, this->polyBgId); + + if ((floorType == FLOOR_TYPE_5) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) { sp44 = 1; } } diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 15e65b6ce..9c6fe4a9d 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -140,11 +140,12 @@ void EnNutsball_Update(Actor* thisx, PlayState* play2) { UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - if (func_800C9A4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId) & 0x30) { + if (SurfaceType_GetWallFlags(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId) & + (WALL_FLAG_4 | WALL_FLAG_5)) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.prevPos, &worldPos, &this->actor.world.pos, &poly, true, false, false, true, &bgId)) { - if (func_800C9A4C(&play->colCtx, poly, bgId) & 0x30) { + if (SurfaceType_GetWallFlags(&play->colCtx, poly, bgId) & (WALL_FLAG_4 | WALL_FLAG_5)) { this->actor.world.pos.x += this->actor.velocity.x * 0.01f; this->actor.world.pos.z += this->actor.velocity.z * 0.01f; } else { diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index 39a240e01..d9c2d61f2 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -355,7 +355,8 @@ s32 EnRat_IsOnCollisionPoly(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* po } if (BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, poly, 1, 1, 1, 1, bgId)) { - if (!(func_800C9A4C(&play->colCtx, *poly, *bgId) & 0x30) && (!isOnWater || (waterSurface <= posResult->y))) { + if (!(SurfaceType_GetWallFlags(&play->colCtx, *poly, *bgId) & (WALL_FLAG_4 | WALL_FLAG_5)) && + (!isOnWater || (waterSurface <= posResult->y))) { return true; } } diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 47d05f8ab..527d41b99 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -138,7 +138,7 @@ s32 EnRu_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) { u8 leftWasGrounded; u8 rightWasGrounded; - s32 waterSfxId; + SurfaceSfxOffset surfaceSfxOffset; s16 sfxId; u8 isFootGrounded; @@ -147,15 +147,16 @@ s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.depthInWater < 20.0f) { - waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW; } else { - waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP; } - sfxId = waterSfxId + SFX_FLAG; + sfxId = NA_SE_PL_WALK_GROUND + surfaceSfxOffset; } else { - sfxId = SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG; + sfxId = NA_SE_PL_WALK_GROUND + + SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); } this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index bcf380cba..f37605707 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -352,7 +352,7 @@ s32 func_808D9440(PlayState* play, Vec3f* posA, Vec3f* posB, Vec3f* posResult, C s32 ret = false; if (BgCheck_EntityLineTest1(&play->colCtx, posA, posB, posResult, outPoly, true, true, true, true, bgId) && - !(func_800C9A4C(&play->colCtx, *outPoly, *bgId) & 0x30)) { + !(SurfaceType_GetWallFlags(&play->colCtx, *outPoly, *bgId) & (WALL_FLAG_4 | WALL_FLAG_5))) { ret = true; } return ret; diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index 7f0a3e971..d98790c6f 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -161,18 +161,18 @@ void EnTest_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnTest* this = THIS; MtxF sp38; - s32 sp34; + s32 bgId; this->unk_209 = 0; this->unk_174 = 0; if (thisx->params > 0) { Actor_SetScale(thisx, thisx->params / 100000.0f); - this->unk_20A = 0; + this->surfaceMaterial = SURFACE_MATERIAL_DIRT; } else { thisx->floorPoly = NULL; thisx->world.pos.y += 10.0f; - thisx->floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, &thisx->floorPoly, &sp34, &thisx->world.pos); + thisx->floorHeight = BgCheck_EntityRaycastFloor3(&play->colCtx, &thisx->floorPoly, &bgId, &thisx->world.pos); if ((thisx->floorPoly == NULL) || (thisx->floorHeight == BGCHECK_Y_MIN)) { Actor_Kill(thisx); @@ -183,7 +183,7 @@ void EnTest_Init(Actor* thisx, PlayState* play2) { func_800C0094(thisx->floorPoly, thisx->world.pos.x, thisx->floorHeight, thisx->world.pos.z, &sp38); Matrix_MtxFToYXZRot(&sp38, &thisx->shape.rot, true); thisx->world.rot = thisx->shape.rot; - this->unk_20A = func_800C9BB8(&play->colCtx, thisx->floorPoly, sp34); + this->surfaceMaterial = SurfaceType_GetMaterial(&play->colCtx, thisx->floorPoly, bgId); } func_80183430(&this->skeletonInfo, &gameplay_keep_Blob_06EB70, &gameplay_keep_Blob_06BB0C, this->unk_178, @@ -257,7 +257,8 @@ void EnTest_Draw(Actor* thisx, PlayState* play) { sp2C = 29; } - if ((this->unk_20A == 15) || (this->unk_20A == 14)) { + //! @bug Checks for non-existent SURFACE_MATERIAL_MAX material + if ((this->surfaceMaterial == SURFACE_MATERIAL_MAX) || (this->surfaceMaterial == SURFACE_MATERIAL_SNOW)) { AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B730), sp2C); } else { AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_06B6A0), sp2C); diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.h b/src/overlays/actors/ovl_En_Test/z_en_test.h index 2b8d62993..68395a96a 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.h +++ b/src/overlays/actors/ovl_En_Test/z_en_test.h @@ -24,7 +24,7 @@ typedef struct EnTest { /* 0x1C0 */ Vec3s unk_1C0[12]; /* 0x208 */ u8 unk_208; /* 0x209 */ u8 unk_209; - /* 0x20A */ u8 unk_20A; + /* 0x20A */ u8 surfaceMaterial; /* 0x20C */ EnTestStruct unk_20C[20]; } EnTest; // size = 0x6BC diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 5b77c1399..3d5c7a741 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -197,7 +197,7 @@ void func_80893A18(EnTite* this) { s32 func_80893A34(EnTite* this, PlayState* play) { if ((this->actor.params == ENTITE_MINUS_2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - (func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 5)) { + (SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == FLOOR_TYPE_5)) { return true; } return false; @@ -240,13 +240,14 @@ void func_80893BCC(EnTite* this, PlayState* play) { s32 j; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - u32 surface = func_800C9BB8(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + SurfaceMaterial surfaceMaterial = + SurfaceType_GetMaterial(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if ((surface == COLPOLY_SURFACE_GROUND) || (surface == COLPOLY_SURFACE_SAND)) { + if ((surfaceMaterial == SURFACE_MATERIAL_DIRT) || (surfaceMaterial == SURFACE_MATERIAL_SAND)) { for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { func_800BBFB0(play, &this->limbPos[i], 1.0f, 2, 80, 15, 1); } - } else if (surface == COLPOLY_SURFACE_SNOW) { + } else if (surfaceMaterial == SURFACE_MATERIAL_SNOW) { Vec3f* ptr; for (i = 5; i < ARRAY_COUNT(this->limbPos); i++) { diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 849214aba..91fd66635 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -1035,13 +1035,13 @@ s32 func_80AEE86C(EnTk* this, PlayState* play) { s32 pad; s32 ret = false; s32 pad2; - CollisionPoly* sp38; - s32 sp34; + CollisionPoly* groundPoly; + s32 bgId; Vec3f sp28; Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &D_80AEFA78, &sp28); - if ((BgCheck_EntityRaycastFloor3(&play->colCtx, &sp38, &sp34, &sp28) != BGCHECK_Y_MIN) && - (func_800C9BB8(&play->colCtx, sp38, sp34) == 1) && (this->unk_2D0 == (u32)1) && + if ((BgCheck_EntityRaycastFloor3(&play->colCtx, &groundPoly, &bgId, &sp28) != BGCHECK_Y_MIN) && + (SurfaceType_GetMaterial(&play->colCtx, groundPoly, bgId) == SURFACE_MATERIAL_SAND) && (this->unk_2D0 == 1) && (this->actor.xyzDistToPlayerSq <= SQ(115.0f)) && func_80AEE7E0(&this->actor.world.pos, 100.0f, this->unk_324, this->unk_36C) && (((this->unk_2CA & 2) && (Math_Vec3f_DistXZ(&this->unk_300, &sp28) >= 100.0f)) || !(this->unk_2CA & 2)) && @@ -1312,7 +1312,8 @@ void EnTk_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); - if ((this->unk_2B0 == 0) && (func_800C9B40(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 12)) { + if ((this->unk_2B0 == 0) && (SurfaceType_GetFloorProperty(&play->colCtx, this->actor.floorPoly, + this->actor.floorBgId) == FLOOR_PROPERTY_12)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); this->unk_2CA |= 0x200; this->actor.velocity.y = 0.0f; diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 7d38f370f..44a50e99d 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -471,14 +471,15 @@ void func_80990C6C(EnWf* this, PlayState* play, s32 arg2) { static Color_RGBA8 D_809942EC = { 255, 255, 255, 255 }; s32 i; Vec3f sp88; - u32 temp_v0; + FloorType floorType; Color_RGBA8* phi_s1; s16 phi_s6; if (this->actor.floorPoly != NULL) { - temp_v0 = func_800C99D4(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); - if (temp_v0 != 5) { - if ((temp_v0 == 15) || (temp_v0 == 14)) { + floorType = SurfaceType_GetFloorType(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); + + if (floorType != FLOOR_TYPE_5) { + if ((floorType == FLOOR_TYPE_15) || (floorType == FLOOR_TYPE_14)) { phi_s1 = &D_809942EC; phi_s6 = Rand_ZeroFloat(150.0f) + 350.0f; arg2 += 2; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index aed16b874..7a160e368 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -122,7 +122,7 @@ s32 EnZo_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) { u8 leftWasGrounded; u8 rightWasGrounded; - s32 waterSfxId; + SurfaceSfxOffset surfaceSfxOffset; u16 sfxId; u8 isFootGrounded; @@ -131,13 +131,14 @@ s32 EnZo_PlayWalkingSound(EnZo* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.depthInWater < 20.0f) { - waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_SHALLOW; } else { - waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + surfaceSfxOffset = SURFACE_SFX_OFFSET_WATER_DEEP; } - sfxId = waterSfxId + SFX_FLAG; + sfxId = NA_SE_PL_WALK_GROUND + surfaceSfxOffset; } else { - sfxId = SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG; + sfxId = NA_SE_PL_WALK_GROUND + + SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); } this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 349724cb3..fe5c1cd62 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -781,15 +781,15 @@ void func_80B94A00(EnZog* this, PlayState* play) { if ((this->unk_304 == 4) && (Animation_OnFrame(&this->skelAnime, 136.0f) || Animation_OnFrame(&this->skelAnime, 155.0f))) { - Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER0); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WATER_SHALLOW); } if ((this->unk_304 == 5) && (Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 37.0f))) { if (this->actor.depthInWater > 0.0f) { - Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_WATER0); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_WATER_SHALLOW); } else { - Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_SAND); + Actor_PlaySfx(&this->actor, NA_SE_PL_WALK_GROUND + SURFACE_SFX_OFFSET_SAND); } } } diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 85b23d232..8aa23816d 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -629,7 +629,8 @@ s32 func_80A24954(ObjIceblock* this, PlayState* play) { func_80A262BC(this); this->unk_2B0 = 3; } else if (this->unk_1B0 & 4) { - if (func_800C99D4(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 5) { + if (SurfaceType_GetFloorType(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == + FLOOR_TYPE_5) { func_80A25FA0(this); this->unk_2B0 = 2; } else { diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index 1f42807c2..bf20758ca 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -4,7 +4,6 @@ * Description: Sakon's Hideout Objects (Sun's Mask, doors, etc) */ -#include "prevent_bss_reordering.h" #include "z_obj_nozoki.h" #include "objects/object_secom_obj/object_secom_obj.h" diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 582d43f02..3038a6d09 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -554,9 +554,9 @@ void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) { ObjOshihiki_SetupOnActor(this, play); } Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); - Actor_PlaySfx(&this->dyna.actor, SurfaceType_GetSfx(&play->colCtx, this->floorPolys[this->highestFloor], - this->floorBgIds[this->highestFloor]) + - SFX_FLAG); + Actor_PlaySfx(&this->dyna.actor, NA_SE_PL_WALK_GROUND + SurfaceType_GetSfxOffset( + &play->colCtx, this->floorPolys[this->highestFloor], + this->floorBgIds[this->highestFloor])); } } diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c index 374a2f520..80e9b1201 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c @@ -614,7 +614,8 @@ void func_80A2264C(ObjSkateblock* this, PlayState* play) { sp20 = func_80A21548(this, play); if (sp20 || ((this->unk_160 - this->dyna.actor.world.pos.y) > 300.0f)) { - if (func_800C9B40(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == 12) { + if (SurfaceType_GetFloorProperty(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == + FLOOR_PROPERTY_12) { func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; func_80A22728(this); diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index a3d203992..681aac01d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -22,7 +22,11 @@ EffectSsInit Effect_Ss_Bubble_InitVars = { EffectSsBubble_Init, }; -static f32 sVecAdjMaximums[] = { 291.0f, 582.0f, 1600.0f }; +static f32 sVecAdjMaximums[] = { + 291.0f, // CONVEYOR_SPEED_SLOW + 582.0f, // CONVEYOR_SPEED_MEDIUM + 1600.0f, // CONVEYOR_SPEED_FAST +}; u32 EffectSsBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsBubbleInitParams* initParams = (EffectSsBubbleInitParams*)initParamsx; @@ -85,17 +89,18 @@ void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this) { } if (((play->gameplayFrames + index) % 8) == 0) { CollisionPoly* colPoly; - u32 speed; - s16 direction; + ConveyorSpeed conveyorSpeed; + s16 conveyorDir; f32 rVecAdjMax; BgCheck_EntityRaycastFloor2_1(play, &play->colCtx, &colPoly, &this->pos); - speed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE); - if ((speed != 0) && !SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) { - direction = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 0xA; - rVecAdjMax = sVecAdjMaximums[speed - 1]; - this->rVecAdjX = Math_SinS(direction) * rVecAdjMax; - this->rVecAdjZ = Math_CosS(direction) * rVecAdjMax; + conveyorSpeed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE); + if ((conveyorSpeed != CONVEYOR_SPEED_DISABLED) && + !SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) { + conveyorDir = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 10; + rVecAdjMax = sVecAdjMaximums[conveyorSpeed - 1]; + this->rVecAdjX = Math_SinS(conveyorDir) * rVecAdjMax; + this->rVecAdjZ = Math_CosS(conveyorDir) * rVecAdjMax; } } this->vec.x += this->rVecAdjX / 100.0f; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index aa6770307..ae80bd5e1 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1055,21 +1055,21 @@ 0x800C98CC:("BgCheck_GetBgCamFuncDataImpl",), 0x800C9924:("BgCheck_GetBgCamFuncData",), 0x800C99AC:("SurfaceType_GetSceneExitIndex",), - 0x800C99D4:("func_800C99D4",), + 0x800C99D4:("SurfaceType_GetFloorType",), 0x800C99FC:("func_800C99FC",), - 0x800C9A24:("func_800C9A24",), - 0x800C9A4C:("func_800C9A4C",), - 0x800C9A7C:("func_800C9A7C",), - 0x800C9AB0:("func_800C9AB0",), - 0x800C9AE4:("func_800C9AE4",), - 0x800C9B18:("func_800C9B18",), - 0x800C9B40:("func_800C9B40",), - 0x800C9B68:("func_800C9B68",), + 0x800C9A24:("SurfaceType_GetWallType",), + 0x800C9A4C:("SurfaceType_GetWallFlags",), + 0x800C9A7C:("SurfaceType_CheckWallFlag0",), + 0x800C9AB0:("SurfaceType_CheckWallFlag1",), + 0x800C9AE4:("SurfaceType_CheckWallFlag2",), + 0x800C9B18:("SurfaceType_GetFloorProperty2",), + 0x800C9B40:("SurfaceType_GetFloorProperty",), + 0x800C9B68:("SurfaceType_IsSoft",), 0x800C9B90:("SurfaceType_IsHorseBlocked",), - 0x800C9BB8:("func_800C9BB8",), - 0x800C9BDC:("SurfaceType_GetSfx",), - 0x800C9C24:("func_800C9C24",), - 0x800C9C74:("SurfaceType_GetSlope",), + 0x800C9BB8:("SurfaceType_GetMaterial",), + 0x800C9BDC:("SurfaceType_GetSfxOffset",), + 0x800C9C24:("SurfaceType_HasMaterialProperty",), + 0x800C9C74:("SurfaceType_GetFloorEffect",), 0x800C9C9C:("SurfaceType_GetLightSettingIndex",), 0x800C9CC4:("SurfaceType_GetEcho",), 0x800C9CEC:("SurfaceType_IsHookshotSurface",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 4dab18e3b..6e83a53e8 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -451,6 +451,11 @@ 0x801AEFC0:("D_801AEFC0","UNK_TYPE1","",0x1), 0x801AEFD0:("gActorOverlayTable","ActorOverlay","[ACTOR_ID_MAX]",0x5640), 0x801B4610:("gMaxActorId","s32","",0x4), + 0x801B4620:("sWallFlags","u32","",0x80), + 0x801B46A0:("sSurfaceSfxOffsets","u16","",0x1E), + 0x801B46C0:("sSurfaceMaterialProperties","u8","",0xF), + 0x801B46D0:("sSmallMemSceneIds","s16","",0x2), + 0x801B46D4:("sSceneMemList","BgCheckSceneMemEntry","",0x8), 0x801B46DC:("sSceneSubdivisionList","BgCheckSceneSubdivisionEntry","[3]",0x24), 0x801B4700:("sCustomDynapolyMem","BgSpecialSceneMaxObjects","[1]",0x8), 0x801B4708:("D_801B4708","UNK_TYPE1","",0x1), diff --git a/tools/namefixer.py b/tools/namefixer.py index 1c38d8359..bb22b1fca 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -461,9 +461,19 @@ wordReplace = { "func_800C9704": "SurfaceType_GetBgCamIndex", "func_800C9924": "BgCheck_GetBgCamFuncData", "func_800C99AC": "SurfaceType_GetSceneExitIndex", + "func_800C99D4": "SurfaceType_GetFloorType", + "func_800C9A24": "SurfaceType_GetWallType", + "func_800C9A4C": "SurfaceType_GetWallFlags", + "func_800C9A7C": "SurfaceType_CheckWallFlag0", + "func_800C9AB0": "SurfaceType_CheckWallFlag1", + "func_800C9AE4": "SurfaceType_CheckWallFlag2", + "func_800C9B18": "SurfaceType_GetFloorProperty2", + "func_800C9B40": "SurfaceType_GetFloorProperty", + "func_800C9BB8": "SurfaceType_GetMaterial", "func_800C9B90": "SurfaceType_IsHorseBlocked", - "func_800C9BDC": "SurfaceType_GetSfx", - "func_800C9C74": "SurfaceType_GetSlope", + "func_800C9BDC": "SurfaceType_GetSfxOffset", + "SurfaceType_GetSfx": "SurfaceType_GetSfxOffset", + "func_800C9C74": "SurfaceType_GetFloorEffect", "func_800C9C9C": "SurfaceType_GetLightSettingIndex", "func_800C9CC4": "SurfaceType_GetEcho", "func_800C9CEC": "SurfaceType_IsHookshotSurface", @@ -923,6 +933,11 @@ wordReplace = { "TRANS_TYPE_20": "TRANS_TYPE_FADE_DYNAMIC", "TRANS_TYPE_21": "TRANS_TYPE_CIRCLE", "TRANS_TYPE_22": "TRANS_TYPE_WIPE5", + + "COLPOLY_SURFACE_GROUND": "SURFACE_MATERIAL_DIRT", + "COLPOLY_SURFACE_SAND": "SURFACE_MATERIAL_SAND", + "COLPOLY_SURFACE_SNOW": "SURFACE_MATERIAL_SNOW", + # Example of custom behaviour: # "PLAYER": ("GET_PLAYER(play)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames } diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index a18086d38..353a7f394 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -569,21 +569,21 @@ asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamCount.s,BgCheck_GetBgCamCount,0 asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamFuncDataImpl.s,BgCheck_GetBgCamFuncDataImpl,0x800C98CC,0x16 asm/non_matchings/code/z_bgcheck/BgCheck_GetBgCamFuncData.s,BgCheck_GetBgCamFuncData,0x800C9924,0x22 asm/non_matchings/code/z_bgcheck/SurfaceType_GetSceneExitIndex.s,SurfaceType_GetSceneExitIndex,0x800C99AC,0xA -asm/non_matchings/code/z_bgcheck/func_800C99D4.s,func_800C99D4,0x800C99D4,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetFloorType.s,SurfaceType_GetFloorType,0x800C99D4,0xA asm/non_matchings/code/z_bgcheck/func_800C99FC.s,func_800C99FC,0x800C99FC,0xA -asm/non_matchings/code/z_bgcheck/func_800C9A24.s,func_800C9A24,0x800C9A24,0xA -asm/non_matchings/code/z_bgcheck/func_800C9A4C.s,func_800C9A4C,0x800C9A4C,0xC -asm/non_matchings/code/z_bgcheck/func_800C9A7C.s,func_800C9A7C,0x800C9A7C,0xD -asm/non_matchings/code/z_bgcheck/func_800C9AB0.s,func_800C9AB0,0x800C9AB0,0xD -asm/non_matchings/code/z_bgcheck/func_800C9AE4.s,func_800C9AE4,0x800C9AE4,0xD -asm/non_matchings/code/z_bgcheck/func_800C9B18.s,func_800C9B18,0x800C9B18,0xA -asm/non_matchings/code/z_bgcheck/func_800C9B40.s,func_800C9B40,0x800C9B40,0xA -asm/non_matchings/code/z_bgcheck/func_800C9B68.s,func_800C9B68,0x800C9B68,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetWallType.s,SurfaceType_GetWallType,0x800C9A24,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetWallFlags.s,SurfaceType_GetWallFlags,0x800C9A4C,0xC +asm/non_matchings/code/z_bgcheck/SurfaceType_CheckWallFlag0.s,SurfaceType_CheckWallFlag0,0x800C9A7C,0xD +asm/non_matchings/code/z_bgcheck/SurfaceType_CheckWallFlag1.s,SurfaceType_CheckWallFlag1,0x800C9AB0,0xD +asm/non_matchings/code/z_bgcheck/SurfaceType_CheckWallFlag2.s,SurfaceType_CheckWallFlag2,0x800C9AE4,0xD +asm/non_matchings/code/z_bgcheck/SurfaceType_GetFloorProperty2.s,SurfaceType_GetFloorProperty2,0x800C9B18,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetFloorProperty.s,SurfaceType_GetFloorProperty,0x800C9B40,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_IsSoft.s,SurfaceType_IsSoft,0x800C9B68,0xA asm/non_matchings/code/z_bgcheck/SurfaceType_IsHorseBlocked.s,SurfaceType_IsHorseBlocked,0x800C9B90,0xA -asm/non_matchings/code/z_bgcheck/func_800C9BB8.s,func_800C9BB8,0x800C9BB8,0x9 -asm/non_matchings/code/z_bgcheck/SurfaceType_GetSfx.s,SurfaceType_GetSfx,0x800C9BDC,0x12 -asm/non_matchings/code/z_bgcheck/func_800C9C24.s,func_800C9C24,0x800C9C24,0x14 -asm/non_matchings/code/z_bgcheck/SurfaceType_GetSlope.s,SurfaceType_GetSlope,0x800C9C74,0xA +asm/non_matchings/code/z_bgcheck/SurfaceType_GetMaterial.s,SurfaceType_GetMaterial,0x800C9BB8,0x9 +asm/non_matchings/code/z_bgcheck/SurfaceType_GetSfxOffset.s,SurfaceType_GetSfxOffset,0x800C9BDC,0x12 +asm/non_matchings/code/z_bgcheck/SurfaceType_HasMaterialProperty.s,SurfaceType_HasMaterialProperty,0x800C9C24,0x14 +asm/non_matchings/code/z_bgcheck/SurfaceType_GetFloorEffect.s,SurfaceType_GetFloorEffect,0x800C9C74,0xA asm/non_matchings/code/z_bgcheck/SurfaceType_GetLightSettingIndex.s,SurfaceType_GetLightSettingIndex,0x800C9C9C,0xA asm/non_matchings/code/z_bgcheck/SurfaceType_GetEcho.s,SurfaceType_GetEcho,0x800C9CC4,0xA asm/non_matchings/code/z_bgcheck/SurfaceType_IsHookshotSurface.s,SurfaceType_IsHookshotSurface,0x800C9CEC,0xA From b8af819165ea4f31f34940d59a13ef19a5aabd2f Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 19 Apr 2023 08:36:53 +1000 Subject: [PATCH 23/29] DynaPoly Docs Pass (#1194) * dyna docs * init flags * more docs * cleanup * partial PR review * another bracket * hold to press * PR cleanup --- include/functions.h | 36 +++--- include/z64actor.h | 22 ++-- include/z64bgcheck.h | 28 +++-- src/code/z_actor.c | 10 +- src/code/z_bg_collect.c | 107 ++++++++++-------- src/code/z_bg_item.c | 72 ++++++------ src/code/z_bgcheck.c | 95 ++++++++-------- src/code/z_player_call.c | 2 +- .../ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c | 4 +- .../ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c | 2 +- .../ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c | 13 ++- .../ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c | 2 +- .../ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c | 14 +-- .../ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h | 4 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 2 +- .../ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c | 2 +- .../actors/ovl_Bg_F40_Block/z_bg_f40_block.c | 2 +- .../actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c | 6 +- .../ovl_Bg_F40_Switch/z_bg_f40_switch.c | 4 +- .../actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c | 2 +- .../actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c | 2 +- .../actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c | 2 +- .../ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c | 2 +- .../ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c | 2 +- .../actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c | 2 +- .../z_bg_hakugin_bombwall.c | 4 +- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c | 2 +- .../z_bg_hakugin_switch.c | 14 +-- .../actors/ovl_Bg_Icicle/z_bg_icicle.c | 6 +- .../ovl_Bg_Ikana_Block/z_bg_ikana_block.c | 6 +- .../z_bg_ikana_bombwall.c | 2 +- .../z_bg_ikana_rotaryroom.c | 2 +- .../ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c | 6 +- .../actors/ovl_Bg_Ikninside/z_bg_ikninside.c | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 4 +- .../ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c | 2 +- .../ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c | 2 +- .../ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c | 4 +- .../ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c | 2 +- .../actors/ovl_Bg_Ladder/z_bg_ladder.c | 4 +- .../ovl_Bg_Last_Bwall/z_bg_last_bwall.c | 4 +- .../actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c | 2 +- .../actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c | 10 +- .../ovl_Bg_Open_Shutter/z_bg_open_shutter.c | 2 +- .../actors/ovl_Bg_Spdweb/z_bg_spdweb.c | 9 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 4 +- .../actors/ovl_Dm_Char01/z_dm_char01.c | 8 +- .../actors/ovl_Dm_Char08/z_dm_char08.c | 14 +-- .../actors/ovl_Dm_Statue/z_dm_statue.c | 2 +- src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 2 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 12 +- src/overlays/actors/ovl_En_Dnb/z_en_dnb.c | 2 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- .../actors/ovl_En_Fu_Kago/z_en_fu_kago.c | 4 +- .../actors/ovl_En_Fu_Mato/z_en_fu_mato.c | 2 +- .../actors/ovl_En_Mushi2/z_en_mushi2.c | 2 +- src/overlays/actors/ovl_En_Raf/z_en_raf.c | 4 +- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 2 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 11 +- src/overlays/actors/ovl_En_Twig/z_en_twig.c | 15 ++- .../actors/ovl_Obj_Armos/z_obj_armos.c | 2 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 18 +-- src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c | 8 +- .../actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c | 2 +- .../ovl_Obj_Danpeilift/z_obj_danpeilift.c | 22 ++-- .../ovl_Obj_Danpeilift/z_obj_danpeilift.h | 6 +- .../actors/ovl_Obj_Dhouse/z_obj_dhouse.c | 2 +- .../actors/ovl_Obj_Driftice/z_obj_driftice.c | 6 +- .../actors/ovl_Obj_Etcetera/z_obj_etcetera.c | 10 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 2 +- .../actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c | 4 +- .../actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c | 2 +- .../actors/ovl_Obj_HsStump/z_obj_hsstump.c | 11 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.c | 6 +- .../actors/ovl_Obj_Iceblock/z_obj_iceblock.c | 8 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 4 +- .../actors/ovl_Obj_Kibako2/z_obj_kibako2.c | 2 +- .../actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c | 2 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 8 +- .../ovl_Obj_Lightblock/z_obj_lightblock.c | 2 +- .../ovl_Obj_Lupygamelift/z_obj_lupygamelift.c | 2 +- .../ovl_Obj_Ocarinalift/z_obj_ocarinalift.c | 10 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 12 +- .../actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c | 2 +- .../actors/ovl_Obj_Raillift/z_obj_raillift.c | 26 ++--- .../actors/ovl_Obj_Raillift/z_obj_raillift.h | 6 +- .../actors/ovl_Obj_Rotlift/z_obj_rotlift.c | 2 +- .../ovl_Obj_Skateblock/z_obj_skateblock.c | 10 +- .../ovl_Obj_Spidertent/z_obj_spidertent.c | 2 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 28 ++--- src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c | 2 +- .../ovl_Obj_Tokei_Step/z_obj_tokei_step.c | 2 +- src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c | 2 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 6 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 4 +- .../actors/ovl_Obj_Y2lift/z_obj_y2lift.c | 10 +- tools/disasm/functions.txt | 54 ++++----- tools/namefixer.py | 23 +++- tools/sizes/code_functions.csv | 26 ++--- 101 files changed, 515 insertions(+), 459 deletions(-) diff --git a/include/functions.h b/include/functions.h index ac6ad65dd..3850ab42e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -776,25 +776,25 @@ void* ActorOverlayTable_FaultAddrConv(void* address, void* param); void ActorOverlayTable_Init(void); void ActorOverlayTable_Cleanup(void); -void BgCheck2_UpdateActorPosition(CollisionContext* colCtx, s32 bgId, Actor* actor); -void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 bgId, Actor* actor); -void BgCheck2_AttachToMesh(CollisionContext* colCtx, Actor* actor, s32 bgId); -u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* colCtx, s32 bgId, Actor* actor); -void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags); +void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Actor* carriedActor); +void DynaPolyActor_UpdateCarriedActorRotY(CollisionContext* colCtx, s32 bgId, Actor* carriedActor); +void DynaPolyActor_AttachCarriedActor(CollisionContext* colCtx, Actor* carriedActor, s32 bgId); +u32 DynaPolyActor_TransformCarriedActor(CollisionContext* colCtx, s32 bgId, Actor* carriedActor); +void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 transformFlags); void DynaPolyActor_LoadMesh(PlayState* play, DynaPolyActor* dynaActor, CollisionHeader* meshHeader); -void DynaPolyActor_ResetState(DynaPolyActor* dynaActor); -void DynaPolyActor_SetRidingFallingState(DynaPolyActor* dynaActor); -void DynaPolyActor_SetRidingMovingState(DynaPolyActor* dynaActor); -void DynaPolyActor_SetRidingMovingStateByIndex(CollisionContext* colCtx, s32 bgId); -void DynaPolyActor_SetRidingRotatingState(DynaPolyActor* dynaActor); -void DynaPolyActor_SetRidingRotatingStateByIndex(CollisionContext* colCtx, s32 bgId); -void DynaPolyActor_SetSwitchPressedState(DynaPolyActor* dynaActor); -void DynaPolyActor_SetHeavySwitchPressedState(DynaPolyActor* dynaActor); -s32 DynaPolyActor_IsInRidingFallingState(DynaPolyActor* dynaActor); -s32 DynaPolyActor_IsInRidingMovingState(DynaPolyActor* dynaActor); -s32 DynaPolyActor_IsInRidingRotatingState(DynaPolyActor* dynaActor); -s32 DynaPolyActor_IsInSwitchPressedState(DynaPolyActor* dynaActor); -s32 DynaPolyActor_IsInHeavySwitchPressedState(DynaPolyActor* dynaActor); +void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor); +void DynaPolyActor_SetActorOnTop(DynaPolyActor* dynaActor); +void DynaPolyActor_SetPlayerOnTop(DynaPolyActor* dynaActor); +void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 bgId); +void DynaPolyActor_SetPlayerAbove(DynaPolyActor* dynaActor); +void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 bgId); +void DynaPolyActor_SetActorOnSwitch(DynaPolyActor* dynaActor); +void DynaPolyActor_SetActorOnHeavySwitch(DynaPolyActor* dynaActor); +s32 DynaPolyActor_IsActorOnTop(DynaPolyActor* dynaActor); +s32 DynaPolyActor_IsPlayerOnTop(DynaPolyActor* dynaActor); +s32 DynaPolyActor_IsPlayerAbove(DynaPolyActor* dynaActor); +s32 DynaPolyActor_IsSwitchPressed(DynaPolyActor* dynaActor); +s32 DynaPolyActor_IsHeavySwitchPressed(DynaPolyActor* dynaActor); s32 DynaPolyActor_ValidateMove(PlayState* play, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius, s16 startHeight); Camera* Camera_Alloc(View* view, CollisionContext* bg, PlayState* play); diff --git a/include/z64actor.h b/include/z64actor.h index 5e9c35cf4..bfce67188 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -229,15 +229,23 @@ typedef enum { /* 1 */ FOOT_RIGHT } ActorFootIndex; +#define DYNA_TRANSFORM_POS (1 << 0) // Position of the actors on top follows the dynapoly actor's movement. +#define DYNA_TRANSFORM_ROT_Y (1 << 1) // The Y rotation of the actors on top follows the dynapoly actor's Y rotation. + +#define DYNA_INTERACT_ACTOR_ON_TOP (1 << 0) // There is an actor standing on the collision of the dynapoly actor +#define DYNA_INTERACT_PLAYER_ON_TOP (1 << 1) // The player actor is standing on the collision of the dynapoly actor +#define DYNA_INTERACT_PLAYER_ABOVE (1 << 2) // The player is directly above the collision of the dynapoly actor (any distance above) +#define DYNA_INTERACT_ACTOR_ON_SWITCH (1 << 3) // Like the ACTOR_ON_TOP flag but only actors with ACTOR_FLAG_CAN_PRESS_SWITCH +#define DYNA_INTERACT_ACTOR_ON_HEAVY_SWITCH (1 << 4) // Like the ACTOR_ON_TOP flag but only actors with ACTOR_FLAG_CAN_PRESS_HEAVY_SWITCH + typedef struct { /* 0x000 */ Actor actor; /* 0x144 */ s32 bgId; /* 0x148 */ f32 pushForce; /* 0x14C */ f32 unk14C; /* 0x150 */ s16 yRotation; - /* 0x154 */ u32 flags; - /* 0x158 */ u8 stateFlags; - /* 0x15A */ s16 pad15A; + /* 0x154 */ u32 transformFlags; + /* 0x158 */ u8 interactFlags; } DynaPolyActor; // size = 0x15C @@ -528,8 +536,8 @@ typedef enum { #define ACTOR_FLAG_8000 (1 << 15) // #define ACTOR_FLAG_10000 (1 << 16) -// -#define ACTOR_FLAG_20000 (1 << 17) +// actor can press and hold down heavy switches +#define ACTOR_FLAG_CAN_PRESS_HEAVY_SWITCH (1 << 17) // #define ACTOR_FLAG_40000 (1 << 18) // @@ -546,8 +554,8 @@ typedef enum { #define ACTOR_FLAG_1000000 (1 << 24) // #define ACTOR_FLAG_2000000 (1 << 25) -// -#define ACTOR_FLAG_4000000 (1 << 26) +// actor can press and hold down switches +#define ACTOR_FLAG_CAN_PRESS_SWITCH (1 << 26) // Prevents locking on with Z targeting an actor even if Tatl is floating over it #define ACTOR_FLAG_CANT_LOCK_ON (1 << 27) // diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index c6210b2c1..a5effefca 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -314,10 +314,16 @@ typedef struct { /* 0x60 */ f32 maxY; } BgActor; // size = 0x64 +#define BGACTOR_IN_USE (1 << 0) // The bgActor entry is in use +#define BGACTOR_1 (1 << 1) +#define BGACTOR_COLLISION_DISABLED (1 << 2) // The collision of the bgActor is disabled +#define BGACTOR_CEILING_COLLISION_DISABLED (1 << 3) // The ceiling collision of the bgActor is ignored +#define BGACTOR_FLOOR_COLLISION_DISABLED (1 << 5) // The floor collision of the bgActor is ignored + typedef struct { /* 0x0000 */ u8 bitFlag; /* 0x0004 */ BgActor bgActors[BG_ACTOR_MAX]; - /* 0x138C */ u16 bgActorFlags[BG_ACTOR_MAX]; // bit 0 - Is mesh active + /* 0x138C */ u16 bgActorFlags[BG_ACTOR_MAX]; /* 0x13F0 */ CollisionPoly* polyList; /* 0x13F4 */ Vec3s* vtxList; /* 0x13F8 */ DynaWaterBoxList waterBoxList; @@ -521,18 +527,18 @@ void DynaPoly_Init(struct PlayState* play, DynaCollisionContext* dyna); void DynaPoly_Alloc(struct PlayState* play, DynaCollisionContext* dyna); s32 DynaPoly_SetBgActor(struct PlayState* play, DynaCollisionContext* dyna, Actor* actor, CollisionHeader* colHeader); DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId); -void func_800C62BC(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C6314(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C636C(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C63C4(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C641C(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C6474(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); -void func_800C6554(struct PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_DisableCollision(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void DynaPoly_EnableCollision(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void DynaPoly_DisableCeilingCollision(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void DynaPoly_EnableCeilingCollision(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void DynaPoly_DisableFloorCollision(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void DynaPoly_EnableFloorCollision(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); +void DynaPoly_InvalidateLookup(struct PlayState* play, DynaCollisionContext* dyna); void DynaPoly_DeleteBgActor(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId); void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPos, Vec3s* minPosOut, s16* xLength, s16* zLength); -void DynaPoly_ExpandSRT(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, s32* waterBoxStartIndex); -void BgCheck_ResetFlagsIfLoadedActor(struct PlayState* play, DynaCollisionContext* dyna, Actor* actor); -void DynaPoly_Setup(struct PlayState* play, DynaCollisionContext* dyna); +void DynaPoly_AddBgActorToLookup(struct PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, s32* waterBoxStartIndex); +void DynaPoly_UnsetAllInteractFlags(struct PlayState* play, DynaCollisionContext* dyna, Actor* actor); +void DynaPoly_UpdateContext(struct PlayState* play, DynaCollisionContext* dyna); void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertices, s32* numWaterBoxes); void DynaPoly_UpdateBgActorTransforms(struct PlayState* play, DynaCollisionContext* dyna); void CollisionHeader_SegmentedToVirtual(CollisionHeader* colHeader); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index b58f6700a..44d9053ec 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1559,7 +1559,7 @@ s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 updBgCheckInfoF } actor->bgCheckFlags |= BGCHECKFLAG_GROUND; - BgCheck2_AttachToMesh(&play->colCtx, actor, (s32)actor->floorBgId); + DynaPolyActor_AttachCarriedActor(&play->colCtx, actor, actor->floorBgId); } } else { return func_800B761C(actor, distToFloor, updBgCheckInfoFlags); @@ -1575,7 +1575,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, Vec3f pos; if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { - BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, actor->floorBgId, actor); + DynaPolyActor_TransformCarriedActor(&play->colCtx, actor->floorBgId, actor); } if (updBgCheckInfoFlags & UPDBGCHECKINFO_FLAG_1) { @@ -2426,7 +2426,7 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) { } actor->update(actor, play); - BgCheck_ResetFlagsIfLoadedActor(play, &play->colCtx.dyna, actor); + DynaPoly_UnsetAllInteractFlags(play, &play->colCtx.dyna, actor); } CollisionCheck_ResetDamage(&actor->colChkInfo); @@ -2516,7 +2516,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } if (i == ACTORCAT_BG) { - DynaPoly_Setup(play, &play->colCtx.dyna); + DynaPoly_UpdateContext(play, &play->colCtx.dyna); } } @@ -3395,7 +3395,7 @@ void func_800BB604(GameState* gameState, ActorContext* actorCtx, Player* player, if ((actor != targetedActor) || (actor->flags & ACTOR_FLAG_80000)) { temp_f0_2 = func_800B82EC(actor, player, D_801ED8DC); - phi_s2_2 = (actor->flags & 1) != 0; + phi_s2_2 = (actor->flags & ACTOR_FLAG_1) != 0; if (phi_s2_2) { phi_s2_2 = temp_f0_2 < D_801ED8C8; } diff --git a/src/code/z_bg_collect.c b/src/code/z_bg_collect.c index 0d4f4a21f..b0c0971ea 100644 --- a/src/code/z_bg_collect.c +++ b/src/code/z_bg_collect.c @@ -1,103 +1,116 @@ #include "global.h" -void BgCheck2_UpdateActorPosition(CollisionContext* colCtx, s32 bgId, Actor* actor) { - MtxF prevMatrix; - MtxF prevMatrixInv; - MtxF currMatrix; - Vec3f newPos; - Vec3f posWithInv; +/** + * Update the `carriedActor`'s position based on the dynapoly actor identified by `bgId`. + */ +void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) { + MtxF prevTransform; + MtxF prevTransformInv; + MtxF curTransform; + Vec3f pos; + Vec3f tempPos; if (!DynaPoly_IsBgIdBgActor(bgId)) { return; } SkinMatrix_SetScaleRotateYRPTranslate( - &prevMatrix, colCtx->dyna.bgActors[bgId].prevTransform.scale.x, + &prevTransform, colCtx->dyna.bgActors[bgId].prevTransform.scale.x, colCtx->dyna.bgActors[bgId].prevTransform.scale.y, colCtx->dyna.bgActors[bgId].prevTransform.scale.z, colCtx->dyna.bgActors[bgId].prevTransform.rot.x, colCtx->dyna.bgActors[bgId].prevTransform.rot.y, colCtx->dyna.bgActors[bgId].prevTransform.rot.z, colCtx->dyna.bgActors[bgId].prevTransform.pos.x, colCtx->dyna.bgActors[bgId].prevTransform.pos.y, colCtx->dyna.bgActors[bgId].prevTransform.pos.z); - if (SkinMatrix_Invert(&prevMatrix, &prevMatrixInv) == 2) { + if (SkinMatrix_Invert(&prevTransform, &prevTransformInv) == 2) { return; } SkinMatrix_SetScaleRotateYRPTranslate( - &currMatrix, colCtx->dyna.bgActors[bgId].curTransform.scale.x, colCtx->dyna.bgActors[bgId].curTransform.scale.y, - colCtx->dyna.bgActors[bgId].curTransform.scale.z, colCtx->dyna.bgActors[bgId].curTransform.rot.x, - colCtx->dyna.bgActors[bgId].curTransform.rot.y, colCtx->dyna.bgActors[bgId].curTransform.rot.z, - colCtx->dyna.bgActors[bgId].curTransform.pos.x, colCtx->dyna.bgActors[bgId].curTransform.pos.y, - colCtx->dyna.bgActors[bgId].curTransform.pos.z); + &curTransform, colCtx->dyna.bgActors[bgId].curTransform.scale.x, + colCtx->dyna.bgActors[bgId].curTransform.scale.y, colCtx->dyna.bgActors[bgId].curTransform.scale.z, + colCtx->dyna.bgActors[bgId].curTransform.rot.x, colCtx->dyna.bgActors[bgId].curTransform.rot.y, + colCtx->dyna.bgActors[bgId].curTransform.rot.z, colCtx->dyna.bgActors[bgId].curTransform.pos.x, + colCtx->dyna.bgActors[bgId].curTransform.pos.y, colCtx->dyna.bgActors[bgId].curTransform.pos.z); - SkinMatrix_Vec3fMtxFMultXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv); - SkinMatrix_Vec3fMtxFMultXYZ(&currMatrix, &posWithInv, &newPos); + // Apply the movement of the dynapoly actor `bgId` over the last frame to the `carriedActor` position + // pos = curTransform * prevTransformInv * pos + // Note (curTransform * prevTransformInv) represents the transform relative to the previous frame + SkinMatrix_Vec3fMtxFMultXYZ(&prevTransformInv, &carriedActor->world.pos, &tempPos); + SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos); - actor->world.pos = newPos; + carriedActor->world.pos = pos; } -void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 bgId, Actor* actor) { - s16 angleChange; +/** + * Update the `carriedActor`'s Y rotation based on the dynapoly actor identified by `bgId`. + */ +void DynaPolyActor_UpdateCarriedActorRotY(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) { + s16 rotY; if (!DynaPoly_IsBgIdBgActor(bgId)) { return; } - angleChange = colCtx->dyna.bgActors[bgId].curTransform.rot.y - colCtx->dyna.bgActors[bgId].prevTransform.rot.y; + rotY = colCtx->dyna.bgActors[bgId].curTransform.rot.y - colCtx->dyna.bgActors[bgId].prevTransform.rot.y; - if (actor->id == 0) { - ((Player*)actor)->currentYaw += angleChange; + if (carriedActor->id == ACTOR_PLAYER) { + ((Player*)carriedActor)->currentYaw += rotY; } - actor->shape.rot.y += angleChange; - actor->world.rot.y += angleChange; + carriedActor->shape.rot.y += rotY; + carriedActor->world.rot.y += rotY; } -void BgCheck2_AttachToMesh(CollisionContext* colCtx, Actor* actor, s32 bgId) { - DynaPolyActor* meshActor; +void DynaPolyActor_AttachCarriedActor(CollisionContext* colCtx, Actor* carriedActor, s32 bgId) { + DynaPolyActor* dynaActor; if (!DynaPoly_IsBgIdBgActor(bgId)) { return; } - meshActor = DynaPoly_GetActor(colCtx, bgId); - if (meshActor != NULL) { - DynaPolyActor_SetRidingFallingState(meshActor); + dynaActor = DynaPoly_GetActor(colCtx, bgId); + if (dynaActor != NULL) { + DynaPolyActor_SetActorOnTop(dynaActor); - if ((actor->flags & 0x4000000) == 0x4000000) { - DynaPolyActor_SetSwitchPressedState(meshActor); + if (CHECK_FLAG_ALL(carriedActor->flags, ACTOR_FLAG_CAN_PRESS_SWITCH)) { + DynaPolyActor_SetActorOnSwitch(dynaActor); } - if ((actor->flags & 0x20000) == 0x20000) { - DynaPolyActor_SetHeavySwitchPressedState(meshActor); + if (CHECK_FLAG_ALL(carriedActor->flags, ACTOR_FLAG_CAN_PRESS_HEAVY_SWITCH)) { + DynaPolyActor_SetActorOnHeavySwitch(dynaActor); } } } -u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* colCtx, s32 bgId, Actor* actor) { - u32 wasUpdated = 0; - DynaPolyActor* meshActor; +/** + * Update the `carriedActor`'s position and Y rotation based on the dynapoly actor identified by `bgId`, according to + * the dynapoly actor's move flags (see `DYNA_TRANSFORM_POS` and `DYNA_TRANSFORM_ROT_Y`). + */ +u32 DynaPolyActor_TransformCarriedActor(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) { + u32 wasUpdated = false; + DynaPolyActor* dynaActor; if (!DynaPoly_IsBgIdBgActor(bgId)) { - return 0; + return false; } - if (colCtx->dyna.bgActorFlags[bgId] & 2 || !(colCtx->dyna.bgActorFlags[bgId] & 1)) { - return 0; + if ((colCtx->dyna.bgActorFlags[bgId] & BGACTOR_1) || !(colCtx->dyna.bgActorFlags[bgId] & BGACTOR_IN_USE)) { + return false; } - meshActor = DynaPoly_GetActor(colCtx, bgId); + dynaActor = DynaPoly_GetActor(colCtx, bgId); - if (meshActor == NULL) { - return 0; + if (dynaActor == NULL) { + return false; } - if (meshActor->flags & 1) { - BgCheck2_UpdateActorPosition(colCtx, bgId, actor); - wasUpdated = 1; + if (dynaActor->transformFlags & DYNA_TRANSFORM_POS) { + DynaPolyActor_UpdateCarriedActorPos(colCtx, bgId, carriedActor); + wasUpdated = true; } - if (meshActor->flags & 2) { - BgCheck2_UpdateActorYRotation(colCtx, bgId, actor); - wasUpdated = 1; + if (dynaActor->transformFlags & DYNA_TRANSFORM_ROT_Y) { + DynaPolyActor_UpdateCarriedActorRotY(colCtx, bgId, carriedActor); + wasUpdated = true; } return wasUpdated; diff --git a/src/code/z_bg_item.c b/src/code/z_bg_item.c index 79bdf2b82..cedd77194 100644 --- a/src/code/z_bg_item.c +++ b/src/code/z_bg_item.c @@ -1,18 +1,15 @@ #include "global.h" -#define DYNAPOLY_STATE_NONE 0 -#define DYNAPOLY_STATE_RIDING_FALLING (1 << 0) -#define DYNAPOLY_STATE_RIDING_MOVING (1 << 1) -#define DYNAPOLY_STATE_RIDING_ROTATING (1 << 2) -#define DYNAPOLY_STATE_SWITCH_PRESSED (1 << 3) -#define DYNAPOLY_STATE_HEAVY_SWITCH_PRESSED (1 << 4) - -void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags) { +/** + * @param transformFlags How other actors standing on the dynapoly actor's collision move when the dynapoly actor moves. + * See `DYNA_TRANSFORM_POS`, `DYNA_TRANSFORM_ROT_Y`. + */ +void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 transformFlags) { dynaActor->bgId = -1; dynaActor->pushForce = 0.0f; dynaActor->unk14C = 0.0f; - dynaActor->flags = flags; - dynaActor->stateFlags = DYNAPOLY_STATE_NONE; + dynaActor->transformFlags = transformFlags; + dynaActor->interactFlags = 0; } void DynaPolyActor_LoadMesh(PlayState* play, DynaPolyActor* dynaActor, CollisionHeader* meshHeader) { @@ -22,80 +19,80 @@ void DynaPolyActor_LoadMesh(PlayState* play, DynaPolyActor* dynaActor, Collision dynaActor->bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &dynaActor->actor, header); } -void DynaPolyActor_ResetState(DynaPolyActor* dynaActor) { - dynaActor->stateFlags = DYNAPOLY_STATE_NONE; +void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor) { + dynaActor->interactFlags = 0; } -void DynaPolyActor_SetRidingFallingState(DynaPolyActor* dynaActor) { - dynaActor->stateFlags |= DYNAPOLY_STATE_RIDING_FALLING; +void DynaPolyActor_SetActorOnTop(DynaPolyActor* dynaActor) { + dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_ON_TOP; } -void DynaPolyActor_SetRidingMovingState(DynaPolyActor* dynaActor) { - dynaActor->stateFlags |= DYNAPOLY_STATE_RIDING_MOVING; +void DynaPolyActor_SetPlayerOnTop(DynaPolyActor* dynaActor) { + dynaActor->interactFlags |= DYNA_INTERACT_PLAYER_ON_TOP; } -void DynaPolyActor_SetRidingMovingStateByIndex(CollisionContext* colCtx, s32 bgId) { +void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 bgId) { DynaPolyActor* dynaActor = DynaPoly_GetActor(colCtx, bgId); if (dynaActor != NULL) { - DynaPolyActor_SetRidingMovingState(dynaActor); + DynaPolyActor_SetPlayerOnTop(dynaActor); } } -void DynaPolyActor_SetRidingRotatingState(DynaPolyActor* dynaActor) { - dynaActor->stateFlags |= DYNAPOLY_STATE_RIDING_ROTATING; +void DynaPolyActor_SetPlayerAbove(DynaPolyActor* dynaActor) { + dynaActor->interactFlags |= DYNA_INTERACT_PLAYER_ABOVE; } -void DynaPolyActor_SetRidingRotatingStateByIndex(CollisionContext* colCtx, s32 bgId) { +void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 bgId) { DynaPolyActor* dynaActor = DynaPoly_GetActor(colCtx, bgId); if (dynaActor != NULL) { - DynaPolyActor_SetRidingRotatingState(dynaActor); + DynaPolyActor_SetPlayerAbove(dynaActor); } } -void DynaPolyActor_SetSwitchPressedState(DynaPolyActor* dynaActor) { - dynaActor->stateFlags |= DYNAPOLY_STATE_SWITCH_PRESSED; +void DynaPolyActor_SetActorOnSwitch(DynaPolyActor* dynaActor) { + dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_ON_SWITCH; } -void DynaPolyActor_SetHeavySwitchPressedState(DynaPolyActor* dynaActor) { - dynaActor->stateFlags |= DYNAPOLY_STATE_HEAVY_SWITCH_PRESSED; +void DynaPolyActor_SetActorOnHeavySwitch(DynaPolyActor* dynaActor) { + dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_ON_HEAVY_SWITCH; } -s32 DynaPolyActor_IsInRidingFallingState(DynaPolyActor* dynaActor) { - if (dynaActor->stateFlags & DYNAPOLY_STATE_RIDING_FALLING) { +s32 DynaPolyActor_IsActorOnTop(DynaPolyActor* dynaActor) { + if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_ON_TOP) { return true; } else { return false; } } -s32 DynaPolyActor_IsInRidingMovingState(DynaPolyActor* dynaActor) { - if (dynaActor->stateFlags & DYNAPOLY_STATE_RIDING_MOVING) { +s32 DynaPolyActor_IsPlayerOnTop(DynaPolyActor* dynaActor) { + if (dynaActor->interactFlags & DYNA_INTERACT_PLAYER_ON_TOP) { return true; } else { return false; } } -s32 DynaPolyActor_IsInRidingRotatingState(DynaPolyActor* dynaActor) { - if (dynaActor->stateFlags & DYNAPOLY_STATE_RIDING_ROTATING) { +s32 DynaPolyActor_IsPlayerAbove(DynaPolyActor* dynaActor) { + if (dynaActor->interactFlags & DYNA_INTERACT_PLAYER_ABOVE) { return true; } else { return false; } } -s32 DynaPolyActor_IsInSwitchPressedState(DynaPolyActor* dynaActor) { - if (dynaActor->stateFlags & DYNAPOLY_STATE_SWITCH_PRESSED) { +s32 DynaPolyActor_IsSwitchPressed(DynaPolyActor* dynaActor) { + if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_ON_SWITCH) { return true; } else { return false; } } -s32 DynaPolyActor_IsInHeavySwitchPressedState(DynaPolyActor* dynaActor) { - if (dynaActor->stateFlags & DYNAPOLY_STATE_HEAVY_SWITCH_PRESSED) { +s32 DynaPolyActor_IsHeavySwitchPressed(DynaPolyActor* dynaActor) { + if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_ON_HEAVY_SWITCH) { return true; } else { return false; @@ -129,13 +126,16 @@ s32 DynaPolyActor_ValidateMove(PlayState* play, DynaPolyActor* dynaActor, s16 st &bgId, &dynaActor->actor, 0.0f)) { return false; } + startPos.x = (dynaActor->actor.world.pos.x * 2.0f) - startPos.x; startPos.z = (dynaActor->actor.world.pos.z * 2.0f) - startPos.z; endPos.x = sign * adjustedEndRadius * sin + startPos.x; endPos.z = sign * adjustedEndRadius * cos + startPos.z; + if (BgCheck_EntityLineTest3(&play->colCtx, &startPos, &endPos, &intersectionPos, &poly, true, false, false, true, &bgId, &dynaActor->actor, 0.0f)) { return false; } + return true; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index de0d5d12a..2fc1852ab 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1665,7 +1665,7 @@ CollisionHeader* BgCheck_GetCollisionHeader(CollisionContext* colCtx, s32 bgId) if ((bgId < 0) || (bgId > BG_ACTOR_MAX)) { return NULL; } - if (!(colCtx->dyna.bgActorFlags[bgId] & 1)) { + if (!(colCtx->dyna.bgActorFlags[bgId] & BGACTOR_IN_USE)) { return NULL; } return colCtx->dyna.bgActors[bgId].colHeader; @@ -2719,8 +2719,8 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto s32 foundSlot = false; for (bgId = 0; bgId < BG_ACTOR_MAX; bgId++) { - if (!(dyna->bgActorFlags[bgId] & 1)) { - dyna->bgActorFlags[bgId] |= 1; + if (!(dyna->bgActorFlags[bgId] & BGACTOR_IN_USE)) { + dyna->bgActorFlags[bgId] |= BGACTOR_IN_USE; foundSlot = true; break; } @@ -2733,7 +2733,7 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto BgActor_SetActor(&dyna->bgActors[bgId], actor, colHeader); dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; - dyna->bgActorFlags[bgId] &= ~2; + dyna->bgActorFlags[bgId] &= ~BGACTOR_1; return bgId; } @@ -2741,51 +2741,51 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto * Gets the actor assigned to `bgId` */ DynaPolyActor* DynaPoly_GetActor(CollisionContext* colCtx, s32 bgId) { - if (!DynaPoly_IsBgIdBgActor(bgId) || !(colCtx->dyna.bgActorFlags[bgId] & 1) || - (colCtx->dyna.bgActorFlags[bgId] & 2)) { + if (!DynaPoly_IsBgIdBgActor(bgId) || !(colCtx->dyna.bgActorFlags[bgId] & BGACTOR_IN_USE) || + (colCtx->dyna.bgActorFlags[bgId] & BGACTOR_1)) { return NULL; } return (DynaPolyActor*)colCtx->dyna.bgActors[bgId].actor; } -void func_800C62BC(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_DisableCollision(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { - dyna->bgActorFlags[bgId] |= 4; + dyna->bgActorFlags[bgId] |= BGACTOR_COLLISION_DISABLED; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C6314(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_EnableCollision(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { - dyna->bgActorFlags[bgId] &= ~4; + dyna->bgActorFlags[bgId] &= ~BGACTOR_COLLISION_DISABLED; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C636C(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_DisableCeilingCollision(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { - dyna->bgActorFlags[bgId] |= 8; + dyna->bgActorFlags[bgId] |= BGACTOR_CEILING_COLLISION_DISABLED; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C63C4(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_EnableCeilingCollision(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { - dyna->bgActorFlags[bgId] &= ~8; + dyna->bgActorFlags[bgId] &= ~BGACTOR_CEILING_COLLISION_DISABLED; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C641C(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_DisableFloorCollision(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { - dyna->bgActorFlags[bgId] |= 0x20; + dyna->bgActorFlags[bgId] |= BGACTOR_FLOOR_COLLISION_DISABLED; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } -void func_800C6474(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { +void DynaPoly_EnableFloorCollision(PlayState* play, DynaCollisionContext* dyna, s32 bgId) { if (DynaPoly_IsBgIdBgActor(bgId)) { - dyna->bgActorFlags[bgId] &= ~0x20; + dyna->bgActorFlags[bgId] &= ~BGACTOR_FLOOR_COLLISION_DISABLED; dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } } @@ -2804,11 +2804,11 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI actor->bgId = BGACTOR_NEG_ONE; dyna->bgActors[bgId].actor = NULL; - dyna->bgActorFlags[bgId] |= 2; + dyna->bgActorFlags[bgId] |= BGACTOR_1; } } -void func_800C6554(PlayState* play, DynaCollisionContext* dyna) { +void DynaPoly_InvalidateLookup(PlayState* play, DynaCollisionContext* dyna) { dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP; } @@ -2865,8 +2865,8 @@ void BgCheck_CalcWaterboxDimensions(Vec3f* minPos, Vec3f* maxXPos, Vec3f* maxZPo /** * original name: DynaPolyInfo_expandSRT */ -void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, s32* polyStartIndex, - s32* waterBoxStartIndex) { +void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s32* vtxStartIndex, + s32* polyStartIndex, s32* waterBoxStartIndex) { Actor* actor; s32 i; s32 j; @@ -2899,7 +2899,7 @@ void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s ScaleRotPos_SetValue(&dyna->bgActors[bgId].curTransform, &actor->scale, &actor->shape.rot, &pos); - if (dyna->bgActorFlags[bgId] & 4) { + if (dyna->bgActorFlags[bgId] & BGACTOR_COLLISION_DISABLED) { return; } @@ -2929,13 +2929,13 @@ void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s s16 normalY = poly->normal.y; if (normalY > COLPOLY_SNORMAL(0.5f)) { - if (!(dyna->bgActorFlags[bgId] & 0x20)) { + if (!(dyna->bgActorFlags[bgId] & BGACTOR_FLOOR_COLLISION_DISABLED)) { s16 polyIndex = pi; DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.floor, &polyIndex); } } else if (normalY < COLPOLY_SNORMAL(-0.8f)) { - if (!(dyna->bgActorFlags[bgId] & 8)) { + if (!(dyna->bgActorFlags[bgId] & BGACTOR_CEILING_COLLISION_DISABLED)) { s16 polyIndex = pi; DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.ceiling, @@ -3091,16 +3091,16 @@ void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s *waterBoxStartIndex += pbgdata->numWaterBoxes; } -void BgCheck_ResetFlagsIfLoadedActor(PlayState* play, DynaCollisionContext* dyna, Actor* actor) { +void DynaPoly_UnsetAllInteractFlags(PlayState* play, DynaCollisionContext* dyna, Actor* actor) { DynaPolyActor* dynaActor; s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { - if ((dyna->bgActorFlags[i] & 1)) { + if ((dyna->bgActorFlags[i] & BGACTOR_IN_USE)) { dynaActor = DynaPoly_GetActor(&play->colCtx, i); if ((dynaActor != NULL) && (&dynaActor->actor == actor)) { - DynaPolyActor_ResetState((DynaPolyActor*)actor); - return; + DynaPolyActor_UnsetAllInteractFlags((DynaPolyActor*)actor); + break; } } } @@ -3109,7 +3109,7 @@ void BgCheck_ResetFlagsIfLoadedActor(PlayState* play, DynaCollisionContext* dyna /** * original name: DynaPolyInfo_setup */ -void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) { +void DynaPoly_UpdateContext(PlayState* play, DynaCollisionContext* dyna) { DynaPolyActor* actor; s32 vtxStartIndex; s32 polyStartIndex; @@ -3123,7 +3123,7 @@ void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) { } for (i = 0; i < BG_ACTOR_MAX; i++) { - if (dyna->bgActorFlags[i] & 2) { + if (dyna->bgActorFlags[i] & BGACTOR_1) { // Initialize BgActor dyna->bgActorFlags[i] = 0; BgActor_Init(play, &dyna->bgActors[i]); @@ -3146,8 +3146,8 @@ void DynaPoly_Setup(PlayState* play, DynaCollisionContext* dyna) { polyStartIndex = 0; waterBoxStartIndex = 0; for (i = 0; i < BG_ACTOR_MAX; i++) { - if ((dyna->bgActorFlags[i] & 1) && !(dyna->bgActorFlags[i] & 2)) { - DynaPoly_ExpandSRT(play, dyna, i, &vtxStartIndex, &polyStartIndex, &waterBoxStartIndex); + if ((dyna->bgActorFlags[i] & BGACTOR_IN_USE) && !(dyna->bgActorFlags[i] & BGACTOR_1)) { + DynaPoly_AddBgActorToLookup(play, dyna, i, &vtxStartIndex, &polyStartIndex, &waterBoxStartIndex); } } dyna->bitFlag &= ~DYNAPOLY_INVALIDATE_LOOKUP; @@ -3165,7 +3165,8 @@ void func_800C756C(DynaCollisionContext* dyna, s32* numPolygons, s32* numVertice *numWaterBoxes = 0; for (i = 0; i < BG_ACTOR_MAX; i++) { - if ((dyna->bgActorFlags[i] & 1) && !(dyna->bgActorFlags[i] & 2) && !(dyna->bgActorFlags[i] & 4)) { + if ((dyna->bgActorFlags[i] & BGACTOR_IN_USE) && !(dyna->bgActorFlags[i] & BGACTOR_1) && + !(dyna->bgActorFlags[i] & BGACTOR_COLLISION_DISABLED)) { colHeader = dyna->bgActors[i].colHeader; *numPolygons += colHeader->numPolygons; *numVertices += colHeader->numVertices; @@ -3181,7 +3182,7 @@ void DynaPoly_UpdateBgActorTransforms(PlayState* play, DynaCollisionContext* dyn s32 i; for (i = 0; i < BG_ACTOR_MAX; i++) { - if (dyna->bgActorFlags[i] & 1) { + if (dyna->bgActorFlags[i] & BGACTOR_IN_USE) { DynaPoly_SetBgActorPrevTransform(play, &dyna->bgActors[i]); } } @@ -3275,7 +3276,8 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) { *dynaRaycast->bgId = BGCHECK_SCENE; for (i = 0; i < BG_ACTOR_MAX; i++) { - if (!(dynaRaycast->colCtx->dyna.bgActorFlags[i] & 1) || (dynaRaycast->colCtx->dyna.bgActorFlags[i] & 2)) { + if (!(dynaRaycast->colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) || + (dynaRaycast->colCtx->dyna.bgActorFlags[i] & BGACTOR_1)) { continue; } @@ -3328,7 +3330,7 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) { if (!pauseState) { pauseState = dynaRaycast->play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE; } - if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & 2)) { + if (!pauseState && (dynaRaycast->colCtx->dyna.bgActorFlags[*dynaRaycast->bgId] & BGACTOR_1)) { curTransform = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].curTransform; polyMin = &dynaRaycast->dyna ->polyList[(u16)dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].dynaLookup.polyStartIndex]; @@ -3587,7 +3589,7 @@ s32 BgCheck_SphVsDynaWall(CollisionContext* colCtx, u16 xpFlags, f32* outX, f32* resultPos = *pos; for (i = 0; i < BG_ACTOR_MAX; i++) { - if (!(colCtx->dyna.bgActorFlags[i] & 1) || (colCtx->dyna.bgActorFlags[i] & 2)) { + if (!(colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) || (colCtx->dyna.bgActorFlags[i] & BGACTOR_1)) { continue; } if ((colCtx->dyna.bgActors + i)->actor == actor) { @@ -3709,7 +3711,7 @@ s32 BgCheck_CheckDynaCeiling(CollisionContext* colCtx, u16 xpFlags, f32* outY, V resultY = tempY; for (i = 0; i < BG_ACTOR_MAX; i++) { - if (!(colCtx->dyna.bgActorFlags[i] & 1) || (colCtx->dyna.bgActorFlags[i] & 2)) { + if (!(colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) || (colCtx->dyna.bgActorFlags[i] & BGACTOR_1)) { continue; } if (actor == colCtx->dyna.bgActors[i].actor) { @@ -3855,7 +3857,7 @@ s32 BgCheck_CheckLineAgainstDyna(CollisionContext* colCtx, u16 xpFlags, Vec3f* p f32 by; for (i = 0; i < BG_ACTOR_MAX; i++) { - if ((colCtx->dyna.bgActorFlags[i] & 1) && !(colCtx->dyna.bgActorFlags[i] & 2)) { + if ((colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) && !(colCtx->dyna.bgActorFlags[i] & BGACTOR_1)) { if (actor != colCtx->dyna.bgActors[i].actor) { ay = posA->y; by = posB->y; @@ -3964,7 +3966,7 @@ s32 BgCheck_SphVsFirstDynaPoly(CollisionContext* colCtx, u16 xpFlags, CollisionP Sphere16 testSphere; for (i = 0; i < BG_ACTOR_MAX; i++) { - if (!(colCtx->dyna.bgActorFlags[i] & 1) || (colCtx->dyna.bgActorFlags[i] & 2)) { + if (!(colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) || (colCtx->dyna.bgActorFlags[i] & BGACTOR_1)) { continue; } if (colCtx->dyna.bgActors[i].actor == actor) { @@ -4019,7 +4021,7 @@ void BgCheck_InitCollisionHeaders(CollisionContext* colCtx, PlayState* play) { for (i = 0; i < BG_ACTOR_MAX; i++) { flag = dyna->bgActorFlags[i]; - if ((flag & 1) && !(flag & 2)) { + if ((flag & BGACTOR_IN_USE) && !(flag & BGACTOR_1)) { Actor_SetObjectDependency(play, dyna->bgActors[i].actor); CollisionHeader_SegmentedToVirtual(dyna->bgActors[i].colHeader); } @@ -4399,7 +4401,8 @@ s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f3 } for (i = 0; i < BG_ACTOR_MAX; i++) { - if (!(colCtx->dyna.bgActorFlags[i] & 1) || (colCtx->dyna.bgActorFlags[i] & 4)) { + if (!(colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) || + (colCtx->dyna.bgActorFlags[i] & BGACTOR_COLLISION_DISABLED)) { continue; } bgActor = &colCtx->dyna.bgActors[i]; @@ -4484,8 +4487,8 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, for (i = 0; i < BG_ACTOR_MAX; i++) { - if (!(colCtx->dyna.bgActorFlags[i] & 1) || (colCtx->dyna.bgActorFlags[i] & 4) || - (colCtx->dyna.bgActorFlags[i] & 2)) { + if (!(colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) || + (colCtx->dyna.bgActorFlags[i] & BGACTOR_COLLISION_DISABLED) || (colCtx->dyna.bgActorFlags[i] & BGACTOR_1)) { continue; } bgActor = &colCtx->dyna.bgActors[i]; @@ -4618,7 +4621,7 @@ s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* } } for (i = 0; i < BG_ACTOR_MAX; i++) { - if (!(colCtx->dyna.bgActorFlags[i] & 1) || (colCtx->dyna.bgActorFlags[i] & 2)) { + if (!(colCtx->dyna.bgActorFlags[i] & BGACTOR_IN_USE) || (colCtx->dyna.bgActorFlags[i] & BGACTOR_1)) { continue; } bgActor = &colCtx->dyna.bgActors[i]; diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index bdc124708..a109dab17 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -3,7 +3,7 @@ #define FLAGS \ (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200000 | ACTOR_FLAG_2000000 | \ - ACTOR_FLAG_4000000 | ACTOR_FLAG_80000000) + ACTOR_FLAG_CAN_PRESS_SWITCH | ACTOR_FLAG_80000000) ActorFunc sPlayerCallInitFunc; ActorFunc sPlayerCallDestroyFunc; diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c index 647fabf73..a2af1839d 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c @@ -100,7 +100,7 @@ void BgAstrBombwall_Init(Actor* thisx, PlayState* play) { BgAstrBombwall* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_astr_obj_Colheader_002498); Collider_InitTris(play, &this->collider); if (Flags_GetSwitch(play, BGASTRBOMBWALL_GET_SWITCHFLAG(thisx))) { @@ -181,7 +181,7 @@ void func_80C0A418(BgAstrBombwall* this, PlayState* play) { } void func_80C0A458(BgAstrBombwall* this, PlayState* play) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; func_80C0A120(this, play); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index ef2ca5273..2a1a7dce8 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -75,7 +75,7 @@ void BgCraceMovebg_Init(Actor* thisx, PlayState* play) { sHasInitializedIsLoaded = true; } - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &gDekuShrineSlidingDoorCol); this->index = BG_CRACE_MOVEBG_GET_INDEX(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c index 533ce6292..5ee73366a 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c @@ -127,12 +127,12 @@ void BgCtowerGear_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); } if (type == BGCTOWERGEAR_WATER_WHEEL) { - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerWaterWheelCol); } else if (type == BGCTOWERGEAR_ORGAN) { DynaPolyActor_Init(&this->dyna, 0); DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerOrganCol); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -167,15 +167,20 @@ void BgCtowerGear_UpdateOrgan(Actor* thisx, PlayState* play) { switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 104)]->action) { case 1: this->dyna.actor.draw = NULL; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); break; + case 2: this->dyna.actor.draw = BgCtowerGear_DrawOrgan; - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); break; + case 3: Actor_Kill(&this->dyna.actor); break; + + default: + break; } } } diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c index 5cc9d4b8d..e94b28d88 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c @@ -46,7 +46,7 @@ void BgCtowerRot_Init(Actor* thisx, PlayState* play) { Vec3f offset; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if (this->dyna.actor.params == BGCTOWERROT_CORRIDOR) { DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTowerCorridorCol); this->actionFunc = BgCtowerRot_CorridorRotate; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c index 064b14f7b..51797185a 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c @@ -317,7 +317,7 @@ void BgDblueBalance_Init(Actor* thisx, PlayState* play) { this->dyna.actor.update = sTypeInfo[sp2C].update; this->dyna.actor.draw = sTypeInfo[sp2C].draw; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, sTypeInfo[sp2C].colHeader); if (sp2C == 3) { @@ -412,17 +412,17 @@ void func_80B82DE0(BgDblueBalance* this, PlayState* play) { phi_a1 = 1; this->unk_17D = 20; if (balance1 != NULL) { - if (balance1->unk_181 != 0) { + if (balance1->isHeavySwitchPressed) { phi_a0 = 4; - } else if (balance1->unk_180 != 0) { + } else if (balance1->isSwitchPressed) { phi_a0 = 2; } } if (balance2 != NULL) { - if (balance2->unk_181 != 0) { + if (balance2->isHeavySwitchPressed) { phi_a1 = 5; - } else if (balance2->unk_180 != 0) { + } else if (balance2->isSwitchPressed) { phi_a1 = 3; } } @@ -546,8 +546,8 @@ void BgDblueBalance_Update(Actor* thisx, PlayState* play) { void func_80B8330C(Actor* thisx, PlayState* play) { BgDblueBalance* this = THIS; - this->unk_180 = DynaPolyActor_IsInSwitchPressedState(&this->dyna); - this->unk_181 = DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna); + this->isSwitchPressed = DynaPolyActor_IsSwitchPressed(&this->dyna); + this->isHeavySwitchPressed = DynaPolyActor_IsHeavySwitchPressed(&this->dyna); } void func_80B83344(BgDblueBalance* this) { diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h index f2200e96f..5d72ea3db 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.h @@ -33,8 +33,8 @@ typedef struct BgDblueBalance { /* 0x17D */ s8 unk_17D; /* 0x17E */ s8 unk_17E; /* 0x17F */ s8 unk_17F; - /* 0x180 */ s8 unk_180; - /* 0x181 */ s8 unk_181; + /* 0x180 */ s8 isSwitchPressed; + /* 0x181 */ s8 isHeavySwitchPressed; /* 0x182 */ s8 unk_182; /* 0x183 */ u8 unk_183; /* 0x184 */ s16 unk_184; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 1ffba6755..960006b93 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -163,7 +163,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) { this->unk_160 = BGDBLUEMOVEBG_GET_F(thisx); this->unk_1BC = BGDBLUEMOVEBG_GET_F000(thisx); this->unk_1C0 = BGDBLUEMOVEBG_GET_FF0(thisx); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if ((this->unk_160 == 9) || (this->unk_160 == 8)) { if (D_80A2BBF4.unk_00 != 0) { diff --git a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c index 124469557..eb1848c56 100644 --- a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c +++ b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c @@ -161,7 +161,7 @@ void BgDkjailIvy_BeginCutscene(BgDkjailIvy* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); this->fadeOutTimer = 50; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); Flags_SetSwitch(play, BG_DKJAIL_GET_SWITCH(&this->dyna.actor)); BgDkjailIvy_IvyCutEffects(this, play); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GRASS_WALL_BROKEN); diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c index e6b18c220..a39e10559 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c @@ -228,7 +228,7 @@ void BgF40Block_Init(Actor* thisx, PlayState* play) { BgF40Block* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_obj_Colheader_004640); if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) { diff --git a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c index 4ae6a8ed7..075f38607 100644 --- a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c +++ b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c @@ -41,7 +41,7 @@ void BgF40Flift_Init(Actor* thisx, PlayState* play) { BgF40Flift* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_obj_Colheader_004240); this->dyna.actor.params = 1; this->actionFunc = func_808D75F0; @@ -54,8 +54,8 @@ void BgF40Flift_Destroy(Actor* thisx, PlayState* play) { } void func_808D75F0(BgF40Flift* this, PlayState* play) { - if (((this->dyna.actor.params == 1) && (DynaPolyActor_IsInRidingMovingState(&this->dyna))) || - ((this->dyna.actor.params == -1) && (!DynaPolyActor_IsInRidingMovingState(&this->dyna)))) { + if (((this->dyna.actor.params == 1) && DynaPolyActor_IsPlayerOnTop(&this->dyna)) || + ((this->dyna.actor.params == -1) && !DynaPolyActor_IsPlayerOnTop(&this->dyna))) { this->timer = 96; this->actionFunc = func_808D7714; } else { diff --git a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c index 558c77064..ffa9491d6 100644 --- a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c +++ b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c @@ -56,7 +56,7 @@ void BgF40Switch_CheckAll(BgF40Switch* this, PlayState* play) { if (actor->id == ACTOR_BG_F40_SWITCH && actor->room == this->dyna.actor.room && actor->update != NULL) { actorAsSwitch = (BgF40Switch*)actor; actorAsSwitch->wasPressed = actorAsSwitch->isPressed; - isPressed = DynaPolyActor_IsInSwitchPressedState(&actorAsSwitch->dyna); + isPressed = DynaPolyActor_IsSwitchPressed(&actorAsSwitch->dyna); if (actorAsSwitch->isPressed && actorAsSwitch->actionFunc == BgF40Switch_IdlePressed) { // Switch is fully pressed - if there's nothing keeping it pressed, wait a short time before // reverting to unpressed state. @@ -112,7 +112,7 @@ void BgF40Switch_Init(Actor* thisx, PlayState* play) { this->dyna.actor.scale.y = 0.165f; this->actionFunc = BgF40Switch_IdleUnpressed; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 1.0f; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_switch_Colheader_000118); if (!sBgF40SwitchGlobalsInitialized) { sBgF40SwitchLastUpdateFrame = play->gameplayFrames; diff --git a/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c b/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c index 40a981a6e..bec649b57 100644 --- a/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c +++ b/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c @@ -34,7 +34,7 @@ void BgFuKaiten_Init(Actor* thisx, PlayState* play) { CollisionHeader* header = NULL; Actor_SetScale(thisx, 1.0); - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); CollisionHeader_GetVirtual(&object_fu_kaiten_Colheader_002D30, &header); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, header); diff --git a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c index 5cb337238..7f485be1d 100644 --- a/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c +++ b/src/overlays/actors/ovl_Bg_Fu_Mizu/z_bg_fu_mizu.c @@ -34,7 +34,7 @@ void BgFuMizu_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; Actor_SetScale(&this->dyna.actor, 1.0f); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&object_fu_kaiten_Colheader_0037F8, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->unk_160 = 0; diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index c9020349c..8b02330f3 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -152,7 +152,7 @@ void BgGoronOyu_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; Actor_SetScale(&this->dyna.actor, 0.1f); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&object_oyu_Colheader_000988, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); diff --git a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c index 331a6dfe5..387f5ec83 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c @@ -202,7 +202,7 @@ void BgHakaBombwall_PlayCutscene(BgHakaBombwall* this, PlayState* play) { this->dyna.actor.draw = NULL; Flags_SetSwitch(play, BGHAKABOMBWALL_GET_7F(&this->dyna.actor)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 0x3C, NA_SE_EV_WALL_BROKEN); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); BgHakaBombwall_SetupEndCutscene(this); } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); diff --git a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c index 412ea3a39..b90774172 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c +++ b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c @@ -49,7 +49,7 @@ void BgHakaCurtain_Init(Actor* thisx, PlayState* play) { BgHakaCurtain* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_001588); if (Flags_GetClear(play, this->dyna.actor.room)) { func_80B6DE80(this); diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c index a8d63c309..94e7c57dc 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c @@ -45,7 +45,7 @@ void BgHakaTomb_Init(Actor* thisx, PlayState* play) { BgHakaTomb* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_000EE8); SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); func_80BD6624(this); diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c index bde3c8540..41112ccdc 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c @@ -369,7 +369,7 @@ s32 func_80ABCC00(BgHakuginBombwall* this, PlayState* play) { return true; } } - } else if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + } else if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 50, NA_SE_EV_WALL_BROKEN); return true; } @@ -401,7 +401,7 @@ void func_80ABCD98(BgHakuginBombwall* this, PlayState* play) { this->dyna.actor.draw = NULL; this->unk_1AC = 20; Flags_SetSwitch(play, BGHAKUGIN_BOMBWALL_SWITCHFLAG(&this->dyna.actor)); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80ABCE60; } else { ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index d4d7e1724..5a06fe415 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -703,7 +703,7 @@ void BgHakuginPost_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.z = 0; this->dyna.actor.shape.rot.x = 0; this->dyna.actor.shape.rot.z = 0; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_hakugin_obj_Colheader_00D3B0); func_80A9B3BC(this, play); func_80A9CA94(this); diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c index 3f7379d34..512a5b822 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c @@ -126,7 +126,7 @@ void BgHakuginSwitch_Init(Actor* thisx, PlayState* play) { sp30 = false; } - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_goronswitch_Colheader_0005C8); Collider_InitCylinder(play, &this->collider); @@ -244,7 +244,7 @@ void func_80B15B74(BgHakuginSwitch* this, PlayState* play) { if (sp34) { this->collider.base.acFlags &= ~AC_HIT; - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { sp24 = true; sp20 = sp28; } @@ -306,7 +306,7 @@ void func_80B15E78(BgHakuginSwitch* this, PlayState* play) { BgHakuginSwitchStruct* sp20 = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; if (Math_StepToF(&this->dyna.actor.world.pos.y, sp20->unk_4 + this->dyna.actor.home.pos.y, sp20->unk_C)) { - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } func_80B15F3C(this, play); @@ -413,7 +413,7 @@ void func_80B162AC(BgHakuginSwitch* this, PlayState* play) { if (sp34) { this->collider.base.acFlags &= ~AC_HIT; - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { sp24 = true; sp28 = true; } @@ -446,7 +446,7 @@ void func_80B163C4(BgHakuginSwitch* this, PlayState* play) { void func_80B16400(BgHakuginSwitch* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, (this->dyna.actor.home.pos.y + 2.0f) - (1800.0f * this->dyna.actor.scale.y), 10.0f)) { - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } func_80B16494(this, play); @@ -510,8 +510,8 @@ void BgHakuginSwitch_Update(Actor* thisx, PlayState* play) { if (this->unk_1C0 != 0) { f32 phi_f0; - if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { - if (DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { + if (DynaPolyActor_IsHeavySwitchPressed(&this->dyna)) { phi_f0 = (sp24 - -10.0f) * -0.21f; } else { phi_f0 = (sp24 - -3.0f) * -0.08f; diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index eabd3f3fe..740d807d8 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -150,7 +150,7 @@ void BgIcicle_Shiver(BgIcicle* this, PlayState* play) { this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIcicle_Fall; } else { rand = Rand_ZeroOne(); @@ -175,7 +175,7 @@ void BgIcicle_Fall(BgIcicle* this, PlayState* play) { if (this->dyna.actor.params == ICICLE_STALACTITE_REGROW) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIcicle_Regrow; } else { Actor_Kill(&this->dyna.actor); @@ -216,7 +216,7 @@ void BgIcicle_UpdateAttacked(BgIcicle* this, PlayState* play) { if (this->dyna.actor.params == ICICLE_STALACTITE_REGROW) { BgIcicle_Break(this, play, 40.0f); this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIcicle_Regrow; return; } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c index 5f35aaa4d..622c84100 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c @@ -184,9 +184,9 @@ void BgIkanaBlock_Init(Actor* thisx, PlayState* play) { BgIkanaBlock* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_15C = Lib_SegmentedToVirtual(gameplay_dangeon_keep_Matanimheader_01B370); this->unk_174 = this->dyna.actor.shape.rot; func_80B7ED54(this); @@ -211,7 +211,7 @@ void func_80B7F034(BgIkanaBlock* this, PlayState* play) { } if (func_80B7EEB4(this, play)) { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = func_80B7F564; func_80B7F0A4(this); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c index 04f7f514b..88f606ac0 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c @@ -335,7 +335,7 @@ void func_80BD503C(BgIkanaBombwall* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); Flags_SetSwitch(play, BGIKANABOMBWALL_GET_SWITCHFLAG(&this->dyna.actor)); if (!BGIKANABOMBWALL_GET_100(&this->dyna.actor)) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } func_80BD5118(this); } else { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index 27ca91c95..432a5b5ff 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -714,7 +714,7 @@ void BgIkanaRotaryroom_Init(Actor* thisx, PlayState* play) { this->dyna.actor.shape.rot.x = 0; } - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, D_80B82218[sp34]); Collider_InitJntSph(play, &this->collider); diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index a9070cb8b..824c58ee6 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -62,11 +62,11 @@ s32 func_80C0A740(BgIkninSusceil* this, PlayState* play) { } void func_80C0A804(BgIkninSusceil* this, PlayState* play) { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80C0A838(BgIkninSusceil* this, PlayState* play) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } void func_80C0A86C(BgIkninSusceil* this, PlayState* play, s16 verticalMag, s16 countdown, s32 arg4) { @@ -115,7 +115,7 @@ void BgIkninSusceil_Init(Actor* thisx, PlayState* play) { BgIkninSusceil* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_ikninside_obj_Colheader_00CBAC); this->animatedTexture = Lib_SegmentedToVirtual(object_ikninside_obj_Matanimheader_00C670); func_80C0AC74(this); diff --git a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c index 6016b2e44..db343e84b 100644 --- a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c +++ b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c @@ -121,7 +121,7 @@ void func_80C072D0(BgIkninside* this, PlayState* play) { Flags_SetSwitch(play, DMIKNINSIDE_GET_SWITCH(&this->dyna.actor)); this->actionFunc = func_80C07230; this->dyna.actor.draw = NULL; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { this->timer = 20; } diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index c1cc4daa6..7ada76df8 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -237,7 +237,7 @@ void func_809541B8(BgIngate* this, PlayState* play) { this->actionFunc = func_809543D4; } } - } else if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + } else if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { this->unk160 |= 4; } } @@ -322,7 +322,7 @@ void BgIngate_Init(Actor* thisx, PlayState* play2) { Vec3f sp20; if (BgIngate_FindActor(this, play, ACTORCAT_BG, ACTOR_BG_INGATE) == NULL) { - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &gSichitaiBoatCol); this->unk160 = 0; this->unk160 |= 0x8; diff --git a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c index 1b1deb6c2..2eac2ed07 100644 --- a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c +++ b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c @@ -39,7 +39,7 @@ void BgInibsMovebg_Init(Actor* thisx, PlayState* play) { BgInibsMovebg* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); this->opaDList = sOpaDLists[BG_INIBS_MOVEBG_GET_MODE(thisx)]; this->xluDList = sXluDLists[BG_INIBS_MOVEBG_GET_MODE(thisx)]; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c index 2da4ddcee..77139783e 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c @@ -187,7 +187,7 @@ void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play) { ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; BgKin2Bombwall_SpawnEffects(this, play); BgKin2Bombwall_SetupEndCutscene(this); diff --git a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c index c55cd4e01..2d7b61d0c 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c @@ -162,7 +162,7 @@ void BgKin2Picture_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); DynaPolyActor_LoadMesh(play, &this->dyna, &gOceanSpiderHouseSkullkidPaintingCol); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); Collider_InitTris(play, &this->colliderTris); Collider_SetTris(play, &this->colliderTris, &this->dyna.actor, &sTrisInit, this->colliderElement); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, @@ -317,7 +317,7 @@ void BgKin2Picture_Fall(BgKin2Picture* this, PlayState* play) { ActorCutscene_Stop(this->dyna.actor.cutscene); } - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOODPLATE_BROKEN); BgKin2Picture_SetupDoNothing(this); } else { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c b/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c index 6c30347ef..f36944db6 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Shelf/z_bg_kin2_shelf.c @@ -207,7 +207,7 @@ void BgKin2Shelf_Init(Actor* thisx, PlayState* play) { this->dyna.actor.flags |= ACTOR_FLAG_10000000; } - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, D_80B70780[sp24]); func_80B700A8(this); } diff --git a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c index 144351614..aacd9b0a7 100644 --- a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c +++ b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c @@ -75,7 +75,7 @@ void BgLadder_Init(Actor* thisx, PlayState* play) { } else { // Otherwise, the ladder doesn't draw; wait for the flag to be set this->alpha = 5; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; this->action = BgLadder_Wait; } @@ -113,7 +113,7 @@ void BgLadder_FadeIn(BgLadder* this, PlayState* play) { if (this->alpha >= 255) { this->alpha = 255; ActorCutscene_Stop(this->dyna.actor.cutscene); - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.flags &= ~ACTOR_FLAG_10; // always update = off this->action = BgLadder_DoNothing; } diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c index 521e14d63..63a973d8b 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c @@ -149,7 +149,7 @@ void BgLastBwall_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, D_80C18AC8); this->type = BGLASTBWALL_GET_TYPE(&this->dyna.actor); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, D_80C18A48[this->type].colHeader); Collider_InitTris(play, &this->colliderTris); if (Flags_GetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor))) { @@ -245,7 +245,7 @@ void func_80C18884(BgLastBwall* this, PlayState* play) { } void func_80C188C4(BgLastBwall* this, PlayState* play) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; func_80C184EC(this, play); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WALL_BROKEN); diff --git a/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c b/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c index 75e7b9e32..24c7ec1b3 100644 --- a/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c +++ b/src/overlays/actors/ovl_Bg_Lbfshot/z_bg_lbfshot.c @@ -36,7 +36,7 @@ void BgLbfshot_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->dyna.actor.uncullZoneForward = 4000.0f; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_lbfshot_Colheader_0014D8); } void BgLbfshot_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index f4f6a6c00..4e9862001 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -144,7 +144,7 @@ void BgNumaHana_Init(Actor* thisx, PlayState* play) { type = BG_NUMA_HANA_GET_TYPE(&this->dyna.actor); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); if (type == BG_NUMA_HANA_TYPE_OPEN_FLOWER_COLLISION) { DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodenFlowerOpenedFlowerCol); @@ -162,7 +162,7 @@ void BgNumaHana_Init(Actor* thisx, PlayState* play) { } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->petalZRotation = 0x2000; this->innerPetalZRotation = 0x2000; @@ -180,7 +180,7 @@ void BgNumaHana_Init(Actor* thisx, PlayState* play) { BgNumaHana_SetupOpenedIdle(this); } else { child = (DynaPolyActor*)this->dyna.actor.child; - func_800C62BC(play, &play->colCtx.dyna, child->bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, child->bgId); Flags_UnsetSwitch(play, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupClosedIdle(this); } @@ -314,8 +314,8 @@ void BgNumaHana_RaiseFlower(BgNumaHana* this, PlayState* play) { child = (DynaPolyActor*)this->dyna.actor.child; // Swaps out the "closed" flower collision for the "opened" collision. - func_800C6314(play, &play->colCtx.dyna, child->bgId); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, child->bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->petalZRotation = 0x2000; this->innerPetalZRotation = 0x2000; diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index 3f7e45f67..99950a407 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -92,7 +92,7 @@ void BgOpenShutter_Init(Actor* thisx, PlayState* play) { BgOpenShutter* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_open_obj_Colheader_001640); this->actionFunc = func_80ACAD88; } diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index a1bd0d65d..4bc3c87af 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -150,7 +150,7 @@ void BgSpdweb_Init(Actor* thisx, PlayState* play) { this->unk_161 = 0; this->switchFlag = BGSPDWEB_GET_SWITCHFLAG(&this->dyna.actor); thisx->params &= 0xFF; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if (this->dyna.actor.params == BGSPDWEB_FF_0) { Collider_InitAndSetTris(play, &this->collider, &this->dyna.actor, &sTrisInit1, this->colliderElements); @@ -297,7 +297,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { return; } - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { sp3A = 300; break; } @@ -305,7 +305,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { } } - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { temp_f12 = 2.0f * sqrtf(CLAMP_MIN(sp3A, 0)); if ((this->unk_164 < temp_f12) && (temp_f12 > 2.0f)) { this->unk_164 = temp_f12; @@ -327,8 +327,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { Math_ApproachZeroF(&this->unk_164, 1.0f, 0.8f); if (this->unk_162 == 4) { - if ((this->unk_161 != 0) || - ((DynaPolyActor_IsInRidingMovingState(&this->dyna) != 0) && (this->unk_164 > 2.0f))) { + if ((this->unk_161 != 0) || (DynaPolyActor_IsPlayerOnTop(&this->dyna) && (this->unk_164 > 2.0f))) { player->actor.velocity.y = this->unk_164 * 0.7f; player->fallStartHeight = (SQ(this->unk_164) * 0.15f) + this->dyna.actor.world.pos.y; this->unk_161 = 0; diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index bef32aedd..683bf322e 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -165,10 +165,10 @@ void BgUmajump_Update(Actor* thisx, PlayState* play) { (gSaveContext.save.time <= CLOCK_TIME(6, 0)))))) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); } - func_800C641C(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableFloorCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = func_8091A5A0; } else if (this->dyna.actor.params == BG_UMAJUMP_TYPE_4) { - func_800C641C(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableFloorCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = Actor_Noop; } else { this->dyna.actor.update = Actor_Noop; diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index dab5b3c08..e49a1ec56 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -373,17 +373,17 @@ void DmChar01_Update(Actor* thisx, PlayState* play2) { Player* player = GET_PLAYER(play); if (player->actor.world.pos.y > 5.0f) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } } if (DMCHAR01_GET(&this->dyna.actor) == DMCHAR01_2) { if (this->dyna.actor.xzDistToPlayer > 600.0f) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } } } diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c index 66d4a7f86..a1853d04d 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c @@ -165,15 +165,15 @@ void DmChar08_Init(Actor* thisx, PlayState* play2) { this->unk_1F0 = 0.0f; if (play->sceneId == SCENE_31MISAKI) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &gTurtleZoraCapeAwakeCol); } else { - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &gTurtleZoraCapeAsleepCol); } this->dynapolyInitialized = true; } else if (play->sceneId == SCENE_SEA) { - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &sTurtleGreatBayTempleCol); this->dynapolyInitialized = true; } @@ -296,7 +296,7 @@ void DmChar08_SetupAppearCs(DmChar08* this, PlayState* play) { void func_80AAF884(DmChar08* this, PlayState* play) { if (play->csCtx.state == CS_STATE_0) { - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &gTurtleZoraCapeAwakeCol); this->dyna.actor.flags |= ACTOR_FLAG_1; this->actionFunc = func_80AAF8F4; @@ -960,7 +960,7 @@ void DmChar08_UpdateCollision(DmChar08* this, PlayState* play) { sTurtleGreatBayTempleColVertices[5].y = 0x4B0; sTurtleGreatBayTempleColVertices[9].y = 0x6A4; } - func_800C6554(play, &play->colCtx.dyna); + DynaPoly_InvalidateLookup(play, &play->colCtx.dyna); } void DmChar08_Update(Actor* thisx, PlayState* play) { @@ -988,9 +988,9 @@ void DmChar08_Update(Actor* thisx, PlayState* play) { this->dyna.actor.world.pos.y = this->targetYPos; if (play->sceneId == SCENE_31MISAKI) { if (this->dyna.actor.xzDistToPlayer > 1300.0f) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } } if (this->unk_1FF != 0) { diff --git a/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c b/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c index 11f2724de..77ce3c738 100644 --- a/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c +++ b/src/overlays/actors/ovl_Dm_Statue/z_dm_statue.c @@ -7,7 +7,7 @@ #include "z_dm_statue.h" #include "objects/object_smtower/object_smtower.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_4000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CAN_PRESS_SWITCH) #define THIS ((DmStatue*)thisx) diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index c7077e56e..b94e3ecb5 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -512,7 +512,7 @@ void func_8088B630(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->arrow.skelAnime); if (this->actor.wallBgId != BG_ACTOR_MAX) { - BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, this->actor.wallBgId, &this->actor); + DynaPolyActor_TransformCarriedActor(&play->colCtx, this->actor.wallBgId, &this->actor); } if (DECR(this->unk_260) == 0) { diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 175ac69a8..a2246b442 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -408,7 +408,7 @@ void EnBomChu_HandleNonSceneCollision(EnBomChu* this, PlayState* play) { Math_Vec3f_Copy(&originalWorldPos, &this->actor.world.pos); Math_Vec3f_Copy(&originalAxisUp, &this->axisUp); yaw = this->actor.shape.rot.y; - BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, this->actor.floorBgId, &this->actor); + DynaPolyActor_TransformCarriedActor(&play->colCtx, this->actor.floorBgId, &this->actor); if (yaw != this->actor.shape.rot.y) { yaw = this->actor.shape.rot.y - yaw; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 6beedbdf8..dbe25cdf4 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -213,7 +213,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.x = 0x7FFF; this->collectableFlag = 0; } else { - func_800C636C(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->collectableFlag = (this->dyna.actor.world.rot.x & 0x7F); this->dyna.actor.world.rot.x = 0; } @@ -228,7 +228,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { animFrame = animFrameEnd; } else if (((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL) || (this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL)) && !Flags_GetSwitch(play, this->switchFlag)) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); if (Rand_ZeroOne() < 0.5f) { this->movementFlags |= ENBOX_MOVE_FALL_ANGLE_SIDE; } @@ -240,7 +240,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { } else if (((this->type == ENBOX_TYPE_BIG_ROOM_CLEAR) || (this->type == ENBOX_TYPE_SMALL_ROOM_CLEAR)) && !Flags_GetClear(play, this->dyna.actor.room)) { EnBox_SetupAction(this, EnBox_AppearOnRoomClear); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); if (this->movementFlags & ENBOX_MOVE_0x80) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 50.0f; } else { @@ -254,7 +254,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { } else if (((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG) || (this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG)) && !Flags_GetSwitch(play, this->switchFlag)) { EnBox_SetupAction(this, EnBox_AppearSwitchFlag); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); if (this->movementFlags & ENBOX_MOVE_0x80) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 50.0f; } else { @@ -377,7 +377,7 @@ void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { Actor_SetClosestSecretDistance(&this->dyna.actor, play); if (this->unk_1A0 >= 0) { EnBox_SetupAction(this, EnBox_Fall); - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else if (this->unk_1A0 >= -11) { this->unk_1A0++; } else if (Flags_GetSwitch(play, this->switchFlag)) { @@ -422,7 +422,7 @@ void func_80868AFC(EnBox* this, PlayState* play) { } void func_80868B74(EnBox* this, PlayState* play) { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); if (this->unk_1A0 < 0) { this->unk_1A0++; } else if (this->unk_1A0 < 40) { diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index 7a8bc5ddb..8edd1b580 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -104,7 +104,7 @@ void EnDnb_Init(Actor* thisx, PlayState* play) { s32 i; s16* alloc; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_hanareyama_obj_Colheader_004D8C); alloc = Lib_SegmentedToVirtual(object_hanareyama_obj_Vec_004710); diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 1f122ae92..6febd3dca 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -775,7 +775,7 @@ void func_80962F4C(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x288B, &this->actor); } - if ((!DynaPolyActor_IsInRidingRotatingState((DynaPolyActor*)this->actor.child) && + if ((!DynaPolyActor_IsPlayerAbove((DynaPolyActor*)this->actor.child) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) || (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] <= SECONDS_TO_TIMER(0)) || (this->unk_548 == this->unk_54C)) { player->stateFlags3 &= ~PLAYER_STATE3_400000; diff --git a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c index e79348366..e976e01dc 100644 --- a/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c +++ b/src/overlays/actors/ovl_En_Fu_Kago/z_en_fu_kago.c @@ -86,7 +86,7 @@ void EnFuKago_Init(Actor* thisx, PlayState* play) { CollisionHeader* sp34 = NULL; Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&object_fu_mato_Colheader_0015C0, &sp34); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp34); Actor_SetScale(&this->dyna.actor, 0.1f); @@ -228,7 +228,7 @@ void func_80ACFA78(EnFuKago* this, PlayState* play) { this->unk_33A = 1; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOODBOX_BREAK); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80AD0028; } diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c index 9e3c19473..c42278805 100644 --- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c +++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c @@ -75,7 +75,7 @@ void EnFuMato_Init(Actor* thisx, PlayState* play) { Actor* actor = play->actorCtx.actorLists[ACTORCAT_NPC].first; EnFu* fu; - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); CollisionHeader_GetVirtual(&object_fu_mato_Colheader_0023D4, &sp2C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp2C); Actor_SetScale(&this->dyna.actor, 0.1f); diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index 99783d77d..2d77519bd 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -1161,7 +1161,7 @@ void EnMushi2_Update(Actor* thisx, PlayState* play) { if ((temp != BGCHECK_SCENE) && ((this->actionFunc == func_80A6A5C0) || (this->actionFunc == func_80A6A824) || (this->actionFunc == func_80A6A9E4) || (this->actionFunc == func_80A6B0D8)) && - BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, temp, &this->actor)) { + DynaPolyActor_TransformCarriedActor(&play->colCtx, temp, &this->actor)) { func_80A68F24(this); } diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index b89aa26f3..6a3f1af5a 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -310,7 +310,7 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) { if (this->timer == 0) { if ((player->transformation != PLAYER_FORM_DEKU) && (this->dyna.actor.xzDistToPlayer < (BREG(48) + 80.0f) && (player->invincibilityTimer == 0) && - DynaPolyActor_IsInRidingMovingState(&this->dyna) && !(player->stateFlags1 & PLAYER_STATE1_8000000) && + DynaPolyActor_IsPlayerOnTop(&this->dyna) && !(player->stateFlags1 & PLAYER_STATE1_8000000) && play->grabPlayer(play, player))) { player->actor.parent = &this->dyna.actor; this->grabTarget = EN_RAF_GRAB_TARGET_PLAYER; @@ -710,7 +710,7 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { return; } - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if ((this->heightDiffFromPlayer > -0.1f) && !this->isCurrentlyInRidingMovingState) { this->heightDiffFromPlayer = -20.0f; this->isCurrentlyInRidingMovingState = true; diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index d9c2d61f2..81898dfa6 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -495,7 +495,7 @@ void EnRat_HandleNonSceneCollision(EnRat* this, PlayState* play) { f32 cos; f32 tempX; - BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, this->actor.floorBgId, &this->actor); + DynaPolyActor_TransformCarriedActor(&play->colCtx, this->actor.floorBgId, &this->actor); if (yaw != this->actor.shape.rot.y) { yaw = this->actor.shape.rot.y - yaw; diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 8d1c726b7..cca0c9dfa 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -10,7 +10,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_mask_ki_tan/object_mask_ki_tan.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_4000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CAN_PRESS_SWITCH) #define THIS ((EnTest3*)thisx) diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index ccf7c5e13..c6681b4be 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -63,17 +63,14 @@ static Gfx* sShellDLists[] = { void EnTorch2_Init(Actor* thisx, PlayState* play) { EnTorch2* this = THIS; - s16 params; Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - // params: which form Link is in (e.g. human, deku, etc.) - params = this->actor.params; - if (params != TORCH2_PARAM_DEKU) { - this->actor.flags |= ACTOR_FLAG_4000000; // Can press switch - if (params == TORCH2_PARAM_GORON) { - this->actor.flags |= ACTOR_FLAG_20000; // Can press heavy switches + if (this->actor.params != TORCH2_PARAM_DEKU) { + this->actor.flags |= ACTOR_FLAG_CAN_PRESS_SWITCH; + if (this->actor.params == TORCH2_PARAM_GORON) { + this->actor.flags |= ACTOR_FLAG_CAN_PRESS_HEAVY_SWITCH; } } this->framesUntilNextState = 20; diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index 205b9d9cc..a86359610 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -63,7 +63,7 @@ void EnTwig_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->unk_160 = RACERING_GET_PARAM_F(&this->dyna.actor); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if (sColHeaders[this->unk_160] != NULL) { DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[this->unk_160]); } @@ -72,6 +72,7 @@ void EnTwig_Init(Actor* thisx, PlayState* play2) { case 0: Actor_Kill(&this->dyna.actor); break; + case 1: if (!sRingsHaveSpawned) { sRingCount = CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04) ? 25 : 20; @@ -91,14 +92,18 @@ void EnTwig_Init(Actor* thisx, PlayState* play2) { } Actor_SetScale(&this->dyna.actor, 4.2f); this->dyna.actor.uncullZoneScale = this->dyna.actor.uncullZoneDownward = this->dyna.actor.scale.x * 60.0f; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); func_80AC0A7C(this, play); break; + case 2: Actor_SetScale(&this->dyna.actor, 1.0f); this->dyna.actor.uncullZoneScale = this->dyna.actor.uncullZoneDownward = this->dyna.actor.scale.x * 880.0f; func_80AC0A54(this, play); break; + + default: + break; } } @@ -149,9 +154,9 @@ void func_80AC0AC8(EnTwig* this, PlayState* play) { } } else { if (this->dyna.actor.xyzDistToPlayerSq <= SQ((this->dyna.actor.scale.x * 40.0f) + 40)) { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->dyna.actor.xyzDistToPlayerSq >= (this->dyna.actor.scale.x * 10.0f * 40.0f * 40.0f)) { this->dyna.actor.shape.rot.y = this->dyna.actor.yawTowardsPlayer; @@ -165,7 +170,7 @@ void func_80AC0CC4(EnTwig* this, PlayState* play) { this->unk_170 = 3458.0f; this->unk_174 = 0.2f; this->unk_16C |= 1; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80AC0D2C; } diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c index 79a877803..93adab401 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c @@ -7,7 +7,7 @@ #include "z_obj_armos.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_4000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_CAN_PRESS_SWITCH) #define THIS ((ObjArmos*)thisx) diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index 13b565598..b6c5be123 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -365,7 +365,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->unk_1FE = 0; this->unk_1B8 = 0.1f; - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); Collider_InitCylinder(play, &this->collider); if ((sp2C == ENOBJBEAN_GET_C000_1) || (sp2C == ENOBJBEAN_GET_C000_2)) { @@ -414,7 +414,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { if (OBJBEAN_GET_80(&this->dyna.actor) || Flags_GetSwitch(play, OBJBEAN_GET_7F(&this->dyna.actor, 1))) { func_80938804(this); } else { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); func_80938704(this); } } @@ -765,7 +765,7 @@ void func_80938804(ObjBean* this) { } void func_80938834(ObjBean* this, PlayState* play) { - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { func_80938874(this); } func_80936F24(this); @@ -784,7 +784,7 @@ void func_809388A8(ObjBean* this, PlayState* play) { func_80937268(this, play); func_809372A8(this); func_8093892C(this); - } else if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + } else if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { func_800B9010(&this->dyna.actor, NA_SE_PL_PLANT_MOVE - SFX_FLAG); } func_80936F24(this); @@ -797,7 +797,7 @@ void func_8093892C(ObjBean* this) { } void func_80938958(ObjBean* this, PlayState* play) { - if (!DynaPolyActor_IsInRidingRotatingState(&this->dyna)) { + if (!DynaPolyActor_IsPlayerAbove(&this->dyna)) { func_80938804(this); } func_80936F24(this); @@ -810,7 +810,7 @@ void func_80938998(ObjBean* this) { } void func_809389BC(ObjBean* this, PlayState* play) { - if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { func_80937268(this, play); func_809372A8(this); func_80937238(this); @@ -851,9 +851,9 @@ void func_80938AD8(ObjBean* this, PlayState* play) { } if (sp30 != 0) { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->dyna.actor.xzDistToPlayer < 74.0f) { @@ -925,7 +925,7 @@ void ObjBean_Update(Actor* thisx, PlayState* play) { this->dyna.actor.shape.shadowScale = this->dyna.actor.scale.x * 88.0f; if (func_80937468(this, play)) { func_809375F4(this, play); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); func_80938998(this); } } else { diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index cc94527a0..6f426bfdd 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -61,7 +61,7 @@ void ObjBoat_Init(Actor* thisx, PlayState* play) { Vec3f sp24; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &object_kaizoku_obj_Colheader_009A88); if (thisx->params < 0) { this->dyna.actor.update = ObjBoat_UpdateCutscene; @@ -95,14 +95,14 @@ void ObjBoat_Update(Actor* thisx, PlayState* play) { s32 pad; ObjBoat* this = THIS; Player* player = GET_PLAYER(play); - s32 temp = DynaPolyActor_IsInRidingMovingState(&this->dyna); + s32 isPlayerOnTop = DynaPolyActor_IsPlayerOnTop(&this->dyna); f32 speedTarget = 0.0f; s16 yawTarget = this->dyna.actor.shape.rot.y; Vec3f nextPoint; - if (temp || ((DynaPolyActor_IsInRidingFallingState(&this->dyna)))) { + if (isPlayerOnTop || DynaPolyActor_IsActorOnTop(&this->dyna)) { if ((this->timer == 0) && - (OBJBOAT_GET_4000(thisx) || (temp && (this->curPointIndex == this->lastPointIndex)))) { + (OBJBOAT_GET_4000(thisx) || (isPlayerOnTop && (this->curPointIndex == this->lastPointIndex)))) { this->direction = -this->direction; if (this->direction > 0) { this->lastPointIndex = this->maxPointIndex; diff --git a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c index 0c888a4ac..b4b27784e 100644 --- a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c +++ b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c @@ -49,7 +49,7 @@ void func_809B1550(Actor* thisx, PlayState* play) { thisx->world.pos.x = (Math_SinS(thisx->shape.rot.y) * sp18) + thisx->home.pos.x; thisx->world.pos.z = (Math_CosS(thisx->shape.rot.y) * sp18) + thisx->home.pos.z; } else { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } } diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index 1a9f62ede..43edd11e0 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -54,7 +54,7 @@ void ObjDanpeilift_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.x = 0; this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.rot.z = 0; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_obj_danpeilift_Colheader_000BA0); if (this->dyna.bgId == BG_ACTOR_MAX) { Actor_Kill(&this->dyna.actor); @@ -130,7 +130,7 @@ void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) { if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || (this->points[0].z != endPoint->z)) { this->actionFunc = ObjDanpeilift_Teleport; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); isPosUpdated = false; } } @@ -143,9 +143,9 @@ void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) { } void ObjDanpeilift_Teleport(ObjDanpeilift* this, PlayState* play) { - if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { ObjDanpeilift_UpdatePosition(this, this->curPoint); - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = ObjDanpeilift_Move; } } @@ -170,20 +170,20 @@ void ObjDanpeilift_Update(Actor* thisx, PlayState* play) { ActorCutscene_Stop(this->dyna.actor.cutscene); } } - if (OBJDANPEILIFT_SHOULD_REACT_TO_WEIGHT(thisx)) { + if (OBJDANPEILIFT_REACT_TO_PLAYER_ON_TOP(thisx)) { f32 target; - this->isWeightOnPrev = this->isWeightOn; - this->isWeightOn = DynaPolyActor_IsInRidingMovingState(&this->dyna) ? 1 : 0; - if ((this->isWeightOn != this->isWeightOnPrev) && (this->maxHeight < 1.0f)) { + this->isPlayerOnTopPrev = this->isPlayerOnTop; + this->isPlayerOnTop = DynaPolyActor_IsPlayerOnTop(&this->dyna) ? true : false; + if ((this->isPlayerOnTop != this->isPlayerOnTopPrev) && (this->maxHeight < 1.0f)) { this->cycle = -0x8000; this->maxHeight = 6.0f; } this->cycle += 0xCE4; Math_StepToF(&this->maxHeight, 0.0f, 0.12f); - step = this->isWeightOn ? Math_CosS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f - : Math_SinS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f; - target = this->isWeightOn ? -8.0f : 0.0f; + step = this->isPlayerOnTop ? Math_CosS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f + : Math_SinS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f; + target = this->isPlayerOnTop ? -8.0f : 0.0f; Math_StepToF(&this->cycleSpeed, target, step); this->dyna.actor.shape.yOffset = ((Math_SinS(this->cycle) * this->maxHeight) + this->cycleSpeed) * 10.0f; } diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h index 392d5d4ca..9c0d023c7 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h @@ -13,7 +13,7 @@ typedef void (*ObjDanpeiliftActionFunc)(struct ObjDanpeilift*, PlayState*); #define OBJDANPEILIFT_GET_PATH(thisx) ((thisx)->params & 0x7F) #define OBJDANPEILIFT_SHOULD_TELEPORT(thisx) (((thisx)->params >> 0xC) & 1) #define OBJDANPEILIFT_GET_SPEED(thisx) ((thisx)->home.rot.z * 0.1f) -#define OBJDANPEILIFT_SHOULD_REACT_TO_WEIGHT(thisx) (((thisx)->params >> 0xE) & 1) +#define OBJDANPEILIFT_REACT_TO_PLAYER_ON_TOP(thisx) (((thisx)->params >> 0xE) & 1) typedef struct ObjDanpeilift { /* 0x000 */ DynaPolyActor dyna; @@ -23,8 +23,8 @@ typedef struct ObjDanpeilift { /* 0x168 */ s32 curPoint; /* 0x16C */ s32 direction; /* 0x170 */ Vec3s* points; - /* 0x174 */ s32 isWeightOn; - /* 0x178 */ s32 isWeightOnPrev; + /* 0x174 */ s32 isPlayerOnTop; + /* 0x178 */ s32 isPlayerOnTopPrev; /* 0x17C */ f32 cycleSpeed; /* 0x180 */ f32 maxHeight; /* 0x184 */ s16 cycle; diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index 4a0c5194f..c942f622b 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -441,7 +441,7 @@ void func_80B13940(ObjDhouse* this, PlayState* play2) { if (sp20) { func_80B12A88(&this->dyna.actor); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = func_80B13C08; this->dyna.actor.flags |= ACTOR_FLAG_20; func_80B139D8(this); diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c index a93ab99bf..7d729495a 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c @@ -389,7 +389,7 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) { if ((this->unk_16C[0].x != points->x) || (this->unk_16C[0].y != points->y) || (this->unk_16C[0].z != points->z)) { func_80A6743C(this); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); sp30 = false; } } @@ -408,7 +408,7 @@ void func_80A6743C(ObjDriftice* this) { void func_80A67450(ObjDriftice* this, PlayState* play) { if (this->unk_248 < 0) { func_80A66570(this, this->unk_164); - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); func_80A671CC(this); } } @@ -429,7 +429,7 @@ void func_80A674C4(ObjDriftice* this, PlayState* play) { void ObjDriftice_Update(Actor* thisx, PlayState* play) { ObjDriftice* this = THIS; - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if (this->unk_248 < 0) { this->unk_248 = 1; } else { diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index 69829d09e..ac9184923 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -154,7 +154,7 @@ void ObjEtcetera_Idle(ObjEtcetera* this, PlayState* play) { this->oscillationTimer = minOscillationTimer; } } else { - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if (!(this->burrowFlag & 1)) { // Player is walking onto the Deku Flower, or falling on it from a height this->oscillationTimer = 10; @@ -187,7 +187,7 @@ void ObjEtcetera_Idle(ObjEtcetera* this, PlayState* play) { } void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, PlayState* play) { - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { this->burrowFlag |= 1; } else { this->burrowFlag &= ~1; @@ -209,11 +209,11 @@ void ObjEtcetera_PlayRustleAnimation(ObjEtcetera* this, PlayState* play) { void ObjEtcetera_DoBounceOscillation(ObjEtcetera* this, PlayState* play) { // In order to match, we are seemingly required to access scale.x at one point // without using this. We can create a thisx or dyna pointer to achieve that, but - // it's more likely they used dyna given that DynaPolyActor_IsInRidingMovingState takes a DynaPolyActor. + // it's more likely they used dyna given that DynaPolyActor_IsPlayerOnTop takes a DynaPolyActor. DynaPolyActor* dyna = &this->dyna; f32 scaleTemp; - if (DynaPolyActor_IsInRidingMovingState(dyna)) { + if (DynaPolyActor_IsPlayerOnTop(dyna)) { this->burrowFlag |= 1; } else { this->burrowFlag &= ~1; @@ -260,7 +260,7 @@ void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->objIndex)) { this->dyna.actor.objBankIndex = this->objIndex; Actor_SetObjectDependency(play, &this->dyna.actor); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); thisCollisionHeader = collisionHeaders[type]; if (thisCollisionHeader != NULL) { CollisionHeader_GetVirtual(thisCollisionHeader, &colHeader); diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 021c253ce..2a2e23c13 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -154,7 +154,7 @@ void ObjGhaka_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, D_80B3C96C); Actor_SetScale(&this->dyna.actor, 0.1f); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&object_ghaka_Colheader_003CD0, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index 582d0a235..d35c9f11e 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -106,7 +106,7 @@ void ObjHakaisi_Init(Actor* thisx, PlayState* play) { return; } - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&object_hakaisi_Colheader_002FC4, &sp7C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp7C); @@ -201,7 +201,7 @@ void func_80B1456C(ObjHakaisi* this, PlayState* play) { } if (this->dyna.actor.colChkInfo.health < 30) { func_80B145F4(this); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } } diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index fa39be7df..5be919068 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -70,7 +70,7 @@ void ObjHgdoor_Init(Actor* thisx, PlayState* play) { CollisionHeader* header = NULL; Actor_SetScale(&this->dyna.actor, 0.1f); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if (OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) { CollisionHeader_GetVirtual(&object_hgdoor_Colheader_001D10, &header); } else { diff --git a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c index b7b1bf92e..ffc3558e6 100644 --- a/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c +++ b/src/overlays/actors/ovl_Obj_HsStump/z_obj_hsstump.c @@ -45,7 +45,7 @@ void ObjHsStump_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->isHidden = OBJHSSTUMP_GET_ISHIDDEN(thisx); this->switchFlag = OBJHSSTUMP_GET_SWITCHFLAG(thisx); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_hsstump_Colheader_0011B0); switch (this->isHidden) { case true: @@ -54,10 +54,15 @@ void ObjHsStump_Init(Actor* thisx, PlayState* play) { } else { this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.0f); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } + // fallthrough case false: ObjHsStump_SetupIdle(this, play); + break; + + default: + break; } } @@ -124,7 +129,7 @@ void ObjHsStump_Appear(ObjHsStump* this, PlayState* play) { } if (this->dyna.actor.scale.x == (18.0f * 0.01f)) { this->isHidden = false; - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); ObjHsStump_SetupIdle(this, play); } this->framesAppeared++; diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index a861e9e63..089cddf02 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -120,7 +120,7 @@ void func_80B9C5E8(ObjHunsui* this, PlayState* play) { if ((this->dyna.actor.xzDistToPlayer < (45.0f * this->dyna.actor.scale.x * 10.0f)) && (this->dyna.actor.playerHeightRel < -21.0f)) { - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { this->unk_172 &= ~8; this->unk_19C = 0.0f; this->unk_1A0 = 0.0f; @@ -205,7 +205,7 @@ void ObjHunsui_Init(Actor* thisx, PlayState* play) { this->unk_160 = OBJHUNSUI_GET_F000(thisx); this->unk_164 = OBJHUNSUI_GET_F80(thisx); this->unk_168 = OBJHUNSUI_GET_7F(thisx); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if ((this->unk_160 != OBJHUNSUI_F000_5) && (this->unk_160 != OBJHUNSUI_F000_6)) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_hunsui_Colheader_000C74); @@ -616,7 +616,7 @@ void func_80B9D714(ObjHunsui* this, PlayState* play) { } } - if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if (this->dyna.actor.xzDistToPlayer < 45.0f) { if ((this->dyna.actor.playerHeightRel < -this->dyna.actor.velocity.y) && (this->dyna.actor.playerHeightRel >= -800.0f)) { diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 8aa23816d..886762306 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -643,7 +643,7 @@ s32 func_80A24954(ObjIceblock* this, PlayState* play) { void func_80A24A48(ObjIceblock* this, PlayState* play) { if (!(this->unk_1B0 & 0x10) && !(this->collider.base.ocFlags1 & OC1_HIT)) { - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->unk_1B0 |= 0x10; } } @@ -921,9 +921,9 @@ void ObjIceblock_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; } - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &gIceBlockCol); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); @@ -1427,7 +1427,7 @@ void ObjIceblock_Update(Actor* thisx, PlayState* play) { } } - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if (this->unk_1B0 & 0x20) { this->unk_1B0 &= ~0x40; } else { diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 5b15d0ecc..e33f62f8b 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -8,7 +8,7 @@ #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "objects/object_kibako/object_kibako.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_4000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_CAN_PRESS_SWITCH) #define THIS ((ObjKibako*)thisx) @@ -349,7 +349,7 @@ void ObjKibako_Held(ObjKibako* this, PlayState* play) { } else { Actor_MoveWithGravity(&this->actor); ObjKibako_SetupThrown(this); - this->actor.flags &= ~ACTOR_FLAG_4000000; + this->actor.flags &= ~ACTOR_FLAG_CAN_PRESS_SWITCH; } Actor_UpdateBgCheckInfo(play, &this->actor, 18.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40); diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index e9ca6aba8..eb14dff6a 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -211,7 +211,7 @@ void ObjKibako2_Idle(ObjKibako2* this, PlayState* play) { ObjKibako2_Break(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); this->dyna.actor.flags |= ACTOR_FLAG_10; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; this->actionFunc = ObjKibako2_Kill; } else if (this->dyna.actor.xzDistToPlayer < 600.0f) { diff --git a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c index 9ceff660e..65ebe75b6 100644 --- a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c +++ b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c @@ -41,7 +41,7 @@ void ObjKzsaku_Init(Actor* thisx, PlayState* play) { CollisionHeader* col = NULL; Actor_SetScale(&this->dyna.actor, 1.0f); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&object_kzsaku_Colheader_001118, &col); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, col); diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index aff88964b..a82c9ceea 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -100,7 +100,7 @@ void ObjLift_Init(Actor* thisx, PlayState* play) { this->dyna.actor.shape.rot.z = 0; this->unk_178 = this->dyna.actor.home.rot.z; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if ((this->unk_178 <= 0) && (Flags_GetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor)))) { Actor_Kill(&this->dyna.actor); return; @@ -129,7 +129,7 @@ void func_8093D7A0(ObjLift* this, PlayState* play) { s32 pad; s16 quakeIndex; - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if (this->timer <= 0) { if (OBJLIFT_GET_7(&this->dyna.actor) == 7) { func_8093D9C0(this); @@ -194,7 +194,7 @@ void func_8093DA48(ObjLift* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK); if (this->unk_178 > 0) { func_8093DB70(this); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } else { Flags_SetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor)); Actor_Kill(&this->dyna.actor); @@ -212,7 +212,7 @@ void func_8093DB90(ObjLift* this, PlayState* play) { if (this->timer <= 0) { Math_Vec3f_Copy(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos); this->dyna.actor.world.rot = this->dyna.actor.shape.rot = this->dyna.actor.home.rot; - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); func_8093D760(this); } } diff --git a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c index 16a628fa2..8225c6c49 100644 --- a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c +++ b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c @@ -178,7 +178,7 @@ void func_80AF3C34(ObjLightblock* this, PlayState* play) { } else { this->alpha = 0; this->dyna.actor.draw = NULL; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } } } diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c index 8d6ae9f71..cb957b839 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c @@ -55,7 +55,7 @@ void ObjLupygamelift_Init(Actor* thisx, PlayState* play) { this->timer = 0; Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawSquare, 0.0f); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_raillift_Colheader_0048D0); this->targetSpeedXZ = thisx->home.rot.z * 0.1f; if (this->targetSpeedXZ < 0.0f) { diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c index ab60ec034..0b4e4e14b 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c @@ -62,7 +62,7 @@ void ObjOcarinalift_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.x = 0; this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.rot.z = 0; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_raillift_Colheader_0048D0); this->unk160 = thisx->home.rot.z * 0.1f; if (this->unk160 < 0.01f) { @@ -153,7 +153,7 @@ void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { if (((this->unk170->x != temp_v1_2->x) || (this->unk170->y != temp_v1_2->y)) || (this->unk170->z != temp_v1_2->z)) { func_80AC99C0(this); - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); sp34 = false; } else if ((paramsC == OBJOCARINALIFT_PARAMSC_1) && (this->unk168 == OBJOCARINALIFT_GET_1F(thisx))) { func_80AC9AB8(this); @@ -173,9 +173,9 @@ void func_80AC99C0(ObjOcarinalift* this) { } void func_80AC99D4(ObjOcarinalift* this, PlayState* play) { - if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { func_80AC94C0(this, this->unk168); - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); if ((OBJOCARINALIFT_GET_C(&this->dyna.actor) == OBJOCARINALIFT_PARAMSC_1) && (this->unk168 == OBJOCARINALIFT_GET_1F(&this->dyna.actor))) { func_80AC9AB8(this); @@ -205,7 +205,7 @@ void func_80AC9AE0(ObjOcarinalift* this, PlayState* play) { if (func_800B8718(&this->dyna.actor, &play->state)) { func_80152434(play, 1); func_80AC9B48(this); - } else if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + } else if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { func_800B8804(&this->dyna.actor, play, 40.0f); } } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 3038a6d09..c3e180f50 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -196,7 +196,7 @@ void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_Init(Actor* thisx, PlayState* play) { ObjOshihiki* this = THIS; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if ((OBJOSHIHIKI_GET_FF00(&this->dyna.actor) >= OBJOSHIHIKI_FF00_0) && (OBJOSHIHIKI_GET_FF00(&this->dyna.actor) < OBJOSHIHIKI_FF00_80)) { @@ -439,8 +439,8 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { } else { dyna = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); if (dyna != NULL) { - DynaPolyActor_SetRidingFallingState(dyna); - DynaPolyActor_SetSwitchPressedState(dyna); + DynaPolyActor_SetActorOnTop(dyna); + DynaPolyActor_SetActorOnSwitch(dyna); if ((this->timer <= 0) && (fabsf(this->dyna.pushForce) > 0.001f) && ObjOshihiki_StrongEnough(this, play) && ObjOshihiki_NoSwitchPress(this, dyna, play) && !ObjOshihiki_CheckWall(play, this->dyna.yRotation, this->dyna.pushForce, this)) { @@ -456,9 +456,9 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { ObjOshihiki_SetupFall(this, play); } else { dyna = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); - if ((dyna != NULL) && (dyna->flags & 1)) { - DynaPolyActor_SetRidingFallingState(dyna); - DynaPolyActor_SetSwitchPressedState(dyna); + if ((dyna != NULL) && (dyna->transformFlags & DYNA_TRANSFORM_POS)) { + DynaPolyActor_SetActorOnTop(dyna); + DynaPolyActor_SetActorOnSwitch(dyna); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } else { ObjOshihiki_SetupFall(this, play); diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c index d5f0c902c..0b5021ccb 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c @@ -8,7 +8,7 @@ #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "objects/object_secom_obj/object_secom_obj.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_4000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_CAN_PRESS_SWITCH) #define THIS ((ObjPzlblock*)thisx) diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 0fdf0a86b..5788f1585 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -66,7 +66,7 @@ void ObjRaillift_Init(Actor* thisx, PlayState* play) { thisx->world.rot.x = 0; thisx->shape.rot.z = 0; thisx->world.rot.z = 0; - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[type]); this->speed = OBJRAILLIFT_GET_SPEED(thisx); if (this->speed < 0.0f) { @@ -164,7 +164,7 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || (this->points[0].z != endPoint->z)) { this->actionFunc = ObjRaillift_Teleport; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); isPosUpdated = false; } } @@ -180,9 +180,9 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { Will teleport to what ever curpoint is set to */ void ObjRaillift_Teleport(ObjRaillift* this, PlayState* play) { - if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { ObjRaillift_UpdatePosition(this, this->curPoint); - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = ObjRaillift_Move; } } @@ -226,24 +226,20 @@ void ObjRaillift_Update(Actor* thisx, PlayState* play) { ActorCutscene_Stop(this->dyna.actor.cutscene); } } - if (OBJRAILLIFT_SHOULD_REACT_TO_WEIGHT(thisx)) { + if (OBJRAILLIFT_REACT_TO_PLAYER_ON_TOP(thisx)) { s32 requiredScopeTemp; - this->isWeightOnPrev = this->isWeightOn; - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { - this->isWeightOn = true; - } else { - this->isWeightOn = false; - } - if ((this->isWeightOn != this->isWeightOnPrev) && (this->maxHeight < 1.0f)) { + this->isPlayerOnTopPrev = this->isPlayerOnTop; + this->isPlayerOnTop = DynaPolyActor_IsPlayerOnTop(&this->dyna) ? true : false; + if ((this->isPlayerOnTop != this->isPlayerOnTopPrev) && (this->maxHeight < 1.0f)) { this->cycle = -0x8000; this->maxHeight = 6.0f; } this->cycle += 0xCE4; Math_StepToF(&this->maxHeight, 0.0f, 0.12f); - step = this->isWeightOn ? Math_CosS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f - : Math_SinS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f; - target = this->isWeightOn ? -8.0f : 0.0f; + step = this->isPlayerOnTop ? Math_CosS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f + : Math_SinS(fabsf(this->cycleSpeed) * 2048.0f) + 0.02f; + target = this->isPlayerOnTop ? -8.0f : 0.0f; Math_StepToF(&this->cycleSpeed, target, step); this->dyna.actor.shape.yOffset = ((Math_SinS(this->cycle) * this->maxHeight) + this->cycleSpeed) * 10.0f; } diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h index 41b7a821e..b921b0e5a 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h @@ -14,7 +14,7 @@ typedef void (*ObjRailliftActionFunc)(struct ObjRaillift*, PlayState*); #define OBJRAILLIFT_GET_STARTING_POINT(thisx) (((thisx)->params >> 7) & 0x1F) #define OBJRAILLIFT_GET_SPEED(thisx) ((thisx)->home.rot.z * 0.1f) #define OBJRAILLIFT_SHOULD_TELEPORT(thisx) (((thisx)->params >> 0xC) & 1) -#define OBJRAILLIFT_SHOULD_REACT_TO_WEIGHT(thisx) (((thisx)->params >> 0xE) & 1) +#define OBJRAILLIFT_REACT_TO_PLAYER_ON_TOP(thisx) (((thisx)->params >> 0xE) & 1) typedef enum { /* 0 */ OOT_WATER_TEMPLE_WATERFALL_PLATFORM, @@ -29,8 +29,8 @@ typedef struct ObjRaillift { /* 0x168 */ s32 curPoint; /* 0x16C */ s32 direction; // +1 for forward, -1 for backward /* 0x170 */ Vec3s* points; - /* 0x174 */ s32 isWeightOn; - /* 0x178 */ s32 isWeightOnPrev; + /* 0x174 */ s32 isPlayerOnTop; + /* 0x178 */ s32 isPlayerOnTopPrev; /* 0x17C */ f32 cycleSpeed; /* 0x180 */ f32 maxHeight; /* 0x184 */ s16 cycle; diff --git a/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c index ce18a68b0..4c63908c6 100644 --- a/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c +++ b/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.c @@ -111,7 +111,7 @@ void ObjRotlift_Init(Actor* thisx, PlayState* play2) { ObjRotlift_MoveDekuFlowers(this); } - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); modelInfo = &sModelInfo[type]; DynaPolyActor_LoadMesh(play, &this->dyna, modelInfo->colHeader); diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c index 80e9b1201..385bb65fb 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c @@ -489,7 +489,7 @@ void ObjSkateblock_Init(Actor* thisx, PlayState* play) { ObjSkateblock* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &gameplay_dangeon_keep_Colheader_007498); if (D_80A22A18 == NULL) { D_80A22A18 = Lib_SegmentedToVirtual(gameplay_dangeon_keep_Matanimheader_01B370); @@ -616,7 +616,7 @@ void func_80A2264C(ObjSkateblock* this, PlayState* play) { if (sp20 || ((this->unk_160 - this->dyna.actor.world.pos.y) > 300.0f)) { if (SurfaceType_GetFloorProperty(&play->colCtx, this->dyna.actor.floorPoly, this->dyna.actor.floorBgId) == FLOOR_PROPERTY_12) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; func_80A22728(this); return; @@ -633,7 +633,7 @@ void func_80A22728(ObjSkateblock* this) { } void func_80A2273C(ObjSkateblock* this, PlayState* play) { - if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.y = (this->dyna.actor.home.pos.y - (600.0f * this->dyna.actor.scale.y)) - 10.0f; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; @@ -657,14 +657,14 @@ void func_80A227C0(ObjSkateblock* this, PlayState* play) { return; } - func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = ObjSkateblock_Draw; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f)) { func_80A22308(this); } - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { D_80A22A10 |= 1 << this->unk_1C0; } } diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 13e127c73..6e959a8dc 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -755,7 +755,7 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { this->unk_3C1--; if (this->unk_3C1 == 40) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } if (this->unk_3C1 >= 32) { diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 76f5bc872..9a1ab7095 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -284,7 +284,7 @@ void ObjSwitch_PlayDiamondSwitchSfx(ObjSwitch* this) { } void ObjSwitch_SetFloorSwitchSnapPlayerState(ObjSwitch* this, s32 state) { - if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { this->floorSwitchPlayerSnapState = state; } } @@ -344,7 +344,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { } else { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 1.0f; } - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &gFloorSwitchCol); } if (type == OBJSWITCH_TYPE_FLOOR) { @@ -517,13 +517,13 @@ void ObjSwitch_FloorSwitchUp(ObjSwitch* this, PlayState* play) { } else { switch (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor)) { case OBJSWITCH_SUBTYPE_ONCE: - if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); } break; case OBJSWITCH_SUBTYPE_SYNC: - if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); } else if (Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { @@ -531,7 +531,7 @@ void ObjSwitch_FloorSwitchUp(ObjSwitch* this, PlayState* play) { } break; case OBJSWITCH_SUBTYPE_TOGGLE: - if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { s32 isSwitchFlagNotSet = Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor)) ? false : true; @@ -540,13 +540,13 @@ void ObjSwitch_FloorSwitchUp(ObjSwitch* this, PlayState* play) { } break; case OBJSWITCH_SUBTYPE_RESET: - if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_FloorSwitchPushDownInit, true); } break; case OBJSWITCH_SUBTYPE_RESET_INVERTED: - if (DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsSwitchPressed(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 2); ObjSwitch_SetSwitchFlagState(this, play, false); ObjSwitch_FloorSwitchPushDownInit(this); @@ -584,7 +584,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { case OBJSWITCH_SUBTYPE_ONCE: case OBJSWITCH_SUBTYPE_SYNC: if (!Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { - if ((play->sceneId == SCENE_SECOM) && DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if ((play->sceneId == SCENE_SECOM) && DynaPolyActor_IsSwitchPressed(&this->dyna)) { ObjSwitch_SetSwitchFlagState(this, play, true); } else { ObjSwitch_FloorSwitchRiseUpInit(this); @@ -594,7 +594,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { case OBJSWITCH_SUBTYPE_TOGGLE: case OBJSWITCH_SUBTYPE_RESET: case OBJSWITCH_SUBTYPE_RESET_INVERTED: - if (!DynaPolyActor_IsInSwitchPressedState(&this->dyna) && + if (!DynaPolyActor_IsSwitchPressed(&this->dyna) && (!Player_InCsMode(play) || (play->sceneId == SCENE_SECOM))) { if (this->floorSwitchReleaseTimer <= 0) { if (subType == OBJSWITCH_SUBTYPE_RESET) { @@ -841,16 +841,16 @@ void ObjSwitch_LargeFloorSwitchUp(ObjSwitch* this, PlayState* play) { s32 subType = OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor); if (subType == OBJSWITCH_SUBTYPE_ONCE) { - if (DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsHeavySwitchPressed(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_LargeFloorSwitchPushDownInit, true); } } else if (subType == OBJSWITCH_SUBTYPE_RESET) { - if (DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { + if (DynaPolyActor_IsHeavySwitchPressed(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 1); ObjSwitch_TryPlayCutsceneInit(this, play, ObjSwitch_LargeFloorSwitchPushDownInit, true); } - } else if (subType == OBJSWITCH_SUBTYPE_RESET_INVERTED && DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna)) { + } else if (subType == OBJSWITCH_SUBTYPE_RESET_INVERTED && DynaPolyActor_IsHeavySwitchPressed(&this->dyna)) { ObjSwitch_SetFloorSwitchSnapPlayerState(this, 2); ObjSwitch_SetSwitchFlagState(this, play, false); ObjSwitch_LargeFloorSwitchPushDownInit(this); @@ -885,7 +885,7 @@ void ObjSwitch_LargeFloorSwitchDown(ObjSwitch* this, PlayState* play) { ObjSwitch_LargeFloorSwitchRiseUpInit(this); } } else if (subType == OBJSWITCH_SUBTYPE_RESET || subType == OBJSWITCH_SUBTYPE_RESET_INVERTED) { - if (!DynaPolyActor_IsInHeavySwitchPressedState(&this->dyna) && !Player_InCsMode(play)) { + if (!DynaPolyActor_IsHeavySwitchPressed(&this->dyna) && !Player_InCsMode(play)) { if (this->floorSwitchReleaseTimer <= 0) { if (OBJ_SWITCH_GET_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_RESET) { ObjSwitch_SetSwitchFlagState(this, play, false); @@ -936,7 +936,7 @@ void ObjSwitch_Update(Actor* thisx, PlayState* play) { case OBJSWITCH_TYPE_FLOOR: case OBJSWITCH_TYPE_FLOOR_RUSTY: case OBJSWITCH_TYPE_FLOOR_LARGE: - this->collisionFlags = this->dyna.stateFlags; + this->collisionFlags = this->dyna.interactFlags; break; case OBJSWITCH_TYPE_EYE: this->collisionFlags = this->colliderTris.base.acFlags; diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c index 5608143b3..9a01a8da3 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -279,7 +279,7 @@ void func_80B9C07C(ObjTaru* this, PlayState* play) { this->actionFunc = func_80B9C1A0; } else { this->dyna.actor.flags |= ACTOR_FLAG_10; - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.draw = NULL; this->actionFunc = func_80B9C174; } diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 4f02a46b2..ec47acd86 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -247,7 +247,7 @@ void ObjTokeiStep_SetupOpen(ObjTokeiStep* this) { void ObjTokeiStep_Open(ObjTokeiStep* this, PlayState* play) { if (ObjTokeiStep_OpenProcess(this, play)) { - func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); ObjTokeiStep_SetupDoNothingOpen(this); } } diff --git a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c index 6009affe4..996bc3810 100644 --- a/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c +++ b/src/overlays/actors/ovl_Obj_Tree/z_obj_tree.c @@ -99,7 +99,7 @@ void ObjTree_Init(Actor* thisx, PlayState* play) { this->dyna.actor.uncullZoneForward = 4000.0f; } else { Actor_SetScale(&this->dyna.actor, 0.1f); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&object_tree_Colheader_001B2C, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 7b4fcf574..5f0e6c411 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -10,7 +10,7 @@ #include "objects/object_tsubo/object_tsubo.h" #include "objects/object_racetsubo/object_racetsubo.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000 | ACTOR_FLAG_4000000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_800000 | ACTOR_FLAG_CAN_PRESS_SWITCH) #define THIS ((ObjTsubo*)thisx) @@ -532,7 +532,7 @@ void func_80928D80(ObjTsubo* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; Actor_MoveWithGravity(&this->actor); - this->actor.flags &= ~ACTOR_FLAG_4000000; + this->actor.flags &= ~ACTOR_FLAG_CAN_PRESS_SWITCH; Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_40 | UPDBGCHECKINFO_FLAG_80); @@ -647,7 +647,7 @@ void func_8092926C(ObjTsubo* this, PlayState* play) { } else { scale = sPotTypeData[OBJ_TSUBO_GET_TYPE(&this->actor)].scale; if (Math_StepToF(&this->actor.scale.x, scale, scale * 0.1f)) { - this->actor.flags |= ACTOR_FLAG_4000000; + this->actor.flags |= ACTOR_FLAG_CAN_PRESS_SWITCH; func_809289B4(this); } this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index ac938752a..677cbfe2a 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -763,7 +763,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); DynaPolyActor_LoadMesh(play, &this->dyna, &object_um_Colheader_007E20); } else { - DynaPolyActor_Init(&this->dyna, 3); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &object_um_Colheader_007F50); } @@ -772,7 +772,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { return; } - func_800C636C(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->donkey = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, this->dyna.actor.world.pos.x, diff --git a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c index 9399940d8..96de17fb0 100644 --- a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c +++ b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c @@ -39,7 +39,7 @@ void ObjY2lift_Init(Actor* thisx, PlayState* play) { ObjY2lift* this = THIS; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &gPirateLiftPlatformCol); } @@ -53,13 +53,13 @@ void ObjY2lift_Update(Actor* thisx, PlayState* play) { ObjY2lift* this = THIS; f32 temp_fv0 = this->dyna.actor.world.pos.y; f32 targetVelocityY = 0.0f; - s32 temp_v0 = DynaPolyActor_IsInRidingMovingState(&this->dyna); + s32 isPlayerOnTop = DynaPolyActor_IsPlayerOnTop(&this->dyna); - if (temp_v0 || DynaPolyActor_IsInRidingFallingState(&this->dyna)) { + if (isPlayerOnTop || DynaPolyActor_IsActorOnTop(&this->dyna)) { if (!this->unk15D) { this->unk15D = true; this->unk15F = 12; - } else if (this->unk15F == 0 && temp_v0) { + } else if ((this->unk15F == 0) && isPlayerOnTop) { this->unk15C = 16; } } else { @@ -68,7 +68,7 @@ void ObjY2lift_Update(Actor* thisx, PlayState* play) { if (DECR(this->unk15C) != 0) { temp_fv0 = this->dyna.actor.home.pos.y + 180.0f; targetVelocityY = 2.0f; - } else if (!temp_v0 && this->dyna.actor.velocity.y <= 0.0f) { + } else if (!isPlayerOnTop && (this->dyna.actor.velocity.y <= 0.0f)) { temp_fv0 = this->dyna.actor.home.pos.y; targetVelocityY = -2.0f; } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index ae80bd5e1..7464ad05e 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1016,18 +1016,18 @@ 0x800C6098:("DynaPoly_Alloc",), 0x800C6188:("DynaPoly_SetBgActor",), 0x800C6248:("DynaPoly_GetActor",), - 0x800C62BC:("func_800C62BC",), - 0x800C6314:("func_800C6314",), - 0x800C636C:("func_800C636C",), - 0x800C63C4:("func_800C63C4",), - 0x800C641C:("func_800C641C",), - 0x800C6474:("func_800C6474",), + 0x800C62BC:("DynaPoly_DisableCollision",), + 0x800C6314:("DynaPoly_EnableCollision",), + 0x800C636C:("DynaPoly_DisableCeilingCollision",), + 0x800C63C4:("DynaPoly_EnableCeilingCollision",), + 0x800C641C:("DynaPoly_DisableFloorCollision",), + 0x800C6474:("DynaPoly_EnableFloorCollision",), 0x800C64CC:("DynaPoly_DeleteBgActor",), - 0x800C6554:("func_800C6554",), + 0x800C6554:("DynaPoly_InvalidateLookup",), 0x800C656C:("BgCheck_CalcWaterboxDimensions",), - 0x800C6838:("DynaPoly_ExpandSRT",), - 0x800C734C:("BgCheck_ResetFlagsIfLoadedActor",), - 0x800C73E4:("DynaPoly_Setup",), + 0x800C6838:("DynaPoly_AddBgActorToLookup",), + 0x800C734C:("DynaPoly_UnsetAllInteractFlags",), + 0x800C73E4:("DynaPoly_UpdateContext",), 0x800C756C:("func_800C756C",), 0x800C765C:("DynaPoly_UpdateBgActorTransforms",), 0x800C76EC:("BgCheck_RaycastFloorDynaList",), @@ -1092,25 +1092,25 @@ 0x800CA6F0:("func_800CA6F0",), 0x800CA9D0:("func_800CA9D0",), 0x800CAA14:("func_800CAA14",), - 0x800CAAD0:("BgCheck2_UpdateActorPosition",), - 0x800CAC0C:("BgCheck2_UpdateActorYRotation",), - 0x800CACA0:("BgCheck2_AttachToMesh",), - 0x800CAD2C:("BgCheck2_UpdateActorAttachedToMesh",), + 0x800CAAD0:("DynaPolyActor_UpdateCarriedActorPos",), + 0x800CAC0C:("DynaPolyActor_UpdateCarriedActorRotY",), + 0x800CACA0:("DynaPolyActor_AttachCarriedActor",), + 0x800CAD2C:("DynaPolyActor_TransformCarriedActor",), 0x800CAE10:("DynaPolyActor_Init",), 0x800CAE34:("DynaPolyActor_LoadMesh",), - 0x800CAE7C:("DynaPolyActor_ResetState",), - 0x800CAE88:("DynaPolyActor_SetRidingFallingState",), - 0x800CAE9C:("DynaPolyActor_SetRidingMovingState",), - 0x800CAEB0:("DynaPolyActor_SetRidingMovingStateByIndex",), - 0x800CAEE0:("DynaPolyActor_SetRidingRotatingState",), - 0x800CAEF4:("DynaPolyActor_SetRidingRotatingStateByIndex",), - 0x800CAF24:("DynaPolyActor_SetSwitchPressedState",), - 0x800CAF38:("DynaPolyActor_SetHeavySwitchPressedState",), - 0x800CAF4C:("DynaPolyActor_IsInRidingFallingState",), - 0x800CAF70:("DynaPolyActor_IsInRidingMovingState",), - 0x800CAF94:("DynaPolyActor_IsInRidingRotatingState",), - 0x800CAFB8:("DynaPolyActor_IsInSwitchPressedState",), - 0x800CAFDC:("DynaPolyActor_IsInHeavySwitchPressedState",), + 0x800CAE7C:("DynaPolyActor_UnsetAllInteractFlags",), + 0x800CAE88:("DynaPolyActor_SetActorOnTop",), + 0x800CAE9C:("DynaPolyActor_SetPlayerOnTop",), + 0x800CAEB0:("DynaPoly_SetPlayerOnTop",), + 0x800CAEE0:("DynaPolyActor_SetPlayerAbove",), + 0x800CAEF4:("DynaPoly_SetPlayerAbove",), + 0x800CAF24:("DynaPolyActor_SetActorOnSwitch",), + 0x800CAF38:("DynaPolyActor_SetActorOnHeavySwitch",), + 0x800CAF4C:("DynaPolyActor_IsActorOnTop",), + 0x800CAF70:("DynaPolyActor_IsPlayerOnTop",), + 0x800CAF94:("DynaPolyActor_IsPlayerAbove",), + 0x800CAFB8:("DynaPolyActor_IsSwitchPressed",), + 0x800CAFDC:("DynaPolyActor_IsHeavySwitchPressed",), 0x800CB000:("DynaPolyActor_ValidateMove",), 0x800CB210:("Camera_fabsf",), 0x800CB240:("Camera_Vec3fMagnitude",), diff --git a/tools/namefixer.py b/tools/namefixer.py index bb22b1fca..7a88f79d9 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -450,13 +450,32 @@ wordReplace = { "BgCheck_AddActorMesh": "DynaPoly_SetBgActor", "BgCheck_GetActorOfMesh": "DynaPoly_GetActor", "BgCheck_RemoveActorMesh": "DynaPoly_DeleteBgActor", - "BgCheck_AddActorMeshToLists": "DynaPoly_ExpandSRT", - "BgCheck_Update": "DynaPoly_Setup", + "BgCheck_AddActorMeshToLists": "DynaPoly_AddBgActorToLookup", + "BgCheck_Update": "DynaPoly_UpdateContext", "BgCheck_UpdateAllActorMeshes": "DynaPoly_UpdateBgActorTransforms", "BgCheck_RelocateMeshHeaderPointers": "CollisionHeader_SegmentedToVirtual", "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual", "BgCheck_RelocateAllMeshHeaders": "BgCheck_InitCollisionHeaders", "BgCheck_GetPolygonAttributes": "SurfaceType_GetData", + "DynaPolyActor_ResetState": "DynaPolyActor_UnsetAllInteractFlags", + "DynaPolyActor_SetRidingFallingState": "DynaPolyActor_SetActorOnTop", + "DynaPolyActor_SetRidingMovingState": "DynaPolyActor_SetPlayerOnTop", + "DynaPolyActor_SetRidingMovingStateByIndex": "DynaPoly_SetPlayerOnTop", + "DynaPolyActor_SetRidingRotatingState": "DynaPolyActor_SetPlayerAbove", + "DynaPolyActor_SetRidingRotatingStateByIndex": "DynaPoly_SetPlayerAbove", + "DynaPolyActor_SetSwitchPressedState": "DynaPolyActor_SetActorOnSwitch", + "DynaPolyActor_SetHeavySwitchPressedState": "DynaPolyActor_SetActorOnHeavySwitch", + "DynaPolyActor_IsInRidingFallingState": "DynaPolyActor_IsActorOnTop", + "DynaPolyActor_IsInRidingMovingState": "DynaPolyActor_IsPlayerOnTop", + "DynaPolyActor_IsInRidingRotatingState": "DynaPolyActor_IsPlayerAbove", + "DynaPolyActor_IsInSwitchPressedState": "DynaPolyActor_IsSwitchPressed", + "DynaPolyActor_IsInHeavySwitchPressedState": "DynaPolyActor_IsHeavySwitchPressed", + "func_800C62BC": "DynaPoly_DisableCollision", + "func_800C6314": "DynaPoly_EnableCollision", + "func_800C636C": "DynaPoly_DisableCeilingCollision", + "func_800C63C4": "DynaPoly_EnableCeilingCollision", + "func_800C641C": "DynaPoly_DisableFloorCollision", + "func_800C6474": "DynaPoly_EnableFloorCollision", "SurfaceType_GetConveyorType": "SurfaceType_IsFloorConveyor", "func_800C9704": "SurfaceType_GetBgCamIndex", "func_800C9924": "BgCheck_GetBgCamFuncData", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 353a7f394..8bfb180ff 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -530,18 +530,18 @@ asm/non_matchings/code/z_bgcheck/DynaPoly_Init.s,DynaPoly_Init,0x800C6044,0x15 asm/non_matchings/code/z_bgcheck/DynaPoly_Alloc.s,DynaPoly_Alloc,0x800C6098,0x3C asm/non_matchings/code/z_bgcheck/DynaPoly_SetBgActor.s,DynaPoly_SetBgActor,0x800C6188,0x30 asm/non_matchings/code/z_bgcheck/DynaPoly_GetActor.s,DynaPoly_GetActor,0x800C6248,0x1D -asm/non_matchings/code/z_bgcheck/func_800C62BC.s,func_800C62BC,0x800C62BC,0x16 -asm/non_matchings/code/z_bgcheck/func_800C6314.s,func_800C6314,0x800C6314,0x16 -asm/non_matchings/code/z_bgcheck/func_800C636C.s,func_800C636C,0x800C636C,0x16 -asm/non_matchings/code/z_bgcheck/func_800C63C4.s,func_800C63C4,0x800C63C4,0x16 -asm/non_matchings/code/z_bgcheck/func_800C641C.s,func_800C641C,0x800C641C,0x16 -asm/non_matchings/code/z_bgcheck/func_800C6474.s,func_800C6474,0x800C6474,0x16 +asm/non_matchings/code/z_bgcheck/DynaPoly_DisableCollision.s,DynaPoly_DisableCollision,0x800C62BC,0x16 +asm/non_matchings/code/z_bgcheck/DynaPoly_EnableCollision.s,DynaPoly_EnableCollision,0x800C6314,0x16 +asm/non_matchings/code/z_bgcheck/DynaPoly_DisableCeilingCollision.s,DynaPoly_DisableCeilingCollision,0x800C636C,0x16 +asm/non_matchings/code/z_bgcheck/DynaPoly_EnableCeilingCollision.s,DynaPoly_EnableCeilingCollision,0x800C63C4,0x16 +asm/non_matchings/code/z_bgcheck/DynaPoly_DisableFloorCollision.s,DynaPoly_DisableFloorCollision,0x800C641C,0x16 +asm/non_matchings/code/z_bgcheck/DynaPoly_EnableFloorCollision.s,DynaPoly_EnableFloorCollision,0x800C6474,0x16 asm/non_matchings/code/z_bgcheck/DynaPoly_DeleteBgActor.s,DynaPoly_DeleteBgActor,0x800C64CC,0x22 -asm/non_matchings/code/z_bgcheck/func_800C6554.s,func_800C6554,0x800C6554,0x6 +asm/non_matchings/code/z_bgcheck/DynaPoly_InvalidateLookup.s,DynaPoly_InvalidateLookup,0x800C6554,0x6 asm/non_matchings/code/z_bgcheck/BgCheck_CalcWaterboxDimensions.s,BgCheck_CalcWaterboxDimensions,0x800C656C,0xB3 asm/non_matchings/code/z_bgcheck/DynaPoly_SetBgActorToLists.s,DynaPoly_SetBgActorToLists,0x800C6838,0x2C5 -asm/non_matchings/code/z_bgcheck/BgCheck_ResetFlagsIfLoadedActor.s,BgCheck_ResetFlagsIfLoadedActor,0x800C734C,0x26 -asm/non_matchings/code/z_bgcheck/DynaPoly_Setup.s,DynaPoly_Setup,0x800C73E4,0x62 +asm/non_matchings/code/z_bgcheck/DynaPoly_UnsetAllInteractFlags.s,DynaPoly_UnsetAllInteractFlags,0x800C734C,0x26 +asm/non_matchings/code/z_bgcheck/DynaPoly_UpdateContext.s,DynaPoly_UpdateContext,0x800C73E4,0x62 asm/non_matchings/code/z_bgcheck/func_800C756C.s,func_800C756C,0x800C756C,0x3C asm/non_matchings/code/z_bgcheck/DynaPoly_SetupAllActorMeshes.s,DynaPoly_SetupAllActorMeshes,0x800C765C,0x24 asm/non_matchings/code/z_bgcheck/func_800C76EC.s,func_800C76EC,0x800C76EC,0xA2 @@ -606,10 +606,10 @@ asm/non_matchings/code/z_bgcheck/WaterBox_GetLightSettingIndex.s,WaterBox_GetLig asm/non_matchings/code/z_bgcheck/func_800CA6F0.s,func_800CA6F0,0x800CA6F0,0xB8 asm/non_matchings/code/z_bgcheck/func_800CA9D0.s,func_800CA9D0,0x800CA9D0,0x11 asm/non_matchings/code/z_bgcheck/func_800CAA14.s,func_800CAA14,0x800CAA14,0x2F -asm/non_matchings/code/z_bg_collect/BgCheck2_UpdateActorPosition.s,BgCheck2_UpdateActorPosition,0x800CAAD0,0x4F -asm/non_matchings/code/z_bg_collect/BgCheck2_UpdateActorYRotation.s,BgCheck2_UpdateActorYRotation,0x800CAC0C,0x25 -asm/non_matchings/code/z_bg_collect/BgCheck2_AttachToMesh.s,BgCheck2_AttachToMesh,0x800CACA0,0x23 -asm/non_matchings/code/z_bg_collect/BgCheck2_UpdateActorAttachedToMesh.s,BgCheck2_UpdateActorAttachedToMesh,0x800CAD2C,0x39 +asm/non_matchings/code/z_bg_collect/DynaPolyActor_UpdateCarriedActorPos.s,DynaPolyActor_UpdateCarriedActorPos,0x800CAAD0,0x4F +asm/non_matchings/code/z_bg_collect/DynaPolyActor_UpdateCarriedActorRotY.s,DynaPolyActor_UpdateCarriedActorRotY,0x800CAC0C,0x25 +asm/non_matchings/code/z_bg_collect/DynaPolyActor_AttachCarriedActor.s,DynaPolyActor_AttachCarriedActor,0x800CACA0,0x23 +asm/non_matchings/code/z_bg_collect/DynaPolyActor_TransformCarriedActor.s,DynaPolyActor_TransformCarriedActor,0x800CAD2C,0x39 asm/non_matchings/code/z_bg_item/DynaPoly_Init.s,DynaPoly_Init,0x800CAE10,0x9 asm/non_matchings/code/z_bg_item/DynaPoly_LoadMesh.s,DynaPoly_LoadMesh,0x800CAE34,0x12 asm/non_matchings/code/z_bg_item/DynaPoly_ResetState.s,DynaPoly_ResetState,0x800CAE7C,0x3 From 3c107cb148d784e2af4a347dc78f25b1697410be Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Tue, 18 Apr 2023 18:54:32 -0400 Subject: [PATCH 24/29] Add `SaveInfo` substruct to `SaveContext` (#1191) * SaveInfo * fix accesses in sram_NES.c * some more fixing * more fixes * format * fix unk * namefixer * format * bss * review * weekeventregconvert * namefixer * bss --- docs/tutorial/advanced_control_flow.md | 42 +- docs/tutorial/documenting.md | 4 +- docs/tutorial/other_functions.md | 2 +- include/macros.h | 2 +- include/z64save.h | 168 +++--- src/code/code_8012EC80.c | 46 +- src/code/flg_set.c | 204 ++++---- src/code/z_demo.c | 9 +- src/code/z_elf_message.c | 2 +- src/code/z_en_item00.c | 21 +- src/code/z_game_over.c | 4 +- src/code/z_kaleido_setup.c | 6 +- src/code/z_lifemeter.c | 29 +- src/code/z_map_exp.c | 5 +- src/code/z_parameter.c | 259 +++++----- src/code/z_scene.c | 6 +- src/code/z_shrink_window.c | 1 + src/code/z_snap.c | 16 +- src/code/z_sram_NES.c | 489 +++++++++--------- .../ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c | 2 +- .../actors/ovl_Dm_Char02/z_dm_char02.c | 2 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 10 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 4 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 28 +- src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c | 2 +- .../ovl_En_Akindonuts/z_en_akindonuts.c | 8 +- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 12 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 4 +- .../actors/ovl_En_Bombers2/z_en_bombers2.c | 3 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 12 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 11 +- src/overlays/actors/ovl_En_Dg/z_en_dg.c | 4 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 4 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 18 +- .../actors/ovl_En_Elfgrp/z_en_elfgrp.c | 30 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 4 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 68 +-- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 6 +- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 10 +- .../actors/ovl_En_Ginko_Man/z_en_ginko_man.c | 56 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 34 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 8 +- src/overlays/actors/ovl_En_In/z_en_in.c | 8 +- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 2 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 6 +- src/overlays/actors/ovl_En_Kbt/z_en_kbt.c | 4 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 4 +- src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 18 +- .../actors/ovl_En_Kujiya/z_en_kujiya.c | 16 +- .../actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c | 8 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 2 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 12 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 2 +- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 4 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 4 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 2 +- src/overlays/actors/ovl_En_Osn/z_en_osn.c | 12 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 2 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 5 +- .../actors/ovl_En_S_Goro/z_en_s_goro.c | 2 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 5 +- .../actors/ovl_En_Sekihi/z_en_sekihi.c | 3 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 4 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 2 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 8 +- .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 6 +- src/overlays/actors/ovl_En_Zod/z_en_zod.c | 24 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 6 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 2 +- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c | 2 +- .../actors/ovl_Obj_Usiyane/z_obj_usiyane.c | 4 +- .../ovl_Obj_Warpstone/z_obj_warpstone.h | 2 +- .../ovl_kaleido_scope/z_kaleido_debug.c | 182 +++---- .../ovl_kaleido_scope/z_kaleido_item.c | 20 +- .../ovl_kaleido_scope/z_kaleido_map.c | 12 +- .../ovl_kaleido_scope/z_kaleido_mask.c | 19 +- .../ovl_kaleido_scope/z_kaleido_scope_NES.c | 14 +- tools/namefixer.py | 78 ++- tools/weekeventregconvert.py | 12 +- 81 files changed, 1126 insertions(+), 1051 deletions(-) diff --git a/docs/tutorial/advanced_control_flow.md b/docs/tutorial/advanced_control_flow.md index 528b052f9..43e9e6d46 100644 --- a/docs/tutorial/advanced_control_flow.md +++ b/docs/tutorial/advanced_control_flow.md @@ -81,7 +81,7 @@ void EnMs_Destroy(Actor* thisx, PlayState* play) { void func_80952734(EnMs* this, PlayState* play) { s16 temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (gSaveContext.save.inventory.items[10] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[10] == ITEM_NONE) { this->actor.textId = 0x92E; } else { this->actor.textId = 0x932; @@ -187,12 +187,12 @@ void func_809527F8(EnMs* this, PlayState* play) { return; } Message_CloseTextbox(play); - if ((s32) gSaveContext.save.playerData.rupees < 0xA) { + if ((s32) gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } - if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if ((s32) gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); return; @@ -274,14 +274,14 @@ block_7: goto block_16; block_11: Message_CloseTextbox(play); - if ((s32) gSaveContext.save.playerData.rupees >= 0xA) { + if ((s32) gSaveContext.save.saveInfo.playerData.rupees >= 0xA) { goto block_13; } play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); return; block_13: - if ((s32) gSaveContext.save.inventory.ammo[gItemSlots[0xA]] < 0x14) { + if ((s32) gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] < 0x14) { goto block_15; } play_sound(0x4806U); @@ -312,7 +312,7 @@ which in many ways looks worse: you can see why the use of gotos in code is stro The simplest sort of block label to eliminate is one that is only used once, and where the corresponding goto jumps over a simple block of code with no extra internal control flow structure. There are two obvious examples of this here, the first being ```C - if ((s32) gSaveContext.save.playerData.rupees >= 0xA) { + if ((s32) gSaveContext.save.saveInfo.playerData.rupees >= 0xA) { goto block_13; } play_sound(0x4806U); @@ -324,7 +324,7 @@ block_13: Currently, this says to jump over the code block `play_sound...` if the condition in the if is satisfied. In non-goto terms, this means that the block should be run if the condition is *not* satisfied. This also illustrates a general property of goto-only mode: you have to reverse the senses of all of the ifs. Therefore the appropriate approach is to swap the if round, put the code block inside, and remove the goto and the label: ```C - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); return; @@ -378,12 +378,12 @@ block_7: block_11: Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } - if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); return; @@ -447,12 +447,12 @@ block_7: block_11: Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } - if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); return; @@ -497,12 +497,12 @@ So let us rewrite the entire second half as a switch: case 0: Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); return; } - if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); return; @@ -533,10 +533,10 @@ There's a couple of other obvious things here: case 0: Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); - } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { @@ -598,10 +598,10 @@ block_7: case 0: Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); - } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { @@ -663,10 +663,10 @@ void func_809527F8(EnMs* this, PlayState* play) { case 0: Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); - } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { @@ -715,10 +715,10 @@ void func_809527F8(EnMs* this, PlayState* play) { case 0: Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 0xA) { + if (gSaveContext.save.saveInfo.playerData.rupees < 0xA) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x935U); - } else if (gSaveContext.save.inventory.ammo[gItemSlots[0xA]] >= 0x14) { + } else if (gSaveContext.save.saveInfo.inventory.ammo[gItemSlots[0xA]] >= 0x14) { play_sound(0x4806U); Message_ContinueTextbox(play, 0x937U); } else { diff --git a/docs/tutorial/documenting.md b/docs/tutorial/documenting.md index 7ecd37ccb..71f3347e3 100644 --- a/docs/tutorial/documenting.md +++ b/docs/tutorial/documenting.md @@ -185,7 +185,7 @@ void func_80C102D4(EnRecepgirl* this, PlayState* play) { if (this->actor.textId == 0x2AD9) { Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); - if ((gSaveContext.save.weekEventReg[63] & 0x80)) { + if ((gSaveContext.save.saveInfo.weekEventReg[63] & 0x80)) { this->actor.textId = 0x2ADF; } else { this->actor.textId = 0x2ADA; @@ -516,7 +516,7 @@ void func_80C102D4(EnRecepgirl* this, PlayState* play) { if (this->actor.textId == 0x2AD9) { // "Welcome..." Flags_SetSwitch(play, this->actor.params); Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f); - if (gSaveContext.save.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting + if (gSaveContext.save.saveInfo.weekEventReg[63] & 0x80) { // showed Couple's Mask to meeting this->actor.textId = 0x2ADF; // Mayor's office is on the left (meeting ended) } else { this->actor.textId = 0x2ADA; // Mayor's office is on the left (meeting ongoing) diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index c6ac63a64..f73902ca5 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -404,7 +404,7 @@ There remains one thing we need to fix before trying to compile it, namely `*(&g /* 0x0F5C */ u32 regionsVisited; // "area_arrival" ``` -so it's somewhere in `weekEventReg`. `0xF37 - 0xEF8 = 0x3F = 63`, and it's a byte array, so the access is actually `gSaveContext.save.weekEventReg[63] & 0x80`. Now it will compile. We also don't use `!= 0` for flag comparisons: just `if (gSaveContext.save.weekEventReg[63] & 0x80)` will do. +so it's somewhere in `weekEventReg`. `0xF37 - 0xEF8 = 0x3F = 63`, and it's a byte array, so the access is actually `gSaveContext.save.saveInfo.weekEventReg[63] & 0x80`. Now it will compile. We also don't use `!= 0` for flag comparisons: just `if (gSaveContext.save.saveInfo.weekEventReg[63] & 0x80)` will do. Running `./diff.py -mwo3 func_80C102D4` and scrolling down, we discover that this doesn't match! diff --git a/include/macros.h b/include/macros.h index d572e9ccf..70e07259f 100644 --- a/include/macros.h +++ b/include/macros.h @@ -60,7 +60,7 @@ #define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg)) // To be used with `Magic_Add`, but ensures enough magic is added to fill the magic bar to capacity -#define MAGIC_FILL_TO_CAPACITY (((void)0, gSaveContext.magicFillTarget) + (gSaveContext.save.playerData.isDoubleMagicAcquired + 1) * MAGIC_NORMAL_METER) +#define MAGIC_FILL_TO_CAPACITY (((void)0, gSaveContext.magicFillTarget) + (gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired + 1) * MAGIC_NORMAL_METER) #define CONTROLLER1(gameState) (&(gameState)->input[0]) #define CONTROLLER2(gameState) (&(gameState)->input[1]) diff --git a/include/z64save.h b/include/z64save.h index afabcce34..362a16e92 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -252,61 +252,65 @@ typedef struct SavePlayerData { /* 0x26 */ s16 savedSceneId; // "scene_data_ID" } SavePlayerData; // size = 0x28 +typedef struct SaveInfo { + /* 0x000 */ SavePlayerData playerData; + /* 0x028 */ ItemEquips equips; + /* 0x04C */ Inventory inventory; + /* 0x0D4 */ PermanentSceneFlags permanentSceneFlags[120]; + /* 0xDF4 */ UNK_TYPE1 unk_DF4[0x54]; + /* 0xE48 */ u32 dekuPlaygroundHighScores[3]; + /* 0xE54 */ u32 pictoFlags0; // Flags set by `PictoActor`s if pictograph is valid + /* 0xE58 */ u32 pictoFlags1; // Flags set by Snap_ValidatePictograph() to record errors; volatile since that function is run many times in succession + /* 0xE5C */ u32 unk_E5C; + /* 0xE60 */ u32 unk_E60; + /* 0xE64 */ u32 unk_E64[7]; // Invadepoh flags + /* 0xE80 */ u32 scenesVisible[7]; // tingle maps and clouded regions on pause map. Stores scenes bitwise for up to 224 scenes even though there are not that many scenes + /* 0xE9C */ u32 skullTokenCount; // upper 16 bits store Swamp skulls, lower 16 bits store Ocean skulls + /* 0xEA0 */ u32 unk_EA0; // Gossic stone heart piece flags + /* 0xEA4 */ u32 unk_EA4; + /* 0xEA8 */ u32 unk_EA8[2]; // Related to blue warps + /* 0xEB0 */ u32 stolenItems; // Items stolen by Takkuri and given to Curiosity Shop Man + /* 0xEB4 */ u32 unk_EB4; + /* 0xEB8 */ u32 bankRupees; + /* 0xEBC */ u32 unk_EBC; + /* 0xEC0 */ u32 unk_EC0; // Fishing flags + /* 0xEC4 */ u32 unk_EC4; + /* 0xEC8 */ u32 horseBackBalloonHighScore; + /* 0xECC */ u32 lotteryCodeGuess; // Lottery code chosen by player (only uses lower three hex digits) + /* 0xED0 */ u32 shootingGalleryHighScores; // High scores for both shooting galleries. Town uses lower 16 bits, Swamp uses higher 16 bits. + /* 0xED4 */ u8 weekEventReg[100]; // "week_event_reg" + /* 0xF38 */ u32 regionsVisited; // "area_arrival" + /* 0xF3C */ u32 worldMapCloudVisibility; // "cloud_clear" + /* 0xF40 */ u8 unk_F40; // "oca_rec_flag" has scarecrows song + /* 0xF41 */ u8 unk_F41; // "oca_rec_flag8" scarecrows song set? + /* 0xF42 */ u8 scarecrowSpawnSong[128]; + /* 0xFC2 */ s8 bombersCaughtNum; // "aikotoba_index" + /* 0xFC3 */ s8 bombersCaughtOrder[5]; // "aikotoba_table" + /* 0xFC8 */ s8 lotteryCodes[3][3]; // "numbers_table", Preset lottery codes + /* 0xFD1 */ s8 spiderHouseMaskOrder[6]; // "kinsta_color_table" + /* 0xFD7 */ s8 bomberCode[5]; // "bombers_aikotoba_table" + /* 0xFDC */ HorseData horseData; + /* 0xFE6 */ u16 checksum; // "check_sum" +} SaveInfo; // size = 0xFE8 + typedef struct Save { - /* 0x0000 */ s32 entrance; // "scene_no" - /* 0x0004 */ u8 equippedMask; // "player_mask" - /* 0x0005 */ u8 isFirstCycle; // "opening_flag" - /* 0x0006 */ u8 unk_06; - /* 0x0007 */ u8 linkAge; // "link_age" - /* 0x0008 */ s32 cutscene; // "day_time" - /* 0x000C */ u16 time; // "zelda_time" - /* 0x000E */ u16 owlSaveLocation; - /* 0x0010 */ s32 isNight; // "asahiru_fg" - /* 0x0014 */ s32 timeSpeedOffset; // "change_zelda_time" - /* 0x0018 */ s32 day; // "totalday" - /* 0x001C */ s32 daysElapsed; // "eventday" - /* 0x0020 */ u8 playerForm; // "player_character" - /* 0x0021 */ u8 snowheadCleared; // "spring_flag" - /* 0x0022 */ u8 hasTatl; // "bell_flag" - /* 0x0023 */ u8 isOwlSave; - /* 0x0024 */ SavePlayerData playerData; - /* 0x004C */ ItemEquips equips; - /* 0x0070 */ Inventory inventory; - /* 0x00F8 */ PermanentSceneFlags permanentSceneFlags[120]; - /* 0x0E18 */ u8 unk_E18[0x54]; - /* 0x0E6C */ u32 dekuPlaygroundHighScores[3]; - /* 0x0E78 */ u32 pictoFlags0; // Flags set by `PictoActor`s if pictograph is valid - /* 0x0E7C */ u32 pictoFlags1; // Flags set by Snap_ValidatePictograph() to record errors; volatile since that function is run many times in succession - /* 0x0E80 */ u32 unk_E80; - /* 0x0E84 */ u32 unk_E84; - /* 0x0E88 */ u32 unk_E88[7]; // Invadepoh flags - /* 0x0EA4 */ u32 scenesVisible[7]; // tingle maps and clouded regions on pause map. Stores scenes bitwise for up to 224 scenes even though there are not that many scenes - /* 0x0EC0 */ u32 skullTokenCount; // upper 16 bits store Swamp skulls, lower 16 bits store Ocean skulls - /* 0x0EC4 */ u32 unk_EC4; // Gossic stone heart piece flags - /* 0x0EC8 */ u32 unk_EC8; - /* 0x0ECC */ u32 unk_ECC[2]; // Related to blue warps - /* 0x0ED4 */ u32 stolenItems; // Items stolen by Takkuri and given to Curiosity Shop Man - /* 0x0ED8 */ u32 unk_DD8; - /* 0x0EDC */ u32 bankRupees; - /* 0x0EE0 */ u32 unk_EE0; - /* 0x0EE4 */ u32 unk_EE4; // Fishing flags - /* 0x0EE8 */ u32 unk_EE8; - /* 0x0EEC */ u32 horseBackBalloonHighScore; - /* 0x0EF0 */ u32 lotteryCodeGuess; // Lottery code chosen by player (only uses lower three hex digits) - /* 0x0EF4 */ u32 shootingGalleryHighScores; // High scores for both shooting galleries. Town uses lower 16 bits, Swamp uses higher 16 bits. - /* 0x0EF8 */ u8 weekEventReg[100]; // "week_event_reg" - /* 0x0F5C */ u32 regionsVisited; // "area_arrival" - /* 0x0F60 */ u32 worldMapCloudVisibility; // "cloud_clear" - /* 0x0F64 */ u8 unk_F64; // "oca_rec_flag" has scarecrows song - /* 0x0F65 */ u8 unk_F65; // "oca_rec_flag8" scarecrows song set? - /* 0x0F66 */ u8 scarecrowSpawnSong[128]; - /* 0x0FE6 */ s8 bombersCaughtNum; // "aikotoba_index" - /* 0x0FE7 */ s8 bombersCaughtOrder[5]; // "aikotoba_table" - /* 0x0FEC */ s8 lotteryCodes[3][3]; // "numbers_table", Preset lottery codes - /* 0x0FF5 */ s8 spiderHouseMaskOrder[6]; // "kinsta_color_table" - /* 0x0FFB */ s8 bomberCode[5]; // "bombers_aikotoba_table" - /* 0x1000 */ HorseData horseData; - /* 0x100A */ u16 checksum; // "check_sum" + /* 0x00 */ s32 entrance; // "scene_no" + /* 0x04 */ u8 equippedMask; // "player_mask" + /* 0x05 */ u8 isFirstCycle; // "opening_flag" + /* 0x06 */ u8 unk_06; + /* 0x07 */ u8 linkAge; // "link_age" + /* 0x08 */ s32 cutscene; // "day_time" + /* 0x0C */ u16 time; // "zelda_time" + /* 0x0E */ u16 owlSaveLocation; + /* 0x10 */ s32 isNight; // "asahiru_fg" + /* 0x14 */ s32 timeSpeedOffset; // "change_zelda_time" + /* 0x18 */ s32 day; // "totalday" + /* 0x1C */ s32 daysElapsed; // "eventday" + /* 0x20 */ u8 playerForm; // "player_character" + /* 0x21 */ u8 snowheadCleared; // "spring_flag" + /* 0x22 */ u8 hasTatl; // "bell_flag" + /* 0x23 */ u8 isOwlSave; + /* 0x24 */ SaveInfo saveInfo; } Save; // size = 0x100C typedef struct SaveContext { @@ -429,41 +433,41 @@ typedef enum { #define GET_PLAYER_FORM ((void)0, gSaveContext.save.playerForm) #define SLOT(item) gItemSlots[item] -#define AMMO(item) gSaveContext.save.inventory.ammo[SLOT(item)] -#define INV_CONTENT(item) gSaveContext.save.inventory.items[SLOT(item)] -#define GET_INV_CONTENT(item) ((void)0, gSaveContext.save.inventory.items)[SLOT(item)] +#define AMMO(item) gSaveContext.save.saveInfo.inventory.ammo[SLOT(item)] +#define INV_CONTENT(item) gSaveContext.save.saveInfo.inventory.items[SLOT(item)] +#define GET_INV_CONTENT(item) ((void)0, gSaveContext.save.saveInfo.inventory.items)[SLOT(item)] #define CUR_FORM ((gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) ? 0 : gSaveContext.save.playerForm) -#define GET_SAVE_EQUIPS_EQUIPMENT ((void)0, gSaveContext.save.equips.equipment) -#define GET_SAVE_INVENTORY_UPGRADES ((void)0, gSaveContext.save.inventory.upgrades) -#define GET_SAVE_INVENTORY_QUEST_ITEMS ((void)0, gSaveContext.save.inventory.questItems) +#define GET_SAVE_EQUIPS_EQUIPMENT ((void)0, gSaveContext.save.saveInfo.equips.equipment) +#define GET_SAVE_INVENTORY_UPGRADES ((void)0, gSaveContext.save.saveInfo.inventory.upgrades) +#define GET_SAVE_INVENTORY_QUEST_ITEMS ((void)0, gSaveContext.save.saveInfo.inventory.questItems) #define GET_CUR_EQUIP_VALUE(equip) ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipMasks[equip]) >> gEquipShifts[equip]) -#define CUR_UPG_VALUE(upg) ((gSaveContext.save.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) +#define CUR_UPG_VALUE(upg) ((gSaveContext.save.saveInfo.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) #define GET_CUR_UPG_VALUE(upg) ((GET_SAVE_INVENTORY_UPGRADES & gUpgradeMasks[upg]) >> gUpgradeShifts[upg]) -#define SET_EQUIP_VALUE(equip, value) (gSaveContext.save.equips.equipment = ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipNegMasks[equip]) | (u16)((u16)(value) << gEquipShifts[equip]))) +#define SET_EQUIP_VALUE(equip, value) (gSaveContext.save.saveInfo.equips.equipment = ((GET_SAVE_EQUIPS_EQUIPMENT & gEquipNegMasks[equip]) | (u16)((u16)(value) << gEquipShifts[equip]))) -#define BUTTON_ITEM_EQUIP(form, button) (gSaveContext.save.equips.buttonItems[form][button]) +#define BUTTON_ITEM_EQUIP(form, button) (gSaveContext.save.saveInfo.equips.buttonItems[form][button]) #define CUR_FORM_EQUIP(button) BUTTON_ITEM_EQUIP(CUR_FORM, button) -#define C_SLOT_EQUIP(form, button) (gSaveContext.save.equips.cButtonSlots[form][button]) +#define C_SLOT_EQUIP(form, button) (gSaveContext.save.saveInfo.equips.cButtonSlots[form][button]) #define CHECK_QUEST_ITEM(item) (GET_SAVE_INVENTORY_QUEST_ITEMS & gBitFlags[item]) -#define SET_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS | gBitFlags[item])) -#define REMOVE_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS & (-1 - gBitFlags[item]))) +#define SET_QUEST_ITEM(item) (gSaveContext.save.saveInfo.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS | gBitFlags[item])) +#define REMOVE_QUEST_ITEM(item) (gSaveContext.save.saveInfo.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS & (-1 - gBitFlags[item]))) #define GET_QUEST_HEART_PIECE_COUNT ((GET_SAVE_INVENTORY_QUEST_ITEMS & 0xF0000000) >> QUEST_HEART_PIECE_COUNT) #define EQ_MAX_QUEST_HEART_PIECE_COUNT ((GET_SAVE_INVENTORY_QUEST_ITEMS & 0xF0000000) == (4 << QUEST_HEART_PIECE_COUNT)) #define LEQ_MAX_QUEST_HEART_PIECE_COUNT ((GET_SAVE_INVENTORY_QUEST_ITEMS & 0xF0000000) <= (4 << QUEST_HEART_PIECE_COUNT)) -#define INCREMENT_QUEST_HEART_PIECE_COUNT (gSaveContext.save.inventory.questItems += (1 << QUEST_HEART_PIECE_COUNT)) -#define DECREMENT_QUEST_HEART_PIECE_COUNT (gSaveContext.save.inventory.questItems -= (1 << QUEST_HEART_PIECE_COUNT)) -#define RESET_HEART_PIECE_COUNT (gSaveContext.save.inventory.questItems ^= (4 << QUEST_HEART_PIECE_COUNT)) +#define INCREMENT_QUEST_HEART_PIECE_COUNT (gSaveContext.save.saveInfo.inventory.questItems += (1 << QUEST_HEART_PIECE_COUNT)) +#define DECREMENT_QUEST_HEART_PIECE_COUNT (gSaveContext.save.saveInfo.inventory.questItems -= (1 << QUEST_HEART_PIECE_COUNT)) +#define RESET_HEART_PIECE_COUNT (gSaveContext.save.saveInfo.inventory.questItems ^= (4 << QUEST_HEART_PIECE_COUNT)) -#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) -#define SET_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] |= (u8)gBitFlags[item]) -#define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.save.inventory.dungeonKeys[(void)0, dungeonIndex]) +#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.saveInfo.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) +#define SET_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.saveInfo.inventory.dungeonItems[(void)0, dungeonIndex] |= (u8)gBitFlags[item]) +#define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.save.saveInfo.inventory.dungeonKeys[(void)0, dungeonIndex]) #define GET_CUR_FORM_BTN_ITEM(btn) ((u8)((btn) == EQUIP_SLOT_B ? BUTTON_ITEM_EQUIP(CUR_FORM, btn) : BUTTON_ITEM_EQUIP(0, btn))) #define GET_CUR_FORM_BTN_SLOT(btn) ((u8)((btn) == EQUIP_SLOT_B ? C_SLOT_EQUIP(CUR_FORM, btn) : C_SLOT_EQUIP(0, btn))) @@ -491,21 +495,21 @@ typedef enum { #define STOLEN_ITEM_NONE (0) -#define STOLEN_ITEM_1 ((gSaveContext.save.stolenItems & 0xFF000000) >> 0x18) -#define STOLEN_ITEM_2 ((gSaveContext.save.stolenItems & 0x00FF0000) >> 0x10) +#define STOLEN_ITEM_1 ((gSaveContext.save.saveInfo.stolenItems & 0xFF000000) >> 0x18) +#define STOLEN_ITEM_2 ((gSaveContext.save.saveInfo.stolenItems & 0x00FF0000) >> 0x10) #define SET_STOLEN_ITEM_1(itemId) \ - (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0xFF000000) | ((itemId & 0xFF) << 0x18)) + (gSaveContext.save.saveInfo.stolenItems = (gSaveContext.save.saveInfo.stolenItems & ~0xFF000000) | ((itemId & 0xFF) << 0x18)) #define SET_STOLEN_ITEM_2(itemId) \ - (gSaveContext.save.stolenItems = (gSaveContext.save.stolenItems & ~0x00FF0000) | ((itemId & 0xFF) << 0x10)) + (gSaveContext.save.saveInfo.stolenItems = (gSaveContext.save.saveInfo.stolenItems & ~0x00FF0000) | ((itemId & 0xFF) << 0x10)) -#define GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() ((s32)(gSaveContext.save.shootingGalleryHighScores & 0xFFFF)) -#define GET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE() ((s32)((gSaveContext.save.shootingGalleryHighScores & 0xFFFF0000) >> 0x10)) -#define SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.shootingGalleryHighScores = (gSaveContext.save.shootingGalleryHighScores & 0xFFFF0000) | ((u16)(score))) -#define SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.shootingGalleryHighScores = ((gSaveContext.save.shootingGalleryHighScores) & 0xFFFF) | ((u16)(score) << 0x10)) +#define GET_TOWN_SHOOTING_GALLERY_HIGH_SCORE() ((s32)(gSaveContext.save.saveInfo.shootingGalleryHighScores & 0xFFFF)) +#define GET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE() ((s32)((gSaveContext.save.saveInfo.shootingGalleryHighScores & 0xFFFF0000) >> 0x10)) +#define SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.saveInfo.shootingGalleryHighScores = (gSaveContext.save.saveInfo.shootingGalleryHighScores & 0xFFFF0000) | ((u16)(score))) +#define SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(score) (gSaveContext.save.saveInfo.shootingGalleryHighScores = ((gSaveContext.save.saveInfo.shootingGalleryHighScores) & 0xFFFF) | ((u16)(score) << 0x10)) /** - * gSaveContext.save.weekEventReg + * gSaveContext.save.saveInfo.weekEventReg */ #define PACK_WEEKEVENTREG_FLAG(index, mask) (((index) << 8) | (mask)) @@ -1448,7 +1452,7 @@ typedef enum { #define WEEKEVENTREG_99_40 PACK_WEEKEVENTREG_FLAG(99, 0x40) #define WEEKEVENTREG_99_80 PACK_WEEKEVENTREG_FLAG(99, 0x80) -#define WEEKEVENTREG(index) (gSaveContext.save.weekEventReg[(index)]) +#define WEEKEVENTREG(index) (gSaveContext.save.saveInfo.weekEventReg[(index)]) #define GET_WEEKEVENTREG(index) ((void)0, WEEKEVENTREG(index)) #define CHECK_WEEKEVENTREG(flag) (WEEKEVENTREG((flag) >> 8) & ((flag) & 0xFF)) diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index d120da618..ca8a3eb1a 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -511,12 +511,12 @@ u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) { } void Inventory_ChangeUpgrade(s16 upgrade, u32 value) { - u32 upgrades = gSaveContext.save.inventory.upgrades; + u32 upgrades = gSaveContext.save.saveInfo.inventory.upgrades; upgrades &= gUpgradeNegMasks[upgrade]; upgrades |= value << gUpgradeShifts[upgrade]; - gSaveContext.save.inventory.upgrades = upgrades; + gSaveContext.save.saveInfo.inventory.upgrades = upgrades; } s32 Inventory_IsMapVisible(s16 sceneId) { @@ -543,7 +543,7 @@ s32 Inventory_IsMapVisible(s16 sceneId) { } } - if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneId - (index << 5)]) { + if (gSaveContext.save.saveInfo.scenesVisible[index] & gBitFlags[sceneId - (index << 5)]) { return true; } @@ -656,23 +656,23 @@ void Inventory_SetWorldMapCloudVisibility(s16 tingleIndex) { index = 6; } - gSaveContext.save.scenesVisible[index] = - gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIds)[i] - (index << 5)]; + gSaveContext.save.saveInfo.scenesVisible[index] = gSaveContext.save.saveInfo.scenesVisible[index] | + gBitFlags[(s16)(*tingleMapSceneIds)[i] - (index << 5)]; i++; } if (*tingleMapSceneIds == sSceneIdsPerTingleMap[TINGLE_MAP_CLOCK_TOWN]) { - gSaveContext.save.worldMapCloudVisibility |= 3; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= 3; } else if (*tingleMapSceneIds == sSceneIdsPerTingleMap[TINGLE_MAP_WOODFALL]) { - gSaveContext.save.worldMapCloudVisibility |= 0x1C; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= 0x1C; } else if (*tingleMapSceneIds == sSceneIdsPerTingleMap[TINGLE_MAP_SNOWHEAD]) { - gSaveContext.save.worldMapCloudVisibility |= 0xE0; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= 0xE0; } else if (*tingleMapSceneIds == sSceneIdsPerTingleMap[TINGLE_MAP_ROMANI_RANCH]) { - gSaveContext.save.worldMapCloudVisibility |= 0x100; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= 0x100; } else if (*tingleMapSceneIds == sSceneIdsPerTingleMap[TINGLE_MAP_GREAT_BAY]) { - gSaveContext.save.worldMapCloudVisibility |= 0x1E00; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= 0x1E00; } else if (*tingleMapSceneIds == sSceneIdsPerTingleMap[TINGLE_MAP_STONE_TOWER]) { - gSaveContext.save.worldMapCloudVisibility |= 0x6000; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= 0x6000; } } @@ -685,34 +685,34 @@ void Inventory_SetWorldMapCloudVisibility(s16 tingleIndex) { void Inventory_SaveDekuPlaygroundHighScore(s16 timerId) { s16 i; - gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.timerCurTimes[timerId]; + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.timerCurTimes[timerId]; for (i = 0; i < 8; i++) { - gSaveContext.save.inventory.dekuPlaygroundPlayerName[CURRENT_DAY - 1][i] = - gSaveContext.save.playerData.playerName[i]; + gSaveContext.save.saveInfo.inventory.dekuPlaygroundPlayerName[CURRENT_DAY - 1][i] = + gSaveContext.save.saveInfo.playerData.playerName[i]; } } void Inventory_IncrementSkullTokenCount(s16 sceneIndex) { if (sceneIndex == SCENE_KINSTA1) { // Swamp Spider House (increment high bits of skullTokenCount) - gSaveContext.save.skullTokenCount = - ((u16)(((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) + 1) << 0x10) | - (gSaveContext.save.skullTokenCount & 0xFFFF); + gSaveContext.save.saveInfo.skullTokenCount = + ((u16)(((gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000) >> 0x10) + 1) << 0x10) | + (gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF); } else { // Ocean Spider House (increment low bits of skullTokenCount) - gSaveContext.save.skullTokenCount = - (((u16)gSaveContext.save.skullTokenCount + 1) & 0xFFFF) | (gSaveContext.save.skullTokenCount & 0xFFFF0000); + gSaveContext.save.saveInfo.skullTokenCount = (((u16)gSaveContext.save.saveInfo.skullTokenCount + 1) & 0xFFFF) | + (gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000); } } s16 Inventory_GetSkullTokenCount(s16 sceneIndex) { if (sceneIndex == SCENE_KINSTA1) { // Swamp Spider House - return (gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10; + return (gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000) >> 0x10; } else { // Ocean Spider House - return gSaveContext.save.skullTokenCount & 0xFFFF; + return gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF; } } @@ -722,6 +722,6 @@ void Inventory_SaveLotteryCodeGuess(PlayState* play) { lotteryCodeGuess = ((play->msgCtx.unk12054[0] & 0xF) << 8); // First Digit lotteryCodeGuess |= ((play->msgCtx.unk12054[1] & 0xF) << 4); // Second Digit lotteryCodeGuess |= (play->msgCtx.unk12054[2] & 0xF); // Third Digit - gSaveContext.save.lotteryCodeGuess = - (gSaveContext.save.lotteryCodeGuess & 0xFFFF0000) | (lotteryCodeGuess & 0xFFFF); + gSaveContext.save.saveInfo.lotteryCodeGuess = + (gSaveContext.save.saveInfo.lotteryCodeGuess & 0xFFFF0000) | (lotteryCodeGuess & 0xFFFF); } diff --git a/src/code/flg_set.c b/src/code/flg_set.c index a22b62a0e..bb25818a6 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -13,106 +13,106 @@ #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" static FlagSetEntry sFlagEntries[] = { - { &gSaveContext.save.weekEventReg[0], "week_event_reg[0]" }, - { &gSaveContext.save.weekEventReg[1], "week_event_reg[1]" }, - { &gSaveContext.save.weekEventReg[2], "week_event_reg[2]" }, - { &gSaveContext.save.weekEventReg[3], "week_event_reg[3]" }, - { &gSaveContext.save.weekEventReg[4], "week_event_reg[4]" }, - { &gSaveContext.save.weekEventReg[5], "week_event_reg[5]" }, - { &gSaveContext.save.weekEventReg[6], "week_event_reg[6]" }, - { &gSaveContext.save.weekEventReg[7], "week_event_reg[7]" }, - { &gSaveContext.save.weekEventReg[8], "week_event_reg[8]" }, - { &gSaveContext.save.weekEventReg[9], "week_event_reg[9]" }, - { &gSaveContext.save.weekEventReg[10], "week_event_reg[10]" }, - { &gSaveContext.save.weekEventReg[11], "week_event_reg[11]" }, - { &gSaveContext.save.weekEventReg[12], "week_event_reg[12]" }, - { &gSaveContext.save.weekEventReg[13], "week_event_reg[13]" }, - { &gSaveContext.save.weekEventReg[14], "week_event_reg[14]" }, - { &gSaveContext.save.weekEventReg[15], "week_event_reg[15]" }, - { &gSaveContext.save.weekEventReg[16], "week_event_reg[16]" }, - { &gSaveContext.save.weekEventReg[17], "week_event_reg[17]" }, - { &gSaveContext.save.weekEventReg[18], "week_event_reg[18]" }, - { &gSaveContext.save.weekEventReg[19], "week_event_reg[19]" }, - { &gSaveContext.save.weekEventReg[20], "week_event_reg[20]" }, - { &gSaveContext.save.weekEventReg[21], "week_event_reg[21]" }, - { &gSaveContext.save.weekEventReg[22], "week_event_reg[22]" }, - { &gSaveContext.save.weekEventReg[23], "week_event_reg[23]" }, - { &gSaveContext.save.weekEventReg[24], "week_event_reg[24]" }, - { &gSaveContext.save.weekEventReg[25], "week_event_reg[25]" }, - { &gSaveContext.save.weekEventReg[26], "week_event_reg[26]" }, - { &gSaveContext.save.weekEventReg[27], "week_event_reg[27]" }, - { &gSaveContext.save.weekEventReg[28], "week_event_reg[28]" }, - { &gSaveContext.save.weekEventReg[29], "week_event_reg[29]" }, - { &gSaveContext.save.weekEventReg[30], "week_event_reg[30]" }, - { &gSaveContext.save.weekEventReg[31], "week_event_reg[31]" }, - { &gSaveContext.save.weekEventReg[32], "week_event_reg[32]" }, - { &gSaveContext.save.weekEventReg[33], "week_event_reg[33]" }, - { &gSaveContext.save.weekEventReg[34], "week_event_reg[34]" }, - { &gSaveContext.save.weekEventReg[35], "week_event_reg[35]" }, - { &gSaveContext.save.weekEventReg[36], "week_event_reg[36]" }, - { &gSaveContext.save.weekEventReg[37], "week_event_reg[37]" }, - { &gSaveContext.save.weekEventReg[38], "week_event_reg[38]" }, - { &gSaveContext.save.weekEventReg[39], "week_event_reg[39]" }, - { &gSaveContext.save.weekEventReg[40], "week_event_reg[40]" }, - { &gSaveContext.save.weekEventReg[41], "week_event_reg[41]" }, - { &gSaveContext.save.weekEventReg[42], "week_event_reg[42]" }, - { &gSaveContext.save.weekEventReg[43], "week_event_reg[43]" }, - { &gSaveContext.save.weekEventReg[44], "week_event_reg[44]" }, - { &gSaveContext.save.weekEventReg[45], "week_event_reg[45]" }, - { &gSaveContext.save.weekEventReg[46], "week_event_reg[46]" }, - { &gSaveContext.save.weekEventReg[47], "week_event_reg[47]" }, - { &gSaveContext.save.weekEventReg[48], "week_event_reg[48]" }, - { &gSaveContext.save.weekEventReg[49], "week_event_reg[49]" }, - { &gSaveContext.save.weekEventReg[50], "week_event_reg[50]" }, - { &gSaveContext.save.weekEventReg[51], "week_event_reg[51]" }, - { &gSaveContext.save.weekEventReg[52], "week_event_reg[52]" }, - { &gSaveContext.save.weekEventReg[53], "week_event_reg[53]" }, - { &gSaveContext.save.weekEventReg[54], "week_event_reg[54]" }, - { &gSaveContext.save.weekEventReg[55], "week_event_reg[55]" }, - { &gSaveContext.save.weekEventReg[56], "week_event_reg[56]" }, - { &gSaveContext.save.weekEventReg[57], "week_event_reg[57]" }, - { &gSaveContext.save.weekEventReg[58], "week_event_reg[58]" }, - { &gSaveContext.save.weekEventReg[59], "week_event_reg[59]" }, - { &gSaveContext.save.weekEventReg[60], "week_event_reg[60]" }, - { &gSaveContext.save.weekEventReg[61], "week_event_reg[61]" }, - { &gSaveContext.save.weekEventReg[62], "week_event_reg[62]" }, - { &gSaveContext.save.weekEventReg[63], "week_event_reg[63]" }, - { &gSaveContext.save.weekEventReg[64], "week_event_reg[64]" }, - { &gSaveContext.save.weekEventReg[65], "week_event_reg[65]" }, - { &gSaveContext.save.weekEventReg[66], "week_event_reg[66]" }, - { &gSaveContext.save.weekEventReg[67], "week_event_reg[67]" }, - { &gSaveContext.save.weekEventReg[68], "week_event_reg[68]" }, - { &gSaveContext.save.weekEventReg[69], "week_event_reg[69]" }, - { &gSaveContext.save.weekEventReg[70], "week_event_reg[70]" }, - { &gSaveContext.save.weekEventReg[71], "week_event_reg[71]" }, - { &gSaveContext.save.weekEventReg[72], "week_event_reg[72]" }, - { &gSaveContext.save.weekEventReg[73], "week_event_reg[73]" }, - { &gSaveContext.save.weekEventReg[74], "week_event_reg[74]" }, - { &gSaveContext.save.weekEventReg[75], "week_event_reg[75]" }, - { &gSaveContext.save.weekEventReg[76], "week_event_reg[76]" }, - { &gSaveContext.save.weekEventReg[77], "week_event_reg[77]" }, - { &gSaveContext.save.weekEventReg[78], "week_event_reg[78]" }, - { &gSaveContext.save.weekEventReg[79], "week_event_reg[79]" }, - { &gSaveContext.save.weekEventReg[80], "week_event_reg[80]" }, - { &gSaveContext.save.weekEventReg[81], "week_event_reg[81]" }, - { &gSaveContext.save.weekEventReg[82], "week_event_reg[82]" }, - { &gSaveContext.save.weekEventReg[83], "week_event_reg[83]" }, - { &gSaveContext.save.weekEventReg[84], "week_event_reg[84]" }, - { &gSaveContext.save.weekEventReg[85], "week_event_reg[85]" }, - { &gSaveContext.save.weekEventReg[86], "week_event_reg[86]" }, - { &gSaveContext.save.weekEventReg[87], "week_event_reg[87]" }, - { &gSaveContext.save.weekEventReg[88], "week_event_reg[88]" }, - { &gSaveContext.save.weekEventReg[89], "week_event_reg[89]" }, - { &gSaveContext.save.weekEventReg[90], "week_event_reg[90]" }, - { &gSaveContext.save.weekEventReg[91], "week_event_reg[91]" }, - { &gSaveContext.save.weekEventReg[92], "week_event_reg[92]" }, - { &gSaveContext.save.weekEventReg[93], "week_event_reg[93]" }, - { &gSaveContext.save.weekEventReg[94], "week_event_reg[94]" }, - { &gSaveContext.save.weekEventReg[95], "week_event_reg[95]" }, - { &gSaveContext.save.weekEventReg[96], "week_event_reg[96]" }, - { &gSaveContext.save.weekEventReg[97], "week_event_reg[97]" }, - { &gSaveContext.save.weekEventReg[98], "week_event_reg[98]" }, - { &gSaveContext.save.weekEventReg[99], "week_event_reg[99]" }, + { &gSaveContext.save.saveInfo.weekEventReg[0], "week_event_reg[0]" }, + { &gSaveContext.save.saveInfo.weekEventReg[1], "week_event_reg[1]" }, + { &gSaveContext.save.saveInfo.weekEventReg[2], "week_event_reg[2]" }, + { &gSaveContext.save.saveInfo.weekEventReg[3], "week_event_reg[3]" }, + { &gSaveContext.save.saveInfo.weekEventReg[4], "week_event_reg[4]" }, + { &gSaveContext.save.saveInfo.weekEventReg[5], "week_event_reg[5]" }, + { &gSaveContext.save.saveInfo.weekEventReg[6], "week_event_reg[6]" }, + { &gSaveContext.save.saveInfo.weekEventReg[7], "week_event_reg[7]" }, + { &gSaveContext.save.saveInfo.weekEventReg[8], "week_event_reg[8]" }, + { &gSaveContext.save.saveInfo.weekEventReg[9], "week_event_reg[9]" }, + { &gSaveContext.save.saveInfo.weekEventReg[10], "week_event_reg[10]" }, + { &gSaveContext.save.saveInfo.weekEventReg[11], "week_event_reg[11]" }, + { &gSaveContext.save.saveInfo.weekEventReg[12], "week_event_reg[12]" }, + { &gSaveContext.save.saveInfo.weekEventReg[13], "week_event_reg[13]" }, + { &gSaveContext.save.saveInfo.weekEventReg[14], "week_event_reg[14]" }, + { &gSaveContext.save.saveInfo.weekEventReg[15], "week_event_reg[15]" }, + { &gSaveContext.save.saveInfo.weekEventReg[16], "week_event_reg[16]" }, + { &gSaveContext.save.saveInfo.weekEventReg[17], "week_event_reg[17]" }, + { &gSaveContext.save.saveInfo.weekEventReg[18], "week_event_reg[18]" }, + { &gSaveContext.save.saveInfo.weekEventReg[19], "week_event_reg[19]" }, + { &gSaveContext.save.saveInfo.weekEventReg[20], "week_event_reg[20]" }, + { &gSaveContext.save.saveInfo.weekEventReg[21], "week_event_reg[21]" }, + { &gSaveContext.save.saveInfo.weekEventReg[22], "week_event_reg[22]" }, + { &gSaveContext.save.saveInfo.weekEventReg[23], "week_event_reg[23]" }, + { &gSaveContext.save.saveInfo.weekEventReg[24], "week_event_reg[24]" }, + { &gSaveContext.save.saveInfo.weekEventReg[25], "week_event_reg[25]" }, + { &gSaveContext.save.saveInfo.weekEventReg[26], "week_event_reg[26]" }, + { &gSaveContext.save.saveInfo.weekEventReg[27], "week_event_reg[27]" }, + { &gSaveContext.save.saveInfo.weekEventReg[28], "week_event_reg[28]" }, + { &gSaveContext.save.saveInfo.weekEventReg[29], "week_event_reg[29]" }, + { &gSaveContext.save.saveInfo.weekEventReg[30], "week_event_reg[30]" }, + { &gSaveContext.save.saveInfo.weekEventReg[31], "week_event_reg[31]" }, + { &gSaveContext.save.saveInfo.weekEventReg[32], "week_event_reg[32]" }, + { &gSaveContext.save.saveInfo.weekEventReg[33], "week_event_reg[33]" }, + { &gSaveContext.save.saveInfo.weekEventReg[34], "week_event_reg[34]" }, + { &gSaveContext.save.saveInfo.weekEventReg[35], "week_event_reg[35]" }, + { &gSaveContext.save.saveInfo.weekEventReg[36], "week_event_reg[36]" }, + { &gSaveContext.save.saveInfo.weekEventReg[37], "week_event_reg[37]" }, + { &gSaveContext.save.saveInfo.weekEventReg[38], "week_event_reg[38]" }, + { &gSaveContext.save.saveInfo.weekEventReg[39], "week_event_reg[39]" }, + { &gSaveContext.save.saveInfo.weekEventReg[40], "week_event_reg[40]" }, + { &gSaveContext.save.saveInfo.weekEventReg[41], "week_event_reg[41]" }, + { &gSaveContext.save.saveInfo.weekEventReg[42], "week_event_reg[42]" }, + { &gSaveContext.save.saveInfo.weekEventReg[43], "week_event_reg[43]" }, + { &gSaveContext.save.saveInfo.weekEventReg[44], "week_event_reg[44]" }, + { &gSaveContext.save.saveInfo.weekEventReg[45], "week_event_reg[45]" }, + { &gSaveContext.save.saveInfo.weekEventReg[46], "week_event_reg[46]" }, + { &gSaveContext.save.saveInfo.weekEventReg[47], "week_event_reg[47]" }, + { &gSaveContext.save.saveInfo.weekEventReg[48], "week_event_reg[48]" }, + { &gSaveContext.save.saveInfo.weekEventReg[49], "week_event_reg[49]" }, + { &gSaveContext.save.saveInfo.weekEventReg[50], "week_event_reg[50]" }, + { &gSaveContext.save.saveInfo.weekEventReg[51], "week_event_reg[51]" }, + { &gSaveContext.save.saveInfo.weekEventReg[52], "week_event_reg[52]" }, + { &gSaveContext.save.saveInfo.weekEventReg[53], "week_event_reg[53]" }, + { &gSaveContext.save.saveInfo.weekEventReg[54], "week_event_reg[54]" }, + { &gSaveContext.save.saveInfo.weekEventReg[55], "week_event_reg[55]" }, + { &gSaveContext.save.saveInfo.weekEventReg[56], "week_event_reg[56]" }, + { &gSaveContext.save.saveInfo.weekEventReg[57], "week_event_reg[57]" }, + { &gSaveContext.save.saveInfo.weekEventReg[58], "week_event_reg[58]" }, + { &gSaveContext.save.saveInfo.weekEventReg[59], "week_event_reg[59]" }, + { &gSaveContext.save.saveInfo.weekEventReg[60], "week_event_reg[60]" }, + { &gSaveContext.save.saveInfo.weekEventReg[61], "week_event_reg[61]" }, + { &gSaveContext.save.saveInfo.weekEventReg[62], "week_event_reg[62]" }, + { &gSaveContext.save.saveInfo.weekEventReg[63], "week_event_reg[63]" }, + { &gSaveContext.save.saveInfo.weekEventReg[64], "week_event_reg[64]" }, + { &gSaveContext.save.saveInfo.weekEventReg[65], "week_event_reg[65]" }, + { &gSaveContext.save.saveInfo.weekEventReg[66], "week_event_reg[66]" }, + { &gSaveContext.save.saveInfo.weekEventReg[67], "week_event_reg[67]" }, + { &gSaveContext.save.saveInfo.weekEventReg[68], "week_event_reg[68]" }, + { &gSaveContext.save.saveInfo.weekEventReg[69], "week_event_reg[69]" }, + { &gSaveContext.save.saveInfo.weekEventReg[70], "week_event_reg[70]" }, + { &gSaveContext.save.saveInfo.weekEventReg[71], "week_event_reg[71]" }, + { &gSaveContext.save.saveInfo.weekEventReg[72], "week_event_reg[72]" }, + { &gSaveContext.save.saveInfo.weekEventReg[73], "week_event_reg[73]" }, + { &gSaveContext.save.saveInfo.weekEventReg[74], "week_event_reg[74]" }, + { &gSaveContext.save.saveInfo.weekEventReg[75], "week_event_reg[75]" }, + { &gSaveContext.save.saveInfo.weekEventReg[76], "week_event_reg[76]" }, + { &gSaveContext.save.saveInfo.weekEventReg[77], "week_event_reg[77]" }, + { &gSaveContext.save.saveInfo.weekEventReg[78], "week_event_reg[78]" }, + { &gSaveContext.save.saveInfo.weekEventReg[79], "week_event_reg[79]" }, + { &gSaveContext.save.saveInfo.weekEventReg[80], "week_event_reg[80]" }, + { &gSaveContext.save.saveInfo.weekEventReg[81], "week_event_reg[81]" }, + { &gSaveContext.save.saveInfo.weekEventReg[82], "week_event_reg[82]" }, + { &gSaveContext.save.saveInfo.weekEventReg[83], "week_event_reg[83]" }, + { &gSaveContext.save.saveInfo.weekEventReg[84], "week_event_reg[84]" }, + { &gSaveContext.save.saveInfo.weekEventReg[85], "week_event_reg[85]" }, + { &gSaveContext.save.saveInfo.weekEventReg[86], "week_event_reg[86]" }, + { &gSaveContext.save.saveInfo.weekEventReg[87], "week_event_reg[87]" }, + { &gSaveContext.save.saveInfo.weekEventReg[88], "week_event_reg[88]" }, + { &gSaveContext.save.saveInfo.weekEventReg[89], "week_event_reg[89]" }, + { &gSaveContext.save.saveInfo.weekEventReg[90], "week_event_reg[90]" }, + { &gSaveContext.save.saveInfo.weekEventReg[91], "week_event_reg[91]" }, + { &gSaveContext.save.saveInfo.weekEventReg[92], "week_event_reg[92]" }, + { &gSaveContext.save.saveInfo.weekEventReg[93], "week_event_reg[93]" }, + { &gSaveContext.save.saveInfo.weekEventReg[94], "week_event_reg[94]" }, + { &gSaveContext.save.saveInfo.weekEventReg[95], "week_event_reg[95]" }, + { &gSaveContext.save.saveInfo.weekEventReg[96], "week_event_reg[96]" }, + { &gSaveContext.save.saveInfo.weekEventReg[97], "week_event_reg[97]" }, + { &gSaveContext.save.saveInfo.weekEventReg[98], "week_event_reg[98]" }, + { &gSaveContext.save.saveInfo.weekEventReg[99], "week_event_reg[99]" }, { &gSaveContext.eventInf[0], "event_inf[0]" }, { &gSaveContext.eventInf[1], "event_inf[1]" }, @@ -246,8 +246,8 @@ void FlagSet_Update(GameState* gameState) { if (CHECK_BTN_ALL(input->cur.button, BTN_START)) { if (CHECK_BTN_ALL(input->press.button, BTN_B)) { s16 i; - for (i = 0; i < ARRAY_COUNT(gSaveContext.save.weekEventReg); i++) { - gSaveContext.save.weekEventReg[i] = 0; + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.weekEventReg); i++) { + gSaveContext.save.saveInfo.weekEventReg[i] = 0; } for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) { gSaveContext.eventInf[i] = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 08d56de69..dc32223a8 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1479,12 +1479,13 @@ void func_800EDBE0(PlayState* play) { if (play->csCtx.sceneCsList[temp_v0_3].unk7 == 0xFE) { ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; - } else if (!(((void)0, - gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) & + } else if (!(((void)0, gSaveContext.save.saveInfo + .weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) & (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)))) { // TODO: macros for this kind of weekEventReg access - gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)] = - ((void)0, gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) | + gSaveContext.save.saveInfo.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)] = + ((void)0, + gSaveContext.save.saveInfo.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) | (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)); ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index 830824024..1b005443d 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -45,7 +45,7 @@ u16 QuestHint_GetTatlTextId(PlayState* play) { return 0x21D; } - if (gSaveContext.save.playerData.isMagicAcquired != true) { + if (gSaveContext.save.saveInfo.playerData.isMagicAcquired != true) { return 0x21F; } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 0c19236dc..44e8703a2 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -885,12 +885,13 @@ s16 func_800A7650(s16 dropId) { (dropId == ITEM00_ARROWS_50)) && (INV_CONTENT(ITEM_BOW) == ITEM_NONE)) || (((dropId == ITEM00_MAGIC_LARGE) || (dropId == ITEM00_MAGIC_SMALL)) && - (gSaveContext.save.playerData.magicLevel == 0))) { + (gSaveContext.save.saveInfo.playerData.magicLevel == 0))) { return ITEM00_NO_DROP; } if (dropId == ITEM00_RECOVERY_HEART) { - if (((void)0, gSaveContext.save.playerData.healthCapacity) == ((void)0, gSaveContext.save.playerData.health)) { + if (((void)0, gSaveContext.save.saveInfo.playerData.healthCapacity) == + ((void)0, gSaveContext.save.saveInfo.playerData.health)) { return ITEM00_RUPEE_GREEN; } } @@ -1148,27 +1149,29 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP } if (dropId == ITEM00_FLEXIBLE) { - if (gSaveContext.save.playerData.health <= 0x10) { + if (gSaveContext.save.saveInfo.playerData.health <= 0x10) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 2); SoundSource_PlaySfxAtFixedWorldPos(play, spawnPos, 40, NA_SE_EV_BUTTERFRY_TO_FAIRY); return; } - if (gSaveContext.save.playerData.health <= 0x30) { + if (gSaveContext.save.saveInfo.playerData.health <= 0x30) { params = 0x10; dropId = ITEM00_RECOVERY_HEART; dropQuantity = 3; - } else if (gSaveContext.save.playerData.health <= 0x50) { + } else if (gSaveContext.save.saveInfo.playerData.health <= 0x50) { params = 0x10; dropId = ITEM00_RECOVERY_HEART; dropQuantity = 1; - } else if ((gSaveContext.save.playerData.magicLevel != 0) && (gSaveContext.save.playerData.magic == 0)) { + } else if ((gSaveContext.save.saveInfo.playerData.magicLevel != 0) && + (gSaveContext.save.saveInfo.playerData.magic == 0)) { params = 0xD0; dropId = ITEM00_MAGIC_LARGE; dropQuantity = 1; - } else if ((gSaveContext.save.playerData.magicLevel != 0) && - ((gSaveContext.save.playerData.magicLevel >> 1) >= gSaveContext.save.playerData.magic)) { + } else if ((gSaveContext.save.saveInfo.playerData.magicLevel != 0) && + ((gSaveContext.save.saveInfo.playerData.magicLevel >> 1) >= + gSaveContext.save.saveInfo.playerData.magic)) { params = 0xD0; dropId = ITEM00_MAGIC_LARGE; dropQuantity = 1; @@ -1180,7 +1183,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP params = 0xB0; dropId = ITEM00_BOMBS_A; dropQuantity = 1; - } else if (gSaveContext.save.playerData.rupees < 11) { + } else if (gSaveContext.save.saveInfo.playerData.rupees < 11) { params = 0xA0; dropId = ITEM00_RUPEE_RED; dropQuantity = 1; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 4e24eb72e..d0e5e45f2 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -50,7 +50,7 @@ void GameOver_Update(PlayState* play) { } gSaveContext.unk_3DC0 = 2000; - gSaveContext.save.playerData.tatlTimer = 0; + gSaveContext.save.saveInfo.playerData.tatlTimer = 0; gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.eventInf[0] = 0; @@ -79,7 +79,7 @@ void GameOver_Update(PlayState* play) { gSaveContext.respawnFlag = -6; } gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; - gSaveContext.save.playerData.health = 0x30; + gSaveContext.save.saveInfo.playerData.health = 0x30; gameOverCtx->state++; if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index dac0d8300..f873ea8ff 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -44,19 +44,19 @@ void func_800F4A10(PlayState* play) { if (pauseCtx->state == PAUSE_STATE_OPENING_0) { for (i = 0; i < REGION_MAX; i++) { - if ((gSaveContext.save.regionsVisited >> i) & 1) { + if ((gSaveContext.save.saveInfo.regionsVisited >> i) & 1) { pauseCtx->worldMapPoints[i] = true; } } } else { for (i = OWL_WARP_STONE_TOWER; i >= OWL_WARP_GREAT_BAY_COAST; i--) { - if ((gSaveContext.save.playerData.owlActivationFlags >> i) & 1) { + if ((gSaveContext.save.saveInfo.playerData.owlActivationFlags >> i) & 1) { pauseCtx->worldMapPoints[i] = true; pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = i; } } - if ((gSaveContext.save.playerData.owlActivationFlags >> 4) & 1) { + if ((gSaveContext.save.saveInfo.playerData.owlActivationFlags >> 4) & 1) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 4; } } diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 06dd1a0c7..d6f2edf2a 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -37,7 +37,7 @@ void LifeMeter_Init(PlayState* play) { interfaceCtx->healthTimer = 320; - interfaceCtx->health = gSaveContext.save.playerData.health; + interfaceCtx->health = gSaveContext.save.saveInfo.playerData.health; interfaceCtx->lifeColorChange = 0; interfaceCtx->lifeColorChangeDirection = 0; @@ -170,7 +170,7 @@ void LifeMeter_UpdateColors(PlayState* play) { s32 LifeMeter_SaveInterfaceHealth(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - gSaveContext.save.playerData.health = interfaceCtx->health; + gSaveContext.save.saveInfo.playerData.health = interfaceCtx->health; return 1; } @@ -181,8 +181,8 @@ s32 LifeMeter_IncreaseInterfaceHealth(PlayState* play) { interfaceCtx->healthTimer = 320; interfaceCtx->health += 0x10; - if (play->interfaceCtx.health >= gSaveContext.save.playerData.health) { - play->interfaceCtx.health = gSaveContext.save.playerData.health; + if (play->interfaceCtx.health >= gSaveContext.save.saveInfo.playerData.health) { + play->interfaceCtx.health = gSaveContext.save.saveInfo.playerData.health; return true; } return false; @@ -199,7 +199,7 @@ s32 LifeMeter_DecreaseInterfaceHealth(PlayState* play) { interfaceCtx->health -= 0x10; if (interfaceCtx->health <= 0) { interfaceCtx->health = 0; - play->damagePlayer(play, -(((void)0, gSaveContext.save.playerData.health) + 1)); + play->damagePlayer(play, -(((void)0, gSaveContext.save.saveInfo.playerData.health) + 1)); return true; } } @@ -220,18 +220,18 @@ void LifeMeter_Draw(PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx; Vtx* beatingHeartVtx = interfaceCtx->beatingHeartVtx; - s32 fractionHeartCount = gSaveContext.save.playerData.health % 0x10; - s16 healthCapacity = gSaveContext.save.playerData.healthCapacity / 0x10; - s16 fullHeartCount = gSaveContext.save.playerData.health / 0x10; + s32 fractionHeartCount = gSaveContext.save.saveInfo.playerData.health % 0x10; + s16 healthCapacity = gSaveContext.save.saveInfo.playerData.healthCapacity / 0x10; + s16 fullHeartCount = gSaveContext.save.saveInfo.playerData.health / 0x10; s32 pad2; f32 lifesize = interfaceCtx->lifeSizeChange * 0.1f; u32 curCombineModeSet = 0; TexturePtr temp = NULL; - s32 ddCount = gSaveContext.save.inventory.defenseHearts - 1; + s32 ddCount = gSaveContext.save.saveInfo.inventory.defenseHearts - 1; OPEN_DISPS(gfxCtx); - if ((gSaveContext.save.playerData.health % 0x10) == 0) { + if ((gSaveContext.save.saveInfo.playerData.health % 0x10) == 0) { fullHeartCount--; } @@ -422,17 +422,18 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) { u32 LifeMeter_IsCritical(void) { s16 criticalThreshold; - if (gSaveContext.save.playerData.healthCapacity <= 0x50) { + if (gSaveContext.save.saveInfo.playerData.healthCapacity <= 0x50) { criticalThreshold = 0x10; - } else if (gSaveContext.save.playerData.healthCapacity <= 0xA0) { + } else if (gSaveContext.save.saveInfo.playerData.healthCapacity <= 0xA0) { criticalThreshold = 0x18; - } else if (gSaveContext.save.playerData.healthCapacity <= 0xF0) { + } else if (gSaveContext.save.saveInfo.playerData.healthCapacity <= 0xF0) { criticalThreshold = 0x20; } else { criticalThreshold = 0x2C; } - if ((criticalThreshold >= gSaveContext.save.playerData.health) && (gSaveContext.save.playerData.health > 0)) { + if ((criticalThreshold >= gSaveContext.save.saveInfo.playerData.health) && + (gSaveContext.save.saveInfo.playerData.health > 0)) { return true; } return false; diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 381387c5e..912926cbb 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -156,7 +156,8 @@ void Map_InitRoomData(PlayState* play, s16 room) { if (room >= 0) { if (Map_IsInDungeonOrBossArea(play)) { - gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].rooms |= gBitFlags[room]; + gSaveContext.save.saveInfo.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].rooms |= + gBitFlags[room]; interfaceCtx->mapRoomNum = room; interfaceCtx->dungeonOrBossAreaMapIndex = mapIndex; } @@ -243,7 +244,7 @@ void Map_Update(PlayState* play) { if (Map_IsInDungeonArea(play)) { floor = func_80109124(player->actor.world.pos.y); if (floor != -1) { - gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].unk_14 |= + gSaveContext.save.saveInfo.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].unk_14 |= gBitFlags[FLOOR_INDEX_MAX - floor]; R_REVERSE_FLOOR_INDEX = FLOOR_INDEX_MAX - floor; if (interfaceCtx->mapRoomNum != sLastRoomNum) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index be5cc01bc..1072587af 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1006,12 +1006,12 @@ void Interface_NewDay(PlayState* play, s32 day) { (u32)SEGMENT_ROM_START(week_static) + i * 0x510, 0x510); // i is used to store sceneId - for (i = 0; i < ARRAY_COUNT(gSaveContext.save.permanentSceneFlags); i++) { - gSaveContext.save.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; - gSaveContext.save.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; - gSaveContext.save.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; - gSaveContext.save.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; - gSaveContext.save.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.permanentSceneFlags); i++) { + gSaveContext.save.saveInfo.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; + gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; + gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; } } @@ -1880,7 +1880,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { } else if (CHECK_EVENTINF(EVENTINF_34)) { // Deku playground minigame if (player->stateFlags3 & PLAYER_STATE3_1000000) { - if (gSaveContext.save.inventory.items[SLOT_NUT] == ITEM_NUT) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_NUT] == ITEM_NUT) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NUT; Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); } else { @@ -1908,7 +1908,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { } } else if (player->stateFlags3 & PLAYER_STATE3_1000000) { // Nuts on B (from flying as Deku Link) - if (gSaveContext.save.inventory.items[SLOT_NUT] == ITEM_NUT) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_NUT] == ITEM_NUT) { if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NUT) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NUT; Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); @@ -1925,7 +1925,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; } - } else if (!gSaveContext.save.playerData.isMagicAcquired && (CUR_FORM == PLAYER_FORM_DEKU) && + } else if (!gSaveContext.save.saveInfo.playerData.isMagicAcquired && (CUR_FORM == PLAYER_FORM_DEKU) && (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_NUT)) { // Nuts on B (as Deku Link) BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_FD; @@ -2324,7 +2324,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { if (play->unk_1887C >= 2) { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); - } else if (gSaveContext.save.inventory.items[SLOT_BOW] == ITEM_NONE) { + } else if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_NONE) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; } else { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); @@ -2382,7 +2382,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { if (play->unk_1887C >= 2) { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); - } else if (gSaveContext.save.inventory.items[SLOT_BOW] == ITEM_NONE) { + } else if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_NONE) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; } else { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); @@ -2627,14 +2627,14 @@ u8 Item_Give(PlayState* play, u8 item) { INCREMENT_QUEST_HEART_PIECE_COUNT; if (EQ_MAX_QUEST_HEART_PIECE_COUNT) { RESET_HEART_PIECE_COUNT; - gSaveContext.save.playerData.healthCapacity += 0x10; - gSaveContext.save.playerData.health += 0x10; + gSaveContext.save.saveInfo.playerData.healthCapacity += 0x10; + gSaveContext.save.saveInfo.playerData.health += 0x10; } return ITEM_NONE; } else if (item == ITEM_HEART_CONTAINER) { - gSaveContext.save.playerData.healthCapacity += 0x10; - gSaveContext.save.playerData.health += 0x10; + gSaveContext.save.saveInfo.playerData.healthCapacity += 0x10; + gSaveContext.save.saveInfo.playerData.health += 0x10; return ITEM_NONE; } else if ((item >= ITEM_SONG_SONATA) && (item <= ITEM_SONG_LULLABY_INTRO)) { @@ -2646,7 +2646,7 @@ u8 Item_Give(PlayState* play, u8 item) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = item; Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); if (item == ITEM_SWORD_RAZOR) { - gSaveContext.save.playerData.swordHealth = 100; + gSaveContext.save.saveInfo.playerData.swordHealth = 100; } return ITEM_NONE; @@ -2824,7 +2824,7 @@ u8 Item_Give(PlayState* play, u8 item) { return ITEM_NONE; } else if ((item >= ITEM_BOMBS_5) && (item <= ITEM_BOMBS_30)) { - if (gSaveContext.save.inventory.items[SLOT_BOMB] != ITEM_BOMB) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOMB] != ITEM_BOMB) { INV_CONTENT(ITEM_BOMB) = ITEM_BOMB; AMMO(ITEM_BOMB) += sAmmoRefillCounts[item - ITEM_BOMBS_5]; return ITEM_NONE; @@ -2847,7 +2847,7 @@ u8 Item_Give(PlayState* play, u8 item) { return ITEM_NONE; } else if ((item >= ITEM_BOMBCHUS_20) && (item <= ITEM_BOMBCHUS_5)) { - if (gSaveContext.save.inventory.items[SLOT_BOMBCHU] != ITEM_BOMBCHU) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOMBCHU] != ITEM_BOMBCHU) { INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; AMMO(ITEM_BOMBCHU) += sBombchuRefillCounts[item - ITEM_BOMBCHUS_20]; @@ -2917,8 +2917,8 @@ u8 Item_Give(PlayState* play, u8 item) { slot = SLOT(item); for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot + i] = ITEM_POTION_RED; + if (gSaveContext.save.saveInfo.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot + i] = ITEM_POTION_RED; return ITEM_NONE; } } @@ -2929,8 +2929,8 @@ u8 Item_Give(PlayState* play, u8 item) { slot = SLOT(item); for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot + i] = item; + if (gSaveContext.save.saveInfo.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot + i] = item; return ITEM_NONE; } } @@ -2940,8 +2940,8 @@ u8 Item_Give(PlayState* play, u8 item) { slot = SLOT(item); for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot + i] = item; + if (gSaveContext.save.saveInfo.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot + i] = item; return ITEM_NONE; } } @@ -2971,7 +2971,7 @@ u8 Item_Give(PlayState* play, u8 item) { slot = SLOT(item); for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[slot + i] == ITEM_BOTTLE) { + if (gSaveContext.save.saveInfo.inventory.items[slot + i] == ITEM_BOTTLE) { if (item == ITEM_HOT_SPRING_WATER) { Interface_StartBottleTimer(60, i); } @@ -2990,14 +2990,14 @@ u8 Item_Give(PlayState* play, u8 item) { gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; } - gSaveContext.save.inventory.items[slot + i] = item; + gSaveContext.save.saveInfo.inventory.items[slot + i] = item; return ITEM_NONE; } } } else { for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot + i] = item; + if (gSaveContext.save.saveInfo.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot + i] = item; return ITEM_NONE; } } @@ -3018,7 +3018,7 @@ u8 Item_Give(PlayState* play, u8 item) { return ITEM_NONE; } - temp = gSaveContext.save.inventory.items[slot]; + temp = gSaveContext.save.saveInfo.inventory.items[slot]; INV_CONTENT(item) = item; return temp; } @@ -3159,13 +3159,13 @@ u8 Item_CheckObtainabilityImpl(u8 item) { bottleSlot = SLOT(item); for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[bottleSlot + i] == ITEM_BOTTLE) { + if (gSaveContext.save.saveInfo.inventory.items[bottleSlot + i] == ITEM_BOTTLE) { return ITEM_NONE; } } } else { for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[bottleSlot + i] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[bottleSlot + i] == ITEM_NONE) { return ITEM_NONE; } } @@ -3174,7 +3174,7 @@ u8 Item_CheckObtainabilityImpl(u8 item) { return ITEM_NONE; } - return gSaveContext.save.inventory.items[slot]; + return gSaveContext.save.saveInfo.inventory.items[slot]; } u8 Item_CheckObtainability(u8 item) { @@ -3184,7 +3184,7 @@ u8 Item_CheckObtainability(u8 item) { void Inventory_DeleteItem(s16 item, s16 slot) { s16 btn; - gSaveContext.save.inventory.items[slot] = ITEM_NONE; + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_NONE; for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { if (GET_CUR_FORM_BTN_ITEM(btn) == item) { @@ -3209,8 +3209,8 @@ s32 Inventory_ReplaceItem(PlayState* play, u8 oldItem, u8 newItem) { u8 i; for (i = 0; i < 24; i++) { - if (gSaveContext.save.inventory.items[i] == oldItem) { - gSaveContext.save.inventory.items[i] = newItem; + if (gSaveContext.save.saveInfo.inventory.items[i] == oldItem) { + gSaveContext.save.saveInfo.inventory.items[i] = newItem; for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { if (GET_CUR_FORM_BTN_ITEM(i) == oldItem) { @@ -3259,7 +3259,7 @@ s32 Inventory_HasEmptyBottle(void) { s32 slot; for (slot = SLOT_BOTTLE_1; slot <= SLOT_BOTTLE_6; slot++) { - if (gSaveContext.save.inventory.items[slot] == ITEM_BOTTLE) { + if (gSaveContext.save.saveInfo.inventory.items[slot] == ITEM_BOTTLE) { return true; } } @@ -3270,7 +3270,7 @@ s32 Inventory_HasItemInBottle(u8 item) { s32 slot; for (slot = SLOT_BOTTLE_1; slot <= SLOT_BOTTLE_6; slot++) { - if (gSaveContext.save.inventory.items[slot] == item) { + if (gSaveContext.save.saveInfo.inventory.items[slot] == item) { return true; } } @@ -3278,7 +3278,7 @@ s32 Inventory_HasItemInBottle(u8 item) { } void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 btn) { - gSaveContext.save.inventory.items[GET_CUR_FORM_BTN_SLOT(btn)] = item; + gSaveContext.save.saveInfo.inventory.items[GET_CUR_FORM_BTN_SLOT(btn)] = item; SET_CUR_FORM_BTN_ITEM(btn, item); Interface_LoadItemIconImpl(play, btn); @@ -3297,7 +3297,7 @@ s32 Inventory_ConsumeFairy(PlayState* play) { u8 i; for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[bottleSlot + i] == ITEM_FAIRY) { + if (gSaveContext.save.saveInfo.inventory.items[bottleSlot + i] == ITEM_FAIRY) { for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { if (GET_CUR_FORM_BTN_ITEM(btn) == ITEM_FAIRY) { SET_CUR_FORM_BTN_ITEM(btn, ITEM_BOTTLE); @@ -3307,7 +3307,7 @@ s32 Inventory_ConsumeFairy(PlayState* play) { break; } } - gSaveContext.save.inventory.items[bottleSlot + i] = ITEM_BOTTLE; + gSaveContext.save.saveInfo.inventory.items[bottleSlot + i] = ITEM_BOTTLE; return true; } } @@ -3321,7 +3321,7 @@ s32 Inventory_ConsumeFairy(PlayState* play) { void Inventory_UpdateItem(PlayState* play, s16 slot, s16 item) { s16 btn; - gSaveContext.save.inventory.items[slot] = item; + gSaveContext.save.saveInfo.inventory.items[slot] = item; for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { if (GET_CUR_FORM_BTN_SLOT(btn) == slot) { @@ -3355,18 +3355,19 @@ void func_80115428(InterfaceContext* interfaceCtx, u16 doAction, s16 loadOffset) s32 Health_ChangeBy(PlayState* play, s16 healthChange) { if (healthChange > 0) { play_sound(NA_SE_SY_HP_RECOVER); - } else if (gSaveContext.save.playerData.doubleDefense && (healthChange < 0)) { + } else if (gSaveContext.save.saveInfo.playerData.doubleDefense && (healthChange < 0)) { healthChange >>= 1; } - gSaveContext.save.playerData.health += healthChange; + gSaveContext.save.saveInfo.playerData.health += healthChange; - if (((void)0, gSaveContext.save.playerData.health) > ((void)0, gSaveContext.save.playerData.healthCapacity)) { - gSaveContext.save.playerData.health = gSaveContext.save.playerData.healthCapacity; + if (((void)0, gSaveContext.save.saveInfo.playerData.health) > + ((void)0, gSaveContext.save.saveInfo.playerData.healthCapacity)) { + gSaveContext.save.saveInfo.playerData.health = gSaveContext.save.saveInfo.playerData.healthCapacity; } - if (gSaveContext.save.playerData.health <= 0) { - gSaveContext.save.playerData.health = 0; + if (gSaveContext.save.saveInfo.playerData.health <= 0) { + gSaveContext.save.saveInfo.playerData.health = 0; return false; } else { return true; @@ -3374,7 +3375,7 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange) { } void Health_GiveHearts(s16 hearts) { - gSaveContext.save.playerData.healthCapacity += hearts * 0x10; + gSaveContext.save.saveInfo.playerData.healthCapacity += hearts * 0x10; } void Rupees_ChangeBy(s16 rupeeChange) { @@ -3441,7 +3442,7 @@ void Inventory_ChangeAmmo(s16 item, s16 ammoChange) { } void Magic_Add(PlayState* play, s16 magicToAdd) { - if (((void)0, gSaveContext.save.playerData.magic) < ((void)0, gSaveContext.magicCapacity)) { + if (((void)0, gSaveContext.save.saveInfo.playerData.magic) < ((void)0, gSaveContext.magicCapacity)) { gSaveContext.magicToAdd += magicToAdd; gSaveContext.isMagicRequested = true; } @@ -3465,12 +3466,12 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { InterfaceContext* interfaceCtx = &play->interfaceCtx; // Magic is not acquired yet - if (!gSaveContext.save.playerData.isMagicAcquired) { + if (!gSaveContext.save.saveInfo.playerData.isMagicAcquired) { return false; } // Not enough magic available to consume - if ((gSaveContext.save.playerData.magic - magicToConsume) < 0) { + if ((gSaveContext.save.saveInfo.playerData.magic - magicToConsume) < 0) { if (gSaveContext.magicCapacity != 0) { play_sound(NA_SE_SY_ERROR); } @@ -3518,7 +3519,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { case MAGIC_CONSUME_LENS: if (gSaveContext.magicState == MAGIC_STATE_IDLE) { - if (gSaveContext.save.playerData.magic != 0) { + if (gSaveContext.save.saveInfo.playerData.magic != 0) { interfaceCtx->magicConsumptionTimer = 80; gSaveContext.magicState = MAGIC_STATE_CONSUME_LENS; return true; @@ -3549,7 +3550,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { case MAGIC_CONSUME_GORON_ZORA: // Goron spiked rolling or Zora electric barrier - if (gSaveContext.save.playerData.magic != 0) { + if (gSaveContext.save.saveInfo.playerData.magic != 0) { interfaceCtx->magicConsumptionTimer = 10; gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA_SETUP; return true; @@ -3560,7 +3561,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { case MAGIC_CONSUME_GIANTS_MASK: // Wearing Giant's Mask if (gSaveContext.magicState == MAGIC_STATE_IDLE) { - if (gSaveContext.save.playerData.magic != 0) { + if (gSaveContext.save.saveInfo.playerData.magic != 0) { interfaceCtx->magicConsumptionTimer = R_MAGIC_CONSUME_TIMER_GIANTS_MASK; gSaveContext.magicState = MAGIC_STATE_CONSUME_GIANTS_MASK; return true; @@ -3584,7 +3585,7 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { magicToConsume = 0; } - gSaveContext.save.playerData.magic -= magicToConsume; + gSaveContext.save.saveInfo.playerData.magic -= magicToConsume; return true; } else { play_sound(NA_SE_SY_ERROR); @@ -3597,11 +3598,11 @@ s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { void Magic_UpdateAddRequest(void) { if (gSaveContext.isMagicRequested) { - gSaveContext.save.playerData.magic += 4; + gSaveContext.save.saveInfo.playerData.magic += 4; play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG); - if (((void)0, gSaveContext.save.playerData.magic) >= ((void)0, gSaveContext.magicCapacity)) { - gSaveContext.save.playerData.magic = gSaveContext.magicCapacity; + if (((void)0, gSaveContext.save.saveInfo.playerData.magic) >= ((void)0, gSaveContext.magicCapacity)) { + gSaveContext.save.saveInfo.playerData.magic = gSaveContext.magicCapacity; gSaveContext.magicToAdd = 0; gSaveContext.isMagicRequested = false; } else { @@ -3677,7 +3678,7 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_STEP_CAPACITY: // Step magicCapacity to the capacity determined by magicLevel // This changes the width of the magic meter drawn - magicCapacityTarget = gSaveContext.save.playerData.magicLevel * MAGIC_NORMAL_METER; + magicCapacityTarget = gSaveContext.save.saveInfo.playerData.magicLevel * MAGIC_NORMAL_METER; if (gSaveContext.magicCapacity != magicCapacityTarget) { if (gSaveContext.magicCapacity < magicCapacityTarget) { gSaveContext.magicCapacity += 0x10; @@ -3699,14 +3700,14 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_FILL: // Add magic until magicFillTarget is reached - gSaveContext.save.playerData.magic += 0x10; + gSaveContext.save.saveInfo.playerData.magic += 0x10; if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (gSaveContext.sceneLayer < 4)) { play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG); } - if (((void)0, gSaveContext.save.playerData.magic) >= ((void)0, gSaveContext.magicFillTarget)) { - gSaveContext.save.playerData.magic = gSaveContext.magicFillTarget; + if (((void)0, gSaveContext.save.saveInfo.playerData.magic) >= ((void)0, gSaveContext.magicFillTarget)) { + gSaveContext.save.saveInfo.playerData.magic = gSaveContext.magicFillTarget; gSaveContext.magicState = MAGIC_STATE_IDLE; } break; @@ -3720,10 +3721,10 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME: // Consume magic until target is reached or no more magic is available if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { - gSaveContext.save.playerData.magic = - ((void)0, gSaveContext.save.playerData.magic) - ((void)0, gSaveContext.magicToConsume); - if (gSaveContext.save.playerData.magic <= 0) { - gSaveContext.save.playerData.magic = 0; + gSaveContext.save.saveInfo.playerData.magic = + ((void)0, gSaveContext.save.saveInfo.playerData.magic) - ((void)0, gSaveContext.magicToConsume); + if (gSaveContext.save.saveInfo.playerData.magic <= 0) { + gSaveContext.save.saveInfo.playerData.magic = 0; } gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1; sMagicMeterOutlinePrimRed = sMagicMeterOutlinePrimGreen = sMagicMeterOutlinePrimBlue = 255; @@ -3749,7 +3750,7 @@ void Magic_Update(PlayState* play) { (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { - if ((gSaveContext.save.playerData.magic == 0) || + if ((gSaveContext.save.saveInfo.playerData.magic == 0) || ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) && (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE)) || ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) != ITEM_LENS) && @@ -3767,7 +3768,7 @@ void Magic_Update(PlayState* play) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { - gSaveContext.save.playerData.magic--; + gSaveContext.save.saveInfo.playerData.magic--; } interfaceCtx->magicConsumptionTimer = 80; } @@ -3779,10 +3780,10 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME_GORON_ZORA_SETUP: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { - gSaveContext.save.playerData.magic -= 2; + gSaveContext.save.saveInfo.playerData.magic -= 2; } - if (gSaveContext.save.playerData.magic <= 0) { - gSaveContext.save.playerData.magic = 0; + if (gSaveContext.save.saveInfo.playerData.magic <= 0) { + gSaveContext.save.saveInfo.playerData.magic = 0; } gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA; // fallthrough @@ -3794,10 +3795,10 @@ void Magic_Update(PlayState* play) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { - gSaveContext.save.playerData.magic--; + gSaveContext.save.saveInfo.playerData.magic--; } - if (gSaveContext.save.playerData.magic <= 0) { - gSaveContext.save.playerData.magic = 0; + if (gSaveContext.save.saveInfo.playerData.magic <= 0) { + gSaveContext.save.saveInfo.playerData.magic = 0; } interfaceCtx->magicConsumptionTimer = 10; } @@ -3816,10 +3817,10 @@ void Magic_Update(PlayState* play) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { - gSaveContext.save.playerData.magic--; + gSaveContext.save.saveInfo.playerData.magic--; } - if (gSaveContext.save.playerData.magic <= 0) { - gSaveContext.save.playerData.magic = 0; + if (gSaveContext.save.saveInfo.playerData.magic <= 0) { + gSaveContext.save.saveInfo.playerData.magic = 0; } interfaceCtx->magicConsumptionTimer = R_MAGIC_CONSUME_TIMER_GIANTS_MASK; } @@ -3842,8 +3843,8 @@ void Magic_DrawMeter(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if (gSaveContext.save.playerData.magicLevel != 0) { - if (gSaveContext.save.playerData.healthCapacity > 0xA0) { + if (gSaveContext.save.saveInfo.playerData.magicLevel != 0) { + if (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) { magicBarY = 42; // two rows of hearts } else { magicBarY = 34; // one row of hearts @@ -3876,8 +3877,8 @@ void Magic_DrawMeter(PlayState* play) { gDPLoadTextureBlock_4b(OVERLAY_DISP++, gMagicMeterFillTex, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(OVERLAY_DISP++, 104, (magicBarY + 3) << 2, - (((void)0, gSaveContext.save.playerData.magic) + 26) << 2, (magicBarY + 10) << 2, - G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + (((void)0, gSaveContext.save.saveInfo.playerData.magic) + 26) << 2, + (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); // Fill the rest of the meter with the normal magic color gDPPipeSync(OVERLAY_DISP++); @@ -3891,7 +3892,8 @@ void Magic_DrawMeter(PlayState* play) { gSPTextureRectangle( OVERLAY_DISP++, 104, (magicBarY + 3) << 2, - ((((void)0, gSaveContext.save.playerData.magic) - ((void)0, gSaveContext.magicToConsume)) + 26) << 2, + ((((void)0, gSaveContext.save.saveInfo.playerData.magic) - ((void)0, gSaveContext.magicToConsume)) + 26) + << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } else { // Fill the whole meter with the normal magic color @@ -3906,8 +3908,8 @@ void Magic_DrawMeter(PlayState* play) { gDPLoadTextureBlock_4b(OVERLAY_DISP++, gMagicMeterFillTex, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(OVERLAY_DISP++, 104, (magicBarY + 3) << 2, - (((void)0, gSaveContext.save.playerData.magic) + 26) << 2, (magicBarY + 10) << 2, - G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + (((void)0, gSaveContext.save.saveInfo.playerData.magic) + 26) << 2, + (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } } @@ -5683,7 +5685,7 @@ void Interface_DrawTimers(PlayState* play) { if (interfaceCtx->magicAlpha != 255) { gSaveContext.timerY[sTimerId] = 22; - } else if (gSaveContext.save.playerData.healthCapacity > 0xA0) { + } else if (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) { gSaveContext.timerY[sTimerId] = 54; } else { gSaveContext.timerY[sTimerId] = 46; @@ -5727,7 +5729,7 @@ void Interface_DrawTimers(PlayState* play) { j = ((((void)0, gSaveContext.timerX[sTimerId]) - 26) / sTimerStateTimer); gSaveContext.timerX[sTimerId] = ((void)0, gSaveContext.timerX[sTimerId]) - j; - j = (gSaveContext.save.playerData.healthCapacity > 0xA0) + j = (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) ? ((((void)0, gSaveContext.timerY[sTimerId]) - 54) / sTimerStateTimer) : ((((void)0, gSaveContext.timerY[sTimerId]) - 46) / sTimerStateTimer); gSaveContext.timerY[sTimerId] = ((void)0, gSaveContext.timerY[sTimerId]) - j; @@ -5741,7 +5743,7 @@ void Interface_DrawTimers(PlayState* play) { gSaveContext.timerY[sTimerId] = R_MOON_CRASH_TIMER_Y; } else { gSaveContext.timerX[sTimerId] = 26; - if (gSaveContext.save.playerData.healthCapacity > 0xA0) { + if (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) { gSaveContext.timerY[sTimerId] = 54; } else { gSaveContext.timerY[sTimerId] = 46; @@ -5781,7 +5783,8 @@ void Interface_DrawTimers(PlayState* play) { break; case TIMER_STATE_ENV_HAZARD_START: - gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(gSaveContext.save.playerData.health >> 1); + gSaveContext.timerCurTimes[sTimerId] = + SECONDS_TO_TIMER(gSaveContext.save.saveInfo.playerData.health >> 1); gSaveContext.timerDirections[sTimerId] = TIMER_COUNT_DOWN; gSaveContext.timerTimeLimits[sTimerId] = gSaveContext.timerCurTimes[sTimerId]; sTimerStateTimer = 20; @@ -5889,8 +5892,8 @@ void Interface_DrawTimers(PlayState* play) { gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[sTimerId] = TIMER_STATE_STOP; if (sEnvTimerActive) { - gSaveContext.save.playerData.health = 0; - play->damagePlayer(play, -(((void)0, gSaveContext.save.playerData.health) + 2)); + gSaveContext.save.saveInfo.playerData.health = 0; + play->damagePlayer(play, -(((void)0, gSaveContext.save.saveInfo.playerData.health) + 2)); } sEnvTimerActive = false; } @@ -5958,7 +5961,8 @@ void Interface_DrawTimers(PlayState* play) { } } else if (CHECK_EVENTINF(EVENTINF_34) && (play->sceneId == SCENE_DEKUTES)) { if ((((void)0, gSaveContext.timerCurTimes[sTimerId]) > - (gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] - SECONDS_TO_TIMER(9))) && + (gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1] - + SECONDS_TO_TIMER(9))) && (sTimerBeepSfxSeconds != sTimerDigits[4])) { play_sound(NA_SE_SY_WARNING_COUNT_E); sTimerBeepSfxSeconds = sTimerDigits[4]; @@ -5996,10 +6000,10 @@ void Interface_DrawTimers(PlayState* play) { } } else if (CHECK_EVENTINF(EVENTINF_34) && (play->sceneId == SCENE_DEKUTES)) { if (((void)0, gSaveContext.timerCurTimes[sTimerId]) >= - gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); } else if (((void)0, gSaveContext.timerCurTimes[sTimerId]) >= - (gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] - + (gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1] - SECONDS_TO_TIMER(9))) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 0, 255); } else { @@ -6107,7 +6111,7 @@ void Interface_UpdateBottleTimers(PlayState* play) { // Time has passed, and the time limit has been exceeded. gSaveContext.bottleTimerCurTimes[i] = SECONDS_TO_TIMER(0); - if (gSaveContext.save.inventory.items[i + SLOT_BOTTLE_1] == ITEM_HOT_SPRING_WATER) { + if (gSaveContext.save.saveInfo.inventory.items[i + SLOT_BOTTLE_1] == ITEM_HOT_SPRING_WATER) { Inventory_UpdateItem(play, i + SLOT_BOTTLE_1, ITEM_SPRING_WATER); Message_StartTextbox(play, 0xFA, NULL); } @@ -6166,7 +6170,7 @@ void Interface_DrawMinigameIcons(PlayState* play) { width = 24; height = 16; rectX = 20; - if (gSaveContext.save.playerData.healthCapacity > 0xA0) { + if (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) { rectY = 75; // two rows of hearts } else { rectY = 67; // one row of hearts @@ -6210,7 +6214,7 @@ void Interface_DrawMinigameIcons(PlayState* play) { if (play->sceneId == SCENE_30GYOSON) { rectX += 20; - if (gSaveContext.save.playerData.healthCapacity > 0xA0) { + if (gSaveContext.save.saveInfo.playerData.healthCapacity > 0xA0) { rectY = 87; // two rows of hearts } else { rectY = 79; // one row of hearts @@ -6465,7 +6469,7 @@ void Interface_Draw(PlayState* play) { PRIMITIVE, 0); counterDigits[0] = counterDigits[1] = 0; - counterDigits[2] = gSaveContext.save.playerData.rupees; + counterDigits[2] = gSaveContext.save.saveInfo.playerData.rupees; if ((counterDigits[2] > 9999) || (counterDigits[2] < 0)) { counterDigits[2] &= 0xDDD; @@ -6498,9 +6502,9 @@ void Interface_Draw(PlayState* play) { gDPPipeSync(OVERLAY_DISP++); - if (gSaveContext.save.playerData.rupees == CUR_CAPACITY(UPG_WALLET)) { + if (gSaveContext.save.saveInfo.playerData.rupees == CUR_CAPACITY(UPG_WALLET)) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha); - } else if (gSaveContext.save.playerData.rupees != 0) { + } else if (gSaveContext.save.saveInfo.playerData.rupees != 0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha); } else { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha); @@ -6851,14 +6855,15 @@ void Interface_Update(PlayState* play) { // Update health if (gSaveContext.healthAccumulator != 0) { gSaveContext.healthAccumulator -= 4; - gSaveContext.save.playerData.health += 4; + gSaveContext.save.saveInfo.playerData.health += 4; - if ((gSaveContext.save.playerData.health & 0xF) < 4) { + if ((gSaveContext.save.saveInfo.playerData.health & 0xF) < 4) { play_sound(NA_SE_SY_HP_RECOVER); } - if (((void)0, gSaveContext.save.playerData.health) >= ((void)0, gSaveContext.save.playerData.healthCapacity)) { - gSaveContext.save.playerData.health = gSaveContext.save.playerData.healthCapacity; + if (((void)0, gSaveContext.save.saveInfo.playerData.health) >= + ((void)0, gSaveContext.save.saveInfo.playerData.healthCapacity)) { + gSaveContext.save.saveInfo.playerData.health = gSaveContext.save.saveInfo.playerData.healthCapacity; gSaveContext.healthAccumulator = 0; } } @@ -6883,26 +6888,26 @@ void Interface_Update(PlayState* play) { // Update rupees if (gSaveContext.rupeeAccumulator != 0) { if (gSaveContext.rupeeAccumulator > 0) { - if (gSaveContext.save.playerData.rupees < CUR_CAPACITY(UPG_WALLET)) { + if (gSaveContext.save.saveInfo.playerData.rupees < CUR_CAPACITY(UPG_WALLET)) { gSaveContext.rupeeAccumulator--; - gSaveContext.save.playerData.rupees++; + gSaveContext.save.saveInfo.playerData.rupees++; play_sound(NA_SE_SY_RUPY_COUNT); } else { // Max rupees - gSaveContext.save.playerData.rupees = CUR_CAPACITY(UPG_WALLET); + gSaveContext.save.saveInfo.playerData.rupees = CUR_CAPACITY(UPG_WALLET); gSaveContext.rupeeAccumulator = 0; } - } else if (gSaveContext.save.playerData.rupees != 0) { + } else if (gSaveContext.save.saveInfo.playerData.rupees != 0) { if (gSaveContext.rupeeAccumulator <= -50) { gSaveContext.rupeeAccumulator += 10; - gSaveContext.save.playerData.rupees -= 10; - if (gSaveContext.save.playerData.rupees < 0) { - gSaveContext.save.playerData.rupees = 0; + gSaveContext.save.saveInfo.playerData.rupees -= 10; + if (gSaveContext.save.saveInfo.playerData.rupees < 0) { + gSaveContext.save.saveInfo.playerData.rupees = 0; } play_sound(NA_SE_SY_RUPY_COUNT); } else { gSaveContext.rupeeAccumulator++; - gSaveContext.save.playerData.rupees--; + gSaveContext.save.saveInfo.playerData.rupees--; play_sound(NA_SE_SY_RUPY_COUNT); } } else { @@ -7035,29 +7040,31 @@ void Interface_Update(PlayState* play) { if (!(player->stateFlags1 & PLAYER_STATE1_200)) { if (R_MAGIC_DBG_SET_UPGRADE == MAGIC_DBG_SET_UPGRADE_DOUBLE_METER) { // Upgrade to double magic - if (!gSaveContext.save.playerData.isMagicAcquired) { - gSaveContext.save.playerData.isMagicAcquired = true; + if (!gSaveContext.save.saveInfo.playerData.isMagicAcquired) { + gSaveContext.save.saveInfo.playerData.isMagicAcquired = true; } - gSaveContext.save.playerData.isDoubleMagicAcquired = true; - gSaveContext.save.playerData.magic = MAGIC_DOUBLE_METER; - gSaveContext.save.playerData.magicLevel = 0; + gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired = true; + gSaveContext.save.saveInfo.playerData.magic = MAGIC_DOUBLE_METER; + gSaveContext.save.saveInfo.playerData.magicLevel = 0; R_MAGIC_DBG_SET_UPGRADE = MAGIC_DBG_SET_UPGRADE_NO_ACTION; } else if (R_MAGIC_DBG_SET_UPGRADE == MAGIC_DBG_SET_UPGRADE_NORMAL_METER) { // Upgrade to normal magic - if (!gSaveContext.save.playerData.isMagicAcquired) { - gSaveContext.save.playerData.isMagicAcquired = true; + if (!gSaveContext.save.saveInfo.playerData.isMagicAcquired) { + gSaveContext.save.saveInfo.playerData.isMagicAcquired = true; } - gSaveContext.save.playerData.isDoubleMagicAcquired = false; - gSaveContext.save.playerData.magic = MAGIC_NORMAL_METER; - gSaveContext.save.playerData.magicLevel = 0; + gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired = false; + gSaveContext.save.saveInfo.playerData.magic = MAGIC_NORMAL_METER; + gSaveContext.save.saveInfo.playerData.magicLevel = 0; R_MAGIC_DBG_SET_UPGRADE = MAGIC_DBG_SET_UPGRADE_NO_ACTION; } - if ((gSaveContext.save.playerData.isMagicAcquired) && (gSaveContext.save.playerData.magicLevel == 0)) { + if ((gSaveContext.save.saveInfo.playerData.isMagicAcquired) && + (gSaveContext.save.saveInfo.playerData.magicLevel == 0)) { // Prepare to step `magicCapacity` to full capacity - gSaveContext.save.playerData.magicLevel = gSaveContext.save.playerData.isDoubleMagicAcquired + 1; - gSaveContext.magicFillTarget = gSaveContext.save.playerData.magic; - gSaveContext.save.playerData.magic = 0; + gSaveContext.save.saveInfo.playerData.magicLevel = + gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired + 1; + gSaveContext.magicFillTarget = gSaveContext.save.saveInfo.playerData.magic; + gSaveContext.save.saveInfo.playerData.magic = 0; gSaveContext.magicState = MAGIC_STATE_STEP_CAPACITY; BUTTON_ITEM_EQUIP(PLAYER_FORM_DEKU, EQUIP_SLOT_B) = ITEM_NUT; } @@ -7071,7 +7078,7 @@ void Interface_Update(PlayState* play) { if ((sEnvHazard == PLAYER_ENV_HAZARD_HOTROOM) || (sEnvHazard == PLAYER_ENV_HAZARD_UNDERWATER_FREE)) { if (CUR_FORM != PLAYER_FORM_ZORA) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { - if ((gSaveContext.save.playerData.health >> 1) != 0) { + if ((gSaveContext.save.saveInfo.playerData.health >> 1) != 0) { gSaveContext.timerStates[TIMER_ID_ENV_HAZARD] = TIMER_STATE_ENV_HAZARD_START; gSaveContext.timerX[TIMER_ID_ENV_HAZARD] = 115; gSaveContext.timerY[TIMER_ID_ENV_HAZARD] = 80; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 1fa3ed54a..fc47c9bf7 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -390,7 +390,7 @@ void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { } // Increase time speed during first cycle - if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (play->envCtx.sceneTimeSpeed != 0)) { + if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) && (play->envCtx.sceneTimeSpeed != 0)) { play->envCtx.sceneTimeSpeed = 5; } @@ -519,8 +519,8 @@ void Scene_CommandSetRegionVisitedFlag(PlayState* play, SceneCmd* cmd) { } if (i < REGION_MAX) { - gSaveContext.save.regionsVisited = - (gBitFlags[i] | gSaveContext.save.regionsVisited) | gSaveContext.save.regionsVisited; + gSaveContext.save.saveInfo.regionsVisited = + (gBitFlags[i] | gSaveContext.save.saveInfo.regionsVisited) | gSaveContext.save.saveInfo.regionsVisited; } } diff --git a/src/code/z_shrink_window.c b/src/code/z_shrink_window.c index 21d8bde40..c4084a18c 100644 --- a/src/code/z_shrink_window.c +++ b/src/code/z_shrink_window.c @@ -3,6 +3,7 @@ * Description: Draws black top/bottom/side borders on the viewing window (e.g. Z-targeting, talking to NPC) */ +#include "prevent_bss_reordering.h" #include "global.h" #include "z64shrink_window.h" diff --git a/src/code/z_snap.c b/src/code/z_snap.c index e9663b02f..9361cc1e0 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -18,8 +18,8 @@ s32 Snap_RecordPictographedActors(PlayState* play) { s32 seen; s32 validCount = 0; - gSaveContext.save.pictoFlags0 = 0; - gSaveContext.save.pictoFlags1 = 0; + gSaveContext.save.saveInfo.pictoFlags0 = 0; + gSaveContext.save.saveInfo.pictoFlags1 = 0; if (play->sceneId == SCENE_20SICHITAI) { Snap_SetFlag(PICTO_VALID_IN_SWAMP); @@ -91,20 +91,20 @@ s32 Snap_RecordPictographedActors(PlayState* play) { // Only used in this file void Snap_SetFlag(s32 flag) { if (flag < 0x20) { - gSaveContext.save.pictoFlags0 |= (1 << flag); + gSaveContext.save.saveInfo.pictoFlags0 |= (1 << flag); } else { flag &= 0x1F; - gSaveContext.save.pictoFlags1 |= (1 << flag); + gSaveContext.save.saveInfo.pictoFlags1 |= (1 << flag); } } // Unused void Snap_UnsetFlag(s32 flag) { if (flag < 0x20) { - gSaveContext.save.pictoFlags0 &= ~(1 << flag); + gSaveContext.save.saveInfo.pictoFlags0 &= ~(1 << flag); } else { flag &= 0x1F; - gSaveContext.save.pictoFlags1 &= ~(1 << flag); + gSaveContext.save.saveInfo.pictoFlags1 &= ~(1 << flag); } } @@ -112,10 +112,10 @@ u32 Snap_CheckFlag(s32 flag) { SaveContext* saveCtx = &gSaveContext; if (flag < 0x20) { - return saveCtx->save.pictoFlags0 & (1 << flag); + return saveCtx->save.saveInfo.pictoFlags0 & (1 << flag); } else { flag &= 0x1F; - return saveCtx->save.pictoFlags1 & (1 << flag); + return saveCtx->save.saveInfo.pictoFlags1 & (1 << flag); } } diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index c32a76d76..c269e30f4 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -134,7 +134,7 @@ u32 D_801C5FC0[SCENE_MAX][4] = { // TODO: figure out a way to use the WEEKEVENTREG defines here // weekEventReg flags which will be not be cleared on a cycle reset -u16 D_801C66D0[ARRAY_COUNT(gSaveContext.save.weekEventReg)] = { +u16 D_801C66D0[ARRAY_COUNT(gSaveContext.save.saveInfo.weekEventReg)] = { /* 0 */ 0xFFFC, /* 1 */ 0xFFFF, /* 2 */ 0xFFFF, @@ -296,24 +296,24 @@ u16 D_801F6AF0; u8 D_801F6AF2; void Sram_ActivateOwl(u8 owlId) { - gSaveContext.save.playerData.owlActivationFlags = - ((void)0, gSaveContext.save.playerData.owlActivationFlags) | (u16)gBitFlags[owlId]; + gSaveContext.save.saveInfo.playerData.owlActivationFlags = + ((void)0, gSaveContext.save.saveInfo.playerData.owlActivationFlags) | (u16)gBitFlags[owlId]; - if (gSaveContext.save.playerData.unk_20 == 0xFF) { - gSaveContext.save.playerData.unk_20 = owlId; + if (gSaveContext.save.saveInfo.playerData.unk_20 == 0xFF) { + gSaveContext.save.saveInfo.playerData.unk_20 = owlId; } } void Sram_ClearHighscores(void) { - gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF) | 0x130000; - gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF0000) | 0xA; - gSaveContext.save.horseBackBalloonHighScore = SECONDS_TO_TIMER(60); + gSaveContext.save.saveInfo.unk_EC4 = (gSaveContext.save.saveInfo.unk_EC4 & 0xFFFF) | 0x130000; + gSaveContext.save.saveInfo.unk_EC4 = (gSaveContext.save.saveInfo.unk_EC4 & 0xFFFF0000) | 0xA; + gSaveContext.save.saveInfo.horseBackBalloonHighScore = SECONDS_TO_TIMER(60); SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(39); SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(10); - gSaveContext.save.dekuPlaygroundHighScores[0] = SECONDS_TO_TIMER(75); - gSaveContext.save.dekuPlaygroundHighScores[1] = SECONDS_TO_TIMER(75); - gSaveContext.save.dekuPlaygroundHighScores[2] = SECONDS_TO_TIMER(76); + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[0] = SECONDS_TO_TIMER(75); + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[1] = SECONDS_TO_TIMER(75); + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[2] = SECONDS_TO_TIMER(76); } /** @@ -342,9 +342,9 @@ void Sram_SaveEndOfCycle(PlayState* play) { gSaveContext.save.day = 0; gSaveContext.save.time = CLOCK_TIME(6, 0) - 1; - gSaveContext.save.playerData.deaths++; - if (gSaveContext.save.playerData.deaths > 999) { - gSaveContext.save.playerData.deaths = 999; + gSaveContext.save.saveInfo.playerData.deaths++; + if (gSaveContext.save.saveInfo.playerData.deaths > 999) { + gSaveContext.save.saveInfo.playerData.deaths = 999; } sceneId = Play_GetOriginalSceneId(play->sceneId); @@ -363,8 +363,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { gSaveContext.cycleSceneFlags[i].collectible = ((void)0, gSaveContext.cycleSceneFlags[i].collectible) & D_801C5FC0[i][3]; gSaveContext.cycleSceneFlags[i].clearedRoom = 0; - gSaveContext.save.permanentSceneFlags[i].unk_14 = 0; - gSaveContext.save.permanentSceneFlags[i].rooms = 0; + gSaveContext.save.saveInfo.permanentSceneFlags[i].unk_14 = 0; + gSaveContext.save.saveInfo.permanentSceneFlags[i].rooms = 0; } for (; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { @@ -388,8 +388,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { for (j = 0; j < ARRAY_COUNT(D_801C6890); j++) { if ((phi_v1_3 & 3) == 0) { - gSaveContext.save.weekEventReg[i] = - ((void)0, gSaveContext.save.weekEventReg[i]) & (0xFF ^ D_801C6890[j]); + gSaveContext.save.saveInfo.weekEventReg[i] = + ((void)0, gSaveContext.save.saveInfo.weekEventReg[i]) & (0xFF ^ D_801C6890[j]); } phi_v1_3 >>= 2; } @@ -405,7 +405,7 @@ void Sram_SaveEndOfCycle(PlayState* play) { CLEAR_EVENTINF(EVENTINF_73); CLEAR_EVENTINF(EVENTINF_74); - if (gSaveContext.save.playerData.rupees != 0) { + if (gSaveContext.save.saveInfo.playerData.rupees != 0) { SET_EVENTINF(EVENTINF_70); } @@ -436,8 +436,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { for (i = 0; i < ARRAY_COUNT(gAmmoItems); i++) { if (gAmmoItems[i] != ITEM_NONE) { - if ((gSaveContext.save.inventory.items[i] != ITEM_NONE) && (i != SLOT_PICTO_BOX)) { - item = gSaveContext.save.inventory.items[i]; + if ((gSaveContext.save.saveInfo.inventory.items[i] != ITEM_NONE) && (i != SLOT_PICTO_BOX)) { + item = gSaveContext.save.saveInfo.inventory.items[i]; AMMO(item) = 0; } } @@ -445,23 +445,23 @@ void Sram_SaveEndOfCycle(PlayState* play) { for (i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_6; i++) { // Check for all bottled items - if (gSaveContext.save.inventory.items[i] >= ITEM_POTION_RED) { - if (gSaveContext.save.inventory.items[i] <= ITEM_OBABA_DRINK) { + if (gSaveContext.save.saveInfo.inventory.items[i] >= ITEM_POTION_RED) { + if (gSaveContext.save.saveInfo.inventory.items[i] <= ITEM_OBABA_DRINK) { for (j = EQUIP_SLOT_C_LEFT; j <= EQUIP_SLOT_C_RIGHT; j++) { - if (GET_CUR_FORM_BTN_ITEM(j) == gSaveContext.save.inventory.items[i]) { + if (GET_CUR_FORM_BTN_ITEM(j) == gSaveContext.save.saveInfo.inventory.items[i]) { SET_CUR_FORM_BTN_ITEM(j, ITEM_BOTTLE); Interface_LoadItemIconImpl(play, j); } } - gSaveContext.save.inventory.items[i] = ITEM_BOTTLE; + gSaveContext.save.saveInfo.inventory.items[i] = ITEM_BOTTLE; } } } REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); - if (gSaveContext.save.playerData.health < 0x30) { - gSaveContext.save.playerData.health = 0x30; + if (gSaveContext.save.saveInfo.playerData.health < 0x30) { + gSaveContext.save.saveInfo.playerData.health = 0x30; } if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) <= EQUIP_VALUE_SWORD_RAZOR) { @@ -491,8 +491,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { if (STOLEN_ITEM_1 == ITEM_BOTTLE) { slot = SLOT(ITEM_BOTTLE); for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot + i] = ITEM_BOTTLE; + if (gSaveContext.save.saveInfo.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot + i] = ITEM_BOTTLE; break; } } @@ -501,8 +501,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { if (STOLEN_ITEM_2 == ITEM_BOTTLE) { slot = SLOT(ITEM_BOTTLE); for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot + i] = ITEM_BOTTLE; + if (gSaveContext.save.saveInfo.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot + i] = ITEM_BOTTLE; break; } } @@ -522,28 +522,28 @@ void Sram_SaveEndOfCycle(PlayState* play) { } } - gSaveContext.save.skullTokenCount &= ~0xFFFF0000; - gSaveContext.save.skullTokenCount &= ~0x0000FFFF; - gSaveContext.save.unk_EC4 = 0; + gSaveContext.save.saveInfo.skullTokenCount &= ~0xFFFF0000; + gSaveContext.save.saveInfo.skullTokenCount &= ~0x0000FFFF; + gSaveContext.save.saveInfo.unk_EA0 = 0; - gSaveContext.save.unk_E88[0] = 0; - gSaveContext.save.unk_E88[1] = 0; - gSaveContext.save.unk_E88[2] = 0; - gSaveContext.save.unk_E88[3] = 0; - gSaveContext.save.unk_E88[4] = 0; - gSaveContext.save.unk_E88[5] = 0; - gSaveContext.save.unk_E88[6] = 0; + gSaveContext.save.saveInfo.unk_E64[0] = 0; + gSaveContext.save.saveInfo.unk_E64[1] = 0; + gSaveContext.save.saveInfo.unk_E64[2] = 0; + gSaveContext.save.saveInfo.unk_E64[3] = 0; + gSaveContext.save.saveInfo.unk_E64[4] = 0; + gSaveContext.save.saveInfo.unk_E64[5] = 0; + gSaveContext.save.saveInfo.unk_E64[6] = 0; Sram_ClearHighscores(); for (i = 0; i < 8; i++) { - gSaveContext.save.inventory.dungeonItems[i] &= (u8)~1; // remove boss key + gSaveContext.save.saveInfo.inventory.dungeonItems[i] &= (u8)~1; // remove boss key DUNGEON_KEY_COUNT(i) = 0; - gSaveContext.save.inventory.strayFairies[i] = 0; + gSaveContext.save.saveInfo.inventory.strayFairies[i] = 0; } - gSaveContext.save.playerData.rupees = 0; - gSaveContext.save.unk_F65 = 0; + gSaveContext.save.saveInfo.playerData.rupees = 0; + gSaveContext.save.saveInfo.unk_F41 = 0; gSaveContext.powderKegTimer = 0; gSaveContext.unk_1014 = 0; gSaveContext.jinxTimer = 0; @@ -558,12 +558,12 @@ void Sram_IncrementDay(void) { gSaveContext.save.daysElapsed++; } - gSaveContext.save.bombersCaughtNum = 0; - gSaveContext.save.bombersCaughtOrder[0] = 0; - gSaveContext.save.bombersCaughtOrder[1] = 0; - gSaveContext.save.bombersCaughtOrder[2] = 0; - gSaveContext.save.bombersCaughtOrder[3] = 0; - gSaveContext.save.bombersCaughtOrder[4] = 0; + gSaveContext.save.saveInfo.bombersCaughtNum = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[0] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[1] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[2] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[3] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[4] = 0; CLEAR_WEEKEVENTREG(WEEKEVENTREG_73_10); CLEAR_WEEKEVENTREG(WEEKEVENTREG_85_02); @@ -593,9 +593,7 @@ void Sram_ResetSave(void) { gSaveContext.save.hasTatl = false; gSaveContext.save.isOwlSave = false; - // Instead of bloating all save context accesses with an extra sub-struct, the size of the would-be sub-struct - // is calculated manually - bzero(&gSaveContext.save.playerData, sizeof(Save) - offsetof(Save, playerData)); + bzero(&gSaveContext.save.saveInfo, sizeof(SaveInfo)); } /** @@ -615,15 +613,15 @@ void Sram_GenerateRandomSaveFields(void) { Sram_ClearHighscores(); - gSaveContext.save.lotteryCodes[0][0] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[0][1] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[0][2] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[1][0] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[1][1] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[1][2] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[2][0] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[2][1] = Rand_S16Offset(0, 10); - gSaveContext.save.lotteryCodes[2][2] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[0][0] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[0][1] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[0][2] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[1][0] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[1][1] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[1][2] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[2][0] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[2][1] = Rand_S16Offset(0, 10); + gSaveContext.save.saveInfo.lotteryCodes[2][2] = Rand_S16Offset(0, 10); // Needed to match... for (i = 0; i < 3; i++) { @@ -636,7 +634,7 @@ void Sram_GenerateRandomSaveFields(void) { while (i != k) { randSpiderHouse = Rand_S16Offset(0, 16) & 3; if (sp2A != randSpiderHouse) { - gSaveContext.save.spiderHouseMaskOrder[i] = randSpiderHouse; + gSaveContext.save.saveInfo.spiderHouseMaskOrder[i] = randSpiderHouse; i++; sp2A = randSpiderHouse; } @@ -646,7 +644,7 @@ void Sram_GenerateRandomSaveFields(void) { randBombers = Rand_S16Offset(0, 6); } while (randBombers <= 0 || randBombers >= 6); - gSaveContext.save.bomberCode[0] = randBombers; + gSaveContext.save.saveInfo.bomberCode[0] = randBombers; i = 1; while (i != 5) { @@ -658,14 +656,14 @@ void Sram_GenerateRandomSaveFields(void) { sp2A = 0; do { - if (randBombers == gSaveContext.save.bomberCode[sp2A]) { + if (randBombers == gSaveContext.save.saveInfo.bomberCode[sp2A]) { k = true; } sp2A++; } while (sp2A < i); if (k == false) { - gSaveContext.save.bomberCode[i] = randBombers; + gSaveContext.save.saveInfo.bomberCode[i] = randBombers; i++; } } @@ -755,19 +753,20 @@ void Sram_InitNewSave(void) { gSaveContext.save.time = CLOCK_TIME(6, 0) - 1; Sram_ResetSave(); - Lib_MemCpy(&gSaveContext.save.playerData, &sSaveDefaultPlayerData, sizeof(SavePlayerData)); - Lib_MemCpy(&gSaveContext.save.equips, &sSaveDefaultItemEquips, sizeof(ItemEquips)); - Lib_MemCpy(&gSaveContext.save.inventory, &sSaveDefaultInventory, sizeof(Inventory)); - Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDefaultChecksum, sizeof(gSaveContext.save.checksum)); + Lib_MemCpy(&gSaveContext.save.saveInfo.playerData, &sSaveDefaultPlayerData, sizeof(SavePlayerData)); + Lib_MemCpy(&gSaveContext.save.saveInfo.equips, &sSaveDefaultItemEquips, sizeof(ItemEquips)); + Lib_MemCpy(&gSaveContext.save.saveInfo.inventory, &sSaveDefaultInventory, sizeof(Inventory)); + Lib_MemCpy(&gSaveContext.save.saveInfo.checksum, &sSaveDefaultChecksum, + sizeof(gSaveContext.save.saveInfo.checksum)); - gSaveContext.save.horseData.sceneId = SCENE_F01; - gSaveContext.save.horseData.pos.x = -1420; - gSaveContext.save.horseData.pos.y = 257; - gSaveContext.save.horseData.pos.z = -1285; - gSaveContext.save.horseData.yaw = -0x7554; + gSaveContext.save.saveInfo.horseData.sceneId = SCENE_F01; + gSaveContext.save.saveInfo.horseData.pos.x = -1420; + gSaveContext.save.saveInfo.horseData.pos.y = 257; + gSaveContext.save.saveInfo.horseData.pos.z = -1285; + gSaveContext.save.saveInfo.horseData.yaw = -0x7554; gSaveContext.nextCutsceneIndex = 0; - gSaveContext.save.playerData.magicLevel = 0; + gSaveContext.save.saveInfo.playerData.magicLevel = 0; Sram_GenerateRandomSaveFields(); } @@ -908,10 +907,10 @@ u8 D_801C6A50[] = { void Sram_InitDebugSave(void) { Sram_ResetSave(); - Lib_MemCpy(&gSaveContext.save.playerData, &sSaveDebugPlayerData, sizeof(SavePlayerData)); - Lib_MemCpy(&gSaveContext.save.equips, &sSaveDebugItemEquips, sizeof(ItemEquips)); - Lib_MemCpy(&gSaveContext.save.inventory, &sSaveDebugInventory, sizeof(Inventory)); - Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.checksum)); + Lib_MemCpy(&gSaveContext.save.saveInfo.playerData, &sSaveDebugPlayerData, sizeof(SavePlayerData)); + Lib_MemCpy(&gSaveContext.save.saveInfo.equips, &sSaveDebugItemEquips, sizeof(ItemEquips)); + Lib_MemCpy(&gSaveContext.save.saveInfo.inventory, &sSaveDebugInventory, sizeof(Inventory)); + Lib_MemCpy(&gSaveContext.save.saveInfo.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.saveInfo.checksum)); if (GET_PLAYER_FORM != PLAYER_FORM_HUMAN) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[GET_PLAYER_FORM]; @@ -920,11 +919,11 @@ void Sram_InitDebugSave(void) { gSaveContext.save.hasTatl = true; - gSaveContext.save.horseData.sceneId = SCENE_F01; - gSaveContext.save.horseData.pos.x = -1420; - gSaveContext.save.horseData.pos.y = 257; - gSaveContext.save.horseData.pos.z = -1285; - gSaveContext.save.horseData.yaw = -0x7554; + gSaveContext.save.saveInfo.horseData.sceneId = SCENE_F01; + gSaveContext.save.saveInfo.horseData.pos.x = -1420; + gSaveContext.save.saveInfo.horseData.pos.y = 257; + gSaveContext.save.saveInfo.horseData.pos.z = -1285; + gSaveContext.save.saveInfo.horseData.yaw = -0x7554; gSaveContext.save.entrance = ENTRANCE(CUTSCENE, 0); gSaveContext.save.isFirstCycle = true; @@ -934,8 +933,8 @@ void Sram_InitDebugSave(void) { SET_WEEKEVENTREG(WEEKEVENTREG_31_04); gSaveContext.cycleSceneFlags[SCENE_INSIDETOWER].switch0 = 1; - gSaveContext.save.permanentSceneFlags[SCENE_INSIDETOWER].switch0 = 1; - gSaveContext.save.playerData.magicLevel = 0; + gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_INSIDETOWER].switch0 = 1; + gSaveContext.save.saveInfo.playerData.magicLevel = 0; Sram_GenerateRandomSaveFields(); } @@ -953,7 +952,7 @@ void func_80144A94(SramContext* sramCtx) { D_801C67F0[gSaveContext.fileNum * 2 + 1]); } Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); - if (CHECK_NEWF(gSaveContext.save.playerData.newf)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf)) { func_80185968(sramCtx->saveBuf, D_801C67C8[gSaveContext.fileNum * 2 + 1], D_801C67F0[gSaveContext.fileNum * 2 + 1]); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save)); @@ -965,11 +964,11 @@ void func_80144A94(SramContext* sramCtx) { } for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { - gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.permanentSceneFlags[i].chest; - gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.permanentSceneFlags[i].switch0; - gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.permanentSceneFlags[i].switch1; - gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.permanentSceneFlags[i].clearedRoom; - gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; + gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest; + gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0; + gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1; + gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom; + gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible; } for (i = 0; i < TIMER_ID_MAX; i++) { @@ -1026,13 +1025,13 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) { Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[phi_t1]); - if (CHECK_NEWF(gSaveContext.save.playerData.newf)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf)) { func_80185968(sramCtx->saveBuf, D_801C67C8[phi_t1 + 1], D_801C67F0[phi_t1 + 1]); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[phi_t1]); } } - gSaveContext.save.playerData.magicLevel = 0; + gSaveContext.save.saveInfo.playerData.magicLevel = 0; if (!gSaveContext.save.isOwlSave) { for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) { @@ -1040,11 +1039,11 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) { } for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { - gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.permanentSceneFlags[i].chest; - gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.permanentSceneFlags[i].switch0; - gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.permanentSceneFlags[i].switch1; - gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.permanentSceneFlags[i].clearedRoom; - gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; + gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest; + gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0; + gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1; + gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom; + gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible; } for (i = 0; i < TIMER_ID_MAX; i++) { @@ -1076,18 +1075,18 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) { } for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { - gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.permanentSceneFlags[i].chest; - gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.permanentSceneFlags[i].switch0; - gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.permanentSceneFlags[i].switch1; - gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.permanentSceneFlags[i].clearedRoom; - gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; + gSaveContext.cycleSceneFlags[i].chest = gSaveContext.save.saveInfo.permanentSceneFlags[i].chest; + gSaveContext.cycleSceneFlags[i].switch0 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0; + gSaveContext.cycleSceneFlags[i].switch1 = gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1; + gSaveContext.cycleSceneFlags[i].clearedRoom = gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom; + gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible; } - if (gSaveContext.save.unk_F65) { - Lib_MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.scarecrowSpawnSong, - sizeof(gSaveContext.save.scarecrowSpawnSong)); + if (gSaveContext.save.saveInfo.unk_F41) { + Lib_MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.saveInfo.scarecrowSpawnSong, + sizeof(gSaveContext.save.saveInfo.scarecrowSpawnSong)); - for (i = 0; i != ARRAY_COUNT(gSaveContext.save.scarecrowSpawnSong); i++) {} + for (i = 0; i != ARRAY_COUNT(gSaveContext.save.saveInfo.scarecrowSpawnSong); i++) {} } fileNum = gSaveContext.fileNum; @@ -1101,28 +1100,28 @@ void func_8014546C(SramContext* sramCtx) { if (gSaveContext.save.isOwlSave) { for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { - gSaveContext.save.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; - gSaveContext.save.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; - gSaveContext.save.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; - gSaveContext.save.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; - gSaveContext.save.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; + gSaveContext.save.saveInfo.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; + gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; + gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; } - gSaveContext.save.checksum = 0; - gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum)); + gSaveContext.save.saveInfo.checksum = 0; + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum)); Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum)); } else { for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { - gSaveContext.save.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; - gSaveContext.save.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; - gSaveContext.save.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; - gSaveContext.save.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; - gSaveContext.save.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; + gSaveContext.save.saveInfo.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; + gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; + gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; } - gSaveContext.save.checksum = 0; - gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); + gSaveContext.save.saveInfo.checksum = 0; + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); if (gSaveContext.unk_3F3F) { Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, sizeof(Save)); @@ -1138,15 +1137,15 @@ void func_80145698(SramContext* sramCtx) { s32 i; for (i = 0; i < ARRAY_COUNT(gSaveContext.cycleSceneFlags); i++) { - gSaveContext.save.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; - gSaveContext.save.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; - gSaveContext.save.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; - gSaveContext.save.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; - gSaveContext.save.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; + gSaveContext.save.saveInfo.permanentSceneFlags[i].chest = gSaveContext.cycleSceneFlags[i].chest; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch0 = gSaveContext.cycleSceneFlags[i].switch0; + gSaveContext.save.saveInfo.permanentSceneFlags[i].switch1 = gSaveContext.cycleSceneFlags[i].switch1; + gSaveContext.save.saveInfo.permanentSceneFlags[i].clearedRoom = gSaveContext.cycleSceneFlags[i].clearedRoom; + gSaveContext.save.saveInfo.permanentSceneFlags[i].collectible = gSaveContext.cycleSceneFlags[i].collectible; } - gSaveContext.save.checksum = 0; - gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); + gSaveContext.save.saveInfo.checksum = 0; + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); if (gSaveContext.unk_3F3F) { Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, sizeof(Save)); Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); @@ -1202,14 +1201,14 @@ void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) { } else { // Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); - temp_s2 = gSaveContext.save.checksum; - gSaveContext.save.checksum = 0; + temp_s2 = gSaveContext.save.saveInfo.checksum; + gSaveContext.save.saveInfo.checksum = 0; temp_v0_2 = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]); - gSaveContext.save.checksum = temp_s2; + gSaveContext.save.saveInfo.checksum = temp_s2; - if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (temp_s2 != temp_v0_2)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (temp_s2 != temp_v0_2)) { sp6E = 1; - if (CHECK_NEWF2(gSaveContext.save.playerData.newf)) {} + if (CHECK_NEWF2(gSaveContext.save.saveInfo.playerData.newf)) {} phi_s2 = false; if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { @@ -1217,9 +1216,9 @@ void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) { } Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); - temp_s2 = gSaveContext.save.checksum; - gSaveContext.save.checksum = 0; - if (phi_s2 || CHECK_NEWF(gSaveContext.save.playerData.newf) || + temp_s2 = gSaveContext.save.saveInfo.checksum; + gSaveContext.save.saveInfo.checksum = 0; + if (phi_s2 || CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (temp_s2 != Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]))) { bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); @@ -1228,55 +1227,57 @@ void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) { } } - gSaveContext.save.checksum = 0; - gSaveContext.save.checksum = + gSaveContext.save.saveInfo.checksum = 0; + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed? - for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) { - fileSelect->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A]; + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.newf); sp7A++) { + fileSelect->newf[sp76][sp7A] = gSaveContext.save.saveInfo.playerData.newf[sp7A]; } if (!CHECK_NEWF(fileSelect->newf[sp76])) { - fileSelect->unk_2440C[sp76] = gSaveContext.save.playerData.deaths; + fileSelect->unk_2440C[sp76] = gSaveContext.save.saveInfo.playerData.deaths; - for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) { - fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A]; + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); sp7A++) { + fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.saveInfo.playerData.playerName[sp7A]; } - fileSelect->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity; - fileSelect->health[sp76] = gSaveContext.save.playerData.health; - fileSelect->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts; - fileSelect->unk_24444[sp76] = gSaveContext.save.inventory.questItems; + fileSelect->healthCapacity[sp76] = gSaveContext.save.saveInfo.playerData.healthCapacity; + fileSelect->health[sp76] = gSaveContext.save.saveInfo.playerData.health; + fileSelect->unk_24454[sp76] = gSaveContext.save.saveInfo.inventory.defenseHearts; + fileSelect->unk_24444[sp76] = gSaveContext.save.saveInfo.inventory.questItems; fileSelect->unk_24458[sp76] = gSaveContext.save.time; fileSelect->unk_24460[sp76] = gSaveContext.save.day; fileSelect->unk_24468[sp76] = gSaveContext.save.isOwlSave; - fileSelect->rupees[sp76] = gSaveContext.save.playerData.rupees; + fileSelect->rupees[sp76] = gSaveContext.save.saveInfo.playerData.rupees; fileSelect->unk_24474[sp76] = CUR_UPG_VALUE(4); for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { - if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) { + if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != 0xFF) { phi_a0++; } } fileSelect->maskCount[sp76] = phi_a0; - fileSelect->heartPieceCount[sp76] = ((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C); + fileSelect->heartPieceCount[sp76] = + ((gSaveContext.save.saveInfo.inventory.questItems & 0xF0000000) >> 0x1C); } if (sp6E == 1) { Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); func_80146EBC(sramCtx, D_801C67C8[sp64], D_801C6818[sp64]); } else if (sp6E == 0) { // TODO: == 0? - temp_s2 = gSaveContext.save.checksum; + temp_s2 = gSaveContext.save.saveInfo.checksum; if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { phi_s2_3 = 1; } else { Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); - phi_s2_3 = gSaveContext.save.checksum; - gSaveContext.save.checksum = 0; + phi_s2_3 = gSaveContext.save.saveInfo.checksum; + gSaveContext.save.saveInfo.checksum = 0; sp7A = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); } - if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (phi_s2_3 != sp7A) || (phi_s2_3 != temp_s2)) { + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (phi_s2_3 != sp7A) || + (phi_s2_3 != temp_s2)) { func_80185968(sramCtx->saveBuf, D_801C67C8[sp64], D_801C67F0[sp64]); Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); @@ -1293,15 +1294,15 @@ void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) { D_801C6870[sp64]); // TODO: Needed? } else { Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); - temp_s2 = gSaveContext.save.checksum; + temp_s2 = gSaveContext.save.saveInfo.checksum; - gSaveContext.save.checksum = 0; + gSaveContext.save.saveInfo.checksum = 0; temp_v0_2 = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]); - gSaveContext.save.checksum = temp_s2; - if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (temp_s2 != temp_v0_2)) { + gSaveContext.save.saveInfo.checksum = temp_s2; + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (temp_s2 != temp_v0_2)) { sp6E = 1; - if ((gSaveContext.save.playerData.newf[0] == 'Z') && - (gSaveContext.save.playerData.newf[1] == 'E')) { + if ((gSaveContext.save.saveInfo.playerData.newf[0] == 'Z') && + (gSaveContext.save.saveInfo.playerData.newf[1] == 'E')) { phi_s2 = false; } @@ -1310,9 +1311,9 @@ void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) { } Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); - temp_s2 = gSaveContext.save.checksum; - gSaveContext.save.checksum = 0; - if (phi_s2 || CHECK_NEWF(gSaveContext.save.playerData.newf) || + temp_s2 = gSaveContext.save.saveInfo.checksum; + gSaveContext.save.saveInfo.checksum = 0; + if (phi_s2 || CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (temp_s2 != Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]))) { bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); @@ -1321,58 +1322,58 @@ void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) { } } - gSaveContext.save.checksum = 0; - gSaveContext.save.checksum = + gSaveContext.save.saveInfo.checksum = 0; + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed? - for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) { - fileSelect->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A]; + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.newf); sp7A++) { + fileSelect->newf[sp76][sp7A] = gSaveContext.save.saveInfo.playerData.newf[sp7A]; } if (!CHECK_NEWF(fileSelect->newf[sp76])) { - fileSelect->unk_2440C[sp76] = gSaveContext.save.playerData.deaths; + fileSelect->unk_2440C[sp76] = gSaveContext.save.saveInfo.playerData.deaths; - for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) { + for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); sp7A++) { phi_s2 += 0; // TODO: Needed? - fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A]; + fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.saveInfo.playerData.playerName[sp7A]; } - fileSelect->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity; - fileSelect->health[sp76] = gSaveContext.save.playerData.health; - fileSelect->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts; - fileSelect->unk_24444[sp76] = gSaveContext.save.inventory.questItems; + fileSelect->healthCapacity[sp76] = gSaveContext.save.saveInfo.playerData.healthCapacity; + fileSelect->health[sp76] = gSaveContext.save.saveInfo.playerData.health; + fileSelect->unk_24454[sp76] = gSaveContext.save.saveInfo.inventory.defenseHearts; + fileSelect->unk_24444[sp76] = gSaveContext.save.saveInfo.inventory.questItems; fileSelect->unk_24458[sp76] = gSaveContext.save.time; fileSelect->unk_24460[sp76] = gSaveContext.save.day; fileSelect->unk_24468[sp76] = gSaveContext.save.isOwlSave; - fileSelect->rupees[sp76] = gSaveContext.save.playerData.rupees; + fileSelect->rupees[sp76] = gSaveContext.save.saveInfo.playerData.rupees; fileSelect->unk_24474[sp76] = CUR_UPG_VALUE(4); for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) { - if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) { + if (gSaveContext.save.saveInfo.inventory.items[sp7A + 24] != 0xFF) { phi_a0++; } } fileSelect->maskCount[sp76] = phi_a0; fileSelect->heartPieceCount[sp76] = - ((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C); + ((gSaveContext.save.saveInfo.inventory.questItems & 0xF0000000) >> 0x1C); } if (sp6E == 1) { func_80146EBC(sramCtx, D_801C67C8[sp64], D_801C67F0[sp64]); func_80146EBC(sramCtx, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1]); } else if (!sp6E) { // TODO: == 0? - temp_s2 = gSaveContext.save.checksum; + temp_s2 = gSaveContext.save.saveInfo.checksum; if (func_80185968(sramCtx->saveBuf, D_801C67C8[sp64 + 1], D_801C67F0[sp64 + 1])) { phi_s2_3 = 1; } else { Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); - phi_s2_3 = gSaveContext.save.checksum; - gSaveContext.save.checksum = 0; - // phi_s2_3 = gSaveContext.save.checksum; + phi_s2_3 = gSaveContext.save.saveInfo.checksum; + gSaveContext.save.saveInfo.checksum = 0; + // phi_s2_3 = gSaveContext.save.saveInfo.checksum; sp7A = Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64]); } - if (CHECK_NEWF(gSaveContext.save.playerData.newf) || (phi_s2_3 != sp7A) || + if (CHECK_NEWF(gSaveContext.save.saveInfo.playerData.newf) || (phi_s2_3 != sp7A) || (phi_s2_3 != temp_s2)) { func_80185968(sramCtx->saveBuf, D_801C67C8[sp64], D_801C67F0[sp64]); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]); @@ -1444,32 +1445,33 @@ void func_80146628(FileSelectState* fileSelect2, SramContext* sramCtx) { if (gSaveContext.unk_3F3F) { if (fileSelect->unk_2446A[fileSelect->unk_2448E]) { func_80147414(sramCtx, fileSelect->unk_2448E, fileSelect->fileNum); - fileSelect->unk_24410[fileSelect->fileNum] = gSaveContext.save.playerData.deaths; + fileSelect->unk_24410[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.deaths; - for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) { - fileSelect->unk_24424[fileSelect->fileNum][i] = gSaveContext.save.playerData.playerName[i]; + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); i++) { + fileSelect->unk_24424[fileSelect->fileNum][i] = gSaveContext.save.saveInfo.playerData.playerName[i]; } - fileSelect->unk_24438[fileSelect->fileNum] = gSaveContext.save.playerData.healthCapacity; - fileSelect->unk_24440[fileSelect->fileNum] = gSaveContext.save.playerData.health; - fileSelect->unk_24456[fileSelect->fileNum] = gSaveContext.save.inventory.defenseHearts; - fileSelect->unk_2444C[fileSelect->fileNum] = gSaveContext.save.inventory.questItems; + fileSelect->unk_24438[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.healthCapacity; + fileSelect->unk_24440[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.health; + fileSelect->unk_24456[fileSelect->fileNum] = gSaveContext.save.saveInfo.inventory.defenseHearts; + fileSelect->unk_2444C[fileSelect->fileNum] = gSaveContext.save.saveInfo.inventory.questItems; fileSelect->unk_2445C[fileSelect->fileNum] = gSaveContext.save.time; fileSelect->unk_24464[fileSelect->fileNum] = gSaveContext.save.day; fileSelect->unk_2446A[fileSelect->fileNum] = gSaveContext.save.isOwlSave; - fileSelect->unk_24470[fileSelect->fileNum] = gSaveContext.save.playerData.rupees; + fileSelect->unk_24470[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.rupees; // = CUR_UPG_VALUE(UPG_WALLET); fileSelect->unk_24476[fileSelect->fileNum] = - (gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4]; + (gSaveContext.save.saveInfo.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4]; for (i = 0, maskCount = 0; i < 24; i++) { - if (gSaveContext.save.inventory.items[i + 24] != ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[i + 24] != ITEM_NONE) { maskCount++; } } fileSelect->unk_2447A[fileSelect->fileNum] = maskCount; - fileSelect->unk_2447E[fileSelect->fileNum] = (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C; + fileSelect->unk_2447E[fileSelect->fileNum] = + (gSaveContext.save.saveInfo.inventory.questItems & 0xF0000000) >> 0x1C; } // clear buffer @@ -1485,33 +1487,33 @@ void func_80146628(FileSelectState* fileSelect2, SramContext* sramCtx) { // copy buffer to save context Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save)); - fileSelect->unk_2440C[fileSelect->fileNum] = gSaveContext.save.playerData.deaths; + fileSelect->unk_2440C[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.deaths; - for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) { - fileSelect->unk_24414[fileSelect->fileNum][i] = gSaveContext.save.playerData.playerName[i]; + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); i++) { + fileSelect->unk_24414[fileSelect->fileNum][i] = gSaveContext.save.saveInfo.playerData.playerName[i]; } - fileSelect->healthCapacity[fileSelect->fileNum] = gSaveContext.save.playerData.healthCapacity; - fileSelect->health[fileSelect->fileNum] = gSaveContext.save.playerData.health; - fileSelect->unk_24454[fileSelect->fileNum] = gSaveContext.save.inventory.defenseHearts; - fileSelect->unk_24444[fileSelect->fileNum] = gSaveContext.save.inventory.questItems; + fileSelect->healthCapacity[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.healthCapacity; + fileSelect->health[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.health; + fileSelect->unk_24454[fileSelect->fileNum] = gSaveContext.save.saveInfo.inventory.defenseHearts; + fileSelect->unk_24444[fileSelect->fileNum] = gSaveContext.save.saveInfo.inventory.questItems; fileSelect->unk_24458[fileSelect->fileNum] = gSaveContext.save.time; fileSelect->unk_24460[fileSelect->fileNum] = gSaveContext.save.day; fileSelect->unk_24468[fileSelect->fileNum] = gSaveContext.save.isOwlSave; - fileSelect->rupees[fileSelect->fileNum] = gSaveContext.save.playerData.rupees; + fileSelect->rupees[fileSelect->fileNum] = gSaveContext.save.saveInfo.playerData.rupees; // = CUR_UPG_VALUE(UPG_WALLET); fileSelect->unk_24474[fileSelect->fileNum] = - (gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4]; + (gSaveContext.save.saveInfo.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4]; for (i = 0, maskCount = 0; i < 24; i++) { - if (gSaveContext.save.inventory.items[i + 24] != ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[i + 24] != ITEM_NONE) { maskCount++; } } fileSelect->maskCount[fileSelect->fileNum] = maskCount; fileSelect->heartPieceCount[fileSelect->fileNum] = - (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C; + (gSaveContext.save.saveInfo.inventory.questItems & 0xF0000000) >> 0x1C; } gSaveContext.save.time = D_801F6AF0; @@ -1533,51 +1535,52 @@ void Sram_InitSave(FileSelectState* fileSelect2, SramContext* sramCtx) { gSaveContext.save.cutscene = 0xFFF0; } - for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(gSaveContext.save.playerData.playerName); phi_v0++) { - gSaveContext.save.playerData.playerName[phi_v0] = fileSelect->unk_24414[fileSelect->unk_24480][phi_v0]; + for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); phi_v0++) { + gSaveContext.save.saveInfo.playerData.playerName[phi_v0] = + fileSelect->unk_24414[fileSelect->unk_24480][phi_v0]; } - gSaveContext.save.playerData.newf[0] = 'Z'; - gSaveContext.save.playerData.newf[1] = 'E'; - gSaveContext.save.playerData.newf[2] = 'L'; - gSaveContext.save.playerData.newf[3] = 'D'; - gSaveContext.save.playerData.newf[4] = 'A'; - gSaveContext.save.playerData.newf[5] = '3'; + gSaveContext.save.saveInfo.playerData.newf[0] = 'Z'; + gSaveContext.save.saveInfo.playerData.newf[1] = 'E'; + gSaveContext.save.saveInfo.playerData.newf[2] = 'L'; + gSaveContext.save.saveInfo.playerData.newf[3] = 'D'; + gSaveContext.save.saveInfo.playerData.newf[4] = 'A'; + gSaveContext.save.saveInfo.playerData.newf[5] = '3'; - gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext.save, sizeof(Save)); Lib_MemCpy(sramCtx->saveBuf, &gSaveContext.save, sizeof(Save)); Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save)); - for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.newf); i++) { - fileSelect->newf[fileSelect->unk_24480][i] = gSaveContext.save.playerData.newf[i]; + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.newf); i++) { + fileSelect->newf[fileSelect->unk_24480][i] = gSaveContext.save.saveInfo.playerData.newf[i]; } - fileSelect->unk_2440C[fileSelect->unk_24480] = gSaveContext.save.playerData.deaths; + fileSelect->unk_2440C[fileSelect->unk_24480] = gSaveContext.save.saveInfo.playerData.deaths; - for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) { - fileSelect->unk_24414[fileSelect->unk_24480][i] = gSaveContext.save.playerData.playerName[i]; + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); i++) { + fileSelect->unk_24414[fileSelect->unk_24480][i] = gSaveContext.save.saveInfo.playerData.playerName[i]; } - fileSelect->healthCapacity[fileSelect->unk_24480] = gSaveContext.save.playerData.healthCapacity; - fileSelect->health[fileSelect->unk_24480] = gSaveContext.save.playerData.health; - fileSelect->unk_24454[fileSelect->unk_24480] = gSaveContext.save.inventory.defenseHearts; - fileSelect->unk_24444[fileSelect->unk_24480] = gSaveContext.save.inventory.questItems; + fileSelect->healthCapacity[fileSelect->unk_24480] = gSaveContext.save.saveInfo.playerData.healthCapacity; + fileSelect->health[fileSelect->unk_24480] = gSaveContext.save.saveInfo.playerData.health; + fileSelect->unk_24454[fileSelect->unk_24480] = gSaveContext.save.saveInfo.inventory.defenseHearts; + fileSelect->unk_24444[fileSelect->unk_24480] = gSaveContext.save.saveInfo.inventory.questItems; fileSelect->unk_24458[fileSelect->unk_24480] = gSaveContext.save.time; fileSelect->unk_24460[fileSelect->unk_24480] = gSaveContext.save.day; fileSelect->unk_24468[fileSelect->unk_24480] = gSaveContext.save.isOwlSave; - fileSelect->rupees[fileSelect->unk_24480] = gSaveContext.save.playerData.rupees; + fileSelect->rupees[fileSelect->unk_24480] = gSaveContext.save.saveInfo.playerData.rupees; fileSelect->unk_24474[fileSelect->unk_24480] = CUR_UPG_VALUE(UPG_WALLET); for (i = 0, maskCount = 0; i < 24; i++) { - if (gSaveContext.save.inventory.items[i + 24] != ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[i + 24] != ITEM_NONE) { maskCount++; } } fileSelect->maskCount[fileSelect->unk_24480] = maskCount; fileSelect->heartPieceCount[fileSelect->unk_24480] = - (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C; + (gSaveContext.save.saveInfo.inventory.questItems & 0xF0000000) >> 0x1C; } gSaveContext.save.time = D_801F6AF0; @@ -1714,7 +1717,7 @@ void func_80147198(SramContext* sramCtx) { sramCtx->status = 0; bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); gSaveContext.save.isOwlSave = false; - gSaveContext.save.checksum = 0; + gSaveContext.save.saveInfo.checksum = 0; // flash read to buffer then copy to save context func_80185968(sramCtx->saveBuf, sramCtx->curPage, sramCtx->numPages); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, offsetof(SaveContext, fileNum)); @@ -1726,15 +1729,15 @@ void func_80147314(SramContext* sramCtx, s32 fileNum) { gSaveContext.save.isOwlSave = false; - gSaveContext.save.playerData.newf[0] = '\0'; - gSaveContext.save.playerData.newf[1] = '\0'; - gSaveContext.save.playerData.newf[2] = '\0'; - gSaveContext.save.playerData.newf[3] = '\0'; - gSaveContext.save.playerData.newf[4] = '\0'; - gSaveContext.save.playerData.newf[5] = '\0'; + gSaveContext.save.saveInfo.playerData.newf[0] = '\0'; + gSaveContext.save.saveInfo.playerData.newf[1] = '\0'; + gSaveContext.save.saveInfo.playerData.newf[2] = '\0'; + gSaveContext.save.saveInfo.playerData.newf[3] = '\0'; + gSaveContext.save.saveInfo.playerData.newf[4] = '\0'; + gSaveContext.save.saveInfo.playerData.newf[5] = '\0'; - gSaveContext.save.checksum = 0; - gSaveContext.save.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum)); + gSaveContext.save.saveInfo.checksum = 0; + gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, offsetof(SaveContext, fileNum)); Lib_MemCpy(sramCtx->saveBuf, &gSaveContext, offsetof(SaveContext, fileNum)); func_80146EBC(sramCtx, D_801C6840[fileNum * 2], D_801C6850[fileNum * 2]); @@ -1742,12 +1745,12 @@ void func_80147314(SramContext* sramCtx, s32 fileNum) { gSaveContext.save.isOwlSave = true; - gSaveContext.save.playerData.newf[0] = 'Z'; - gSaveContext.save.playerData.newf[1] = 'E'; - gSaveContext.save.playerData.newf[2] = 'L'; - gSaveContext.save.playerData.newf[3] = 'D'; - gSaveContext.save.playerData.newf[4] = 'A'; - gSaveContext.save.playerData.newf[5] = '3'; + gSaveContext.save.saveInfo.playerData.newf[0] = 'Z'; + gSaveContext.save.saveInfo.playerData.newf[1] = 'E'; + gSaveContext.save.saveInfo.playerData.newf[2] = 'L'; + gSaveContext.save.saveInfo.playerData.newf[3] = 'D'; + gSaveContext.save.saveInfo.playerData.newf[4] = 'A'; + gSaveContext.save.saveInfo.playerData.newf[5] = '3'; } void func_80147414(SramContext* sramCtx, s32 fileNum, s32 arg2) { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index dfb22deee..1550711e1 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -187,7 +187,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { hitMask = BgKin2Fence_CheckHitMask(this); if (hitMask >= 0) { - nextMask = (s8)gSaveContext.save.spiderHouseMaskOrder[this->masksHit]; + nextMask = (s8)gSaveContext.save.saveInfo.spiderHouseMaskOrder[this->masksHit]; if (hitMask == nextMask) { play_sound(NA_SE_SY_TRE_BOX_APPEAR); this->masksHit += 1; diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index 56c02526b..f1759b7fb 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -83,7 +83,7 @@ void DmChar02_PlaySfxForCutscenes(DmChar02* this, PlayState* play) { void DmChar02_Init(Actor* thisx, PlayState* play) { DmChar02* this = THIS; - if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->animIndex = DMCHAR02_ANIM_HIT_GROUND; this->actor.targetArrowOffset = 3000.0f; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 83bdfe71a..f8210a9de 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -1052,7 +1052,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { R_MOON_CRASH_TIMER_X = 115; } - if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { sCylinderInit.base.colType = COLTYPE_WOOD; this->actionFunc = DmStk_ClockTower_StartIntroCutsceneVersion1; } else { @@ -1402,7 +1402,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { case 22: this->animIndex = SK_ANIM_PLAY_OCARINA_WHILE_FLOATING; - if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; @@ -1414,7 +1414,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { case 24: this->animIndex = SK_ANIM_CALL_DOWN_MOON_START; - if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; @@ -1425,14 +1425,14 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { case 26: this->animIndex = SK_ANIM_SMACK_FAIRY_START; - if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; case 27: this->animIndex = SK_ANIM_HIT_BY_BUBBLE; - if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { this->handType = SK_HAND_TYPE_HOLDING_OCARINA; } break; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 8a9d26a4d..a0eefb83a 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -345,7 +345,7 @@ void func_808A1090(DoorShutter* this, PlayState* play) { if (this->unk_166 != 0) { Flags_SetSwitch(play, DOORSHUTTER_GET_7F(&this->actor)); if (this->doorType != 5) { - gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; + gSaveContext.save.saveInfo.inventory.dungeonKeys[gSaveContext.mapIndex]--; Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIN_KEY_UNLOCK_B); @@ -368,7 +368,7 @@ void func_808A1090(DoorShutter* this, PlayState* play) { } if (this->doorType == 6) { - if (gSaveContext.save.playerData.healthCapacity < (DOORSHUTTER_GET_1F(&this->actor) * 0x10)) { + if (gSaveContext.save.saveInfo.playerData.healthCapacity < (DOORSHUTTER_GET_1F(&this->actor) * 0x10)) { player->doorType = PLAYER_DOORTYPE_TALKING; this->actor.textId = 0x14FC; } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 01df27715..d942903a1 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -554,28 +554,28 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { switch (play->sceneId) { case SCENE_MITURIN_BS: - gSaveContext.save.unk_ECC[0] = - (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFFFFFF00) | (((u8)gSaveContext.save.unk_ECC[1]) & 0xFF); + gSaveContext.save.saveInfo.unk_EA8[0] = (((void)0, gSaveContext.save.saveInfo.unk_EA8[0]) & 0xFFFFFF00) | + (((u8)gSaveContext.save.saveInfo.unk_EA8[1]) & 0xFF); break; case SCENE_HAKUGIN_BS: - gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFFFF00FF) | - ((((u8)gSaveContext.save.unk_ECC[1]) & 0xFF) << 8); + gSaveContext.save.saveInfo.unk_EA8[0] = (((void)0, gSaveContext.save.saveInfo.unk_EA8[0]) & 0xFFFF00FF) | + ((((u8)gSaveContext.save.saveInfo.unk_EA8[1]) & 0xFF) << 8); break; case SCENE_INISIE_BS: - gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFF00FFFF) | - ((((u8)gSaveContext.save.unk_ECC[1]) & 0xFF) << 0x10); + gSaveContext.save.saveInfo.unk_EA8[0] = (((void)0, gSaveContext.save.saveInfo.unk_EA8[0]) & 0xFF00FFFF) | + ((((u8)gSaveContext.save.saveInfo.unk_EA8[1]) & 0xFF) << 0x10); break; case SCENE_SEA_BS: - gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0x00FFFFFF) | - ((((u8)gSaveContext.save.unk_ECC[1]) & 0xFF) << 0x18); + gSaveContext.save.saveInfo.unk_EA8[0] = (((void)0, gSaveContext.save.saveInfo.unk_EA8[0]) & 0x00FFFFFF) | + ((((u8)gSaveContext.save.saveInfo.unk_EA8[1]) & 0xFF) << 0x18); break; } - gSaveContext.save.unk_ECC[1] = - (gSaveContext.save.unk_ECC[1] & 0xFFFFFF00) | ((((u8)gSaveContext.save.unk_ECC[1]) + 1) & 0xFF); + gSaveContext.save.saveInfo.unk_EA8[1] = (gSaveContext.save.saveInfo.unk_EA8[1] & 0xFFFFFF00) | + ((((u8)gSaveContext.save.saveInfo.unk_EA8[1]) + 1) & 0xFF); Item_Give(play, func_808B849C(this, play) + (ITEM_REMAINS_ODOLWA - 1)); DoorWarp1_SetupAction(this, func_808B9E94); } @@ -658,19 +658,19 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { switch (phi_v0_2) { case 0: - phi_a0 = gSaveContext.save.unk_ECC[0] & 0xFF; + phi_a0 = gSaveContext.save.saveInfo.unk_EA8[0] & 0xFF; break; case 1: - phi_a0 = (gSaveContext.save.unk_ECC[0] & 0xFF00) >> 8; + phi_a0 = (gSaveContext.save.saveInfo.unk_EA8[0] & 0xFF00) >> 8; break; case 2: - phi_a0 = (gSaveContext.save.unk_ECC[0] & 0xFF0000) >> 0x10; + phi_a0 = (gSaveContext.save.saveInfo.unk_EA8[0] & 0xFF0000) >> 0x10; break; case 3: - phi_a0 = (gSaveContext.save.unk_ECC[0] & 0xFF000000) >> 0x18; + phi_a0 = (gSaveContext.save.saveInfo.unk_EA8[0] & 0xFF000000) >> 0x18; break; default: diff --git a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c index 1507da5e2..d05c099e9 100644 --- a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c +++ b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c @@ -162,7 +162,7 @@ void ElfMsg6_Init(Actor* thisx, PlayState* play) { switch (ELFMSG6_GET_F0(&this->actor)) { case 0: - if (gSaveContext.save.inventory.items[ITEM_HOOKSHOT] != ITEM_HOOKSHOT) { + if (gSaveContext.save.saveInfo.inventory.items[ITEM_HOOKSHOT] != ITEM_HOOKSHOT) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 87f39a510..99779f20b 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -300,7 +300,7 @@ s32 func_80BED208(EnAkindonuts* this) { return 0; } - if (gSaveContext.save.playerData.rupees < 10) { + if (gSaveContext.save.saveInfo.playerData.rupees < 10) { return 1; } @@ -322,7 +322,7 @@ s32 func_80BED27C(EnAkindonuts* this) { return 0; } - if (gSaveContext.save.playerData.rupees < 200) { + if (gSaveContext.save.saveInfo.playerData.rupees < 200) { return 1; } @@ -336,7 +336,7 @@ s32 func_80BED2FC(EnAkindonuts* this) { return 2; } - if (gSaveContext.save.playerData.rupees < 40) { + if (gSaveContext.save.saveInfo.playerData.rupees < 40) { return 1; } @@ -350,7 +350,7 @@ s32 func_80BED35C(EnAkindonuts* this) { return 2; } - if (gSaveContext.save.playerData.rupees < 100) { + if (gSaveContext.save.saveInfo.playerData.rupees < 100) { return 1; } diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 97bc517c9..0f66d5cf4 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -305,7 +305,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { break; case PLAYER_FORM_HUMAN: - if (gSaveContext.save.playerData.rupees < 10) { + if (gSaveContext.save.saveInfo.playerData.rupees < 10) { this->unk_210 = 0x3524; this->unk_2D2 |= 0x10; } else { @@ -369,7 +369,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { break; case 0x3528: - if (gSaveContext.save.playerData.rupees < this->unk_434) { + if (gSaveContext.save.saveInfo.playerData.rupees < this->unk_434) { this->unk_210 = 0x3536; this->unk_2D2 |= 0x40; this->unk_43C = 1; @@ -434,7 +434,7 @@ void func_809C1D64(EnAob01* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.playerData.rupees < 10) { + if (gSaveContext.save.saveInfo.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); this->unk_210 = 0x3524; Message_StartTextbox(play, this->unk_210, &this->actor); @@ -904,7 +904,7 @@ void func_809C2FA0(void) { } for (i = 0; i < ARRAY_COUNT(sp44); i++) { - gSaveContext.save.weekEventReg[42 + i] = 0; + gSaveContext.save.saveInfo.weekEventReg[42 + i] = 0; sp44[i] = 0; } @@ -914,8 +914,8 @@ void func_809C2FA0(void) { if (i % 2) { sp44[index] |= orig2 << 0x4; - gSaveContext.save.weekEventReg[42 + index] = - ((void)0, gSaveContext.save.weekEventReg[42 + index]) | sp44[index]; + gSaveContext.save.saveInfo.weekEventReg[42 + index] = + ((void)0, gSaveContext.save.saveInfo.weekEventReg[42 + index]) | sp44[index]; } else { sp44[index] |= orig2; } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 5eed1b1d5..47df4b75b 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -1614,7 +1614,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) { if (this->numGekkoMeleeAttacks == 0) { this->numGekkoPosGrabPlayer--; - if ((gSaveContext.save.playerData.health < 5) || (this->numGekkoPosGrabPlayer == 0)) { + if ((gSaveContext.save.saveInfo.playerData.health < 5) || (this->numGekkoPosGrabPlayer == 0)) { this->numGekkoPosGrabPlayer = 0; this->gekkoRot.y = this->actor.world.rot.y; this->gekkoPosOffset.x = Math_SinS(this->gekkoRot.y) * -50.0f; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 7217dbc65..6b54c387c 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -173,9 +173,9 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { func_809C4B50(this); func_809C493C(this, 0, 1.0f); - for (i = 0; i < ARRAY_COUNT(gSaveContext.save.bomberCode); i++) { + for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.bomberCode); i++) { Math_Vec3f_Copy(&sp7C, &this->actor.home.pos); - code = gSaveContext.save.bomberCode[i]; + code = gSaveContext.save.saveInfo.bomberCode[i]; if (code == 1) { Math_Vec3f_Copy(&this->actor.world.pos, &D_809C61A0[i]); this->unk_2D8[code] = this; diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index 0c3bdf745..9591fbbb9 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -220,7 +220,8 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { s32 correctDigits; for (i = 0; i < ARRAY_COUNT(this->correctDigitSlots); i++) { - if (!(this->correctDigitSlots[i]) && (play->msgCtx.unk12054[i] == gSaveContext.save.bomberCode[i])) { + if (!(this->correctDigitSlots[i]) && + (play->msgCtx.unk12054[i] == gSaveContext.save.saveInfo.bomberCode[i])) { this->correctDigitSlots[i] = true; } } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 611c6144b..a1a1b0a32 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -720,12 +720,12 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_08); CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_10); - gSaveContext.save.bombersCaughtNum = 0; - gSaveContext.save.bombersCaughtOrder[0] = 0; - gSaveContext.save.bombersCaughtOrder[1] = 0; - gSaveContext.save.bombersCaughtOrder[2] = 0; - gSaveContext.save.bombersCaughtOrder[3] = 0; - gSaveContext.save.bombersCaughtOrder[4] = 0; + gSaveContext.save.saveInfo.bombersCaughtNum = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[0] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[1] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[2] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[3] = 0; + gSaveContext.save.saveInfo.bombersCaughtOrder[4] = 0; func_80BFE494(this, 3, 1.0f); this->unk_2C8 = 9; diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index fc11e86c1..7cc78d9cf 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -686,11 +686,12 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { return; } - Message_StartTextbox(play, D_80C03230[((void)0, gSaveContext.save.bombersCaughtNum)], &this->actor); - gSaveContext.save.bombersCaughtOrder[((void)0, gSaveContext.save.bombersCaughtNum)] = this->unk_2C8 + 1; - gSaveContext.save.bombersCaughtNum++; + Message_StartTextbox(play, D_80C03230[((void)0, gSaveContext.save.saveInfo.bombersCaughtNum)], &this->actor); + gSaveContext.save.saveInfo.bombersCaughtOrder[((void)0, gSaveContext.save.saveInfo.bombersCaughtNum)] = + this->unk_2C8 + 1; + gSaveContext.save.saveInfo.bombersCaughtNum++; - if (gSaveContext.save.bombersCaughtNum > 4) { + if (gSaveContext.save.saveInfo.bombersCaughtNum > 4) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { Actor_PlaySfx(&this->actor, NA_SE_SY_PIECE_OF_HEART); @@ -761,7 +762,7 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - if ((this->unk_2CA == 8) && (gSaveContext.save.bombersCaughtNum >= 5)) { + if ((this->unk_2CA == 8) && (gSaveContext.save.saveInfo.bombersCaughtNum >= 5)) { func_80C02CA4(this, play); } else { if (this->unk_2CA == 8) { diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index a173834c7..360cf2c49 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -426,10 +426,10 @@ void EnDg_UpdateTextId(EnDg* this) { // the range of 0x3538 to 0x3545. if (this->index % 2) { sRacetrackDogInfo[this->index].textId = - 0x3538 + ((gSaveContext.save.weekEventReg[42 + (this->index / 2)] & 0xF0) >> 4); + 0x3538 + ((gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)] & 0xF0) >> 4); } else { sRacetrackDogInfo[this->index].textId = - 0x3538 + (gSaveContext.save.weekEventReg[42 + (this->index / 2)] & 0x0F); + 0x3538 + (gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)] & 0x0F); } } else { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 478f071b3..aa9d9c89a 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -476,7 +476,7 @@ void func_80866B20(EnDoor* this, PlayState* play) { Animation_PlayOnceSetSpeed(&this->skelAnime, sAnimations[this->animIndex], (player->stateFlags1 & PLAYER_STATE1_8000000) ? 0.75f : 1.5f); if (this->unk_1A6 != 0) { - gSaveContext.save.inventory.dungeonKeys[gSaveContext.mapIndex]--; + gSaveContext.save.saveInfo.inventory.dungeonKeys[gSaveContext.mapIndex]--; Flags_SetSwitch(play, this->switchFlag); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } @@ -499,7 +499,7 @@ void func_80866B20(EnDoor* this, PlayState* play) { player->doorDirection = playerPosRelToDoor.z >= 0.0f ? 1.0f : -1.0f; player->doorActor = &this->dyna.actor; if (this->unk_1A6 != 0) { - if (gSaveContext.save.inventory.dungeonKeys[((void)0, gSaveContext.mapIndex)] <= 0) { + if (gSaveContext.save.saveInfo.inventory.dungeonKeys[((void)0, gSaveContext.mapIndex)] <= 0) { player->doorType = PLAYER_DOORTYPE_TALKING; this->dyna.actor.textId = 0x1802; } else { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index fd800c27f..751c24aab 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -355,8 +355,9 @@ void EnElf_Init(Actor* thisx, PlayState* play2) { this->elfMsg = NULL; this->unk_234 = NULL; this->unk_269 = 20; - if ((gSaveContext.save.playerData.tatlTimer >= 25800) || (gSaveContext.save.playerData.tatlTimer < 3000)) { - gSaveContext.save.playerData.tatlTimer = 0; + if ((gSaveContext.save.saveInfo.playerData.tatlTimer >= 25800) || + (gSaveContext.save.saveInfo.playerData.tatlTimer < 3000)) { + gSaveContext.save.saveInfo.playerData.tatlTimer = 0; } this->unk_266 = QuestHint_GetTatlTextId(play); break; @@ -1455,11 +1456,12 @@ void func_8089010C(Actor* thisx, PlayState* play) { if (temp_v0 != this->unk_266) { this->unk_266 = temp_v0; - gSaveContext.save.playerData.tatlTimer = 0; + gSaveContext.save.saveInfo.playerData.tatlTimer = 0; } if ((player->tatlTextId == 0) && (player->targetedActor == NULL)) { - if ((gSaveContext.save.playerData.tatlTimer >= 600) && (gSaveContext.save.playerData.tatlTimer <= 3000)) { + if ((gSaveContext.save.saveInfo.playerData.tatlTimer >= 600) && + (gSaveContext.save.saveInfo.playerData.tatlTimer <= 3000)) { player->tatlTextId = QuestHint_GetTatlTextId(play); } } @@ -1474,7 +1476,7 @@ void func_8089010C(Actor* thisx, PlayState* play) { if (thisx->textId == QuestHint_GetTatlTextId(play)) { this->fairyFlags |= 0x80; - gSaveContext.save.playerData.tatlTimer = 3001; + gSaveContext.save.saveInfo.playerData.tatlTimer = 3001; } this->fairyFlags |= 0x10; @@ -1505,10 +1507,10 @@ void func_8089010C(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (!Play_InCsMode(play)) { - if (gSaveContext.save.playerData.tatlTimer < 25800) { - gSaveContext.save.playerData.tatlTimer++; + if (gSaveContext.save.saveInfo.playerData.tatlTimer < 25800) { + gSaveContext.save.saveInfo.playerData.tatlTimer++; } else if (!(this->fairyFlags & 0x80)) { - gSaveContext.save.playerData.tatlTimer = 0; + gSaveContext.save.saveInfo.playerData.tatlTimer = 0; } } } diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index 2189bba99..7f6067d9c 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -101,13 +101,13 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) { break; case ENELFGRP_2: - if (gSaveContext.save.playerData.isDoubleMagicAcquired == true) { + if (gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired == true) { func_80A396B0(this, 1); } break; case ENELFGRP_3: - if (gSaveContext.save.playerData.doubleDefense) { + if (gSaveContext.save.saveInfo.playerData.doubleDefense) { func_80A396B0(this, 1); } break; @@ -125,7 +125,7 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) { this->actor.textId = (this->unk_147 * 3) + 0x581; } else { this->actionFunc = func_80A3A8F8; - if ((gSaveContext.save.weekEventReg[9] & this->unk_146)) { + if ((gSaveContext.save.saveInfo.weekEventReg[9] & this->unk_146)) { this->actor.textId = (this->unk_147 * 3) + 0x580; } else { this->actor.textId = (this->unk_147 * 3) + 0x57F; @@ -158,13 +158,13 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) { func_80A396B0(this, 3); this->unk_14A |= 2; } - } else if (gSaveContext.save.playerData.isMagicAcquired == true) { + } else if (gSaveContext.save.saveInfo.playerData.isMagicAcquired == true) { func_80A396B0(this, 1); } } else { func_80A39DC8(this, play, 24, 0); this->actionFunc = func_80A3A8F8; - if ((gSaveContext.save.weekEventReg[9] & this->unk_146)) { + if ((gSaveContext.save.saveInfo.weekEventReg[9] & this->unk_146)) { this->actor.textId = 0x580; } else { this->actor.textId = 0x578; @@ -183,7 +183,7 @@ s32 func_80A39BD0(PlayState* play, s32 arg2) { return 0; } - return (((void)0, gSaveContext.save.inventory.strayFairies[arg2 - 1]) - func_80A39C1C(play, arg2)) + 10; + return (((void)0, gSaveContext.save.saveInfo.inventory.strayFairies[arg2 - 1]) - func_80A39C1C(play, arg2)) + 10; } s32 func_80A39C1C(PlayState* play, s32 arg1) { @@ -207,13 +207,13 @@ s32 func_80A39C1C(PlayState* play, s32 arg1) { } if (arg1 == 0) { - if (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1) { + if (gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 1) { return 25; } return 24; } - temp_v1 = (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; + temp_v1 = (gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; if (temp_v1 < 10) { temp_v1 = 10; } else if (temp_v1 > 25) { @@ -229,13 +229,13 @@ void func_80A39CD4(PlayState* play, s32 arg1, s32 arg2) { if (arg1 == 0) { if (arg2 == 25) { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 1; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= 1; } else { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~1; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~1; } } else { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= arg2 << ((arg1 * 5) - 4); + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= arg2 << ((arg1 * 5) - 4); } } @@ -524,7 +524,7 @@ void func_80A3A7FC(EnElfgrp* this, PlayState* play) { s32 temp_s0; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - gSaveContext.save.weekEventReg[9] |= this->unk_146; + gSaveContext.save.saveInfo.weekEventReg[9] |= this->unk_146; this->actionFunc = func_80A3A6F4; temp_s0 = func_80A39BD0(play, this->unk_147); func_80A39DC8(this, play, temp_s0, 1); @@ -544,7 +544,7 @@ void func_80A3A8F8(EnElfgrp* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - gSaveContext.save.weekEventReg[9] |= this->unk_146; + gSaveContext.save.saveInfo.weekEventReg[9] |= this->unk_146; this->actionFunc = func_80A3A6F4; return; } @@ -563,7 +563,7 @@ void func_80A3A8F8(EnElfgrp* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20000000; Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_80A3A77C; - gSaveContext.save.weekEventReg[9] |= this->unk_146; + gSaveContext.save.saveInfo.weekEventReg[9] |= this->unk_146; } else { this->actor.flags |= ACTOR_FLAG_10000; func_800B8614(&this->actor, play, 100.0f); diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 28b086fbb..542d739e6 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -490,10 +490,10 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { } if (Map_IsInDungeonOrBossArea(play)) { - gSaveContext.save.inventory.strayFairies[gSaveContext.dungeonIndex]++; + gSaveContext.save.saveInfo.inventory.strayFairies[gSaveContext.dungeonIndex]++; // You found a Stray Fairy! Message_StartTextbox(play, 0x11, NULL); - if (gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= 15) { + if (gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= 15) { Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } } diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index e91632700..4bbd4b5cc 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -835,7 +835,7 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { if (sLinkAge != 1) { // HIGH_SCORE(HS_FISHING) from OoT - if (gSaveContext.save.unk_EE4 & 0x1000) { + if (gSaveContext.save.saveInfo.unk_EC0 & 0x1000) { D_8090CD08 = 0; } else { D_8090CD08 = 1; @@ -853,18 +853,18 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); if (sLinkAge == 1) { - if (gSaveContext.save.unk_EE4 & 0x7F) { - D_809171CC = gSaveContext.save.unk_EE4 & 0x7F; + if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F) { + D_809171CC = gSaveContext.save.saveInfo.unk_EC0 & 0x7F; } else { D_809171CC = 40.0f; } - } else if (gSaveContext.save.unk_EE4 & 0x7F000000) { - D_809171CC = (gSaveContext.save.unk_EE4 & 0x7F000000) >> 0x18; + } else if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) { + D_809171CC = (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) >> 0x18; } else { D_809171CC = 45.0f; } - D_809171D1 = (gSaveContext.save.unk_EE4 & 0xFF0000) >> 0x10; + D_809171D1 = (gSaveContext.save.saveInfo.unk_EC0 & 0xFF0000) >> 0x10; if ((D_809171D1 & 7) == 7) { play->roomCtx.unk7A[0] = 90; D_809171CA = 1; @@ -2795,8 +2795,8 @@ void func_80903C60(EnFishing* this, u8 arg1) { void EnFishing_HandleAquariumDialog(EnFishing* this, PlayState* play) { if (sLinkAge == 1) { - if (gSaveContext.save.unk_EE4 & 0x7F) { - if (gSaveContext.save.unk_EE4 & 0x80) { + if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F) { + if (gSaveContext.save.saveInfo.unk_EC0 & 0x80) { this->actor.textId = 0x40B1; } else { this->actor.textId = 0x4089; @@ -2804,8 +2804,8 @@ void EnFishing_HandleAquariumDialog(EnFishing* this, PlayState* play) { } else { this->actor.textId = 0x40AE; } - } else if (gSaveContext.save.unk_EE4 & 0x7F000000) { - if (gSaveContext.save.unk_EE4 & 0x80000000) { + } else if (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) { + if (gSaveContext.save.saveInfo.unk_EC0 & 0x80000000) { this->actor.textId = 0x40B1; } else { this->actor.textId = 0x4089; @@ -3745,8 +3745,8 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((D_80917272 == 0) && (D_80917274 == 0)) { // Assignment of OoT's D_80B7E086 here removed in MM - if (((sLinkAge == 1) && (gSaveContext.save.unk_EE4 & 0x400)) || - ((sLinkAge != 1) && (gSaveContext.save.unk_EE4 & 0x800))) { + if (((sLinkAge == 1) && (gSaveContext.save.saveInfo.unk_EC0 & 0x400)) || + ((sLinkAge != 1) && (gSaveContext.save.saveInfo.unk_EC0 & 0x800))) { // Assignment of OoT's D_80B7A67C here removed in MM, this is now an empty branch } } else { @@ -4685,7 +4685,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 0: if (D_809171FC == 0) { if (sLinkAge != 1) { - if ((gSaveContext.save.unk_EE4 & 0x100) && !(gSaveContext.save.unk_EE4 & 0x200)) { + if ((gSaveContext.save.saveInfo.unk_EC0 & 0x100) && !(gSaveContext.save.saveInfo.unk_EC0 & 0x200)) { this->actor.textId = 0x4093; } else { this->actor.textId = 0x407B; @@ -4703,9 +4703,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { if (D_809171FC == 0) { this->unk_154 = 1; if (sLinkAge != 1) { - gSaveContext.save.unk_EE4 |= 0x200; + gSaveContext.save.saveInfo.unk_EC0 |= 0x200; } else { - gSaveContext.save.unk_EE4 |= 0x100; + gSaveContext.save.saveInfo.unk_EC0 |= 0x100; } } else { this->unk_154 = 10; @@ -4721,7 +4721,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.playerData.rupees >= 20) { + if (gSaveContext.save.saveInfo.playerData.rupees >= 20) { Rupees_ChangeBy(-20); if (!Rumble_ControllerOneHasRumblePak()) { this->actor.textId = 0x407C; @@ -4788,8 +4788,8 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { D_8090CD04 = 20; this->unk_154 = 0; - if ((gSaveContext.save.unk_EE4 & 0xFF0000) < 0xFF0000) { - gSaveContext.save.unk_EE4 += 0x10000; + if ((gSaveContext.save.saveInfo.unk_EC0 & 0xFF0000) < 0xFF0000) { + gSaveContext.save.saveInfo.unk_EC0 += 0x10000; } } break; @@ -4898,29 +4898,29 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { if (sLinkAge == 1) { f32 temp; - gSaveContext.save.unk_EE4 &= 0xFFFFFF00; - gSaveContext.save.unk_EE4 |= ((s16)D_809171CC & 0x7F); - temp = (gSaveContext.save.unk_EE4 & 0x7F000000) >> 0x18; + gSaveContext.save.saveInfo.unk_EC0 &= 0xFFFFFF00; + gSaveContext.save.saveInfo.unk_EC0 |= ((s16)D_809171CC & 0x7F); + temp = (gSaveContext.save.saveInfo.unk_EC0 & 0x7F000000) >> 0x18; if (temp < D_809171CC) { - gSaveContext.save.unk_EE4 &= 0xFFFFFF; - gSaveContext.save.unk_EE4 |= ((s16)D_809171CC & 0x7F) << 0x18; + gSaveContext.save.saveInfo.unk_EC0 &= 0xFFFFFF; + gSaveContext.save.saveInfo.unk_EC0 |= ((s16)D_809171CC & 0x7F) << 0x18; if (D_809171D2 == 2) { - gSaveContext.save.unk_EE4 |= 0x80000000; + gSaveContext.save.saveInfo.unk_EC0 |= 0x80000000; } } if (D_809171D2 == 2) { - gSaveContext.save.unk_EE4 |= 0x80; + gSaveContext.save.saveInfo.unk_EC0 |= 0x80; this->unk_154 = 0; break; } } else { - gSaveContext.save.unk_EE4 &= 0xFFFFFF; - gSaveContext.save.unk_EE4 |= ((s16)D_809171CC & 0x7F) << 0x18; + gSaveContext.save.saveInfo.unk_EC0 &= 0xFFFFFF; + gSaveContext.save.saveInfo.unk_EC0 |= ((s16)D_809171CC & 0x7F) << 0x18; if (D_809171D2 == 2) { - gSaveContext.save.unk_EE4 |= 0x80000000; + gSaveContext.save.saveInfo.unk_EC0 |= 0x80000000; this->unk_154 = 0; break; } @@ -4937,14 +4937,14 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } if (sLinkAge == 1) { - if ((D_809171CC >= 50.0f) && !(gSaveContext.save.unk_EE4 & 0x400)) { - gSaveContext.save.unk_EE4 |= 0x400; + if ((D_809171CC >= 50.0f) && !(gSaveContext.save.saveInfo.unk_EC0 & 0x400)) { + gSaveContext.save.saveInfo.unk_EC0 |= 0x400; getItemId = GI_HEART_PIECE; sSinkingLureLocation = Rand_ZeroFloat(3.999f) + 1.0f; } } else { - if ((D_809171CC >= 60.0f) && !(gSaveContext.save.unk_EE4 & 0x800)) { - gSaveContext.save.unk_EE4 |= 0x800; + if ((D_809171CC >= 60.0f) && !(gSaveContext.save.saveInfo.unk_EC0 & 0x800)) { + gSaveContext.save.saveInfo.unk_EC0 |= 0x800; getItemId = GI_SKULL_TOKEN; sSinkingLureLocation = Rand_ZeroFloat(3.999f) + 1.0f; } @@ -5107,9 +5107,9 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { } if (D_8090CD08 == 0) { - gSaveContext.save.unk_EE4 |= 0x1000; + gSaveContext.save.saveInfo.unk_EC0 |= 0x1000; } else if (D_8090CD08 == 1) { - gSaveContext.save.unk_EE4 &= ~0x1000; + gSaveContext.save.saveInfo.unk_EC0 &= ~0x1000; } if (D_8090CCFC != 0) { diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 6febd3dca..2626d1cbd 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -429,7 +429,7 @@ void func_80962588(EnFu* this, PlayState* play) { if (Message_ShouldAdvance(play) && (this->unk_552 == 0x2871)) { if (1) {} if (play->msgCtx.choiceIndex == 0) { - if (gSaveContext.save.playerData.rupees >= 10) { + if (gSaveContext.save.saveInfo.playerData.rupees >= 10) { func_8019F208(); Rupees_ChangeBy(-10); func_80963DE4(this, play); @@ -652,7 +652,7 @@ void func_80962A10(EnFu* this, PlayState* play) { this->unk_546 = 1; } - if ((gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && gSaveContext.save.playerData.isMagicAcquired) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_DEKU) && gSaveContext.save.saveInfo.playerData.isMagicAcquired) { Magic_Add(play, MAGIC_FILL_TO_CAPACITY); } @@ -1139,7 +1139,7 @@ void func_80963DE4(EnFu* this, PlayState* play) { } void func_80963EAC(EnFu* this, PlayState* play) { - if (gSaveContext.save.playerData.isMagicAcquired) { + if (gSaveContext.save.saveInfo.playerData.isMagicAcquired) { if (this->unk_540 == 1) { Message_StartTextbox(play, 0x2847, &this->actor); this->unk_552 = 0x2847; diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 3d75c729c..0575494c8 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -163,7 +163,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14E4; } - if (gSaveContext.save.playerData.health > 48) { + if (gSaveContext.save.saveInfo.playerData.health > 48) { return 0x14D2; } @@ -171,7 +171,7 @@ u16 func_80B0F7FC(EnGb2* this) { return 0x14D3; case 0x14E4: - if (gSaveContext.save.playerData.health > 48) { + if (gSaveContext.save.saveInfo.playerData.health > 48) { return 0x14D2; } @@ -407,7 +407,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { if (this->unk_26E == 0x14D5) { switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.playerData.rupees < this->unk_288) { + if (gSaveContext.save.saveInfo.playerData.rupees < this->unk_288) { play_sound(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; @@ -505,7 +505,7 @@ void func_80B10344(EnGb2* this, PlayState* play) { } } - if (gSaveContext.save.playerData.health < 49) { + if (gSaveContext.save.saveInfo.playerData.health < 49) { gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; SET_EVENTINF(EVENTINF_46); SET_EVENTINF(EVENTINF_45); @@ -575,7 +575,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { } else if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.playerData.rupees < this->unk_288) { + if (gSaveContext.save.saveInfo.playerData.rupees < this->unk_288) { play_sound(NA_SE_SY_ERROR); this->unk_26E = 0x14D7; this->unk_26C |= 2; diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index 350ce734c..fba0c1118 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -89,7 +89,7 @@ void EnGinkoMan_Idle(EnGinkoMan* this, PlayState* play) { EnGinkoMan_SwitchAnimation(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x44C, &this->actor); this->curTextId = 0x44C; // would you like to make an account @@ -153,7 +153,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); } - play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; + play->msgCtx.bankRupees = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; Message_StartTextbox(play, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" } @@ -164,22 +164,22 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { this->curTextId = 0x44E; //" ...So, what'll it be? Deposit Rupees Don't deposit Rupees" break; case 0x45A: // "All right, little guy, now I've got a total of [rupees] from you!" - if (((gSaveContext.save.bankRupees & 0xFFFF) >= 200) && (this->previousBankValue < 200) && + if (((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 200) && (this->previousBankValue < 200) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_40)) { SET_WEEKEVENTREG(WEEKEVENTREG_59_40); Message_StartTextbox(play, 0x45B, &this->actor); this->curTextId = 0x45B; // "What's this? You've already saved up 200 Rupees!?! - } else if (((gSaveContext.save.bankRupees & 0xFFFF) >= 1000) && ((this->previousBankValue) < 1000) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_80)) { + } else if (((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 1000) && + ((this->previousBankValue) < 1000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_80)) { SET_WEEKEVENTREG(WEEKEVENTREG_59_80); Message_StartTextbox(play, 0x45C, &this->actor); this->curTextId = 0x45C; // "What's this? You've already saved up 1000 Rupees!?! - } else if ((gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { + } else if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 5000) { if ((this->previousBankValue < 5000) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_60_01)) { SET_WEEKEVENTREG(WEEKEVENTREG_60_01); Message_StartTextbox(play, 0x45D, &this->actor); this->curTextId = 0x45D; // "What's this? You've already saved up 5000 Rupees?! - } else if (this->previousBankValue < (s16)(gSaveContext.save.bankRupees & 0xFFFF)) { + } else if (this->previousBankValue < (s16)(gSaveContext.save.saveInfo.bankRupees & 0xFFFF)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x45E, &this->actor); this->curTextId = @@ -221,7 +221,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { break; case 0x465: // "There! Now I'll know you when I see you!" Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); - play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; + play->msgCtx.bankRupees = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; Message_StartTextbox(play, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" break; @@ -237,10 +237,10 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { case 0x46C: // "Ah, yes...[Link], right? If I remember, you're the little guy who deposited [rupees]." case 0x47E: // "Your deposits total [rupees]." if (this->choiceDepositWithdrawl == GINKOMAN_CHOICE_DEPOSIT) { - if ((u32)(gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { + if ((u32)(gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 5000) { Message_StartTextbox(play, 0x45F, &this->actor); this->curTextId = 0x45F; // "Excuuuse me! But I can't take anymore deposits! - } else if (gSaveContext.save.playerData.rupees == 0) { + } else if (gSaveContext.save.saveInfo.playerData.rupees == 0) { Message_StartTextbox(play, 0x458, &this->actor); this->curTextId = 0x458; // "Hmm...You play mean jokes, little guy! You haven't even got a single Rupee! @@ -288,12 +288,12 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) { case 0x473: // Use it wisely... case 0x474: // "Aw, you're taking out all that? If you spend it like that, it'll all be gone before you know // it!" - if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { Message_StartTextbox(play, 0x478, &this->actor); // "Look, little guy, all the Rupees you deposited are gone, so you can't use that stamp anymore." this->curTextId = 0x478; } else { - play->msgCtx.bankRupees = gSaveContext.save.bankRupees & 0xFFFF; + play->msgCtx.bankRupees = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; Message_StartTextbox(play, 0x45A, &this->actor); this->curTextId = 0x45A; // "All right, little guy, now I've got a total of [rupees] from you!" } @@ -319,12 +319,12 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { switch (this->curTextId) { case 0x44E: // "...So, what'll it be? if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if ((gSaveContext.save.bankRupees & 0xFFFF) >= 5000) { + if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) >= 5000) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x45F, &this->actor); this->curTextId = 0x45F; // bank full, cannot accept more } else { - if (gSaveContext.save.playerData.rupees > 0) { + if (gSaveContext.save.saveInfo.playerData.rupees > 0) { func_8019F208(); Message_StartTextbox(play, 0x44F, &this->actor); this->curTextId = 0x44F; // "All right! so..." @@ -342,7 +342,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { break; case 0x452: // Really? are you really depositing rupees? if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if (gSaveContext.save.playerData.rupees < play->msgCtx.bankRupeesSelected) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.bankRupeesSelected) { play_sound(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); Message_StartTextbox(play, 0x459, &this->actor); @@ -361,20 +361,20 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { this->curTextId = 0x453; // That's it? That aint nothing at all } - if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { this->isNewAccount = true; } Rupees_ChangeBy(-play->msgCtx.bankRupeesSelected); - this->previousBankValue = gSaveContext.save.bankRupees & 0xFFFF; - gSaveContext.save.bankRupees = - ((gSaveContext.save.bankRupees & 0xFFFF) + play->msgCtx.bankRupeesSelected) | - (gSaveContext.save.bankRupees & 0xFFFF0000); + this->previousBankValue = gSaveContext.save.saveInfo.bankRupees & 0xFFFF; + gSaveContext.save.saveInfo.bankRupees = + ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) + play->msgCtx.bankRupeesSelected) | + (gSaveContext.save.saveInfo.bankRupees & 0xFFFF0000); } } else { // GINKOMAN_CHOICE_NO func_8019F230(); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); - if ((gSaveContext.save.bankRupees & 0xFFFF) == 0) { + if ((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) == 0) { Message_StartTextbox(play, 0x456, &this->actor); this->curTextId = 0x456; // Is that so? think about it } else { @@ -403,14 +403,14 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { break; case 0x471: // Are you really withdrawling [selected rupees]? if (play->msgCtx.choiceIndex == GINKOMAN_CHOICE_YES) { - if ((s32)((gSaveContext.save.bankRupees & 0xFFFF)) < + if ((s32)((gSaveContext.save.saveInfo.bankRupees & 0xFFFF)) < ((s32)(play->msgCtx.bankRupeesSelected + this->serviceFee))) { play_sound(NA_SE_SY_ERROR); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_LEGSMACKING); Message_StartTextbox(play, 0x476, &this->actor); this->curTextId = 0x476; // you dont have enough deposited to withdrawl } else if (CUR_CAPACITY(UPG_WALLET) < - (play->msgCtx.bankRupeesSelected + gSaveContext.save.playerData.rupees)) { + (play->msgCtx.bankRupeesSelected + gSaveContext.save.saveInfo.playerData.rupees)) { // check if wallet is big enough play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x475, &this->actor); @@ -428,11 +428,11 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { this->curTextId = 0x472; // It's a waste to take out such a tiny bit } - this->previousBankValue = (s16)(gSaveContext.save.bankRupees & 0xFFFF); - gSaveContext.save.bankRupees = - (((gSaveContext.save.bankRupees & 0xFFFF) - play->msgCtx.bankRupeesSelected) - + this->previousBankValue = (s16)(gSaveContext.save.saveInfo.bankRupees & 0xFFFF); + gSaveContext.save.saveInfo.bankRupees = + (((gSaveContext.save.saveInfo.bankRupees & 0xFFFF) - play->msgCtx.bankRupeesSelected) - this->serviceFee) | - (gSaveContext.save.bankRupees & 0xFFFF0000); + (gSaveContext.save.saveInfo.bankRupees & 0xFFFF0000); Rupees_ChangeBy(play->msgCtx.bankRupeesSelected); } } else { @@ -591,7 +591,7 @@ void EnGinkoMan_Stamp(EnGinkoMan* this, PlayState* play) { break; case 0x469: // "Excuse me, but let me take a look at you..." Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, GINKO_ANIM_SITTING); - play->msgCtx.bankRupees = (gSaveContext.save.bankRupees & 0xFFFF); + play->msgCtx.bankRupees = (gSaveContext.save.saveInfo.bankRupees & 0xFFFF); if ((CURRENT_DAY == 3) && (gSaveContext.save.isNight == true)) { Message_StartTextbox(play, 0x46C, &this->actor); this->curTextId = 0x46C; // "Ah, yes...[Link], right? diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 28267a485..90e449be3 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -188,7 +188,7 @@ s32 EnGirlA_CanBuyPotionRed(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; @@ -198,7 +198,7 @@ s32 EnGirlA_CanBuyPotionGreen(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; @@ -214,7 +214,7 @@ s32 EnGirlA_CanBuyPotionBlue(PlayState* play, EnGirlA* this) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_53_10)) { return CANBUY_RESULT_SUCCESS_2; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; @@ -227,7 +227,7 @@ s32 EnGirlA_CanBuyArrows(PlayState* play, EnGirlA* this) { if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { return CANBUY_RESULT_NO_ROOM_2; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; @@ -237,7 +237,7 @@ s32 EnGirlA_CanBuyNuts(PlayState* play, EnGirlA* this) { if (CUR_CAPACITY(UPG_NUTS) != 0 && CUR_CAPACITY(UPG_NUTS) <= AMMO(ITEM_NUT)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (Item_CheckObtainability(ITEM_NUT) == ITEM_NONE) { @@ -250,7 +250,7 @@ s32 EnGirlA_CanBuyShieldHero(PlayState* play, EnGirlA* this) { if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_NONE) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; @@ -260,7 +260,7 @@ s32 EnGirlA_CanBuyStick(PlayState* play, EnGirlA* this) { if (CUR_CAPACITY(UPG_STICKS) != 0 && AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (Item_CheckObtainability(ITEM_STICK) == ITEM_NONE) { @@ -270,7 +270,7 @@ s32 EnGirlA_CanBuyStick(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyMaskAllNight(PlayState* play, EnGirlA* this) { - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; @@ -280,7 +280,7 @@ s32 EnGirlA_CanBuyBombBagCuriosityShop(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) >= 2) { return CANBUY_RESULT_CANNOT_GET_NOW; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; @@ -293,7 +293,7 @@ s32 EnGirlA_CanBuyBombBag20BombShop(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) >= 2) { return CANBUY_RESULT_HAVE_BETTER; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; @@ -306,7 +306,7 @@ s32 EnGirlA_CanBuyBombBag30BombShop(PlayState* play, EnGirlA* this) { if (GET_CUR_UPG_VALUE(UPG_BOMB_BAG) == 3) { return CANBUY_RESULT_HAVE_BETTER; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; @@ -319,7 +319,7 @@ s32 EnGirlA_CanBuyBombchus(PlayState* play, EnGirlA* this) { if (AMMO(ITEM_BOMBCHU) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } if (Item_CheckObtainability(ITEM_BOMBCHU) == ITEM_NONE) { @@ -335,21 +335,21 @@ s32 EnGirlA_CanBuyBombs(PlayState* play, EnGirlA* this) { if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyBottleStolen(PlayState* play, EnGirlA* this) { - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; } s32 EnGirlA_CanBuySword(PlayState* play, EnGirlA* this) { - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; @@ -359,7 +359,7 @@ s32 EnGirlA_CanBuyShieldMirror(PlayState* play, EnGirlA* this) { if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_NONE) { return CANBUY_RESULT_NO_ROOM; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_1; @@ -369,7 +369,7 @@ s32 EnGirlA_CanBuyFairy(PlayState* play, EnGirlA* this) { if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } return CANBUY_RESULT_SUCCESS_2; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index b01427406..003ac43e0 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -112,7 +112,7 @@ s8 func_80997A90(s16 arg0, s16 arg1) { if ((arg0 == 0) || ((arg0 != 1) && (arg0 != 2) && (arg0 == 3))) { phi_v1 = 0; } else { - phi_v1 = (gSaveContext.save.unk_EC4 >> (arg1 * 3)) & 7; + phi_v1 = (gSaveContext.save.saveInfo.unk_EA0 >> (arg1 * 3)) & 7; } return phi_v1; } @@ -388,8 +388,8 @@ void func_809985B8(EnGs* this, PlayState* play) { Math_Vec3f_Sum(&player->actor.world.pos, &sp38, &player->actor.world.pos); Math_Vec3f_Copy(&player->actor.prevPos, &player->actor.world.pos); this->unk_200 = 0.0f; - gSaveContext.save.unk_EC4 = ((u32)gSaveContext.save.unk_EC4 & ~(7 << (this->unk_198 * 3))) | - ((this->unk_194 & 7) << (this->unk_198 * 3)); + gSaveContext.save.saveInfo.unk_EA0 = ((u32)gSaveContext.save.saveInfo.unk_EA0 & ~(7 << (this->unk_198 * 3))) | + ((this->unk_194 & 7) << (this->unk_198 * 3)); gossipStone = NULL; do { @@ -450,7 +450,7 @@ void func_8099874C(EnGs* this, PlayState* play) { phi_v0 = 1; for (i = 0; i < 4; i++) { - if (((gSaveContext.save.unk_EC4 >> (i * 3)) & 7) != (u32)this->unk_194) { + if (((gSaveContext.save.saveInfo.unk_EA0 >> (i * 3)) & 7) != (u32)this->unk_194) { phi_v0 = 0; } } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 27c8de507..8bedd48cf 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -576,7 +576,7 @@ s32 func_808F4150(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx) if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { Rupees_ChangeBy(-play->msgCtx.unk1206C); if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_57_01)) { func_808F4108(this, play, 0x3474); @@ -602,7 +602,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.playerData.rupees >= fee) { + if (gSaveContext.save.saveInfo.playerData.rupees >= fee) { Rupees_ChangeBy(-fee); if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_57_01)) { if (arg4 != 0) { @@ -747,7 +747,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3466: if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); @@ -999,7 +999,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3490: if (msgCtx->choiceIndex == 0) { func_8019F208(); - if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f); diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 8b3ec5956..263b4fab4 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -409,7 +409,7 @@ void func_80C14610(EnJgameTsn* this, PlayState* play) { void func_80C14684(EnJgameTsn* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { - if (gSaveContext.save.playerData.rupees >= 20) { + if (gSaveContext.save.saveInfo.playerData.rupees >= 20) { Message_StartTextbox(play, 0x109E, &this->actor); this->unk_300 = 0x109E; Rupees_ChangeBy(-20); diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 0cfe7ae75..e4e01467f 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -1764,14 +1764,14 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { Vec3f sp58; s32 i; - if (gSaveContext.save.playerData.health <= 0x10) { + if (gSaveContext.save.saveInfo.playerData.health <= 0x10) { this->swordCollider.info.toucher.damage = 0; } else { this->swordCollider.info.toucher.damage = 4; } if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && (this->swordCollider.base.atFlags & AT_HIT)) { - if ((gSaveContext.save.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { + if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { this->unk_2D0 = 2; this->subCamId = 0; this->picto.actor.flags |= ACTOR_FLAG_100000; @@ -1788,7 +1788,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } else if ((this->action == KAIZOKU_ACTION_11) && (this->swordCollider.base.at == &GET_PLAYER(play)->actor)) { func_800B8D98(play, &this->picto.actor, 3.0f, this->picto.actor.yawTowardsPlayer, 1.0f); Health_ChangeBy(play, -0xC); - if ((gSaveContext.save.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { + if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { Health_ChangeBy(play, 0x10); this->unk_2D0 = 2; this->subCamId = 0; diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c index d2847a39d..b3b8ca295 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c @@ -71,12 +71,12 @@ void EnKbt_Destroy(Actor* thisx, PlayState* play) { } s32 func_80B33E64(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1; + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 1; } s32 func_80B33E8C(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 2))) { return true; } return false; diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index ee7e0fe84..813852b44 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -224,7 +224,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); - } else if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + } else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2718, &this->actor); this->unk_288 = 0x2718; @@ -242,7 +242,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); - } else if (gSaveContext.save.playerData.rupees < play->msgCtx.unk12070) { + } else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk12070) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2718, &this->actor); this->unk_288 = 0x2718; diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index 356af73f7..56fb61bed 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -151,33 +151,33 @@ ObjIcePoly* EnKgy_FindIceBlock(PlayState* play) { } void func_80B40C74(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 1; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= 1; if (CURRENT_DAY == 1) { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 2; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= 2; } else { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~2; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~2; } } void func_80B40D00(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 4; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= 4; } void func_80B40D30(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~7; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~7; } s32 func_80B40D64(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1; + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 1; } s32 func_80B40D8C(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 4; + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 4; } s32 func_80B40DB4(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 2))) { return true; } return false; @@ -621,7 +621,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC3B: switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { play_sound(NA_SE_SY_ERROR); func_80B40E74(this, play, 0xC3F); } else { diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index 1de7fc728..3e54fd0f9 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -46,13 +46,13 @@ ActorInit En_Kujiya_InitVars = { (ActorFunc)EnKujiya_Draw, }; -#define CHECK_LOTTERY_NUMBERS \ - (((u32)((void)0, gSaveContext.save.lotteryCodes[CURRENT_DAY - 1][0]) == \ - ((((void)0, gSaveContext.save.lotteryCodeGuess & 0xFFFF) & 0xF00) >> 8)) && \ - ((u32)((void)0, gSaveContext.save.lotteryCodes[CURRENT_DAY - 1][1]) == \ - ((((void)0, gSaveContext.save.lotteryCodeGuess & 0xFFFF) & 0xF0) >> 4)) && \ - ((u32)((void)0, gSaveContext.save.lotteryCodes[CURRENT_DAY - 1][2]) == \ - (((void)0, gSaveContext.save.lotteryCodeGuess & 0xFFFF) & 0xF))) +#define CHECK_LOTTERY_NUMBERS \ + (((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][0]) == \ + ((((void)0, gSaveContext.save.saveInfo.lotteryCodeGuess & 0xFFFF) & 0xF00) >> 8)) && \ + ((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][1]) == \ + ((((void)0, gSaveContext.save.saveInfo.lotteryCodeGuess & 0xFFFF) & 0xF0) >> 4)) && \ + ((u32)((void)0, gSaveContext.save.saveInfo.lotteryCodes[CURRENT_DAY - 1][2]) == \ + (((void)0, gSaveContext.save.saveInfo.lotteryCodeGuess & 0xFFFF) & 0xF))) void EnKujiya_Init(Actor* thisx, PlayState* play) { EnKujiya* this = THIS; @@ -111,7 +111,7 @@ void EnKujiya_Wait(EnKujiya* this, PlayState* play) { void EnKujiya_HandlePlayerChoice(EnKujiya* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (play->msgCtx.choiceIndex == 0) { // Buy - if (gSaveContext.save.playerData.rupees < 10) { + if (gSaveContext.save.saveInfo.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x2B62, &this->actor); this->textId = 0x2B62; // Not enough Rupees diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index 5b2028486..0bd619a9c 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -393,7 +393,7 @@ void func_80AEA1A0(EnLiftNuts* this, PlayState* play) { } } else { if (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]) >= - gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < 0x2EE0) { Message_StartTextbox(play, 0x27F9, &this->actor); this->textId = 0x27F9; @@ -452,7 +452,7 @@ void func_80AEA7A4(EnLiftNuts* this, PlayState* play) { switch (this->textId) { case 0x27E2: if (play->msgCtx.choiceIndex == 0) { // Yes - if (gSaveContext.save.playerData.rupees >= 10) { + if (gSaveContext.save.saveInfo.playerData.rupees >= 10) { func_8019F208(); Message_StartTextbox(play, 0x27E5, &this->actor); this->textId = 0x27E5; @@ -784,7 +784,7 @@ void func_80AEB294(EnLiftNuts* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; if (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]) < - gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { Flags_SetSwitch(play, 0x40); } Flags_SetSwitch(play, 0x41); @@ -804,7 +804,7 @@ void func_80AEB428(EnLiftNuts* this, PlayState* play) { if (this->unk_354 == 10) { if (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]) > - gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { + gSaveContext.save.saveInfo.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { Message_StartTextbox(play, 0x27EA, &this->actor); this->textId = 0x27EA; } else if (*this->ptr_1EC == 300) { diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 3d97839a0..0586b2111 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -129,7 +129,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { this->isCharging = false; if (player->stateFlags2 & PLAYER_STATE2_20000) { - if (!gSaveContext.save.playerData.isMagicAcquired || (gSaveContext.magicState != MAGIC_STATE_IDLE) || + if (!gSaveContext.save.saveInfo.playerData.isMagicAcquired || (gSaveContext.magicState != MAGIC_STATE_IDLE) || ((ENMTHUNDER_GET_MAGIC_COST(&this->actor) != 0) && !Magic_Consume(play, ENMTHUNDER_GET_MAGIC_COST(&this->actor), MAGIC_CONSUME_NOW))) { AudioSfx_PlaySfx(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 0a1ec063a..0bbbce26a 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -907,9 +907,9 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { this->textId = 0x336D; } else { time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; - if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { + if ((s32)time < (s32)gSaveContext.save.saveInfo.horseBackBalloonHighScore) { // [Score] New record! - gSaveContext.save.horseBackBalloonHighScore = time; + gSaveContext.save.saveInfo.horseBackBalloonHighScore = time; EnMa4_SetFaceExpression(this, 0, 3); Message_StartTextbox(play, 0x3350, &this->actor); this->textId = 0x3350; @@ -951,8 +951,8 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { this->textId = 0x3356; } else { time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; - if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { - gSaveContext.save.horseBackBalloonHighScore = time; + if ((s32)time < (s32)gSaveContext.save.saveInfo.horseBackBalloonHighScore) { + gSaveContext.save.saveInfo.horseBackBalloonHighScore = time; EnMa4_SetFaceExpression(this, 0, 3); Message_StartTextbox(play, 0x3350, &this->actor); this->textId = 0x3350; @@ -978,9 +978,9 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { this->textId = 0x3356; } else { time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; - if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { + if ((s32)time < (s32)gSaveContext.save.saveInfo.horseBackBalloonHighScore) { // New record - gSaveContext.save.horseBackBalloonHighScore = time; + gSaveContext.save.saveInfo.horseBackBalloonHighScore = time; Message_StartTextbox(play, 0x335D, &this->actor); this->textId = 0x335D; } else { diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 054f39c81..930fb13d5 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -120,7 +120,7 @@ void EnMk_Destroy(Actor* thisx, PlayState* play) { } s32 func_80959524(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 7; + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7; } void func_8095954C(EnMk* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 291fa83ce..366bddef3 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -148,7 +148,7 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) { case 0x278E: if (play->msgCtx.choiceIndex == 0) { if (this->unk_2B2 & 0x20) { - if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { func_8019F208(); Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; @@ -174,7 +174,7 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) { case 0x279A: if (play->msgCtx.choiceIndex == 0) { - if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { + if (gSaveContext.save.saveInfo.playerData.rupees >= play->msgCtx.unk1206C) { func_8019F208(); Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index d7a4fff3d..3cbf7e2ad 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -83,7 +83,7 @@ void EnMs_Destroy(Actor* thisx, PlayState* play) { void EnMs_Wait(EnMs* this, PlayState* play) { s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (gSaveContext.save.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { this->actor.textId = 0x92E; // "[...] You're the first customer [...]" } else { this->actor.textId = 0x932; // "[...] So you liked my Magic Beans [...]" @@ -118,7 +118,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: // yes Message_CloseTextbox(play); - if (gSaveContext.save.playerData.rupees < 10) { + if (gSaveContext.save.saveInfo.playerData.rupees < 10) { play_sound(NA_SE_SY_ERROR); Message_ContinueTextbox(play, 0x935); // "[...] You don't have enough Rupees." } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index c53a29232..01cbb5dda 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -81,7 +81,7 @@ void func_8093E518(EnOkarinaTag* this, PlayState* play) { var_v1 = this->unk14A; if (var_v1 == 6) { var_v1 = 0xA; - if (gSaveContext.save.unk_F65 == 0) { + if (gSaveContext.save.saveInfo.unk_F41 == 0) { return; } } diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index e9e12e311..e5540a292 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -443,10 +443,11 @@ s32 EnOsn_GetInitialMaskText(EnOsn* this, PlayState* play) { s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) && CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { + if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] != ITEM_NONE) && + CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { if (this->stateFlags & OSN_STATE_SPECIAL_CONVERSTATION) { this->stateFlags |= OSN_STATE_END_CONVERSATION; - if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) && + if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] != ITEM_NONE) && (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { @@ -692,11 +693,11 @@ void EnOsn_HandleConversation(EnOsn* this, PlayState* play) { void EnOsn_InitCutscene(EnOsn* this) { this->cutscene = this->actor.cutscene; - if ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || + if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) || (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); - if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) || + if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] != ITEM_NONE) || (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); } @@ -719,7 +720,8 @@ void EnOsn_ChooseAction(EnOsn* this, PlayState* play) { void EnOsn_Idle(EnOsn* this, PlayState* play) { s16 yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((gSaveContext.save.inventory.items[SLOT_OCARINA] != ITEM_NONE) && !CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { + if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] != ITEM_NONE) && + !CHECK_QUEST_ITEM(QUEST_SONG_HEALING)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnOsn_StartCutscene; } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && (yaw < 0x4000) && diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index fb4c54c3d..a5bb03a72 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -157,7 +157,7 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { break; case ENOWL_GET_TYPE_2: - if (gSaveContext.save.inventory.items[ITEM_LENS] == ITEM_LENS) { + if (gSaveContext.save.saveInfo.inventory.items[ITEM_LENS] == ITEM_LENS) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index c97a0362a..3ffde38cd 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -443,9 +443,10 @@ void EnRacedog_UpdateTextId(EnRacedog* this) { // range of 0x3539 to 0x3546. if (this->index % 2) { sDogInfo[this->index].textId = - (((gSaveContext.save.weekEventReg[42 + (this->index / 2)]) & 0xF0) >> 4) + 0x3539; + (((gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)]) & 0xF0) >> 4) + 0x3539; } else { - sDogInfo[this->index].textId = ((gSaveContext.save.weekEventReg[42 + (this->index / 2)]) & 0x0F) + 0x3539; + sDogInfo[this->index].textId = + ((gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)]) & 0x0F) + 0x3539; } // As a sanity check, this makes sure the text ID is something in the expected range of 0x3539 to 0x3546. diff --git a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c index debcc77b9..14904e5b7 100644 --- a/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c +++ b/src/overlays/actors/ovl_En_S_Goro/z_en_s_goro.c @@ -701,7 +701,7 @@ u16 EnSGoro_BombshopGoron_NextTextId(EnSGoro* this, PlayState* play) { return 0x673; } this->powderKegPrice = play->msgCtx.unk1206C; - if (gSaveContext.save.playerData.rupees < this->powderKegPrice) { + if (gSaveContext.save.saveInfo.playerData.rupees < this->powderKegPrice) { this->actionFlags |= EN_S_GORO_ACTIONFLAG_LASTMESSAGE; this->actionFlags |= EN_S_GORO_ACTIONFLAG_TIRED; play_sound(NA_SE_SY_ERROR); diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index c7ccaec9a..1c82887b4 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -334,7 +334,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.playerData.rupees < this->unk_358) { + if (gSaveContext.save.saveInfo.playerData.rupees < this->unk_358) { play_sound(NA_SE_SY_ERROR); this->unk_33C = 0x1636; this->unk_328 |= 1; @@ -684,7 +684,8 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { s32 pad; EnScopenuts* this = THIS; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_40) && (gSaveContext.save.inventory.items[ITEM_OCARINA] == ITEM_NONE)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_74_40) && + (gSaveContext.save.saveInfo.inventory.items[ITEM_OCARINA] == ITEM_NONE)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c index ff12d798f..538f7d304 100644 --- a/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c +++ b/src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c @@ -59,7 +59,8 @@ void EnSekihi_Init(Actor* thisx, PlayState* play) { return; } - if ((params == SEKIHI_TYPE_4) && (((gSaveContext.save.skullTokenCount & 0xFFFF)) >= SPIDER_HOUSE_TOKENS_REQUIRED)) { + if ((params == SEKIHI_TYPE_4) && + ((gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF) >= SPIDER_HOUSE_TOKENS_REQUIRED)) { // For some reason the mikau grave sets the flag instead of something in the spider house on exit. SET_WEEKEVENTREG(WEEKEVENTREG_OCEANSIDE_SPIDER_HOUSE_BUYER_MOVED_IN); } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 3ff396920..f10d387d1 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -154,7 +154,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { break; case STH_TYPE_MOON_LOOKING: // South Clock Town - if ((gSaveContext.save.skullTokenCount & 0xFFFF) >= SPIDER_HOUSE_TOKENS_REQUIRED) { + if ((gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF) >= SPIDER_HOUSE_TOKENS_REQUIRED) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index b0c052b5c..01c8e96a5 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -327,7 +327,7 @@ void EnSyatekiMan_Swamp_HandleChoice(EnSyatekiMan* this, PlayState* play) { // You don't have a bow! Message_StartTextbox(play, 0xA30, &this->actor); this->prevTextId = 0xA30; - } else if (gSaveContext.save.playerData.rupees < 20) { + } else if (gSaveContext.save.saveInfo.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); // You don't have enough rupees! @@ -627,7 +627,7 @@ void EnSyatekiMan_Town_HandleChoice(EnSyatekiMan* this, PlayState* play) { Message_StartTextbox(play, 0x3FA, &this->actor); this->prevTextId = 0x3FA; } - } else if (gSaveContext.save.playerData.rupees < 20) { + } else if (gSaveContext.save.saveInfo.playerData.rupees < 20) { play_sound(NA_SE_SY_ERROR); if (CURRENT_DAY != 3) { // You don't have a enough rupees! diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 180bc59d4..59af8f7e8 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -436,7 +436,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { if (CURRENT_DAY == 3) { if ((this->nextBellTime == CLOCK_TIME(0, 0)) && - ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || + ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) || (play->sceneId == SCENE_CLOCKTOWER))) { s32 playerParams; u32 entrance = gSaveContext.save.entrance; diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 491d94227..d472077ec 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -223,10 +223,10 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { s16 itemId2 = 0; for (; slotId < 24; slotId++) { - if ((gSaveContext.save.inventory.items[slotId] >= ITEM_BOTTLE) && - (gSaveContext.save.inventory.items[slotId] <= ITEM_POTION_BLUE)) { + if ((gSaveContext.save.saveInfo.inventory.items[slotId] >= ITEM_BOTTLE) && + (gSaveContext.save.saveInfo.inventory.items[slotId] <= ITEM_POTION_BLUE)) { isItemFound = true; - itemId2 = gSaveContext.save.inventory.items[slotId]; + itemId2 = gSaveContext.save.saveInfo.inventory.items[slotId]; break; } } @@ -343,7 +343,7 @@ s32 func_80C10E98(PlayState* play) { spAC = 0; } - sp98 = (gSaveContext.save.playerData.rupees / 4) * 3; + sp98 = (gSaveContext.save.saveInfo.playerData.rupees / 4) * 3; phi_s0_2 = sp98 / 50; sp5C = (-spB0 - spAC); sp5C += 8; diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 9928146b1..09ec80172 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -352,9 +352,9 @@ void func_80B76980(EnTruMt* this, PlayState* play) { } else if (CHECK_EVENTINF(EVENTINF_40)) { u32 score = gSaveContext.minigameScore; - if (((gSaveContext.save.unk_EE8 & 0xFFFF0000) >> 0x10) < score) { - gSaveContext.save.unk_EE8 = - ((gSaveContext.minigameScore & 0xFFFF) << 0x10) | (gSaveContext.save.unk_EE8 & 0xFFFF); + if (((gSaveContext.save.saveInfo.unk_EC4 & 0xFFFF0000) >> 0x10) < score) { + gSaveContext.save.saveInfo.unk_EC4 = + ((gSaveContext.minigameScore & 0xFFFF) << 0x10) | (gSaveContext.save.saveInfo.unk_EC4 & 0xFFFF); SET_EVENTINF(EVENTINF_37); } } diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index 1ef62420b..7808e8089 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -115,7 +115,7 @@ void EnZod_Init(Actor* thisx, PlayState* play) { switch (ENZOD_GET_TYPE(thisx)) { case ENZOD_TYPE_1: - if (gSaveContext.save.weekEventReg[78] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_01)) { this->actionFunc = func_80BAFDB4; EnZod_ChangeAnim(this, ENZOD_ANIM_PLAYING_VIVACE, ANIMMODE_ONCE); this->actor.flags |= ACTOR_FLAG_10; @@ -124,7 +124,7 @@ void EnZod_Init(Actor* thisx, PlayState* play) { } this->actionFunc = func_80BAFB84; - if (!(gSaveContext.save.weekEventReg[55] & 0x80)) { + if (!(CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80))) { Actor_Kill(&this->actor); break; } @@ -137,7 +137,7 @@ void EnZod_Init(Actor* thisx, PlayState* play) { break; default: - if (gSaveContext.save.weekEventReg[55] & 0x80) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { Actor_Kill(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -156,19 +156,19 @@ void EnZod_HandleRoomConversation(EnZod* this, PlayState* play) { if (gSaveContext.save.playerForm != PLAYER_FORM_ZORA) { textId = 0x1227; - if (gSaveContext.save.weekEventReg[32] & 8) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_08)) { textId = 0x1229; } else { - gSaveContext.save.weekEventReg[32] |= 8; + SET_WEEKEVENTREG(WEEKEVENTREG_32_08); } } else if (this->stateFlags & TIJO_STATE_1) { textId = 0x1225; } else { textId = 0x1219; - if (gSaveContext.save.weekEventReg[32] & 0x10) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_32_10)) { textId = 0x1226; } else { - gSaveContext.save.weekEventReg[32] |= 0x10; + SET_WEEKEVENTREG(WEEKEVENTREG_32_10); } this->stateFlags |= TIJO_STATE_1; } @@ -394,14 +394,14 @@ void func_80BAFA44(EnZod* this, PlayState* play) { u16 textId; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - if (gSaveContext.save.weekEventReg[79] & 1) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_01)) { textId = 0x1253; } else { textId = 0x1251; - if (gSaveContext.save.weekEventReg[78] & 0x20) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_20)) { textId = 0x1252; } else { - gSaveContext.save.weekEventReg[78] |= 0x20; + SET_WEEKEVENTREG(WEEKEVENTREG_78_20); } } } else { @@ -453,7 +453,7 @@ void EnZod_Rehearse(EnZod* this, PlayState* play) { play->nextEntrance = play->setupExitList[ENZOD_GET_ENTRANCE_INDEX(&this->actor)]; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.weekEventReg[78] &= (u8)~1; + CLEAR_WEEKEVENTREG(WEEKEVENTREG_78_01); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } @@ -471,7 +471,7 @@ void EnZod_SetupRehearse(EnZod* this, PlayState* play) { ActorCutscene_Stop(this->actor.cutscene); this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); ActorCutscene_SetIntentToPlay(this->actor.cutscene); - gSaveContext.save.weekEventReg[79] |= 1; + SET_WEEKEVENTREG(WEEKEVENTREG_79_01); SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_INDIGO_GO_SESSION | SEQ_FLAG_ASYNC); } } diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index 44a705539..17abb250d 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -206,13 +206,13 @@ void EnZoraegg_Destroy(Actor* thisx, PlayState* play) { } s32 func_80B319A8(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 7; + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7; } void func_80B319D0(PlayState* play, s32 arg1) { if ((arg1 < 8) && (arg1 >= 0)) { - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~7; - gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= arg1; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 &= ~7; + gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 |= arg1; } } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 1eb6b020b..a24791080 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -467,7 +467,7 @@ void func_80B973BC(EnZot* this, PlayState* play) { break; case 0x1275: - if (gSaveContext.save.playerData.rupees < 10) { + if (gSaveContext.save.saveInfo.playerData.rupees < 10) { Message_ContinueTextbox(play, 0x1277); } else { Message_ContinueTextbox(play, 0x1278); diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 94e9c85c1..00dd90b94 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -620,7 +620,7 @@ void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, PlayState* play) { } s32 ObjTokeidai_IsPostFirstCycleFinalHours(ObjTokeidai* this, PlayState* play) { - if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { return false; } if (CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) { diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c index d527e4937..81efe0fc5 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c @@ -45,9 +45,9 @@ s32 func_80C07C80(s32 arg0) { s32 var_v1; if (!(arg0 & 1)) { - var_v1 = gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF; + var_v1 = gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] & 0xFFFF; } else { - var_v1 = (gSaveContext.save.unk_E88[arg0 >> 1] & 0xFFFF0000) >> 0x10; + var_v1 = (gSaveContext.save.saveInfo.unk_E64[arg0 >> 1] & 0xFFFF0000) >> 0x10; } return var_v1 + CLOCK_TIME(2, 30); } diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h index a2db609d6..241eb825d 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.h @@ -27,6 +27,6 @@ typedef struct ObjWarpstone { } ObjWarpstone; // size = 0x1B0 #define OBJ_WARPSTONE_GET_ID(thisx) ((u16)((thisx)->params & 0xF)) -#define OBJ_WARPSTONE_IS_ACTIVATED(owlId) (((void)0, gSaveContext.save.playerData.owlActivationFlags) & (u16)gBitFlags[(owlId)]) +#define OBJ_WARPSTONE_IS_ACTIVATED(owlId) (((void)0, gSaveContext.save.saveInfo.playerData.owlActivationFlags) & (u16)gBitFlags[(owlId)]) #endif // Z_OBJ_WARPSTONE_H diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c index b8858b7ca..3d7e08221 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c @@ -370,14 +370,14 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); // Current Health Quarter (X / 4) - KaleidoScope_DrawDigit(play, (((void)0, gSaveContext.save.playerData.health) % 0x10) / 4, 217, 15); + KaleidoScope_DrawDigit(play, (((void)0, gSaveContext.save.saveInfo.playerData.health) % 0x10) / 4, 217, 15); gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); // Rupees counterDigits[0] = counterDigits[1] = counterDigits[2] = 0; - counterDigits[3] = gSaveContext.save.playerData.rupees; + counterDigits[3] = gSaveContext.save.saveInfo.playerData.rupees; while (counterDigits[3] >= 1000) { counterDigits[0]++; counterDigits[3] -= 1000; @@ -400,7 +400,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { // Health capacity counterDigits[2] = 0; - counterDigits[3] = gSaveContext.save.playerData.healthCapacity / 0x10; + counterDigits[3] = gSaveContext.save.saveInfo.playerData.healthCapacity / 0x10; while (counterDigits[3] >= 10) { counterDigits[2]++; counterDigits[3] -= 10; @@ -411,7 +411,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { // Health counterDigits[2] = 0; - counterDigits[3] = gSaveContext.save.playerData.health / 0x10; + counterDigits[3] = gSaveContext.save.saveInfo.playerData.health / 0x10; while (counterDigits[3] >= 10) { counterDigits[2]++; counterDigits[3] -= 10; @@ -431,10 +431,10 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { (slot == SLOT_MAGIC_BEANS)) { counterDigits[3] = AMMO(gAmmoItems[slot]); } else if ((slot == SLOT_TRADE_DEED) || (slot == SLOT_TRADE_KEY_MAMA) || (slot == SLOT_TRADE_COUPLE)) { - counterDigits[3] = gSaveContext.save.inventory.items[slot]; + counterDigits[3] = gSaveContext.save.saveInfo.inventory.items[slot]; } else if (slot >= SLOT_BOTTLE_1) { - counterDigits[3] = gSaveContext.save.inventory.items[slot]; - } else if (gSaveContext.save.inventory.items[slot] != ITEM_NONE) { + counterDigits[3] = gSaveContext.save.saveInfo.inventory.items[slot]; + } else if (gSaveContext.save.saveInfo.inventory.items[slot] != ITEM_NONE) { counterDigits[3] = 1; } @@ -461,7 +461,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { for (j = 0, rectLeft = 204; j < 6; j++, slot++, rectLeft += 14) { counterDigits[2] = 0; - if (gSaveContext.save.inventory.items[SLOT_MASK_POSTMAN + slot] != ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[SLOT_MASK_POSTMAN + slot] != ITEM_NONE) { counterDigits[2] = 1; } KaleidoScope_DrawDigit(play, counterDigits[2], rectLeft, rectTop); @@ -583,7 +583,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { // Dungeon Items // Loop over columns (i), (counterDigits[1] stores rectLeft) for (counterDigits[1] = 129, i = 0; i < 4; i++) { - counterDigits[2] = gSaveContext.save.inventory.dungeonItems[i] & gEquipMasks[0]; + counterDigits[2] = gSaveContext.save.saveInfo.inventory.dungeonItems[i] & gEquipMasks[0]; KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 168); counterDigits[1] += 12; } @@ -591,7 +591,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { // Stray Fairies // Loop over columns (i), (counterDigits[1] stores rectLeft) for (counterDigits[1] = 202, i = 0; i < 4; i++) { - counterDigits[3] = gSaveContext.save.inventory.strayFairies[i]; + counterDigits[3] = gSaveContext.save.saveInfo.inventory.strayFairies[i]; counterDigits[2] = counterDigits[3] / 10; counterDigits[3] -= counterDigits[2] * 10; if (counterDigits[2] != 0) { @@ -602,22 +602,22 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { } // Double Defence - KaleidoScope_DrawDigit(play, gSaveContext.save.playerData.doubleDefense, 44, 202); + KaleidoScope_DrawDigit(play, gSaveContext.save.saveInfo.playerData.doubleDefense, 44, 202); // Magic - //! @bug should be gSaveContext.save.playerData.doubleMagic - KaleidoScope_DrawDigit(play, gSaveContext.save.playerData.doubleDefense, 75, 202); + //! @bug should be gSaveContext.save.saveInfo.playerData.doubleMagic + KaleidoScope_DrawDigit(play, gSaveContext.save.saveInfo.playerData.doubleDefense, 75, 202); // Lottery // Loop over columns (i), (counterDigits[1] stores rectLeft) for (counterDigits[1] = 139, i = 0; i < 3; i++) { - counterDigits[2] = gSaveContext.save.lotteryCodes[0][i]; + counterDigits[2] = gSaveContext.save.saveInfo.lotteryCodes[0][i]; KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 184); - counterDigits[2] = gSaveContext.save.lotteryCodes[1][i]; + counterDigits[2] = gSaveContext.save.saveInfo.lotteryCodes[1][i]; KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 198); - counterDigits[2] = gSaveContext.save.lotteryCodes[2][i]; + counterDigits[2] = gSaveContext.save.saveInfo.lotteryCodes[2][i]; KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 212); counterDigits[1] += 12; @@ -626,7 +626,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { // Oceanside Spider House Mask Order // Loop over columns (i), (counterDigits[1] stores rectLeft) for (counterDigits[1] = 217, i = 0; i < 6; i++) { - counterDigits[2] = gSaveContext.save.spiderHouseMaskOrder[i]; + counterDigits[2] = gSaveContext.save.saveInfo.spiderHouseMaskOrder[i]; KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 186); counterDigits[1] += 12; @@ -635,7 +635,7 @@ void KaleidoScope_DrawInventoryEditor(PlayState* play) { // Bombers code // Loop over columns (i), (counterDigits[1] stores rectLeft) for (counterDigits[1] = 220, i = 0; i < 5; i++) { - counterDigits[2] = gSaveContext.save.bomberCode[i]; + counterDigits[2] = gSaveContext.save.saveInfo.bomberCode[i]; KaleidoScope_DrawDigit(play, counterDigits[2], counterDigits[1], 210); counterDigits[1] += 12; @@ -709,24 +709,24 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { case INV_EDITOR_SECTION_RUPEE: // Rupees if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { - gSaveContext.save.playerData.rupees -= 100; - if (gSaveContext.save.playerData.rupees < 0) { - gSaveContext.save.playerData.rupees = 0; + gSaveContext.save.saveInfo.playerData.rupees -= 100; + if (gSaveContext.save.saveInfo.playerData.rupees < 0) { + gSaveContext.save.saveInfo.playerData.rupees = 0; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { - gSaveContext.save.playerData.rupees += 100; - if (gSaveContext.save.playerData.rupees >= 9999) { - gSaveContext.save.playerData.rupees = 9999; + gSaveContext.save.saveInfo.playerData.rupees += 100; + if (gSaveContext.save.saveInfo.playerData.rupees >= 9999) { + gSaveContext.save.saveInfo.playerData.rupees = 9999; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - gSaveContext.save.playerData.rupees--; - if (gSaveContext.save.playerData.rupees < 0) { - gSaveContext.save.playerData.rupees = 0; + gSaveContext.save.saveInfo.playerData.rupees--; + if (gSaveContext.save.saveInfo.playerData.rupees < 0) { + gSaveContext.save.saveInfo.playerData.rupees = 0; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - gSaveContext.save.playerData.rupees++; - if (gSaveContext.save.playerData.rupees >= 9999) { - gSaveContext.save.playerData.rupees = 9999; + gSaveContext.save.saveInfo.playerData.rupees++; + if (gSaveContext.save.saveInfo.playerData.rupees >= 9999) { + gSaveContext.save.saveInfo.playerData.rupees = 9999; } } break; @@ -734,15 +734,15 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { case INV_EDITOR_SECTION_HEALTH_CAPACITY: // Health Capacity if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - gSaveContext.save.playerData.healthCapacity -= 0x10; - if (gSaveContext.save.playerData.healthCapacity < 0x30) { - gSaveContext.save.playerData.healthCapacity = 0x30; + gSaveContext.save.saveInfo.playerData.healthCapacity -= 0x10; + if (gSaveContext.save.saveInfo.playerData.healthCapacity < 0x30) { + gSaveContext.save.saveInfo.playerData.healthCapacity = 0x30; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - gSaveContext.save.playerData.healthCapacity += 0x10; - if (gSaveContext.save.playerData.healthCapacity >= 0x140) { - gSaveContext.save.playerData.healthCapacity = 0x140; + gSaveContext.save.saveInfo.playerData.healthCapacity += 0x10; + if (gSaveContext.save.saveInfo.playerData.healthCapacity >= 0x140) { + gSaveContext.save.saveInfo.playerData.healthCapacity = 0x140; } } break; @@ -806,48 +806,48 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { } else if (slot == SLOT_TRADE_DEED) { if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_MOON_TEAR; + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_MOON_TEAR; } else if ((INV_CONTENT(ITEM_MOON_TEAR) >= ITEM_MOON_TEAR) && (INV_CONTENT(ITEM_MOON_TEAR) <= ITEM_DEED_MOUNTAIN)) { - gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) + 1; + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) + 1; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { if (INV_CONTENT(ITEM_MOON_TEAR) == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_DEED_OCEAN; + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_DEED_OCEAN; } else if ((INV_CONTENT(ITEM_MOON_TEAR) >= ITEM_DEED_LAND) && (INV_CONTENT(ITEM_MOON_TEAR) <= ITEM_DEED_OCEAN)) { - gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) - 1; + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_MOON_TEAR) - 1; } } } else if (slot == SLOT_TRADE_KEY_MAMA) { if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { if (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_ROOM_KEY; + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_ROOM_KEY; } else if ((INV_CONTENT(ITEM_ROOM_KEY) >= ITEM_ROOM_KEY) && (INV_CONTENT(ITEM_ROOM_KEY) <= ITEM_ROOM_KEY)) { - gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_ROOM_KEY) + 1; + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_ROOM_KEY) + 1; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { if (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_LETTER_MAMA; + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_LETTER_MAMA; } else if ((INV_CONTENT(ITEM_ROOM_KEY) >= ITEM_LETTER_MAMA) && (INV_CONTENT(ITEM_ROOM_KEY) <= ITEM_LETTER_MAMA)) { - gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_ROOM_KEY) - 1; + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_ROOM_KEY) - 1; } } } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { if (INV_CONTENT(ITEM_LETTER_TO_KAFEI) == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_LETTER_TO_KAFEI; + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_LETTER_TO_KAFEI; } else if ((INV_CONTENT(ITEM_LETTER_TO_KAFEI) >= ITEM_LETTER_TO_KAFEI) && (INV_CONTENT(ITEM_LETTER_TO_KAFEI) <= ITEM_LETTER_TO_KAFEI)) { - gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_LETTER_TO_KAFEI) + 1; + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_LETTER_TO_KAFEI) + 1; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { if (INV_CONTENT(ITEM_LETTER_TO_KAFEI) == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_PENDANT_OF_MEMORIES; + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_PENDANT_OF_MEMORIES; } else if ((INV_CONTENT(ITEM_LETTER_TO_KAFEI) >= ITEM_PENDANT_OF_MEMORIES) && (INV_CONTENT(ITEM_LETTER_TO_KAFEI) <= ITEM_PENDANT_OF_MEMORIES)) { - gSaveContext.save.inventory.items[slot] = INV_CONTENT(ITEM_LETTER_TO_KAFEI) - 1; + gSaveContext.save.saveInfo.inventory.items[slot] = INV_CONTENT(ITEM_LETTER_TO_KAFEI) - 1; } } } else if ((slot >= SLOT_BOTTLE_1) && (slot <= SLOT_BOTTLE_6)) { @@ -855,18 +855,20 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { value = ITEM_BOTTLE + slot - SLOT_BOTTLE_1; Inventory_DeleteItem(value, SLOT(ITEM_BOTTLE) + slot - SLOT_BOTTLE_1); } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - if (gSaveContext.save.inventory.items[slot] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_BOTTLE; - } else if ((gSaveContext.save.inventory.items[slot] >= ITEM_BOTTLE) && - (gSaveContext.save.inventory.items[slot] <= ITEM_HYLIAN_LOACH)) { - gSaveContext.save.inventory.items[slot] = gSaveContext.save.inventory.items[slot] + 1; + if (gSaveContext.save.saveInfo.inventory.items[slot] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_BOTTLE; + } else if ((gSaveContext.save.saveInfo.inventory.items[slot] >= ITEM_BOTTLE) && + (gSaveContext.save.saveInfo.inventory.items[slot] <= ITEM_HYLIAN_LOACH)) { + gSaveContext.save.saveInfo.inventory.items[slot] = + gSaveContext.save.saveInfo.inventory.items[slot] + 1; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - if (gSaveContext.save.inventory.items[slot] == ITEM_NONE) { - gSaveContext.save.inventory.items[slot] = ITEM_OBABA_DRINK; - } else if ((gSaveContext.save.inventory.items[slot] >= ITEM_POTION_RED) && - (gSaveContext.save.inventory.items[slot] <= ITEM_OBABA_DRINK)) { - gSaveContext.save.inventory.items[slot] = gSaveContext.save.inventory.items[slot] - 1; + if (gSaveContext.save.saveInfo.inventory.items[slot] == ITEM_NONE) { + gSaveContext.save.saveInfo.inventory.items[slot] = ITEM_OBABA_DRINK; + } else if ((gSaveContext.save.saveInfo.inventory.items[slot] >= ITEM_POTION_RED) && + (gSaveContext.save.saveInfo.inventory.items[slot] <= ITEM_OBABA_DRINK)) { + gSaveContext.save.saveInfo.inventory.items[slot] = + gSaveContext.save.saveInfo.inventory.items[slot] - 1; } } } else { @@ -874,7 +876,7 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { value = sSlotItems[slot]; - if (gSaveContext.save.inventory.items[slot] == ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[slot] == ITEM_NONE) { INV_CONTENT(value) = value; } else { Inventory_DeleteItem(value, slot); @@ -895,7 +897,7 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { if (value != 0) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); - gSaveContext.save.playerData.swordHealth = 100; + gSaveContext.save.saveInfo.playerData.swordHealth = 100; } else { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; } @@ -910,7 +912,7 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, value); CUR_FORM_EQUIP(EQUIP_SLOT_B) = value + (ITEM_SWORD_KOKIRI - 1); - gSaveContext.save.playerData.swordHealth = 100; + gSaveContext.save.saveInfo.playerData.swordHealth = 100; } Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); @@ -974,41 +976,43 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { } else if (sCurSection == INV_EDITOR_SECTION_SWAMP_GOLD_SKULLS) { // Gold Skulls (Swamp Spider House) if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - if (((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) != 0) { - gSaveContext.save.skullTokenCount = - ((u16)(((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) - 1) << 0x10) | - (gSaveContext.save.skullTokenCount & 0xFFFF); + if (((gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000) >> 0x10) != 0) { + gSaveContext.save.saveInfo.skullTokenCount = + ((u16)(((gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000) >> 0x10) - 1) << 0x10) | + (gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF); } } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - gSaveContext.save.skullTokenCount = - ((u16)(((gSaveContext.save.skullTokenCount & 0xFFFF0000) >> 0x10) + 1) << 0x10) | - (gSaveContext.save.skullTokenCount & 0xFFFF); + gSaveContext.save.saveInfo.skullTokenCount = + ((u16)(((gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000) >> 0x10) + 1) << 0x10) | + (gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF); } } else if (sCurSection == INV_EDITOR_SECTION_OCEAN_GOLD_SKULLS) { // Gold Skulls (Oceans Spider House) if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - if (((u16)gSaveContext.save.skullTokenCount) != 0) { - gSaveContext.save.skullTokenCount = (((u16)gSaveContext.save.skullTokenCount - 1) & 0xFFFF) | - (gSaveContext.save.skullTokenCount & 0xFFFF0000); + if (((u16)gSaveContext.save.saveInfo.skullTokenCount) != 0) { + gSaveContext.save.saveInfo.skullTokenCount = + (((u16)gSaveContext.save.saveInfo.skullTokenCount - 1) & 0xFFFF) | + (gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000); } } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - gSaveContext.save.skullTokenCount = (((u16)gSaveContext.save.skullTokenCount + 1) & 0xFFFF) | - (gSaveContext.save.skullTokenCount & 0xFFFF0000); + gSaveContext.save.saveInfo.skullTokenCount = + (((u16)gSaveContext.save.saveInfo.skullTokenCount + 1) & 0xFFFF) | + (gSaveContext.save.saveInfo.skullTokenCount & 0xFFFF0000); } } else if (sCurSection == INV_EDITOR_SECTION_NOTEBOOK) { // Bombers Notebook if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - gSaveContext.save.inventory.questItems ^= gBitFlags[QUEST_BOMBERS_NOTEBOOK]; + gSaveContext.save.saveInfo.inventory.questItems ^= gBitFlags[QUEST_BOMBERS_NOTEBOOK]; } } else if (sCurSection == INV_EDITOR_SECTION_LULLABY_INTRO) { // Goron Lullaby Intro if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - gSaveContext.save.inventory.questItems ^= gBitFlags[QUEST_SONG_LULLABY_INTRO]; + gSaveContext.save.saveInfo.inventory.questItems ^= gBitFlags[QUEST_SONG_LULLABY_INTRO]; } } else if (sCurSection < INV_EDITOR_SECTION_LULLABY_INTRO) { @@ -1017,7 +1021,7 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { //! have also been taken slot = sCurSection - INV_EDITOR_SECTION_BOSS; if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - gSaveContext.save.inventory.questItems ^= gBitFlags[slot]; + gSaveContext.save.saveInfo.inventory.questItems ^= gBitFlags[slot]; } } else if (sCurSection < INV_EDITOR_SECTION_DUNGEON_ITEMS) { @@ -1045,30 +1049,30 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { slot = sCurSection - INV_EDITOR_SECTION_DUNGEON_ITEMS; if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { // Map - gSaveContext.save.inventory.dungeonItems[slot] ^= 4; + gSaveContext.save.saveInfo.inventory.dungeonItems[slot] ^= 4; } if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { // Compass - gSaveContext.save.inventory.dungeonItems[slot] ^= 2; + gSaveContext.save.saveInfo.inventory.dungeonItems[slot] ^= 2; } if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { // Boss Key - gSaveContext.save.inventory.dungeonItems[slot] ^= 1; + gSaveContext.save.saveInfo.inventory.dungeonItems[slot] ^= 1; } } else if (sCurSection < INV_EDITOR_SECTION_DOUBLE_DEFENSE) { // Stray Fairies slot = sCurSection - INV_EDITOR_SECTION_STRAY_FAIRIES; if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { - gSaveContext.save.inventory.strayFairies[slot]--; - if (gSaveContext.save.inventory.strayFairies[slot] < 0) { - gSaveContext.save.inventory.strayFairies[slot] = 0; + gSaveContext.save.saveInfo.inventory.strayFairies[slot]--; + if (gSaveContext.save.saveInfo.inventory.strayFairies[slot] < 0) { + gSaveContext.save.saveInfo.inventory.strayFairies[slot] = 0; } } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - gSaveContext.save.inventory.strayFairies[slot]++; - if (gSaveContext.save.inventory.strayFairies[slot] >= 99) { - gSaveContext.save.inventory.strayFairies[slot] = 99; + gSaveContext.save.saveInfo.inventory.strayFairies[slot]++; + if (gSaveContext.save.saveInfo.inventory.strayFairies[slot] >= 99) { + gSaveContext.save.saveInfo.inventory.strayFairies[slot] = 99; } } @@ -1076,11 +1080,11 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { // Double Defence if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT) || CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { - gSaveContext.save.playerData.doubleDefense ^= 1; - if (!gSaveContext.save.playerData.doubleDefense) { - gSaveContext.save.inventory.defenseHearts = 0; + gSaveContext.save.saveInfo.playerData.doubleDefense ^= 1; + if (!gSaveContext.save.saveInfo.playerData.doubleDefense) { + gSaveContext.save.saveInfo.inventory.defenseHearts = 0; } else { - gSaveContext.save.inventory.defenseHearts = 20; + gSaveContext.save.saveInfo.inventory.defenseHearts = 20; } } } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 474180826..149b72444 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -275,7 +275,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { for (j = 0, i = 0; i < NUM_ITEM_SLOTS; i++, j += 4) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - if (((void)0, gSaveContext.save.inventory.items[i]) != ITEM_NONE) { + if (((void)0, gSaveContext.save.saveInfo.inventory.items[i]) != ITEM_NONE) { if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_ITEM) && (pauseCtx->cursorSpecialPos == 0) && gPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) { @@ -309,8 +309,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { } gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0); - KaleidoScope_DrawTexQuadRGBA32(play->state.gfxCtx, - gItemIcons[((void)0, gSaveContext.save.inventory.items[i])], 32, 32, 0); + KaleidoScope_DrawTexQuadRGBA32( + play->state.gfxCtx, gItemIcons[((void)0, gSaveContext.save.saveInfo.inventory.items[i])], 32, 32, 0); } } @@ -325,9 +325,9 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { // Loop over slots (i) and ammoIndex (j) for (j = 0, i = 0; i < NUM_ITEM_SLOTS; i++) { if (gAmmoItems[i] != ITEM_NONE) { - if (((void)0, gSaveContext.save.inventory.items[i]) != ITEM_NONE) { + if (((void)0, gSaveContext.save.saveInfo.inventory.items[i]) != ITEM_NONE) { KaleidoScope_DrawAmmoCount(pauseCtx, play->state.gfxCtx, - ((void)0, gSaveContext.save.inventory.items[i]), j); + ((void)0, gSaveContext.save.saveInfo.inventory.items[i]), j); } j++; } @@ -446,7 +446,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { } if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { - cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; + cursorItem = gSaveContext.save.saveInfo.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; } } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { @@ -459,7 +459,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { // Search for slot to move to while (true) { // Check if current cursor has an item in its slot - if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[cursorPoint] != ITEM_NONE) { pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex; @@ -497,7 +497,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { // Search for slot to move to while (true) { // Check if current cursor has an item in its slot - if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) { + if (gSaveContext.save.saveInfo.inventory.items[cursorPoint] != ITEM_NONE) { pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex; @@ -568,9 +568,9 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW; if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { - cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; + cursorItem = gSaveContext.save.saveInfo.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; } else if (moveCursorResult != PAUSE_CURSOR_RESULT_SPECIAL_POS) { - cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; + cursorItem = gSaveContext.save.saveInfo.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; } if (cursorItem == ITEM_NONE) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index 87acfaa6c..ab598723f 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -59,7 +59,7 @@ void KaleidoScope_DrawDungeonStrayFairyCount(PlayState* play) { 1 << 10); // Get digits for current number of stray fairies collected - counterDigits[1] = gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; + counterDigits[1] = gSaveContext.save.saveInfo.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex]; counterDigits[0] = counterDigits[1] / 10; counterDigits[1] -= (s16)(counterDigits[0] * 10); @@ -379,7 +379,7 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { } else if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->stickAdjY > 30)) { if (pauseCtx->cursorPoint[PAUSE_MAP] >= DUNGEON_FLOOR_INDEX_4) { for (i = pauseCtx->cursorPoint[PAUSE_MAP] - (DUNGEON_FLOOR_INDEX_4 + 1); i >= 0; i--) { - if ((gSaveContext.save.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & + if ((gSaveContext.save.saveInfo.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & gBitFlags[i]) || func_801090B0(FLOOR_INDEX_MAX - i)) { pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; @@ -400,7 +400,7 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { (pauseCtx->cursorPoint[PAUSE_MAP] <= DUNGEON_FLOOR_INDEX_1)) { for (i = pauseCtx->cursorPoint[PAUSE_MAP] - (DUNGEON_FLOOR_INDEX_4 - 1); i <= DUNGEON_FLOOR_INDEX_0; i++) { - if ((gSaveContext.save.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & + if ((gSaveContext.save.saveInfo.permanentSceneFlags[(void)0, gSaveContext.dungeonIndex].unk_14 & gBitFlags[i]) || func_801090B0(FLOOR_INDEX_MAX - i)) { pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; @@ -642,7 +642,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { // Draw clouds over the world map // Iterate over cloud bits (n) for (n = 0; n < 15; n++) { - if (!(((void)0, gSaveContext.save.worldMapCloudVisibility) & gBitFlags[n])) { + if (!(((void)0, gSaveContext.save.saveInfo.worldMapCloudVisibility) & gBitFlags[n])) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60 + n * 4], 4, 0); @@ -674,7 +674,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { sWorldMapDotEnvColors[0][2], 0); if (R_PAUSE_DBG_MAP_CLOUD_ON) { - gSaveContext.save.worldMapCloudVisibility |= (u16)~0x8000; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= (u16)~0x8000; pauseCtx->mapPageVtx[120].v.ob[0] = pauseCtx->mapPageVtx[122].v.ob[0] = R_PAUSE_DBG_MAP_CLOUD_X; @@ -706,7 +706,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); if (R_PAUSE_DBG_MAP_CLOUD_ON) { - gSaveContext.save.worldMapCloudVisibility |= (u16)~0x8000; + gSaveContext.save.saveInfo.worldMapCloudVisibility |= (u16)~0x8000; pauseCtx->mapPageVtx[164].v.ob[0] = pauseCtx->mapPageVtx[166].v.ob[0] = R_PAUSE_DBG_MAP_CLOUD_X; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index 219ecd7a9..61157ffce 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -221,7 +221,7 @@ void KaleidoScope_DrawMaskSelect(PlayState* play) { for (j = 0, i = 0; i < NUM_MASK_SLOTS; i++, j += 4) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - if (((void)0, gSaveContext.save.inventory.items[i + NUM_ITEM_SLOTS]) != ITEM_NONE) { + if (((void)0, gSaveContext.save.saveInfo.inventory.items[i + NUM_ITEM_SLOTS]) != ITEM_NONE) { if (!CHECK_GIVEN_MASK_ON_MOON(i)) { if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_MASK) && (pauseCtx->cursorSpecialPos == 0) && @@ -258,8 +258,8 @@ void KaleidoScope_DrawMaskSelect(PlayState* play) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->maskVtx[j + 0], 4, 0); KaleidoScope_DrawTexQuadRGBA32( - play->state.gfxCtx, gItemIcons[((void)0, gSaveContext.save.inventory.items[i + NUM_ITEM_SLOTS])], - 32, 32, 0); + play->state.gfxCtx, + gItemIcons[((void)0, gSaveContext.save.saveInfo.inventory.items[i + NUM_ITEM_SLOTS])], 32, 32, 0); } } } @@ -371,7 +371,8 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { } if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { - cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; + cursorItem = + gSaveContext.save.saveInfo.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) { cursorItem = ITEM_NONE; } @@ -387,7 +388,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { // Search for slot to move to while (true) { // Check if current cursor has an item in its slot - if ((gSaveContext.save.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) && + if ((gSaveContext.save.saveInfo.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) && !CHECK_GIVEN_MASK_ON_MOON(cursorPoint)) { pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex; @@ -428,7 +429,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { // Search for slot to move to while (true) { // Check if current cursor has an item in its slot - if ((gSaveContext.save.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) && + if ((gSaveContext.save.saveInfo.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) && !CHECK_GIVEN_MASK_ON_MOON(cursorPoint)) { pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex; @@ -500,12 +501,14 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW; if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { - cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; + cursorItem = + gSaveContext.save.saveInfo.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) { cursorItem = ITEM_NONE; } } else if (moveCursorResult != PAUSE_CURSOR_RESULT_SPECIAL_POS) { - cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; + cursorItem = + gSaveContext.save.saveInfo.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) { cursorItem = ITEM_NONE; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index 721ca7a18..1377f287f 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -811,7 +811,7 @@ void KaleidoScope_Update(PlayState* play) { } else { play_sound(NA_SE_SY_PIECE_OF_HEART); Play_SaveCycleSceneFlags(&play->state); - gSaveContext.save.playerData.savedSceneId = play->sceneId; + gSaveContext.save.saveInfo.playerData.savedSceneId = play->sceneId; func_8014546C(sramCtx); if (gSaveContext.unk_3F3F == 0) { pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_5; @@ -1072,8 +1072,8 @@ void KaleidoScope_Update(PlayState* play) { play_sound(NA_SE_SY_PIECE_OF_HEART); pauseCtx->promptChoice = PAUSE_PROMPT_YES; Play_SaveCycleSceneFlags(&play->state); - gSaveContext.save.playerData.savedSceneId = play->sceneId; - gSaveContext.save.playerData.health = 0x30; + gSaveContext.save.saveInfo.playerData.savedSceneId = play->sceneId; + gSaveContext.save.saveInfo.playerData.health = 0x30; func_8014546C(sramCtx); if (gSaveContext.unk_3F3F == 0) { pauseCtx->state = PAUSE_STATE_GAMEOVER_8; @@ -1145,15 +1145,15 @@ void KaleidoScope_Update(PlayState* play) { func_80169FDC(&play->state); gSaveContext.respawnFlag = -2; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; - gSaveContext.save.playerData.health = 0x30; + gSaveContext.save.saveInfo.playerData.health = 0x30; Audio_SetSpec(0xA); gSaveContext.healthAccumulator = 0; gSaveContext.magicState = MAGIC_STATE_IDLE; gSaveContext.magicFlag = 0; gSaveContext.magicCapacity = 0; - gSaveContext.magicFillTarget = gSaveContext.save.playerData.magic; - gSaveContext.save.playerData.magicLevel = 0; - gSaveContext.save.playerData.magic = 0; + gSaveContext.magicFillTarget = gSaveContext.save.saveInfo.playerData.magic; + gSaveContext.save.saveInfo.playerData.magicLevel = 0; + gSaveContext.save.saveInfo.playerData.magic = 0; } else { // PAUSE_PROMPT_NO STOP_GAMESTATE(&play->state); SET_NEXT_GAMESTATE(&play->state, TitleSetup_Init, sizeof(TitleSetupState)); diff --git a/tools/namefixer.py b/tools/namefixer.py index 7a88f79d9..ad78411f8 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -761,41 +761,41 @@ wordReplace = { "gSaveContext.unk_3F22": "gSaveContext.hudVisibility", "gSaveContext.unk_3F24": "gSaveContext.hudVisibilityTimer", "gSaveContext.unk_3F26": "gSaveContext.prevHudVisibility", - "gSaveContext.weekEventReg": "gSaveContext.save.weekEventReg", + "gSaveContext.weekEventReg": "gSaveContext.save.saveInfo.weekEventReg", "gSaveContext.playerForm": "gSaveContext.save.playerForm", "gSaveContext.day": "gSaveContext.save.day", "gSaveContext.isNight": "gSaveContext.save.isNight", "gSaveContext.environmentTime": "gSaveContext.skyboxTime", - "gSaveContext.naviTimer": "gSaveContext.save.playerData.tatlTimer", - "gSaveContext.tatlTimer": "gSaveContext.save.playerData.tatlTimer", - "gSaveContext.rupees": "gSaveContext.save.playerData.rupees", - "gSaveContext.magicAcquired": "gSaveContext.save.playerData.isMagicAcquired", - "gSaveContext.doubleMagic": "gSaveContext.save.playerData.isDoubleMagicAcquired", - "gSaveContext.doubleDefense": "gSaveContext.save.playerData.doubleDefense", - "gSaveContext.playerName": "gSaveContext.save.playerData.playerName", - "gSaveContext.inventory": "gSaveContext.save.inventory", + "gSaveContext.naviTimer": "gSaveContext.save.saveInfo.playerData.tatlTimer", + "gSaveContext.tatlTimer": "gSaveContext.save.saveInfo.playerData.tatlTimer", + "gSaveContext.rupees": "gSaveContext.save.saveInfo.playerData.rupees", + "gSaveContext.magicAcquired": "gSaveContext.save.saveInfo.playerData.isMagicAcquired", + "gSaveContext.doubleMagic": "gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired", + "gSaveContext.doubleDefense": "gSaveContext.save.saveInfo.playerData.doubleDefense", + "gSaveContext.playerName": "gSaveContext.save.saveInfo.playerData.playerName", + "gSaveContext.inventory": "gSaveContext.save.saveInfo.inventory", "gSaveContext.equippedMask": "gSaveContext.save.equippedMask", "gSaveContext.entranceIndex": "gSaveContext.save.entrance", "gSaveContext.time": "gSaveContext.save.time", "gSaveContext.save.daySpeed": "gSaveContext.save.timeSpeedOffset", "gSaveContext.unk_14": "gSaveContext.save.timeSpeedOffset", - "gSaveContext.unk_FE6": "gSaveContext.save.bombersCaughtNum", - "gSaveContext.unk_FE7": "gSaveContext.save.bombersCaughtOrder", + "gSaveContext.unk_FE6": "gSaveContext.save.saveInfo.bombersCaughtNum", + "gSaveContext.unk_FE7": "gSaveContext.save.saveInfo.bombersCaughtOrder", "gSaveContext.linkAge": "gSaveContext.save.linkAge", - "gSaveContext.dekuPlaygroundHighScores": "gSaveContext.save.dekuPlaygroundHighScores", - "gSaveContext.lotteryCodeGuess": "gSaveContext.save.lotteryCodeGuess", - "gSaveContext.permanentSceneFlags": "gSaveContext.save.permanentSceneFlags", - "gSaveContext.bomberCode": "gSaveContext.save.bomberCode", - "gSaveContext.skullTokenCount": "gSaveContext.save.skullTokenCount", + "gSaveContext.dekuPlaygroundHighScores": "gSaveContext.save.saveInfo.dekuPlaygroundHighScores", + "gSaveContext.lotteryCodeGuess": "gSaveContext.save.saveInfo.lotteryCodeGuess", + "gSaveContext.permanentSceneFlags": "gSaveContext.save.saveInfo.permanentSceneFlags", + "gSaveContext.bomberCode": "gSaveContext.save.saveInfo.bomberCode", + "gSaveContext.skullTokenCount": "gSaveContext.save.saveInfo.skullTokenCount", "gSaveContext.cutscene": "gSaveContext.save.cutscene", - "gSaveContext.health": "gSaveContext.save.playerData.health", - "gSaveContext.equips": "gSaveContext.save.equips", + "gSaveContext.health": "gSaveContext.save.saveInfo.playerData.health", + "gSaveContext.equips": "gSaveContext.save.saveInfo.equips", "gSaveContext.unk_1016": "gSaveContext.jinxTimer", "gSaveContext.unk_3F58": "gSaveContext.sunsSongState", "gSaveContext.equips.buttonItems": "gSaveContext.save.equips.buttonItems", "gSaveContext.unk_48C8": "gSaveContext.dungeonIndex", - "gSaveContext.save.playerData.magicAcquired": "gSaveContext.save.playerData.isMagicAcquired", - "gSaveContext.save.playerDatadoubleMagic": "gSaveContext.save.playerData.isDoubleMagicAcquired", + "gSaveContext.save.saveInfo.playerData.magicAcquired": "gSaveContext.save.saveInfo.playerData.isMagicAcquired", + "gSaveContext.save.playerDatadoubleMagic": "gSaveContext.save.saveInfo.playerData.isDoubleMagicAcquired", "gSaveContext.unk_3F28": "gSaveContext.magicState", "gSaveContext.unk_3F30": "gSaveContext.magicFillTarget", "gSaveContext.unk_3F2C": "gSaveContext.magicFlag", @@ -805,6 +805,44 @@ wordReplace = { "gSaveContext.nightSeqIndex": "gSaveContext.ambienceId", "gSaveContext.minigameState": "gSaveContext.minigameStatus", "gSaveContext.unk_3F3C": "gSaveContext.minigameHiddenScore", + "gSaveContext.save.playerData": "gSaveContext.save.saveInfo.playerData", + "gSaveContext.save.equips": "gSaveContext.save.saveInfo.equips", + "gSaveContext.save.inventory": "gSaveContext.save.saveInfo.inventory", + "gSaveContext.save.permanentSceneFlags": "gSaveContext.save.saveInfo.permanentSceneFlags", + + "gSaveContext.save.unk_E18": "gSaveContext.save.saveInfo.unk_E5C", + "gSaveContext.save.dekuPlaygroundHighScores": "gSaveContext.save.saveInfo.dekuPlaygroundHighScores", + "gSaveContext.save.pictoFlags0": "gSaveContext.save.saveInfo.pictoFlags0", + "gSaveContext.save.pictoFlags1": "gSaveContext.save.saveInfo.pictoFlags1", + "gSaveContext.save.unk_E84": "gSaveContext.save.saveInfo.unk_E60", + "gSaveContext.save.unk_E88": "gSaveContext.save.saveInfo.unk_E64", + "gSaveContext.save.scenesVisible": "gSaveContext.save.saveInfo.scenesVisible", + "gSaveContext.save.skullTokenCount": "gSaveContext.save.saveInfo.skullTokenCount", + "gSaveContext.save.unk_EC4": "gSaveContext.save.saveInfo.unk_EA0", + "gSaveContext.save.unk_EC8": "gSaveContext.save.saveInfo.unk_EA4", + "gSaveContext.save.unk_ECC": "gSaveContext.save.saveInfo.unk_EA8", + "gSaveContext.save.stolenItems": "gSaveContext.save.saveInfo.stolenItems", + "gSaveContext.save.unk_DD8": "gSaveContext.save.saveInfo.unk_EB4", + "gSaveContext.save.bankRupees": "gSaveContext.save.saveInfo.bankRupees", + "gSaveContext.save.unk_EE0": "gSaveContext.save.saveInfo.unk_EBC", + "gSaveContext.save.unk_EE4": "gSaveContext.save.saveInfo.unk_EC0", + "gSaveContext.save.unk_EE8": "gSaveContext.save.saveInfo.unk_EC4", + "gSaveContext.save.horseBackBalloonHighScore": "gSaveContext.save.saveInfo.horseBackBalloonHighScore", + "gSaveContext.save.lotteryCodeGuess": "gSaveContext.save.saveInfo.lotteryCodeGuess", + "gSaveContext.save.shootingGalleryHighScores": "gSaveContext.save.saveInfo.shootingGalleryHighScores", + "gSaveContext.save.weekEventReg": "gSaveContext.save.saveInfo.weekEventReg", + "gSaveContext.save.regionsVisited": "gSaveContext.save.saveInfo.regionsVisited", + "gSaveContext.save.worldMapCloudVisibility": "gSaveContext.save.saveInfo.worldMapCloudVisibility", + "gSaveContext.save.unk_F64": "gSaveContext.save.saveInfo.unk_F40", + "gSaveContext.save.unk_F65": "gSaveContext.save.saveInfo.unk_F41", + "gSaveContext.save.scarecrowSpawnSong": "gSaveContext.save.saveInfo.scarecrowSpawnSong", + "gSaveContext.save.bombersCaughtNum": "gSaveContext.save.saveInfo.bombersCaughtNum", + "gSaveContext.save.bombersCaughtOrder": "gSaveContext.save.saveInfo.bombersCaughtOrder", + "gSaveContext.save.lotteryCodes": "gSaveContext.save.saveInfo.lotteryCodes", + "gSaveContext.save.spiderHouseMaskOrder": "gSaveContext.save.saveInfo.spiderHouseMaskOrder", + "gSaveContext.save.bomberCode": "gSaveContext.save.saveInfo.bomberCode", + "gSaveContext.save.horseData": "gSaveContext.save.saveInfo.horseData", + "gSaveContext.save.checksum": "gSaveContext.save.saveInfo.checksum", "player->unk_A87": "player->exchangeItemId", "player->leftHandActor": "player->heldActor", diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py index 02a3e4a42..071907058 100755 --- a/tools/weekeventregconvert.py +++ b/tools/weekeventregconvert.py @@ -843,20 +843,20 @@ def applyChange(fileContents: str, compiledRegex: re.Pattern, callback) -> str: def updateCheck(fileContents: str) -> str: - # gSaveContext.save.weekEventReg[86] & 2 - checkRegex = re.compile(rf"gSaveContext.save.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\&\s*(?P{NUMBER_PATTERN})") + # gSaveContext.save.saveInfo.weekEventReg[86] & 2 + checkRegex = re.compile(rf"gSaveContext.save.saveInfo.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\&\s*(?P{NUMBER_PATTERN})") return applyChange(fileContents, checkRegex, getCheckMacro) def updateSet(fileContents: str) -> str: - # gSaveContext.save.weekEventReg[51] |= 0x10 - setRegex = re.compile(rf"gSaveContext.save.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\|=\s*(?P{NUMBER_PATTERN})") + # gSaveContext.save.saveInfo.weekEventReg[51] |= 0x10 + setRegex = re.compile(rf"gSaveContext.save.saveInfo.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\|=\s*(?P{NUMBER_PATTERN})") return applyChange(fileContents, setRegex, getSetMacro) def updateClear(fileContents: str) -> str: - # gSaveContext.save.weekEventReg[85] &= (u8)~0x80 - clearRegex = re.compile(rf"gSaveContext.save.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\&=\s*(\(u8\))?~(?P{NUMBER_PATTERN})") + # gSaveContext.save.saveInfo.weekEventReg[85] &= (u8)~0x80 + clearRegex = re.compile(rf"gSaveContext.save.saveInfo.weekEventReg\[(?P{NUMBER_PATTERN})\]\s*\&=\s*(\(u8\))?~(?P{NUMBER_PATTERN})") return applyChange(fileContents, clearRegex, getClearMacro) From f9c638117c0b5f9559ee8952fe459cac178bc73c Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Tue, 18 Apr 2023 22:38:22 -0400 Subject: [PATCH 25/29] Rename `LinkAnimation` to `DmaAnimation` and other `skelanime` misc cleanups (#1147) * Rename LinkAnimation to PlayerAnimation * remove the remaining link stuff * Move functions out of functions.h * cleanup returns * more cleanups * format * format again * format again again * Remove internal functions from header * legacy * bss * linkAnimSegment * Update src/overlays/actors/ovl_En_Yb/z_en_yb.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * bss * `DmaAnimation` rename * more DMA i missed * Revert "more DMA i missed" This reverts commit 6c0ca44f450c92d8c12374fa243c8b17d46527d3. * Revert "`DmaAnimation` rename" This reverts commit 1d2626514c94158001566fa664222b0dcf34a4f7. * Add LinkAnimationHeader rename to namefixer.py --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- include/functions.h | 91 +------- include/z64.h | 3 +- include/z64animation.h | 113 +++++++--- include/z64animation_legacy.h | 36 ++++ include/z64player.h | 18 +- src/code/z_skelanime.c | 199 ++++++++++-------- src/overlays/actors/ovl_En_Rz/z_en_rz.c | 16 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 2 +- src/overlays/actors/ovl_En_Yb/z_en_yb.c | 21 +- tools/disasm/functions.txt | 48 ++--- tools/namefixer.py | 66 ++---- tools/sizes/code_functions.csv | 44 ++-- 12 files changed, 323 insertions(+), 334 deletions(-) create mode 100644 include/z64animation_legacy.h diff --git a/include/functions.h b/include/functions.h index 3850ab42e..c45f57928 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1828,96 +1828,9 @@ s32 Entrance_GetSceneId(u16 entrance); s32 Entrance_GetSceneIdAbsolute(u16 entrance); s32 Entrance_GetSpawnNum(u16 entrance); s32 Entrance_GetTransitionFlags(u16 entrance); + s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleOutput* output); -void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); -void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod); -void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod, Mtx** mtx); -void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod); -void SkelAnime_DrawLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); -void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); -void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, Mtx** limbMatricies); -void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor); -void SkelAnime_DrawTransformFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor, Mtx** mtx); -void SkelAnime_DrawTransformFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor); -void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); -s16 Animation_GetLength(void* animation); -s16 Animation_GetLastFrame(void* animation); -Gfx* SkelAnime_DrawLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); -Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); -Gfx* SkelAnime_DrawFlexLimb(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx); -Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, Gfx* gfx); -s16 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Vec3s* frameTable); -s16 Animation_GetLimbCount2(LegacyAnimationHeader* animation); -s16 Animation_GetLength2(LegacyAnimationHeader* animation); -s16 Animation_GetLastFrame2(LegacyAnimationHeader* animation); -void SkelAnime_InterpFrameTable(s32 limbCount, Vec3s* dst, Vec3s* start, Vec3s* target, f32 weight); -void AnimationContext_Reset(AnimationContext* animationCtx); -void AnimationContext_SetNextQueue(PlayState* play); -void AnimationContext_DisableQueue(PlayState* play); -AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, AnimationType type); -void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); -void AnimationContext_SetCopyAll(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src); -void AnimationContext_SetInterp(PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight); -void AnimationContext_SetCopyTrue(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); -void AnimationContext_SetCopyFalse(PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); -void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* skelAnime, f32 arg3); -void AnimationContext_LoadFrame(PlayState* play, AnimationEntryData* data); -void AnimationContext_CopyAll(PlayState* play, AnimationEntryData* data); -void AnimationContext_Interp(PlayState* play, AnimationEntryData* data); -void AnimationContext_CopyTrue(PlayState* play, AnimationEntryData* data); -void AnimationContext_CopyFalse(PlayState* play, AnimationEntryData* data); -void AnimationContext_MoveActor(PlayState* play, AnimationEntryData* data); -void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx); -void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, LinkAnimationHeader* animation, s32 flags, void* jointTableBuffer, void* morphTableBuffer, s32 limbBufCount); -void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime); -s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime); -s32 LinkAnimation_Morph(PlayState* play, SkelAnime* skelAnime); -void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime); -s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime); -s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime); -void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames); -void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); -void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); -void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); -void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation); -void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed); -void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime); -void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime); -void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame); -void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight); -void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer); -void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer); -void LinkAnimation_EndLoop(SkelAnime* skelAnime); -s32 Animation_OnFrameImpl(SkelAnime* skelAnime, f32 frame, f32 updateRate); -s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); -void SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -void SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation); -void SkelAnime_SetUpdate(SkelAnime* skelAnime); -s32 SkelAnime_Update(SkelAnime* skelAnime); -s32 SkelAnime_Morph(SkelAnime* skelAnime); -s32 SkelAnime_MorphTaper(SkelAnime* skelAnime); -void SkelAnime_AnimateFrame(SkelAnime* skelAnime); -s32 SkelAnime_LoopFull(SkelAnime* skelAnime); -s32 SkelAnime_LoopPartial(SkelAnime* skelAnime); -s32 SkelAnime_Once(SkelAnime* skelAnime); -void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames, s8 taper); -void Animation_Change(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); -void Animation_PlayOnce(SkelAnime* skelAnime, AnimationHeader* animation); -void Animation_MorphToPlayOnce(SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames); -void Animation_PlayOnceSetSpeed(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed); -void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animation); -void Animation_MorphToLoop(SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames); -void Animation_PlayLoopSetSpeed(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed); -void Animation_EndLoop(SkelAnime* skelAnime); -void Animation_Reverse(SkelAnime* skelAnime); -void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); -void SkelAnime_CopyFrameTableFalse(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); -void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle); -s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame); -void SkelAnime_Free(SkelAnime* skelAnime, PlayState* play); -void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); + void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); void SkinMatrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest); diff --git a/include/z64.h b/include/z64.h index f7c4ad29b..959f195ba 100644 --- a/include/z64.h +++ b/include/z64.h @@ -30,6 +30,7 @@ #include "thga.h" #include "z64actor.h" #include "z64animation.h" +#include "z64animation_legacy.h" #include "z64audio.h" #include "z64bgcheck.h" #include "z64camera.h" @@ -645,7 +646,7 @@ typedef struct PlayState { /* 0x1878C */ void (*unk_1878C)(struct PlayState* play); /* 0x18790 */ void (*unk_18790)(struct PlayState* play, s16 arg1); /* 0x18794 */ PlayerItemAction (*unk_18794)(struct PlayState* play, Player* player, ItemId itemId); - /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct PlayState* play, LinkAnimationHeader* talkAnim, s32 animMode); + /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct PlayState* play, PlayerAnimationHeader* talkAnim, s32 animMode); /* 0x1879C */ s16 playerActorCsIds[10]; /* 0x187B0 */ MtxF viewProjectionMtxF; /* 0x187F0 */ Vec3f projectionMtxFDiagonal; diff --git a/include/z64animation.h b/include/z64animation.h index 0e8eb9fcb..4dd808af8 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -11,10 +11,7 @@ struct Actor; struct SkelAnime; struct PlayerAnimationFrame; -#define LINK_ANIMETION_OFFSET(addr, offset) \ - (SEGMENT_ROM_START(link_animetion) + ((uintptr_t)addr & 0xFFFFFF) + ((u32)offset)) #define LIMB_DONE 0xFF -#define ANIMATION_ENTRY_MAX 50 #define ANIM_FLAG_1 (1 << 0) #define ANIM_FLAG_UPDATEY (1 << 1) @@ -82,35 +79,19 @@ typedef struct { /* 0xC */ u16 staticIndexMax; } AnimationHeader; // size = 0x10 -typedef struct { - /* 0x00 */ s16 xMax; - /* 0x02 */ s16 x; - /* 0x04 */ s16 yMax; - /* 0x06 */ s16 y; - /* 0x08 */ s16 zMax; - /* 0x10 */ s16 z; -} JointKey; // size = 0x12 - -typedef struct { - /* 0x0 */ s16 frameCount; - /* 0x2 */ s16 limbCount; - /* 0x4 */ s16* frameData; - /* 0x8 */ JointKey* jointKey; -} LegacyAnimationHeader; // size = 0xC - typedef enum { - ANIMATION_LINKANIMETION, - ANIMENTRY_COPYALL, - ANIMENTRY_INTERP, - ANIMENTRY_COPYTRUE, - ANIMENTRY_COPYFALSE, - ANIMENTRY_MOVEACTOR + /* 0 */ ANIMATION_LINKANIMETION, + /* 1 */ ANIMENTRY_COPYALL, + /* 2 */ ANIMENTRY_INTERP, + /* 3 */ ANIMENTRY_COPYTRUE, + /* 4 */ ANIMENTRY_COPYFALSE, + /* 5 */ ANIMENTRY_MOVEACTOR } AnimationType; typedef struct { /* 0x00 */ DmaRequest req; /* 0x20 */ OSMesgQueue msgQueue; - /* 0x38 */ OSMesg msg; + /* 0x38 */ OSMesg msg[1]; } AnimEntryLoadFrame; // size = 0x3C typedef struct { @@ -166,16 +147,16 @@ typedef struct { typedef struct AnimationContext { /* 0x000 */ s16 animationCount; - /* 0x004 */ AnimationEntry entries[ANIMATION_ENTRY_MAX]; + /* 0x004 */ AnimationEntry entries[50]; } AnimationContext; // size = 0xC84 typedef struct { /* 0x0 */ AnimationHeaderCommon common; /* 0x4 */ union { void* segmentVoid; - struct PlayerAnimationFrame* segment; + struct PlayerAnimationFrame* linkAnimSegment; }; -} LinkAnimationHeader; // size = 0x8 +} PlayerAnimationHeader; // size = 0x8 typedef struct SkelAnime { /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton @@ -183,7 +164,7 @@ typedef struct SkelAnime { /* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton /* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1. /* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb. - /* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader. + /* 0x08 */ void* animation; // Can be an AnimationHeader or PlayerAnimationHeader. /* 0x0C */ f32 startFrame; // In mode 4, start of partial loop. /* 0x10 */ f32 endFrame; // In mode 2, Update returns true when curFrame is equal to this. In mode 4, end of partial loop. /* 0x14 */ f32 animLength; // Total number of frames in the current animation's file. @@ -195,10 +176,10 @@ typedef struct SkelAnime { /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph /* 0x30 */ union { s32 (*normal)(struct SkelAnime*);// Can be Loop, Partial loop, Play once, Morph, or Tapered morph - s32 (*link)(struct PlayState*, struct SkelAnime*); // Loop, Play once, and Morph + s32 (*player)(struct PlayState*, struct SkelAnime*); // Loop, Play once, and Morph } update; - /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton - /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. + /* 0x34 */ s8 initFlags; // Flags used when initializing Player's skeleton + /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. /* 0x36 */ s16 prevRot; // Previous rotation in worldspace. /* 0x38 */ Vec3s prevTransl; // Previous modelspace translation. /* 0x3E */ Vec3s baseTransl; // Base modelspace translation. @@ -228,8 +209,6 @@ typedef void (*TransformLimbDraw)(struct PlayState* play, s32 limbIndex, struct typedef void (*AnimationEntryCallback)(struct PlayState*, AnimationEntryData*); -extern u32 link_animetion_segment; - typedef struct { /* 0x00 */ AnimationHeader* animation; /* 0x04 */ f32 playSpeed; @@ -324,4 +303,68 @@ typedef s32 (*OverrideKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* typedef void (*PostKeyframeDrawScaled)(struct PlayState* play, SkeletonInfo* skeleton, s32 limbIndex, Gfx** dList, u8* flags, struct Actor* actor, Vec3f* scale, Vec3s* rot, Vec3f* pos); +void SkelAnime_DrawLod(struct PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, struct Actor* actor, s32 lod); +void SkelAnime_DrawFlexLod(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, struct Actor* actor, s32 lod); +void SkelAnime_DrawOpa(struct PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, struct Actor* actor); +void SkelAnime_DrawFlexOpa(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, struct Actor* actor); +void SkelAnime_DrawTransformFlexOpa(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, struct Actor* actor); +s16 Animation_GetLastFrame(void* animation); +Gfx* SkelAnime_Draw(struct PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, struct Actor* actor, Gfx* gfx); +Gfx* SkelAnime_DrawFlex(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, struct Actor* actor, Gfx* gfx); + +void AnimationContext_Reset(AnimationContext* animationCtx); +void AnimationContext_SetNextQueue(struct PlayState* play); +void AnimationContext_DisableQueue(struct PlayState* play); +void AnimationContext_SetLoadFrame(struct PlayState* play, PlayerAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable); +void AnimationContext_SetCopyAll(struct PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src); +void AnimationContext_SetInterp(struct PlayState* play, s32 vecCount, Vec3s* base, Vec3s* mod, f32 weight); +void AnimationContext_SetCopyTrue(struct PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); +void AnimationContext_SetCopyFalse(struct PlayState* play, s32 vecCount, Vec3s* dst, Vec3s* src, u8* copyFlag); +void AnimationContext_SetMoveActor(struct PlayState* play, struct Actor* actor, SkelAnime* skelAnime, f32 arg3); + +void AnimationContext_Update(struct PlayState* play, AnimationContext* animationCtx); +void SkelAnime_InitPlayer(struct PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, PlayerAnimationHeader* animation, s32 flags, void* jointTableBuffer, void* morphTableBuffer, s32 limbBufCount); +void PlayerAnimation_SetUpdateFunction(SkelAnime* skelAnime); +s32 PlayerAnimation_Update(struct PlayState* play, SkelAnime* skelAnime); +void Animation_SetMorph(struct PlayState* play, SkelAnime* skelAnime, f32 morphFrames); +void PlayerAnimation_Change(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); +void PlayerAnimation_PlayOnce(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation); +void PlayerAnimation_PlayOnceSetSpeed(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 playSpeed); +void PlayerAnimation_PlayLoop(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation); +void PlayerAnimation_PlayLoopSetSpeed(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 playSpeed); +void PlayerAnimation_CopyJointToMorph(struct PlayState* play, SkelAnime* skelAnime); +void PlayerAnimation_CopyMorphToJoint(struct PlayState* play, SkelAnime* skelAnime); +void PlayerAnimation_LoadToMorph(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 frame); +void PlayerAnimation_LoadToJoint(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 frame); +void PlayerAnimation_InterpJointMorph(struct PlayState* play, SkelAnime* skelAnime, f32 weight); +void PlayerAnimation_BlendToJoint(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation1, f32 frame1, PlayerAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer); +void PlayerAnimation_BlendToMorph(struct PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation1, f32 frame1, PlayerAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer); +void PlayerAnimation_EndLoop(SkelAnime* skelAnime); +s32 PlayerAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); + +void SkelAnime_Init(struct PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); +void SkelAnime_InitFlex(struct PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); +void SkelAnime_InitSkin(struct GameState* gameState, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation); + +s32 SkelAnime_Update(SkelAnime* skelAnime); +void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames, s8 taper); +void Animation_Change(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed, f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); +void Animation_PlayOnce(SkelAnime* skelAnime, AnimationHeader* animation); +void Animation_MorphToPlayOnce(SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames); +void Animation_PlayOnceSetSpeed(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed); +void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animation); +void Animation_MorphToLoop(SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames); +void Animation_PlayLoopSetSpeed(SkelAnime* skelAnime, AnimationHeader* animation, f32 playSpeed); +void Animation_EndLoop(SkelAnime* skelAnime); +void Animation_Reverse(SkelAnime* skelAnime); +void SkelAnime_CopyFrameTableTrue(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); +void SkelAnime_CopyFrameTableFalse(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* copyFlag); +void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle); +s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame); +void SkelAnime_Free(SkelAnime* skelAnime, struct PlayState* play); + +// ZAPD compatibility typedefs +// TODO: Remove when ZAPD adds support for them +typedef PlayerAnimationHeader LinkAnimationHeader; + #endif diff --git a/include/z64animation_legacy.h b/include/z64animation_legacy.h new file mode 100644 index 000000000..238939f74 --- /dev/null +++ b/include/z64animation_legacy.h @@ -0,0 +1,36 @@ +#ifndef Z64_ANIMATION_LEGACY_H +#define Z64_ANIMATION_LEGACY_H + +#include "ultra64.h" +#include "z64math.h" + +typedef struct LegacyLimb { + /* 0x00 */ Gfx* dList; + /* 0x04 */ Vec3f trans; + /* 0x10 */ Vec3s rot; + /* 0x18 */ struct LegacyLimb* sibling; + /* 0x1C */ struct LegacyLimb* child; +} LegacyLimb; // size = 0x20 + +typedef struct { + /* 0x00 */ s16 xMax; + /* 0x02 */ s16 x; + /* 0x04 */ s16 yMax; + /* 0x06 */ s16 y; + /* 0x08 */ s16 zMax; + /* 0x10 */ s16 z; +} LegacyJointKey; // size = 0x12 + +typedef struct { + /* 0x0 */ s16 frameCount; + /* 0x2 */ s16 limbCount; + /* 0x4 */ s16* frameData; + /* 0x8 */ LegacyJointKey* jointKey; +} LegacyAnimationHeader; // size = 0xC + +s16 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Vec3s* frameTable); +s16 Animation_GetLimbCountLegacy(LegacyAnimationHeader* animation); +s16 Animation_GetLengthLegacy(LegacyAnimationHeader* animation); +s16 Animation_GetLastFrameLegacy(LegacyAnimationHeader* animation); + +#endif diff --git a/include/z64player.h b/include/z64player.h index 456eba3eb..f1d1f75e4 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -399,15 +399,15 @@ typedef struct PlayerAgeProperties { /* 0x94 */ u16 surfaceSfxIdOffset; /* 0x98 */ f32 unk_98; /* 0x9C */ f32 unk_9C; - /* 0xA0 */ LinkAnimationHeader* unk_A0; - /* 0xA4 */ LinkAnimationHeader* unk_A4; - /* 0xA8 */ LinkAnimationHeader* unk_A8; - /* 0xAC */ LinkAnimationHeader* unk_AC; - /* 0xB0 */ LinkAnimationHeader* unk_B0; - /* 0xB4 */ LinkAnimationHeader* unk_B4[4]; - /* 0xC4 */ LinkAnimationHeader* unk_C4[2]; - /* 0xCC */ LinkAnimationHeader* unk_CC[2]; - /* 0xD4 */ LinkAnimationHeader* unk_D4[2]; + /* 0xA0 */ PlayerAnimationHeader* unk_A0; + /* 0xA4 */ PlayerAnimationHeader* unk_A4; + /* 0xA8 */ PlayerAnimationHeader* unk_A8; + /* 0xAC */ PlayerAnimationHeader* unk_AC; + /* 0xB0 */ PlayerAnimationHeader* unk_B0; + /* 0xB4 */ PlayerAnimationHeader* unk_B4[4]; + /* 0xC4 */ PlayerAnimationHeader* unk_C4[2]; + /* 0xCC */ PlayerAnimationHeader* unk_CC[2]; + /* 0xD4 */ PlayerAnimationHeader* unk_D4[2]; } PlayerAgeProperties; // size = 0xDC typedef struct { diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 9890f4741..cf7f95078 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -3,17 +3,24 @@ #define ANIM_INTERP 1 -s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime); -s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime); +s32 PlayerAnimation_Loop(PlayState* play, SkelAnime* skelAnime); +s32 PlayerAnimation_Once(PlayState* play, SkelAnime* skelAnime); s32 SkelAnime_LoopFull(SkelAnime* skelAnime); s32 SkelAnime_LoopPartial(SkelAnime* skelAnime); s32 SkelAnime_Once(SkelAnime* skelAnime); void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animation); void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle); -void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, - f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); +void PlayerAnimation_Change(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 playSpeed, + f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames); void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); +void AnimationContext_LoadFrame(struct PlayState* play, AnimationEntryData* data); +void AnimationContext_CopyAll(struct PlayState* play, AnimationEntryData* data); +void AnimationContext_Interp(struct PlayState* play, AnimationEntryData* data); +void AnimationContext_CopyTrue(struct PlayState* play, AnimationEntryData* data); +void AnimationContext_CopyFalse(struct PlayState* play, AnimationEntryData* data); +void AnimationContext_MoveActor(struct PlayState* play, AnimationEntryData* data); + static AnimationEntryCallback sAnimationLoadDone[] = { AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp, AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor, @@ -44,7 +51,7 @@ void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3 pos.z = limb->jointPos.z; dList = limb->dLists[lod]; - if ((overrideLimbDraw == NULL) || (overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, actor) == 0)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, limbIndex, &dList, &pos, &rot, actor)) { Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { Gfx* polyTemp = POLY_OPA_DISP; @@ -876,7 +883,7 @@ Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32 s16 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Vec3s* frameTable) { LegacyAnimationHeader* animHeader = Lib_SegmentedToVirtual(animation); s16 limbCount = animHeader->limbCount; - JointKey* key = Lib_SegmentedToVirtual(animHeader->jointKey); + LegacyJointKey* key = Lib_SegmentedToVirtual(animHeader->jointKey); s16* frameData = Lib_SegmentedToVirtual(animHeader->frameData); s16* staticData = &frameData[0]; s16* dynamicData = &frameData[frame]; @@ -901,7 +908,7 @@ s16 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Ve /** * Used by legacy animation format */ -s16 Animation_GetLimbCount2(LegacyAnimationHeader* animation) { +s16 Animation_GetLimbCountLegacy(LegacyAnimationHeader* animation) { LegacyAnimationHeader* animHeader = Lib_SegmentedToVirtual(animation); return animHeader->limbCount; @@ -910,7 +917,7 @@ s16 Animation_GetLimbCount2(LegacyAnimationHeader* animation) { /** * Used by legacy animation format */ -s16 Animation_GetLength2(LegacyAnimationHeader* animation) { +s16 Animation_GetLengthLegacy(LegacyAnimationHeader* animation) { LegacyAnimationHeader* animHeader = Lib_SegmentedToVirtual(animation); return animHeader->frameCount; @@ -919,7 +926,7 @@ s16 Animation_GetLength2(LegacyAnimationHeader* animation) { /** * Used by legacy animation format */ -s16 Animation_GetLastFrame2(LegacyAnimationHeader* animation) { +s16 Animation_GetLastFrameLegacy(LegacyAnimationHeader* animation) { AnimationHeaderCommon* animHeader = Lib_SegmentedToVirtual(animation); return animHeader->frameCount - 1; @@ -979,7 +986,7 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat AnimationEntry* entry; s16 index = animationCtx->animationCount; - if (index >= ANIMATION_ENTRY_MAX) { + if (index >= ARRAY_COUNT(animationCtx->entries)) { return NULL; } @@ -989,21 +996,25 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat return entry; } +#define LINK_ANIMETION_OFFSET(addr, offset) \ + (SEGMENT_ROM_START(link_animetion) + ((uintptr_t)addr & 0xFFFFFF) + ((u32)offset)) + /** - * Requests loading frame data from the Link animation into frameTable + * Requests loading frame data from the Player animation into frameTable */ -void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, +void AnimationContext_SetLoadFrame(PlayState* play, PlayerAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable) { AnimationEntry* entry = AnimationContext_AddEntry(&play->animationCtx, ANIMATION_LINKANIMETION); if (entry != NULL) { - LinkAnimationHeader* linkAnimHeader = Lib_SegmentedToVirtual(animation); - uintptr_t ram = frameTable; + PlayerAnimationHeader* playerAnimHeader = Lib_SegmentedToVirtual(animation); + void* ram = (void*)frameTable; - osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1); - DmaMgr_SendRequestImpl(&entry->data.load.req, ram, - LINK_ANIMETION_OFFSET(linkAnimHeader->segment, (sizeof(Vec3s) * limbCount + 2) * frame), - sizeof(Vec3s) * limbCount + 2, 0, &entry->data.load.msgQueue, NULL); + osCreateMesgQueue(&entry->data.load.msgQueue, entry->data.load.msg, ARRAY_COUNT(entry->data.load.msg)); + DmaMgr_SendRequestImpl( + &entry->data.load.req, ram, + LINK_ANIMETION_OFFSET(playerAnimHeader->linkAnimSegment, (sizeof(Vec3s) * limbCount + sizeof(s16)) * frame), + sizeof(Vec3s) * limbCount + sizeof(s16), 0, &entry->data.load.msgQueue, NULL); } } @@ -1080,7 +1091,7 @@ void AnimationContext_SetMoveActor(PlayState* play, Actor* actor, SkelAnime* ske } /** - * Receives the request for Link's animation frame data + * Receives the request for Player's animation frame data */ void AnimationContext_LoadFrame(PlayState* play, AnimationEntryData* data) { AnimEntryLoadFrame* entry = &data->load; @@ -1185,12 +1196,12 @@ void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) { } /** - * Initializes a skeleton to be used with Link animations to a looping animation, dynamically allocating the frame + * Initializes a skeleton to be used with Player animations to a looping animation, dynamically allocating the frame * tables if not given. */ -void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, - LinkAnimationHeader* animation, s32 flags, void* jointTableBuffer, void* morphTableBuffer, - s32 limbBufCount) { +void SkelAnime_InitPlayer(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, + PlayerAnimationHeader* animation, s32 flags, void* jointTableBuffer, void* morphTableBuffer, + s32 limbBufCount) { FlexSkeletonHeader* skeletonHeader; s32 headerJointCount; s32 limbCount; @@ -1226,52 +1237,52 @@ void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeade skelAnime->morphTable = (void*)ALIGN16((uintptr_t)morphTableBuffer); } - LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f); + PlayerAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f); } /** - * Sets the update function of a SkelAnime that uses Link animations based on its mode + * Sets the update function of a SkelAnime that uses Player animations based on its mode */ -void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) { +void PlayerAnimation_SetUpdateFunction(SkelAnime* skelAnime) { if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) { - skelAnime->update.link = LinkAnimation_Loop; + skelAnime->update.player = PlayerAnimation_Loop; } else { - skelAnime->update.link = LinkAnimation_Once; + skelAnime->update.player = PlayerAnimation_Once; } skelAnime->morphWeight = 0.0f; } /** - * Advances the current Link animation and updates all frame tables. If the animation plays once, returns true when it + * Advances the current Player animation and updates all frame tables. If the animation plays once, returns true when it * finishes. */ -s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) { - return skelAnime->update.link(play, skelAnime); +s32 PlayerAnimation_Update(PlayState* play, SkelAnime* skelAnime) { + return skelAnime->update.player(play, skelAnime); } /** * Requests an interpolation between the pose in jointTable to the one in morphTable, advancing the morph but not the * animation frame */ -s32 LinkAnimation_Morph(PlayState* play, SkelAnime* skelAnime) { +s32 PlayerAnimation_Morph(PlayState* play, SkelAnime* skelAnime) { f32 prevMorphWeight = skelAnime->morphWeight; f32 updateRate = (s32)play->state.framerateDivisor * 0.5f; skelAnime->morphWeight -= skelAnime->morphRate * updateRate; if (skelAnime->morphWeight <= 0.0f) { - LinkAnimation_SetUpdateFunction(skelAnime); + PlayerAnimation_SetUpdateFunction(skelAnime); } AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, 1.0f - (skelAnime->morphWeight / prevMorphWeight)); - return 0; + return false; } /** - * Requests a load of the next frame of a Link animation, advances the morph, and requests an interpolation between + * Requests a load of the next frame of a Player animation, advances the morph, and requests an interpolation between * jointTable and morphTable */ -void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime) { +void PlayerAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime) { AnimationContext_SetLoadFrame(play, skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, skelAnime->jointTable); if (skelAnime->morphWeight != 0) { @@ -1287,9 +1298,9 @@ void LinkAnimation_AnimateFrame(PlayState* play, SkelAnime* skelAnime) { } /** - * Advances a Link animation that loops over its full length + * Advances a Player animation that loops over its full length */ -s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime) { +s32 PlayerAnimation_Loop(PlayState* play, SkelAnime* skelAnime) { f32 updateRate = (s32)play->state.framerateDivisor * 0.5f; skelAnime->curFrame += skelAnime->playSpeed * updateRate; @@ -1298,19 +1309,19 @@ s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime) { } else if (skelAnime->animLength <= skelAnime->curFrame) { skelAnime->curFrame -= skelAnime->animLength; } - LinkAnimation_AnimateFrame(play, skelAnime); - return 0; + PlayerAnimation_AnimateFrame(play, skelAnime); + return false; } /** - * Advances a Link animation that stops at endFrame and returns true when it is reached. + * Advances a Player animation that stops at endFrame and returns true when it is reached. */ -s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime) { +s32 PlayerAnimation_Once(PlayState* play, SkelAnime* skelAnime) { f32 updateRate = (s32)play->state.framerateDivisor * 0.5f; if (skelAnime->curFrame == skelAnime->endFrame) { - LinkAnimation_AnimateFrame(play, skelAnime); - return 1; + PlayerAnimation_AnimateFrame(play, skelAnime); + return true; } skelAnime->curFrame += skelAnime->playSpeed * updateRate; @@ -1324,8 +1335,8 @@ s32 LinkAnimation_Once(PlayState* play, SkelAnime* skelAnime) { skelAnime->curFrame -= skelAnime->animLength; } } - LinkAnimation_AnimateFrame(play, skelAnime); - return 0; + PlayerAnimation_AnimateFrame(play, skelAnime); + return false; } /** @@ -1337,28 +1348,28 @@ void Animation_SetMorph(PlayState* play, SkelAnime* skelAnime, f32 morphFrames) } /** - * General way to set a new Link animation, allowing choice of playback speed, start frame, end frame, play mode, and + * General way to set a new Player animation, allowing choice of playback speed, start frame, end frame, play mode, and * number of transition frames. Positive morph frames morph from the current pose to the start pose of the new * animation, then start the new animation. Negative morph frames start the new animation immediately, modified by the * pose immediately before the animation change. */ -void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed, - f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames) { +void PlayerAnimation_Change(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 playSpeed, + f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames) { skelAnime->mode = mode; if ((morphFrames != 0.0f) && ((animation != skelAnime->animation) || (startFrame != skelAnime->curFrame))) { if (morphFrames < 0) { - LinkAnimation_SetUpdateFunction(skelAnime); + PlayerAnimation_SetUpdateFunction(skelAnime); SkelAnime_CopyFrameTable(skelAnime, skelAnime->morphTable, skelAnime->jointTable); morphFrames = -morphFrames; } else { - skelAnime->update.link = LinkAnimation_Morph; + skelAnime->update.player = PlayerAnimation_Morph; AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->morphTable); } skelAnime->morphWeight = 1.0f; skelAnime->morphRate = 1.0f / morphFrames; } else { - LinkAnimation_SetUpdateFunction(skelAnime); + PlayerAnimation_SetUpdateFunction(skelAnime); AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->jointTable); skelAnime->morphWeight = 0.0f; } @@ -1373,79 +1384,80 @@ void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHe } /** - * Immediately changes to a Link animation that plays once at the default speed. + * Immediately changes to a Player animation that plays once at the default speed. */ -void LinkAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { - LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), - ANIMMODE_ONCE, 0.0f); +void PlayerAnimation_PlayOnce(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation) { + PlayerAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), + ANIMMODE_ONCE, 0.0f); } /** - * Immediately changes to a Link animation that plays once at the specified speed. + * Immediately changes to a Player animation that plays once at the specified speed. */ -void LinkAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, - f32 playSpeed) { - LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common), - ANIMMODE_ONCE, 0.0f); +void PlayerAnimation_PlayOnceSetSpeed(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, + f32 playSpeed) { + PlayerAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common), + ANIMMODE_ONCE, 0.0f); } /** - * Immediately changes to a Link animation that loops at the default speed. + * Immediately changes to a Player animation that loops at the default speed. */ -void LinkAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation) { - LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), - ANIMMODE_LOOP, 0.0f); +void PlayerAnimation_PlayLoop(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation) { + PlayerAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(&animation->common), + ANIMMODE_LOOP, 0.0f); } /** - * Immediately changes to a Link animation that loops at the specified speed. + * Immediately changes to a Player animation that loops at the specified speed. */ -void LinkAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, - f32 playSpeed) { - LinkAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common), - ANIMMODE_LOOP, 0.0f); +void PlayerAnimation_PlayLoopSetSpeed(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, + f32 playSpeed) { + PlayerAnimation_Change(play, skelAnime, animation, playSpeed, 0.0f, Animation_GetLastFrame(&animation->common), + ANIMMODE_LOOP, 0.0f); } /** * Requests copying jointTable to morphTable */ -void LinkAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime) { +void PlayerAnimation_CopyJointToMorph(PlayState* play, SkelAnime* skelAnime) { AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->morphTable, skelAnime->jointTable); } /** * Requests copying morphTable to jointTable */ -void LinkAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime) { +void PlayerAnimation_CopyMorphToJoint(PlayState* play, SkelAnime* skelAnime) { AnimationContext_SetCopyAll(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable); } /** - * Requests loading frame data from the Link animation into morphTable + * Requests loading frame data from the Player animation into morphTable */ -void LinkAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) { +void PlayerAnimation_LoadToMorph(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 frame) { AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->morphTable); } /** - * Requests loading frame data from the Link animation into jointTable + * Requests loading frame data from the Player animation into jointTable */ -void LinkAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 frame) { +void PlayerAnimation_LoadToJoint(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation, f32 frame) { AnimationContext_SetLoadFrame(play, animation, (s32)frame, skelAnime->limbCount, skelAnime->jointTable); } /** * Requests interpolating between jointTable and morphTable, placing the result in jointTable */ -void LinkAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight) { +void PlayerAnimation_InterpJointMorph(PlayState* play, SkelAnime* skelAnime, f32 weight) { AnimationContext_SetInterp(play, skelAnime->limbCount, skelAnime->jointTable, skelAnime->morphTable, weight); } /** - * Requests loading frame data from the Link animations and blending them, placing the result in jointTable + * Requests loading frame data from the Player animations and blending them, placing the result in jointTable */ -void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, - LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer) { +void PlayerAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation1, f32 frame1, + PlayerAnimationHeader* animation2, f32 frame2, f32 blendWeight, + void* blendTableBuffer) { void* alignedBlendTable; AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->jointTable); @@ -1457,10 +1469,11 @@ void LinkAnimation_BlendToJoint(PlayState* play, SkelAnime* skelAnime, LinkAnima } /** - * Requests loading frame data from the Link animations and blending them, placing the result in morphTable + * Requests loading frame data from the Player animations and blending them, placing the result in morphTable */ -void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation1, f32 frame1, - LinkAnimationHeader* animation2, f32 frame2, f32 blendWeight, void* blendTableBuffer) { +void PlayerAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, PlayerAnimationHeader* animation1, f32 frame1, + PlayerAnimationHeader* animation2, f32 frame2, f32 blendWeight, + void* blendTableBuffer) { void* alignedBlendTable; AnimationContext_SetLoadFrame(play, animation1, (s32)frame1, skelAnime->limbCount, skelAnime->morphTable); @@ -1474,9 +1487,9 @@ void LinkAnimation_BlendToMorph(PlayState* play, SkelAnime* skelAnime, LinkAnima /** * Changes a looping animation to one that stops at the end. */ -void LinkAnimation_EndLoop(SkelAnime* skelAnime) { +void PlayerAnimation_EndLoop(SkelAnime* skelAnime) { skelAnime->mode = ANIMMODE_ONCE; - LinkAnimation_SetUpdateFunction(skelAnime); + PlayerAnimation_SetUpdateFunction(skelAnime); } /** @@ -1507,9 +1520,9 @@ s32 Animation_OnFrameImpl(SkelAnime* skelAnime, f32 frame, f32 updateRate) { } /** - * Checks if the current Link animation has reached the specified frame + * Checks if the current Player animation has reached the specified frame */ -s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) { +s32 PlayerAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) { f32 updateRate = gFramerateDivisorHalf; return Animation_OnFrameImpl(skelAnime, frame, updateRate); @@ -1620,7 +1633,7 @@ s32 SkelAnime_Morph(SkelAnime* skelAnime) { } SkelAnime_InterpFrameTable(skelAnime->limbCount, skelAnime->jointTable, skelAnime->jointTable, skelAnime->morphTable, 1.0f - (skelAnime->morphWeight / prevMorphWeight)); - return 0; + return false; } /** @@ -1654,7 +1667,7 @@ s32 SkelAnime_MorphTaper(SkelAnime* skelAnime) { } SkelAnime_InterpFrameTable(skelAnime->limbCount, skelAnime->jointTable, skelAnime->jointTable, skelAnime->morphTable, 1.0f - curWeight); - return 0; + return false; } /** @@ -1701,7 +1714,7 @@ s32 SkelAnime_LoopFull(SkelAnime* skelAnime) { } SkelAnime_AnimateFrame(skelAnime); - return 0; + return false; } /** @@ -1718,7 +1731,7 @@ s32 SkelAnime_LoopPartial(SkelAnime* skelAnime) { } SkelAnime_AnimateFrame(skelAnime); - return 0; + return false; } /** @@ -1730,7 +1743,7 @@ s32 SkelAnime_Once(SkelAnime* skelAnime) { if (skelAnime->curFrame == skelAnime->endFrame) { SkelAnime_GetFrameData(skelAnime->animation, skelAnime->curFrame, skelAnime->limbCount, skelAnime->jointTable); SkelAnime_AnimateFrame(skelAnime); - return 1; + return true; } skelAnime->curFrame += skelAnime->playSpeed * updateRate; @@ -1746,7 +1759,7 @@ s32 SkelAnime_Once(SkelAnime* skelAnime) { } } SkelAnime_AnimateFrame(skelAnime); - return 0; + return false; } /** diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index fe5562f14..42e2dd013 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -203,7 +203,7 @@ void EnRz_ChangeAnim(PlayState* play, EnRz* this, s16 animIndex, u8 animMode, f3 &gRosaSistersStandingAnim, &gRosaSistersStandingAnim, &gRosaSistersWalkingAnim, &gRosaSistersSittingAnim, &gRosaSistersApplaudingAnim, &gRosaSistersOnKneesAnim, &gRosaSistersDancingAnim, }; - static LinkAnimationHeader* sLinkAnimations[] = { + static PlayerAnimationHeader* sPlayerAnimations[] = { &gPlayerAnim_link_normal_wait_free, &gPlayerAnim_alink_dance_loop, }; @@ -219,13 +219,15 @@ void EnRz_ChangeAnim(PlayState* play, EnRz* this, s16 animIndex, u8 animMode, f3 if ((animIndex >= EN_RZ_ANIM_THINKING) && (animIndex < EN_RZ_ANIM_MAX) && ((animIndex != this->animIndex) || (animMode != ANIMMODE_LOOP))) { if (animIndex >= ARRAY_COUNT(sJudoAnimations)) { - endFrame = Animation_GetLastFrame(sLinkAnimations[animIndex - ARRAY_COUNT(sJudoAnimations)]); + endFrame = Animation_GetLastFrame(sPlayerAnimations[animIndex - ARRAY_COUNT(sJudoAnimations)]); if (animMode == ANIMMODE_LOOP) { - LinkAnimation_Change(play, &this->skelAnime, sLinkAnimations[animIndex - ARRAY_COUNT(sJudoAnimations)], - 2.0f / 3.0f, 0.0f, endFrame, ANIMMODE_LOOP, morphFrames); + PlayerAnimation_Change(play, &this->skelAnime, + sPlayerAnimations[animIndex - ARRAY_COUNT(sJudoAnimations)], 2.0f / 3.0f, 0.0f, + endFrame, ANIMMODE_LOOP, morphFrames); } else { - LinkAnimation_Change(play, &this->skelAnime, sLinkAnimations[animIndex - ARRAY_COUNT(sJudoAnimations)], - 2.0f / 3.0f, 0.0f, endFrame, ANIMMODE_LOOP, morphFrames); + PlayerAnimation_Change(play, &this->skelAnime, + sPlayerAnimations[animIndex - ARRAY_COUNT(sJudoAnimations)], 2.0f / 3.0f, 0.0f, + endFrame, ANIMMODE_LOOP, morphFrames); } } else { Animation_Change(&this->skelAnime, animationPtr[animIndex], 1.0f, 0.0f, @@ -325,7 +327,7 @@ s32 EnRz_UpdateSkelAnime(EnRz* this, PlayState* play) { if (this->animIndex < EN_RZ_ANIM_LINK_NORMAL_WAIT_FREE) { return SkelAnime_Update(&this->skelAnime); } else { - return LinkAnimation_Update(play, &this->skelAnime); + return PlayerAnimation_Update(play, &this->skelAnime); } } diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index cca0c9dfa..38ee9b710 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -320,7 +320,7 @@ s32 func_80A3E898(EnTest3* this, PlayState* play) { Message_ContinueTextbox(play, textId); } if (textId == 0x296B) { - LinkAnimation_PlayOnceSetSpeed(play, &this->player.skelAnime, &gPlayerAnim_al_yareyare, 2.0f / 3.0f); + PlayerAnimation_PlayOnceSetSpeed(play, &this->player.skelAnime, &gPlayerAnim_al_yareyare, 2.0f / 3.0f); } return false; } diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index b6c05815e..35bd7113e 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -68,7 +68,10 @@ static ColliderCylinderInit sCylinderInit = { // assumption: draw uses two different skeleton functions, might be incompatible static AnimationHeader* gYbUnusedAnimations[] = { &object_yb_Anim_000200 }; -static LinkAnimationHeader* gLinkAnimations[] = { &gPlayerAnim_link_normal_wait_free, &gPlayerAnim_alink_dance_loop }; +static PlayerAnimationHeader* gPlayerAnimations[] = { + &gPlayerAnim_link_normal_wait_free, + &gPlayerAnim_alink_dance_loop, +}; static Vec3f D_80BFB2E8 = { 0.0f, 0.5f, 0.0f }; @@ -168,17 +171,17 @@ void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play) { void EnYb_ChangeAnim(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f32 morphFrames) { if (animIndex >= 0 && animIndex < 3) { - if (animIndex != this->animIndex || animMode != ANIMMODE_LOOP) { + if ((animIndex != this->animIndex) || (animMode != ANIMMODE_LOOP)) { if (animIndex > 0) { if (animMode == ANIMMODE_LOOP) { - LinkAnimation_Change(play, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, - Animation_GetLastFrame(gLinkAnimations[animIndex - 1]), ANIMMODE_LOOP, - morphFrames); + PlayerAnimation_Change(play, &this->skelAnime, gPlayerAnimations[animIndex - 1], 1.0f, 0.0f, + Animation_GetLastFrame(gPlayerAnimations[animIndex - 1]), ANIMMODE_LOOP, + morphFrames); } else { // unused case, (only called once with animMode = ANIMMODE_LOOP) - LinkAnimation_Change(play, &this->skelAnime, gLinkAnimations[animIndex - 1], 1.0f, 0.0f, - Animation_GetLastFrame(gLinkAnimations[animIndex - 1]), ANIMMODE_LOOP, - morphFrames); + PlayerAnimation_Change(play, &this->skelAnime, gPlayerAnimations[animIndex - 1], 1.0f, 0.0f, + Animation_GetLastFrame(gPlayerAnimations[animIndex - 1]), ANIMMODE_LOOP, + morphFrames); } } else { // unused case, (only called once with animIndex = 2) @@ -207,7 +210,7 @@ void EnYb_UpdateAnimation(EnYb* this, PlayState* play) { if (this->animIndex <= 0) { SkelAnime_Update(&this->skelAnime); } else { - LinkAnimation_Update(play, &this->skelAnime); + PlayerAnimation_Update(play, &this->skelAnime); } } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7464ad05e..d4d6565e9 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2537,9 +2537,9 @@ 0x80134B54:("SkelAnime_DrawFlexLimb",), 0x80134DBC:("SkelAnime_DrawFlex",), 0x80134FFC:("SkelAnime_GetFrameDataLegacy",), - 0x801353D4:("Animation_GetLimbCount2",), - 0x801353F8:("Animation_GetLength2",), - 0x8013541C:("Animation_GetLastFrame2",), + 0x801353D4:("Animation_GetLimbCountLegacy",), + 0x801353F8:("Animation_GetLengthLegacy",), + 0x8013541C:("Animation_GetLastFrameLegacy",), 0x80135448:("SkelAnime_InterpFrameTable",), 0x801358C8:("AnimationContext_Reset",), 0x801358D4:("AnimationContext_SetNextQueue",), @@ -2558,29 +2558,29 @@ 0x80135DB8:("AnimationContext_CopyFalse",), 0x80135E3C:("AnimationContext_MoveActor",), 0x80135EE8:("AnimationContext_Update",), - 0x80135F88:("SkelAnime_InitLink",), - 0x801360A8:("LinkAnimation_SetUpdateFunction",), - 0x801360E0:("LinkAnimation_Update",), - 0x80136104:("LinkAnimation_Morph",), - 0x801361BC:("LinkAnimation_AnimateFrame",), - 0x80136288:("LinkAnimation_Loop",), - 0x8013631C:("LinkAnimation_Once",), + 0x80135F88:("SkelAnime_InitPlayer",), + 0x801360A8:("PlayerAnimation_SetUpdateFunction",), + 0x801360E0:("PlayerAnimation_Update",), + 0x80136104:("PlayerAnimation_Morph",), + 0x801361BC:("PlayerAnimation_AnimateFrame",), + 0x80136288:("PlayerAnimation_Loop",), + 0x8013631C:("PlayerAnimation_Once",), 0x801363F0:("Animation_SetMorph",), - 0x80136414:("LinkAnimation_Change",), - 0x8013658C:("LinkAnimation_PlayOnce",), - 0x801365EC:("LinkAnimation_PlayOnceSetSpeed",), - 0x80136650:("LinkAnimation_PlayLoop",), - 0x801366AC:("LinkAnimation_PlayLoopSetSpeed",), - 0x8013670C:("LinkAnimation_CopyJointToMorph",), - 0x8013673C:("LinkAnimation_CopyMorphToJoint",), - 0x8013676C:("LinkAnimation_LoadToMorph",), - 0x801367B0:("LinkAnimation_LoadToJoint",), - 0x801367F4:("LinkAnimation_InterpJointMorph",), - 0x8013682C:("LinkAnimation_BlendToJoint",), - 0x801368CC:("LinkAnimation_BlendToMorph",), - 0x8013696C:("LinkAnimation_EndLoop",), + 0x80136414:("PlayerAnimation_Change",), + 0x8013658C:("PlayerAnimation_PlayOnce",), + 0x801365EC:("PlayerAnimation_PlayOnceSetSpeed",), + 0x80136650:("PlayerAnimation_PlayLoop",), + 0x801366AC:("PlayerAnimation_PlayLoopSetSpeed",), + 0x8013670C:("PlayerAnimation_CopyJointToMorph",), + 0x8013673C:("PlayerAnimation_CopyMorphToJoint",), + 0x8013676C:("PlayerAnimation_LoadToMorph",), + 0x801367B0:("PlayerAnimation_LoadToJoint",), + 0x801367F4:("PlayerAnimation_InterpJointMorph",), + 0x8013682C:("PlayerAnimation_BlendToJoint",), + 0x801368CC:("PlayerAnimation_BlendToMorph",), + 0x8013696C:("PlayerAnimation_EndLoop",), 0x80136990:("Animation_OnFrameImpl",), - 0x80136A48:("LinkAnimation_OnFrame",), + 0x80136A48:("PlayerAnimation_OnFrame",), 0x80136A7C:("SkelAnime_Init",), 0x80136B30:("SkelAnime_InitFlex",), 0x80136BEC:("SkelAnime_InitSkin",), diff --git a/tools/namefixer.py b/tools/namefixer.py index ad78411f8..d5cc4e29a 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -195,72 +195,50 @@ wordReplace = { "func_801A4A28": "Audio_PlayAmbience", "func_801A7328": "AudioSfx_StopByPosAndId", "func_801A75E8": "AudioSfx_StopById", - "SkelAnime_LodDrawLimb": "SkelAnime_DrawLimbLod", "SkelAnime_LodDraw": "SkelAnime_DrawLod", - "SkelAnime_LodDrawLimbSV": "SkelAnime_DrawFlexLimbLod", "SkelAnime_LodDrawSV": "SkelAnime_DrawFlexLod", - # "SkelAnime_DrawLimb": "SkelAnime_DrawLimbOpa", # A different function is called this now # "SkelAnime_Draw": "SkelAnime_DrawOpa", # A different function is called this now "SkelAnime_DrawLimbSV": "SkelAnime_DrawFlexLimbOpa", "SkelAnime_DrawSV": "SkelAnime_DrawFlexOpa", # "SkelAnime_AnimateFrame": "SkelAnime_GetFrameData", # A different function is called this now - "SkelAnime_GetTotalFrames": "Animation_GetLength", "SkelAnime_GetFrameCount": "Animation_GetLastFrame", - "SkelAnime_Draw2Limb": "SkelAnime_DrawLimb", "SkelAnime_Draw2": "SkelAnime_Draw", - "SkelAnime_DrawLimbSV2": "SkelAnime_DrawFlexLimb", "SkelAnime_DrawSV2": "SkelAnime_DrawFlex", - "func_80134FFC": "SkelAnime_GetFrameData2", - "func_801353D4": "Animation_GetLimbCount2", - "SkelAnime_GetTotalFrames2": "Animation_GetLength2", - "SkelAnime_GetFrameCount2": "Animation_GetLastFrame2", - "SkelAnime_InterpolateVec3s": "SkelAnime_InterpFrameTable", "SkelAnime_AnimationCtxReset": "AnimationContext_Reset", "func_801358D4": "AnimationContext_SetNextQueue", "func_801358F4": "AnimationContext_DisableQueue", - "SkelAnime_NextEntry": "AnimationContext_AddEntry", "SkelAnime_LoadLinkAnimetion": "AnimationContext_SetLoadFrame", - "SkelAnime_LoadAnimationType1": "AnimationContext_SetCopyAll", - "SkelAnime_LoadAnimationType2": "AnimationContext_SetInterp", - "SkelAnime_LoadAnimationType3": "AnimationContext_SetCopyTrue", - "SkelAnime_LoadAnimationType4": "AnimationContext_SetCopyFalse", - "SkelAnime_LoadAnimationType5": "AnimationContext_SetMoveActor", - "SkelAnime_LinkAnimetionLoaded": "AnimationContext_LoadFrame", + "SkelAnime_AnimationType1Loaded": "AnimationContext_CopyAll", "SkelAnime_AnimationType2Loaded": "AnimationContext_CopyInterp", "SkelAnime_AnimationType3Loaded": "AnimationContext_CopyTrue", "SkelAnime_AnimationType4Loaded": "AnimationContext_CopyFalse", "SkelAnime_AnimationType5Loaded": "AnimationContext_MoveActor", "func_80135EE8": "AnimationContext_Update", - "SkelAnime_InitLinkAnimetion": "SkelAnime_InitLink", - "func_801360A8": "LinkAnimation_SetUpdateFunction", - "func_801360E0": "LinkAnimation_Update", - "func_80136104": "LinkAnimation_Morph", - "func_801361BC": "LinkAnimation_AnimateFrame", - "func_80136288": "LinkAnimation_Loop", - "func_8013631C": "LinkAnimation_Once", + "SkelAnime_InitLink": "SkelAnime_InitPlayer", + "LinkAnimation_SetUpdateFunction": "PlayerAnimation_SetUpdateFunction", + "LinkAnimation_Update": "PlayerAnimation_Update", "SkelAnime_SetTransition": "Animation_SetMorph", - "SkelAnime_ChangeLinkAnim": "LinkAnimation_Change", - "SkelAnime_ChangeLinkAnimDefaultStop": "LinkAnimation_PlayOnce", - "SkelAnime_ChangeLinkAnimPlaybackStop": "LinkAnimation_PlayOnceSetSpeed", - "SkelAnime_ChangeLinkAnimDefaultRepeat": "LinkAnimation_PlayLoop", - "SkelAnime_ChangeLinkAnimPlaybackRepeat": "LinkAnimation_PlayLoopSetSpeed", - "func_8013670C": "LinkAnimation_CopyJointToMorph", - "func_8013673C": "LinkAnimation_CopyMorphToJoint", - "func_8013676C": "LinkAnimation_LoadToMorph", - "func_801367B0": "LinkAnimation_LoadToJoint", - "func_801367F4": "LinkAnimation_InterpJointMorph", - "func_8013682C": "LinkAnimation_BlendToJoint", - "func_801368CC": "LinkAnimation_BlendToMorph", - "SkelAnime_SetModeStop": "LinkAnimation_EndLoop", - "func_80136990": "Animation_OnFrameImpl", - "func_80136A48": "LinkAnimation_OnFrame", + "LinkAnimation_Change": "PlayerAnimation_Change", + "LinkAnimation_PlayOnce": "PlayerAnimation_PlayOnce", + "LinkAnimation_PlayOnceSetSpeed": "PlayerAnimation_PlayOnceSetSpeed", + "LinkAnimation_PlayLoop": "PlayerAnimation_PlayLoop", + "LinkAnimation_PlayLoopSetSpeed": "PlayerAnimation_PlayLoopSetSpeed", + "LinkAnimation_CopyJointToMorph": "PlayerAnimation_CopyJointToMorph", + "LinkAnimation_CopyMorphToJoint": "PlayerAnimation_CopyMorphToJoint", + "LinkAnimation_LoadToMorph": "PlayerAnimation_LoadToMorph", + "LinkAnimation_LoadToJoint": "PlayerAnimation_LoadToJoint", + "LinkAnimation_InterpJointMorph": "PlayerAnimation_InterpJointMorph", + "LinkAnimation_BlendToJoint": "PlayerAnimation_BlendToJoint", + "LinkAnimation_BlendToMorph": "PlayerAnimation_BlendToMorph", + "LinkAnimation_EndLoop": "PlayerAnimation_EndLoop", + "LinkAnimation_OnFrame": "PlayerAnimation_OnFrame", + "SkelAnime_InitSV": "SkelAnime_InitFlex", - "func_80136C84": "SkelAnime_SetUpdate", "SkelAnime_FrameUpdateMatrix": "SkelAnime_Update", "func_80136CF4": "SkelAnime_Morph", "func_80136D98": "SkelAnime_MorphTaper", - "func_80136F04": "SkelAnime_AnimateFrame", + "func_8013702C": "SkelAnime_LoopFull", "func_801370B0": "SkelAnime_LoopPartial", "func_8013713C": "SkelAnime_Once", @@ -278,7 +256,7 @@ wordReplace = { "func_801376DC": "SkelAnime_CopyFrameTableFalse", "func_80137748": "SkelAnime_UpdateTranslation", "func_801378B8": "Animation_OnFrame", - "SkelAnime_CopyVec3s": "SkelAnime_CopyFrameTable", + "Actor_SetObjectSegment": "Actor_SetObjectDependency", "func_800B3FC0": "ActorShadow_DrawCircle", "func_800B4024": "ActorShadow_DrawSquare", @@ -625,7 +603,6 @@ wordReplace = { "func_800EE2F4": "Cutscene_IsPlaying", "Cutscene_GetSceneSetupIndex": "Cutscene_GetSceneLayer", "func_801343C0": "SkelAnime_DrawTransformFlexOpa", - "func_80134148": "SkelAnime_DrawTransformFlexLimbOpa", "func_80114E90": "Inventory_HasEmptyBottle", "func_80114F2C": "Inventory_HasItemInBottle", "func_80123C90": "Player_SetEquipmentData", @@ -731,6 +708,7 @@ wordReplace = { "globalCtx": "play", "globalCtx2": "play2", "ScheduleResult": "ScheduleOutput", + "LinkAnimationHeader": "PlayerAnimationHeader", # Struct members "skelAnime.unk03": "skelAnime.taper", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 8bfb180ff..d70411560 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2051,7 +2051,7 @@ asm/non_matchings/code/z_skelanime/SkelAnime_Draw.s,SkelAnime_Draw,0x80134990,0x asm/non_matchings/code/z_skelanime/SkelAnime_DrawLimbSV2.s,SkelAnime_DrawLimbSV2,0x80134B54,0x9A asm/non_matchings/code/z_skelanime/SkelAnime_DrawFlex.s,SkelAnime_DrawFlex,0x80134DBC,0x90 asm/non_matchings/code/z_skelanime/SkelAnime_GetFrameData2.s,SkelAnime_GetFrameData2,0x80134FFC,0xF6 -asm/non_matchings/code/z_skelanime/Animation_GetLimbCount2.s,Animation_GetLimbCount2,0x801353D4,0x9 +asm/non_matchings/code/z_skelanime/Animation_GetLimbCountLegacy.s,Animation_GetLimbCountLegacy,0x801353D4,0x9 asm/non_matchings/code/z_skelanime/SkelAnime_GetTotalFrames2.s,SkelAnime_GetTotalFrames2,0x801353F8,0x9 asm/non_matchings/code/z_skelanime/SkelAnime_GetFrameCount2.s,SkelAnime_GetFrameCount2,0x8013541C,0xB asm/non_matchings/code/z_skelanime/SkelAnime_InterpFrameTable.s,SkelAnime_InterpFrameTable,0x80135448,0x120 @@ -2072,29 +2072,29 @@ asm/non_matchings/code/z_skelanime/AnimationContext_CopyTrue.s,AnimationContext_ asm/non_matchings/code/z_skelanime/AnimationContext_CopyFalse.s,AnimationContext_CopyFalse,0x80135DB8,0x21 asm/non_matchings/code/z_skelanime/AnimationContext_MoveActor.s,AnimationContext_MoveActor,0x80135E3C,0x2B asm/non_matchings/code/z_skelanime/AnimationContext_Update.s,AnimationContext_Update,0x80135EE8,0x28 -asm/non_matchings/code/z_skelanime/SkelAnime_InitLinkAnimetion.s,SkelAnime_InitLinkAnimetion,0x80135F88,0x48 -asm/non_matchings/code/z_skelanime/LinkAnimation_SetUpdateFunction.s,LinkAnimation_SetUpdateFunction,0x801360A8,0xE -asm/non_matchings/code/z_skelanime/LinkAnimation_Update.s,LinkAnimation_Update,0x801360E0,0x9 -asm/non_matchings/code/z_skelanime/LinkAnimation_Morph.s,LinkAnimation_Morph,0x80136104,0x2E -asm/non_matchings/code/z_skelanime/LinkAnimation_AnimateFrame.s,LinkAnimation_AnimateFrame,0x801361BC,0x33 -asm/non_matchings/code/z_skelanime/LinkAnimation_Loop.s,LinkAnimation_Loop,0x80136288,0x25 -asm/non_matchings/code/z_skelanime/LinkAnimation_Once.s,LinkAnimation_Once,0x8013631C,0x35 +asm/non_matchings/code/z_skelanime/SkelAnime_InitPlayerAnimetion.s,SkelAnime_InitPlayerAnimetion,0x80135F88,0x48 +asm/non_matchings/code/z_skelanime/PlayerAnimation_SetUpdateFunction.s,PlayerAnimation_SetUpdateFunction,0x801360A8,0xE +asm/non_matchings/code/z_skelanime/PlayerAnimation_Update.s,PlayerAnimation_Update,0x801360E0,0x9 +asm/non_matchings/code/z_skelanime/PlayerAnimation_Morph.s,PlayerAnimation_Morph,0x80136104,0x2E +asm/non_matchings/code/z_skelanime/PlayerAnimation_AnimateFrame.s,PlayerAnimation_AnimateFrame,0x801361BC,0x33 +asm/non_matchings/code/z_skelanime/PlayerAnimation_Loop.s,PlayerAnimation_Loop,0x80136288,0x25 +asm/non_matchings/code/z_skelanime/PlayerAnimation_Once.s,PlayerAnimation_Once,0x8013631C,0x35 asm/non_matchings/code/z_skelanime/Animation_SetMorph.s,Animation_SetMorph,0x801363F0,0x9 -asm/non_matchings/code/z_skelanime/LinkAnimation_Change.s,LinkAnimation_Change,0x80136414,0x5E -asm/non_matchings/code/z_skelanime/LinkAnimation_ChangeDefaultStop.s,LinkAnimation_ChangeDefaultStop,0x8013658C,0x18 -asm/non_matchings/code/z_skelanime/LinkAnimation_ChangePlaybackStop.s,LinkAnimation_ChangePlaybackStop,0x801365EC,0x19 -asm/non_matchings/code/z_skelanime/LinkAnimation_ChangeDefaultRepeat.s,LinkAnimation_ChangeDefaultRepeat,0x80136650,0x17 -asm/non_matchings/code/z_skelanime/LinkAnimation_ChangePlaybackRepeat.s,LinkAnimation_ChangePlaybackRepeat,0x801366AC,0x18 -asm/non_matchings/code/z_skelanime/LinkAnimation_CopyJointToMorph.s,LinkAnimation_CopyJointToMorph,0x8013670C,0xC -asm/non_matchings/code/z_skelanime/LinkAnimation_CopyMorphToJoint.s,LinkAnimation_CopyMorphToJoint,0x8013673C,0xC -asm/non_matchings/code/z_skelanime/LinkAnimation_LoadToMorph.s,LinkAnimation_LoadToMorph,0x8013676C,0x11 -asm/non_matchings/code/z_skelanime/LinkAnimation_LoadToJoint.s,LinkAnimation_LoadToJoint,0x801367B0,0x11 -asm/non_matchings/code/z_skelanime/LinkAnimation_InterpJointMorph.s,LinkAnimation_InterpJointMorph,0x801367F4,0xE -asm/non_matchings/code/z_skelanime/LinkAnimation_BlendToJoint.s,LinkAnimation_BlendToJoint,0x8013682C,0x28 -asm/non_matchings/code/z_skelanime/LinkAnimation_BlendToMorph.s,LinkAnimation_BlendToMorph,0x801368CC,0x28 -asm/non_matchings/code/z_skelanime/LinkAnimation_EndLoop.s,LinkAnimation_EndLoop,0x8013696C,0x9 +asm/non_matchings/code/z_skelanime/PlayerAnimation_Change.s,PlayerAnimation_Change,0x80136414,0x5E +asm/non_matchings/code/z_skelanime/PlayerAnimation_ChangeDefaultStop.s,PlayerAnimation_ChangeDefaultStop,0x8013658C,0x18 +asm/non_matchings/code/z_skelanime/PlayerAnimation_ChangePlaybackStop.s,PlayerAnimation_ChangePlaybackStop,0x801365EC,0x19 +asm/non_matchings/code/z_skelanime/PlayerAnimation_ChangeDefaultRepeat.s,PlayerAnimation_ChangeDefaultRepeat,0x80136650,0x17 +asm/non_matchings/code/z_skelanime/PlayerAnimation_ChangePlaybackRepeat.s,PlayerAnimation_ChangePlaybackRepeat,0x801366AC,0x18 +asm/non_matchings/code/z_skelanime/PlayerAnimation_CopyJointToMorph.s,PlayerAnimation_CopyJointToMorph,0x8013670C,0xC +asm/non_matchings/code/z_skelanime/PlayerAnimation_CopyMorphToJoint.s,PlayerAnimation_CopyMorphToJoint,0x8013673C,0xC +asm/non_matchings/code/z_skelanime/PlayerAnimation_LoadToMorph.s,PlayerAnimation_LoadToMorph,0x8013676C,0x11 +asm/non_matchings/code/z_skelanime/PlayerAnimation_LoadToJoint.s,PlayerAnimation_LoadToJoint,0x801367B0,0x11 +asm/non_matchings/code/z_skelanime/PlayerAnimation_InterpJointMorph.s,PlayerAnimation_InterpJointMorph,0x801367F4,0xE +asm/non_matchings/code/z_skelanime/PlayerAnimation_BlendToJoint.s,PlayerAnimation_BlendToJoint,0x8013682C,0x28 +asm/non_matchings/code/z_skelanime/PlayerAnimation_BlendToMorph.s,PlayerAnimation_BlendToMorph,0x801368CC,0x28 +asm/non_matchings/code/z_skelanime/PlayerAnimation_EndLoop.s,PlayerAnimation_EndLoop,0x8013696C,0x9 asm/non_matchings/code/z_skelanime/Animation_OnFrameImpl.s,Animation_OnFrameImpl,0x80136990,0x2E -asm/non_matchings/code/z_skelanime/LinkAnimation_OnFrame.s,LinkAnimation_OnFrame,0x80136A48,0xD +asm/non_matchings/code/z_skelanime/PlayerAnimation_OnFrame.s,PlayerAnimation_OnFrame,0x80136A48,0xD asm/non_matchings/code/z_skelanime/SkelAnime_Init.s,SkelAnime_Init,0x80136A7C,0x2D asm/non_matchings/code/z_skelanime/SkelAnime_InitFlex.s,SkelAnime_InitFlex,0x80136B30,0x2F asm/non_matchings/code/z_skelanime/SkelAnime_InitSkin.s,SkelAnime_InitSkin,0x80136BEC,0x26 From 543c38ae06d68ce2aa603144dbbe76262d00ddb6 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Tue, 18 Apr 2023 23:01:05 -0400 Subject: [PATCH 26/29] `z_player_lib`: Dawn of the final PR (#1142) * Player_GetMask and Player_RemoveMask * some comments * Player_ActionToBottle and Player_GetBottleHeld * Player_DrawGetItemImpl and Player_DrawGetItem * func_80123420 OK * Decompile a few more functions * Decompile a few more functions * func_80122760 * func_80122868, func_801229A0 and func_801229EC * func_80122F28 * func_8012301C * func_801242B4 * func_801242DC * func_80124420 nonmatching * func_80126440 * func_801240C8 and func_801240DC * func_8012405C and func_80124088 * func_80124020 * Player_IsBurningStickInRange * func_8012754C * func_80125318 and func_80125CE0 * func_801229FC * func_80127B64 * func_80127488 * func_80122D44 * func_80122BA4 * func_80122C20 attempt * func_80122EEC * func_80122F9C * func_80122FCC and func_8012300C * func_80123448 * func_801234D4 * func_801235DC * func_80123960 * func_80123BD4 * func_80123AA4 * func_801239AC * func_801241B4 * func_80123C58 and func_80123C90 * func_80123D50 and func_80123DA4 * func_80123DC0, func_80123E90 and func_80123F14 * func_80124110 and func_80124148 * func_80124168 and func_80124190 * func_80124278 * func_80124F18 non_equivalent * func_80125340 and func_8012536C * func_801263FC * func_801265C8 * func_8012669C * func_80128B74 * func_80123140 * func_801246F4 * func_801253A4 NON_MATCHING * func_801262C8 * func_80126AB4 * func_80126B8C * func_80127438 * func_801278F8 NON_MATCHING * Fix data split * cleanup externs * func_80128BD0 compiles... * Rename Player_SetEquipmentData * fix merge issues * Fix types * Improvement? Worse? I don't know at this point * func_80128640 attempt * func_80127BE8 * func_80127A60 * func_80127594 attempt * func_801271B0 * func_8012364C NON_MATCHING * func_80124618 * func_80124CC4 non matching * func_801251C4 * func_80125580 non equivalent * func_80128388 * cleanup * remove some hardcoded pointers * object symbol cleanup * func_80124870 NON_EQUIVALENT * name overridlimbdraw arguments * func_80125D4C NON_EQUIVALENT * func_80126BD0 NON_MATCHING * Match func_80126BD0 thanks to anon58 * func_80127DA4 NON_EQUIVALENT * fix merge issues * some stealing from OoT * small rename pass and cleanup * Improve some * CLAMP and fix warnings * func_80125580 matched by mzx * cleanup func_80128BD0 a bit * import data * func_80124CC4 * Rename objectFileTable to gObjectTable * Improve func_80124FF0 thanks to maide * fix renames * Match func_80124FF0 thanks to Maide * cleanup * More cleaning up * import bss * Add PLAYER_STATE macros * a bit more of cleanup * run formatter * func_80128BD0 a bit more deecent * Add player limb enum * Use limb enum * cleanup and format * Use symbols for player dlists groups * A bunch more of pointers * more object pointers * Change the remaining object pointers * Add a few missing dlist in link_child * Small rename * whoops * Work on NON_MATCHINGs * Cleanup * Steal OoT renames from "sword" to "meleeWeapon" * Fix some symbols * Match func_80127594 and format * Match func_80127DA4 * Matched func_801284A0 * Annotate D_801F59AC * Matched func_80128640 * Some cleanup * format * stuffs * some cleanups * import stuff from pr * swords and shields * fixes * bss * cleanup Player_OverrideLimbDrawGameplayCommon * progress on func_80125D4C * PlayerMeleeWeapon enum * Player_BButtonSwordFromAP * GET_B_SWORD_FROM_AP * GET_MELEE_WEAPON_FROM_AP * PlayerBottle * PlayerExplosive and PlayerSword * misc fixes * Various changes fromplayer_actor * z64player.h stuff from player_actor * Fixes * skelanime stuff * placeholders on z64item.h, save macros and ther cleanups * <= PLAYER_AP_MINUS1 * Player_UpdateBunnyEarsKinematics Co-authored-by: EllipticEllipsis * cleanup * bodyPartsPos * comment * sizeof(u16) * typo * merge fixes * fix * fixes * format * fix merge * fix merge * func_80125D4C Co-authored-by: engineer124 * func_80128BD0 improvement * minor renames * format * whoops * small cleanup * Update src/code/z_player_lib.c Co-authored-by: EllipticEllipsis * review Co-authored-by: EllipticEllipsis * format * _B_ * review Co-authored-by: EllipticEllipsis * review Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * format * remove gap * whoops * clanups * remove stuff from permuter_settings * steal some OoT docs * some other docs vscode didn't add to the last commit * format * data as infunction-static data * OoT docs stealing * Improvements on Player_PostLimbDrawGameplay * More improvement * Match Player_PostLimbDrawGameplay Co-authored-by: engineer124 * cleanups * Convert unk_AF0 into an union and some other cleanups * bss * headLimbRot and upperLimbRot * fix naming * cleanups * bss * bss * Update src/code/z_player_lib.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * pr review Co-authored-by: engineer124 * bss * gesture * namefixer * gestureInfo * IA_MIN and BOTTLE_EMPTY * review Co-authored-by: engineer124 * review * D_801F59B0_LEN * Remove LevelOfDetail enum * bss * review * review * gLinkDekuClosedFlowerDL gLinkDekuOpenFlowerDL * _B_ * Player_DrawStrayFairyParticles * fix build --------- Co-authored-by: kyleburnette Co-authored-by: Kelebek1 Co-authored-by: Derek Hensley Co-authored-by: EllipticEllipsis Co-authored-by: engineer124 Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- assets/xml/objects/gameplay_keep.xml | 12 +- assets/xml/objects/object_link_child.xml | 18 +- assets/xml/objects/object_link_goron.xml | 2 +- assets/xml/objects/object_link_nuts.xml | 4 +- include/functions.h | 32 +- include/ultra64/message.h | 4 +- include/z64.h | 4 +- include/z64animation.h | 4 +- include/z64player.h | 171 +- src/code/code_8012EC80.c | 2 +- src/code/z_actor.c | 2 +- src/code/z_eff_tire_mark.c | 2 +- src/code/z_play.c | 2 +- src/code/z_player_lib.c | 2043 ++++++++++++++--- src/code/z_skelanime.c | 2 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 2 + src/overlays/actors/ovl_En_Fsn/z_en_fsn.c | 2 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 2 +- src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 2 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 6 +- .../ovl_En_Stone_heishi/z_en_stone_heishi.c | 2 +- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 4 +- .../ovl_En_Talk_Gibud/z_en_talk_gibud.c | 2 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 22 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 4 +- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 2 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 12 +- tools/disasm/functions.txt | 34 +- tools/disasm/variables.txt | 49 +- tools/namefixer.py | 13 +- tools/sizes/code_functions.csv | 34 +- 31 files changed, 2048 insertions(+), 448 deletions(-) diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 16cbf0b85..8a78a1709 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -787,7 +787,7 @@ - + @@ -1145,8 +1145,8 @@ - - + + @@ -1223,7 +1223,9 @@ + + @@ -1477,7 +1479,7 @@ - + @@ -1487,7 +1489,7 @@ - + diff --git a/assets/xml/objects/object_link_child.xml b/assets/xml/objects/object_link_child.xml index 23d3cf09c..dd045c1d8 100644 --- a/assets/xml/objects/object_link_child.xml +++ b/assets/xml/objects/object_link_child.xml @@ -101,7 +101,7 @@ - + @@ -110,17 +110,17 @@ - - + + - + - - + + @@ -143,12 +143,12 @@ - - + + - + diff --git a/assets/xml/objects/object_link_goron.xml b/assets/xml/objects/object_link_goron.xml index 48eef4dd9..76017884e 100644 --- a/assets/xml/objects/object_link_goron.xml +++ b/assets/xml/objects/object_link_goron.xml @@ -90,7 +90,7 @@ - + diff --git a/assets/xml/objects/object_link_nuts.xml b/assets/xml/objects/object_link_nuts.xml index a00c44db4..9247d3db4 100644 --- a/assets/xml/objects/object_link_nuts.xml +++ b/assets/xml/objects/object_link_nuts.xml @@ -40,10 +40,10 @@ - + - + diff --git a/include/functions.h b/include/functions.h index c45f57928..91fa5d29d 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1616,34 +1616,34 @@ s32 Player_HasMirrorShieldEquipped(PlayState* play); s32 Player_IsHoldingMirrorShield(PlayState* play); s32 Player_IsHoldingHookshot(Player* player); s32 func_801240DC(Player* player); -s32 func_80124110(Player* player, PlayerItemAction itemAction); -s32 func_80124148(Player* player); -s32 Player_ActionToMeleeWeapon(PlayerItemAction itemAction); -s32 Player_GetMeleeWeaponHeld(Player* player); +PlayerBButtonSword Player_BButtonSwordFromIA(Player* player, PlayerItemAction itemAction); +PlayerBButtonSword Player_GetHeldBButtonSword(Player* player); +PlayerMeleeWeapon Player_MeleeWeaponFromIA(PlayerItemAction itemAction); +PlayerMeleeWeapon Player_GetMeleeWeaponHeld(Player* player); s32 Player_IsHoldingTwoHandedWeapon(Player* player); -s32 Player_ActionToBottle(Player* player, PlayerItemAction itemAction); -s32 Player_GetBottleHeld(Player* Player); -s32 Player_ActionToExplosive(Player* player, PlayerItemAction itemAction); -s32 Player_GetExplosiveHeld(Player* player); -s32 Player_ActionToSword(Actor* actor, PlayerItemAction itemAction); +PlayerBottle Player_BottleFromIA(Player* player, PlayerItemAction itemAction); +PlayerBottle Player_GetBottleHeld(Player* Player); +PlayerExplosive Player_ExplosiveFromIA(Player* player, PlayerItemAction itemAction); +PlayerExplosive Player_GetExplosiveHeld(Player* player); +PlayerSword Player_SwordFromIA(Player* player, PlayerItemAction itemAction); s32 func_801242B4(Player* player); s32 Player_GetEnvironmentalHazard(PlayState* play); -void func_80124420(Player* player); +void Player_UpdateBunnyEars(Player* player); void func_80124618(struct_80124618 arg0[], f32 curFrame, Vec3f* arg2); void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, PlayerTransformation playerForm, s32 boots, s32 face, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor); void func_80125318(Vec3f* arg0, Vec3s* arg1); void Player_DrawZoraShield(PlayState* play, Player* player); void func_80125500(PlayState* play, Player* player, s32 limbIndex, Vec3f* pos, Vec3s* rot); -s32 func_80125D4C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor); -s32 func_801262C8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor); -s32 func_801263FC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -s32 func_80126440(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* arg3, Vec3f* arg4); +s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor); +s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor); +s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); +s32 func_80126440(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase); void Player_DrawGetItem(PlayState* play, Player* player); void func_80126B8C(PlayState* play, Player* player); s32 func_80127438(PlayState* play, Player* player, s32 currentMask); s32 func_80128640(PlayState* play, Player* player, Gfx* dlist); -void func_80128B74(PlayState* play, Player* player, s32 limbIndex); -void func_80128BD0(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor); +void Player_SetFeetPos(PlayState* play, Player* player, s32 limbIndex); +void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor); Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); diff --git a/include/ultra64/message.h b/include/ultra64/message.h index a049ae363..de0c39b83 100644 --- a/include/ultra64/message.h +++ b/include/ultra64/message.h @@ -1,5 +1,5 @@ -#ifndef _ULTRA64_MESSAGE_H_ -#define _ULTRA64_MESSAGE_H_ +#ifndef ULTRA64_MESSAGE_H +#define ULTRA64_MESSAGE_H #include "ultra64/thread.h" diff --git a/include/z64.h b/include/z64.h index 959f195ba..f496f02f1 100644 --- a/include/z64.h +++ b/include/z64.h @@ -646,14 +646,14 @@ typedef struct PlayState { /* 0x1878C */ void (*unk_1878C)(struct PlayState* play); /* 0x18790 */ void (*unk_18790)(struct PlayState* play, s16 arg1); /* 0x18794 */ PlayerItemAction (*unk_18794)(struct PlayState* play, Player* player, ItemId itemId); - /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct PlayState* play, PlayerAnimationHeader* talkAnim, s32 animMode); + /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct PlayState* play, PlayerAnimationHeader* talkAnim, AnimationMode animMode); /* 0x1879C */ s16 playerActorCsIds[10]; /* 0x187B0 */ MtxF viewProjectionMtxF; /* 0x187F0 */ Vec3f projectionMtxFDiagonal; /* 0x187FC */ MtxF billboardMtxF; /* 0x1883C */ Mtx* billboardMtx; /* 0x18840 */ u32 gameplayFrames; - /* 0x18844 */ u8 unk_18844; + /* 0x18844 */ u8 unk_18844; // bool /* 0x18845 */ u8 haltAllActors; /* 0x18846 */ s16 numSetupActors; /* 0x18848 */ u8 numRooms; diff --git a/include/z64animation.h b/include/z64animation.h index 4dd808af8..44c35312d 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -27,9 +27,9 @@ typedef enum AnimationMode { /* 5 */ ANIMMODE_LOOP_PARTIAL_INTERP } AnimationMode; -typedef enum { +typedef enum { /* -1 */ ANIMTAPER_DECEL = -1, - /* 0 */ ANIMTAPER_NONE, + /* 0 */ ANIMTAPER_NONE, /* 1 */ ANIMTAPER_ACCEL } AnimationTapers; diff --git a/include/z64player.h b/include/z64player.h index f1d1f75e4..27a586555 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -22,7 +22,8 @@ typedef enum PlayerBoots { /* 4 */ PLAYER_BOOTS_ZORA_LAND, /* 5 */ PLAYER_BOOTS_ZORA_UNDERWATER, /* 6 */ PLAYER_BOOTS_GORON, - /* 7 */ PLAYER_BOOTS_MAX + /* 7 */ PLAYER_BOOTS_7, + /* 8 */ PLAYER_BOOTS_MAX } PlayerBoots; typedef enum PlayerStrength { @@ -84,7 +85,8 @@ typedef enum PlayerItemAction { /* 0x00 */ PLAYER_IA_NONE, /* 0x01 */ PLAYER_IA_LAST_USED, /* 0x02 */ PLAYER_IA_FISHING_ROD, - /* 0x03 */ PLAYER_IA_SWORD_KOKIRI, + /* 0x03 */ PLAYER_IA_SWORD_MIN, + /* 0x03 */ PLAYER_IA_SWORD_KOKIRI = PLAYER_IA_SWORD_MIN, /* 0x04 */ PLAYER_IA_SWORD_RAZOR, /* 0x05 */ PLAYER_IA_SWORD_GILDED, /* 0x06 */ PLAYER_IA_SWORD_GREAT_FAIRY, @@ -95,14 +97,16 @@ typedef enum PlayerItemAction { /* 0x0B */ PLAYER_IA_BOW_ICE, /* 0x0C */ PLAYER_IA_BOW_LIGHT, /* 0x0D */ PLAYER_IA_HOOKSHOT, - /* 0x0E */ PLAYER_IA_BOMB, + /* 0x0E */ PLAYER_IA_EXPLOSIVE_MIN, + /* 0x0E */ PLAYER_IA_BOMB = PLAYER_IA_EXPLOSIVE_MIN, /* 0x0F */ PLAYER_IA_POWDER_KEG, /* 0x10 */ PLAYER_IA_BOMBCHU, /* 0x11 */ PLAYER_IA_11, /* 0x12 */ PLAYER_IA_NUT, /* 0x13 */ PLAYER_IA_PICTO_BOX, /* 0x14 */ PLAYER_IA_OCARINA, - /* 0x15 */ PLAYER_IA_BOTTLE, + /* 0x15 */ PLAYER_IA_BOTTLE_MIN, + /* 0x15 */ PLAYER_IA_BOTTLE_EMPTY = PLAYER_IA_BOTTLE_MIN, /* 0x16 */ PLAYER_IA_BOTTLE_FISH, /* 0x17 */ PLAYER_IA_BOTTLE_SPRING_WATER, /* 0x18 */ PLAYER_IA_BOTTLE_HOT_SPRING_WATER, @@ -167,6 +171,83 @@ typedef enum PlayerItemAction { /* 0x53 */ PLAYER_IA_MAX } PlayerItemAction; +// Relies on B swords related item actions to be contiguous +#define GET_B_SWORD_FROM_IA(itemAction) ((itemAction) - PLAYER_IA_SWORD_MIN + 1) + +typedef enum PlayerBButtonSword { + /* 0 */ PLAYER_B_SWORD_NONE, + /* 1 */ PLAYER_B_SWORD_KOKIRI = GET_B_SWORD_FROM_IA(PLAYER_IA_SWORD_KOKIRI), + /* 2 */ PLAYER_B_SWORD_RAZOR = GET_B_SWORD_FROM_IA(PLAYER_IA_SWORD_RAZOR), + /* 3 */ PLAYER_B_SWORD_GILDED = GET_B_SWORD_FROM_IA(PLAYER_IA_SWORD_GILDED), + /* 4 */ PLAYER_B_SWORD_MAX +} PlayerBButtonSword; + +// Relies on melee weapon related item actions to be contiguous +#define GET_MELEE_WEAPON_FROM_IA(itemAction) ((itemAction) - PLAYER_IA_SWORD_MIN + 1) + +typedef enum PlayerMeleeWeapon { + /* 0 */ PLAYER_MELEEWEAPON_NONE, + /* 1 */ PLAYER_MELEEWEAPON_SWORD_KOKIRI = GET_MELEE_WEAPON_FROM_IA(PLAYER_IA_SWORD_KOKIRI), + /* 2 */ PLAYER_MELEEWEAPON_SWORD_RAZOR = GET_MELEE_WEAPON_FROM_IA(PLAYER_IA_SWORD_RAZOR), + /* 3 */ PLAYER_MELEEWEAPON_SWORD_GILDED = GET_MELEE_WEAPON_FROM_IA(PLAYER_IA_SWORD_GILDED), + /* 4 */ PLAYER_MELEEWEAPON_SWORD_GREAT_FAIRY = GET_MELEE_WEAPON_FROM_IA(PLAYER_IA_SWORD_GREAT_FAIRY), + /* 5 */ PLAYER_MELEEWEAPON_STICK = GET_MELEE_WEAPON_FROM_IA(PLAYER_IA_STICK), + /* 6 */ PLAYER_MELEEWEAPON_ZORA_FINS = GET_MELEE_WEAPON_FROM_IA(PLAYER_IA_ZORA_FINS), + /* 7 */ PLAYER_MELEEWEAPON_MAX +} PlayerMeleeWeapon; + +// Relies on bottle-related item actions to be contiguous +#define GET_BOTTLE_FROM_IA(itemAction) ((itemAction) - PLAYER_IA_BOTTLE_MIN) + +typedef enum PlayerBottle { + /* -1 */ PLAYER_BOTTLE_NONE = -1, + /* 0 */ PLAYER_BOTTLE_EMPTY = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_EMPTY), + /* 1 */ PLAYER_BOTTLE_FISH = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_FISH), + /* 2 */ PLAYER_BOTTLE_SPRING_WATER = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_SPRING_WATER), + /* 3 */ PLAYER_BOTTLE_HOT_SPRING_WATER = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_HOT_SPRING_WATER), + /* 4 */ PLAYER_BOTTLE_ZORA_EGG = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_ZORA_EGG), + /* 5 */ PLAYER_BOTTLE_DEKU_PRINCESS = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_DEKU_PRINCESS), + /* 6 */ PLAYER_BOTTLE_GOLD_DUST = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_GOLD_DUST), + /* 7 */ PLAYER_BOTTLE_1C = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_1C), + /* 8 */ PLAYER_BOTTLE_SEAHORSE = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_SEAHORSE), + /* 9 */ PLAYER_BOTTLE_MUSHROOM = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_MUSHROOM), + /* 10 */ PLAYER_BOTTLE_HYLIAN_LOACH = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_HYLIAN_LOACH), + /* 11 */ PLAYER_BOTTLE_BUG = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_BUG), + /* 12 */ PLAYER_BOTTLE_POE = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_POE), + /* 13 */ PLAYER_BOTTLE_BIG_POE = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_BIG_POE), + /* 14 */ PLAYER_BOTTLE_POTION_RED = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_POTION_RED), + /* 15 */ PLAYER_BOTTLE_POTION_BLUE = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_POTION_BLUE), + /* 16 */ PLAYER_BOTTLE_POTION_GREEN = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_POTION_GREEN), + /* 17 */ PLAYER_BOTTLE_MILK = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_MILK), + /* 18 */ PLAYER_BOTTLE_MILK_HALF = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_MILK_HALF), + /* 19 */ PLAYER_BOTTLE_CHATEAU = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_CHATEAU), + /* 20 */ PLAYER_BOTTLE_FAIRY = GET_BOTTLE_FROM_IA(PLAYER_IA_BOTTLE_FAIRY), + /* 21 */ PLAYER_BOTTLE_MAX +} PlayerBottle; + +// Relies on explosive-related item actions to be contiguous +#define GET_EXPLOSIVE_FROM_IA(itemAction) ((itemAction) - PLAYER_IA_EXPLOSIVE_MIN) + +typedef enum PlayerExplosive { + /* -1 */ PLAYER_EXPLOSIVE_NONE = -1, + /* 0 */ PLAYER_EXPLOSIVE_BOMB = GET_EXPLOSIVE_FROM_IA(PLAYER_IA_BOMB), + /* 1 */ PLAYER_EXPLOSIVE_POWDER_KEG = GET_EXPLOSIVE_FROM_IA(PLAYER_IA_POWDER_KEG), + /* 2 */ PLAYER_EXPLOSIVE_BOMBCHU = GET_EXPLOSIVE_FROM_IA(PLAYER_IA_BOMBCHU), + /* 3 */ PLAYER_EXPLOSIVE_MAX +} PlayerExplosive; + +// Relies on sword item actions to be contiguous +#define GET_SWORD_FROM_IA(itemAction) ((itemAction) - PLAYER_IA_SWORD_MIN) + +typedef enum PlayerSword { + /* -1 */ PLAYER_SWORD_NONE = -1, + /* 0 */ PLAYER_SWORD_KOKIRI = GET_SWORD_FROM_IA(PLAYER_IA_SWORD_KOKIRI), + /* 1 */ PLAYER_SWORD_RAZOR = GET_SWORD_FROM_IA(PLAYER_IA_SWORD_RAZOR), + /* 2 */ PLAYER_SWORD_GILDED = GET_SWORD_FROM_IA(PLAYER_IA_SWORD_GILDED), + /* 3 */ PLAYER_SWORD_GREAT_FAIRY = GET_SWORD_FROM_IA(PLAYER_IA_SWORD_GREAT_FAIRY), + /* 4 */ PLAYER_SWORD_MAX +} PlayerSword; + typedef enum PlayerMeleeWeaponAnimation { /* 0 */ PLAYER_MWA_FORWARD_SLASH_1H, // Vertical one-handed slash /* 1 */ PLAYER_MWA_FORWARD_SLASH_2H, // Vertical two-handed slash @@ -217,10 +298,10 @@ typedef enum PlayerDoorType { } PlayerDoorType; typedef enum PlayerAnimType { - /* 0 */ PLAYER_ANIMTYPE_0, + /* 0 */ PLAYER_ANIMTYPE_DEFAULT, // DEFAULT /* 1 */ PLAYER_ANIMTYPE_1, /* 2 */ PLAYER_ANIMTYPE_2, - /* 3 */ PLAYER_ANIMTYPE_3, + /* 3 */ PLAYER_ANIMTYPE_3, // Two hand weapon /* 4 */ PLAYER_ANIMTYPE_4, /* 5 */ PLAYER_ANIMTYPE_5, /* 6 */ PLAYER_ANIMTYPE_MAX @@ -228,28 +309,29 @@ typedef enum PlayerAnimType { typedef enum PlayerModelType { // left hand - /* 0 */ PLAYER_MODELTYPE_LH_OPEN, - /* 1 */ PLAYER_MODELTYPE_LH_CLOSED, - /* 2 */ PLAYER_MODELTYPE_LH_ONE_HAND_SWORD, - /* 3 */ PLAYER_MODELTYPE_LH_TWO_HAND_SWORD, - /* 4 */ PLAYER_MODELTYPE_LH_4, - /* 5 */ PLAYER_MODELTYPE_LH_BOTTLE, + /* 0 */ PLAYER_MODELTYPE_LH_OPEN, + /* 1 */ PLAYER_MODELTYPE_LH_CLOSED, + /* 2 */ PLAYER_MODELTYPE_LH_ONE_HAND_SWORD, + /* 3 */ PLAYER_MODELTYPE_LH_TWO_HAND_SWORD, + /* 4 */ PLAYER_MODELTYPE_LH_4, + /* 5 */ PLAYER_MODELTYPE_LH_BOTTLE, // right hand - /* 6 */ PLAYER_MODELTYPE_RH_OPEN, - /* 7 */ PLAYER_MODELTYPE_RH_CLOSED, - /* 8 */ PLAYER_MODELTYPE_RH_SHIELD, - /* 9 */ PLAYER_MODELTYPE_RH_BOW, - /* 10 */ PLAYER_MODELTYPE_RH_INSTRUMENT, - /* 11 */ PLAYER_MODELTYPE_RH_HOOKSHOT, + /* 6 */ PLAYER_MODELTYPE_RH_OPEN, + /* 7 */ PLAYER_MODELTYPE_RH_CLOSED, + /* 8 */ PLAYER_MODELTYPE_RH_SHIELD, + /* 9 */ PLAYER_MODELTYPE_RH_BOW, + /* 10 */ PLAYER_MODELTYPE_RH_INSTRUMENT, + /* 11 */ PLAYER_MODELTYPE_RH_HOOKSHOT, // sheath - /* 12 */ PLAYER_MODELTYPE_SHEATH_12, - /* 13 */ PLAYER_MODELTYPE_SHEATH_13, - /* 14 */ PLAYER_MODELTYPE_SHEATH_14, - /* 15 */ PLAYER_MODELTYPE_SHEATH_15, + /* 12 */ PLAYER_MODELTYPE_SHEATH_12, + /* 13 */ PLAYER_MODELTYPE_SHEATH_13, + /* 14 */ PLAYER_MODELTYPE_SHEATH_14, + /* 15 */ PLAYER_MODELTYPE_SHEATH_15, // waist - /* 16 */ PLAYER_MODELTYPE_WAIST, - /* 17 */ PLAYER_MODELTYPE_17, // NULL? - /* 18 */ PLAYER_MODELTYPE_MAX + /* 16 */ PLAYER_MODELTYPE_WAIST, + /* 17 */ PLAYER_MODELTYPE_17, // NULL? + /* 18 */ PLAYER_MODELTYPE_MAX, + /* 255 */ PLAYER_MODELTYPE_RH_FF = 0xFF // disable shield collider, cutscene-specific } PlayerModelType; typedef struct PlayerModelIndices { @@ -368,25 +450,33 @@ typedef enum PlayerBodyPart { typedef struct PlayerAnimationFrame { /* 0x000 */ Vec3s frameTable[PLAYER_LIMB_MAX]; - /* 0x108 */ s16 faceInfo; + /* 0x108 */ s16 appearanceInfo; // bitpack containing the face and hands info } PlayerAnimationFrame; // size = 0x10A #define PLAYER_LIMB_BUF_SIZE (ALIGN16(sizeof(PlayerAnimationFrame)) + 0xF) +#define GET_APPEARANCE_FROM_JOINT_TABLE(jointTable) (((PlayerAnimationFrame *)(jointTable))->appearanceInfo) +#define GET_EYE_INDEX_FROM_JOINT_TABLE(jointTable) ((GET_APPEARANCE_FROM_JOINT_TABLE(jointTable) & 0xF) - 1) +#define GET_MOUTH_INDEX_FROM_JOINT_TABLE(jointTable) (((GET_APPEARANCE_FROM_JOINT_TABLE(jointTable) >> 4) & 0xF) - 1) + +// Note the returned value from this macro needs to be shifted +#define GET_LEFT_HAND_INDEX_FROM_JOINT_TABLE(jointTable) (GET_APPEARANCE_FROM_JOINT_TABLE(jointTable) & 0xF000) +#define GET_RIGHT_HAND_INDEX_FROM_JOINT_TABLE(jointTable) (GET_APPEARANCE_FROM_JOINT_TABLE(jointTable) & 0x0F00) + typedef struct PlayerAgeProperties { /* 0x00 */ f32 unk_00; // ceilingCheckHeight? /* 0x04 */ f32 shadowScale; /* 0x08 */ f32 unk_08; /* 0x0C */ f32 unk_0C; /* 0x10 */ f32 unk_10; - /* 0x14 */ f32 unk_14; - /* 0x18 */ f32 unk_18; - /* 0x1C */ f32 unk_1C; - /* 0x20 */ f32 unk_20; - /* 0x24 */ f32 unk_24; - /* 0x28 */ f32 unk_28; - /* 0x2C */ f32 unk_2C; - /* 0x30 */ f32 unk_30; + /* 0x14 */ f32 unk_14; // compared to wallHeight + /* 0x18 */ f32 unk_18; // compared to wallHeight + /* 0x1C */ f32 unk_1C; // compared to wallHeight + /* 0x20 */ f32 unk_20; // unused? + /* 0x24 */ f32 unk_24; // water stuff // depthInWater + /* 0x28 */ f32 unk_28; // water stuff // depthInWater + /* 0x2C */ f32 unk_2C; // water stuff // depthInWater + /* 0x30 */ f32 unk_30; // water stuff // depthInWater /* 0x34 */ f32 unk_34; /* 0x38 */ f32 unk_38; // wallCheckHeight? /* 0x3C */ f32 unk_3C; @@ -942,8 +1032,8 @@ typedef struct Player { /* 0xAA6 */ u16 unk_AA6; // flags of some kind /* 0xAA8 */ s16 unk_AA8; /* 0xAAA */ s16 unk_AAA; - /* 0xAAC */ Vec3s unk_AAC; - /* 0xAB2 */ Vec3s unk_AB2; + /* 0xAAC */ Vec3s headLimbRot; + /* 0xAB2 */ Vec3s upperLimbRot; /* 0xAB8 */ f32 unk_AB8; /* 0xABC */ f32 unk_ABC; /* 0xAC0 */ f32 unk_AC0; @@ -966,11 +1056,14 @@ typedef struct Player { /* 0xAE7 */ s8 unk_AE7; // a timer /* 0xAE8 */ s16 unk_AE8; // multipurpose timer /* 0xAEC */ f32 unk_AEC; - /* 0xAF0 */ Vec3f unk_AF0[2]; + /* 0xAF0 */ union { // TODO: this may be an union of two structs + Vec3f unk_AF0[2]; + f32 arr_AF0[6]; + }; /* 0xB08 */ f32 unk_B08[2]; // TODO: Investigate if this member actually is an array /* 0xB10 */ f32 unk_B10[6]; /* 0xB28 */ s16 unk_B28; //Burning stick timer? - /* 0xB2A */ s8 getItemDrawId; + /* 0xB2A */ s8 getItemDrawIdPlusOne; /* 0xB2B */ s8 unk_B2B; /* 0xB2C */ f32 windSpeed; /* 0xB30 */ s16 windAngleX; @@ -1022,7 +1115,7 @@ typedef struct Player { /* 0xCC4 */ MtxF mf_CC4; /* 0xD04 */ MtxF shieldMf; /* 0xD44 */ u8 isBurning; - /* 0xD45 */ u8 flameTimers[PLAYER_BODYPART_MAX]; + /* 0xD45 */ u8 flameTimers[PLAYER_BODYPART_MAX]; // one flame per body part /* 0xD57 */ u8 unk_D57; /* 0xD58 */ PlayerFuncD58 unk_D58; /* 0xD5C */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index ca8a3eb1a..e10290356 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -472,7 +472,7 @@ u16 gSceneIdsPerRegion[REGION_MAX][27] = { }; s32 Inventory_GetBtnBItem(PlayState* play) { - if (gSaveContext.buttonStatus[0] == BTN_DISABLED) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { return ITEM_NONE; } else if (gSaveContext.bButtonStatus == BTN_DISABLED) { return ITEM_NONE; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 44d9053ec..8e2f65965 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2032,7 +2032,7 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, GetItemId getItemId, f32 x if (!(player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_1000 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000)) && - Player_GetExplosiveHeld(player) < 0) { + (Player_GetExplosiveHeld(player) <= PLAYER_EXPLOSIVE_NONE)) { if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) { if ((getItemId == GI_MASK_CIRCUS_LEADER || getItemId == GI_PENDANT_OF_MEMORIES || getItemId == GI_DEED_LAND || diff --git a/src/code/z_eff_tire_mark.c b/src/code/z_eff_tire_mark.c index f19eb1289..d7754c5a7 100644 --- a/src/code/z_eff_tire_mark.c +++ b/src/code/z_eff_tire_mark.c @@ -11,7 +11,7 @@ void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f u32 spA0; Vec3s* vtxList = colCtx->colHeader->vtxList; - if ((bgId != 50) || (this->numElements >= (ARRAY_COUNT(this->elements) - 1)) || (colPoly == NULL)) { + if ((bgId != BGCHECK_SCENE) || (this->numElements >= (ARRAY_COUNT(this->elements) - 1)) || (colPoly == NULL)) { func_800AEF44(this); return; } diff --git a/src/code/z_play.c b/src/code/z_play.c index 178802486..99073fb5c 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1266,7 +1266,7 @@ void Play_DrawMain(PlayState* this) { goto PostWorldDraw; } - if (this->unk_18844 == 0) { + if (!this->unk_18844) { if (1) { if ((this->skyboxId != SKYBOX_NONE) && !this->envCtx.skyboxDisabled) { if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_3)) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index a7004ad3c..4c72496d0 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1,15 +1,21 @@ -#include "prevent_bss_reordering.h" +/** + * File: z_player_lib.c + * Description: Set of library functions to interact with the Player system + */ +#include "prevent_bss_reordering.h" #include "global.h" #include "objects/gameplay_keep/gameplay_keep.h" +// Assets for each player form #include "objects/object_link_boy/object_link_boy.h" #include "objects/object_link_goron/object_link_goron.h" #include "objects/object_link_zora/object_link_zora.h" #include "objects/object_link_nuts/object_link_nuts.h" #include "objects/object_link_child/object_link_child.h" +// Assets for each mask #include "objects/object_mask_truth/object_mask_truth.h" #include "objects/object_mask_kerfay/object_mask_kerfay.h" #include "objects/object_mask_yofukasi/object_mask_yofukasi.h" @@ -35,6 +41,9 @@ #include "objects/object_mask_zora/object_mask_zora.h" #include "objects/object_mask_nuts/object_mask_nuts.h" +// Assets for other actors +#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" + void PlayerCall_Init(Actor* thisx, PlayState* play); void PlayerCall_Destroy(Actor* thisx, PlayState* play); void PlayerCall_Update(Actor* thisx, PlayState* play); @@ -49,30 +58,29 @@ typedef struct { struct_801F58B0 D_801F58B0[3][3]; -Vec3f D_801F59B0[2]; +#define D_801F59B0_LEN 2 -s32 D_801F59C8[2]; +Vec3f D_801F59B0[D_801F59B0_LEN]; -typedef struct { - /* 0x0 */ s16 unk_0; - /* 0x2 */ s16 unk_2; - /* 0x4 */ s16 unk_4; - /* 0x6 */ s16 unk_6; - /* 0x8 */ s16 unk_8; -} struct_801F59D0; // size = 0xA +s32 D_801F59C8[D_801F59B0_LEN]; -struct_801F59D0 D_801F59D0; +typedef struct BunnyEarKinematics { + /* 0x0 */ Vec3s rot; + /* 0x6 */ Vec3s angVel; +} BunnyEarKinematics; // size = 0xC -Vec3f* D_801F59DC; +BunnyEarKinematics sBunnyEarKinematics; + +Vec3f* sPlayerCurBodyPartPos; s32 D_801F59E0; -s32 D_801F59E4; +s32 sPlayerLod; -Vec3f D_801F59E8; +Vec3f sPlayerGetItemRefPos; -s32 D_801F59F4; -s32 D_801F59F8; +PlayerModelType sPlayerLeftHandType; +PlayerModelType sPlayerRightHandType; void func_80127B64(struct_801F58B0 arg0[], s32 count, Vec3f* arg2); @@ -149,15 +157,35 @@ void func_801229A0(PlayState* play, Player* player) { CLOSE_DISPS(play->state.gfxCtx); } +// Update function void func_801229EC(Actor* thisx, PlayState* play) { } s16 sMaskObjectIds[PLAYER_MASK_MAX - 1] = { - OBJECT_MASK_TRUTH, OBJECT_MASK_KERFAY, OBJECT_MASK_YOFUKASI, OBJECT_MASK_RABIT, OBJECT_MASK_KI_TAN, - OBJECT_MASK_JSON, OBJECT_MASK_ROMERNY, OBJECT_MASK_ZACHO, OBJECT_MASK_POSTHAT, OBJECT_MASK_MEOTO, - OBJECT_MASK_BIGELF, OBJECT_MASK_GIBUDO, OBJECT_MASK_GERO, OBJECT_MASK_DANCER, OBJECT_MASK_SKJ, - OBJECT_MASK_STONE, OBJECT_MASK_BREE, OBJECT_MASK_BAKURETU, OBJECT_MASK_BU_SAN, OBJECT_MASK_KYOJIN, - OBJECT_MASK_BOY, OBJECT_MASK_GORON, OBJECT_MASK_ZORA, OBJECT_MASK_NUTS, + OBJECT_MASK_TRUTH, // PLAYER_MASK_TRUTH + OBJECT_MASK_KERFAY, // PLAYER_MASK_KAFEIS_MASK + OBJECT_MASK_YOFUKASI, // PLAYER_MASK_ALL_NIGHT + OBJECT_MASK_RABIT, // PLAYER_MASK_BUNNY + OBJECT_MASK_KI_TAN, // PLAYER_MASK_KEATON + OBJECT_MASK_JSON, // PLAYER_MASK_GARO + OBJECT_MASK_ROMERNY, // PLAYER_MASK_ROMANI + OBJECT_MASK_ZACHO, // PLAYER_MASK_CIRCUS_LEADER + OBJECT_MASK_POSTHAT, // PLAYER_MASK_POSTMAN + OBJECT_MASK_MEOTO, // PLAYER_MASK_COUPLE + OBJECT_MASK_BIGELF, // PLAYER_MASK_GREAT_FAIRY + OBJECT_MASK_GIBUDO, // PLAYER_MASK_GIBDO + OBJECT_MASK_GERO, // PLAYER_MASK_DON_GERO + OBJECT_MASK_DANCER, // PLAYER_MASK_KAMARO + OBJECT_MASK_SKJ, // PLAYER_MASK_CAPTAIN + OBJECT_MASK_STONE, // PLAYER_MASK_STONE + OBJECT_MASK_BREE, // PLAYER_MASK_BREMEN + OBJECT_MASK_BAKURETU, // PLAYER_MASK_BLAST + OBJECT_MASK_BU_SAN, // PLAYER_MASK_SCENTS + OBJECT_MASK_KYOJIN, // PLAYER_MASK_GIANT + OBJECT_MASK_BOY, // PLAYER_MASK_FIERCE_DEITY + OBJECT_MASK_GORON, // PLAYER_MASK_GORON + OBJECT_MASK_ZORA, // PLAYER_MASK_ZORA + OBJECT_MASK_NUTS, // PLAYER_MASK_DEKU }; // Load mask object? @@ -197,7 +225,7 @@ void func_801229FC(Player* player) { } else if (player->currentMask == PLAYER_MASK_CIRCUS_LEADER) { s32 i; - for (i = 0; i < ARRAY_COUNT(D_801F59C8); i++) { + for (i = 0; i < D_801F59B0_LEN; i++) { D_801F59C8[i] += Rand_S16Offset(4, 23) + (s32)(fabsf(player->linearVelocity) * 50.0f); } } @@ -356,6 +384,7 @@ void func_8012300C(PlayState* play, s32 arg1) { player->unk_B2B = arg1; } +// Update function void func_8012301C(Actor* thisx, PlayState* play2) { PlayState* play = play2; Player* this = (Player*)thisx; @@ -386,21 +415,29 @@ FlexSkeletonHeader* gPlayerSkeletons[PLAYER_FORM_MAX] = { &gLinkFierceDeitySkel, &gLinkGoronSkel, &gLinkZoraSkel, &gLinkDekuSkel, &gLinkHumanSkel, }; -s16 D_801BFE14[][18] = { +s16 D_801BFE14[PLAYER_BOOTS_MAX][18] = { + // PLAYER_BOOTS_FIERCE_DEITY { 200, 666, 200, 700, 366, 200, 600, 175, 60, 800, 1000, -100, 600, 590, 800, 125, 300, 65 }, + // PLAYER_BOOTS_HYLIAN { 200, 1000, 300, 800, 500, 400, 800, 400, 120, 800, 550, -100, 600, 540, 750, 125, 400, 200 }, + // PLAYER_BOOTS_GIANT { 100, 1000, 300, 800, 250, 200, 800, 200, 90, 800, 350, -80, 600, 540, 750, 60, 200, 200 }, + // PLAYER_BOOTS_DEKU { 200, 1000, 300, 700, 550, 270, 600, 1000, 120, 800, 600, -100, 600, 590, 750, 125, 200, 130 }, + // PLAYER_BOOTS_ZORA_LAND { 200, 1000, 300, 700, 550, 270, 700, 300, 120, 800, 600, -100, 600, 590, 750, 125, 200, 130 }, + // PLAYER_BOOTS_ZORA_UNDERWATER { 200, 1000, 300, 700, 550, 270, 700, 300, 120, 800, 600, -100, 600, 590, 750, 125, 200, 130 }, + // PLAYER_BOOTS_GORON { 200, 1000, 300, 700, 550, 270, 700, 200, 120, 800, 600, -140, 600, 590, 750, 125, 200, 130 }, + // PLAYER_BOOTS_7 { 80, 800, 150, 700, 480, 270, 600, 50, 120, 800, 300, -40, 400, 540, 270, 25, 0, 80 }, }; // OoT's Player_SetBootData void func_80123140(PlayState* play, Player* player) { s16* bootRegs; - s32 currentBoots; + PlayerBoots currentBoots; f32 scale; if ((player->actor.id == ACTOR_PLAYER) && (player->transformation == PLAYER_FORM_FIERCE_DEITY)) { @@ -637,7 +674,7 @@ u8 sActionModelGroups[PLAYER_IA_MAX] = { PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NUT PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PICTO_BOX PLAYER_MODELGROUP_INSTRUMENT, // PLAYER_IA_OCARINA - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_EMPTY PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_SPRING_WATER PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_HOT_SPRING_WATER @@ -751,10 +788,10 @@ PlayerModelIndices gPlayerModelTypes[PLAYER_MODELGROUP_MAX] = { { PLAYER_ANIMTYPE_1, PLAYER_MODELTYPE_LH_ONE_HAND_SWORD, PLAYER_MODELTYPE_RH_SHIELD, PLAYER_MODELTYPE_SHEATH_13, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_DEFAULT */ - { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, + { PLAYER_ANIMTYPE_DEFAULT, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_4 */ - { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, + { PLAYER_ANIMTYPE_DEFAULT, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_TWO_HAND_SWORD */ { PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_TWO_HAND_SWORD, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_14, @@ -766,7 +803,7 @@ PlayerModelIndices gPlayerModelTypes[PLAYER_MODELGROUP_MAX] = { { PLAYER_ANIMTYPE_5, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_8 */ - { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_4, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, + { PLAYER_ANIMTYPE_DEFAULT, PLAYER_MODELTYPE_LH_4, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_HOOKSHOT */ { PLAYER_ANIMTYPE_4, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_HOOKSHOT, PLAYER_MODELTYPE_SHEATH_14, @@ -775,16 +812,16 @@ PlayerModelIndices gPlayerModelTypes[PLAYER_MODELGROUP_MAX] = { { PLAYER_ANIMTYPE_3, PLAYER_MODELTYPE_LH_CLOSED, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_INSTRUMENT */ - { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_INSTRUMENT, PLAYER_MODELTYPE_SHEATH_14, + { PLAYER_ANIMTYPE_DEFAULT, PLAYER_MODELTYPE_LH_OPEN, PLAYER_MODELTYPE_RH_INSTRUMENT, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_BOTTLE */ - { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_BOTTLE, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, + { PLAYER_ANIMTYPE_DEFAULT, PLAYER_MODELTYPE_LH_BOTTLE, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_13 */ - { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_ONE_HAND_SWORD, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_15, + { PLAYER_ANIMTYPE_DEFAULT, PLAYER_MODELTYPE_LH_ONE_HAND_SWORD, PLAYER_MODELTYPE_RH_OPEN, PLAYER_MODELTYPE_SHEATH_15, PLAYER_MODELTYPE_WAIST }, /* PLAYER_MODELGROUP_ZORA_FINS */ - { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_CLOSED, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_14, + { PLAYER_ANIMTYPE_DEFAULT, PLAYER_MODELTYPE_LH_CLOSED, PLAYER_MODELTYPE_RH_CLOSED, PLAYER_MODELTYPE_SHEATH_14, PLAYER_MODELTYPE_WAIST }, }; @@ -796,9 +833,11 @@ Gfx* gPlayerWaistDLs[2 * PLAYER_FORM_MAX] = { gLinkZoraWaistDL, gLinkDekuWaistDL, gLinkDekuWaistDL, gLinkHumanWaistDL, gLinkHumanWaistDL, }; -Gfx* gPlayerHandHoldingShields[PLAYER_SHIELD_MAX - 1][2] = { - { gLinkHumanRightHandHoldingHylianShieldDL, gLinkHumanRightHandHoldingHylianShieldDL }, - { gLinkHumanRightHandHoldingMirrorShieldDL, gLinkHumanRightHandHoldingMirrorShieldDL }, +Gfx* gPlayerHandHoldingShields[2 * (PLAYER_SHIELD_MAX - 1)] = { + gLinkHumanRightHandHoldingHerosShieldDL, + gLinkHumanRightHandHoldingHerosShieldDL, + gLinkHumanRightHandHoldingMirrorShieldDL, + gLinkHumanRightHandHoldingMirrorShieldDL, }; Gfx* gPlayerSheath12DLs[2 * PLAYER_FORM_MAX] = { @@ -840,21 +879,21 @@ Gfx* gPlayerSheath14DLs[2 * PLAYER_FORM_MAX] = { gLinkHumanSheathEmptyDL, }; -Gfx* gPlayerShields[][2] = { - { gLinkHumanHylianShieldWithMtxDL, gLinkHumanHylianShieldWithMtxDL }, - { gLinkHumanMirrorShieldWithMtxDL, gLinkHumanMirrorShieldWithMtxDL }, +Gfx* gPlayerShields[] = { + gLinkHumanHerosShieldWithMtxDL, + gLinkHumanHerosShieldWithMtxDL, + gLinkHumanMirrorShieldWithMtxDL, + gLinkHumanMirrorShieldWithMtxDL, }; -Gfx* gPlayerSheathedSwords[][2] = { - { gLinkHumanSheathedKokiriSwordDL, gLinkHumanSheathedKokiriSwordDL }, - { gLinkHumanSheathedRazorSwordDL, gLinkHumanSheathedRazorSwordDL }, - { gLinkHumanSheathedGildedSwordDL, gLinkHumanSheathedGildedSwordDL }, +Gfx* gPlayerSheathedSwords[] = { + gLinkHumanSheathedKokiriSwordDL, gLinkHumanSheathedKokiriSwordDL, gLinkHumanSheathedRazorSwordDL, + gLinkHumanSheathedRazorSwordDL, gLinkHumanSheathedGildedSwordDL, gLinkHumanSheathedGildedSwordDL, }; -Gfx* gPlayerSwordSheaths[][2] = { - { gLinkHumanKokiriSwordSheathDL, gLinkHumanKokiriSwordSheathDL }, - { gLinkHumanRazorSwordSheathDL, gLinkHumanRazorSwordSheathDL }, - { gLinkHumanGildedSwordSheathDL, gLinkHumanGildedSwordSheathDL }, +Gfx* gPlayerSwordSheaths[] = { + gLinkHumanKokiriSwordSheathDL, gLinkHumanKokiriSwordSheathDL, gLinkHumanRazorSwordSheathDL, + gLinkHumanRazorSwordSheathDL, gLinkHumanGildedSwordSheathDL, gLinkHumanGildedSwordSheathDL, }; Gfx* gPlayerLeftHandTwoHandSwordDLs[2 * PLAYER_FORM_MAX] = { @@ -895,10 +934,16 @@ Gfx* gPlayerLeftHandOneHandSwordDLs[2 * PLAYER_FORM_MAX] = { gLinkHumanLeftHandHoldingKokiriSwordDL, }; -Gfx* D_801C018C[][2] = { - { gLinkHumanLeftHandHoldingKokiriSwordDL, gLinkHumanLeftHandHoldingKokiriSwordDL }, - { gLinkHumanLeftHandHoldingRazorSwordDL, gLinkHumanLeftHandHoldingRazorSwordDL }, - { gLinkHumanLeftHandHoldingGildedSwordDL, gLinkHumanLeftHandHoldingGildedSwordDL }, +Gfx* D_801C018C[] = { + // EQUIP_VALUE_SWORD_KOKIRI + gLinkHumanLeftHandHoldingKokiriSwordDL, + gLinkHumanLeftHandHoldingKokiriSwordDL, + // EQUIP_VALUE_SWORD_RAZOR + gLinkHumanLeftHandHoldingRazorSwordDL, + gLinkHumanLeftHandHoldingRazorSwordDL, + // EQUIP_VALUE_SWORD_GILDED + gLinkHumanLeftHandHoldingGildedSwordDL, + gLinkHumanLeftHandHoldingGildedSwordDL, }; Gfx* gPlayerRightHandOpenDLs[2 * PLAYER_FORM_MAX] = { @@ -967,22 +1012,22 @@ Gfx* gPlayerLeftHandBottleDLs[2 * PLAYER_FORM_MAX] = { /* DLists groups end */ -Gfx* D_801C0294[PLAYER_FORM_MAX] = { +Gfx* sPlayerFirstPersonLeftForearmDLs[PLAYER_FORM_MAX] = { gLinkFierceDeityLeftForearmDL, gLinkGoronLeftForearmDL, gLinkZoraLeftForearmDL, gLinkDekuLeftForearmDL, gLinkHumanLeftForearmDL, }; -Gfx* D_801C02A8[PLAYER_FORM_MAX] = { +Gfx* sPlayerFirstPersonLeftHandDLs[PLAYER_FORM_MAX] = { gLinkFierceDeityLeftHandDL, gLinkGoronLeftHandOpenDL, gLinkZoraLeftHandClosedDL, gLinkDekuLeftHandDL, gLinkHumanLeftHandClosedDL, }; -Gfx* D_801C02BC[PLAYER_FORM_MAX] = { +Gfx* sPlayerFirstPersonRightShoulderDLs[PLAYER_FORM_MAX] = { gLinkFierceDeityRightShoulderDL, gLinkGoronRightShoulderDL, gLinkZoraRightShoulderDL, gLinkDekuRightShoulderDL, gLinkHumanRightShoulderDL, }; -Gfx* D_801C02D0[PLAYER_FORM_MAX] = { +Gfx* sPlayerFirstPersonRightHandDLs[PLAYER_FORM_MAX] = { gLinkFierceDeityRightHandDL, //! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist 0x060038C0, @@ -991,7 +1036,7 @@ Gfx* D_801C02D0[PLAYER_FORM_MAX] = { object_link_child_DL_018490, }; -Gfx* D_801C02E4[PLAYER_FORM_MAX] = { +Gfx* sPlayerFirstPersonRightHandHookshotDLs[PLAYER_FORM_MAX] = { gLinkFierceDeityRightHandDL, //! @bug This is in the middle of a texture in the link_goron object. It has the same offset as a link_nuts dlist 0x060038C0, @@ -1224,7 +1269,7 @@ void Player_SetModelGroup(Player* player, PlayerModelGroup modelGroup) { player->modelGroup = modelGroup; if (modelGroup == PLAYER_MODELGROUP_1) { - player->modelAnimType = PLAYER_ANIMTYPE_0; + player->modelAnimType = PLAYER_ANIMTYPE_DEFAULT; } else { player->modelAnimType = gPlayerModelTypes[modelGroup].modelAnimType; } @@ -1232,7 +1277,7 @@ void Player_SetModelGroup(Player* player, PlayerModelGroup modelGroup) { if (player->modelAnimType < PLAYER_ANIMTYPE_3) { if (((player->transformation != PLAYER_FORM_FIERCE_DEITY) && (player->transformation != PLAYER_FORM_HUMAN)) || (player->currentShield == PLAYER_SHIELD_NONE)) { - player->modelAnimType = PLAYER_ANIMTYPE_0; + player->modelAnimType = PLAYER_ANIMTYPE_DEFAULT; } } @@ -1367,34 +1412,35 @@ s32 func_801240DC(Player* player) { return Player_IsHoldingHookshot(player) && (player->heldActor == NULL); } -s32 func_80124110(Player* player, PlayerItemAction itemAction) { - s32 temp_v0 = itemAction - PLAYER_IA_FISHING_ROD; +PlayerBButtonSword Player_BButtonSwordFromIA(Player* player, PlayerItemAction itemAction) { + PlayerBButtonSword bButtonSword = GET_B_SWORD_FROM_IA(itemAction); if (player->transformation != PLAYER_FORM_GORON) { - if (((itemAction - PLAYER_IA_FISHING_ROD) > (PLAYER_IA_FISHING_ROD - PLAYER_IA_FISHING_ROD)) && - ((itemAction - PLAYER_IA_FISHING_ROD) < (PLAYER_IA_SWORD_GREAT_FAIRY - PLAYER_IA_FISHING_ROD))) { - return temp_v0; + if ((GET_B_SWORD_FROM_IA(itemAction) > PLAYER_B_SWORD_NONE) && + (GET_B_SWORD_FROM_IA(itemAction) < PLAYER_B_SWORD_MAX)) { + return bButtonSword; } } - return 0; + return PLAYER_B_SWORD_NONE; } -s32 func_80124148(Player* player) { - return func_80124110(player, player->heldItemAction); +PlayerBButtonSword Player_GetHeldBButtonSword(Player* player) { + return Player_BButtonSwordFromIA(player, player->heldItemAction); } -s32 Player_ActionToMeleeWeapon(PlayerItemAction itemAction) { - s32 weapon = itemAction - (PLAYER_IA_SWORD_KOKIRI - 1); +PlayerMeleeWeapon Player_MeleeWeaponFromIA(PlayerItemAction itemAction) { + PlayerMeleeWeapon weapon = GET_MELEE_WEAPON_FROM_IA(itemAction); - if ((weapon > 0) && (weapon <= (PLAYER_IA_ZORA_FINS - (PLAYER_IA_SWORD_KOKIRI - 1)))) { + if ((weapon > PLAYER_MELEEWEAPON_NONE) && (weapon < PLAYER_MELEEWEAPON_MAX)) { return weapon; } - return 0; + + return PLAYER_MELEEWEAPON_NONE; } -s32 Player_GetMeleeWeaponHeld(Player* player) { - return Player_ActionToMeleeWeapon(player->heldItemAction); +PlayerMeleeWeapon Player_GetMeleeWeaponHeld(Player* player) { + return Player_MeleeWeaponFromIA(player->heldItemAction); } s32 Player_IsHoldingTwoHandedWeapon(Player* player) { @@ -1406,47 +1452,45 @@ s32 Player_IsHoldingTwoHandedWeapon(Player* player) { return false; } -s32 Player_ActionToBottle(Player* player, PlayerItemAction itemAction) { - s32 bottle = itemAction - PLAYER_IA_BOTTLE; +PlayerBottle Player_BottleFromIA(Player* player, PlayerItemAction itemAction) { + PlayerBottle bottle = GET_BOTTLE_FROM_IA(itemAction); - // Relies on bottle-related item actions to be contiguous - if ((bottle >= (PLAYER_IA_BOTTLE - PLAYER_IA_BOTTLE)) && (bottle <= (PLAYER_IA_BOTTLE_FAIRY - PLAYER_IA_BOTTLE))) { + if ((bottle > PLAYER_BOTTLE_NONE) && (bottle < PLAYER_BOTTLE_MAX)) { return bottle; } - return -1; + return PLAYER_BOTTLE_NONE; } -s32 Player_GetBottleHeld(Player* Player) { - return Player_ActionToBottle(Player, Player->heldItemAction); +PlayerBottle Player_GetBottleHeld(Player* Player) { + return Player_BottleFromIA(Player, Player->heldItemAction); } -s32 Player_ActionToExplosive(Player* player, PlayerItemAction itemAction) { - s32 explosive = itemAction - PLAYER_IA_BOMB; +PlayerExplosive Player_ExplosiveFromIA(Player* player, PlayerItemAction itemAction) { + PlayerExplosive explosive = GET_EXPLOSIVE_FROM_IA(itemAction); - // Relies on explosive-related item actions to be contiguous - if ((explosive >= (PLAYER_IA_BOMB - PLAYER_IA_BOMB)) && (explosive <= (PLAYER_IA_BOMBCHU - PLAYER_IA_BOMB))) { + if ((explosive > PLAYER_EXPLOSIVE_NONE) && (explosive < PLAYER_EXPLOSIVE_MAX)) { return explosive; } - return -1; + return PLAYER_EXPLOSIVE_NONE; } -s32 Player_GetExplosiveHeld(Player* player) { - return Player_ActionToExplosive(player, player->heldItemAction); +PlayerExplosive Player_GetExplosiveHeld(Player* player) { + return Player_ExplosiveFromIA(player, player->heldItemAction); } -s32 Player_ActionToSword(Actor* actor, PlayerItemAction itemAction) { - s32 sword = 0; +// Note this function maps PLAYER_IA_LAST_USED to PLAYER_SWORD_KOKIRI +PlayerSword Player_SwordFromIA(Player* player, PlayerItemAction itemAction) { + PlayerSword sword = PLAYER_SWORD_KOKIRI; //! FAKE: if ((itemAction == PLAYER_IA_LAST_USED) || - ((sword = itemAction - PLAYER_IA_SWORD_KOKIRI, (sword >= PLAYER_IA_SWORD_KOKIRI - PLAYER_IA_SWORD_KOKIRI)) && - (sword <= PLAYER_IA_SWORD_GREAT_FAIRY - PLAYER_IA_SWORD_KOKIRI))) { + ((sword = GET_SWORD_FROM_IA(itemAction), (sword > PLAYER_SWORD_NONE)) && (sword < PLAYER_SWORD_MAX))) { return sword; } - return -1; + return PLAYER_SWORD_NONE; } s32 func_801242B4(Player* player) { @@ -1485,8 +1529,45 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) { return envHazard + 1; } -void func_80124420(Player* player); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80124420.s") +void Player_UpdateBunnyEars(Player* player) { + Vec3s force; + s16 angle; + + sBunnyEarKinematics.angVel.x -= sBunnyEarKinematics.angVel.x >> 3; + sBunnyEarKinematics.angVel.y -= sBunnyEarKinematics.angVel.y >> 3; + sBunnyEarKinematics.angVel.x += -sBunnyEarKinematics.rot.x >> 2; + sBunnyEarKinematics.angVel.y += -sBunnyEarKinematics.rot.y >> 2; + + angle = player->actor.world.rot.y - player->actor.shape.rot.y; + force.x = + (s32)(player->actor.speed * -200.0f * Math_CosS(angle) * (randPlusMinusPoint5Scaled(2.0f) + 10.0f)) & 0xFFFF; + force.y = + (s32)(player->actor.speed * 100.0f * Math_SinS(angle) * (randPlusMinusPoint5Scaled(2.0f) + 10.0f)) & 0xFFFF; + + sBunnyEarKinematics.angVel.x += force.x >> 2; + sBunnyEarKinematics.angVel.y += force.y >> 2; + + if (sBunnyEarKinematics.angVel.x > 0x1770) { + sBunnyEarKinematics.angVel.x = 0x1770; + } else if (sBunnyEarKinematics.angVel.x < -0x1770) { + sBunnyEarKinematics.angVel.x = -0x1770; + } + + if (sBunnyEarKinematics.angVel.y > 0x1770) { + sBunnyEarKinematics.angVel.y = 0x1770; + } else if (sBunnyEarKinematics.angVel.y < -0x1770) { + sBunnyEarKinematics.angVel.y = -0x1770; + } + + sBunnyEarKinematics.rot.x += sBunnyEarKinematics.angVel.x; + sBunnyEarKinematics.rot.y += sBunnyEarKinematics.angVel.y; + + if (sBunnyEarKinematics.rot.x < 0) { + sBunnyEarKinematics.rot.z = sBunnyEarKinematics.rot.x >> 1; + } else { + sBunnyEarKinematics.rot.z = 0; + } +} void func_80124618(struct_80124618 arg0[], f32 curFrame, Vec3f* arg2) { s32 currentFrame = curFrame; @@ -1542,16 +1623,22 @@ Gfx gCullFrontDList[] = { gsSPEndDisplayList(), }; -TexturePtr sPlayerEyesTextures[] = { - gLinkHumanEyesOpenTex, gLinkHumanEyesHalfTex, gLinkHumanEyesClosedTex, gLinkHumanEyesRollRightTex, - gLinkHumanEyesRollLeftTex, gLinkHumanEyesRollUpTex, gLinkHumanEyesRollDownTex, object_link_child_Tex_003800, +TexturePtr sPlayerEyesTextures[PLAYER_EYES_MAX] = { + gLinkHumanEyesOpenTex, // PLAYER_EYES_OPEN + gLinkHumanEyesHalfTex, // PLAYER_EYES_HALF + gLinkHumanEyesClosedTex, // PLAYER_EYES_CLOSED + gLinkHumanEyesRollRightTex, // PLAYER_EYES_ROLL_RIGHT + gLinkHumanEyesRollLeftTex, // PLAYER_EYES_ROLL_LEFT + gLinkHumanEyesRollUpTex, // PLAYER_EYES_ROLL_UP + gLinkHumanEyesRollDownTex, // PLAYER_EYES_ROLL_DOWN + object_link_child_Tex_003800, // PLAYER_EYES_7 }; -TexturePtr sPlayerMouthTextures[] = { - gLinkHumanMouthClosedTex, - gLinkHumanMouthTeethTex, - gLinkHumanMouthAngryTex, - gLinkHumanMouthHappyTex, +TexturePtr sPlayerMouthTextures[PLAYER_MOUTH_MAX] = { + gLinkHumanMouthClosedTex, // PLAYER_MOUTH_CLOSED + gLinkHumanMouthTeethTex, // PLAYER_MOUTH_TEETH + gLinkHumanMouthAngryTex, // PLAYER_MOUTH_ANGRY + gLinkHumanMouthHappyTex, // PLAYER_MOUTH_HAPPY }; typedef struct PlayerFaceIndices { @@ -1583,8 +1670,8 @@ PlayerFaceIndices sPlayerFaces[] = { void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, PlayerTransformation playerForm, s32 boots, s32 face, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor) { - s32 eyeIndex = (jointTable[22].x & 0xF) - 1; - s32 mouthIndex = ((jointTable[22].x >> 4) & 0xF) - 1; + s32 eyeIndex = GET_EYE_INDEX_FROM_JOINT_TABLE(jointTable); + s32 mouthIndex = GET_MOUTH_INDEX_FROM_JOINT_TABLE(jointTable); Gfx* gfx; OPEN_DISPS(play->state.gfxCtx); @@ -1614,68 +1701,172 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL POLY_OPA_DISP = &gfx[2]; D_801F59E0 = playerForm * 2; - D_801F59E4 = lod; + sPlayerLod = lod; SkelAnime_DrawFlexLod(play, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, actor, lod); CLOSE_DISPS(play->state.gfxCtx); } Vec3f D_801C08C0[PLAYER_FORM_MAX] = { - { 1304.0f, 0.0f, 0.0f }, { 1156.0f, 0.0f, 0.0f }, { 1406.0f, 0.0f, 0.0f }, - { 408.0f, 0.0f, 0.0f }, { 695.0f, 0.0f, 0.0f }, + { 1304.0f, 0.0f, 0.0f }, // PLAYER_FORM_FIERCE_DEITY + { 1156.0f, 0.0f, 0.0f }, // PLAYER_FORM_GORON + { 1406.0f, 0.0f, 0.0f }, // PLAYER_FORM_ZORA + { 408.0f, 0.0f, 0.0f }, // PLAYER_FORM_DEKU + { 695.0f, 0.0f, 0.0f }, // PLAYER_FORM_HUMAN }; f32 D_801C08FC[PLAYER_FORM_MAX] = { - 1265.0f, 1056.0f, 1506.0f, 359.0f, 826.0f, + 1265.0f, // PLAYER_FORM_FIERCE_DEITY + 1056.0f, // PLAYER_FORM_GORON + 1506.0f, // PLAYER_FORM_ZORA + 359.0f, // PLAYER_FORM_DEKU + 826.0f, // PLAYER_FORM_HUMAN }; f32 D_801C0910[PLAYER_FORM_MAX] = { - 170.0416f, 133.63359f, 197.68358f, 16.646399f, 48.302498f, + 170.0416f, // PLAYER_FORM_FIERCE_DEITY + 133.63359f, // PLAYER_FORM_GORON + 197.68358f, // PLAYER_FORM_ZORA + 16.646399f, // PLAYER_FORM_DEKU + 48.302498f, // PLAYER_FORM_HUMAN }; f32 D_801C0924[PLAYER_FORM_MAX] = { - 10.019104f, 22.120003f, -29.12001f, 3.7582989f, -19.925102f, + 10.019104f, // PLAYER_FORM_FIERCE_DEITY + 22.120003f, // PLAYER_FORM_GORON + -29.12001f, // PLAYER_FORM_ZORA + 3.7582989f, // PLAYER_FORM_DEKU + -19.925102f, // PLAYER_FORM_HUMAN }; f32 D_801C0938[PLAYER_FORM_MAX] = { - 5.0f, 4.0f, 1.0f, 1.0f, 3.0f, + 5.0f, // PLAYER_FORM_FIERCE_DEITY + 4.0f, // PLAYER_FORM_GORON + 1.0f, // PLAYER_FORM_ZORA + 1.0f, // PLAYER_FORM_DEKU + 3.0f, // PLAYER_FORM_HUMAN }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80124870.s") +/** + * Adjusts player's legs to slopes and spawns flames when running on lava + */ +void Player_AdjustSingleLeg(PlayState* play, Player* player, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, + s32 thighLimbIndex, s32 shinLimbIndex, s32 footLimbIndex) { + CollisionPoly* poly; + s32 bgId; + f32 yIntersect; + Vec3f sp90; + Vec3f sp84; + Vec3f footprintPos; + f32 sp74; + f32 sp70; + f32 sp7C; -void func_80124CC4(PlayState* play, Player* player, f32 arg2) { + if ((player->stateFlags3 & PLAYER_STATE3_1) || !(player->actor.scale.y >= 0.0f) || + (player->stateFlags1 & PLAYER_STATE1_80) || play->unk_18844) { + return; + } + + sp74 = D_801C0910[player->transformation]; + sp70 = D_801C0924[player->transformation]; + sp7C = D_801C0938[player->transformation] - player->unk_AB8; + Matrix_Push(); + Matrix_TranslateRotateZYX(pos, rot); + Matrix_MultZero(&sp90); + Matrix_TranslateRotateZYX(&D_801C08C0[player->transformation], &skelAnime->jointTable[shinLimbIndex]); + Matrix_Translate(D_801C08FC[player->transformation], 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_MultZero(&sp84); + Matrix_MultVecY(-300.0f, &footprintPos); + Matrix_Pop(); + + footprintPos.y += 15.0f; + yIntersect = BgCheck_EntityRaycastFloor3(&play->colCtx, &poly, &bgId, &footprintPos) + sp7C + + (player->unk_ABC * player->actor.scale.y); + if (sp84.y < yIntersect) { + f32 diffX = sp84.x - sp90.x; + f32 diffY = sp84.y - sp90.y; + f32 diffZ = sp84.z - sp90.z; + f32 distance; + f32 sp58; + f32 sp54; + f32 temp_f20; + f32 sp4C; + f32 sp48; + s16 temp_f8; + s32 temp_v0_4; + s16 phi_t1; + + distance = sqrtf(SQ(diffX) + SQ(diffY) + SQ(diffZ)); + + sp58 = (SQ(distance) + sp70) / (2.0f * distance); + + temp_f20 = sp74 - SQ(sp58); + temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20); + + sp4C = func_80086B30(temp_f20, sp58); + distance = sqrtf(SQ(diffX) + SQ(yIntersect - sp90.y) + SQ(diffZ)); + sp58 = (SQ(distance) + sp70) / (2.0f * distance); + sp54 = distance - sp58; + + temp_f20 = sp74 - SQ(sp58); + temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20); + + sp48 = func_80086B30(temp_f20, sp58); + phi_t1 = (M_PI - (func_80086B30(sp54, temp_f20) + ((M_PI / 2.0f) - sp48))) * (0x8000 / M_PI); + phi_t1 = -skelAnime->jointTable[shinLimbIndex].z + phi_t1; + temp_f8 = (sp48 - sp4C) * (0x8000 / M_PI); + + if ((s16)(ABS_ALT(skelAnime->jointTable[shinLimbIndex].x) + ABS_ALT(skelAnime->jointTable[shinLimbIndex].y)) < + 0) { + phi_t1 = BINANG_ROT180(phi_t1); + } + + rot->z -= temp_f8; + + skelAnime->jointTable[thighLimbIndex].z -= temp_f8; + skelAnime->jointTable[shinLimbIndex].z += phi_t1; + skelAnime->jointTable[footLimbIndex].z = (skelAnime->jointTable[footLimbIndex].z + temp_f8) - phi_t1; + + temp_v0_4 = SurfaceType_GetFloorType(&play->colCtx, poly, bgId); + if ((temp_v0_4 >= 2) && (temp_v0_4 < 4) && !SurfaceType_IsWallDamage(&play->colCtx, poly, bgId)) { + footprintPos.y = yIntersect; + EffectSsGFire_Spawn(play, &footprintPos); + } + } +} + +void Player_DrawHookshotReticle(PlayState* play, Player* player, f32 hookshotDistance) { static Vec3f D_801C094C = { -500.0f, -100.0f, 0.0f }; CollisionPoly* poly; s32 bgId; Vec3f sp7C; Vec3f sp70; Vec3f pos; - Vec3f sp58; - f32 sp54; - f32 scale; D_801C094C.z = 0.0f; Matrix_MultVec3f(&D_801C094C, &sp7C); - D_801C094C.z = arg2; + D_801C094C.z = hookshotDistance; Matrix_MultVec3f(&D_801C094C, &sp70); if (BgCheck_AnyLineTest3(&play->colCtx, &sp7C, &sp70, &pos, &poly, true, true, true, true, &bgId)) { if (!func_800B90AC(play, &player->actor, poly, bgId, &pos) || BgCheck_ProjectileLineTest(&play->colCtx, &sp7C, &sp70, &pos, &poly, true, true, true, true, &bgId)) { + Vec3f sp58; + f32 sp54; + f32 scale; + OPEN_DISPS(play->state.gfxCtx); OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 7); SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &sp58, &sp54); - if (sp54 < 200.0f) { - scale = 0.08f; - } else { - scale = (sp54 / 200.0f) * 0.08f; - } + + scale = (sp54 < 200.0f) ? 0.08f : (sp54 / 200.0f) * 0.08f; + Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.status[player->actor.objBankIndex].segment); - gSPDisplayList(OVERLAY_DISP++, gameplay_keep_DL_04F250); + gSPDisplayList(OVERLAY_DISP++, gHookshotReticleDL); CLOSE_DISPS(play->state.gfxCtx); } @@ -1694,8 +1885,6 @@ Gfx** D_801C0964[] = { }; void func_80124F18(s16* arg0, f32* arg1, s16 arg2, f32 arg3, f32 arg4) { - f32 phi_f12; - if (*arg0 < arg2) { *arg1 += arg3; } else { @@ -1742,7 +1931,26 @@ void func_80124FF0(f32 arg0, s16 arg1, Vec3f* arg2, s16 arg3, Vec3f* arg4, Vec3f func_80124F18(arg6, arg7, temp_v0, 20.0f, 2000.0f); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_801251C4.s") +void func_801251C4(Player* player, Vec3f* arg1) { + Vec3f sp4C; + Vec3f sp40; + + sp4C.x = player->actor.world.pos.x; + sp4C.y = player->actor.world.pos.y + 60.0f; + sp4C.z = player->actor.world.pos.z; + func_80124FF0(-20.0f, player->unk_B8C, &sp4C, player->actor.shape.rot.y, + &player->bodyPartsPos[PLAYER_BODYPART_WAIST], arg1, &player->unk_B90, &player->unk_B10[0], 0.0f, + 0x1F40, &player->unk_B92, &player->unk_B10[1], 0); + + sp40.x = + (player->bodyPartsPos[PLAYER_BODYPART_LEFT_FOOT].x + player->bodyPartsPos[PLAYER_BODYPART_RIGHT_FOOT].x) / 2.0f; + sp40.y = + (player->bodyPartsPos[PLAYER_BODYPART_LEFT_FOOT].y + player->bodyPartsPos[PLAYER_BODYPART_RIGHT_FOOT].y) / 2.0f; + sp40.z = + (player->bodyPartsPos[PLAYER_BODYPART_LEFT_FOOT].z + player->bodyPartsPos[PLAYER_BODYPART_RIGHT_FOOT].z) / 2.0f; + func_80124FF0(-20.0f, player->unk_B90, arg1, (player->actor.shape.rot.y + player->unk_B92), &sp40, arg1, + &player->unk_B94, &player->unk_B10[2], -1.9f, 0x1F40, &player->unk_B96, &player->unk_B10[3], 0); +} void func_80125318(Vec3f* arg0, Vec3s* arg1) { arg0->x = 0.0f; @@ -1769,11 +1977,9 @@ void Player_DrawZoraShield(PlayState* play, Player* player) { u8* phi_a0; Vtx* vtx; Gfx* dList; - f32 scale; + f32 scale = player->unk_B62 * (10.0f / 51.0f); s32 i; - scale = player->unk_B62 * (10.0f / 51.0f); - OPEN_DISPS(play->state.gfxCtx); AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(&object_link_zora_Matanimheader_012A80)); @@ -1801,49 +2007,399 @@ void Player_DrawZoraShield(PlayState* play, Player* player) { CLOSE_DISPS(play->state.gfxCtx); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80125500.s") +void func_80125500(PlayState* play, Player* player, s32 limbIndex, Vec3f* pos, Vec3s* rot) { + if (limbIndex == PLAYER_LIMB_LEFT_THIGH) { + Player_AdjustSingleLeg(play, player, &player->skelAnime, pos, rot, PLAYER_LIMB_LEFT_THIGH, + PLAYER_LIMB_LEFT_SHIN, PLAYER_LIMB_LEFT_FOOT); + } else if (limbIndex == PLAYER_LIMB_RIGHT_THIGH) { + Player_AdjustSingleLeg(play, player, &player->skelAnime, pos, rot, PLAYER_LIMB_RIGHT_THIGH, + PLAYER_LIMB_RIGHT_SHIN, PLAYER_LIMB_RIGHT_FOOT); + } +} -s32 func_80125580(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80125580.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80125CE0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80125D4C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_801262C8.s") - -// unused -s32 func_801263FC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { +s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + s32 pad; Player* player = (Player*)thisx; - if (!func_80125580(play, limbIndex, dList, pos, rot, thisx)) { + if (limbIndex == PLAYER_LIMB_ROOT) { + sPlayerLeftHandType = player->leftHandType; + sPlayerRightHandType = player->rightHandType; + + // `sPlayerCurBodyPartPos` is incremented before each usage, so it starts at index -1. + // What determines if a limb corresponds to a body part is whether or not it has a non-NULL `dList`. + // Note: The increment would not be done for the root limb, even if it had a non-NULL `dList`. + // So if the root limb had a non-NULL `dList` (which is not the case in vanilla), + // an out-of-bounds write to `bodyPartsPos` would occur. + sPlayerCurBodyPartPos = &player->bodyPartsPos[-1]; + + if (player->transformation != PLAYER_FORM_FIERCE_DEITY) { + if (!(player->skelAnime.moveFlags & ANIM_FLAG_4) || (player->skelAnime.moveFlags & ANIM_FLAG_1)) { + pos->x *= player->ageProperties->unk_08; + pos->z *= player->ageProperties->unk_08; + } + if (!(player->skelAnime.moveFlags & ANIM_FLAG_4) || (player->skelAnime.moveFlags & ANIM_FLAG_UPDATEY)) { + pos->y *= player->ageProperties->unk_08; + } + } + + pos->y -= player->unk_AB8; + if ((player->transformation == PLAYER_FORM_ZORA) && (player->stateFlags3 & PLAYER_STATE3_8000)) { + Matrix_Translate(pos->x, ((Math_CosS(player->unk_AAA) - 1.0f) * 200.0f) + pos->y, pos->z, MTXMODE_APPLY); + Matrix_RotateXS(player->unk_AAA, MTXMODE_APPLY); + + if (player->unk_B62 != 0) { + Matrix_Push(); + Matrix_RotateZS(player->unk_B8E, MTXMODE_APPLY); + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); + Matrix_RotateXS(-0x8000, MTXMODE_APPLY); + Matrix_Translate(0.0f, 0.0f, -4000.0f, MTXMODE_APPLY); + Player_DrawZoraShield(play, player); + Matrix_Pop(); + } + + Matrix_RotateZS(player->unk_B86[1], MTXMODE_APPLY); + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); + func_80125318(pos, rot); + } else if (player->stateFlags3 & PLAYER_STATE3_2000) { + Vec3f sp54; + + func_801251C4(player, &sp54); + sp54.x -= player->actor.world.pos.x; + sp54.y -= player->actor.world.pos.y; + sp54.z -= player->actor.world.pos.z; + Matrix_Translate(pos->x + sp54.x, pos->y + sp54.y, pos->z + sp54.z, MTXMODE_APPLY); + Matrix_RotateXS(player->unk_B94, MTXMODE_APPLY); + Matrix_RotateZS(player->unk_B8E, MTXMODE_APPLY); + player->upperLimbRot.x = player->unk_B90 - player->unk_B94; + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); + func_80125318(pos, rot); + } else if (player->unk_AAA != 0) { + Matrix_Translate(pos->x, ((Math_CosS(player->unk_AAA) - 1.0f) * 200.0f) + pos->y, pos->z, MTXMODE_APPLY); + Matrix_RotateXS(player->unk_AAA, MTXMODE_APPLY); + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); + func_80125318(pos, rot); + } + } else { + if (*dList != NULL) { + sPlayerCurBodyPartPos++; + } + + if (limbIndex == PLAYER_LIMB_HEAD) { + rot->x += player->headLimbRot.z; + rot->y -= player->headLimbRot.y; + rot->z += player->headLimbRot.x; + + if (player->transformation == PLAYER_FORM_DEKU) { + EnArrow* bubble = NULL; + + if (((player->skelAnime.animation == &gPlayerAnim_pn_drinkend)) || + (player->unk_284.animation == &gPlayerAnim_pn_tamahaki) || + ((player->stateFlags3 & PLAYER_STATE3_40) && ((bubble = (EnArrow*)player->heldActor) != NULL))) { + Matrix_TranslateRotateZYX(pos, rot); + func_80125340(); + func_80125318(pos, rot); + + if (bubble != NULL) { + s32 requiredScopeTemp[2]; + + player->unk_AF0[0].x = 1.0f - (bubble->bubble.unk_144 * 0.03f); + player->unk_AF0[0].y = 1.0f - (bubble->bubble.unk_144 * 0.01f); + player->unk_AF0[0].z = 1.0f - (bubble->bubble.unk_144 * 0.04f); + rot->z = bubble->bubble.unk_144 * 320.0f; + } else if (player->skelAnime.animation == &gPlayerAnim_pn_drinkend) { + func_80124618(D_801C03E0, player->skelAnime.curFrame, player->unk_AF0); + } else { + func_80124618(D_801C03C0, player->unk_284.curFrame, player->unk_AF0); + } + + Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY); + } + } + } else if (limbIndex == PLAYER_LIMB_TORSO) { + if ((player->skelAnime.animation == &gPlayerAnim_pg_gakkistart) || + (player->skelAnime.animation == &gPlayerAnim_pg_wait) || + (player->skelAnime.animation == &gPlayerAnim_pg_punchC) || + (player->transformation == PLAYER_FORM_ZORA)) { + Matrix_TranslateRotateZYX(pos, rot); + if (player->transformation == PLAYER_FORM_GORON) { + func_80125340(); + } + + func_80125318(pos, rot); + if ((player->transformation != PLAYER_FORM_ZORA) || + (player->skelAnime.animation == &gPlayerAnim_pz_wait)) { + struct_80124618* phi_a0 = + (player->skelAnime.animation == &gPlayerAnim_pz_wait) + ? D_801C0608 + : ((player->skelAnime.animation == &gPlayerAnim_pg_wait) + ? D_801C0628 + : ((player->skelAnime.animation == &gPlayerAnim_pg_punchC) ? D_801C07C0 + : D_801C0460)); + + func_80124618(phi_a0, player->skelAnime.curFrame, player->unk_AF0); + } else { + player->unk_AF0[0].y = 1.0f; + } + + if (player->transformation == PLAYER_FORM_ZORA) { + player->unk_AF0[0].y *= 1.0f + (0.29999995f * player->unk_B10[0]); + player->unk_AF0[0].x = 1.0f; + player->unk_AF0[0].z = 1.0f; + } + Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY); + } + } else if (limbIndex == PLAYER_LIMB_UPPER_ROOT) { + s16 rotX; + s16 rotZ = 0x44C; + + if (player->unk_AA8 != 0) { + Matrix_RotateZS(rotZ, MTXMODE_APPLY); + Matrix_RotateYS(player->unk_AA8, MTXMODE_APPLY); + } + + if (player->upperLimbRot.y != 0) { + Matrix_RotateYS(player->upperLimbRot.y, MTXMODE_APPLY); + } + + rotX = player->upperLimbRot.x; + if ((player->transformation == PLAYER_FORM_DEKU) && (player->stateFlags3 & PLAYER_STATE3_40)) { + if (player->heldActor != NULL) { + rotX += (s16)(((EnArrow*)(player->heldActor))->bubble.unk_144 * -470.0f); + } + } + + Matrix_RotateXS(rotX, MTXMODE_APPLY); + if (player->upperLimbRot.z != 0) { + Matrix_RotateZS(player->upperLimbRot.z, MTXMODE_APPLY); + } + } else { + func_80125500(play, player, limbIndex, pos, rot); + } + } + + return false; +} + +void func_80125CE0(Player* player, struct_80124618* arg1, Vec3f* pos, Vec3s* rot) { + Matrix_TranslateRotateZYX(pos, rot); + func_80125318(pos, rot); + func_80124618(arg1, player->skelAnime.curFrame, player->unk_AF0); + Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY); +} + +s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* actor) { + Player* player = (Player*)actor; + + if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, &player->actor)) { + if (limbIndex == PLAYER_LIMB_LEFT_HAND) { + Gfx** leftHandDLists = player->leftHandDLists; + EquipValueSword swordEquipValue; + + if (player->stateFlags3 & PLAYER_STATE3_2000) { + rot->z -= player->unk_B8C; + } else if ((sPlayerLeftHandType == PLAYER_MODELTYPE_LH_4) && + (player->stateFlags1 & PLAYER_STATE1_2000000)) { + leftHandDLists = &gPlayerLeftHandOpenDLs[D_801F59E0]; + sPlayerLeftHandType = PLAYER_MODELTYPE_LH_OPEN; + } else if ((player->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (player->actor.speed > 2.0f) && + !(player->stateFlags1 & PLAYER_STATE1_8000000)) { + leftHandDLists = &gPlayerLeftHandClosedDLs[D_801F59E0]; + sPlayerLeftHandType = PLAYER_MODELTYPE_LH_CLOSED; + } else if ((player->leftHandType == PLAYER_MODELTYPE_LH_ONE_HAND_SWORD) && + (player->transformation == PLAYER_FORM_HUMAN) && + ((swordEquipValue = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD), + swordEquipValue != EQUIP_VALUE_SWORD_NONE))) { + leftHandDLists = &D_801C018C[2 * ((swordEquipValue - 1) ^ 0)]; + } else { + s32 handIndex = GET_LEFT_HAND_INDEX_FROM_JOINT_TABLE(player->skelAnime.jointTable); + + if (handIndex != 0) { + handIndex = (handIndex >> 12) - 1; + if (handIndex >= 2) { + handIndex = 0; + } + leftHandDLists = &D_801C095C[handIndex][D_801F59E0]; + } + } + + *dList = leftHandDLists[sPlayerLod]; + + if (player->transformation == PLAYER_FORM_GORON) { + if (player->skelAnime.animation == &gPlayerAnim_pg_punchA) { + func_80125CE0(player, D_801C0750, pos, rot); + } + } else if (player->transformation == PLAYER_FORM_ZORA) { + if ((player->stateFlags1 & PLAYER_STATE1_2) || (player->stateFlags1 & PLAYER_STATE1_400) || + func_801242B4(player)) { + *dList = gLinkZoraLeftHandOpenDL; + } else { + s32 phi_a1 = (player->skelAnime.animation == &gPlayerAnim_pz_gakkistart) && + (player->skelAnime.curFrame >= 6.0f); + + if (phi_a1 || (player->skelAnime.animation == &gPlayerAnim_pz_gakkiplay)) { + *dList = object_link_zora_DL_00E2A0; + func_80125CE0(player, phi_a1 ? D_801C0538 : D_801C0560, pos, rot); + } + } + } + } else if (limbIndex == PLAYER_LIMB_RIGHT_HAND) { + if ((player->transformation == PLAYER_FORM_ZORA) && + (((player->stateFlags1 & PLAYER_STATE1_2)) || (player->stateFlags1 & PLAYER_STATE1_400) || + func_801242B4(player))) { + *dList = gLinkZoraRightHandOpenDL; + } else { + Gfx** rightHandDLists = player->rightHandDLists; + + if (player->stateFlags3 & PLAYER_STATE3_2000) { + rot->z -= player->unk_B8C; + } + + if (sPlayerRightHandType == PLAYER_MODELTYPE_RH_SHIELD) { + if (player->transformation == PLAYER_FORM_HUMAN) { + if (player->currentShield != PLAYER_SHIELD_NONE) { + //! FAKE + rightHandDLists = &gPlayerHandHoldingShields[2 * ((player->currentShield - 1) ^ 0)]; + } + } + } else if ((player->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (player->actor.speed > 2.0f) && + (!(player->stateFlags1 & PLAYER_STATE1_8000000))) { + rightHandDLists = &gPlayerRightHandClosedDLs[D_801F59E0]; + sPlayerRightHandType = PLAYER_MODELTYPE_RH_CLOSED; + } else { + s32 handIndex = GET_RIGHT_HAND_INDEX_FROM_JOINT_TABLE(player->skelAnime.jointTable); + + if (handIndex != 0) { + handIndex = (handIndex >> 8) - 1; + rightHandDLists = &D_801C0964[handIndex][D_801F59E0]; + } + } + + *dList = rightHandDLists[sPlayerLod]; + if (player->skelAnime.animation == &gPlayerAnim_pg_punchB) { + func_80125CE0(player, D_801C0784, pos, rot); + } + } + } else if (limbIndex == PLAYER_LIMB_SHEATH) { + Gfx** sheathDLists = player->sheathDLists; + + if (player->transformation == PLAYER_FORM_HUMAN) { + EquipValueSword swordEquipValue = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD); + + if (swordEquipValue != EQUIP_VALUE_SWORD_NONE) { + if ((player->sheathType == PLAYER_MODELTYPE_SHEATH_14) || + (player->sheathType == PLAYER_MODELTYPE_SHEATH_12)) { + sheathDLists = &gPlayerSheathedSwords[2 * ((swordEquipValue - 1) ^ 0)]; + } else { + sheathDLists = &gPlayerSwordSheaths[2 * ((swordEquipValue - 1) ^ 0)]; + } + } + } + + *dList = sheathDLists[sPlayerLod]; + } else if (limbIndex == PLAYER_LIMB_WAIST) { + *dList = player->waistDLists[sPlayerLod]; + } else if (limbIndex == PLAYER_LIMB_HAT) { + if (player->transformation == PLAYER_FORM_ZORA) { + Matrix_Scale((player->unk_B10[0] * 1) + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + } + } + } + + return false; +} + +s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* actor) { + Player* player = (Player*)actor; + + if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, actor)) { + if (player->unk_AA5 != 3) { + *dList = NULL; + } else if (limbIndex == PLAYER_LIMB_LEFT_FOREARM) { + *dList = sPlayerFirstPersonLeftForearmDLs[player->transformation]; + } else if (limbIndex == PLAYER_LIMB_LEFT_HAND) { + *dList = sPlayerFirstPersonLeftHandDLs[player->transformation]; + } else if (limbIndex == PLAYER_LIMB_RIGHT_SHOULDER) { + *dList = sPlayerFirstPersonRightShoulderDLs[player->transformation]; + } else if (limbIndex == PLAYER_LIMB_RIGHT_HAND) { + if (Player_IsHoldingHookshot(player)) { + *dList = sPlayerFirstPersonRightHandHookshotDLs[player->transformation]; + } else { + *dList = sPlayerFirstPersonRightHandDLs[player->transformation]; + } + } else { + *dList = NULL; + } + } + + return false; +} + +// Unused remnant of OoT +s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + Player* player = (Player*)thisx; + + if (!Player_OverrideLimbDrawGameplayCommon(play, limbIndex, dList, pos, rot, thisx)) { *dList = NULL; } return false; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80126440.s") +s32 func_80126440(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase) { + if (!weaponInfo->active) { + if (collider != NULL) { + Collider_ResetQuadAT(play, &collider->base); + } + Math_Vec3f_Copy(&weaponInfo->tip, newTip); + Math_Vec3f_Copy(&weaponInfo->base, newBase); + weaponInfo->active = true; -u8 D_801C096C[PLAYER_SHIELD_MAX] = { - COLTYPE_METAL, - COLTYPE_METAL, - COLTYPE_METAL, + return true; + } + + if ((weaponInfo->tip.x == newTip->x) && (weaponInfo->tip.y == newTip->y) && (weaponInfo->tip.z == newTip->z)) { + if ((weaponInfo->base.x == newBase->x) && (weaponInfo->base.y == newBase->y) && + (weaponInfo->base.z == newBase->z)) { + if (collider != NULL) { + Collider_ResetQuadAT(play, &collider->base); + } + + return false; + } + } + + if (collider != NULL) { + Collider_SetQuadVertices(collider, newBase, newTip, &weaponInfo->base, &weaponInfo->tip); + CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); + } + + Math_Vec3f_Copy(&weaponInfo->base, newBase); + Math_Vec3f_Copy(&weaponInfo->tip, newTip); + weaponInfo->active = true; + + return true; +} + +u8 sPlayerShieldCollisionTypes[PLAYER_SHIELD_MAX] = { + COLTYPE_METAL, // PLAYER_SHIELD_NONE + COLTYPE_METAL, // PLAYER_SHIELD_HEROS_SHIELD + COLTYPE_METAL, // PLAYER_SHIELD_MIRROR_SHIELD }; -void func_801265C8(PlayState* play, Player* player, ColliderQuad* collider, Vec3f arg3[4]) { +void Player_UpdateShieldCollider(PlayState* play, Player* player, ColliderQuad* collider, Vec3f quadSrc[4]) { if (player->stateFlags1 & PLAYER_STATE1_400000) { - Vec3f sp4C; - Vec3f sp40; - Vec3f sp34; - Vec3f sp28; + Vec3f quadDest[4]; - player->shieldQuad.base.colType = D_801C096C[player->currentShield]; - Matrix_MultVec3f(&arg3[0], &sp28); - Matrix_MultVec3f(&arg3[1], &sp34); - Matrix_MultVec3f(&arg3[2], &sp40); - Matrix_MultVec3f(&arg3[3], &sp4C); - Collider_SetQuadVertices(collider, &sp28, &sp34, &sp40, &sp4C); + player->shieldQuad.base.colType = sPlayerShieldCollisionTypes[player->currentShield]; + Matrix_MultVec3f(&quadSrc[0], &quadDest[0]); + Matrix_MultVec3f(&quadSrc[1], &quadDest[1]); + Matrix_MultVec3f(&quadSrc[2], &quadDest[2]); + Matrix_MultVec3f(&quadSrc[3], &quadDest[3]); + Collider_SetQuadVertices(collider, &quadDest[0], &quadDest[1], &quadDest[2], &quadDest[3]); CollisionCheck_SetAC(play, &play->colChkCtx, &collider->base); CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } @@ -1949,47 +2505,73 @@ Gfx* D_801C0B14[] = { }; u8 D_801C0B1C[] = { - 0x0C, - 0x0F, + PLAYER_BODYPART_LEFT_HAND, + PLAYER_BODYPART_RIGHT_HAND, }; Gfx* D_801C0B20[] = { - object_mask_truth_DL_0001A0, - object_mask_kerfay_DL_000D40, - object_mask_yofukasi_DL_000490, - object_mask_rabit_DL_000610, - object_mask_ki_tan_DL_0004A0, - object_mask_json_DL_0004C0, - object_mask_romerny_DL_0007A0, - object_mask_zacho_DL_000700, - object_mask_posthat_DL_000290, - object_mask_meoto_DL_0005A0, - object_mask_bigelf_DL_0016F0, - object_mask_gibudo_DL_000250, - gDonGeroMaskDL, - object_mask_dancer_DL_000EF0, - object_mask_skj_DL_0009F0, - object_mask_stone_DL_000820, - object_mask_bree_DL_0003C0, - object_mask_bakuretu_DL_0005C0, - object_mask_bu_san_DL_000710, - object_mask_kyojin_DL_000380, - gameplay_keep_DL_00B260, - gameplay_keep_DL_005A10, - gameplay_keep_DL_005360, - gDekuMaskDL, + object_mask_truth_DL_0001A0, // PLAYER_MASK_TRUTH + object_mask_kerfay_DL_000D40, // PLAYER_MASK_KAFEIS_MASK + object_mask_yofukasi_DL_000490, // PLAYER_MASK_ALL_NIGHT + object_mask_rabit_DL_000610, // PLAYER_MASK_BUNNY + object_mask_ki_tan_DL_0004A0, // PLAYER_MASK_KEATON + object_mask_json_DL_0004C0, // PLAYER_MASK_GARO + object_mask_romerny_DL_0007A0, // PLAYER_MASK_ROMANI + object_mask_zacho_DL_000700, // PLAYER_MASK_CIRCUS_LEADER + object_mask_posthat_DL_000290, // PLAYER_MASK_POSTMAN + object_mask_meoto_DL_0005A0, // PLAYER_MASK_COUPLE + object_mask_bigelf_DL_0016F0, // PLAYER_MASK_GREAT_FAIRY + object_mask_gibudo_DL_000250, // PLAYER_MASK_GIBDO + gDonGeroMaskDL, // PLAYER_MASK_DON_GERO + object_mask_dancer_DL_000EF0, // PLAYER_MASK_KAMARO + object_mask_skj_DL_0009F0, // PLAYER_MASK_CAPTAIN + object_mask_stone_DL_000820, // PLAYER_MASK_STONE + object_mask_bree_DL_0003C0, // PLAYER_MASK_BREMEN + object_mask_bakuretu_DL_0005C0, // PLAYER_MASK_BLAST + object_mask_bu_san_DL_000710, // PLAYER_MASK_SCENTS + object_mask_kyojin_DL_000380, // PLAYER_MASK_GIANT + gameplay_keep_DL_00B260, // PLAYER_MASK_FIERCE_DEITY + gameplay_keep_DL_005A10, // PLAYER_MASK_GORON + gameplay_keep_DL_005360, // PLAYER_MASK_ZORA + gDekuMaskDL, // PLAYER_MASK_DEKU object_mask_boy_DL_000900, object_mask_goron_DL_0014A0, object_mask_zora_DL_000DB0, object_mask_nuts_DL_001D90, }; -Vec3f D_801C0B90[] = { +Vec3f D_801C0B90[D_801F59B0_LEN] = { { 950.0f, -800.0f, 300.0f }, { 950.0f, -800.0f, -300.0f }, }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8012669C.s") +void func_8012669C(PlayState* play, Player* player, Vec3f* arg2, Vec3f* arg3) { + Vec3f sp3C; + Vec3f sp30; + + Matrix_MultVec3f(arg2, &sp3C); + Matrix_MultVec3f(arg3, &sp30); + + if (player->meleeWeaponState != 0) { + if (func_80126440(play, NULL, &player->meleeWeaponInfo[0], &sp3C, &sp30) && + (player->transformation != PLAYER_FORM_GORON) && (!(player->stateFlags1 & PLAYER_STATE1_400000))) { + EffectBlure_AddVertex(Effect_GetByIndex(player->meleeWeaponEffectIndex[0]), &player->meleeWeaponInfo[0].tip, + &player->meleeWeaponInfo[0].base); + } + if ((player->meleeWeaponState > 0) && ((player->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || + (player->stateFlags2 & PLAYER_STATE2_20000))) { + Matrix_MultVec3f(&arg2[1], &sp3C); + Matrix_MultVec3f(&arg3[1], &sp30); + func_80126440(play, &player->meleeWeaponQuads[0], &player->meleeWeaponInfo[1], &sp3C, &sp30); + Matrix_MultVec3f(&arg2[2], &sp3C); + Matrix_MultVec3f(&arg3[2], &sp30); + func_80126440(play, &player->meleeWeaponQuads[1], &player->meleeWeaponInfo[2], &sp3C, &sp30); + } + } else { + Math_Vec3f_Copy(&player->meleeWeaponInfo[0].tip, &sp3C); + Math_Vec3f_Copy(&player->meleeWeaponInfo[0].base, &sp30); + } +} void Player_DrawGetItemImpl(PlayState* play, Player* player, Vec3f* refPos, s32 drawIdPlusOne) { f32 sp34; @@ -2038,21 +2620,203 @@ void Player_DrawGetItem(PlayState* play, Player* player) { refPos.y = player->actor.world.pos.y + 28.0f; } } else { - Math_Vec3f_Copy(&refPos, &D_801F59E8); + Math_Vec3f_Copy(&refPos, &sPlayerGetItemRefPos); } - drawIdPlusOne = ABS_ALT(player->getItemDrawId); + drawIdPlusOne = ABS_ALT(player->getItemDrawIdPlusOne); Player_DrawGetItemImpl(play, player, &refPos, drawIdPlusOne); } } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80126AB4.s") +void func_80126AB4(Player* player, Vec3f** arg1) { + if ((player->transformation == PLAYER_FORM_GORON) || (player->actor.id == ACTOR_EN_TEST3)) { + Math_Vec3f_Copy(&player->unk_AF0[1], &player->meleeWeaponInfo[0].base); + *arg1 = D_801C09B8; + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80126B8C.s") + D_801C0994[1].x = D_801C0994[0].x; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80126BD0.s") + if (player->unk_ADD >= 3) { + player->unk_ADD++; + D_801C0994[1].x *= 1.0f + ((9 - player->unk_ADD) * 0.1f); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_801271B0.s") + D_801C0994[1].x += 1200.0f; + D_801C0994[2].x = D_801C0994[1].x; + *arg1 = D_801C0994; +} + +void func_80126B8C(PlayState* play, Player* player) { + Vec3f* sp1C; + + func_80126AB4(player, &sp1C); + func_8012669C(play, player, sp1C, D_801C0970); +} + +// Zora boomerangs (?) +void func_80126BD0(PlayState* play, Player* player, s32 arg2) { + if ((player->transformation != PLAYER_FORM_ZORA) || (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) { + return; + } + + if ((arg2 != 0) && (player->stateFlags1 & PLAYER_STATE1_400000)) { + OPEN_DISPS(play->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_link_zora_DL_0110A8); + + CLOSE_DISPS(play->state.gfxCtx); + } else { + Actor* boomerangActor = player->boomerangActor; + Vec3f sp58; + Vec3f sp4C; + + if (player->stateFlags1 & PLAYER_STATE1_2000000) { + if (player->boomerangActor == NULL) { + return; + } + if ((player->boomerangActor->params == arg2) || + (((boomerangActor->child != NULL)) && (boomerangActor->child->params == arg2))) { + return; + } + } + + OPEN_DISPS(play->state.gfxCtx); + + if ((player->skelAnime.animation != &gPlayerAnim_pz_gakkiplay) && + (player->skelAnime.animation != &gPlayerAnim_pz_fishswim)) { + if (player->skelAnime.animation == &gPlayerAnim_pz_gakkistart) { + func_80124618(D_801C0580, player->skelAnime.curFrame, player->unk_AF0); + } else if (player->skelAnime.animation == &gPlayerAnim_pz_waterroll) { + func_80124618(D_801C05A8, player->skelAnime.curFrame, player->unk_AF0); + } else if (player->skelAnime.animation == &gPlayerAnim_pz_swimtowait) { + func_80124618(D_801C05D8, player->skelAnime.curFrame, player->unk_AF0); + } else if (player->skelAnime.animation == &gPlayerAnim_pz_bladeon) { + func_80124618(D_801C07F0, player->skelAnime.curFrame, player->unk_AF0); + } else if (player->skelAnime.animation == &gPlayerAnim_pz_jumpAT) { + func_80124618(D_801C0820, player->skelAnime.curFrame, player->unk_AF0); + } else if (player->skelAnime.animation == &gPlayerAnim_pz_jumpATend) { + func_80124618(D_801C0838, player->skelAnime.curFrame, player->unk_AF0); + } else if (player->heldItemAction == PLAYER_IA_ZORA_FINS) { + player->unk_AF0[0].x = 1.0f; + player->unk_AF0[0].y = 1.0f; + player->unk_AF0[0].z = 1.0f; + } else { + player->unk_AF0[0].x = 0.4f; + player->unk_AF0[0].y = 0.6f; + player->unk_AF0[0].z = 0.7f; + } + Matrix_Push(); + + Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_OPA_DISP++, D_801C0AB4[arg2]); + + if (player->meleeWeaponState != 0) { + if ((((player->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_LEFT)) && (arg2 == 0)) || + ((player->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_COMBO) && (arg2 != 0))) { + func_8012669C(play, player, D_801C0A00, D_801C09DC); + } + } + + Matrix_Pop(); + } + + if (player->skelAnime.animation == &gPlayerAnim_pz_waterroll) { + func_80124618(D_801C05C8, player->skelAnime.curFrame, player->unk_AF0); + D_801C05F0[0].unk_2.x = 50; + D_801C05F0[0].unk_2.y = 50; + D_801C05F0[0].unk_2.z = 50; + D_801C05F0[1].unk_2 = D_801C05F0[0].unk_2; + } else if (player->skelAnime.animation == &gPlayerAnim_pz_swimtowait) { + func_80124618(D_801C05F0, player->skelAnime.curFrame, player->unk_AF0); + } else if (player->skelAnime.animation == &gPlayerAnim_pz_fishswim) { + player->unk_AF0[0].x = (ABS_ALT(player->unk_B8A) * 0.00003f) + 0.5f; + player->unk_AF0[0].y = player->unk_AF0[0].x; + player->unk_AF0[0].z = player->unk_AF0[0].x; + + D_801C05F0[0].unk_2.x = (player->unk_AF0[0].x * 100.0f); + + D_801C05F0[0].unk_2.y = D_801C05F0[0].unk_2.x; + D_801C05F0[0].unk_2.z = D_801C05F0[0].unk_2.x; + + D_801C05F0[1].unk_2 = D_801C05F0[0].unk_2; + } else { + //! @bug Skips CLOSE_DISPS + return; + } + + Matrix_Push(); + Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_801C0ABC[arg2]); + + Matrix_MultVec3f(&D_801C0AC4[arg2], &sp58); + Matrix_MultVec3f(&D_801C0ADC[arg2], &sp4C); + + if (func_80126440(play, NULL, &player->meleeWeaponInfo[arg2], &sp58, &sp4C) && + (player->stateFlags1 & PLAYER_STATE1_8000000)) { + EffectBlure_AddVertex(Effect_GetByIndex(player->meleeWeaponEffectIndex[arg2]), + &player->meleeWeaponInfo[arg2].tip, &player->meleeWeaponInfo[arg2].base); + } + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } +} + +s32 func_801271B0(PlayState* play, Player* player, s32 arg2) { + if (player->transformation == PLAYER_FORM_DEKU) { + if (((player->skelAnime.animation == &gPlayerAnim_pn_kakku)) || + (player->skelAnime.animation == &gPlayerAnim_pn_kakkufinish) || + (player->skelAnime.animation == &gPlayerAnim_pn_rakkafinish) || + (player->skelAnime.animation == &gPlayerAnim_pn_batabata)) { + struct_80124618** sp3C = D_801C0AF4; + + OPEN_DISPS(play->state.gfxCtx); + + if (player->skelAnime.animation == &gPlayerAnim_pn_kakkufinish) { + sp3C = D_801C0AFC; + } else if (player->skelAnime.animation == &gPlayerAnim_pn_batabata) { + sp3C = D_801C0B0C; + } else if (player->skelAnime.animation == &gPlayerAnim_pn_rakkafinish) { + sp3C = D_801C0B04; + } + + Matrix_Push(); + Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY); + func_80124618(sp3C[0], player->skelAnime.curFrame, &player->unk_AF0[1]); + Matrix_Scale(player->unk_AF0[1].x, player->unk_AF0[1].y, player->unk_AF0[1].z, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_OPA_DISP++, D_801C0B14[arg2]); + + Matrix_Translate(2150.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_RotateXS(player->unk_B8A, MTXMODE_APPLY); + func_80124618(sp3C[1], player->skelAnime.curFrame, &player->unk_AF0[1]); + Matrix_Scale(player->unk_AF0[1].x, player->unk_AF0[1].y, player->unk_AF0[1].z, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + // Close flower / Open flower + gSPDisplayList(POLY_OPA_DISP++, + player->actor.velocity.y < -6.0f ? gLinkDekuClosedFlowerDL : gLinkDekuOpenFlowerDL); + + Matrix_MultZero(&player->bodyPartsPos[D_801C0B1C[arg2]]); + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + + return true; + } + } + + return false; +} // Player_SetMaskSegment? s32 func_80127438(PlayState* play, Player* player, s32 currentMask) { @@ -2086,7 +2850,7 @@ void Player_DrawCouplesMask(PlayState* play, Player* player) { AnimatedMat_DrawOpa(play, Lib_SegmentedToVirtual(&object_mask_meoto_Matanimheader_001CD8)); } -void Player_DrawCircusLeadersMask(PlayState* play, Actor* actor) { +void Player_DrawCircusLeadersMask(PlayState* play, Player* player) { static Vec3f bubbleVelocity = { 0.0f, 0.0f, 0.0f }; static Vec3f bubbleAccel = { 0.0f, 0.0f, 0.0f }; Gfx* gfx; @@ -2096,7 +2860,7 @@ void Player_DrawCircusLeadersMask(PlayState* play, Actor* actor) { gfx = POLY_XLU_DISP; - for (i = 0; i < ARRAY_COUNT(D_801C0B90); i++) { + for (i = 0; i < D_801F59B0_LEN; i++) { f32 scaleY = (D_801F59C8[i] / 400.0f) * 0.1f; Matrix_MultVec3f(&D_801C0B90[i], &D_801F59B0[i]); @@ -2106,7 +2870,7 @@ void Player_DrawCircusLeadersMask(PlayState* play, Actor* actor) { D_801F59B0[i].y += -10.0f * scaleY; - if (D_801F59C8[i] < 0x190) { + if (D_801F59C8[i] < 400) { f32 scaleXZ = CLAMP_MAX(scaleY, 0.05f); Matrix_Push(); @@ -2124,12 +2888,11 @@ void Player_DrawCircusLeadersMask(PlayState* play, Actor* actor) { gfx = &gfx[6]; } else { - Player* player = (Player*)actor; - f32 temp_f0 = sqrtf(SQ(player->actor.velocity.x) + SQ(player->actor.velocity.z)); - s16 phi_s0 = temp_f0 * 2000.0f; + f32 speedXZ = sqrtf(SQ(player->actor.velocity.x) + SQ(player->actor.velocity.z)); + s16 phi_s0 = speedXZ * 2000.0f; f32 temp_f20; - bubbleVelocity.y = temp_f0 * 0.4f; + bubbleVelocity.y = speedXZ * 0.4f; bubbleAccel.y = -0.3f; if (phi_s0 > 0x3E80) { @@ -2137,17 +2900,14 @@ void Player_DrawCircusLeadersMask(PlayState* play, Actor* actor) { } phi_s0 = player->actor.focus.rot.y + ((i != 0) ? phi_s0 : -phi_s0); - temp_f20 = temp_f0 * 0.2f; - - if (temp_f20 > 4.0f) { - temp_f20 = 4.0f; - } + temp_f20 = speedXZ * 0.2f; + temp_f20 = CLAMP_MAX(temp_f20, 4.0f); bubbleVelocity.x = -Math_SinS(phi_s0) * temp_f20; bubbleVelocity.z = -Math_CosS(phi_s0) * temp_f20; EffectSsDtBubble_SpawnColorProfile(play, &D_801F59B0[i], &bubbleVelocity, &bubbleAccel, 20, 20, 3, 0); - D_801F59C8[i] -= 0x190; + D_801F59C8[i] -= 400; } } @@ -2214,7 +2974,7 @@ Vec3f D_801C0C30[] = { { 301.0f, -729.0f, 699.0f }, }; -typedef struct { +typedef struct struct_80128388_arg1 { /* 0x00 */ f32 unk_00; /* 0x04 */ s16 unk_04; /* 0x06 */ s16 unk_06; @@ -2230,91 +2990,237 @@ struct_80128388_arg1 D_801C0C54[] = { { 30.0f, 0x0000, 0x0000, { 0.0f, 0.0f, 0.0f }, 20.0f, 0x1F40, 0x2EE0 }, }; -Color_RGB8 D_801C0CA8[] = { - { 255, 255, 255 }, { 80, 80, 255 }, { 136, 192, 255 }, { 136, 192, 255 }, { 184, 232, 232 }, { 248, 200, 0 }, - { 255, 180, 0 }, { 0, 128, 0 }, { 252, 238, 0 }, { 131, 0, 174 }, { 64, 64, 32 }, { 0, 0, 255 }, - { 255, 0, 255 }, { 255, 0, 255 }, { 255, 0, 0 }, { 0, 0, 255 }, { 0, 200, 0 }, { 255, 255, 255 }, - { 255, 255, 255 }, { 255, 255, 255 }, { 80, 80, 255 }, +Color_RGB8 sPlayerBottleColors[PLAYER_BOTTLE_MAX] = { + { 255, 255, 255 }, // PLAYER_BOTTLE_EMPTY + { 80, 80, 255 }, // PLAYER_BOTTLE_FISH + { 136, 192, 255 }, // PLAYER_BOTTLE_SPRING_WATER + { 136, 192, 255 }, // PLAYER_BOTTLE_HOT_SPRING_WATER + { 184, 232, 232 }, // PLAYER_BOTTLE_ZORA_EGG + { 248, 200, 0 }, // PLAYER_BOTTLE_DEKU_PRINCESS + { 255, 180, 0 }, // PLAYER_BOTTLE_GOLD_DUST + { 0, 128, 0 }, // PLAYER_BOTTLE_1C + { 252, 238, 0 }, // PLAYER_BOTTLE_SEAHORSE + { 131, 0, 174 }, // PLAYER_BOTTLE_MUSHROOM + { 64, 64, 32 }, // PLAYER_BOTTLE_HYLIAN_LOACH + { 0, 0, 255 }, // PLAYER_BOTTLE_BUG + { 255, 0, 255 }, // PLAYER_BOTTLE_POE + { 255, 0, 255 }, // PLAYER_BOTTLE_BIG_POE + { 255, 0, 0 }, // PLAYER_BOTTLE_POTION_RED + { 0, 0, 255 }, // PLAYER_BOTTLE_POTION_BLUE + { 0, 200, 0 }, // PLAYER_BOTTLE_POTION_GREEN + { 255, 255, 255 }, // PLAYER_BOTTLE_MILK + { 255, 255, 255 }, // PLAYER_BOTTLE_MILK_HALF + { 255, 255, 255 }, // PLAYER_BOTTLE_CHATEAU + { 80, 80, 255 }, // PLAYER_BOTTLE_FAIRY }; Vec3f D_801C0CE8[PLAYER_FORM_MAX] = { - { 0.0f, 0.0f, 0.0f }, { 300.0f, 300.0f, -230.0f }, { 0.0f, 90.0f, -50.0f }, - { 0.0f, 20.0f, -60.0f }, { 0.0f, 0.0f, 0.0f }, -}; -Vec3f D_801C0D24[PLAYER_FORM_MAX] = { - { 200.0f, 300.0f, 0.0f }, { 200.0f, 200.0f, 0.0f }, { 200.0f, 300.0f, 0.0f }, - { 200.0f, 150.0f, 0.0f }, { 200.0f, 200.0f, 0.0f }, -}; -Vec3f D_801C0D60 = { 398.0f, 1419.0f, 244.0f }; -Vec3f D_801C0D6C = { 420.0f, 1210.0f, 380.0f }; - -f32 D_801C0D78[] = { - 0.0f, // Player is not holding a melee weapon - 3000.0f, // PLAYER_IA_SWORD_KOKIRI - 3000.0f, // PLAYER_IA_SWORD_RAZOR - 4000.0f, // PLAYER_IA_SWORD_GILDED - 5500.0f, // PLAYER_IA_SWORD_GREAT_FAIRY - -1.0f, // PLAYER_IA_STICK - 2500.0f, // PLAYER_IA_ZORA_FINS + { 0.0f, 0.0f, 0.0f }, // PLAYER_FORM_FIERCE_DEITY + { 300.0f, 300.0f, -230.0f }, // PLAYER_FORM_GORON + { 0.0f, 90.0f, -50.0f }, // PLAYER_FORM_ZORA + { 0.0f, 20.0f, -60.0f }, // PLAYER_FORM_DEKU + { 0.0f, 0.0f, 0.0f }, // PLAYER_FORM_HUMAN }; -Gfx* D_801C0D94 = object_link_child_DL_017818; +void Player_DrawBunnyHood(PlayState* play) { + Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Mtx)); + Vec3s earRot; -f32 D_801C0D98 = -35.0f; + OPEN_DISPS(play->state.gfxCtx); -f32 D_801C0D9C = -395.0f; -f32 D_801C0DA0 = 0.0f; + gSPSegment(POLY_OPA_DISP++, 0x0B, mtx); -f32 D_801C0DA4 = 0.0f; + Matrix_Push(); -Vec3f D_801C0DA8[4] = { - { -4500.0f, -3000.0f, -600.0f }, - { 1500.0f, -3000.0f, -600.0f }, - { -4500.0f, 3000.0f, -600.0f }, - { 1500.0f, 3000.0f, -600.0f }, -}; + earRot.x = sBunnyEarKinematics.rot.y + 0x3E2; + earRot.y = sBunnyEarKinematics.rot.z + 0xDBE; + earRot.z = sBunnyEarKinematics.rot.x - 0x348A; + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, -240.0f, &earRot); -Vec3f D_801C0DD8 = { 50.0f, 800.0f, 0.0f }; -Vec3f D_801C0DE4 = { 50.0f, 850.0f, 0.0f }; -Gfx* D_801C0DF0[] = { - object_link_goron_DL_010590, object_link_goron_DL_010368, object_link_goron_DL_010140, - object_link_goron_DL_00FF18, object_link_goron_DL_00FCF0, -}; + Matrix_ToMtx(mtx++); -Vec2f D_801C0E04[PLAYER_FORM_MAX] = { - { 140.0f, -130.0f }, { 0.0f, -200.0f }, { -160.0f, 0.0f }, { 220.0f, -200.0f }, { 0.0f, 0.0f }, -}; + earRot.x = sBunnyEarKinematics.rot.y - 0x3E2; + earRot.y = -sBunnyEarKinematics.rot.z - 0xDBE; + earRot.z = sBunnyEarKinematics.rot.x - 0x348A; + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, 240.0f, &earRot); -Gfx* D_801C0E2C[] = { - object_link_nuts_DL_007A28, object_link_nuts_DL_0077D0, object_link_nuts_DL_007548, - object_link_nuts_DL_007900, object_link_nuts_DL_0076A0, -}; -Vec3f D_801C0E40[PLAYER_FORM_MAX] = { - { 0.0f, 0.0f, 0.0f }, { -578.3f, -1100.9f, 0.0f }, { -189.5f, -594.87f, 0.0f }, - { -570.0f, -812.0f, 0.0f }, { -230.0f, -520.0f, 0.0f }, -}; -Vec3f D_801C0E7C = { 1100.0f, -700.0f, 0.0f }; + Matrix_ToMtx(mtx); -// unused -Vec3f D_801C0E88 = { 1600.0f, -1700.0f, -70.0f }; + Matrix_Pop(); -Vec3f D_801C0E94 = { 1800.0f, -300.0f, 0.0f }; -Vec3f D_801C0EA0 = { 1300.0f, -400.0f, 0.0f }; -Vec3f D_801C0EAC = { 630.0f, 100.0f, -30.0f }; -Vec3s D_801C0EB8 = { 0, 0, 0x7FFF }; + CLOSE_DISPS(play->state.gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/Player_DrawBunnyHood.s") +void func_80127B64(struct_801F58B0 arg0[], s32 count, Vec3f* arg2) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80127B64.s") + for (i = 0; i < count; i++, arg0++) { + Math_Vec3f_Copy(&arg0->unk_00, arg2); + Math_Vec3f_Copy(&arg0->unk_0C, &gZeroVec3f); + arg0->unk_18 = 0; + arg0->unk_1A = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80127BE8.s") +// Draws the Great Fairy's Mask particles when a stray fairy is in the room +void Player_DrawStrayFairyParticles(PlayState* play, Vec3f* arg1) { + Vec3f sp2C; + f32 sp28; + + D_801C0BE0.y = Rand_ZeroFloat(0.07f) + -0.1f; + D_801C0BEC.y = Rand_ZeroFloat(0.1f) + 0.04f; + if (Rand_ZeroOne() < 0.5f) { + sp28 = -1.0f; + } else { + sp28 = 1.0f; + } + + D_801C0BE0.x = (Rand_ZeroFloat(0.2f) + 0.1f) * sp28; + D_801C0BEC.x = 0.1f * sp28; + if (Rand_ZeroOne() < 0.5f) { + sp28 = -1.0f; + } else { + sp28 = 1.0f; + } + + D_801C0BE0.z = (Rand_ZeroFloat(0.2f) + 0.1f) * sp28; + D_801C0BEC.z = 0.1f * sp28; + sp2C.x = arg1->x; + sp2C.y = Rand_ZeroFloat(15.0f) + arg1->y; + sp2C.z = arg1->z; + EffectSsKirakira_SpawnDispersed(play, &sp2C, &D_801C0BE0, &D_801C0BEC, &D_801C0BF8, &D_801C0BFC, -50, 11); +} void func_80127DA4(PlayState* play, struct_801F58B0 arg1[], struct_80128388_arg1 arg2[], s32 arg3, Vec3f* arg4, - Vec3f* arg5, u32* arg6); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80127DA4.s") + Vec3f* arg5, u32* arg6) { + struct_801F58B0* phi_s1 = &arg1[1]; + Vec3f spB0; + Vec3f spA4; + f32 f22; + f32 f28; + f32 f24; + f32 f20; + f32 f0; + f32 sp8C = -1.0f; + s32 i; + s16 s0; + s16 s2; -void func_80128388(struct_801F58B0 arg0[], struct_80128388_arg1 arg1[], s32 arg2, Mtx** arg3); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80128388.s") + Math_Vec3f_Copy(&arg1->unk_00, arg4); + Math_Vec3f_Diff(arg5, arg4, &spB0); + arg1->unk_18 = Math_Atan2S_XY(spB0.z, spB0.x); + arg1->unk_1A = Math_Atan2S_XY(sqrtf(SQXZ(spB0)), spB0.y); + i = 1; + arg2++; + + while (i < arg3) { + if (play->actorCtx.flags & ACTORCTX_FLAG_3) { + if (*arg6 & 0x20) { + sp8C = -0.2f; + } else { + sp8C = 0.2f; + } + + *arg6 += 0x16; + if (!(*arg6 & 1)) { + Player_DrawStrayFairyParticles(play, &phi_s1->unk_00); + } + } + Math_Vec3f_Sum(&phi_s1->unk_00, &phi_s1->unk_0C, &phi_s1->unk_00); + + f0 = Math_Vec3f_DistXYZAndStoreDiff(&arg1->unk_00, &phi_s1->unk_00, &spB0); + f28 = f0 - arg2->unk_00; + if (f0 == 0.0f) { + spB0.x = 0.0f; + spB0.y = arg2->unk_00; + spB0.z = 0.0f; + } + f20 = sqrtf(SQXZ(spB0)); + + if (f20 > 4.0f) { + phi_s1->unk_18 = Math_Atan2S_XY(spB0.z, spB0.x); + s2 = phi_s1->unk_18 - arg1->unk_18; + + if (ABS_ALT(s2) > 0x4000) { + phi_s1->unk_18 = (s16)(phi_s1->unk_18 + 0x8000); + f20 = -f20; + } + } + + phi_s1->unk_1A = Math_Atan2S_XY(f20, spB0.y); + + s2 = phi_s1->unk_18 - arg1->unk_18; + s2 = CLAMP(s2, -arg2->unk_18, arg2->unk_18); + phi_s1->unk_18 = arg1->unk_18 + s2; + + s0 = phi_s1->unk_1A - arg1->unk_1A; + s0 = CLAMP(s0, -arg2->unk_1A, arg2->unk_1A); + phi_s1->unk_1A = arg1->unk_1A + s0; + + f20 = Math_CosS(phi_s1->unk_1A) * arg2->unk_00; + spA4.x = Math_SinS(phi_s1->unk_18) * f20; + spA4.z = Math_CosS(phi_s1->unk_18) * f20; + spA4.y = Math_SinS(phi_s1->unk_1A) * arg2->unk_00; + Math_Vec3f_Sum(&arg1->unk_00, &spA4, &phi_s1->unk_00); + phi_s1->unk_0C.x *= 0.9f; + phi_s1->unk_0C.z *= 0.9f; + + f22 = Math_CosS(s0) * f28; + f24 = Math_SinS(s0) * f28; + phi_s1->unk_0C.y += sp8C; + + if (play->actorCtx.flags & ACTORCTX_FLAG_3) { + phi_s1->unk_0C.y = CLAMP(phi_s1->unk_0C.y, -0.8f, 0.8f); + } else { + phi_s1->unk_0C.y = phi_s1->unk_0C.y; + f20 = Math_SinS(arg1->unk_1A); + phi_s1->unk_0C.y += (((f22 * Math_CosS(arg1->unk_1A)) + (f24 * f20)) * 0.2f); + phi_s1->unk_0C.y = CLAMP(phi_s1->unk_0C.y, -2.0f, 4.0f); + } + + f20 = (f24 * Math_CosS(arg1->unk_1A)) - (Math_SinS(arg1->unk_1A) * f22); + f22 = Math_CosS(s2) * f20; + f24 = Math_SinS(s2) * f20; + + f20 = Math_SinS(arg1->unk_18); + + phi_s1->unk_0C.x += (((f24 * Math_CosS(arg1->unk_18)) - (f22 * f20)) * 0.1f); + phi_s1->unk_0C.x = CLAMP(phi_s1->unk_0C.x, -4.0f, 4.0f); + + f20 = Math_SinS(arg1->unk_18); + + phi_s1->unk_0C.z += (((f22 * Math_CosS(arg1->unk_18)) + (f24 * f20)) * -0.1f); + phi_s1->unk_0C.z = CLAMP(phi_s1->unk_0C.z, -4.0f, 4.0f); + + arg1++; + phi_s1++; + i++; + arg2++; + } +} + +void func_80128388(struct_801F58B0 arg0[], struct_80128388_arg1 arg1[], s32 arg2, Mtx** arg3) { + struct_801F58B0* phi_s1 = &arg0[1]; + Vec3f sp58; + Vec3s sp50; + s32 i; + + sp58.y = 0.0f; + sp58.z = 0.0f; + sp50.x = 0; + + for (i = 1; i < arg2; i++) { + sp58.x = arg1->unk_00 * 100.0f; + sp50.z = arg1->unk_06 + (s16)(phi_s1->unk_1A - arg0->unk_1A); + sp50.y = arg1->unk_04 + (s16)(phi_s1->unk_18 - arg0->unk_18); + Matrix_TranslateRotateZYX(&sp58, &sp50); + Matrix_ToMtx(*arg3); + (*arg3)++; + arg0++; + phi_s1++; + arg1++; + } +} void Player_DrawGreatFairysMask(PlayState* play, Player* player) { s32 pad; @@ -2331,7 +3237,8 @@ void Player_DrawGreatFairysMask(PlayState* play, Player* player) { gSPSegment(POLY_OPA_DISP++, 0x0B, mtx); Matrix_MultVec3f(&D_801C0C00, &D_801C0C54[1].unk_08); - Math_Vec3f_Lerp(&player->bodyPartsPos[7], &player->bodyPartsPos[0], 0.2f, &D_801C0C54[2].unk_08); + Math_Vec3f_Lerp(&player->bodyPartsPos[PLAYER_BODYPART_HEAD], &player->bodyPartsPos[PLAYER_BODYPART_WAIST], 0.2f, + &D_801C0C54[2].unk_08); for (i = 0; i < ARRAY_COUNT(D_801C0C0C); i++) { Matrix_MultVec3f(iter, &sp84); @@ -2351,8 +3258,598 @@ void Player_DrawGreatFairysMask(PlayState* play, Player* player) { CLOSE_DISPS(play->state.gfxCtx); } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80128640.s") +s32 func_80128640(PlayState* play, Player* player, Gfx* dlist) { + s32 temp_v1 = player->skelAnime.animation == &gPlayerAnim_cl_maskoff; + f32 temp_f0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80128B74.s") + if (temp_v1 || + ((player->currentMask != PLAYER_MASK_NONE) && (player->skelAnime.animation == &gPlayerAnim_cl_setmask) && + (temp_f0 = player->skelAnime.curFrame - 8.0f, (temp_f0 >= 0.0f)) && (temp_f0 < 4.0f)) || + (player->stateFlags2 & PLAYER_STATE2_1000000)) { + s32 mask; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80128BD0.s") + if (temp_v1) { + mask = player->prevMask; + } else { + mask = player->currentMask; + } + + if (func_80127438(play, player, mask)) { + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Push(); + Matrix_Translate(-323.67f, 412.15f, -969.96f, MTXMODE_APPLY); + Matrix_RotateZYX(-0x32BE, -0x50DE, -0x7717, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_OPA_DISP++, D_801C0B20[mask - 1]); + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } + + } else if (player->itemAction == PLAYER_IA_STICK) { + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Push(); + Matrix_Translate(-428.26f, 267.2f, -33.82f, MTXMODE_APPLY); + Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY); + Matrix_Scale(1.0f, player->unk_B08[1], 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gDekuStickDL); + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } else if (player->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE) { + PlayerBottle bottle = Player_BottleFromIA(player, player->itemAction); + Vec3f* temp_v1_2 = &D_801C0CE8[player->transformation]; + + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Push(); + Matrix_Translate(temp_v1_2->x, temp_v1_2->y, temp_v1_2->z, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + // Note this does not check for PLAYER_BOTTLE_NONE, which would produce an OoB access on sPlayerBottleColors. + // Under normal circunstances it should not be a problem because of the previous + // `player->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE` check + if (bottle != PLAYER_BOTTLE_EMPTY) { + Color_RGB8* bottleColor = &sPlayerBottleColors[bottle]; + + gDPSetEnvColor(POLY_XLU_DISP++, bottleColor->r, bottleColor->g, bottleColor->b, 0); + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_000320); + } + + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_0003E0); + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } else if (dlist == object_link_zora_DL_00E2A0) { // zora guitar + s16 sp26 = Math_SinS(player->unk_B86[0]) * (ABS_ALT(player->upperLimbRot.x) * ((f32)(IREG(52) + 20)) / 100.0f); + s16 sp24 = Math_SinS(player->unk_B86[1]) * (ABS_ALT(player->upperLimbRot.y) * ((f32)(IREG(53) + 15)) / 100.0f); + + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Push(); + Matrix_RotateXS(sp26, MTXMODE_APPLY); + Matrix_RotateYS(sp24, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_link_zora_DL_00E088); // hand + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } else { + return false; + } + + return true; +} + +Vec3f sPlayerFootPos[PLAYER_FORM_MAX] = { + { 200.0f, 300.0f, 0.0f }, // PLAYER_FORM_FIERCE_DEITY + { 200.0f, 200.0f, 0.0f }, // PLAYER_FORM_GORON + { 200.0f, 300.0f, 0.0f }, // PLAYER_FORM_ZORA + { 200.0f, 150.0f, 0.0f }, // PLAYER_FORM_DEKU + { 200.0f, 200.0f, 0.0f }, // PLAYER_FORM_HUMAN +}; + +void Player_SetFeetPos(PlayState* play, Player* player, s32 limbIndex) { + Vec3f* footPos = &sPlayerFootPos[player->transformation]; + + Actor_SetFeetPos(&player->actor, limbIndex, PLAYER_LIMB_LEFT_FOOT, footPos, PLAYER_LIMB_RIGHT_FOOT, footPos); +} + +void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor) { + Player* player = (Player*)actor; + + if (*dList2 != NULL) { + Matrix_MultZero(sPlayerCurBodyPartPos); + } + + if (limbIndex == PLAYER_LIMB_LEFT_HAND) { + Math_Vec3f_Copy(&player->leftHandWorld.pos, sPlayerCurBodyPartPos); + + if ((*dList1 != NULL) && !func_801271B0(play, player, 0) && !func_80128640(play, player, *dList1) && + (player->skelAnime.animation == &gPlayerAnim_pg_punchA)) { + func_80127488(play, player, D_801C0778[(s32)player->skelAnime.curFrame]); + } + + if (player->actor.scale.y >= 0.0f) { + Actor* heldActor; + MtxF sp230; + + if (!Player_IsHoldingHookshot(player) && ((heldActor = player->heldActor) != NULL)) { + if ((player->stateFlags3 & PLAYER_STATE3_40) && (player->transformation != PLAYER_FORM_DEKU)) { + static Vec3f D_801C0D60 = { 398.0f, 1419.0f, 244.0f }; + static Vec3f D_801C0D6C = { 420.0f, 1210.0f, 380.0f }; + Vec3s* temp_s1; + Vec3f* var_a0 = &D_801C0D60; + + if (player->transformation == PLAYER_FORM_HUMAN) { + var_a0 = &D_801C0D6C; + } + + Matrix_MultVec3f(var_a0, &heldActor->world.pos); + Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY); + + Matrix_Get(&sp230); + temp_s1 = &heldActor->world.rot; + Matrix_MtxFToYXZRot(&sp230, temp_s1, false); + heldActor->shape.rot = *temp_s1; + } else if (player->stateFlags1 & PLAYER_STATE1_800) { + heldActor->world.rot.y = heldActor->shape.rot.y = + player->actor.shape.rot.y + player->leftHandWorld.rot.y; + } + } else { + static f32 sMeleeWeaponLengths[PLAYER_MELEEWEAPON_MAX] = { + 0.0f, // PLAYER_MELEEWEAPON_NONE + 3000.0f, // PLAYER_MELEEWEAPON_SWORD_KOKIRI + 3000.0f, // PLAYER_MELEEWEAPON_SWORD_RAZOR + 4000.0f, // PLAYER_MELEEWEAPON_SWORD_GILDED + 5500.0f, // PLAYER_MELEEWEAPON_SWORD_GREAT_FAIRY + -1.0f, // PLAYER_MELEEWEAPON_STICK + 2500.0f, // PLAYER_MELEEWEAPON_ZORA_FINS + }; + + if ((player->transformation == PLAYER_FORM_FIERCE_DEITY) || + ((player->transformation != PLAYER_FORM_ZORA) && + ((player->itemAction == PLAYER_IA_STICK) || + ((player->meleeWeaponState != 0) && + (player->meleeWeaponAnimation != PLAYER_MWA_GORON_PUNCH_RIGHT) && + (player->meleeWeaponAnimation != PLAYER_MWA_GORON_PUNCH_BUTT))))) { + if (player->itemAction == PLAYER_IA_STICK) { + D_801C0994->x = player->unk_B08[1] * 5000.0f; + } else { + D_801C0994->x = sMeleeWeaponLengths[Player_GetMeleeWeaponHeld(player)]; + } + func_80126B8C(play, player); + } + + Matrix_Get(&player->mf_CC4); + Matrix_MtxFToYXZRot(&player->mf_CC4, &player->leftHandWorld.rot, false); + } + } + } else if (limbIndex == PLAYER_LIMB_RIGHT_HAND) { + Actor* heldActor = player->heldActor; + s32 pad; + + if (*dList1 != NULL) { + if (player->rightHandType == PLAYER_MODELTYPE_RH_BOW) { + static Gfx* D_801C0D94 = object_link_child_DL_017818; + static Vec3f D_801C0D98 = { -35.0f, -395.0f, 0.0f }; + // Unused + static s32 D_801C0DA4 = 0; + + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Push(); + Matrix_Translate(D_801C0D98.x, D_801C0D98.y, D_801C0D98.z, MTXMODE_APPLY); + if ((player->stateFlags3 & PLAYER_STATE3_40) && (player->unk_B28 >= 0) && (player->unk_ACC < 0xB)) { + Vec3f sp20C; + f32 temp_fv0; + s32 pad2; + + Matrix_MultZero(&sp20C); + temp_fv0 = Math_Vec3f_DistXYZ(sPlayerCurBodyPartPos, &sp20C); + player->unk_B08[0] = temp_fv0 - 3.0f; + if (temp_fv0 < 3.0f) { + player->unk_B08[0] = 0.0f; + } else { + player->unk_B08[0] *= 1.6f; + if (player->unk_B08[0] > 1.0f) { + player->unk_B08[0] = 1.0f; + } + } + player->unk_B08[1] = -0.5f; + } + Matrix_Scale(1.0f, player->unk_B08[0], 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_801C0D94); + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } else if (player->skelAnime.animation == &gPlayerAnim_pg_punchB) { + func_80127488(play, player, D_801C07AC[(s32)player->skelAnime.curFrame]); + } else { + func_801271B0(play, player, 1); + } + } + + if (player->actor.scale.y >= 0.0f) { + if (player->rightHandType == PLAYER_MODELTYPE_RH_FF) { + Matrix_Get(&player->shieldMf); + } else if (player->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) { + // Coordinates of the shield quad collider vertices, in the right hand limb's own model space. + static Vec3f sRightHandLimbModelShieldQuadVertices[4] = { + { -4500.0f, -3000.0f, -600.0f }, + { 1500.0f, -3000.0f, -600.0f }, + { -4500.0f, 3000.0f, -600.0f }, + { 1500.0f, 3000.0f, -600.0f }, + }; + + Matrix_Get(&player->shieldMf); + Player_UpdateShieldCollider(play, player, &player->shieldQuad, sRightHandLimbModelShieldQuadVertices); + } else if (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT) { + static Vec3f D_801C0DD8 = { 50.0f, 800.0f, 0.0f }; + + Matrix_MultVec3f(&D_801C0DD8, &player->rightHandWorld.pos); + + if (heldActor != NULL) { + static Vec3f D_801C0DE4 = { 50.0f, 850.0f, 0.0f }; + MtxF sp1BC; + + Matrix_MultVec3f(&D_801C0DE4, &heldActor->world.pos); + Matrix_RotateZYX(0, -0x4000, -0x4000, MTXMODE_APPLY); + Matrix_Get(&sp1BC); + Matrix_MtxFToYXZRot(&sp1BC, &heldActor->world.rot, false); + heldActor->shape.rot = heldActor->world.rot; + if (func_800B7128(player)) { + Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); + Player_DrawHookshotReticle(play, player, 77600.0f); + } + } + } else if (player->meleeWeaponState != 0) { + if (player->meleeWeaponAnimation == PLAYER_MWA_GORON_PUNCH_RIGHT) { + func_80126B8C(play, player); + } + } + if ((player->getItemDrawIdPlusOne != (GID_NONE + 1)) || + ((func_800B7118(player) == 0) && (heldActor != NULL))) { + if (!(player->stateFlags1 & PLAYER_STATE1_400) && (player->getItemDrawIdPlusOne != (GID_NONE + 1)) && + (player->exchangeItemId != PLAYER_IA_NONE)) { + Math_Vec3f_Copy(&sPlayerGetItemRefPos, &player->leftHandWorld.pos); + } else { + sPlayerGetItemRefPos.x = + (player->bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].x + player->leftHandWorld.pos.x) * 0.5f; + sPlayerGetItemRefPos.y = + (player->bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].y + player->leftHandWorld.pos.y) * 0.5f; + sPlayerGetItemRefPos.z = + (player->bodyPartsPos[PLAYER_BODYPART_RIGHT_HAND].z + player->leftHandWorld.pos.z) * 0.5f; + } + + if (player->getItemDrawIdPlusOne == (GID_NONE + 1)) { + Math_Vec3f_Copy(&heldActor->world.pos, &sPlayerGetItemRefPos); + } + } + } + } else if (limbIndex == PLAYER_LIMB_LEFT_FOREARM) { + func_80126BD0(play, player, 0); + } else if (limbIndex == PLAYER_LIMB_RIGHT_FOREARM) { + func_80126BD0(play, player, 1); + } else if (limbIndex == PLAYER_LIMB_TORSO) { + if (player->transformation == PLAYER_FORM_GORON) { + s32 temp_a0 = player->skelAnime.animation == &gPlayerAnim_pg_gakkistart; + s32 temp_v1_3 = player->skelAnime.animation == &gPlayerAnim_pg_gakkiwait; + + if ((temp_a0 || temp_v1_3 || (player->skelAnime.animation == &gPlayerAnim_pg_gakkiplay))) { + static Gfx* D_801C0DF0[] = { + object_link_goron_DL_010590, object_link_goron_DL_010368, object_link_goron_DL_010140, + object_link_goron_DL_00FF18, object_link_goron_DL_00FCF0, + }; + Vec3f sp178[ARRAY_COUNT(D_801C0DF0)]; + s32 i; + + OPEN_DISPS(play->state.gfxCtx); + + if (temp_v1_3) { + f32* var_v0 = player->unk_B10; + + for (i = 0; i < ARRAY_COUNT(sp178); i++, var_v0++) { + func_80124618(D_801C0510, *var_v0, &sp178[i]); + } + } else { + if (temp_a0 != 0) { + func_8012536C(); + func_80124618(D_801C0428, player->skelAnime.curFrame, &player->unk_AF0[1]); + } + + for (i = 0; i < ARRAY_COUNT(sp178); i++) { + Math_Vec3f_Copy(&sp178[i], &player->unk_AF0[1]); + } + } + Matrix_Push(); + Matrix_Scale(player->unk_AF0[1].x, player->unk_AF0[1].y, player->unk_AF0[1].z, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_OPA_DISP++, object_link_goron_DL_00FC18); + + Matrix_Pop(); + + for (i = 0; i < ARRAY_COUNT(sp178); i++) { + Matrix_Push(); + Matrix_Scale(sp178[i].x, sp178[i].y, sp178[i].z, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(POLY_OPA_DISP++, D_801C0DF0[i]); + Matrix_Pop(); + } + + CLOSE_DISPS(play->state.gfxCtx); + } + } + } else if (limbIndex == PLAYER_LIMB_HEAD) { + //! FAKE + if (((*dList1 != NULL) && ((((void)0, player->currentMask)) != (((void)0, PLAYER_MASK_NONE)))) && + (((player->transformation == PLAYER_FORM_HUMAN) && + ((player->skelAnime.animation != &gPlayerAnim_cl_setmask) || (player->skelAnime.curFrame >= 12.0f))) || + ((((player->transformation != PLAYER_FORM_HUMAN) && (player->currentMask >= PLAYER_MASK_FIERCE_DEITY)) && + ((player->transformation + PLAYER_MASK_FIERCE_DEITY) != player->currentMask)) && + (player->skelAnime.curFrame >= 10.0f)))) { + if (func_80127438(play, player, player->currentMask)) { + s32 maskMinusOne = ((void)0, player->currentMask) - 1; + + OPEN_DISPS(play->state.gfxCtx); + + if (((void)0, player->currentMask) == PLAYER_MASK_COUPLE) { + Player_DrawCouplesMask(play, player); + } else if (((void)0, player->currentMask) == PLAYER_MASK_CIRCUS_LEADER) { + Player_DrawCircusLeadersMask(play, player); + } else if (((void)0, player->currentMask) == PLAYER_MASK_BLAST) { + Player_DrawBlastMask(play, player); + } else if (((void)0, player->currentMask) == PLAYER_MASK_BUNNY) { + Player_DrawBunnyHood(play); + } else if (((void)0, player->currentMask) == PLAYER_MASK_GREAT_FAIRY) { + Player_DrawGreatFairysMask(play, player); + } else if (((void)0, player->currentMask) >= PLAYER_MASK_FIERCE_DEITY) { + static Vec2f D_801C0E04[PLAYER_FORM_MAX] = { + { 140.0f, -130.0f }, // PLAYER_FORM_FIERCE_DEITY + { 0.0f, -200.0f }, // PLAYER_FORM_GORON + { -160.0f, 0.0f }, // PLAYER_FORM_ZORA + { 220.0f, -200.0f }, // PLAYER_FORM_DEKU + { 0.0f, 0.0f }, // PLAYER_FORM_HUMAN + }; + Vec2f* temp_s0_4 = &D_801C0E04[player->transformation]; + + Matrix_Push(); + Matrix_Translate(temp_s0_4->x, temp_s0_4->z, 0.0f, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f - player->unk_B10[3], 1.0f - player->unk_B10[2], MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + Matrix_Pop(); + + if (((player->skelAnime.animation == &gPlayerAnim_cl_setmask) && + (player->skelAnime.curFrame >= 51.0f)) || + (player->skelAnime.animation == &gPlayerAnim_cl_setmaskend)) { + maskMinusOne += 4; + } + } + + gSPDisplayList(POLY_OPA_DISP++, D_801C0B20[maskMinusOne]); + + CLOSE_DISPS(play->state.gfxCtx); + } + } else if (player->transformation == PLAYER_FORM_DEKU) { + if (player->skelAnime.animation == &gPlayerAnim_pn_gurd) { + OPEN_DISPS(play->state.gfxCtx); + + func_80124618(D_801C0410, player->skelAnime.curFrame, player->unk_AF0); + Matrix_Push(); + + Matrix_Scale(player->unk_AF0[0].x, player->unk_AF0[0].y, player->unk_AF0[0].z, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_link_nuts_DL_00A348); + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } else { + s32 temp_v1_5 = player->skelAnime.animation == &gPlayerAnim_pn_gakkistart; + + if (temp_v1_5 || (player->skelAnime.animation == &gPlayerAnim_pn_gakkiplay) || + (player->skelAnime.animation == &gPlayerAnim_dl_kokeru)) { + static Gfx* D_801C0E2C[] = { + object_link_nuts_DL_007A28, object_link_nuts_DL_0077D0, object_link_nuts_DL_007548, + object_link_nuts_DL_007900, object_link_nuts_DL_0076A0, + }; + Vec3f spF0[ARRAY_COUNT(D_801C0E2C)]; + s32 i; + f32* temp; + + OPEN_DISPS(play->state.gfxCtx); + + if (temp_v1_5) { + Vec3f spD4; + + func_80124618(D_801C0340, player->skelAnime.curFrame, &spD4); + player->arr_AF0[0] = spD4.x; + func_80124618(D_801C0368, player->skelAnime.curFrame, spF0); + + for (i = 0; i < ARRAY_COUNT(spF0) - 1; i++) { + Math_Vec3f_Copy(&spF0[i + 1], spF0); + } + + temp = &player->arr_AF0[1]; + for (i = 0; i < ARRAY_COUNT(spF0); i++) { + *temp = spF0[0].x; + temp++; + } + } else { + temp = &player->arr_AF0[1]; + for (i = 0; i < ARRAY_COUNT(spF0); i++) { + spF0[i].x = *temp; + spF0[i].y = *temp; + spF0[i].z = *temp; + temp++; + } + } + + Matrix_Push(); + Matrix_Scale(player->arr_AF0[0], player->arr_AF0[0], player->arr_AF0[0], MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_link_nuts_DL_007390); + + Matrix_Pop(); + + for (i = 0; i < ARRAY_COUNT(spF0); i++) { + Matrix_Push(); + + Matrix_Scale(spF0[i].x, spF0[i].y, spF0[i].z, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + //! FAKE (yes, all of them are required) + // https://decomp.me/scratch/AdU3G + if (1) {} + if (1) {} + if (1) {} + if (1) {} + if (1) {} + if (1) {} + gSPDisplayList(POLY_OPA_DISP++, D_801C0E2C[i]); + + Matrix_Pop(); + } + + CLOSE_DISPS(play->state.gfxCtx); + } + } + } + + if ((player->stateFlags1 & (PLAYER_STATE1_2 | PLAYER_STATE1_100)) && (player->unk_AE8 != 0)) { + static Vec3f D_801C0E40[PLAYER_FORM_MAX] = { + { 0.0f, 0.0f, 0.0f }, // PLAYER_FORM_FIERCE_DEITY + { -578.3f, -1100.9f, 0.0f }, // PLAYER_FORM_GORON + { -189.5f, -594.87f, 0.0f }, // PLAYER_FORM_ZORA + { -570.0f, -812.0f, 0.0f }, // PLAYER_FORM_DEKU + { -230.0f, -520.0f, 0.0f }, // PLAYER_FORM_HUMAN + }; + Vec3f* temp_s0_7 = &D_801C0E40[player->transformation]; + + OPEN_DISPS(play->state.gfxCtx); + + Matrix_Push(); + AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(gameplay_keep_Matanimheader_054F18)); + Matrix_Translate(temp_s0_7->x, temp_s0_7->y, 0.0f, MTXMODE_APPLY); + if (player->transformation == PLAYER_FORM_ZORA) { + Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY); + } + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, (u8)player->unk_AE8); + gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054C90); + + Matrix_Pop(); + + CLOSE_DISPS(play->state.gfxCtx); + } + if (player->actor.scale.y >= 0.0f) { + static Vec3f sPlayerFocusHeadLimbModelPos = { 1100.0f, -700.0f, 0.0f }; + static Vec3f D_801C0E88 = { 1600.0f, -1700.0f, -70.0f }; // unused + Actor* spA8 = NULL; + + if (player->transformation != PLAYER_FORM_DEKU) { + Matrix_MultVec3f(&sPlayerFocusHeadLimbModelPos, &player->actor.focus.pos); + } else { + static Vec3f D_801C0E94 = { 1800.0f, -300.0f, 0.0f }; + + Matrix_MultVec3f(&sPlayerFocusHeadLimbModelPos, &player->actor.focus.pos); + Matrix_MultVec3f(&D_801C0E94, sPlayerCurBodyPartPos); + if ((player->skelAnime.animation == &gPlayerAnim_pn_drinkend) || + (player->unk_284.animation == &gPlayerAnim_pn_tamahaki) || + ((player->stateFlags3 & PLAYER_STATE3_40) && ((spA8 = player->heldActor) != NULL))) { + if (spA8 != NULL) { + static Vec3f D_801C0EA0 = { 1300.0f, -400.0f, 0.0f }; + MtxF sp68; + + Matrix_Push(); + Matrix_MultVec3f(&D_801C0EA0, &spA8->world.pos); + Matrix_RotateZYX(0, 0x4000, 0, MTXMODE_APPLY); + Matrix_Get(&sp68); + Matrix_MtxFToYXZRot(&sp68, &spA8->world.rot, false); + spA8->shape.rot = spA8->world.rot; + Matrix_Pop(); + } + } + } + } + } else if ((limbIndex == PLAYER_LIMB_HAT) && (player->stateFlags3 & PLAYER_STATE3_100000)) { + Vec3f sp5C; + Vec3f sp50; + + Matrix_MultVecX(3000.0f, &sp5C); + Matrix_MultVecX(2300.0f, &sp50); + if (func_80126440(play, NULL, player->meleeWeaponInfo, &sp5C, &sp50)) { + EffectBlure_AddVertex(Effect_GetByIndex(player->meleeWeaponEffectIndex[0]), &player->meleeWeaponInfo[0].tip, + &player->meleeWeaponInfo[0].base); + } + } else if (limbIndex == PLAYER_LIMB_RIGHT_SHIN) { + if (player->meleeWeaponState != 0) { + if ((player->meleeWeaponAnimation == PLAYER_MWA_ZORA_PUNCH_KICK) || + (player->meleeWeaponAnimation == PLAYER_MWA_ZORA_JUMPKICK_START) || + (player->meleeWeaponAnimation == PLAYER_MWA_ZORA_JUMPKICK_FINISH)) { + func_8012669C(play, player, D_801C0A48, D_801C0A24); + } + } + } else if (limbIndex == PLAYER_LIMB_WAIST) { + if (player->meleeWeaponState != 0) { + if (player->meleeWeaponAnimation == PLAYER_MWA_GORON_PUNCH_BUTT) { + Math_Vec3f_Copy(&player->unk_AF0[1], &player->meleeWeaponInfo[0].base); + func_8012669C(play, player, D_801C0A90, D_801C0A6C); + } + } + } else if (limbIndex == PLAYER_LIMB_SHEATH) { + if ((*dList1 != NULL) && (player->transformation == PLAYER_FORM_HUMAN) && + (player->currentShield != PLAYER_SHIELD_NONE) && + ((player->sheathType == PLAYER_MODELTYPE_SHEATH_14) || + (player->sheathType == PLAYER_MODELTYPE_SHEATH_15))) { + OPEN_DISPS(play->state.gfxCtx); + + gSPDisplayList(POLY_OPA_DISP++, gPlayerShields[2 * ((player->currentShield - 1) ^ 0)]); + + CLOSE_DISPS(play->state.gfxCtx); + } + + if (player->actor.scale.y >= 0.0f) { + if ((player->rightHandType != PLAYER_MODELTYPE_RH_SHIELD) && + (player->rightHandType != PLAYER_MODELTYPE_RH_FF)) { + static Vec3f sSheathLimbModelShieldOnBackPos = { 630.0f, 100.0f, -30.0f }; + static Vec3s sSheathLimbModelShieldOnBackZyxRot = { 0, 0, 0x7FFF }; + + Matrix_TranslateRotateZYX(&sSheathLimbModelShieldOnBackPos, &sSheathLimbModelShieldOnBackZyxRot); + Matrix_Get(&player->shieldMf); + } + } + } else if (player->actor.scale.y >= 0.0f) { + Player_SetFeetPos(play, player, limbIndex); + } + + func_8012536C(); +} diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index cf7f95078..085cb4de2 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1226,7 +1226,7 @@ void SkelAnime_InitPlayer(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHea allocSize = sizeof(Vec3s) * limbCount; if (flags & 8) { - allocSize += 2; + allocSize += sizeof(u16); } if (jointTableBuffer == NULL) { diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index be76f63b2..506f8a1fa 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -48,6 +48,8 @@ * - Effect Update/Draw * - Seaweed */ + +#include "prevent_bss_reordering.h" #include "z_boss_03.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h" diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index c9844abb6..81e261a00 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -997,7 +997,7 @@ void EnFsn_GiveItem(EnFsn* this, PlayState* play) { } this->actor.parent = NULL; if (ENFSN_IS_SHOP(&this->actor) && !this->isSelling) { - Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); } this->actionFunc = EnFsn_SetupResumeInteraction; } else if (this->isSelling == true) { diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index 813852b44..eceaac242 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -461,7 +461,7 @@ s32 func_80B26F6C(EnKendoJs* this, PlayState* play) { switch (this->unk_288) { case 0x271D: - if (Player_GetMeleeWeaponHeld(player) != 0) { + if (Player_GetMeleeWeaponHeld(player) != PLAYER_MELEEWEAPON_NONE) { Message_StartTextbox(play, 0x272A, &this->actor); this->unk_288 = 0x272A; return true; diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index 56fb61bed..d85924b14 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -743,7 +743,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC46: case 0xC55: - Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); player->exchangeItemId = PLAYER_IA_NONE; this->unk_29C &= ~0x8; play->msgCtx.msgLength = 0; diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 3808c9cfc..2a81da583 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -400,7 +400,7 @@ void EnMinifrog_NextFrogReturned(EnMinifrog* this, PlayState* play) { this->actionFunc = EnMinifrog_ContinueChoirCutscene; this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | 0x2 << MINIFROG_WHITE); - play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, 0); + play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, ANIMMODE_LOOP); } } @@ -431,7 +431,7 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { this->flags &= ~0x100; this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | 0x2 << MINIFROG_WHITE); - play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, 0); + play->setPlayerTalkAnim(play, &gPlayerAnim_link_normal_talk_free_wait, ANIMMODE_LOOP); } else if (this->timer <= 0) { this->actionFunc = EnMinifrog_NextFrogReturned; this->timer = 30; @@ -451,7 +451,7 @@ void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, PlayState* play) { this->timer = 5; func_801A1F00(3, NA_BGM_FROG_SONG); this->flags |= 0x100; - play->setPlayerTalkAnim(play, &gPlayerAnim_pn_gakkiplay, 0); + play->setPlayerTalkAnim(play, &gPlayerAnim_pn_gakkiplay, ANIMMODE_LOOP); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } diff --git a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c index f75c54d37..1692e1461 100644 --- a/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c +++ b/src/overlays/actors/ovl_En_Stone_heishi/z_en_stone_heishi.c @@ -347,7 +347,7 @@ void EnStoneheishi_DrinkBottleProcess(EnStoneheishi* this, PlayState* play) { if ((this->timer < 10) && (this->bottleDisplay != EN_STONE_BOTTLE_EMPTY)) { this->bottleDisplay = EN_STONE_BOTTLE_EMPTY; Actor_PlaySfx(&this->actor, NA_SE_VO_NP_DRINK); - Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); } } else { this->drinkBottleState++; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 6c020e7e6..dfa1e0bb7 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -323,9 +323,9 @@ s32 func_80BE0D60(EnTab* this, PlayState* play) { this->unk_320++; if (this->unk_320 == 1) { - play->setPlayerTalkAnim(play, &gPlayerAnim_link_demo_bikkuri, 2); + play->setPlayerTalkAnim(play, &gPlayerAnim_link_demo_bikkuri, ANIMMODE_ONCE); } else if (this->unk_320 > 20) { - play->setPlayerTalkAnim(play, NULL, 0); + play->setPlayerTalkAnim(play, NULL, ANIMMODE_LOOP); this->unk_320 = 0; ret = true; } diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index 035b04983..11d984fe7 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -824,7 +824,7 @@ void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play) { if (!requestedItem->isBottledItem) { Inventory_ChangeAmmo(requestedItem->item, -requestedItem->amount); } else { - Player_UpdateBottleHeld(play, player, ITEM_BOTTLE, PLAYER_IA_BOTTLE); + Player_UpdateBottleHeld(play, player, ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); } player->stateFlags1 |= PLAYER_STATE1_20; player->stateFlags1 |= PLAYER_STATE1_20000000; diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 38ee9b710..7941ea758 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -1123,9 +1123,9 @@ s32 EnTest3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* *dList = NULL; } if (limbIndex == OBJECT_TEST3_LIMB_0B) { - rot->x += this->player.unk_AAC.z; - rot->y -= this->player.unk_AAC.y; - rot->z += this->player.unk_AAC.x; + rot->x += this->player.headLimbRot.z; + rot->y -= this->player.headLimbRot.y; + rot->z += this->player.headLimbRot.x; } else if (limbIndex == OBJECT_TEST3_LIMB_0A) { s32 requiredScopeTemp; @@ -1133,12 +1133,12 @@ s32 EnTest3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* Matrix_RotateZS(0x44C, MTXMODE_APPLY); Matrix_RotateYS(this->player.unk_AA8, MTXMODE_APPLY); } - if (this->player.unk_AB2.y != 0) { - Matrix_RotateYS(this->player.unk_AB2.y, MTXMODE_APPLY); + if (this->player.upperLimbRot.y != 0) { + Matrix_RotateYS(this->player.upperLimbRot.y, MTXMODE_APPLY); } - Matrix_RotateXS(this->player.unk_AB2.x, MTXMODE_APPLY); - if (this->player.unk_AB2.z != 0) { - Matrix_RotateZS(this->player.unk_AB2.z, MTXMODE_APPLY); + Matrix_RotateXS(this->player.upperLimbRot.x, MTXMODE_APPLY); + if (this->player.upperLimbRot.z != 0) { + Matrix_RotateZS(this->player.upperLimbRot.z, MTXMODE_APPLY); } } else { func_80125500(play, &this->player, limbIndex, pos, rot); @@ -1214,7 +1214,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL } else if (limbIndex == OBJECT_TEST3_LIMB_15) { if (D_80A41D60 || CHECK_WEEKEVENTREG(WEEKEVENTREG_50_80) || (INV_CONTENT(ITEM_PENDANT_OF_MEMORIES) == ITEM_PENDANT_OF_MEMORIES) || - (this->player.getItemDrawId - 1 == GID_PENDANT_OF_MEMORIES)) { + (this->player.getItemDrawIdPlusOne - 1 == GID_PENDANT_OF_MEMORIES)) { D_80A41D60 = true; } else { OPEN_DISPS(play->state.gfxCtx); @@ -1222,7 +1222,7 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL CLOSE_DISPS(play->state.gfxCtx); } } else { - func_80128B74(play, &this->player, limbIndex); + Player_SetFeetPos(play, &this->player, limbIndex); } } @@ -1295,7 +1295,7 @@ void EnTest3_Draw(Actor* thisx, PlayState* play2) { if (this->player.invincibilityTimer > 0) { POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); } - if ((this->player.getItemDrawId - 1) != GID_NONE) { + if ((this->player.getItemDrawIdPlusOne - 1) != GID_NONE) { Player_DrawGetItem(play, &this->player); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index ed0e61937..6decc1150 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -349,7 +349,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { this->textId = 0x884; Message_StartTextbox(play, this->textId, &this->actor); SET_WEEKEVENTREG(WEEKEVENTREG_53_08); - Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); break; case 0x888: this->textId = 0x889; @@ -375,7 +375,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { void EnTrt_PayForMushroom(EnTrt* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE); + Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); this->actionFunc = EnTrt_SetupItemGiven; } else { Actor_OfferGetItem(&this->actor, play, GI_RUPEE_RED, 300.0f, 300.0f); diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index 7ab20a77c..a9335f850 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -913,7 +913,7 @@ s32 func_80A87880(Actor* thisx, PlayState* play) { Animation_OnFrame(&this->skelAnime, 52.0f)) { if (Animation_OnFrame(&this->skelAnime, 52.0f)) { this->unk_34E &= ~0x400; - Player_UpdateBottleHeld(play, player, ITEM_BOTTLE, PLAYER_IA_BOTTLE); + Player_UpdateBottleHeld(play, player, ITEM_BOTTLE, PLAYER_IA_BOTTLE_EMPTY); } Actor_PlaySfx(&this->actor, NA_SE_EN_KOUME_DRINK); } else if (Animation_OnFrame(&this->skelAnime, 90.0f)) { diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 677cbfe2a..46fbe067c 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -620,13 +620,13 @@ void func_80B78EBC(ObjUm* this, PlayState* play) { player->actor.focus.rot.z = 0; player->actor.focus.rot.y = player->actor.shape.rot.y; - player->unk_AAC.x = 0; - player->unk_AAC.y = 0; - player->unk_AAC.z = 0; + player->headLimbRot.x = 0; + player->headLimbRot.y = 0; + player->headLimbRot.z = 0; - player->unk_AB2.x = 0; - player->unk_AB2.y = 0; - player->unk_AB2.z = 0; + player->upperLimbRot.x = 0; + player->upperLimbRot.y = 0; + player->upperLimbRot.z = 0; player->currentYaw = player->actor.focus.rot.y; } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index d4d6565e9..126407393 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2221,23 +2221,23 @@ 0x80124088:("Player_IsHoldingMirrorShield",), 0x801240C8:("Player_IsHoldingHookshot",), 0x801240DC:("func_801240DC",), - 0x80124110:("func_80124110",), - 0x80124148:("func_80124148",), - 0x80124168:("Player_ActionToMeleeWeapon",), + 0x80124110:("Player_BButtonSwordFromIA",), + 0x80124148:("Player_GetHeldBButtonSword",), + 0x80124168:("Player_MeleeWeaponFromIA",), 0x80124190:("Player_GetMeleeWeaponHeld",), 0x801241B4:("Player_IsHoldingTwoHandedWeapon",), - 0x801241E0:("Player_ActionToBottle",), + 0x801241E0:("Player_BottleFromIA",), 0x8012420C:("Player_GetBottleHeld",), - 0x8012422C:("Player_ActionToExplosive",), + 0x8012422C:("Player_ExplosiveFromIA",), 0x80124258:("Player_GetExplosiveHeld",), - 0x80124278:("Player_ActionToSword",), + 0x80124278:("Player_SwordFromIA",), 0x801242B4:("func_801242B4",), 0x801242DC:("Player_GetEnvironmentalHazard",), - 0x80124420:("func_80124420",), + 0x80124420:("Player_UpdateBunnyEars",), 0x80124618:("func_80124618",), 0x801246F4:("Player_DrawImpl",), - 0x80124870:("func_80124870",), - 0x80124CC4:("func_80124CC4",), + 0x80124870:("Player_AdjustSingleLeg",), + 0x80124CC4:("Player_DrawHookshotReticle",), 0x80124F18:("func_80124F18",), 0x80124FF0:("func_80124FF0",), 0x801251C4:("func_801251C4",), @@ -2246,13 +2246,13 @@ 0x8012536C:("func_8012536C",), 0x801253A4:("Player_DrawZoraShield",), 0x80125500:("func_80125500",), - 0x80125580:("func_80125580",), + 0x80125580:("Player_OverrideLimbDrawGameplayCommon",), 0x80125CE0:("func_80125CE0",), - 0x80125D4C:("func_80125D4C",), - 0x801262C8:("func_801262C8",), - 0x801263FC:("func_801263FC",), + 0x80125D4C:("Player_OverrideLimbDrawGameplayDefault",), + 0x801262C8:("Player_OverrideLimbDrawGameplayFirstPerson",), + 0x801263FC:("Player_OverrideLimbDrawGameplayCrawling",), 0x80126440:("func_80126440",), - 0x801265C8:("func_801265C8",), + 0x801265C8:("Player_UpdateShieldCollider",), 0x8012669C:("func_8012669C",), 0x80126808:("Player_DrawGetItemImpl",), 0x8012697C:("Player_DrawGetItem",), @@ -2267,13 +2267,13 @@ 0x801278F8:("Player_DrawBlastMask",), 0x80127A60:("Player_DrawBunnyHood",), 0x80127B64:("func_80127B64",), - 0x80127BE8:("func_80127BE8",), + 0x80127BE8:("Player_DrawStrayFairyParticles",), 0x80127DA4:("func_80127DA4",), 0x80128388:("func_80128388",), 0x801284A0:("Player_DrawGreatFairysMask",), 0x80128640:("func_80128640",), - 0x80128B74:("func_80128B74",), - 0x80128BD0:("func_80128BD0",), + 0x80128B74:("Player_SetFeetPos",), + 0x80128BD0:("Player_PostLimbDrawGameplay",), 0x80129EF0:("PreNMI_Stop",), 0x80129F04:("PreNMI_Update",), 0x80129F4C:("PreNMI_Draw",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 6e83a53e8..6ed78a348 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1210,9 +1210,9 @@ 0x801C0034:("gPlayerSheath12DLs","UNK_TYPE1","",0x1), 0x801C005C:("gPlayerSheath13DLs","UNK_TYPE1","",0x1), 0x801C0084:("gPlayerSheath14DLs","UNK_TYPE1","",0x1), - 0x801C00AC:("gPlayerShields","UNK_TYPE1","",0x1), - 0x801C00BC:("gPlayerSheathedSwords","UNK_TYPE1","",0x1), - 0x801C00D4:("gPlayerSwordSheaths","UNK_TYPE1","",0x1), + 0x801C00AC:("gPlayerShields","Gfx*","",0x10), + 0x801C00BC:("gPlayerSheathedSwords","Gfx*","",0x18), + 0x801C00D4:("gPlayerSwordSheaths","Gfx*","",0x18), 0x801C00EC:("gPlayerLeftHandTwoHandSwordDLs","UNK_TYPE1","",0x1), 0x801C0114:("gPlayerLeftHandOpenDLs","UNK_TYPE1","",0x1), 0x801C013C:("gPlayerLeftHandClosedDLs","UNK_TYPE1","",0x1), @@ -1224,11 +1224,11 @@ 0x801C021C:("gPlayerRightHandInstrumentDLs","UNK_TYPE1","",0x1), 0x801C0244:("gPlayerRightHandHookshotDLs","UNK_TYPE1","",0x1), 0x801C026C:("gPlayerLeftHandBottleDLs","UNK_TYPE1","",0x1), - 0x801C0294:("D_801C0294","UNK_TYPE1","",0x1), - 0x801C02A8:("D_801C02A8","UNK_TYPE1","",0x1), - 0x801C02BC:("D_801C02BC","UNK_TYPE1","",0x1), - 0x801C02D0:("D_801C02D0","UNK_TYPE1","",0x1), - 0x801C02E4:("D_801C02E4","UNK_TYPE1","",0x1), + 0x801C0294:("sPlayerFirstPersonLeftForearmDLs","UNK_TYPE1","",0x1), + 0x801C02A8:("sPlayerFirstPersonLeftHandDLs","UNK_TYPE1","",0x1), + 0x801C02BC:("sPlayerFirstPersonRightShoulderDLs","UNK_TYPE1","",0x1), + 0x801C02D0:("sPlayerFirstPersonRightHandDLs","UNK_TYPE1","",0x1), + 0x801C02E4:("sPlayerFirstPersonRightHandHookshotDLs","UNK_TYPE1","",0x1), 0x801C02F8:("sPlayerDListGroups","UNK_PTR","",0x4), 0x801C0340:("D_801C0340","UNK_TYPE1","",0x1), 0x801C0368:("D_801C0368","UNK_TYPE1","",0x1), @@ -1279,7 +1279,7 @@ 0x801C0958:("D_801C0958","UNK_TYPE4","",0x4), 0x801C095C:("D_801C095C","UNK_PTR","",0x4), 0x801C0964:("D_801C0964","UNK_TYPE1","",0x1), - 0x801C096C:("D_801C096C","UNK_TYPE1","",0x1), + 0x801C096C:("sPlayerShieldCollisionTypes","UNK_TYPE1","",0x1), 0x801C0970:("D_801C0970","UNK_TYPE1","",0x1), 0x801C0994:("D_801C0994","UNK_TYPE4","",0x4), 0x801C09B8:("D_801C09B8","UNK_TYPE1","",0x1), @@ -1313,28 +1313,27 @@ 0x801C0C0C:("D_801C0C0C","UNK_TYPE4","",0x4), 0x801C0C30:("D_801C0C30","UNK_TYPE1","",0x1), 0x801C0C54:("D_801C0C54","struct_80128388_arg1","",0x54), - 0x801C0CA8:("D_801C0CA8","UNK_TYPE1","",0x1), + 0x801C0CA8:("sPlayerBottleColors","UNK_TYPE1","",0x1), 0x801C0CE8:("D_801C0CE8","UNK_TYPE4","",0x4), - 0x801C0D24:("D_801C0D24","UNK_TYPE1","",0x1), + 0x801C0D24:("sPlayerFootPos","UNK_TYPE1","",0x1), 0x801C0D60:("D_801C0D60","UNK_TYPE1","",0x1), 0x801C0D6C:("D_801C0D6C","UNK_TYPE1","",0x1), - 0x801C0D78:("D_801C0D78","UNK_TYPE1","",0x1), + 0x801C0D78:("sMeleeWeaponLengths","f32","[7]",0x1C), 0x801C0D94:("D_801C0D94","UNK_TYPE4","",0x4), - 0x801C0D98:("D_801C0D98","UNK_TYPE4","",0x4), - 0x801C0D9C:("D_801C0D9C","UNK_TYPE4","",0x4), - 0x801C0DA0:("D_801C0DA0","UNK_TYPE4","",0x4), - 0x801C0DA8:("D_801C0DA8","UNK_TYPE1","",0x1), + 0x801C0D98:("D_801C0D98","Vec3f","",0xC), + 0x801C0DA4:("D_801C0DA4","UNK_TYPE4","",0x4), + 0x801C0DA8:("sRightHandLimbModelShieldQuadVertices","Vec3f","[4]",0x30), 0x801C0DD8:("D_801C0DD8","UNK_TYPE1","",0x1), 0x801C0DE4:("D_801C0DE4","UNK_TYPE1","",0x1), 0x801C0DF0:("D_801C0DF0","UNK_TYPE4","",0x4), 0x801C0E04:("D_801C0E04","UNK_TYPE1","",0x1), 0x801C0E2C:("D_801C0E2C","UNK_TYPE4","",0x4), 0x801C0E40:("D_801C0E40","UNK_TYPE4","",0x4), - 0x801C0E7C:("D_801C0E7C","UNK_TYPE1","",0x1), + 0x801C0E7C:("sPlayerFocusHeadLimbModelPos","Vec3f","",0xC), 0x801C0E94:("D_801C0E94","UNK_TYPE1","",0x1), 0x801C0EA0:("D_801C0EA0","UNK_TYPE1","",0x1), - 0x801C0EAC:("D_801C0EAC","UNK_TYPE1","",0x1), - 0x801C0EB8:("D_801C0EB8","UNK_TYPE1","",0x1), + 0x801C0EAC:("sSheathLimbModelShieldOnBackPos","Vec3f","",0xC), + 0x801C0EB8:("sSheathLimbModelShieldOnBackZyxRot","Vec3s","",0x6), 0x801C0EC0:("sIsQuakeInitialized","UNK_TYPE2","",0x2), 0x801C0EC4:("sQuakeRequestCount","s16","",0x2), 0x801C0EC8:("sQuakeCallbacks","quake_callback_func","[7]",0x1c), @@ -4009,13 +4008,13 @@ 0x801F59AC:("D_801F59AC","UNK_TYPE1","",0x1), 0x801F59B0:("D_801F59B0","Vec3f","[2]",0x18), 0x801F59C8:("D_801F59C8","s32","[2]",0x8), - 0x801F59D0:("D_801F59D0","struct_801F59D0","",0x0A), - 0x801F59DC:("D_801F59DC","Vec3f*","",0x4), + 0x801F59D0:("sBunnyEarKinematics","struct_801F59D0","",0x0A), + 0x801F59DC:("sPlayerCurBodyPartPos","Vec3f*","",0x4), 0x801F59E0:("D_801F59E0","s32","",0x4), - 0x801F59E4:("D_801F59E4","s32","",0x4), - 0x801F59E8:("D_801F59E8","Vec3f","",0xC), - 0x801F59F4:("D_801F59F4","s32","",0x4), - 0x801F59F8:("D_801F59F8","s32","",0x4), + 0x801F59E4:("sPlayerLod","s32","",0x4), + 0x801F59E8:("sPlayerGetItemRefPos","Vec3f","",0xC), + 0x801F59F4:("sPlayerLeftHandType","s32","",0x4), + 0x801F59F8:("sPlayerRightHandType","s32","",0x4), 0x801F5A00:("sQuakeRequest","QuakeRequest","[4]",0x90), 0x801F5A90:("sDistortionRequest","DistortionRequest","",0xc), 0x801F5AA0:("sMatAnimStep","s32","",0x4), diff --git a/tools/namefixer.py b/tools/namefixer.py index d5cc4e29a..b037f9415 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -18,7 +18,7 @@ simpleReplace = { wordReplace = { # Functions "Actor_GetSwitchFlag": "Flags_GetSwitch", - "Math_FAtan2F(": "Math_Atan2S_XY(", + "Math_FAtan2F": "Math_Atan2S_XY", "Math_Acot2F": "Math_Atan2F_XY", "atan_flip": "Math_Atan2F_XY", "atans": "Math_Atan2S", @@ -839,13 +839,19 @@ wordReplace = { "player->heldItemActionParam": "player->itemAction", "player->unk_A9C": "player->secretRumbleCharge", "player->unk_AA0": "player->closestSecretDistSq", + "player->unk_AAC": "player->headLimbRot", + "player->unk_AB2": "player->upperLimbRot", + "player->unk_B2A": "player->getItemDrawIdPlusOne", + "player->getItemDrawId": "player->getItemDrawIdPlusOne", "player->unk_B68": "player->fallStartHeight", "player->unk_B6A": "player->fallDistance", "player->targetActor": "player->talkActor", "player->targetActorDistance": "player->talkActorDistance", "player->unk_730": "player->targetedActor", - "player->ageProperties->unk_92": "player->ageProperties->voiceSfxIdOffset", - "player->ageProperties->unk_94": "player->ageProperties->surfaceSfxIdOffset", + + "ageProperties->unk_04": "ageProperties->shadowScale", + "ageProperties->unk_92": "ageProperties->voiceSfxOffset", + "ageProperties->unk_94": "ageProperties->surfaceSfxOffset", "csCtx.npcActions": "csCtx.actorActions", "csCtx->npcActions": "csCtx->actorActions", @@ -943,6 +949,7 @@ wordReplace = { "EXCH_ITEM_LETTER_MAMA": "PLAYER_IA_LETTER_MAMA", "ITEM_FISHING_POLE": "ITEM_FISHING_ROD", "PLAYER_AP_FISHING_POLE": "PLAYER_IA_FISHING_ROD", + "PLAYER_IA_BOTTLE": "PLAYER_IA_BOTTLE_EMPTY", # Enums "TRANS_TYPE_00": "TRANS_TYPE_WIPE", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index d70411560..92cd63a29 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1735,23 +1735,23 @@ asm/non_matchings/code/z_player_lib/Player_HasMirrorShieldEquipped.s,Player_HasM asm/non_matchings/code/z_player_lib/Player_IsHoldingMirrorShield.s,Player_IsHoldingMirrorShield,0x80124088,0x10 asm/non_matchings/code/z_player_lib/Player_IsHoldingHookshot.s,Player_IsHoldingHookshot,0x801240C8,0x5 asm/non_matchings/code/z_player_lib/func_801240DC.s,func_801240DC,0x801240DC,0xD -asm/non_matchings/code/z_player_lib/func_80124110.s,func_80124110,0x80124110,0xE -asm/non_matchings/code/z_player_lib/func_80124148.s,func_80124148,0x80124148,0x8 -asm/non_matchings/code/z_player_lib/Player_ActionToMeleeWeapon.s,Player_ActionToMeleeWeapon,0x80124168,0xA +asm/non_matchings/code/z_player_lib/Player_BButtonSwordFromIA.s,Player_BButtonSwordFromIA,0x80124110,0xE +asm/non_matchings/code/z_player_lib/Player_GetHeldBButtonSword.s,Player_GetHeldBButtonSword,0x80124148,0x8 +asm/non_matchings/code/z_player_lib/Player_MeleeWeaponFromIA.s,Player_MeleeWeaponFromIA,0x80124168,0xA asm/non_matchings/code/z_player_lib/Player_GetMeleeWeaponHeld.s,Player_GetMeleeWeaponHeld,0x80124190,0x9 asm/non_matchings/code/z_player_lib/Player_IsHoldingTwoHandedWeapon.s,Player_IsHoldingTwoHandedWeapon,0x801241B4,0xB -asm/non_matchings/code/z_player_lib/Player_ActionToBottle.s,Player_ActionToBottle,0x801241E0,0xB +asm/non_matchings/code/z_player_lib/Player_BottleFromIA.s,Player_BottleFromIA,0x801241E0,0xB asm/non_matchings/code/z_player_lib/Player_GetBottleHeld.s,Player_GetBottleHeld,0x8012420C,0x8 -asm/non_matchings/code/z_player_lib/Player_ActionToExplosive.s,Player_ActionToExplosive,0x8012422C,0xB +asm/non_matchings/code/z_player_lib/Player_ExplosiveFromIA.s,Player_ExplosiveFromIA,0x8012422C,0xB asm/non_matchings/code/z_player_lib/Player_GetExplosiveHeld.s,Player_GetExplosiveHeld,0x80124258,0x8 -asm/non_matchings/code/z_player_lib/Player_ActionToSword.s,Player_ActionToSword,0x80124278,0xF +asm/non_matchings/code/z_player_lib/Player_SwordFromIA.s,Player_SwordFromIA,0x80124278,0xF asm/non_matchings/code/z_player_lib/func_801242B4.s,func_801242B4,0x801242B4,0xA asm/non_matchings/code/z_player_lib/Player_GetEnvironmentalHazard.s,Player_GetEnvironmentalHazard,0x801242DC,0x51 -asm/non_matchings/code/z_player_lib/func_80124420.s,func_80124420,0x80124420,0x7E +asm/non_matchings/code/z_player_lib/Player_UpdateBunnyEars.s,Player_UpdateBunnyEars,0x80124420,0x7E asm/non_matchings/code/z_player_lib/func_80124618.s,func_80124618,0x80124618,0x37 asm/non_matchings/code/z_player_lib/Player_DrawImpl.s,Player_DrawImpl,0x801246F4,0x5F -asm/non_matchings/code/z_player_lib/func_80124870.s,func_80124870,0x80124870,0x115 -asm/non_matchings/code/z_player_lib/func_80124CC4.s,func_80124CC4,0x80124CC4,0x95 +asm/non_matchings/code/z_player_lib/Player_AdjustSingleLeg.s,Player_AdjustSingleLeg,0x80124870,0x115 +asm/non_matchings/code/z_player_lib/Player_DrawHookshotReticle.s,Player_DrawHookshotReticle,0x80124CC4,0x95 asm/non_matchings/code/z_player_lib/func_80124F18.s,func_80124F18,0x80124F18,0x36 asm/non_matchings/code/z_player_lib/func_80124FF0.s,func_80124FF0,0x80124FF0,0x75 asm/non_matchings/code/z_player_lib/func_801251C4.s,func_801251C4,0x801251C4,0x55 @@ -1760,13 +1760,13 @@ asm/non_matchings/code/z_player_lib/func_80125340.s,func_80125340,0x80125340,0xB asm/non_matchings/code/z_player_lib/func_8012536C.s,func_8012536C,0x8012536C,0xE asm/non_matchings/code/z_player_lib/Player_DrawZoraShield.s,Player_DrawZoraShield,0x801253A4,0x57 asm/non_matchings/code/z_player_lib/func_80125500.s,func_80125500,0x80125500,0x20 -asm/non_matchings/code/z_player_lib/func_80125580.s,func_80125580,0x80125580,0x1D8 +asm/non_matchings/code/z_player_lib/Player_OverrideLimbDrawGameplayCommon.s,Player_OverrideLimbDrawGameplayCommon,0x80125580,0x1D8 asm/non_matchings/code/z_player_lib/func_80125CE0.s,func_80125CE0,0x80125CE0,0x1B -asm/non_matchings/code/z_player_lib/func_80125D4C.s,func_80125D4C,0x80125D4C,0x15F -asm/non_matchings/code/z_player_lib/func_801262C8.s,func_801262C8,0x801262C8,0x4D -asm/non_matchings/code/z_player_lib/func_801263FC.s,func_801263FC,0x801263FC,0x11 +asm/non_matchings/code/z_player_lib/Player_OverrideLimbDrawGameplayDefault.s,Player_OverrideLimbDrawGameplayDefault,0x80125D4C,0x15F +asm/non_matchings/code/z_player_lib/Player_OverrideLimbDrawGameplayFirstPerson.s,Player_OverrideLimbDrawGameplayFirstPerson,0x801262C8,0x4D +asm/non_matchings/code/z_player_lib/Player_OverrideLimbDrawGameplayCrawling.s,Player_OverrideLimbDrawGameplayCrawling,0x801263FC,0x11 asm/non_matchings/code/z_player_lib/func_80126440.s,func_80126440,0x80126440,0x62 -asm/non_matchings/code/z_player_lib/func_801265C8.s,func_801265C8,0x801265C8,0x35 +asm/non_matchings/code/z_player_lib/Player_UpdateShieldCollider.s,Player_UpdateShieldCollider,0x801265C8,0x35 asm/non_matchings/code/z_player_lib/func_8012669C.s,func_8012669C,0x8012669C,0x5B asm/non_matchings/code/z_player_lib/Player_DrawGetItemImpl.s,Player_DrawGetItemImpl,0x80126808,0x5D asm/non_matchings/code/z_player_lib/Player_DrawGetItem.s,Player_DrawGetItem,0x8012697C,0x4E @@ -1781,13 +1781,13 @@ asm/non_matchings/code/z_player_lib/Player_DrawCircusLeadersMask.s,Player_DrawCi asm/non_matchings/code/z_player_lib/Player_DrawBlastMask.s,Player_DrawBlastMask,0x801278F8,0x5A asm/non_matchings/code/z_player_lib/Player_DrawBunnyHood.s,Player_DrawBunnyHood,0x80127A60,0x41 asm/non_matchings/code/z_player_lib/func_80127B64.s,func_80127B64,0x80127B64,0x21 -asm/non_matchings/code/z_player_lib/func_80127BE8.s,func_80127BE8,0x80127BE8,0x6F +asm/non_matchings/code/z_player_lib/Player_DrawStrayFairyParticles.s,Player_DrawStrayFairyParticles,0x80127BE8,0x6F asm/non_matchings/code/z_player_lib/func_80127DA4.s,func_80127DA4,0x80127DA4,0x179 asm/non_matchings/code/z_player_lib/func_80128388.s,func_80128388,0x80128388,0x46 asm/non_matchings/code/z_player_lib/Player_DrawGreatFairysMask.s,Player_DrawGreatFairysMask,0x801284A0,0x68 asm/non_matchings/code/z_player_lib/func_80128640.s,func_80128640,0x80128640,0x14D -asm/non_matchings/code/z_player_lib/func_80128B74.s,func_80128B74,0x80128B74,0x17 -asm/non_matchings/code/z_player_lib/func_80128BD0.s,func_80128BD0,0x80128BD0,0x4C8 +asm/non_matchings/code/z_player_lib/Player_SetFeetPos.s,Player_SetFeetPos,0x80128B74,0x17 +asm/non_matchings/code/z_player_lib/Player_PostLimbDrawGameplay.s,Player_PostLimbDrawGameplay,0x80128BD0,0x4C8 asm/non_matchings/code/z_prenmi/PreNMI_Stop.s,PreNMI_Stop,0x80129EF0,0x5 asm/non_matchings/code/z_prenmi/PreNMI_Update.s,PreNMI_Update,0x80129F04,0x12 asm/non_matchings/code/z_prenmi/PreNMI_Draw.s,PreNMI_Draw,0x80129F4C,0x2B From 9d25fad40743fe259867bc81c152591683c8fe73 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 20 Apr 2023 03:52:00 +1000 Subject: [PATCH 27/29] Cutscene Documentation (z_eventmgr.c OK) (#1164) * begin cutscene docs * more docs * more docs * z_eventmgr.c OK Co-authored-by: Thar0 * cutscene camera * commands WIP * more docs * merge master * csId, oof * more cleanup * more docs, csCam * more cleanup * more docs * more * cleanup functions.h * better misc cmd docs * apply discord discussions * small adjustment * more cleanup * more docs * more cleanup * more cs cam docs * small fix * cmd cleanup * small cleanup * better match, thanks anon * remove last return * PR suggestions, small cleanup * next PR review * rm internal funcs from functions.h * more PR * add comment * csCam interp typedef handler * cleanup, scene cmd * missed an enum use * ActorCutscene -> CutsceneManager, PR Suggestions * more PR Suggestions * more actorCutscene cleanup * R_USE_DEBUG_CUTSCENE * more small docs * move functions to cutscene.h * PlayerCsId * fix bss * missed some function headers * more scene cleanup * more scene cleanup * missed one * CS_SPAWN_FLAGS * wrong usage of macro * more cleanup * name last cs transition types * IsNext bool * update namefixer * fix namefixer * more cleanup * add comment * fixed enums for motion blur * consistent cutscene lists * cutscene entry func consistent * PR Suggestion * fig review * fix additionalCsId name in actor * more pr review * bss --------- Co-authored-by: Thar0 Co-authored-by: angie --- include/functions.h | 75 +- include/regs.h | 3 + include/variables.h | 30 +- include/z64.h | 48 +- include/z64actor.h | 2 +- include/z64camera.h | 2 +- include/z64cutscene.h | 983 +++++++++-- include/z64cutscene_commands.h | 546 ++++--- include/z64player.h | 6 +- include/z64save.h | 12 +- include/z64scene.h | 34 +- include/z64subs.h | 8 +- spec | 5 +- src/audio/code_8019AF00.c | 2 +- src/boot_O2_g3/idle.c | 1 + src/boot_O2_g3/yaz0.c | 1 - src/code/cutscene_camera.c | 380 +++++ src/code/db_camera.c | 43 - src/code/z_actor.c | 26 +- src/code/z_camera_data.inc.c | 50 +- src/code/z_collision_check.c | 1 - src/code/z_demo.c | 1431 +++++++++-------- src/code/z_env_flags.c | 18 +- src/code/z_eventmgr.c | 552 ++++++- src/code/z_kaleido_setup.c | 2 +- src/code/z_parameter.c | 6 +- src/code/z_play.c | 96 +- src/code/z_player_lib.c | 4 +- src/code/z_scene.c | 22 +- src/code/z_sram_NES.c | 17 +- src/code/z_sub_s.c | 43 +- .../ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c | 4 +- .../ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h | 2 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 6 +- .../ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c | 4 +- .../ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c | 12 +- .../ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c | 8 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 30 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h | 4 +- .../z_bg_dblue_waterfall.c | 14 +- .../z_bg_dblue_waterfall.h | 2 +- .../ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c | 8 +- .../actors/ovl_Bg_F40_Block/z_bg_f40_block.c | 16 +- .../ovl_Bg_F40_Switch/z_bg_f40_switch.c | 10 +- .../actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c | 10 +- .../actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h | 2 +- .../ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c | 10 +- .../ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c | 14 +- .../actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c | 19 +- .../actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h | 2 +- .../z_bg_hakugin_bombwall.c | 10 +- .../z_bg_hakugin_elvpole.c | 8 +- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c | 86 +- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h | 12 +- .../z_bg_hakugin_switch.c | 40 +- .../z_bg_hakugin_switch.h | 6 +- .../ovl_Bg_Ikana_Block/z_bg_ikana_block.c | 8 +- .../z_bg_ikana_bombwall.c | 14 +- .../ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c | 12 +- .../z_bg_ikana_rotaryroom.c | 20 +- .../ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c | 12 +- .../ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c | 8 +- .../actors/ovl_Bg_Ikninside/z_bg_ikninside.c | 14 +- .../ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c | 20 +- .../ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h | 2 +- .../actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c | 16 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 24 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.h | 2 +- .../ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c | 10 +- .../ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c | 6 +- .../ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c | 10 +- .../actors/ovl_Bg_Ladder/z_bg_ladder.c | 10 +- .../ovl_Bg_Last_Bwall/z_bg_last_bwall.c | 4 +- .../ovl_Bg_Last_Bwall/z_bg_last_bwall.h | 2 +- .../actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c | 8 +- .../ovl_Bg_Open_Shutter/z_bg_open_shutter.c | 10 +- .../actors/ovl_Bg_Open_Spot/z_bg_open_spot.c | 10 +- .../ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c | 14 +- .../ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h | 2 +- .../actors/ovl_Bg_Spdweb/z_bg_spdweb.c | 14 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 14 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 23 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 28 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 10 +- src/overlays/actors/ovl_Boss_06/z_boss_06.c | 10 +- .../actors/ovl_Demo_Getitem/z_demo_getitem.c | 14 +- .../actors/ovl_Demo_Getitem/z_demo_getitem.h | 2 +- .../actors/ovl_Demo_Syoten/z_demo_syoten.c | 88 +- .../actors/ovl_Demo_Syoten/z_demo_syoten.h | 4 +- src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c | 20 +- src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h | 2 +- src/overlays/actors/ovl_Dm_Al/z_dm_al.c | 20 +- src/overlays/actors/ovl_Dm_Al/z_dm_al.h | 2 +- src/overlays/actors/ovl_Dm_An/z_dm_an.c | 22 +- src/overlays/actors/ovl_Dm_An/z_dm_an.h | 2 +- src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c | 20 +- .../actors/ovl_Dm_Char00/z_dm_char00.c | 104 +- .../actors/ovl_Dm_Char00/z_dm_char00.h | 2 +- .../actors/ovl_Dm_Char01/z_dm_char01.c | 27 +- .../actors/ovl_Dm_Char02/z_dm_char02.c | 20 +- .../actors/ovl_Dm_Char03/z_dm_char03.c | 30 +- .../actors/ovl_Dm_Char04/z_dm_char04.c | 20 +- .../actors/ovl_Dm_Char04/z_dm_char04.h | 2 +- .../actors/ovl_Dm_Char05/z_dm_char05.c | 163 +- .../actors/ovl_Dm_Char06/z_dm_char06.c | 20 +- .../actors/ovl_Dm_Char08/z_dm_char08.c | 82 +- .../actors/ovl_Dm_Char08/z_dm_char08.h | 2 +- .../actors/ovl_Dm_Char09/z_dm_char09.c | 22 +- .../actors/ovl_Dm_Char09/z_dm_char09.h | 2 +- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c | 22 +- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h | 2 +- src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c | 20 +- src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h | 2 +- .../actors/ovl_Dm_Opstage/z_dm_opstage.c | 16 +- .../actors/ovl_Dm_Opstage/z_dm_opstage.h | 2 +- .../actors/ovl_Dm_Ravine/z_dm_ravine.c | 2 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 150 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h | 2 +- src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c | 40 +- src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c | 18 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 10 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 30 +- .../actors/ovl_Door_Shutter/z_door_shutter.h | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 58 +- .../actors/ovl_Door_Warp1/z_door_warp1.h | 2 +- .../actors/ovl_Eff_Change/z_eff_change.c | 12 +- .../z_eff_kamejima_wave.c | 12 +- .../actors/ovl_Eff_Lastday/z_eff_lastday.c | 48 +- .../actors/ovl_Eff_Lastday/z_eff_lastday.h | 2 +- .../actors/ovl_Eff_Zoraband/z_eff_zoraband.c | 6 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 18 +- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c | 20 +- src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c | 18 +- src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c | 20 +- src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c | 28 +- .../ovl_En_Akindonuts/z_en_akindonuts.c | 28 +- .../ovl_En_Akindonuts/z_en_akindonuts.h | 2 +- src/overlays/actors/ovl_En_Al/z_en_al.c | 35 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 12 +- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 35 +- .../actors/ovl_En_Aob_01/z_en_aob_01.h | 2 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 17 +- src/overlays/actors/ovl_En_Az/z_en_az.h | 2 +- src/overlays/actors/ovl_En_Bat/z_en_bat.c | 2 +- src/overlays/actors/ovl_En_Bee/z_en_bee.c | 4 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 32 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.h | 2 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 20 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 34 +- .../actors/ovl_En_Bigslime/z_en_bigslime.h | 2 +- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 2 +- .../actors/ovl_En_Bji_01/z_en_bji_01.h | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 90 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 76 +- .../actors/ovl_En_Bombal/z_en_bombal.c | 16 +- .../actors/ovl_En_Bombal/z_en_bombal.h | 2 +- .../actors/ovl_En_Bombers/z_en_bombers.c | 4 +- .../actors/ovl_En_Bombers2/z_en_bombers2.c | 18 +- .../actors/ovl_En_Bombers2/z_en_bombers2.h | 2 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 44 +- .../actors/ovl_En_Bomjima/z_en_bomjima.h | 4 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 40 +- src/overlays/actors/ovl_En_Box/z_en_box.h | 4 +- src/overlays/actors/ovl_En_Cha/z_en_cha.c | 8 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 6 +- src/overlays/actors/ovl_En_Dai/z_en_dai.c | 52 +- src/overlays/actors/ovl_En_Dai/z_en_dai.h | 2 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 36 +- src/overlays/actors/ovl_En_Dnk/z_en_dnk.c | 8 +- src/overlays/actors/ovl_En_Dno/z_en_dno.c | 14 +- src/overlays/actors/ovl_En_Dno/z_en_dno.h | 2 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 31 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.h | 2 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 24 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.h | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 32 +- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 5 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 2 +- .../actors/ovl_En_Dragon/z_en_dragon.c | 22 +- .../actors/ovl_En_Dragon/z_en_dragon.h | 4 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 10 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 77 +- .../actors/ovl_En_Elfgrp/z_en_elfgrp.c | 39 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 12 +- src/overlays/actors/ovl_En_Fall/z_en_fall.c | 87 +- src/overlays/actors/ovl_En_Fall2/z_en_fall2.c | 16 +- src/overlays/actors/ovl_En_Fall2/z_en_fall2.h | 4 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 20 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.h | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 19 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 4 +- src/overlays/actors/ovl_En_Fsn/z_en_fsn.c | 126 +- src/overlays/actors/ovl_En_Fsn/z_en_fsn.h | 10 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 4 +- .../actors/ovl_En_Gakufu/z_en_gakufu.c | 8 +- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 74 +- src/overlays/actors/ovl_En_Gb2/z_en_gb2.h | 4 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 23 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 2 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 31 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 12 +- src/overlays/actors/ovl_En_Geg/z_en_geg.c | 66 +- src/overlays/actors/ovl_En_Geg/z_en_geg.h | 6 +- src/overlays/actors/ovl_En_Gg/z_en_gg.c | 28 +- src/overlays/actors/ovl_En_Gg/z_en_gg.h | 4 +- src/overlays/actors/ovl_En_Gg2/z_en_gg2.c | 14 +- src/overlays/actors/ovl_En_Gg2/z_en_gg2.h | 2 +- src/overlays/actors/ovl_En_Giant/z_en_giant.c | 161 +- src/overlays/actors/ovl_En_Giant/z_en_giant.h | 4 +- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 52 +- src/overlays/actors/ovl_En_Gk/z_en_gk.h | 4 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 67 +- src/overlays/actors/ovl_En_Gm/z_en_gm.h | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 90 +- src/overlays/actors/ovl_En_Go/z_en_go.h | 4 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 17 +- src/overlays/actors/ovl_En_Gs/z_en_gs.h | 2 +- .../actors/ovl_En_Hanabi/z_en_hanabi.c | 6 +- src/overlays/actors/ovl_En_Hg/z_en_hg.c | 67 +- src/overlays/actors/ovl_En_Hg/z_en_hg.h | 4 +- src/overlays/actors/ovl_En_Hgo/z_en_hgo.c | 22 +- src/overlays/actors/ovl_En_Hgo/z_en_hgo.h | 2 +- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.c | 14 +- .../ovl_En_Hidden_Nuts/z_en_hidden_nuts.h | 2 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 274 ++-- src/overlays/actors/ovl_En_Horse/z_en_horse.h | 6 +- src/overlays/actors/ovl_En_Hs/z_en_hs.c | 2 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 40 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 16 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 14 +- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 74 +- src/overlays/actors/ovl_En_Jg/z_en_jg.h | 4 +- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 20 +- src/overlays/actors/ovl_En_Js/z_en_js.c | 42 +- src/overlays/actors/ovl_En_Js/z_en_js.h | 4 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 48 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 2 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 110 +- .../actors/ovl_En_Kakasi/z_en_kakasi.h | 2 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 4 +- src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 55 +- src/overlays/actors/ovl_En_Kgy/z_en_kgy.h | 4 +- .../actors/ovl_En_Kujiya/z_en_kujiya.c | 24 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 2 +- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 11 +- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 32 +- .../actors/ovl_En_Ma_Yto/z_en_ma_yto.c | 34 +- .../actors/ovl_En_Ma_Yts/z_en_ma_yts.c | 20 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 14 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 50 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 60 +- src/overlays/actors/ovl_En_Mk/z_en_mk.h | 2 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 10 +- .../actors/ovl_En_Mt_tag/z_en_mt_tag.c | 20 +- .../actors/ovl_En_Mushi2/z_en_mushi2.c | 2 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 36 +- .../actors/ovl_En_Onpuman/z_en_onpuman.c | 16 +- src/overlays/actors/ovl_En_Osk/z_en_osk.c | 52 +- src/overlays/actors/ovl_En_Osk/z_en_osk.h | 4 +- src/overlays/actors/ovl_En_Osn/z_en_osn.c | 36 +- src/overlays/actors/ovl_En_Osn/z_en_osn.h | 4 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 104 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.h | 10 +- src/overlays/actors/ovl_En_Ot/z_en_ot.c | 22 +- src/overlays/actors/ovl_En_Ot/z_en_ot.h | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 46 +- src/overlays/actors/ovl_En_Owl/z_en_owl.h | 4 +- .../actors/ovl_En_Pamera/z_en_pamera.c | 53 +- .../actors/ovl_En_Pamera/z_en_pamera.h | 4 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 20 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.h | 2 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 52 +- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.c | 2 +- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 40 +- .../actors/ovl_En_Railgibud/z_en_railgibud.h | 4 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 10 +- src/overlays/actors/ovl_En_Rz/z_en_rz.c | 50 +- src/overlays/actors/ovl_En_Rz/z_en_rz.h | 6 +- .../actors/ovl_En_Scopecrow/z_en_scopecrow.c | 2 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 28 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.h | 2 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 58 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.h | 2 +- src/overlays/actors/ovl_En_Shn/z_en_shn.c | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 2 +- src/overlays/actors/ovl_En_Slime/z_en_slime.c | 2 +- .../actors/ovl_En_Snowman/z_en_snowman.c | 2 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 114 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.h | 8 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 84 +- .../actors/ovl_En_Suttari/z_en_suttari.h | 4 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 10 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 68 +- src/overlays/actors/ovl_En_Test3/z_en_test3.h | 2 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 98 +- src/overlays/actors/ovl_En_Test4/z_en_test4.h | 2 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 232 +-- src/overlays/actors/ovl_En_Test6/z_en_test6.h | 4 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 58 +- .../actors/ovl_En_Time_Tag/z_en_time_tag.c | 46 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 24 +- src/overlays/actors/ovl_En_Tk/z_en_tk.h | 4 +- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 48 +- src/overlays/actors/ovl_En_Toto/z_en_toto.h | 4 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 158 +- src/overlays/actors/ovl_En_Trt/z_en_trt.h | 10 +- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 30 +- src/overlays/actors/ovl_En_Trt2/z_en_trt2.h | 2 +- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 50 +- src/overlays/actors/ovl_En_Tru/z_en_tru.h | 2 +- src/overlays/actors/ovl_En_Tsn/z_en_tsn.c | 24 +- .../actors/ovl_En_Warp_tag/z_en_warp_tag.c | 24 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 21 +- src/overlays/actors/ovl_En_Wiz/z_en_wiz.c | 22 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 2 +- src/overlays/actors/ovl_En_Yb/z_en_yb.c | 46 +- src/overlays/actors/ovl_En_Yb/z_en_yb.h | 4 +- src/overlays/actors/ovl_En_Zob/z_en_zob.c | 82 +- src/overlays/actors/ovl_En_Zob/z_en_zob.h | 6 +- src/overlays/actors/ovl_En_Zod/z_en_zod.c | 38 +- src/overlays/actors/ovl_En_Zog/z_en_zog.c | 70 +- src/overlays/actors/ovl_En_Zog/z_en_zog.h | 6 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 63 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.h | 2 +- src/overlays/actors/ovl_En_Zos/z_en_zos.c | 42 +- src/overlays/actors/ovl_En_Zos/z_en_zos.h | 2 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 25 +- src/overlays/actors/ovl_En_Zov/z_en_zov.c | 52 +- src/overlays/actors/ovl_En_Zov/z_en_zov.h | 6 +- src/overlays/actors/ovl_En_Zow/z_en_zow.c | 4 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 26 +- .../ovl_Obj_Bigicicle/z_obj_bigicicle.c | 12 +- .../ovl_Obj_Blockstop/z_obj_blockstop.c | 10 +- src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c | 22 +- src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h | 2 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 12 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h | 2 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 16 +- .../ovl_Obj_Danpeilift/z_obj_danpeilift.c | 2 +- src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c | 22 +- .../ovl_Obj_Fireshield/z_obj_fireshield.c | 10 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 6 +- .../actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c | 14 +- .../actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h | 2 +- .../actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c | 34 +- .../actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h | 4 +- .../ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c | 12 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.c | 24 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.h | 4 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 14 +- .../actors/ovl_Obj_Iceblock/z_obj_iceblock.c | 14 +- .../actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c | 2 +- .../actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c | 12 +- .../ovl_Obj_Lightblock/z_obj_lightblock.c | 14 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 8 +- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 10 +- .../actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c | 20 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 6 +- .../actors/ovl_Obj_Nozoki/z_obj_nozoki.c | 30 +- .../actors/ovl_Obj_Nozoki/z_obj_nozoki.h | 2 +- .../ovl_Obj_Ocarinalift/z_obj_ocarinalift.c | 10 +- .../actors/ovl_Obj_Purify/z_obj_purify.c | 2 +- .../actors/ovl_Obj_Raillift/z_obj_raillift.c | 10 +- .../ovl_Obj_Roomtimer/z_obj_roomtimer.c | 10 +- .../ovl_Obj_Skateblock/z_obj_skateblock.c | 4 +- .../actors/ovl_Obj_Snowball/z_obj_snowball.c | 26 +- .../ovl_Obj_Spidertent/z_obj_spidertent.c | 10 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 8 +- .../actors/ovl_Obj_Swprize/z_obj_swprize.c | 8 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 13 +- src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c | 6 +- .../ovl_Obj_Tokei_Step/z_obj_tokei_step.c | 10 +- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c | 48 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 44 +- .../actors/ovl_Obj_Usiyane/z_obj_usiyane.c | 16 +- .../actors/ovl_Obj_Usiyane/z_obj_usiyane.h | 4 +- .../ovl_Obj_Warpstone/z_obj_warpstone.c | 8 +- .../actors/ovl_Obj_Wturn/z_obj_wturn.c | 10 +- .../ovl_Obj_Y2shutter/z_obj_y2shutter.c | 12 +- .../actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c | 2 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 10 +- src/overlays/actors/ovl_TG_Sw/z_tg_sw.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 4 +- src/overlays/gamestates/ovl_select/z_select.c | 118 +- tools/disasm/files.txt | 6 +- tools/disasm/functions.txt | 168 +- tools/disasm/variables.txt | 60 +- tools/namefixer.py | 70 +- tools/sizes/code_functions.csv | 180 +-- tools/weekeventregconvert.py | 8 +- 390 files changed, 7327 insertions(+), 5600 deletions(-) create mode 100644 src/code/cutscene_camera.c delete mode 100644 src/code/db_camera.c diff --git a/include/functions.h b/include/functions.h index 91fa5d29d..690558f38 100644 --- a/include/functions.h +++ b/include/functions.h @@ -722,7 +722,7 @@ void Actor_KillAllWithMissingObject(PlayState* play, ActorContext* actorCtx); void func_800BA798(PlayState* play, ActorContext* actorCtx); void Actor_CleanupContext(ActorContext* actorCtx, PlayState* play); Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params); -Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s32 params, u32 cutscene, u32 halfDaysBits, Actor* parent); +Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX, s16 rotY, s16 rotZ, s32 params, u32 csId, u32 halfDaysBits, Actor* parent); Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params); void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx); void Enemy_StartFinishingBlow(PlayState* play, Actor* actor); @@ -1064,23 +1064,6 @@ s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRo s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos); void SaveContext_Init(void); -void Cutscene_Init(PlayState* play, CutsceneContext* csCtx); -void Cutscene_Start(PlayState* play, CutsceneContext* csCtx); -void Cutscene_End(PlayState* play, CutsceneContext* csCtx); -void Cutscene_Update1(PlayState* play, CutsceneContext* csCtx); -void Cutscene_Update2(PlayState* play, CutsceneContext* csCtx); -void func_800EDBE0(PlayState* play); -void func_800EDDB0(PlayState* play); -void Cutscene_LoadCutsceneData(PlayState* play, u8 csIndex); -void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 actorActionIndex); -void Cutscene_ActorTranslateAndYaw(Actor* actor, PlayState* play, s32 actorActionIndex); -void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex); -void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex); -s32 Cutscene_GetSceneLayer(PlayState* play); -s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd); -s32 Cutscene_CheckActorAction(PlayState* play, u16 actorActionCmd); -u8 Cutscene_IsPlaying(PlayState* play); - void GetItem_Draw(PlayState* play, s16 drawId); void SoundSource_InitAll(PlayState* play); @@ -1090,35 +1073,6 @@ void SoundSource_PlaySfxEachFrameAtFixedWorldPos(PlayState* play, Vec3f* worldPo u16 QuestHint_GetTatlTextId(PlayState* play); u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet); -void EnvFlags_UnsetAll(PlayState* play); -void EnvFlags_Set(PlayState* play, s16 flag); -void EnvFlags_Unset(PlayState* play, s16 flag); -s32 EnvFlags_Get(PlayState* play, s16 flag); -s16 func_800F1460(s16 param_1); -ActorCutscene* ActorCutscene_GetCutsceneImpl(s16 index); -void ActorCutscene_Init(PlayState* play, ActorCutscene* cutscenes, s32 num); -void func_800F15D8(Camera* camera); -void ActorCutscene_ClearWaiting(void); -// void ActorCutscene_ClearNextCutscenes(void); -// void ActorCutscene_MarkNextCutscenes(void); -// void ActorCutscene_End(void); -s16 ActorCutscene_Update(void); -void ActorCutscene_SetIntentToPlay(s16 index); -s16 ActorCutscene_GetCanPlayNext(s16 index); -s16 ActorCutscene_StartAndSetUnkLinkFields(s16 index, Actor* actor); -s16 ActorCutscene_StartAndSetFlag(s16 index, Actor* actor); -s16 ActorCutscene_Start(s16 index, Actor* actor); -s16 ActorCutscene_Stop(s16 index); -s16 ActorCutscene_GetCurrentIndex(void); -ActorCutscene* ActorCutscene_GetCutscene(s16 index); -s16 ActorCutscene_GetAdditionalCutscene(s16 index); -s16 ActorCutscene_GetLength(s16 index); -s32 func_800F2138(s32 arg0); -s32 func_800F2178(s16 arg0); -s16 ActorCutscene_GetCurrentSubCamId(s16 index); -s16 func_800F21CC(void); -s32 func_800F22C4(s16 param_1, Actor* actor); -void ActorCutscene_SetReturnCamera(s16 index); s32 func_800F3940(PlayState* play); // void func_800F39B4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); @@ -1776,8 +1730,8 @@ void Scene_Command09(PlayState* play, SceneCmd* cmd); void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd); void Scene_CommandEchoSetting(PlayState* play, SceneCmd* cmd); void Scene_CommandAltHeaderList(PlayState* play, SceneCmd* cmd); +void Scene_CommandCutsceneScriptList(PlayState* play, SceneCmd* cmd); void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd); -void Scene_CommandActorCutsceneList(PlayState* play, SceneCmd* cmd); void Scene_CommandMiniMap(PlayState* play, SceneCmd* cmd); void Scene_Command1D(PlayState* play, SceneCmd* cmd); void Scene_CommandMiniMapCompassInfo(PlayState* play, SceneCmd* cmd); @@ -1957,27 +1911,6 @@ void Message_FindCreditsMessage(PlayState* play, u16 textId); void func_8015E7EC(PlayState* play, UNK_PTR puParm2); // void func_8015F8A8(UNK_TYPE4 ctxt); -// void func_80161180(void); -s32 func_8016119C(Camera* camera, DbCameraUnkStruct* arg1); -// void func_8016122C(void); -// void func_801612B8(void); -s32 func_80161998(u8* cmd, DbCameraUnkStruct* arg1); -// s32 func_80161BAC(void); -void func_80161BE0(s16 arg0); -void func_80161C0C(void); -// void func_80161C20(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80161E4C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_801620CC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_8016237C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE4 param_6); -// void func_801623E4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_801624EC(void); -// void func_8016253C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_801629BC(void); -// void func_80162A50(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80162FF8(void); -// void func_801631DC(void); -// void func_80163334(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_80163660(void); void* KaleidoManager_FaultAddrConv(void* address, void* param); void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); @@ -2070,7 +2003,7 @@ s32 FrameAdvance_IsEnabled(GameState* thisx); s32 func_8016A02C(GameState* thisx, Actor* actor, s16* yaw); s32 Play_IsUnderwater(PlayState* this, Vec3f* pos); s32 Play_IsDebugCamEnabled(void); -void Play_AssignPlayerActorCsIdsFromScene(GameState* thisx, s32 startActorCsId); +void Play_AssignPlayerCsIdsFromScene(GameState* thisx, s32 spawnCsId); void Play_FillScreen(GameState* thisx, s16 fillScreenOn, u8 red, u8 green, u8 blue, u8 alpha); void Play_Init(GameState* thisx); @@ -2560,7 +2493,7 @@ OcarinaStaff* AudioOcarina_GetRecordingStaff(void); OcarinaStaff* AudioOcarina_GetPlayingStaff(void); OcarinaStaff* AudioOcarina_GetPlaybackStaff(void); void AudioOcarina_TerminaWallGenerateNotes(void); -void AudioOcarina_PlayLongScarecrowAfterCredits(void); +void AudioOcarina_PlayLongScarecrowSong(void); void Audio_Update(void); void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex); diff --git a/include/regs.h b/include/regs.h index 8de13fb66..112a00239 100644 --- a/include/regs.h +++ b/include/regs.h @@ -166,4 +166,7 @@ extern RegEditor* gRegEditor; #define R_ITEM_ICON_WIDTH(i) VREG(76 + i) #define R_ITEM_BTN_WIDTH(i) VREG(80 + i) +// Name inferred from OoT. Set to true to manually set play->csCtx.script +#define R_USE_DEBUG_CUTSCENE dREG(95) + #endif diff --git a/include/variables.h b/include/variables.h index b90fadcc6..f3d668b2b 100644 --- a/include/variables.h +++ b/include/variables.h @@ -431,19 +431,9 @@ extern EffectShieldParticleInit shieldParticleInitWood; // extern UNK_TYPE2 D_801BB0FC; // extern UNK_TYPE1 D_801BB100; -extern u8 D_801BB12C; +extern u8 gOpeningEntranceIndex; -// extern UNK_TYPE1 D_801BC41E; -extern ActorCutscene actorCutscenesGlobalCutscenes[8]; -extern s16 actorCutsceneCurrent; -extern s16 actorCutsceneCurrentLength; -extern s16 actorCutsceneEnding; -extern s16 actorCutsceneCurrentCamera; -extern Actor* actorCutsceneCurrentCutsceneActor; -// extern UNK_TYPE4 actorCutsceneStartMethod; -extern PlayState* actorCutscenesPlayState; -extern s16 actorCutsceneReturnCamera; -extern s16 D_801BD8C6; +extern ActorCutscene sGlobalCutsceneList[8]; extern GameStateOverlay gGameStateOverlayTable[]; extern s32 gGraphNumGameStates; // extern UNK_TYPE2 D_801BDA70; @@ -764,7 +754,7 @@ extern s32 gDbgCamEnabled; // extern UNK_TYPE2 sQuakeIndex; // extern UNK_TYPE2 sIsCameraUnderwater; extern Input* D_801D0D60; -// extern UNK_TYPE2 D_801D0D64; +// extern UNK_TYPE2 sPlayerCsIdToCsCamId; // extern UNK_TYPE1 D_801D0D7A; // extern UNK_TYPE1 D_801D0D80; // extern UNK_TYPE1 D_801D11F4; @@ -2335,14 +2325,14 @@ extern SaveContext gSaveContext; // extern UNK_TYPE1 D_801F48C8; extern UNK_TYPE D_801F4DDC; -extern u8 D_801F4DE0; -extern s16 D_801F4DE2; +extern u8 gDisablePlayerCsModeStartPos; +extern s16 gDungeonBossWarpSceneId; -extern ActorCutscene* actorCutscenes; -extern s16 actorCutsceneCount; -extern u8 actorCutsceneWaiting[16]; +extern ActorCutscene* sSceneCutsceneList; +extern s16 sSceneCutsceneCount; +extern u8 sWaitingCutsceneList[16]; // extern UNK_TYPE1 D_801F4E08; -extern u8 actorCutsceneNextCutscenes[16]; +extern u8 sNextCutsceneList[16]; // extern UNK_TYPE1 D_801F4E20; extern u8 D_801F4E30; // extern UNK_TYPE1 D_801F4E31; @@ -2420,7 +2410,7 @@ extern s16 D_801F4E7A; // extern UNK_TYPE1 D_801F6B1E; // extern UNK_TYPE1 D_801F6B20; // extern UNK_TYPE1 D_801F6B22; -// extern UNK_TYPE4 D_801F6B50; +// extern UNK_TYPE4 sCurCsCamera; // extern UNK_TYPE1 D_801F6B58; extern void (*sKaleidoScopeUpdateFunc)(PlayState* play); extern void (*sKaleidoScopeDrawFunc)(PlayState* play); diff --git a/include/z64.h b/include/z64.h index f496f02f1..50405690f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -87,19 +87,6 @@ typedef enum { /* 4 */ EQUIP_SLOT_A } EquipSlot; -typedef struct { - /* 0x0 */ s16 priority; // Lower means higher priority. -1 means it ignores priority - /* 0x2 */ s16 length; - /* 0x4 */ s16 csCamSceneDataId; // Index of CsCameraEntry to use. Negative indices use sGlobalCamDataSettings. Indices 0 and above use CsCameraEntry from scene - /* 0x6 */ s16 unk6; - /* 0x8 */ s16 additionalCutscene; - /* 0xA */ u8 sound; - /* 0xB */ u8 unkB; - /* 0xC */ s16 unkC; - /* 0xE */ u8 unkE; - /* 0xF */ u8 letterboxSize; -} ActorCutscene; // size = 0x10 - typedef struct { /* 0x0 */ s8 segment; /* 0x2 */ s16 type; @@ -647,7 +634,7 @@ typedef struct PlayState { /* 0x18790 */ void (*unk_18790)(struct PlayState* play, s16 arg1); /* 0x18794 */ PlayerItemAction (*unk_18794)(struct PlayState* play, Player* player, ItemId itemId); /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct PlayState* play, PlayerAnimationHeader* talkAnim, AnimationMode animMode); - /* 0x1879C */ s16 playerActorCsIds[10]; + /* 0x1879C */ s16 playerCsIds[PLAYER_CS_ID_MAX]; /* 0x187B0 */ MtxF viewProjectionMtxF; /* 0x187F0 */ Vec3f projectionMtxFDiagonal; /* 0x187FC */ MtxF billboardMtxF; @@ -678,7 +665,7 @@ typedef struct PlayState { /* 0x1887F */ u8 transitionType; // fadeTransition /* 0x18880 */ u8 unk_18880; /* 0x18884 */ CollisionCheckContext colChkCtx; - /* 0x18B20 */ u16 envFlags[20]; + /* 0x18B20 */ u16 cutsceneFlags[20]; /* 0x18B48 */ u8 curSpawn; /* 0x18B49 */ u8 unk_18B49; /* 0x18B4A */ u8 transitionMode; @@ -797,35 +784,4 @@ enum fram_mode { FRAM_MODE_STATUS }; -typedef struct { - /* 0x00 */ UNK_TYPE1 unk_00[0x14]; - /* 0x14 */ s16 unk_14; - /* 0x16 */ s16 unk_16; - /* 0x18 */ s16 unk_18; - /* 0x1A */ UNK_TYPE1 unk_1A[0x3]; - /* 0x0C */ u8 unk_1D; - /* 0x1E */ UNK_TYPE1 unk_1E[0xC]; - /* 0x2A */ s16 unk_2A; - /* 0x1E */ UNK_TYPE1 unk_2C[0x1]; - /* 0x2D */ u8 unk_2D; - /* 0x2E */ UNK_TYPE1 unk_2E[2]; -} DbCameraUnkSubStruct; // size = 0x30 - -typedef struct { - /* 0x00 */ s16 unk_00; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ s16 unk_06; - /* 0x08 */ s16 unk_08; - /* 0x0A */ s16 unk_0A; - /* 0x0C */ s16 unk_0C; - /* 0x0E */ UNK_TYPE1 unk_0E[0x02]; - /* 0x10 */ DbCameraUnkSubStruct unk_10; - /* 0x40 */ DbCameraUnkSubStruct unk_40; - /* 0x70 */ UNK_PTR unk_70; - /* 0x74 */ UNK_PTR unk_74; - /* 0x78 */ UNK_PTR unk_78; - /* 0x7C */ Camera* camera; -} DbCameraUnkStruct; // size = 0x80 - #endif diff --git a/include/z64actor.h b/include/z64actor.h index bfce67188..7cc4275ac 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -174,7 +174,7 @@ typedef struct Actor { /* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on /* 0x020 */ s16 halfDaysBits; // Bitmask indicating which half-days this actor is allowed to not be killed(?) (TODO: not sure how to word this). If the current halfDayBit is not part of this mask then the actor is killed when spawning the setup actors /* 0x024 */ PosRot world; // Position/rotation in the world - /* 0x038 */ s8 cutscene; + /* 0x038 */ s8 csId; // ActorCutscene index, see `CutsceneId` /* 0x039 */ u8 audioFlags; // Another set of flags? Seems related to sfx or bgm /* 0x03C */ PosRot focus; // Target reticle focuses on this position. For player this represents head pos and rot /* 0x050 */ u16 sfxId; // Id of sound effect to play. Plays when value is set, then is cleared the following update cycle diff --git a/include/z64camera.h b/include/z64camera.h index 9c101bf73..3205496e7 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -1319,7 +1319,7 @@ typedef struct { /* 0x0C */ f32 unk_0C; /* 0x10 */ f32 unk_10; /* 0x14 */ f32 unk_14; - /* 0x18 */ VecSph unk_18; // sp18-1C-20--24-26-28 // CutsceneCameraPoint? + /* 0x18 */ VecSph unk_18; /* 0x20 */ s16 unk_20; /* 0x22 */ s16 timer; } Demo4ReadWriteData; // size = 0x24 diff --git a/include/z64cutscene.h b/include/z64cutscene.h index f4cc10802..1fc32be28 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -4,158 +4,575 @@ #include "ultra64.h" #include "unk.h" -typedef struct { - /* 0x0 */ s8 continueFlag; - /* 0x1 */ s8 cameraRoll; - /* 0x2 */ u16 nextPointFrame; - /* 0x4 */ f32 viewAngle; // in degrees - /* 0x8 */ Vec3s pos; -} CutsceneCameraPoint; // size = 0x10 -typedef struct { - /* 0x00 */ Vec3f at; - /* 0x0C */ Vec3f eye; - /* 0x18 */ s16 roll; - /* 0x1A */ s16 fov; -} CutsceneCameraAngle; // size = 0x1C - -typedef struct { - /* 0x0 */ CutsceneCameraPoint* atPoints; - /* 0x4 */ CutsceneCameraPoint* eyePoints; - /* 0x8 */ s16 relativeToPlayer; -} CutsceneCameraMove; // size = 0xC - -typedef struct { - /* 0x00 */ u16 action; // "dousa" - /* 0x02 */ u16 startFrame; - /* 0x04 */ u16 endFrame; - union { - /* 0x06 */ Vec3s rot; - /* 0x06 */ Vec3us urot; +typedef union { + struct { + /* 0x00 */ u16 id; // "dousa" + /* 0x02 */ u16 startFrame; + /* 0x04 */ u16 endFrame; + /* 0x06 */ Vec3us rot; + /* 0x0C */ Vec3i startPos; + /* 0x18 */ Vec3i endPos; + /* 0x24 */ Vec3f normal; }; - /* 0x0C */ Vec3i startPos; - /* 0x18 */ Vec3i endPos; - /* 0x24 */ Vec3f normal; -} CsCmdActorAction; // size = 0x30 + s32 _words[12]; +} CsCmdActorCue; // size = 0x30 -typedef struct { - /* 0x0 */ u16 base; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ u16 unk_06; -} CsCmdBase; // size = 0x8 +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + }; + s32 _words[2]; +} CsCmdMisc; // size = 0x30 -typedef struct { - /* 0x0 */ u16 unk0; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ u8 hour; - /* 0x7 */ u8 minute; - /* 0x8 */ UNK_TYPE1 unk_08[0x04]; -} CsCmdDayTime; // size = 0xC +typedef union { + struct { + /* 0x0 */ u16 unused0; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + /* 0x6 */ u8 hour; + /* 0x7 */ u8 minute; + }; + s32 _words[3]; +} CsCmdTime; // size = 0xC -typedef struct { - /* 0x0 */ u16 setting; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ u16 unk_06; -} CsCmdEnvLighting; // size = 0x8 +typedef union { + struct { + /* 0x0 */ u16 settingPlusOne; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdLightSetting; // size = 0x8 -typedef struct { - /* 0x0 */ u16 sequence; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ u16 unk_06; -} CsCmdSequenceChange; // size = 0x8 +typedef union { + struct { + /* 0x0 */ u16 seqIdPlusOne; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + }; + s32 _words[2]; +} CsCmdStartSeq; // size = 0x8 -typedef struct { - /* 0x0 */ u16 type; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ u16 unk_06; - /* 0x8 */ u32 unk_08; -} CsCmdSequenceFade; // size = 0xC +typedef union { + struct { + /* 0x0 */ u16 seqIdPlusOne; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + }; + s32 _words[2]; +} CsCmdStopSeq; // size = 0x8 -typedef struct { - /* 0x0 */ u16 base; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ u16 type; - /* 0x8 */ u16 textId1; - /* 0xA */ u16 textId2; -} CsCmdTextbox; // size = 0xC +typedef union { + struct { + /* 0x0 */ u16 seqPlayer; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + }; + s32 _words[3]; +} CsCmdFadeOutSeq; // size = 0xC typedef enum { - /* -1 */ CS_TEXTBOX_TYPE_NONE = -1, - /* 0 */ CS_TEXTBOX_TYPE_DEFAULT, - /* 1 */ CS_TEXTBOX_TYPE_1, - /* 2 */ CS_TEXTBOX_TYPE_LEARN_SONG, - /* 3 */ CS_TEXTBOX_TYPE_3, - /* 4 */ CS_TEXTBOX_TYPE_BOSSES_REMAINS, - /* 5 */ CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS -} CutsceneTextboxType; + /* 1 */ CS_FADE_OUT_BGM_MAIN = 1, + /* 2 */ CS_FADE_OUT_FANFARE +} CutsceneFadeOutSeqPlayer; -typedef struct { - /* 0x0 */ u16 type; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ u8 intensity; - /* 0x7 */ u8 decayTimer; - /* 0x8 */ u8 decayStep; - /* 0x9 */ UNK_TYPE1 pad9[0x3]; +typedef union { + struct { + /* 0x0 */ u16 unused0; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdStartAmbience; // size = 0x8 + +typedef union { + struct { + /* 0x0 */ u16 unused0; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + }; + s32 _words[2]; +} CsCmdFadeOutAmbience; // size = 0x8 + +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdModifySeq; // size = 0x8 + +typedef enum { + /* 1 */ CS_MOD_SEQ_0 = 1, + /* 2 */ CS_MOD_SEQ_1, + /* 3 */ CS_MOD_SEQ_2, + /* 4 */ CS_MOD_AMBIENCE_0, + /* 5 */ CS_MOD_AMBIENCE_1, + /* 6 */ CS_MOD_AMBIENCE_2, + /* 7 */ CS_MOD_SEQ_STORE, + /* 8 */ CS_MOD_SEQ_RESTORE +} CsModifySeqType; + +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdDestination; // size = 0x8 + +typedef enum { + /* 1 */ CS_DESTINATION_DEFAULT = 1, + /* 2 */ CS_DESTINATION_BOSS_WARP +} CsDestinationType; + +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdChooseCreditsScene; // size = 0x8 + +typedef enum { + /* 1 */ CS_CREDITS_DESTINATION = CS_DESTINATION_DEFAULT, + /* 2 */ CS_CREDITS_MASK_KAMARO, + /* 3 */ CS_CREDITS_MASK_GREAT_FAIRY, + /* 4 */ CS_CREDITS_MASK_ROMANI, + /* 5 */ CS_CREDITS_MASK_BLAST, + /* 6 */ CS_CREDITS_MASK_CIRCUS_LEADER, + /* 7 */ CS_CREDITS_MASK_BREMEN, + /* 8 */ CS_CREDITS_IKANA, + /* 9 */ CS_CREDITS_MASK_COUPLE, + /* 10 */ CS_CREDITS_MASK_BUNNY, + /* 11 */ CS_CREDITS_MASK_POSTMAN +} CsChooseCreditsSceneType; + +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + }; + s32 _words[2]; +} CsCmdMotionBlur; // size = 0x8 + +typedef enum { + /* 1 */ CS_MOTION_BLUR_ENABLE = 1, // enable instantly + /* 2 */ CS_MOTION_BLUR_DISABLE // disable gradually +} CsMotionBlurType; + +typedef union { + struct { + /* 0x0 */ u16 unused0; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdSfxReverbIndexTo2; // size = 0x8 + +typedef union { + struct { + /* 0x0 */ u16 unused0; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdSfxReverbIndexTo1; // size = 0x8 + +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + }; + s32 _words[2]; +} CsCmdTransition; // size = 0x8 + +typedef enum { + /* 1 */ CS_TRANS_GRAY_FILL_IN = 1, // has hardcoded sounds for some scenes + /* 2 */ CS_TRANS_BLUE_FILL_IN, + /* 3 */ CS_TRANS_RED_FILL_OUT, + /* 4 */ CS_TRANS_GREEN_FILL_OUT, + /* 5 */ CS_TRANS_GRAY_FILL_OUT, + /* 6 */ CS_TRANS_BLUE_FILL_OUT, + /* 7 */ CS_TRANS_RED_FILL_IN, + /* 8 */ CS_TRANS_GREEN_FILL_IN, + /* 9 */ CS_TRANS_TRIGGER_INSTANCE, // used with `TRANS_MODE_INSTANCE_WAIT` + /* 10 */ CS_TRANS_BLACK_FILL_OUT, + /* 11 */ CS_TRANS_BLACK_FILL_IN, + /* 12 */ CS_TRANS_GRAY_TO_BLACK, + /* 13 */ CS_TRANS_BLACK_TO_GRAY +} CutsceneTransitionType; + +typedef union { + struct { + /* 0x0 */ u16 textId; // can also be an ocarina action for `CS_TEXT_OCARINA_ACTION` + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + /* 0x6 */ u16 type; + /* 0x8 */ u16 altTextId1; + /* 0xA */ u16 altTextId2; + }; + s32 _words[3]; +} CsCmdText; // size = 0xC + +typedef enum { + /* -1 */ CS_TEXT_TYPE_NONE = -1, + /* 0 */ CS_TEXT_TYPE_DEFAULT, + /* 1 */ CS_TEXT_TYPE_1, + /* 2 */ CS_TEXT_OCARINA_ACTION, + /* 3 */ CS_TEXT_TYPE_3, + /* 4 */ CS_TEXT_TYPE_BOSSES_REMAINS, // use `altText1` in the Giant Cutscene if all remains are already obtained + /* 5 */ CS_TEXT_TYPE_ALL_NORMAL_MASKS +} CutsceneTextType; + +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + /* 0x6 */ u8 intensity; + /* 0x7 */ u8 decayTimer; + /* 0x8 */ u8 decayStep; + }; + s32 _words[3]; } CsCmdRumble; // size = 0xC -typedef struct { - /* 0x0 */ u16 unk0; - /* 0x2 */ u16 startFrame; - /* 0x4 */ u16 endFrame; - /* 0x6 */ Color_RGB8 color; - /* 0x9 */ UNK_TYPE1 pad9[0x3]; -} CsCmdFadeScreen; // size = 0xC +typedef enum { + /* 1 */ CS_RUMBLE_ONCE = 1, // rumble once when startFrame is reached + /* 2 */ CS_RUMBLE_PULSE // rumble every 64 frames between startFrame and endFrame +} CutsceneRumbleType; + +typedef union { + struct { + /* 0x0 */ u16 type; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; + /* 0x6 */ Color_RGB8 color; + }; + s32 _words[3]; +} CsCmdTransitionGeneral; // size = 0xC typedef enum { - /* 0 */ CS_STATE_0, - /* 1 */ CS_STATE_1, - /* 2 */ CS_STATE_2, - /* 3 */ CS_STATE_3, - /* 4 */ CS_STATE_4 + /* 1 */ CS_TRANS_GENERAL_FILL_IN = 1, + /* 2 */ CS_TRANS_GENERAL_FILL_OUT +} CsTransitionGeneralType; + +typedef union { + struct { + /* 0x0 */ u16 giveTatl; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdGiveTatl; // size = 0x8 + +typedef enum { + /* 0 */ CS_STATE_IDLE, + /* 1 */ CS_STATE_START, + /* 2 */ CS_STATE_RUN, + /* 3 */ CS_STATE_STOP, + /* 4 */ CS_STATE_RUN_UNSTOPPABLE } CutsceneState; +typedef union { + struct { + /* 0x0 */ u16 unused0; + /* 0x2 */ u16 startFrame; + /* 0x4 */ u16 endFrame; // unused + }; + s32 _words[2]; +} CsCmdUnimplemented; // size = 0x8 + typedef enum { - /* 0x00A */ CS_CMD_TEXTBOX = 0xA, - /* 0x05A */ CS_CMD_CAMERA = 0x5A, - /* 0x096 */ CS_CMD_MISC = 0x96, - /* 0x097 */ CS_CMD_SET_LIGHTING, - /* 0x098 */ CS_CMD_SCENE_TRANS_FX, - /* 0x099 */ CS_CMD_MOTIONBLUR, - /* 0x09A */ CS_CMD_GIVETATL, - /* 0x09B */ CS_CMD_FADESCREEN, - /* 0x09C */ CS_CMD_FADESEQ, - /* 0x09D */ CS_CMD_SETTIME, - /* 0x0C8 */ CS_CMD_SET_PLAYER_ACTION = 0xC8, - /* 0x0FA */ CS_CMD_UNK_FA = 0xFA, - /* 0x0FE */ CS_CMD_UNK_FE = 0xFE, - /* 0x0FF */ CS_CMD_UNK_FF, - /* 0x100 */ CS_CMD_UNK_100, - /* 0x101 */ CS_CMD_UNK_101, - /* 0x102 */ CS_CMD_UNK_102, - /* 0x103 */ CS_CMD_UNK_103, - /* 0x104 */ CS_CMD_UNK_104, - /* 0x105 */ CS_CMD_UNK_105, - /* 0x108 */ CS_CMD_UNK_108 = 0x108, - /* 0x109 */ CS_CMD_UNK_109, - /* 0x12C */ CS_CMD_PLAYSEQ = 0x12C, - /* 0x12D */ CS_CMD_STOPSEQ, - /* 0x12E */ CS_CMD_PLAYAMBIENCE, - /* 0x12F */ CS_CMD_FADEAMBIENCE, - /* 0x130 */ CS_CMD_130, - /* 0x131 */ CS_CMD_131, - /* 0x132 */ CS_CMD_132, - /* 0x15E */ CS_CMD_TERMINATOR = 0x15E, + /* 0x00A */ CS_CMD_TEXT = 10, + /* 0x05A */ CS_CMD_CAMERA_SPLINE = 90, + /* 0x064 */ CS_CMD_ACTOR_CUE_100 = 100, + /* 0x065 */ CS_CMD_ACTOR_CUE_101, + /* 0x066 */ CS_CMD_ACTOR_CUE_102, + /* 0x067 */ CS_CMD_ACTOR_CUE_103, + /* 0x068 */ CS_CMD_ACTOR_CUE_104, + /* 0x069 */ CS_CMD_ACTOR_CUE_105, + /* 0x06A */ CS_CMD_ACTOR_CUE_106, + /* 0x06B */ CS_CMD_ACTOR_CUE_107, + /* 0x06C */ CS_CMD_ACTOR_CUE_108, + /* 0x06D */ CS_CMD_ACTOR_CUE_109, + /* 0x06E */ CS_CMD_ACTOR_CUE_110, + /* 0x06F */ CS_CMD_ACTOR_CUE_111, + /* 0x070 */ CS_CMD_ACTOR_CUE_112, + /* 0x071 */ CS_CMD_ACTOR_CUE_113, + /* 0x072 */ CS_CMD_ACTOR_CUE_114, + /* 0x073 */ CS_CMD_ACTOR_CUE_115, + /* 0x074 */ CS_CMD_ACTOR_CUE_116, + /* 0x075 */ CS_CMD_ACTOR_CUE_117, + /* 0x076 */ CS_CMD_ACTOR_CUE_118, + /* 0x077 */ CS_CMD_ACTOR_CUE_119, + /* 0x078 */ CS_CMD_ACTOR_CUE_120, + /* 0x079 */ CS_CMD_ACTOR_CUE_121, + /* 0x07A */ CS_CMD_ACTOR_CUE_122, + /* 0x07B */ CS_CMD_ACTOR_CUE_123, + /* 0x07C */ CS_CMD_ACTOR_CUE_124, + /* 0x07D */ CS_CMD_ACTOR_CUE_125, + /* 0x07E */ CS_CMD_ACTOR_CUE_126, + /* 0x07F */ CS_CMD_ACTOR_CUE_127, + /* 0x080 */ CS_CMD_ACTOR_CUE_128, + /* 0x081 */ CS_CMD_ACTOR_CUE_129, + /* 0x082 */ CS_CMD_ACTOR_CUE_130, + /* 0x083 */ CS_CMD_ACTOR_CUE_131, + /* 0x084 */ CS_CMD_ACTOR_CUE_132, + /* 0x085 */ CS_CMD_ACTOR_CUE_133, + /* 0x086 */ CS_CMD_ACTOR_CUE_134, + /* 0x087 */ CS_CMD_ACTOR_CUE_135, + /* 0x088 */ CS_CMD_ACTOR_CUE_136, + /* 0x089 */ CS_CMD_ACTOR_CUE_137, + /* 0x08A */ CS_CMD_ACTOR_CUE_138, + /* 0x08B */ CS_CMD_ACTOR_CUE_139, + /* 0x08C */ CS_CMD_ACTOR_CUE_140, + /* 0x08D */ CS_CMD_ACTOR_CUE_141, + /* 0x08E */ CS_CMD_ACTOR_CUE_142, + /* 0x08F */ CS_CMD_ACTOR_CUE_143, + /* 0x090 */ CS_CMD_ACTOR_CUE_144, + /* 0x091 */ CS_CMD_ACTOR_CUE_145, + /* 0x092 */ CS_CMD_ACTOR_CUE_146, + /* 0x093 */ CS_CMD_ACTOR_CUE_147, + /* 0x094 */ CS_CMD_ACTOR_CUE_148, + /* 0x095 */ CS_CMD_ACTOR_CUE_149, + /* 0x096 */ CS_CMD_MISC, + /* 0x097 */ CS_CMD_LIGHT_SETTING, + /* 0x098 */ CS_CMD_TRANSITION, + /* 0x099 */ CS_CMD_MOTION_BLUR, + /* 0x09A */ CS_CMD_GIVE_TATL, + /* 0x09B */ CS_CMD_TRANSITION_GENERAL, + /* 0x09C */ CS_CMD_FADE_OUT_SEQ, + /* 0x09D */ CS_CMD_TIME, + /* 0x0C8 */ CS_CMD_PLAYER_CUE = 200, + /* 0x0C9 */ CS_CMD_ACTOR_CUE_201, + /* 0x0FA */ CS_CMD_UNK_DATA_FA = 0xFA, + /* 0x0FE */ CS_CMD_UNK_DATA_FE = 0xFE, + /* 0x0FF */ CS_CMD_UNK_DATA_FF, + /* 0x100 */ CS_CMD_UNK_DATA_100, + /* 0x101 */ CS_CMD_UNK_DATA_101, + /* 0x102 */ CS_CMD_UNK_DATA_102, + /* 0x103 */ CS_CMD_UNK_DATA_103, + /* 0x104 */ CS_CMD_UNK_DATA_104, + /* 0x105 */ CS_CMD_UNK_DATA_105, + /* 0x108 */ CS_CMD_UNK_DATA_108 = 0x108, + /* 0x109 */ CS_CMD_UNK_DATA_109, + /* 0x12C */ CS_CMD_START_SEQ = 300, + /* 0x12D */ CS_CMD_STOP_SEQ, + /* 0x12E */ CS_CMD_START_AMBIENCE, + /* 0x12F */ CS_CMD_FADE_OUT_AMBIENCE, + /* 0x130 */ CS_CMD_SFX_REVERB_INDEX_2, + /* 0x131 */ CS_CMD_SFX_REVERB_INDEX_1, + /* 0x132 */ CS_CMD_MODIFY_SEQ, + /* 0x15E */ CS_CMD_DESTINATION = 350, /* 0x15F */ CS_CMD_CHOOSE_CREDITS_SCENES, - /* 0x190 */ CS_CMD_RUMBLE = 0x190 + /* 0x190 */ CS_CMD_RUMBLE = 400, + /* 0x1C2 */ CS_CMD_ACTOR_CUE_450 = 450, + /* 0x1C3 */ CS_CMD_ACTOR_CUE_451, + /* 0x1C4 */ CS_CMD_ACTOR_CUE_452, + /* 0x1C5 */ CS_CMD_ACTOR_CUE_453, + /* 0x1C6 */ CS_CMD_ACTOR_CUE_454, + /* 0x1C7 */ CS_CMD_ACTOR_CUE_455, + /* 0x1C8 */ CS_CMD_ACTOR_CUE_456, + /* 0x1C9 */ CS_CMD_ACTOR_CUE_457, + /* 0x1CA */ CS_CMD_ACTOR_CUE_458, + /* 0x1CB */ CS_CMD_ACTOR_CUE_459, + /* 0x1CC */ CS_CMD_ACTOR_CUE_460, + /* 0x1CD */ CS_CMD_ACTOR_CUE_461, + /* 0x1CE */ CS_CMD_ACTOR_CUE_462, + /* 0x1CF */ CS_CMD_ACTOR_CUE_463, + /* 0x1D0 */ CS_CMD_ACTOR_CUE_464, + /* 0x1D1 */ CS_CMD_ACTOR_CUE_465, + /* 0x1D2 */ CS_CMD_ACTOR_CUE_466, + /* 0x1D3 */ CS_CMD_ACTOR_CUE_467, + /* 0x1D4 */ CS_CMD_ACTOR_CUE_468, + /* 0x1D5 */ CS_CMD_ACTOR_CUE_469, + /* 0x1D6 */ CS_CMD_ACTOR_CUE_470, + /* 0x1D7 */ CS_CMD_ACTOR_CUE_471, + /* 0x1D8 */ CS_CMD_ACTOR_CUE_472, + /* 0x1D9 */ CS_CMD_ACTOR_CUE_473, + /* 0x1DA */ CS_CMD_ACTOR_CUE_474, + /* 0x1DB */ CS_CMD_ACTOR_CUE_475, + /* 0x1DC */ CS_CMD_ACTOR_CUE_476, + /* 0x1DD */ CS_CMD_ACTOR_CUE_477, + /* 0x1DE */ CS_CMD_ACTOR_CUE_478, + /* 0x1DF */ CS_CMD_ACTOR_CUE_479, + /* 0x1E0 */ CS_CMD_ACTOR_CUE_480, + /* 0x1E1 */ CS_CMD_ACTOR_CUE_481, + /* 0x1E2 */ CS_CMD_ACTOR_CUE_482, + /* 0x1E3 */ CS_CMD_ACTOR_CUE_483, + /* 0x1E4 */ CS_CMD_ACTOR_CUE_484, + /* 0x1E5 */ CS_CMD_ACTOR_CUE_485, + /* 0x1E6 */ CS_CMD_ACTOR_CUE_486, + /* 0x1E7 */ CS_CMD_ACTOR_CUE_487, + /* 0x1E8 */ CS_CMD_ACTOR_CUE_488, + /* 0x1E9 */ CS_CMD_ACTOR_CUE_489, + /* 0x1EA */ CS_CMD_ACTOR_CUE_490, + /* 0x1EB */ CS_CMD_ACTOR_CUE_491, + /* 0x1EC */ CS_CMD_ACTOR_CUE_492, + /* 0x1ED */ CS_CMD_ACTOR_CUE_493, + /* 0x1EE */ CS_CMD_ACTOR_CUE_494, + /* 0x1EF */ CS_CMD_ACTOR_CUE_495, + /* 0x1F0 */ CS_CMD_ACTOR_CUE_496, + /* 0x1F1 */ CS_CMD_ACTOR_CUE_497, + /* 0x1F2 */ CS_CMD_ACTOR_CUE_498, + /* 0x1F3 */ CS_CMD_ACTOR_CUE_499, + /* 0x1F4 */ CS_CMD_ACTOR_CUE_500, + /* 0x1F5 */ CS_CMD_ACTOR_CUE_501, + /* 0x1F6 */ CS_CMD_ACTOR_CUE_502, + /* 0x1F7 */ CS_CMD_ACTOR_CUE_503, + /* 0x1F8 */ CS_CMD_ACTOR_CUE_504, + /* 0x1F9 */ CS_CMD_ACTOR_CUE_505, + /* 0x1FA */ CS_CMD_ACTOR_CUE_506, + /* 0x1FB */ CS_CMD_ACTOR_CUE_507, + /* 0x1FC */ CS_CMD_ACTOR_CUE_508, + /* 0x1FD */ CS_CMD_ACTOR_CUE_509, + /* 0x1FE */ CS_CMD_ACTOR_CUE_510, + /* 0x1FF */ CS_CMD_ACTOR_CUE_511, + /* 0x200 */ CS_CMD_ACTOR_CUE_512, + /* 0x201 */ CS_CMD_ACTOR_CUE_513, + /* 0x202 */ CS_CMD_ACTOR_CUE_514, + /* 0x203 */ CS_CMD_ACTOR_CUE_515, + /* 0x204 */ CS_CMD_ACTOR_CUE_516, + /* 0x205 */ CS_CMD_ACTOR_CUE_517, + /* 0x206 */ CS_CMD_ACTOR_CUE_518, + /* 0x207 */ CS_CMD_ACTOR_CUE_519, + /* 0x208 */ CS_CMD_ACTOR_CUE_520, + /* 0x209 */ CS_CMD_ACTOR_CUE_521, + /* 0x20A */ CS_CMD_ACTOR_CUE_522, + /* 0x20B */ CS_CMD_ACTOR_CUE_523, + /* 0x20C */ CS_CMD_ACTOR_CUE_524, + /* 0x20D */ CS_CMD_ACTOR_CUE_525, + /* 0x20E */ CS_CMD_ACTOR_CUE_526, + /* 0x20F */ CS_CMD_ACTOR_CUE_527, + /* 0x210 */ CS_CMD_ACTOR_CUE_528, + /* 0x211 */ CS_CMD_ACTOR_CUE_529, + /* 0x212 */ CS_CMD_ACTOR_CUE_530, + /* 0x213 */ CS_CMD_ACTOR_CUE_531, + /* 0x214 */ CS_CMD_ACTOR_CUE_532, + /* 0x215 */ CS_CMD_ACTOR_CUE_533, + /* 0x216 */ CS_CMD_ACTOR_CUE_534, + /* 0x217 */ CS_CMD_ACTOR_CUE_535, + /* 0x218 */ CS_CMD_ACTOR_CUE_536, + /* 0x219 */ CS_CMD_ACTOR_CUE_537, + /* 0x21A */ CS_CMD_ACTOR_CUE_538, + /* 0x21B */ CS_CMD_ACTOR_CUE_539, + /* 0x21C */ CS_CMD_ACTOR_CUE_540, + /* 0x21D */ CS_CMD_ACTOR_CUE_541, + /* 0x21E */ CS_CMD_ACTOR_CUE_542, + /* 0x21F */ CS_CMD_ACTOR_CUE_543, + /* 0x220 */ CS_CMD_ACTOR_CUE_544, + /* 0x221 */ CS_CMD_ACTOR_CUE_545, + /* 0x222 */ CS_CMD_ACTOR_CUE_546, + /* 0x223 */ CS_CMD_ACTOR_CUE_547, + /* 0x224 */ CS_CMD_ACTOR_CUE_548, + /* 0x225 */ CS_CMD_ACTOR_CUE_549, + /* 0x226 */ CS_CMD_ACTOR_CUE_550, + /* 0x227 */ CS_CMD_ACTOR_CUE_551, + /* 0x228 */ CS_CMD_ACTOR_CUE_552, + /* 0x229 */ CS_CMD_ACTOR_CUE_553, + /* 0x22A */ CS_CMD_ACTOR_CUE_554, + /* 0x22B */ CS_CMD_ACTOR_CUE_555, + /* 0x22C */ CS_CMD_ACTOR_CUE_556, + /* 0x22D */ CS_CMD_ACTOR_CUE_557, + /* 0x22E */ CS_CMD_ACTOR_CUE_558, + /* 0x22F */ CS_CMD_ACTOR_CUE_559, + /* 0x230 */ CS_CMD_ACTOR_CUE_560, + /* 0x231 */ CS_CMD_ACTOR_CUE_561, + /* 0x232 */ CS_CMD_ACTOR_CUE_562, + /* 0x233 */ CS_CMD_ACTOR_CUE_563, + /* 0x234 */ CS_CMD_ACTOR_CUE_564, + /* 0x235 */ CS_CMD_ACTOR_CUE_565, + /* 0x236 */ CS_CMD_ACTOR_CUE_566, + /* 0x237 */ CS_CMD_ACTOR_CUE_567, + /* 0x238 */ CS_CMD_ACTOR_CUE_568, + /* 0x239 */ CS_CMD_ACTOR_CUE_569, + /* 0x23A */ CS_CMD_ACTOR_CUE_570, + /* 0x23B */ CS_CMD_ACTOR_CUE_571, + /* 0x23C */ CS_CMD_ACTOR_CUE_572, + /* 0x23D */ CS_CMD_ACTOR_CUE_573, + /* 0x23E */ CS_CMD_ACTOR_CUE_574, + /* 0x23F */ CS_CMD_ACTOR_CUE_575, + /* 0x240 */ CS_CMD_ACTOR_CUE_576, + /* 0x241 */ CS_CMD_ACTOR_CUE_577, + /* 0x242 */ CS_CMD_ACTOR_CUE_578, + /* 0x243 */ CS_CMD_ACTOR_CUE_579, + /* 0x244 */ CS_CMD_ACTOR_CUE_580, + /* 0x245 */ CS_CMD_ACTOR_CUE_581, + /* 0x246 */ CS_CMD_ACTOR_CUE_582, + /* 0x247 */ CS_CMD_ACTOR_CUE_583, + /* 0x248 */ CS_CMD_ACTOR_CUE_584, + /* 0x249 */ CS_CMD_ACTOR_CUE_585, + /* 0x24A */ CS_CMD_ACTOR_CUE_586, + /* 0x24B */ CS_CMD_ACTOR_CUE_587, + /* 0x24C */ CS_CMD_ACTOR_CUE_588, + /* 0x24D */ CS_CMD_ACTOR_CUE_589, + /* 0x24E */ CS_CMD_ACTOR_CUE_590, + /* 0x24F */ CS_CMD_ACTOR_CUE_591, + /* 0x250 */ CS_CMD_ACTOR_CUE_592, + /* 0x251 */ CS_CMD_ACTOR_CUE_593, + /* 0x252 */ CS_CMD_ACTOR_CUE_594, + /* 0x253 */ CS_CMD_ACTOR_CUE_595, + /* 0x254 */ CS_CMD_ACTOR_CUE_596, + /* 0x255 */ CS_CMD_ACTOR_CUE_597, + /* 0x256 */ CS_CMD_ACTOR_CUE_598, + /* 0x257 */ CS_CMD_ACTOR_CUE_599, + /* -2 */ CS_CMD_ACTOR_CUE_POST_PROCESS = 0xFFFFFFFE, + /* -1 */ CS_CAM_STOP // OoT Remnant } CutsceneCmd; +typedef enum { + /* 0x00 */ CS_MISC_UNIMPLEMENTED_0, + /* 0x01 */ CS_MISC_RAIN, + /* 0x02 */ CS_MISC_LIGHTNING, + /* 0x03 */ CS_MISC_LIFT_FOG, + /* 0x04 */ CS_MISC_CLOUDY_SKY, + /* 0x05 */ CS_MISC_STOP_CUTSCENE, + /* 0x06 */ CS_MISC_UNIMPLEMENTED_6, + /* 0x07 */ CS_MISC_SHOW_TITLE_CARD, + /* 0x08 */ CS_MISC_EARTHQUAKE_MEDIUM, + /* 0x09 */ CS_MISC_EARTHQUAKE_STOP, + /* 0x0A */ CS_MISC_VISMONO_BLACK_AND_WHITE, + /* 0x0B */ CS_MISC_VISMONO_SEPIA, + /* 0x0C */ CS_MISC_HIDE_ROOM, + /* 0x0D */ CS_MISC_RED_PULSATING_LIGHTS, + /* 0x0E */ CS_MISC_HALT_ALL_ACTORS, + /* 0x0F */ CS_MISC_RESUME_ALL_ACTORS, + /* 0x10 */ CS_MISC_SANDSTORM_FILL, + /* 0x11 */ CS_MISC_SUNSSONG_START, + /* 0x12 */ CS_MISC_FREEZE_TIME, + /* 0x13 */ CS_MISC_LONG_SCARECROW_SONG, + /* 0x14 */ CS_MISC_SET_CSFLAG_3, + /* 0x15 */ CS_MISC_SET_CSFLAG_4, + /* 0x16 */ CS_MISC_PLAYER_FORM_DEKU, + /* 0x17 */ CS_MISC_ENABLE_PLAYER_REFLECTION, + /* 0x18 */ CS_MISC_DISABLE_PLAYER_REFLECTION, + /* 0x19 */ CS_MISC_PLAYER_FORM_HUMAN, + /* 0x1A */ CS_MISC_EARTHQUAKE_STRONG, + /* 0x1B */ CS_MISC_DEST_MOON_CRASH_FIRE_WALL, + /* 0x1C */ CS_MISC_MOON_CRASH_SKYBOX, + /* 0x1D */ CS_MISC_PLAYER_FORM_RESTORED, + /* 0x1E */ CS_MISC_DISABLE_PLAYER_CSMODE_START_POS, + /* 0x1F */ CS_MISC_ENABLE_PLAYER_CSMODE_START_POS, + /* 0x20 */ CS_MISC_UNIMPLEMENTED_20, + /* 0x21 */ CS_MISC_SAVE_ENTER_CLOCK_TOWN, + /* 0x22 */ CS_MISC_RESET_SAVE_FROM_MOON_CRASH, + /* 0x23 */ CS_MISC_TIME_ADVANCE, + /* 0x24 */ CS_MISC_EARTHQUAKE_WEAK, + /* 0x25 */ CS_MISC_UNIMPLEMENTED_25, + /* 0x26 */ CS_MISC_DAWN_OF_A_NEW_DAY, + /* 0x27 */ CS_MISC_PLAYER_FORM_ZORA, + /* 0x28 */ CS_MISC_FINALE +} CutsceneMiscType; + typedef union CutsceneData { s32 i; f32 f; @@ -163,29 +580,291 @@ typedef union CutsceneData { s8 b[4]; } CutsceneData; -typedef struct { - /* 0x0 */ CutsceneData* segmentedData; - /* 0x4 */ s16 nextEntrance; - /* 0x6 */ u8 unk6; - /* 0x7 */ u8 unk7; // a weekEventReg bitpack? -} CutsceneEntry; // size = 0x8 +#define BIT_FLAG_TO_SHIFT(flag) \ + ((flag & 0x80) ? 7 : \ + (flag & 0x40) ? 6 : \ + (flag & 0x20) ? 5 : \ + (flag & 0x10) ? 4 : \ + (flag & 0x8) ? 3 : \ + (flag & 0x4) ? 2 : \ + (flag & 0x2) ? 1 : \ + (flag & 0x1) ? 0 : \ + 0) + +// Do not trigger the scripted cutscene upon any spawn +#define CS_SPAWN_FLAG_NONE 0xFF +// Always trigger the scripted cutscene upon the specified spawn +#define CS_SPAWN_FLAG_ALWAYS 0xFE +// Trigger the scripted cutscene once upon the specified spawn if `weekEventFlags` is not set. Set `weekEventFlags` after the cutscene. +//! @note Despite there being more than `0x1F` indices for weekEventFlags, this u8 flag entry can only check weekEventFlags with indices [0 - 0x1F] +#define CS_SPAWN_FLAG_ONCE(weekEventFlag) ((((weekEventFlag) & 0x1F00) >> 5) | BIT_FLAG_TO_SHIFT((weekEventFlag) & 0xFF)) + +#define CHECK_CS_SPAWN_FLAG_WEEKEVENTREG(spawnFlags) (GET_WEEKEVENTREG((spawnFlags) / 8) & (1 << ((spawnFlags) % 8))) +#define SET_CS_SPAWN_FLAG_WEEKEVENTREG(spawnFlags) (WEEKEVENTREG((spawnFlags) / 8) = GET_WEEKEVENTREG((spawnFlags) / 8) | (1 << ((spawnFlags) % 8))) + typedef struct { - /* 0x00 */ u8 sceneCsCount; - /* 0x04 */ CutsceneData* csData; - /* 0x08 */ u8 state; - /* 0x0C */ f32 unk_0C; - /* 0x10 */ u16 frames; - /* 0x12 */ u16 currentCsIndex; - /* 0x14 */ s32 subCamId; - /* 0x18 */ u16 unk_18; - /* 0x1A */ u8 unk_1A; - /* 0x1B */ u8 unk_1B; - /* 0x1C */ CutsceneCameraPoint* atPoints; - /* 0x20 */ CutsceneCameraPoint* eyePoints; - /* 0x24 */ CsCmdActorAction* playerAction; - /* 0x28 */ CsCmdActorAction* actorActions[10]; // "npcdemopnt" - /* 0x50 */ CutsceneEntry* sceneCsList; + /* 0x0 */ CutsceneData* script; + /* 0x4 */ s16 nextEntrance; + /* 0x6 */ u8 spawn; + /* 0x7 */ u8 spawnFlags; // See `CS_SPAWN_FLAG_` +} CutsceneScriptEntry; // size = 0x8 + +// ZAPD compatibility typedefs +// TODO: Remove when ZAPD adds support for them +typedef CutsceneScriptEntry CutsceneEntry; + +typedef struct { + /* 0x00 */ u8 scriptListCount; + /* 0x04 */ CutsceneData* script; + /* 0x08 */ u8 state; + /* 0x0C */ f32 timer; + /* 0x10 */ u16 curFrame; + /* 0x12 */ u16 scriptIndex; + /* 0x14 */ s32 subCamId; + /* 0x18 */ u16 camEyeSplinePointsAppliedFrame; // Remnant of OoT. Set but never used. + /* 0x1C */ UNK_TYPE1 unk_1C[0xA]; // Remnant of cam data from OoT + /* 0x24 */ CsCmdActorCue* playerCue; + /* 0x28 */ CsCmdActorCue* actorCues[10]; // "npcdemopnt" + /* 0x50 */ CutsceneScriptEntry* scriptList; } CutsceneContext; // size = 0x54 +/* Actor Cutscenes, which encompasses all cutscenes */ + +typedef struct { + /* 0x00 */ s16 priority; // Lower means higher priority. -1 means it ignores priority + /* 0x02 */ s16 length; + /* 0x04 */ s16 csCamId; // Index of CsCameraEntry to use. Negative indices use sGlobalCamDataSettings. Indices 0 and above use CsCameraEntry from a sceneLayer + /* 0x06 */ s16 scriptIndex; + /* 0x08 */ s16 additionalCsId; + /* 0x0A */ u8 endSfx; + /* 0x0B */ u8 customValue; // 0 - 99: actor-specific custom value. 100+: spawn. 255: none + /* 0x0C */ s16 hudVisibility; + /* 0x0E */ u8 endCam; + /* 0x0F */ u8 letterboxSize; +} ActorCutscene; // size = 0x10 +// TODO: rename `ActorCutscene` to `CutsceneEntry` once ZAPD uses `CutsceneScriptEntry` +// typedef CutsceneEntry ActorCutscene; + +typedef enum { + /* -1 */ CS_ID_NONE = -1, + // CsId's 0 - 119 are sceneLayer-specific and index `ActorCutscene` + /* 0x78 */ CS_ID_GLOBAL_78 = 120, + /* 0x79 */ CS_ID_GLOBAL_79, + /* 0x7A */ CS_ID_GLOBAL_7A, + /* 0x7B */ CS_ID_GLOBAL_ELEGY, + /* 0x7C */ CS_ID_GLOBAL_TALK, + /* 0x7D */ CS_ID_GLOBAL_DOOR, + /* 0x7E */ CS_ID_GLOBAL_RETURN_TO_CAM, // smoothly return to the previous camera + /* 0x7F */ CS_ID_GLOBAL_END +} CutsceneId; + +typedef enum { + /* 0 */ PLAYER_CS_ID_ITEM_OCARINA, + /* 1 */ PLAYER_CS_ID_ITEM_GET, + /* 2 */ PLAYER_CS_ID_ITEM_BOTTLE, + /* 3 */ PLAYER_CS_ID_ITEM_SHOW, + /* 4 */ PLAYER_CS_ID_WARP_PAD_MOON, + /* 5 */ PLAYER_CS_ID_MASK_TRANSFORMATION, + /* 6 */ PLAYER_CS_ID_DEATH, + /* 7 */ PLAYER_CS_ID_REVIVE, + /* 8 */ PLAYER_CS_ID_SONG_WARP, // Song of Time and Song of Soaring + /* 9 */ PLAYER_CS_ID_WARP_PAD_ENTRANCE, + /* 10 */ PLAYER_CS_ID_MAX +} PlayerCsId; + +#define CS_SCRIPT_ID_NONE -1 + +typedef enum { + // global (see sGlobalCamDataSettings) + /* -25 */ CS_CAM_ID_GLOBAL_ELEGY = -25, // CAM_SET_ELEGY_SHELL + /* -24 */ CS_CAM_ID_GLOBAL_SIDED, // CAM_SET_SIDED + /* -23 */ CS_CAM_ID_GLOBAL_BOAT_CRUISE, // CAM_SET_BOAT_CRUISE + /* -22 */ CS_CAM_ID_GLOBAL_N16, // CAM_SET_NONE + /* -21 */ CS_CAM_ID_GLOBAL_SUBJECTD, // CAM_SET_SUBJECTD + /* -20 */ CS_CAM_ID_GLOBAL_NORMALD, // CAM_SET_NORMALD + /* -19 */ CS_CAM_ID_GLOBAL_N13, // CAM_SET_NONE + /* -18 */ CS_CAM_ID_GLOBAL_N12, // CAM_SET_NONE + /* -17 */ CS_CAM_ID_GLOBAL_N11, // CAM_SET_NONE + /* -16 */ CS_CAM_ID_GLOBAL_WARP_PAD_ENTRANCE, // CAM_SET_WARP_PAD_ENTRANCE + /* -15 */ CS_CAM_ID_GLOBAL_ATTENTION, // CAM_SET_ATTENTION + /* -14 */ CS_CAM_ID_GLOBAL_CONNECT, // CAM_SET_CONNECT0 + /* -13 */ CS_CAM_ID_GLOBAL_REMOTE_BOMB, // CAM_SET_REMOTEBOMB + /* -12 */ CS_CAM_ID_GLOBAL_N0C, // CAM_SET_NONE + /* -11 */ CS_CAM_ID_GLOBAL_MASK_TRANSFORMATION, // CAM_SET_MASK_TRANSFORMATION + /* -10 */ CS_CAM_ID_GLOBAL_LONG_CHEST_OPENING, // CAM_SET_LONG_CHEST_OPENING + /* -9 */ CS_CAM_ID_GLOBAL_REVIVE, // CAM_SET_REBIRTH + /* -8 */ CS_CAM_ID_GLOBAL_DEATH, // CAM_SET_DEATH + /* -7 */ CS_CAM_ID_GLOBAL_WARP_PAD_MOON, // CAM_SET_WARP_PAD_MOON + /* -6 */ CS_CAM_ID_GLOBAL_SONG_WARP, // CAM_SET_NAVI + /* -5 */ CS_CAM_ID_GLOBAL_ITEM_SHOW, // CAM_SET_ITEM3 + /* -4 */ CS_CAM_ID_GLOBAL_ITEM_BOTTLE, // CAM_SET_ITEM2 + /* -3 */ CS_CAM_ID_GLOBAL_ITEM_OCARINA, // CAM_SET_ITEM1 + /* -2 */ CS_CAM_ID_GLOBAL_ITEM_GET, // CAM_SET_ITEM0 + /* -1 */ CS_CAM_ID_NONE + // CamCsId's 0+ are sceneLayer-specific and index `ActorCsCamInfo` +} CutsceneCamId; + +typedef enum { + /* -1 */ CS_HUD_VISIBILITY_ALL_ALT = -1, + /* 0 */ CS_HUD_VISIBILITY_NONE, + /* 1 */ CS_HUD_VISIBILITY_ALL, + /* 2 */ CS_HUD_VISIBILITY_A_HEARTS_MAGIC, + /* 3 */ CS_HUD_VISIBILITY_C_HEARTS_MAGIC, + /* 4 */ CS_HUD_VISIBILITY_ALL_NO_MINIMAP, + /* 5 */ CS_HUD_VISIBILITY_A_B_C, + /* 6 */ CS_HUD_VISIBILITY_B_MINIMAP, + /* 7 */ CS_HUD_VISIBILITY_A +} CutsceneHudVisibility; + +typedef enum { + /* 0 */ CS_END_SFX_NONE, + /* 1 */ CS_END_SFX_TRE_BOX_APPEAR, + /* 2 */ CS_END_SFX_CORRECT_CHIME, + /* 255 */ CS_END_SFX_NONE_ALT = 0xFF +} CutsceneEndSfx; + +typedef enum { + /* 0 */ CS_END_CAM_0, + /* 1 */ CS_END_CAM_1, + /* 2 */ CS_END_CAM_SMOOTH +} CutsceneEndCam; + +/* Cutscene Camera Spline Scripts */ + +typedef struct { + /* 0x0 */ s16 numEntries; + /* 0x2 */ s16 unk_02; // unused + /* 0x4 */ s16 unk_04; // unused + /* 0x6 */ s16 duration; // total duration +} CsCmdCamSpline; // size = 0x8 + +// Both camAt and camEye +typedef struct { + /* 0x0 */ u8 interpType; // see `CutsceneCamInterpType` + /* 0x1 */ u8 weight; // for certain types of interpTypes, shifts the weight to certain points. Default is 100. + /* 0x2 */ s16 duration; // duration of current point + /* 0x4 */ Vec3s pos; + /* 0xA */ s16 relativeTo; // see `CutsceneCamRelativeTo` +} CsCmdCamPoint; // size = 0xC + +typedef enum { + /* 0 */ CS_CAM_INTERP_0, + /* 1 */ CS_CAM_INTERP_1, + /* 2 */ CS_CAM_INTERP_2, + /* 3 */ CS_CAM_INTERP_3, + /* 4 */ CS_CAM_INTERP_4, + /* 5 */ CS_CAM_INTERP_5, + /* 6 */ CS_CAM_INTERP_6, + /* 7 */ CS_CAM_INTERP_7 +} CutsceneCamInterpType; + +typedef enum { + /* 0 */ CS_CAM_REL_0, + /* 1 */ CS_CAM_REL_1, + /* 2 */ CS_CAM_REL_2, + /* 3 */ CS_CAM_REL_3, + /* 4 */ CS_CAM_REL_4, + /* 5 */ CS_CAM_REL_5 +} CutsceneCamRelativeTo; + + +// Roll and Fov Data +typedef struct { + /* 0x0 */ s16 unused0; // unused + /* 0x2 */ s16 roll; + /* 0x4 */ s16 fov; + /* 0x6 */ s16 unused1; // unused +} CsCmdCamMisc; // size = 0x8 + +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ f32 unk_18; + /* 0x1C */ f32 unk_1C; + /* 0x2A */ f32 unk_20; + /* 0x24 */ s16 unk_24; + /* 0x26 */ s16 unk_26; + /* 0x28 */ s16 unk_28; + /* 0x2A */ s16 numEntries; + /* 0x1E */ u8 curPoint; + /* 0x2D */ u8 unk_2D; + /* 0x2E */ UNK_TYPE1 unk_2E[2]; +} CutsceneCameraInterp; // size = 0x30 + +typedef struct { + /* 0x00 */ s16 splineIndex; + /* 0x02 */ s16 cmdIndex; + /* 0x04 */ s16 splineNeedsInit; + /* 0x06 */ s16 state; + /* 0x08 */ s16 nextSplineTimer; + /* 0x0A */ s16 updateSplineTimer; + /* 0x0C */ s16 duration; // Duration of the current spline + /* 0x10 */ CutsceneCameraInterp eyeInterp; + /* 0x40 */ CutsceneCameraInterp atInterp; + /* 0x70 */ CsCmdCamPoint* atCmd; + /* 0x74 */ CsCmdCamPoint* eyeCmd; + /* 0x78 */ CsCmdCamMisc* miscCmd; + /* 0x7C */ Camera* camera; +} CutsceneCamera; // size = 0x80 + +typedef enum { + /* 0 */ CS_CAM_STATE_UPDATE_ALL, // Update spline and next spline timer + /* 0 */ CS_CAM_STATE_UPDATE_SPLINE, // Update spline, do not advance next spline timer + /* 0 */ CS_CAM_STATE_PAUSE, // No updates + /* 0 */ CS_CAM_STATE_DONE_SPLINE, // Finished the current spline, ready for the next one + /* 0 */ CS_CAM_STATE_DONE = 999 // Finished all the splines. +} CutsceneCameraState; + +// OoT Remnant +#define CS_CAM_DATA_NOT_APPLIED 0xFFFF + +void Cutscene_InitContext(struct PlayState* play, CutsceneContext* csCtx); +void Cutscene_StartManual(struct PlayState* play, CutsceneContext* csCtx); +void Cutscene_StopManual(struct PlayState* play, CutsceneContext* csCtx); +void Cutscene_UpdateManual(struct PlayState* play, CutsceneContext* csCtx); +void Cutscene_UpdateScripted(struct PlayState* play, CutsceneContext* csCtx); +void Cutscene_HandleEntranceTriggers(struct PlayState* play); +void func_800EDDB0(struct PlayState* play); +void Cutscene_StartScripted(struct PlayState* play, u8 scriptIndex); +void Cutscene_ActorTranslate(Actor* actor, struct PlayState* play, s32 cueChannel); +void Cutscene_ActorTranslateAndYaw(Actor* actor, struct PlayState* play, s32 cueChannel); +void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, struct PlayState* play, s32 cueChannel); +void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, struct PlayState* play, s32 cueChannel); +s32 Cutscene_GetSceneLayer(struct PlayState* play); +s32 Cutscene_GetCueChannel(struct PlayState* play, u16 cueType); +s32 Cutscene_IsCueInChannel(struct PlayState* play, u16 cueType); +u8 Cutscene_IsPlaying(struct PlayState* play); + +void CutsceneManager_Init(struct PlayState* play, ActorCutscene* cutsceneList, s16 numEntries); +void CutsceneManager_StoreCamera(Camera* camera); +void CutsceneManager_ClearWaiting(void); +s16 CutsceneManager_Update(void); +void CutsceneManager_Queue(s16 csId); +s16 CutsceneManager_IsNext(s16 csId); +s16 CutsceneManager_StartWithPlayerCs(s16 csId, Actor* actor); +s16 CutsceneManager_StartWithPlayerCsAndSetFlag(s16 csId, Actor* actor); +s16 CutsceneManager_Start(s16 csId, Actor* actor); +s16 CutsceneManager_Stop(s16 csId); +s16 CutsceneManager_GetCurrentCsId(void); +ActorCutscene* CutsceneManager_GetCutsceneEntry(s16 csId); +s16 CutsceneManager_GetAdditionalCsId(s16 csId); +s16 CutsceneManager_GetLength(s16 csId); +s16 CutsceneManager_GetCutsceneScriptIndex(s16 csId); +s16 CutsceneManager_GetCutsceneCustomValue(s16 csId); +s16 CutsceneManager_GetCurrentSubCamId(s16 csId); +s16 CutsceneManager_FindEntranceCsId(void); +s32 func_800F22C4(s16 csId, Actor* actor); +void CutsceneManager_SetReturnCamera(s16 camId); + +s32 CutsceneCamera_Init(Camera* camera, CutsceneCamera* csCamera); +s32 CutsceneCamera_UpdateSplines(u8* script, CutsceneCamera* csCamera); +void CutsceneCamera_SetState(s16 state); +void CutsceneCamera_Reset(void); + +void CutsceneFlags_UnsetAll(struct PlayState* play); +void CutsceneFlags_Set(struct PlayState* play, s16 flag); +void CutsceneFlags_Unset(struct PlayState* play, s16 flag); +s32 CutsceneFlags_Get(struct PlayState* play, s16 flag); + #endif diff --git a/include/z64cutscene_commands.h b/include/z64cutscene_commands.h index 1ab6533ac..50e1ce451 100644 --- a/include/z64cutscene_commands.h +++ b/include/z64cutscene_commands.h @@ -5,13 +5,19 @@ #include "z64cutscene.h" /** + * Cutscene scripts are arrays of `CutsceneData` words, including bit-packed integers and floats. + */ + +/** + * Marks the beginning of a cutscene script. + * * ARGS - * s32 totalEntries (e), s32 endFrame (n) + * s32 totalEntries (e), s32 frameCount (n) * FORMAT * eeeeeeee nnnnnnnn * size = 0x8 */ -#define CS_BEGIN_CUTSCENE(totalEntries, endFrame) { CMD_W(totalEntries) }, { CMD_W(endFrame) } +#define CS_BEGIN_CUTSCENE(totalEntries, frameCount) { CMD_W(totalEntries) }, { CMD_W(frameCount) } /** @@ -21,83 +27,83 @@ * 0000000A eeeeeeee * size = 0x8 */ -#define CS_TEXT_LIST(entries) { CS_CMD_TEXTBOX }, { CMD_W(entries) } +#define CS_TEXT_LIST(entries) { CS_CMD_TEXT }, { CMD_W(entries) } /** * ARGS - * s16 messageId (i), s16 startFrame (s), s16 endFrame (e), s16 type (o), + * s16 textId (i), s16 startFrame (s), s16 endFrame (e), s16 type (o), * s16 topOptionBranch (y), s16 bottomOptionBranch (n) * FORMAT * iiiissss eeeeoooo yyyynnnn * size = 0xC */ -#define CS_TEXT_DISPLAY_TEXTBOX(messageId, startFrame, endFrame, type, topOptionBranch, bottomOptionBranch) \ - { CMD_HH(messageId, startFrame) }, { CMD_HH(endFrame, type) }, { CMD_HH(topOptionBranch, bottomOptionBranch) } +#define CS_TEXT(textId, startFrame, endFrame, type, topOptionBranch, bottomOptionBranch) \ + { CMD_HH(textId, startFrame) }, { CMD_HH(endFrame, type) }, { CMD_HH(topOptionBranch, bottomOptionBranch) } /** * ARGS - * s16 messageId (i), s16 startFrame (s), s16 endFrame (e), + * s16 textId (i), s16 startFrame (s), s16 endFrame (e), * s16 topOptionBranch (y), s16 bottomOptionBranch (n) * FORMAT * iiiissss eeee0000 yyyynnnn * size = 0xC */ -#define CS_TEXT_DEFAULT(messageId, startFrame, endFrame, topOptionBranch, bottomOptionBranch) \ - CS_TEXT_DISPLAY_TEXTBOX(messageId, startFrame, endFrame, CS_TEXTBOX_TYPE_DEFAULT, topOptionBranch, bottomOptionBranch) +#define CS_TEXT_DEFAULT(textId, startFrame, endFrame, topOptionBranch, bottomOptionBranch) \ + CS_TEXT(textId, startFrame, endFrame, CS_TEXT_TYPE_DEFAULT, topOptionBranch, bottomOptionBranch) /** * ARGS - * s16 messageId (i), s16 startFrame (s), s16 endFrame (e), + * s16 textId (i), s16 startFrame (s), s16 endFrame (e), * s16 topOptionBranch (y), s16 bottomOptionBranch (n) * FORMAT * iiiissss eeee0001 yyyynnnn * size = 0xC */ -#define CS_TEXT_TYPE_1(messageId, startFrame, endFrame, topOptionBranch, bottomOptionBranch) \ - CS_TEXT_DISPLAY_TEXTBOX(messageId, startFrame, endFrame, CS_TEXTBOX_TYPE_1, topOptionBranch, bottomOptionBranch) +#define CS_TEXT_TYPE_1(textId, startFrame, endFrame, topOptionBranch, bottomOptionBranch) \ + CS_TEXT(textId, startFrame, endFrame, CS_TEXT_TYPE_1, topOptionBranch, bottomOptionBranch) /** * ARGS - * s16 ocarinaSongAction (o), s16 startFrame (s), s16 endFrame (e), s16 messageId (i) + * s16 ocarinaSongAction (o), s16 startFrame (s), s16 endFrame (e), s16 textId (i) * FORMAT * oooossss eeee0002 iiiiFFFF * size = 0xC */ -#define CS_TEXT_LEARN_SONG(ocarinaSongAction, startFrame, endFrame, messageId) \ - CS_TEXT_DISPLAY_TEXTBOX(ocarinaSongAction, startFrame, endFrame, CS_TEXTBOX_TYPE_LEARN_SONG, messageId, 0xFFFF) +#define CS_TEXT_OCARINA_ACTION(ocarinaSongAction, startFrame, endFrame, textId) \ + CS_TEXT(ocarinaSongAction, startFrame, endFrame, CS_TEXT_OCARINA_ACTION, textId, 0xFFFF) /** * ARGS - * s16 messageId (i), s16 startFrame (s), s16 endFrame (e), + * s16 textId (i), s16 startFrame (s), s16 endFrame (e), * s16 topOptionBranch (y), s16 bottomOptionBranch (n) * FORMAT * iiiissss eeee0003 yyyynnnn * size = 0xC */ -#define CS_TEXT_TYPE_3(messageId, startFrame, endFrame, topOptionBranch, bottomOptionBranch) \ - CS_TEXT_DISPLAY_TEXTBOX(messageId, startFrame, endFrame, CS_TEXTBOX_TYPE_3, topOptionBranch, bottomOptionBranch) +#define CS_TEXT_TYPE_3(textId, startFrame, endFrame, topOptionBranch, bottomOptionBranch) \ + CS_TEXT(textId, startFrame, endFrame, CS_TEXT_TYPE_3, topOptionBranch, bottomOptionBranch) /** - * If Player has all 4 bosses' remains then alternativeMessageId is used, otherwise defaultMessageId is used + * If Player has all 4 bosses' remains then alternativeTextId is used, otherwise defaultTextId is used * ARGS - * s16 defaultMessageId (d), s16 startFrame (s), s16 endFrame (e), s16 alternativeMessageId (a) + * s16 defaultTextId (d), s16 startFrame (s), s16 endFrame (e), s16 alternativeTextId (a) * FORMAT * ddddssss eeee0004 aaaaFFFF * size = 0xC */ -#define CS_TEXT_BOSSES_REMAINS(defaultMessageId, startFrame, endFrame, alternativeMessageId) \ - CS_TEXT_DISPLAY_TEXTBOX(defaultMessageId, startFrame, endFrame, CS_TEXTBOX_TYPE_BOSSES_REMAINS, alternativeMessageId, 0xFFFF) +#define CS_TEXT_BOSSES_REMAINS(defaultTextId, startFrame, endFrame, alternativeTextId) \ + CS_TEXT(defaultTextId, startFrame, endFrame, CS_TEXT_TYPE_BOSSES_REMAINS, alternativeTextId, 0xFFFF) /** - * If Player has every non-transformation mask then alternativeMessageId is used, otherwise defaultMessageId is used + * If Player has every non-transformation mask then alternativeTextId is used, otherwise defaultTextId is used * ARGS - * s16 defaultMessageId (d), s16 startFrame (s), s16 endFrame (e), s16 alternativeMessageId (a) + * s16 defaultTextId (d), s16 startFrame (s), s16 endFrame (e), s16 alternativeTextId (a) * FORMAT * ddddssss eeee0005 aaaaFFFF * size = 0xC */ -#define CS_TEXT_ALL_NORMAL_MASKS(defaultMessageId, startFrame, endFrame, alternativeMessageId) \ - CS_TEXT_DISPLAY_TEXTBOX(defaultMessageId, startFrame, endFrame, CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS, alternativeMessageId, 0xFFFF) +#define CS_TEXT_ALL_NORMAL_MASKS(defaultTextId, startFrame, endFrame, alternativeTextId) \ + CS_TEXT(defaultTextId, startFrame, endFrame, CS_TEXT_TYPE_ALL_NORMAL_MASKS, alternativeTextId, 0xFFFF) /** * ARGS @@ -107,22 +113,57 @@ * size = 0xC */ #define CS_TEXT_NONE(startFrame, endFrame) \ - CS_TEXT_DISPLAY_TEXTBOX(0xFFFF, startFrame, endFrame, CS_TEXTBOX_TYPE_NONE, 0xFFFF, 0xFFFF) + CS_TEXT(0xFFFF, startFrame, endFrame, CS_TEXT_TYPE_NONE, 0xFFFF, 0xFFFF) /** * ARGS - * s32 entries (e) + * s32 numBytes (b) * FORMAT - * 0000005A eeeeeeee + * 0000005A bbbbbbbb * size = 0x8 */ -#define CS_CAMERA_LIST(entries) { CS_CMD_CAMERA }, { CMD_W(entries) } +#define CS_CAM_SPLINE_LIST(numBytes) { CS_CMD_CAMERA_SPLINE }, { CMD_W(numBytes) } -// TODO: Camera command macros. Requieres func_80161998 being decomped +/** + * ARGS + * s16 numEntries (e), s16 duration (d) + * FORMAT + * Capital U is Unused + * eeeeUUUU UUUUdddd + * size = 0x8 + */ +#define CS_CAM_SPLINE(numEntries, unused0, unused1, duration) \ + { CMD_HH(numEntries, unused0) }, { CMD_HH(unused1, duration) } + +/** + * ARGS + * u8 interpType (i), u8 weight (2), s16 duration (d), Vec3s pos (x/y/z), s16 relativeTo (r) + * FORMAT + * ii22dddd xxxxyyyy zzzzrrrr + * size = 0xC + */ +#define CS_CAM_POINT(interpType, weight, duration, posX, posY, posZ, relativeTo) \ + { CMD_BBH(interpType, weight, duration) }, { CMD_HH(posX, posY) }, { CMD_HH(posZ, relativeTo) } + +/** + * ARGS + * s16 roll (r), s16 fov (f) + * FORMAT + * Capital U is Unused + * UUUUrrrr ffffUUUU + * size = 0x8 + */ +#define CS_CAM_MISC(unused0, roll, fov, unused1) \ + { CMD_HH(unused0, roll) }, { CMD_HH(fov, unused1) } + +// First half-word is read from as `numEntries` in `CS_CAM_SPLINE()` +#define CS_CAM_END() { CMD_HH(0xFFFF, 4) } /** + * Declares a list of `CS_MISC` entries. + * * ARGS * s32 entries (e) * FORMAT @@ -132,36 +173,46 @@ #define CS_MISC_LIST(entries) { CS_CMD_MISC }, { CMD_W(entries) } /** + * Various miscellaneous commands. + * @see `CutsceneMiscType` enum for the different types of commands. + * @note setting `endFrame` to same value as `startFrame` will not behave as expected. + * For commands that only need to last one frame, set `endFrame` to `startFrame + 1`. + * * ARGS - * s16 unk (u), s16 startFrame (s), s16 endFrame (e) + * s16 type (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * uuuussss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_MISC(unk, startFrame, endFrame, unk_06) \ - { CMD_HH(unk, startFrame) }, { CMD_HH(endFrame, unk_06) } +#define CS_MISC(type, startFrame, endFrame, unused0) \ + { CMD_HH(type, startFrame) }, { CMD_HH(endFrame, unused0) } /** + * Declares a list of `CS_LIGHT_SETTING` entries. + * * ARGS * s32 entries (e) * FORMAT * 00000097 eeeeeeee * size = 0x8 */ -#define CS_LIGHTING_LIST(entries) { CS_CMD_SET_LIGHTING }, { CMD_W(entries) } +#define CS_LIGHT_SETTING_LIST(entries) { CS_CMD_LIGHT_SETTING }, { CMD_W(entries) } /** + * Changes the environment lights to the specified setting. + * The lighting change will take place immediately with no blending. + * * ARGS - * s16 setting (m), s16 startFrame (s), s16 endFrame (e) + * s16 setting (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_LIGHTING(setting, startFrame, endFrame) \ - { CMD_HH(setting, startFrame) }, { CMD_HH(endFrame, endFrame) } +#define CS_LIGHT_SETTING(lightSetting, startFrame, endFrame) \ + { CMD_BBH(0, (lightSetting + 1), startFrame) }, { CMD_HH(endFrame, endFrame) } /** @@ -171,18 +222,18 @@ * 00000098 eeeeeeee * size = 0x8 */ -#define CS_SCENE_TRANS_FX_LIST(entries) { CS_CMD_SCENE_TRANS_FX }, { CMD_W(entries) } +#define CS_TRANSITION_LIST(entries) { CS_CMD_TRANSITION }, { CMD_W(entries) } /** * ARGS - * s16 transitionType (m), s16 startFrame (s), s16 endFrame (e) + * s16 type (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_SCENE_TRANS_FX(transitionType, startFrame, endFrame) \ - { CMD_HH(transitionType, startFrame) }, { CMD_HH(endFrame, endFrame) } +#define CS_TRANSITION(type, startFrame, endFrame) \ + { CMD_HH(type, startFrame) }, { CMD_HH(endFrame, endFrame) } /** @@ -190,20 +241,20 @@ * s32 entries (e) * FORMAT * 00000099 eeeeeeee - * size = 0x08 + * size = 0x8 */ -#define CS_MOTIONBLUR_LIST(entries) { CS_CMD_MOTIONBLUR }, { CMD_W(entries) } +#define CS_MOTION_BLUR_LIST(entries) { CS_CMD_MOTION_BLUR }, { CMD_W(entries) } /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 type (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_MOTIONBLUR(base, startFrame, endFrame) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, endFrame) } +#define CS_MOTION_BLUR(type, startFrame, endFrame) \ + { CMD_HH(type, startFrame) }, { CMD_HH(endFrame, endFrame) } /** @@ -213,18 +264,18 @@ * 0000009A eeeeeeee * size = 0x8 */ -#define CS_GIVETATL_LIST(entries) { CS_CMD_GIVETATL }, { CMD_W(entries) } +#define CS_GIVE_TATL_LIST(entries) { CS_CMD_GIVE_TATL }, { CMD_W(entries) } /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 giveTatl (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_GIVETATL(base, startFrame, endFrame) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, endFrame) } +#define CS_GIVE_TATL(giveTatl, startFrame, endFrame) \ + { CMD_HH(giveTatl, startFrame) }, { CMD_HH(endFrame, endFrame) } /** @@ -234,75 +285,66 @@ * 0000009B eeeeeeee * size = 0x8 */ -#define CS_FADESCREEN_LIST(entries) { CS_CMD_FADESCREEN }, { CMD_W(entries) } +#define CS_TRANSITION_GENERAL_LIST(entries) { CS_CMD_TRANSITION_GENERAL }, { CMD_W(entries) } /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e), + * s16 type (t), s16 startFrame (s), s16 endFrame (e), * u8 red (r), u8 green (g), blue (b) * FORMAT * Capital U is Unused - * mmmmssss eeeerrgg bbUUUUUU + * ttttssss eeeerrgg bbUUUUUU * size = 0x0C */ -#define CS_FADESCREEN(base, startFrame, endFrame, red, green, blue) \ - { CMD_HH(base, startFrame) }, { CMD_HBB(endFrame, red, green) }, { CMD_BBBB(blue, 0, 0, 0) } - - -/** - * ARGS - * s32 entries (e) - * FORMAT - * 0000009C eeeeeeee - * size = 0x8 - */ -#define CS_FADESEQ_LIST(entries) { CS_CMD_FADESEQ }, { CMD_W(entries) } - -/** - * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) - * FORMAT - * Capital U is Unused - * mmmmssss eeeeUUUU UUUUUUUU - * size = 0x0C - */ -#define CS_FADESEQ(base, startFrame, endFrame) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, 0) }, { CMD_W(0) } +#define CS_TRANSITION_GENERAL(type, startFrame, endFrame, red, green, blue) \ + { CMD_HH(type, startFrame) }, { CMD_HBB(endFrame, red, green) }, { CMD_BBBB(blue, 0, 0, 0) } /** + * Declares a list of `CS_TIME` entries. + * * ARGS * s32 entries (e) * FORMAT * 0000009D eeeeeeee * size = 0x8 */ -#define CS_TIME_LIST(entries) { CS_CMD_SETTIME }, { CMD_W(entries) } +#define CS_TIME_LIST(entries) { CS_CMD_TIME }, { CMD_W(entries) } /** + * Sets the time of day. + * Both the day time and skybox time are set by this command. + * @note `endFrame` is not used in the implementation of the command, so its value does not matter + * * ARGS - * s16 unk (u), s16 startFrame (s), s16 endFrame (e), s8 hour (h), s8 min (m) + * s16 startFrame (s), s16 endFrame (e), s8 hour (h), s8 min (m) * FORMAT * Capital U is Unused - * uuuussss eeeehhmm UUUUUUUU + * UUUUssss eeeehhmm UUUUUUUU * size = 0xC */ -#define CS_TIME(unk, startFrame, endFrame, hour, min, unused) \ - { CMD_HH(unk, startFrame) }, { CMD_HBB(endFrame, hour, min) }, { CMD_W(unused) } +#define CS_TIME(unused0, startFrame, endFrame, hour, min) \ + { CMD_HH(unused0, startFrame) }, { CMD_HBB(endFrame, hour, min) }, { CMD_W(0) } /** + * Declares a list of `CS_ACTOR_CUE` entries. + * * ARGS * s32 cmdType (c), s32 entries (e) * FORMAT * cccccccc eeeeeeee * size = 0x8 */ -#define CS_ACTOR_ACTION_LIST(cmdType, entries) { CMD_W(cmdType) }, { CMD_W(entries) } +#define CS_ACTOR_CUE_LIST(cmdType, entries) { CMD_W(cmdType) }, { CMD_W(entries) } /** + * Defines a cue that an actor can listen for. + * The actor can choose whether or not to use the position and rotation data supplied to it. + * The cue `id` is a number that has an actor-specific meaning. + * * ARGS - * s16 npcAction (a), s16 startFrame (s), s16 endFrame (e), + * s16 id (a), s16 startFrame (s), s16 endFrame (e), * s16 rotX (u), s16 rotY (v), s16 rotZ (w), * s32 startX (i), s32 startY (j), s32 startZ (k), * s32 endX (l), s32 endY (m), s32 endZ (n), @@ -311,25 +353,29 @@ * aaaassss eeeeuuuu vvvvwwww iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmm nnnnnnnn xxxxxxxx yyyyyyyy zzzzzzzz * size = 0x30 */ -#define CS_ACTOR_ACTION(npcAction, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, normX, normY, normZ) \ - { CMD_HH(npcAction, startFrame) }, { CMD_HH(endFrame, rotX) }, { CMD_HH(rotY, rotZ) }, \ +#define CS_ACTOR_CUE(id, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, normX, normY, normZ) \ + { CMD_HH(id, startFrame) }, { CMD_HH(endFrame, rotX) }, { CMD_HH(rotY, rotZ) }, \ { CMD_W(startX) }, { CMD_W(startY) }, { CMD_W(startZ) }, \ { CMD_W(endX) }, { CMD_W(endY) }, { CMD_W(endZ) }, \ { CMD_F(normX) }, { CMD_F(normY) }, { CMD_F(normZ) } /** + * Declares a list of `CS_PLAYER_CUE` entries. + * * ARGS * s32 cmdType (c), s32 entries (e) * FORMAT * 000000C8 eeeeeeee * size = 0x8 */ -#define CS_PLAYER_ACTION_LIST(entries) { CS_CMD_SET_PLAYER_ACTION }, { CMD_W(entries) } +#define CS_PLAYER_CUE_LIST(entries) { CS_CMD_PLAYER_CUE }, { CMD_W(entries) } /** + * A player cue is the same as `CS_ACTOR_CUE` but is specifically for player. + * * ARGS - * s16 playerAction (a), s16 startFrame (s), s16 endFrame (e), + * s16 id (a), s16 startFrame (s), s16 endFrame (e), * s16 rotX (u), s16 rotY (v), s16 rotZ (w), * s32 startX (i), s32 startY (j), s32 startZ (k), * s32 endX (l), s32 endY (m), s32 endZ (n), @@ -338,113 +384,87 @@ * aaaassss eeeeuuuu vvvvwwww iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmm nnnnnnnn xxxxxxxx yyyyyyyy zzzzzzzz * size = 0x30 */ -#define CS_PLAYER_ACTION(playerAction, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, normX, normY, normZ) \ - CS_ACTOR_ACTION(playerAction, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, normX, normY, normZ) +#define CS_PLAYER_CUE(id, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, normX, normY, normZ) \ + CS_ACTOR_CUE(id, startFrame, endFrame, rotX, rotY, rotZ, startX, startY, startZ, endX, endY, endZ, normX, normY, normZ) /** + * Declares a list of `CS_START_SEQ` entries. + * * ARGS * s32 entries (e) * FORMAT * 0000012C eeeeeeee * size = 0x8 */ -#define CS_PLAYSEQ_LIST(entries) { CS_CMD_PLAYSEQ }, { CMD_W(entries) } +#define CS_START_SEQ_LIST(entries) \ + { CS_CMD_START_SEQ }, { CMD_W(entries) } /** + * Starts a sequence at the specified time. + * @note `endFrame` is not used in the implementation of the command, so its value does not matter + * * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 seqId (i), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 - */ -#define CS_PLAYSEQ(sequence, startFrame, endFrame) \ - { CMD_HH(sequence, startFrame) }, { CMD_HH(endFrame, endFrame) } - - -/** - * ARGS - * s32 entries (e) - * FORMAT - * 00000130 eeeeeeee + * iiiissss eeeeUUUU * size = 0x8 */ -#define CS_SCENE_UNK_130_LIST(entries) { CS_CMD_130 }, { CMD_W(entries) } - -/** - * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) - * FORMAT - * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x30 - */ -#define CS_SCENE_UNK_130(base, startFrame, endFrame, unk_06) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, unk_06) } - - -/** - * ARGS - * s32 entries (e) - * FORMAT - * 00000131 eeeeeeee - * size = 0x8 - */ -#define CS_SCENE_UNK_131_LIST(entries) { CS_CMD_131 }, { CMD_W(entries) } - -/** - * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) - * FORMAT - * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 - */ -#define CS_SCENE_UNK_131(base, startFrame, endFrame, unk_06) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, unk_06) } - - -/** - * ARGS - * s32 entries (e) - * FORMAT - * 00000132 eeeeeeee - * size = 0x8 - */ -#define CS_SCENE_UNK_132_LIST(entries) { CS_CMD_132 }, { CMD_W(entries) } - -/** - * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) - * FORMAT - * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 - */ -#define CS_SCENE_UNK_132(base, startFrame, endFrame) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, endFrame) } +#define CS_START_SEQ(seqId, startFrame, endFrame) \ + { CMD_HH((seqId + 1), startFrame) }, { CMD_HH(endFrame, endFrame) } /** + * Declares a list of `CS_STOP_SEQ` entries. + * * ARGS * s32 entries (e) * FORMAT * 00000133 eeeeeeee * size = 0x8 */ -#define CS_STOPSEQ_LIST(entries) { CS_CMD_STOPSEQ }, { CMD_W(entries) } +#define CS_STOP_SEQ_LIST(entries) { CS_CMD_STOP_SEQ }, { CMD_W(entries) } /** + * Stops a sequence at the specified time. + * * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 seqId (i), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * iiiissss eeeeUUUU + * size = 0x8 */ -#define CS_STOPSEQ(base, startFrame, endFrame, unk_06) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, unk_06) } +#define CS_STOP_SEQ(seqId, startFrame, endFrame, unk_06) \ + { CMD_HH((seqId + 1), startFrame) }, { CMD_HH(endFrame, unk_06) } + + +/** + * Stops a sequence at the specified time. + * @note `endFrame` is not used in the implementation of the command, so its value does not matter + * + * ARGS + * s32 entries (e) + * FORMAT + * 0000009C eeeeeeee + * size = 0x8 + */ +#define CS_FADE_OUT_SEQ_LIST(entries) { CS_CMD_FADE_OUT_SEQ }, { CMD_W(entries) } + +/** + * Fade out the sequence that is playing on the specified sequence player, over the specified frame range. + * @see `CutsceneFadeOutSeqPlayer` + * + * ARGS + * s16 seqPlayer (p), s16 startFrame (s), s16 endFrame (e) + * FORMAT + * Capital U is Unused + * ppppssss eeeeUUUU UUUUUUUU + * size = 0x0C + */ +#define CS_FADE_OUT_SEQ(seqPlayer, startFrame, endFrame) \ + { CMD_HH(seqPlayer, startFrame) }, { CMD_HH(endFrame, 0) }, { CMD_W(0) } /** @@ -454,18 +474,18 @@ * 00000134 eeeeeeee * size = 0x8 */ -#define CS_PLAYAMBIENCE_LIST(entries) { CS_CMD_PLAYAMBIENCE }, { CMD_W(entries) } +#define CS_START_AMBIENCE_LIST(entries) { CS_CMD_START_AMBIENCE }, { CMD_W(entries) } /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * UUUUssss eeeeUUUU + * size = 0x8 */ -#define CS_PLAYAMBIENCE(base, startFrame, endFrame, unk_06) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, unk_06) } +#define CS_START_AMBIENCE(unused0, startFrame, endFrame) \ + { CMD_HH(unused0, startFrame) }, { CMD_HH(endFrame, 0) } /** @@ -475,39 +495,106 @@ * 00000135 eeeeeeee * size = 0x8 */ -#define CS_FADEAMBIENCE_LIST(entries) { CS_CMD_FADEAMBIENCE }, { CMD_W(entries) } +#define CS_FADE_OUT_AMBIENCE_LIST(entries) { CS_CMD_FADE_OUT_AMBIENCE }, { CMD_W(entries) } /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * UUUUssss eeeeUUUU + * size = 0x8 */ -#define CS_FADEAMBIENCE(base, startFrame, endFrame, unk_06) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, unk_06) } +#define CS_FADE_OUT_AMBIENCE(unused0, startFrame, endFrame) \ + { CMD_HH(unused0, startFrame) }, { CMD_HH(endFrame, 0) } /** * ARGS * s32 entries (e) * FORMAT - * 0000015E eeeeeeee + * 00000132 eeeeeeee * size = 0x8 */ -#define CS_TERMINATOR_LIST(entries) { CS_CMD_TERMINATOR }, { CMD_W(entries) } +#define CS_MODIFY_SEQ_LIST(entries) { CS_CMD_MODIFY_SEQ }, { CMD_W(entries) } /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 type (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_TERMINATOR(base, startFrame, endFrame) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, endFrame) } +#define CS_MODIFY_SEQ(type, startFrame, endFrame) \ + { CMD_HH(type, startFrame) }, { CMD_HH(endFrame, endFrame) } + + +/** + * ARGS + * s32 entries (e) + * FORMAT + * 00000130 eeeeeeee + * size = 0x8 + */ +#define CS_SFX_REVERB_INDEX_2_LIST(entries) { CS_CMD_SFX_REVERB_INDEX_2 }, { CMD_W(entries) } + +/** + * ARGS + * s16 startFrame (s), s16 endFrame (e) + * FORMAT + * Capital U is Unused + * UUUUssss eeeeUUUU + * size = 0x30 + */ +#define CS_SFX_REVERB_INDEX_2(unused0, startFrame, endFrame) \ + { CMD_HH(unused0, startFrame) }, { CMD_HH(endFrame, 0) } + + +/** + * ARGS + * s32 entries (e) + * FORMAT + * 00000131 eeeeeeee + * size = 0x8 + */ +#define CS_SFX_REVERB_INDEX_1_LIST(entries) { CS_CMD_SFX_REVERB_INDEX_1 }, { CMD_W(entries) } + +/** + * ARGS + * s16 startFrame (s), s16 endFrame (e) + * FORMAT + * Capital U is Unused + * UUUUssss eeeeUUUU + * size = 0x8 + */ +#define CS_SFX_REVERB_INDEX_1(unused0, startFrame, endFrame) \ + { CMD_HH(unused0, startFrame) }, { CMD_HH(endFrame, 0) } + + +/** + * Declares a list of `CS_DESTINATION` entries. + * + * ARGS + * s32 entries (e) + * FORMAT + * 0000015E eeeeeeee + * size = 0x8 + */ +#define CS_DESTINATION_LIST(entries) { CS_CMD_DESTINATION }, { CMD_W(entries) } + +/** + * Sends the player to a new destination using the entry defined in `CutsceneScriptEntry`. + * + * ARGS + * s16 type (t), s16 startFrame (s), s16 endFrame (e) + * FORMAT + * Capital U is Unused + * ttttssss eeeeUUUU + * size = 0x8 + */ +#define CS_DESTINATION(type, startFrame, endFrame) \ + { CMD_HH(type, startFrame) }, { CMD_HH(endFrame, endFrame) } /** @@ -521,14 +608,14 @@ /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 type (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_CHOOSE_CREDITS_SCENES(base, startFrame, endFrame) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, endFrame) } +#define CS_CHOOSE_CREDITS_SCENES(type, startFrame, endFrame) \ + { CMD_HH(type, startFrame) }, { CMD_HH(endFrame, endFrame) } /** @@ -542,14 +629,14 @@ /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 type (t), s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * ttttssss eeeeUUUU + * size = 0x8 */ -#define CS_RUMBLE(base, startFrame, endFrame, intensity, decayTimer, decayStep) \ - { CMD_HH(base, startFrame) }, { CMD_HBB(endFrame, intensity, decayTimer) }, { CMD_BBBB(decayStep, 0, 0, 0) } +#define CS_RUMBLE(type, startFrame, endFrame, intensity, decayTimer, decayStep) \ + { CMD_HH(type, startFrame) }, { CMD_HBB(endFrame, intensity, decayTimer) }, { CMD_BBBB(decayStep, 0, 0, 0) } /** @@ -563,14 +650,14 @@ /** * ARGS - * s16 base (m), s16 startFrame (s), s16 endFrame (e) + * s16 startFrame (s), s16 endFrame (e) * FORMAT * Capital U is Unused - * mmmmssss eeeeUUUU - * size = 0x08 + * UUUUssss eeeeUUUU + * size = 0x8 */ -#define CS_UNK_DATA(base, startFrame, endFrame, unk_06) \ - { CMD_HH(base, startFrame) }, { CMD_HH(endFrame, unk_06) } +#define CS_UNK_DATA(unused0, startFrame, endFrame, unk_06) \ + { CMD_HH(unused0, startFrame) }, { CMD_HH(endFrame, unk_06) } /** @@ -578,4 +665,47 @@ */ #define CS_END() { CMD_W(0xFFFFFFFF) } +// TODO: Fix ZAPD and delete these +#define CS_ACTOR_ACTION_LIST CS_ACTOR_CUE_LIST +#define CS_ACTOR_ACTION CS_ACTOR_CUE +#define CS_PLAYER_ACTION_LIST CS_PLAYER_CUE_LIST +#define CS_PLAYER_ACTION CS_PLAYER_CUE +#define CS_LIGHTING_LIST CS_LIGHT_SETTING_LIST +#define CS_CAMERA_LIST CS_CAM_SPLINE_LIST +#define CS_TEXT_DISPLAY_TEXTBOX CS_TEXT +#define CS_TEXT_LEARN_SONG CS_TEXT_OCARINA_ACTION +#define CS_SCENE_TRANS_FX_LIST CS_TRANSITION_LIST +#define CS_SCENE_TRANS_FX CS_TRANSITION +#define CS_GIVETATL_LIST CS_GIVE_TATL_LIST +#define CS_GIVETATL CS_GIVE_TATL +#define CS_PLAYSEQ_LIST CS_START_SEQ_LIST +#define CS_STOPSEQ_LIST CS_STOP_SEQ_LIST +#define CS_FADESEQ_LIST CS_FADE_OUT_SEQ_LIST +#define CS_FADESEQ CS_FADE_OUT_SEQ +#define CS_PLAYAMBIENCE_LIST CS_START_AMBIENCE_LIST +#define CS_PLAYAMBIENCE CS_START_AMBIENCE +#define CS_FADEAMBIENCE_LIST CS_FADE_OUT_AMBIENCE_LIST +#define CS_FADEAMBIENCE CS_FADE_OUT_AMBIENCE +#define CS_SCENE_UNK_130_LIST CS_SFX_REVERB_INDEX_2_LIST +#define CS_SCENE_UNK_130 CS_SFX_REVERB_INDEX_2 +#define CS_SCENE_UNK_131_LIST CS_SFX_REVERB_INDEX_1_LIST +#define CS_SCENE_UNK_131 CS_SFX_REVERB_INDEX_1 +#define CS_SCENE_UNK_132_LIST CS_MODIFY_SEQ_LIST +#define CS_SCENE_UNK_132 CS_MODIFY_SEQ +#define CS_MOTIONBLUR_LIST CS_MOTION_BLUR_LIST +#define CS_MOTIONBLUR CS_MOTION_BLUR +#define CS_FADESCREEN_LIST CS_TRANSITION_GENERAL_LIST +#define CS_FADESCREEN CS_TRANSITION_GENERAL +#define CS_TERMINATOR_LIST CS_DESTINATION_LIST +#define CS_TERMINATOR CS_DESTINATION + +#define CS_PLAYSEQ(seqId, startFrame, endFrame) \ +CS_START_SEQ((seqId)-1, startFrame, endFrame) + +#define CS_STOPSEQ(seqId, startFrame, endFrame, unk_06) \ +CS_STOP_SEQ((seqId)-1, startFrame, endFrame, unk_06) + +#define CS_LIGHTING(lightSetting, startFrame, endFrame) \ +CS_LIGHT_SETTING((lightSetting)-1, startFrame, endFrame) + #endif diff --git a/include/z64player.h b/include/z64player.h index 27a586555..54894893f 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -535,8 +535,8 @@ typedef enum PlayerCsMode { /* 0x03 */ PLAYER_CSMODE_3, /* 0x04 */ PLAYER_CSMODE_4, /* 0x05 */ PLAYER_CSMODE_5, - /* 0x06 */ PLAYER_CSMODE_6, - /* 0x07 */ PLAYER_CSMODE_7, + /* 0x06 */ PLAYER_CSMODE_END, + /* 0x07 */ PLAYER_CSMODE_WAIT, /* 0x08 */ PLAYER_CSMODE_8, /* 0x09 */ PLAYER_CSMODE_9, /* 0x0A */ PLAYER_CSMODE_10, @@ -1018,7 +1018,7 @@ typedef struct Player { /* 0xA7C */ Actor* boomerangActor; /* 0xA80 */ Actor* tatlActor; /* 0xA84 */ s16 tatlTextId; - /* 0xA86 */ s8 unk_A86; // actorCutsceneIndex? + /* 0xA86 */ s8 csId; /* 0xA87 */ s8 exchangeItemId; // PlayerItemAction enum /* 0xA88 */ Actor* talkActor; /* 0xA8C */ f32 talkActorDistance; diff --git a/include/z64save.h b/include/z64save.h index 362a16e92..1f59fea01 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -299,7 +299,7 @@ typedef struct Save { /* 0x05 */ u8 isFirstCycle; // "opening_flag" /* 0x06 */ u8 unk_06; /* 0x07 */ u8 linkAge; // "link_age" - /* 0x08 */ s32 cutscene; // "day_time" + /* 0x08 */ s32 cutsceneIndex; // "day_time" /* 0x0C */ u16 time; // "zelda_time" /* 0x0E */ u16 owlSaveLocation; /* 0x10 */ s32 isNight; // "asahiru_fg" @@ -707,7 +707,7 @@ typedef enum { #define WEEKEVENTREG_20_01 PACK_WEEKEVENTREG_FLAG(20, 0x01) // woodfall temple purification cutscene watched -#define WEEKEVENTREG_20_02 PACK_WEEKEVENTREG_FLAG(20, 0x02) +#define WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE PACK_WEEKEVENTREG_FLAG(20, 0x02) #define WEEKEVENTREG_20_04 PACK_WEEKEVENTREG_FLAG(20, 0x04) #define WEEKEVENTREG_20_08 PACK_WEEKEVENTREG_FLAG(20, 0x08) @@ -851,7 +851,7 @@ typedef enum { #define WEEKEVENTREG_33_40 PACK_WEEKEVENTREG_FLAG(33, 0x40) // Mountain village is unfrozen -#define WEEKEVENTREG_33_80 PACK_WEEKEVENTREG_FLAG(33, 0x80) +#define WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE PACK_WEEKEVENTREG_FLAG(33, 0x80) // Spoken to MINIFROG_YELLOW #define WEEKEVENTREG_34_01 PACK_WEEKEVENTREG_FLAG(34, 0x01) @@ -1015,7 +1015,7 @@ typedef enum { #define WEEKEVENTREG_52_10 PACK_WEEKEVENTREG_FLAG(52, 0x10) // cleared Stone Tower Temple -#define WEEKEVENTREG_52_20 PACK_WEEKEVENTREG_FLAG(52, 0x20) +#define WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE PACK_WEEKEVENTREG_FLAG(52, 0x20) #define WEEKEVENTREG_52_40 PACK_WEEKEVENTREG_FLAG(52, 0x40) #define WEEKEVENTREG_52_80 PACK_WEEKEVENTREG_FLAG(52, 0x80) @@ -1047,7 +1047,7 @@ typedef enum { #define WEEKEVENTREG_55_40 PACK_WEEKEVENTREG_FLAG(55, 0x40) // Gyorg has been defeated -#define WEEKEVENTREG_55_80 PACK_WEEKEVENTREG_FLAG(55, 0x80) +#define WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE PACK_WEEKEVENTREG_FLAG(55, 0x80) #define WEEKEVENTREG_56_01 PACK_WEEKEVENTREG_FLAG(56, 0x01) #define WEEKEVENTREG_56_02 PACK_WEEKEVENTREG_FLAG(56, 0x02) @@ -1576,7 +1576,7 @@ void Sram_IncrementDay(void); u16 Sram_CalcChecksum(void* data, size_t count); void Sram_InitNewSave(void); void Sram_InitDebugSave(void); -void func_80144A94(SramContext* sramCtx); +void Sram_ResetSaveFromMoonCrash(SramContext* sramCtx); void Sram_OpenSave(struct FileSelectState* fileSelect, SramContext* sramCtx); void func_8014546C(SramContext* sramCtx); void func_801457CC(struct FileSelectState* fileSelect, SramContext* sramCtx); diff --git a/include/z64scene.h b/include/z64scene.h index 84b405b90..c31b7ce58 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -177,9 +177,9 @@ typedef struct { typedef struct { /* 0x0 */ u8 code; - /* 0x1 */ u8 sceneCsCount; + /* 0x1 */ u8 scriptListCount; /* 0x4 */ void* segment; -} SCmdCutsceneList; // size = 0x8 +} SCmdCsScriptList; // size = 0x8 typedef struct { /* 0x0 */ u8 code; @@ -202,7 +202,7 @@ typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 num; /* 0x4 */ void* segment; -} SCmdCutsceneActorList; // size = 0x8 +} SCmdCutsceneList; // size = 0x8 typedef struct { /* 0x0 */ u8 code; @@ -531,11 +531,11 @@ typedef union { /* Command: 0x14 */ SCmdEndMarker endMarker; /* Command: 0x15 */ SCmdSoundSettings soundSettings; /* Command: 0x16 */ SCmdEchoSettings echoSettings; - /* Command: 0x17 */ SCmdCutsceneList cutsceneList; + /* Command: 0x17 */ SCmdCsScriptList scriptList; /* Command: 0x18 */ SCmdAltHeaders altHeaders; /* Command: 0x19 */ SCmdRegionVisited regionVisited; /* Command: 0x1A */ SCmdTextureAnimations textureAnimations; - /* Command: 0x1B */ SCmdCutsceneActorList cutsceneActorList; + /* Command: 0x1B */ SCmdCutsceneList cutsceneList; /* Command: 0x1C */ SCmdMinimapSettings minimapSettings; /* Command: 0x1D */ // Unused /* Command: 0x1E */ SCmdMinimapChests minimapChests; @@ -822,6 +822,15 @@ typedef enum { */ #define ENTRANCE(scene, spawn) ((((ENTR_SCENE_##scene) & 0x7F) << 9) | (((spawn) & 0x1F) << 4)) +/* +* Entrances used in cutscene destination. Includes scene layer that's immediately applied to `nextCutsceneIndex` and removed. +* See `CutsceneScriptEntry.nextEntrance` +* 0xFE00: Index into sSceneEntranceTable (Scene) +* 0x01F0: Index into the scenes specific entrance table (Spawn) +* 0x000F: Index into the specific entrance table (Layer) +*/ +#define CS_ENTRANCE(scene, spawn, layer) ((((ENTR_SCENE_##scene) & 0x7F) << 9) | (((spawn) & 0x1F) << 4) | ((layer) & 0xF)) + // SceneTableEntry draw configs typedef enum { /* 0 */ SCENE_DRAW_CFG_DEFAULT, @@ -867,7 +876,7 @@ typedef enum { /* 0x14 */ SCENE_CMD_ID_END, /* 0x15 */ SCENE_CMD_ID_SOUND_SETTINGS, /* 0x16 */ SCENE_CMD_ID_ECHO_SETTINGS, - /* 0x17 */ SCENE_CMD_ID_CUTSCENE_LIST, + /* 0x17 */ SCENE_CMD_ID_CUTSCENE_SCRIPT_LIST, /* 0x18 */ SCENE_CMD_ID_ALTERNATE_HEADER_LIST, /* 0x19 */ SCENE_CMD_ID_SET_REGION_VISITED, /* 0x1A */ SCENE_CMD_ID_ANIMATED_MATERIAL_LIST, @@ -952,21 +961,20 @@ typedef enum { #define SCENE_CMD_ECHO_SETTINGS(echo) \ { SCENE_CMD_ID_ECHO_SETTINGS, 0, CMD_BBBB(0, 0, 0, echo) } -#define SCENE_CMD_CUTSCENE_LIST(numCutscene, cutsceneList) \ - { SCENE_CMD_ID_CUTSCENE_LIST, numCutscene, CMD_PTR(cutsceneList) } +#define SCENE_CMD_CUTSCENE_SCRIPT_LIST(numEntries, scriptList) \ + { SCENE_CMD_ID_CUTSCENE_SCRIPT_LIST, numEntries, CMD_PTR(scriptList) } #define SCENE_CMD_ALTERNATE_HEADER_LIST(alternateHeaderList) \ { SCENE_CMD_ID_ALTERNATE_HEADER_LIST, 0, CMD_PTR(alternateHeaderList) } -#define SCENE_CMD_MISC_SETTINGS SCENE_CMD_SET_REGION_VISITED // TODO: ZAPD Capatability #define SCENE_CMD_SET_REGION_VISITED() \ { SCENE_CMD_ID_SET_REGION_VISITED, 0, CMD_W(0) } #define SCENE_CMD_ANIMATED_MATERIAL_LIST(matAnimList) \ { SCENE_CMD_ID_ANIMATED_MATERIAL_LIST, 0, CMD_PTR(matAnimList) } -#define SCENE_CMD_ACTOR_CUTSCENE_LIST(actorCutsceneCount, actorCutsceneList) \ - { SCENE_CMD_ID_ACTOR_CUTSCENE_LIST, actorCutsceneCount, CMD_PTR(actorCutsceneList) } +#define SCENE_CMD_ACTOR_CUTSCENE_LIST(numEntries, actorCutsceneList) \ + { SCENE_CMD_ID_ACTOR_CUTSCENE_LIST, numEntries, CMD_PTR(actorCutsceneList) } #define SCENE_CMD_MINIMAP_INFO(minimapInfo) \ { SCENE_CMD_ID_MINIMAP_INFO, 0, CMD_PTR(minimapInfo) } @@ -974,4 +982,8 @@ typedef enum { #define SCENE_CMD_MINIMAP_COMPASS_ICON_INFO(compassIconCount, compassIconInfo) \ { SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO, compassIconCount, CMD_PTR(compassIconInfo) } + // TODO: ZAPD Capatability +#define SCENE_CMD_MISC_SETTINGS SCENE_CMD_SET_REGION_VISITED +#define SCENE_CMD_CUTSCENE_LIST SCENE_CMD_CUTSCENE_SCRIPT_LIST + #endif diff --git a/include/z64subs.h b/include/z64subs.h index cc0e7ba2f..ad2b7044f 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -11,9 +11,9 @@ extern Vec3f gOneVec3f; #define SUBS_TIME_PATHING_ORDER 3 typedef enum { - /* 0 */ SUBS_CUTSCENE_SET_UNK_LINK_FIELDS, + /* 0 */ SUBS_CUTSCENE_WITH_PLAYER, /* 1 */ SUBS_CUTSCENE_NORMAL, - /* 2 */ SUBS_CUTSCENE_SET_FLAG + /* 2 */ SUBS_CUTSCENE_WITH_PLAYER_SET_FLAG } SubSCutsceneType; //! TODO: rename based on func_8013E748 and func_800B8500 @@ -153,8 +153,8 @@ s32 SubS_ActorPathing_SetNextPoint(struct PlayState* play, ActorPathing* actorPa void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animationInfo, s32 nextAnimIndex, s32* curAnimIndex); -s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type); -s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes); +s32 SubS_StartCutscene(Actor* actor, s16 nextCsId, s16 curCsId, s32 type); +s32 SubS_FillCutscenesList(Actor* actor, s16 csIdList[], s16 numCutscenes); void SubS_ConstructPlane(Vec3f* point, Vec3f* unitVec, Vec3s* rot, Plane* plane); s32 SubS_LineSegVsPlane(Vec3f* point, Vec3s* rot, Vec3f* unitVec, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersect); diff --git a/spec b/spec index 417609b6f..481fd099d 100644 --- a/spec +++ b/spec @@ -470,7 +470,6 @@ beginseg include "build/data/code/z_eventmgr.bss.o" include "build/src/code/z_fcurve_data.o" include "build/src/code/z_fcurve_data_skelanime.o" - include "build/data/code/code_801BD830.data.o" include "build/src/code/z_fireobj.o" include "build/src/code/z_game_dlftbls.o" include "build/src/code/z_horse.o" @@ -539,8 +538,8 @@ beginseg include "build/src/code/z_message_staff.o" include "build/src/code/z_player_call.o" include "build/src/code/z_shrink_window.o" - include "build/src/code/db_camera.o" - include "build/data/code/db_camera.bss.o" + include "build/src/code/cutscene_camera.o" + include "build/data/code/cutscene_camera.bss.o" include "build/src/code/z_kaleido_manager.o" include "build/src/code/z_kaleido_scope_call.o" include "build/src/code/z_fbdemo_dlftbls.o" diff --git a/src/audio/code_8019AF00.c b/src/audio/code_8019AF00.c index 5af712e99..d107e65b7 100644 --- a/src/audio/code_8019AF00.c +++ b/src/audio/code_8019AF00.c @@ -3357,7 +3357,7 @@ void AudioOcarina_Update(void) { #define OCARINA_INSTRUMENT_OOT_MAX 7 -void AudioOcarina_PlayLongScarecrowAfterCredits(void) { +void AudioOcarina_PlayLongScarecrowSong(void) { static u8 sScarecrowAfterCreditsState = 0; static u8 sScarecrowAfterCreditsIntrumentId = OCARINA_INSTRUMENT_DEFAULT; static u16 sScarecrowAfterCreditsTimer = 1200; diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index 2b8a88728..6c63e2a70 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "stack.h" #include "buffers.h" diff --git a/src/boot_O2_g3/yaz0.c b/src/boot_O2_g3/yaz0.c index aa7ecdfe1..3517b97ae 100644 --- a/src/boot_O2_g3/yaz0.c +++ b/src/boot_O2_g3/yaz0.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" u8 sYaz0DataBuffer[0x400]; diff --git a/src/code/cutscene_camera.c b/src/code/cutscene_camera.c new file mode 100644 index 000000000..d5f028b94 --- /dev/null +++ b/src/code/cutscene_camera.c @@ -0,0 +1,380 @@ +#include "global.h" + +extern CutsceneCamera* sCurCsCamera; + +typedef s16 (*CsCamInterpolateCallback)(Vec3f*, f32*, s16*, CsCmdCamPoint*, CsCmdCamMisc*, CutsceneCameraInterp*); + +// function declarations +s16 func_80161180(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_8016237C(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_8016253C(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_80162A50(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_801623E4(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_80161C20(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_80161E4C(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_801620CC(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +s16 func_80163334(Vec3f* pos, f32* fov, s16* roll, CsCmdCamPoint* point, CsCmdCamMisc* misc, + CutsceneCameraInterp* interp); +f32 func_80163660(Actor* actor); + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80161180.s") + +/** + * Initializes Cutscene Camera Info + */ +s32 CutsceneCamera_Init(Camera* camera, CutsceneCamera* csCamera) { + csCamera->camera = camera; + + csCamera->nextSplineTimer = csCamera->updateSplineTimer = 0; + csCamera->cmdIndex = 0; + csCamera->splineIndex = 0xFFFF; + csCamera->splineNeedsInit = true; + csCamera->state = CS_CAM_STATE_UPDATE_ALL; + + sCurCsCamera = csCamera; + + __osMemset(&csCamera->eyeInterp, 0, sizeof(CutsceneCameraInterp)); + __osMemset(&csCamera->atInterp, 0, sizeof(CutsceneCameraInterp)); + + csCamera->eyeInterp.unk_2D = csCamera->atInterp.unk_2D = 7; + + return 1; +} + +CsCamInterpolateCallback CutsceneCamera_Interpolate(u8 interpType) { + switch (interpType) { + case CS_CAM_INTERP_7: + default: + return func_80161180; + + case CS_CAM_INTERP_0: + return func_8016237C; + + case CS_CAM_INTERP_5: + return func_8016253C; + + case CS_CAM_INTERP_4: + return func_80162A50; + + case CS_CAM_INTERP_1: + return func_801623E4; + + case CS_CAM_INTERP_2: + return func_80161C20; + + case CS_CAM_INTERP_3: + return func_80161E4C; + + case CS_CAM_INTERP_6: + return func_801620CC; + } +} + +u8 CutsceneCamera_ProcessSpline(CutsceneCamera* csCamera) { + s32 sp5C; + f32* fov; + s16* roll; + CsCamInterpolateCallback interpHandler; + Player* player; + Actor* target; + s16 numPoints; + + sp5C = true; + if (csCamera->state == CS_CAM_STATE_DONE_SPLINE) { + return false; + } + + player = GET_PLAYER(csCamera->camera->play); + target = csCamera->camera->target; + + if (csCamera->eyeCmd[csCamera->atInterp.curPoint].interpType < + csCamera->atCmd[csCamera->eyeInterp.curPoint].interpType) { + sp5C = false; + } + + csCamera->eyeInterp.unk_00 = csCamera->camera->eye; + csCamera->atInterp.unk_00 = csCamera->camera->at; + + if (sp5C) { + fov = NULL; + } else { + fov = &csCamera->camera->fov; + } + + if (sp5C) { + roll = NULL; + } else { + roll = &csCamera->camera->roll; + } + + interpHandler = CutsceneCamera_Interpolate(csCamera->atCmd[csCamera->eyeInterp.curPoint].interpType); + + switch (csCamera->atCmd[csCamera->eyeInterp.curPoint].relativeTo) { + case CS_CAM_REL_2: + OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 2); + break; + + case CS_CAM_REL_3: + OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + break; + + case CS_CAM_REL_1: + OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + break; + + case CS_CAM_REL_4: + OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, 1); + break; + + case CS_CAM_REL_5: + OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, 2); + break; + + default: // CS_CAM_REL_0 + break; + } + + numPoints = interpHandler(&csCamera->camera->at, fov, roll, &csCamera->atCmd[csCamera->eyeInterp.curPoint], + &csCamera->miscCmd[csCamera->eyeInterp.curPoint], &csCamera->eyeInterp); + + switch (csCamera->atCmd[csCamera->eyeInterp.curPoint].relativeTo) { + case CS_CAM_REL_2: + OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 2); + break; + + case CS_CAM_REL_3: + OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + csCamera->camera->at.y += func_80163660(&player->actor); + break; + + case CS_CAM_REL_1: + OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + break; + + case CS_CAM_REL_4: + OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->at, &csCamera->camera->at, 1); + break; + + case CS_CAM_REL_5: + OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->at, &csCamera->camera->at, 2); + break; + + default: // CS_CAM_REL_0 + break; + } + + csCamera->eyeInterp.curPoint += numPoints; + + if (sp5C) { + fov = &csCamera->camera->fov; + } else { + fov = NULL; + } + + if (sp5C) { + roll = &csCamera->camera->roll; + } else { + roll = NULL; + } + + interpHandler = CutsceneCamera_Interpolate(csCamera->eyeCmd[csCamera->atInterp.curPoint].interpType); + + switch (csCamera->eyeCmd[csCamera->atInterp.curPoint].relativeTo) { + case CS_CAM_REL_2: + OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + break; + + case CS_CAM_REL_3: + OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + break; + + case CS_CAM_REL_1: + OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + break; + + case CS_CAM_REL_4: + OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + break; + + case CS_CAM_REL_5: + OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + break; + + default: // CS_CAM_REL_0 + break; + } + + numPoints = interpHandler(&csCamera->camera->eye, fov, roll, &csCamera->eyeCmd[csCamera->atInterp.curPoint], + &csCamera->miscCmd[csCamera->atInterp.curPoint], &csCamera->atInterp); + + switch (csCamera->eyeCmd[csCamera->atInterp.curPoint].relativeTo) { + case CS_CAM_REL_2: + OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + break; + + case CS_CAM_REL_3: + OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + csCamera->camera->eye.y += func_80163660(&player->actor); + break; + + case CS_CAM_REL_1: + OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + break; + + case CS_CAM_REL_4: + OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + break; + + case CS_CAM_REL_5: + OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + break; + + default: // CS_CAM_REL_0 + break; + } + + csCamera->atInterp.curPoint += numPoints; + + if ((csCamera->eyeInterp.curPoint >= csCamera->eyeInterp.numEntries) || + (csCamera->atInterp.curPoint >= csCamera->atInterp.numEntries)) { + return false; + } + + return true; +} + +/** + * Processes camera cutscene commands + */ +s32 CutsceneCamera_UpdateSplines(u8* script, CutsceneCamera* csCamera) { + CsCmdCamSpline* spline; + + switch (csCamera->state) { + case CS_CAM_STATE_DONE: + return 0; + + case CS_CAM_STATE_PAUSE: + return csCamera->nextSplineTimer; + + case CS_CAM_STATE_UPDATE_SPLINE: + if (csCamera->updateSplineTimer <= csCamera->duration) { + csCamera->updateSplineTimer++; + if (csCamera->updateSplineTimer <= csCamera->duration) { + // Process Spline + if (!CutsceneCamera_ProcessSpline(csCamera)) { + csCamera->state = CS_CAM_STATE_DONE_SPLINE; + } + } + } + break; + + case CS_CAM_STATE_DONE_SPLINE: + break; + + default: // CS_CAM_STATE_UPDATE_ALL + if (csCamera->splineNeedsInit == true) { + // Spline Header + spline = (CsCmdCamSpline*)&script[csCamera->cmdIndex]; + csCamera->atInterp.numEntries = csCamera->eyeInterp.numEntries = spline->numEntries; + csCamera->duration = spline->duration; + csCamera->cmdIndex += sizeof(CsCmdCamSpline); + + // At Point + csCamera->atCmd = (CsCmdCamPoint*)&script[csCamera->cmdIndex]; + csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamPoint)); + + // Misc Point + csCamera->eyeCmd = (CsCmdCamPoint*)&script[csCamera->cmdIndex]; + csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamPoint)); + + // Misc + csCamera->miscCmd = (CsCmdCamMisc*)&script[csCamera->cmdIndex]; + csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamMisc)); + + // Other Params + csCamera->eyeInterp.curPoint = 0; + csCamera->atInterp.curPoint = 0; + + csCamera->splineNeedsInit = false; + //! FAKE: csCamera->splineIndex++; + csCamera->splineIndex = (csCamera->splineIndex & 0xFFFF) + 1; + csCamera->state = CS_CAM_STATE_UPDATE_ALL; + csCamera->nextSplineTimer = csCamera->updateSplineTimer = 0; + csCamera->eyeInterp.unk_2D = csCamera->atInterp.unk_2D = 7; + } + + csCamera->nextSplineTimer++; + + if (csCamera->updateSplineTimer <= csCamera->duration) { + csCamera->updateSplineTimer++; + if (csCamera->updateSplineTimer <= csCamera->duration) { + // Process SubCommands + if (!CutsceneCamera_ProcessSpline(csCamera)) { + csCamera->state = CS_CAM_STATE_DONE_SPLINE; + } + } + } + break; + } + + if (csCamera->nextSplineTimer > csCamera->duration) { + // Next Spline + csCamera->splineNeedsInit = true; + spline = (CsCmdCamSpline*)&script[csCamera->cmdIndex]; + if (spline->numEntries == -1) { + csCamera->state = CS_CAM_STATE_DONE; + return 0; + } + } + + return csCamera->nextSplineTimer; +} + +// Unused +s16 func_80161BAC(void) { + return (sCurCsCamera->state == CS_CAM_STATE_PAUSE) || (sCurCsCamera->state == CS_CAM_STATE_UPDATE_SPLINE); +} + +void CutsceneCamera_SetState(s16 state) { + if (sCurCsCamera->state == CS_CAM_STATE_UPDATE_ALL) { + sCurCsCamera->state = state; + } +} + +void CutsceneCamera_Reset(void) { + sCurCsCamera->state = CS_CAM_STATE_UPDATE_ALL; +} + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80161C20.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80161E4C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801620CC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_8016237C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801623E4.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801624EC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_8016253C.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801629BC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80162A50.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80162FF8.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_801631DC.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80163334.s") + +#pragma GLOBAL_ASM("asm/non_matchings/code/cutscene_camera/func_80163660.s") diff --git a/src/code/db_camera.c b/src/code/db_camera.c deleted file mode 100644 index 92b6d87f9..000000000 --- a/src/code/db_camera.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161180.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016119C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016122C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801612B8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161998.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161BAC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161BE0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161C0C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161C20.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80161E4C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801620CC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016237C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801623E4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801624EC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_8016253C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801629BC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80162A50.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80162FF8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_801631DC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80163334.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_80163660.s") diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 8e2f65965..84501dcbb 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1371,7 +1371,7 @@ void func_800B722C(GameState* gameState, Player* player) { s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode) { Player* player = GET_PLAYER(play); - if ((player->csMode == PLAYER_CSMODE_5) || ((csMode == PLAYER_CSMODE_6) && (player->csMode == PLAYER_CSMODE_0))) { + if ((player->csMode == PLAYER_CSMODE_5) || ((csMode == PLAYER_CSMODE_END) && (player->csMode == PLAYER_CSMODE_0))) { return false; } @@ -1880,7 +1880,7 @@ s32 func_800B8500(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, Player player->talkActorDistance = actor->xzDistToPlayer; player->exchangeItemId = exchangeItemId; - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); return true; } @@ -2048,7 +2048,7 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, GetItemId getItemId, f32 x player->getItemDirection = absYawDiff; if ((getItemId > GI_NONE) && (getItemId < GI_MAX)) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[1]); + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_ITEM_GET]); } return true; @@ -2123,7 +2123,7 @@ s32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) { PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000))) { player->rideActor = horse; player->mountSide = mountSide; - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); return true; } @@ -3126,8 +3126,8 @@ void Actor_FreeOverlay(ActorOverlay* entry) { Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params) { - return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, - HALFDAYBIT_ALL, NULL); + return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, + CS_ID_NONE, HALFDAYBIT_ALL, NULL); } ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) { @@ -3171,7 +3171,7 @@ ActorInit* Actor_LoadOverlay(ActorContext* actorCtx, s16 index) { } Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s16 index, f32 x, f32 y, f32 z, s16 rotX, - s16 rotY, s16 rotZ, s32 params, u32 cutscene, u32 halfDaysBits, Actor* parent) { + s16 rotY, s16 rotZ, s32 params, u32 csId, u32 halfDaysBits, Actor* parent) { s32 pad; Actor* actor; ActorInit* actorInit; @@ -3237,10 +3237,10 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 actor->home.rot.y = rotY; actor->home.rot.z = rotZ; actor->params = params & 0xFFFF; - actor->cutscene = (cutscene & 0x7F); + actor->csId = csId & 0x7F; - if (actor->cutscene == 0x7F) { - actor->cutscene = -1; + if (actor->csId == 0x7F) { + actor->csId = CS_ID_NONE; } if (halfDaysBits != 0) { @@ -3263,8 +3263,8 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s32 params) { - return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, -1, - parent->halfDaysBits, parent); + return Actor_SpawnAsChildAndCutscene(actorCtx, play, actorId, posX, posY, posZ, rotX, rotY, rotZ, params, + CS_ID_NONE, parent->halfDaysBits, parent); } void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { @@ -4404,7 +4404,7 @@ s16 func_800BDB6C(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { Player* player = GET_PLAYER(play); f32 phi_f2; - if ((play->csCtx.state != CS_STATE_0) || gDbgCamEnabled) { + if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; } else { phi_f2 = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index a8e9fbb80..3df77c0c4 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -3613,31 +3613,31 @@ CameraSetting sCameraSettings[] = { }; s16 sGlobalCamDataSettings[] = { - /* -25 */ CAM_SET_ELEGY_SHELL, - /* -24 */ CAM_SET_SIDED, - /* -23 */ CAM_SET_BOAT_CRUISE, - /* -22 */ CAM_SET_NONE, - /* -21 */ CAM_SET_SUBJECTD, - /* -20 */ CAM_SET_NORMALD, - /* -19 */ CAM_SET_NONE, - /* -18 */ CAM_SET_NONE, - /* -17 */ CAM_SET_NONE, - /* -16 */ CAM_SET_WARP_PAD_ENTRANCE, - /* -15 */ CAM_SET_ATTENTION, - /* -14 */ CAM_SET_CONNECT0, - /* -13 */ CAM_SET_REMOTEBOMB, - /* -12 */ CAM_SET_NONE, - /* -11 */ CAM_SET_MASK_TRANSFORMATION, - /* -10 */ CAM_SET_LONG_CHEST_OPENING, - /* -9 */ CAM_SET_REBIRTH, - /* -8 */ CAM_SET_DEATH, - /* -7 */ CAM_SET_WARP_PAD_MOON, - /* -6 */ CAM_SET_NAVI, - /* -5 */ CAM_SET_ITEM3, - /* -4 */ CAM_SET_ITEM2, - /* -3 */ CAM_SET_ITEM1, - /* -2 */ CAM_SET_ITEM0, - /* -1 */ CAM_SET_STOP0, + /* -25 */ CAM_SET_ELEGY_SHELL, // CS_CAM_ID_GLOBAL_ELEGY + /* -24 */ CAM_SET_SIDED, // CS_CAM_ID_GLOBAL_SIDED + /* -23 */ CAM_SET_BOAT_CRUISE, // CS_CAM_ID_GLOBAL_BOAT_CRUISE + /* -22 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N16 + /* -21 */ CAM_SET_SUBJECTD, // CS_CAM_ID_GLOBAL_SUBJECTD + /* -20 */ CAM_SET_NORMALD, // CS_CAM_ID_GLOBAL_NORMALD + /* -19 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N13 + /* -18 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N12 + /* -17 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N11 + /* -16 */ CAM_SET_WARP_PAD_ENTRANCE, // CS_CAM_ID_GLOBAL_WARP_PAD_ENTRANCE + /* -15 */ CAM_SET_ATTENTION, // CS_CAM_ID_GLOBAL_ATTENTION + /* -14 */ CAM_SET_CONNECT0, // CS_CAM_ID_GLOBAL_CONNECT + /* -13 */ CAM_SET_REMOTEBOMB, // CS_CAM_ID_GLOBAL_REMOTE_BOMB + /* -12 */ CAM_SET_NONE, // CS_CAM_ID_GLOBAL_N0C + /* -11 */ CAM_SET_MASK_TRANSFORMATION, // CS_CAM_ID_GLOBAL_MASK_TRANSFORMATION + /* -10 */ CAM_SET_LONG_CHEST_OPENING, // CS_CAM_ID_GLOBAL_LONG_CHEST_OPENING + /* -9 */ CAM_SET_REBIRTH, // CS_CAM_ID_GLOBAL_REVIVE + /* -8 */ CAM_SET_DEATH, // CS_CAM_ID_GLOBAL_DEATH + /* -7 */ CAM_SET_WARP_PAD_MOON, // CS_CAM_ID_GLOBAL_WARP_PAD_MOON + /* -6 */ CAM_SET_NAVI, // CS_CAM_ID_GLOBAL_SONG_WARP + /* -5 */ CAM_SET_ITEM3, // CS_CAM_ID_GLOBAL_ITEM_SHOW + /* -4 */ CAM_SET_ITEM2, // CS_CAM_ID_GLOBAL_ITEM_BOTTLE + /* -3 */ CAM_SET_ITEM1, // CS_CAM_ID_GLOBAL_ITEM_OCARINA + /* -2 */ CAM_SET_ITEM0, // CS_CAM_ID_GLOBAL_ITEM_GET + /* -1 */ CAM_SET_STOP0, // CS_CAM_ID_NONE /* 0 */ CAM_SET_NONE, }; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 6ecbd617a..20083f3c4 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" Vec3f D_801EDE00; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index dc32223a8..79270adce 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,171 +1,177 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "z64quake.h" #include "z64rumble.h" #include "z64shrink_window.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" -void Cutscene_DoNothing(PlayState* play, CutsceneContext* csCtx); -void func_800EA258(PlayState* play, CutsceneContext* csCtx); -void func_800ED9C4(PlayState* play, CutsceneContext* csCtx); -void func_800EA2B8(PlayState* play, CutsceneContext* csCtx); -void func_800ED980(PlayState* play, CutsceneContext* csCtx); -void func_800EDA04(PlayState* play, CutsceneContext* csCtx); -void func_800EDA84(PlayState* play, CutsceneContext* csCtx); +void CutsceneHandler_DoNothing(PlayState* play, CutsceneContext* csCtx); +void CutsceneHandler_StartManual(PlayState* play, CutsceneContext* csCtx); +void CutsceneHandler_StopManual(PlayState* play, CutsceneContext* csCtx); +void CutsceneHandler_StartScript(PlayState* play, CutsceneContext* csCtx); +void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx); +void CutsceneHandler_StopScript(PlayState* play, CutsceneContext* csCtx); +void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx); // Unused UNK_TYPE4 D_801BB120 = 0; -u16 D_801BB124 = 0; -u16 D_801BB128 = 0; -u8 D_801BB12C = 0; +u16 sCurTextId = 0; +u16 sCurOcarinaAction = 0; +u8 gOpeningEntranceIndex = 0; u8 sCutsceneStoredPlayerForm = 0; // bss #ifndef NON_MATCHING -static u16 seqId; +static u16 sSeqId; #endif s16 sCutsceneQuakeIndex; -DbCameraUnkStruct sCutsceneCameraInfo; -u16 D_801F4DC8[10]; +CutsceneCamera sCutsceneCameraInfo; +u16 sCueTypeList[10]; UNK_TYPE D_801F4DDC; -u8 D_801F4DE0; -s16 D_801F4DE2; +u8 gDisablePlayerCsModeStartPos; +s16 gDungeonBossWarpSceneId; -void Cutscene_Init(PlayState* play, CutsceneContext* csCtx) { +void Cutscene_InitContext(PlayState* play, CutsceneContext* csCtx) { s32 i; - csCtx->state = CS_STATE_0; - csCtx->frames = 0; - csCtx->unk_0C = 0.0f; - play->csCtx.sceneCsCount = 0; - play->csCtx.currentCsIndex = 0; + csCtx->state = CS_STATE_IDLE; + csCtx->curFrame = 0; + csCtx->timer = 0.0f; + play->csCtx.scriptListCount = 0; + play->csCtx.scriptIndex = 0; - for (i = 0; i < ARRAY_COUNT(D_801F4DC8); i++) { - D_801F4DC8[i] = 0; + for (i = 0; i < ARRAY_COUNT(sCueTypeList); i++) { + sCueTypeList[i] = 0; } - D_801F4DE0 = 0; + gDisablePlayerCsModeStartPos = 0; Audio_SetCutsceneFlag(false); } -void Cutscene_Start(PlayState* play, CutsceneContext* csCtx) { - csCtx->state = CS_STATE_1; - csCtx->playerAction = NULL; +void Cutscene_StartManual(PlayState* play, CutsceneContext* csCtx) { + csCtx->state = CS_STATE_START; + csCtx->playerCue = NULL; } -void Cutscene_End(PlayState* play, CutsceneContext* csCtx) { - if (csCtx->state != CS_STATE_4) { - csCtx->state = CS_STATE_3; +void Cutscene_StopManual(PlayState* play, CutsceneContext* csCtx) { + if (csCtx->state != CS_STATE_RUN_UNSTOPPABLE) { + csCtx->state = CS_STATE_STOP; } } -typedef void (*CutsceneStateHandler)(PlayState* play, CutsceneContext* csCtx); +typedef void (*CutsceneHandler)(PlayState* play, CutsceneContext* csCtx); -CutsceneStateHandler sCsStateHandlers1[] = { - Cutscene_DoNothing, // CS_STATE_0 - func_800EA258, // CS_STATE_1 - Cutscene_DoNothing, // CS_STATE_2 - func_800ED9C4, // CS_STATE_3 - Cutscene_DoNothing, // CS_STATE_4 +CutsceneHandler sManualCutsceneHandlers[] = { + CutsceneHandler_DoNothing, // CS_STATE_IDLE + CutsceneHandler_StartManual, // CS_STATE_START + CutsceneHandler_DoNothing, // CS_STATE_RUN + CutsceneHandler_StopManual, // CS_STATE_STOP + CutsceneHandler_DoNothing, // CS_STATE_RUN_UNSTOPPABLE }; -void Cutscene_Update1(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutscene < 0xFFF0) { - sCsStateHandlers1[csCtx->state](play, csCtx); +void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { + if (gSaveContext.save.cutsceneIndex < 0xFFF0) { + sManualCutsceneHandlers[csCtx->state](play, csCtx); } } -CutsceneStateHandler sCsStateHandlers2[] = { - Cutscene_DoNothing, // CS_STATE_0 - func_800EA2B8, // CS_STATE_1 - func_800ED980, // CS_STATE_2 - func_800EDA04, // CS_STATE_3 - func_800ED980, // CS_STATE_4 +CutsceneHandler sScriptedCutsceneHandlers[] = { + CutsceneHandler_DoNothing, // CS_STATE_IDLE + CutsceneHandler_StartScript, // CS_STATE_START + CutsceneHandler_RunScript, // CS_STATE_RUN + CutsceneHandler_StopScript, // CS_STATE_STOP + CutsceneHandler_RunScript, // CS_STATE_RUN_UNSTOPPABLE }; -void Cutscene_Update2(PlayState* play, CutsceneContext* csCtx) { +void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) { gSaveContext.cutsceneTrigger = 0; } - if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0)) { - gSaveContext.save.cutscene = 0xFFFD; + if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE)) { + gSaveContext.save.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; } - if (gSaveContext.save.cutscene >= 0xFFF0) { - func_800EDA84(play, csCtx); - sCsStateHandlers2[csCtx->state](play, csCtx); + if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { + Cutscene_SetupScripted(play, csCtx); + sScriptedCutsceneHandlers[csCtx->state](play, csCtx); } } -void Cutscene_DoNothing(PlayState* play, CutsceneContext* csCtx) { +void CutsceneHandler_DoNothing(PlayState* play, CutsceneContext* csCtx) { } -s32 func_800EA220(PlayState* play, CutsceneContext* csCtx, f32 target) { - return Math_StepToF(&csCtx->unk_0C, target, 0.1f); +s32 Cutscene_StepTimer(PlayState* play, CutsceneContext* csCtx, f32 target) { + return Math_StepToF(&csCtx->timer, target, 0.1f); } -void func_800EA258(PlayState* play, CutsceneContext* csCtx) { +void CutsceneHandler_StartManual(PlayState* play, CutsceneContext* csCtx) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_Letterbox_SetSizeTarget(32); - if (func_800EA220(play, csCtx, 1.0f)) { + + if (Cutscene_StepTimer(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); - csCtx->state++; + csCtx->state++; // CS_STATE_RUN } } -void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) { - func_800ED980(play, csCtx); +void CutsceneHandler_StartScript(PlayState* play, CutsceneContext* csCtx) { + CutsceneHandler_RunScript(play, csCtx); Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_Letterbox_SetSizeTarget(32); - if (func_800EA220(play, csCtx, 1.0f)) { + + if (Cutscene_StepTimer(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); - csCtx->state++; + csCtx->state++; // CS_STATE_RUN } } /* Start of command handling section */ -// Command 0x96: Miscellaneous commands. -void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { +void CutsceneCmd_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdMisc* cmd) { static u16 D_801BB15C = 0xFFFF; Player* player = GET_PLAYER(play); - f32 progress; - u8 isStartFrame = false; + f32 lerp; + u8 isFirstFrame = false; SceneTableEntry* loadedScene; - if ((csCtx->frames < cmd->startFrame) || ((csCtx->frames >= cmd->endFrame) && (cmd->endFrame != cmd->startFrame))) { + if (!((csCtx->curFrame >= cmd->startFrame) && + ((csCtx->curFrame < cmd->endFrame) || (cmd->endFrame == cmd->startFrame)))) { return; } - progress = Environment_LerpWeight(cmd->endFrame - 1, cmd->startFrame, csCtx->frames); - if (csCtx->frames == cmd->startFrame) { - isStartFrame = true; + lerp = Environment_LerpWeight(cmd->endFrame - 1, cmd->startFrame, csCtx->curFrame); + + if (csCtx->curFrame == cmd->startFrame) { + isFirstFrame = true; } - // TODO: consider creating an enum for this when we understand what each value does - switch (cmd->base) { - case 0x1: - if (isStartFrame) { + switch (cmd->type) { + case CS_MISC_RAIN: + if (isFirstFrame) { func_800FD78C(play); - play->envCtx.unk_F2[0] = 0x3C; + play->envCtx.unk_F2[0] = 60; } break; - case 0x2: - if (isStartFrame) { + + case CS_MISC_LIGHTNING: + if (isFirstFrame) { Audio_SetAmbienceChannelIO(AMBIENCE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); Environment_AddLightningBolts(play, 3); D_801F4E68 = 1; } break; - case 0x3: + + case CS_MISC_LIFT_FOG: if (play->envCtx.lightSettings.zFar < 12800) { play->envCtx.lightSettings.zFar += 35; } break; - case 0x4: - if (isStartFrame) { + + case CS_MISC_CLOUDY_SKY: + if (isFirstFrame) { play->envCtx.unk_19 = 1; play->envCtx.unk_17 = 1; play->envCtx.unk_18 = 0; @@ -177,49 +183,57 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c play->envCtx.unk_22 = play->envCtx.unk_24; } break; - case 0x5: - if (isStartFrame && (csCtx->state != CS_STATE_4)) { - csCtx->state = CS_STATE_3; + + case CS_MISC_STOP_CUTSCENE: + if (isFirstFrame && (csCtx->state != CS_STATE_RUN_UNSTOPPABLE)) { + csCtx->state = CS_STATE_STOP; } break; - case 0x7: - if (isStartFrame) { + + case CS_MISC_SHOW_TITLE_CARD: + if (isFirstFrame) { loadedScene = play->loadedScene; if (loadedScene->titleTextId != 0) { func_80151A68(play, loadedScene->titleTextId); } } break; - case 0x8: + + case CS_MISC_EARTHQUAKE_MEDIUM: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); - if (isStartFrame) { + if (isFirstFrame) { sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 6, 4, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); } break; - case 0x9: - if (isStartFrame) { + + case CS_MISC_EARTHQUAKE_STOP: + if (isFirstFrame) { Quake_Init(); } break; - case 0xA: + + case CS_MISC_VISMONO_BLACK_AND_WHITE: gVisMonoColor.r = 255; gVisMonoColor.g = 255; gVisMonoColor.b = 255; - gVisMonoColor.a = 255 * progress; + gVisMonoColor.a = 255 * lerp; break; - case 0xB: + + case CS_MISC_VISMONO_SEPIA: gVisMonoColor.r = 255; gVisMonoColor.g = 180; gVisMonoColor.b = 100; - gVisMonoColor.a = 255 * progress; + gVisMonoColor.a = 255 * lerp; break; - case 0xC: + + case CS_MISC_HIDE_ROOM: play->roomCtx.curRoom.segment = NULL; break; - case 0xD: + + case CS_MISC_RED_PULSATING_LIGHTS: if (play->state.frames & 8) { if (play->envCtx.lightSettings.ambientColor[0] < 40) { play->envCtx.lightSettings.ambientColor[0] += 2; @@ -234,96 +248,118 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c } } break; - case 0xE: + + case CS_MISC_HALT_ALL_ACTORS: play->haltAllActors = true; break; - case 0xF: + + case CS_MISC_RESUME_ALL_ACTORS: play->haltAllActors = false; break; - case 0x10: - if (isStartFrame) { + + case CS_MISC_SANDSTORM_FILL: + if (isFirstFrame) { play->envCtx.sandstormState = 1; } func_8019F128(NA_SE_EV_SAND_STORM - SFX_FLAG); break; - case 0x11: + + case CS_MISC_SUNSSONG_START: gSaveContext.sunsSongState = SUNSSONG_START; break; - case 0x12: + + case CS_MISC_FREEZE_TIME: if (!gSaveContext.save.isNight) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) - (u16)R_TIME_SPEED; } else { gSaveContext.save.time = ((void)0, gSaveContext.save.time) - (u16)(2 * R_TIME_SPEED); } break; - case 0x13: - AudioOcarina_PlayLongScarecrowAfterCredits(); - csCtx->frames = cmd->startFrame - 1; + + case CS_MISC_LONG_SCARECROW_SONG: + AudioOcarina_PlayLongScarecrowSong(); + csCtx->curFrame = cmd->startFrame - 1; // the cutscene runs forever break; - case 0x14: - EnvFlags_Set(play, 3); + + case CS_MISC_SET_CSFLAG_3: + CutsceneFlags_Set(play, 3); break; - case 0x15: - EnvFlags_Set(play, 4); + + case CS_MISC_SET_CSFLAG_4: + CutsceneFlags_Set(play, 4); break; - case 0x16: + + case CS_MISC_PLAYER_FORM_DEKU: gSaveContext.save.playerForm = PLAYER_FORM_DEKU; break; - case 0x17: + + case CS_MISC_ENABLE_PLAYER_REFLECTION: player->stateFlags2 |= PLAYER_STATE2_4000000; break; - case 0x18: + + case CS_MISC_DISABLE_PLAYER_REFLECTION: player->stateFlags2 &= ~PLAYER_STATE2_4000000; break; - case 0x19: + + case CS_MISC_PLAYER_FORM_HUMAN: sCutsceneStoredPlayerForm = gSaveContext.save.playerForm; gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; gSaveContext.save.equippedMask = PLAYER_MASK_NONE; break; - case 0x1A: + + case CS_MISC_EARTHQUAKE_STRONG: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); - if (isStartFrame) { + if (isFirstFrame) { sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 30000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 20, 10, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); } break; - case 0x1B: - if (isStartFrame) { + + case CS_MISC_DEST_MOON_CRASH_FIRE_WALL: + if (isFirstFrame) { play->nextEntrance = ENTRANCE(CUTSCENE, 0); gSaveContext.nextCutsceneIndex = 0xFFF8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; } break; - case 0x1C: - if (isStartFrame) { + + case CS_MISC_MOON_CRASH_SKYBOX: + if (isFirstFrame) { + // skyboxConfig play->envCtx.unk_17 = 0xD; } break; - case 0x1D: + + case CS_MISC_PLAYER_FORM_RESTORED: gSaveContext.save.playerForm = sCutsceneStoredPlayerForm; break; - case 0x1E: - D_801F4DE0 = true; + + case CS_MISC_DISABLE_PLAYER_CSMODE_START_POS: + gDisablePlayerCsModeStartPos = true; break; - case 0x1F: - D_801F4DE0 = false; + + case CS_MISC_ENABLE_PLAYER_CSMODE_START_POS: + gDisablePlayerCsModeStartPos = false; break; - case 0x21: - if (isStartFrame) { + + case CS_MISC_SAVE_ENTER_CLOCK_TOWN: + if (isFirstFrame) { Sram_SaveSpecialEnterClockTown(play); } break; - case 0x22: - if (isStartFrame) { - func_80144A94(&play->sramCtx); + + case CS_MISC_RESET_SAVE_FROM_MOON_CRASH: + if (isFirstFrame) { + Sram_ResetSaveFromMoonCrash(&play->sramCtx); } break; - case 0x23: - if (csCtx->frames != D_801BB15C) { - D_801BB15C = csCtx->frames; + + case CS_MISC_TIME_ADVANCE: + if (csCtx->curFrame != D_801BB15C) { + D_801BB15C = csCtx->curFrame; if (R_TIME_SPEED != 0) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; @@ -332,9 +368,10 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c } } break; - case 0x24: + + case CS_MISC_EARTHQUAKE_WEAK: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); - if (isStartFrame) { + if (isFirstFrame) { sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 2, 1, 0, 0); @@ -342,10 +379,8 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c } break; - case 0x26: - // Seems to be used to trigger "Dawn of A New Day" - - gSaveContext.save.day = 9; + case CS_MISC_DAWN_OF_A_NEW_DAY: + gSaveContext.save.day = 9; // 9 % 5 is day number 4, see `CURRENT_DAY` STOP_GAMESTATE(&play->state); SET_NEXT_GAMESTATE(&play->state, DayTelop_Init, sizeof(DayTelopState)); @@ -353,21 +388,23 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c Sram_SaveSpecialNewDay(play); break; - case 0x27: + case CS_MISC_PLAYER_FORM_ZORA: gSaveContext.save.playerForm = PLAYER_FORM_ZORA; break; - case 0x28: - csCtx->frames = cmd->startFrame - 1; + case CS_MISC_FINALE: + csCtx->curFrame = cmd->startFrame - 1; // the cutscene runs forever + break; + + default: break; } } -// Command 0x97: Set Environment Lighting -void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmdEnvLighting* cmd) { - if (csCtx->frames == cmd->startFrame) { - if (cmd->setting != 0x20) { - play->envCtx.lightSettingOverride = cmd->setting - 1; +void CutsceneCmd_SetLightSetting(PlayState* play, CutsceneContext* csCtx, CsCmdLightSetting* cmd) { + if (csCtx->curFrame == cmd->startFrame) { + if (cmd->settingPlusOne != 32) { + play->envCtx.lightSettingOverride = cmd->settingPlusOne - 1; play->envCtx.lightBlend = 1.0f; } else { play->envCtx.lightSettingOverride = 0xFF; @@ -375,51 +412,45 @@ void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmd } } -// Command 0x12C: Plays a sequence (Background music or Fanfare) -void Cutscene_Command_PlaySequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { - if (csCtx->frames == cmd->startFrame) { - Audio_PlaySequenceInCutscene(cmd->sequence - 1); +void CutsceneCmd_StartSequence(PlayState* play, CutsceneContext* csCtx, CsCmdStartSeq* cmd) { + if (csCtx->curFrame == cmd->startFrame) { + Audio_PlaySequenceInCutscene(cmd->seqIdPlusOne - 1); } } -// Command 0x12D: Stops a sequence (Background music or Fanfare) -void Cutscene_Command_StopSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { - if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { - Audio_StopSequenceInCutscene(cmd->sequence - 1); +void CutsceneCmd_StopSequence(PlayState* play, CutsceneContext* csCtx, CsCmdStopSeq* cmd) { + if ((csCtx->curFrame >= cmd->startFrame) && (csCtx->curFrame <= cmd->endFrame)) { + Audio_StopSequenceInCutscene(cmd->seqIdPlusOne - 1); } } -// Command 0x9C: Fade a sequence (Background music or Fanfare) over duration -void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceFade* cmd) { - if ((csCtx->frames == cmd->startFrame) && (csCtx->frames < cmd->endFrame)) { - u8 fadeTimer = cmd->endFrame - cmd->startFrame; +void CutsceneCmd_FadeOutSequence(PlayState* play, CutsceneContext* csCtx, CsCmdFadeOutSeq* cmd) { + if ((csCtx->curFrame == cmd->startFrame) && (csCtx->curFrame < cmd->endFrame)) { + u8 fadeOutDuration = cmd->endFrame - cmd->startFrame; - if (cmd->type == 2) { - SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, fadeTimer); - } else { - SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, fadeTimer); + if (cmd->seqPlayer == CS_FADE_OUT_FANFARE) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, fadeOutDuration); + } else { // CS_FADE_OUT_BGM_MAIN + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, fadeOutDuration); } } } -// Command 0x12E: Play Ambience sequence -void Cutscene_Command_PlayAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if (csCtx->frames == cmd->startFrame) { +void CutsceneCmd_StartAmbience(PlayState* play, CutsceneContext* csCtx, CsCmdStartAmbience* cmd) { + if (csCtx->curFrame == cmd->startFrame) { Audio_PlayAmbience(play->sequenceCtx.ambienceId); } } -// Command 0x130: -void func_800EAD48(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if (csCtx->frames == cmd->startFrame) { +void Cutscene_SetSfxReverbIndexTo2(PlayState* play, CutsceneContext* csCtx, CsCmdSfxReverbIndexTo2* cmd) { + if (csCtx->curFrame == cmd->startFrame) { // Audio_SetSfxReverbIndexExceptOcarinaBank func_801A4428(2); } } -// Command 0x131: -void func_800EAD7C(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if (csCtx->frames == cmd->startFrame) { +void Cutscene_SetSfxReverbIndexTo1(PlayState* play, CutsceneContext* csCtx, CsCmdSfxReverbIndexTo1* cmd) { + if (csCtx->curFrame == cmd->startFrame) { // Audio_SetSfxReverbIndexExceptOcarinaBank func_801A4428(1); } @@ -427,107 +458,103 @@ void func_800EAD7C(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { #ifdef NON_MATCHING // needs in-function static bss -// audio related -void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - static u16 seqId; +void CutsceneCmd_ModifySequence(PlayState* play, CutsceneContext* csCtx, CsCmdModifySeq* cmd) { + static u16 sSeqId; u8 dayMinusOne; - if (csCtx->frames == cmd->startFrame) { - dayMinusOne = (gSaveContext.save.day - 1); + if (csCtx->curFrame == cmd->startFrame) { + dayMinusOne = gSaveContext.save.day - 1; if (dayMinusOne >= 3) { dayMinusOne = 0; } - switch (cmd->base) { - case 1: - // func_801A246C(SEQ_PLAYER_BGM_MAIN, TYPE_1); + switch (cmd->type) { + case CS_MOD_SEQ_0: func_801A246C(SEQ_PLAYER_BGM_MAIN, 1); break; - case 2: - // func_801A246C(SEQ_PLAYER_BGM_MAIN, TYPE_0); + case CS_MOD_SEQ_1: func_801A246C(SEQ_PLAYER_BGM_MAIN, 0); break; - case 3: - // func_801A246C(SEQ_PLAYER_BGM_MAIN, TYPE_2); + case CS_MOD_SEQ_2: func_801A246C(SEQ_PLAYER_BGM_MAIN, 2); break; - case 4: - // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_1); + case CS_MOD_AMBIENCE_0: func_801A246C(SEQ_PLAYER_AMBIENCE, 1); break; - case 5: - // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_0); + case CS_MOD_AMBIENCE_1: func_801A246C(SEQ_PLAYER_AMBIENCE, 0); break; - case 6: - // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_2); + case CS_MOD_AMBIENCE_2: func_801A246C(SEQ_PLAYER_AMBIENCE, 2); break; - case 7: - seqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); + case CS_MOD_SEQ_STORE: + sSeqId = AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); break; - case 8: - if (seqId != NA_BGM_DISABLED) { - Audio_PlaySceneSequence(seqId, dayMinusOne); + case CS_MOD_SEQ_RESTORE: + if (sSeqId != NA_BGM_DISABLED) { + Audio_PlaySceneSequence(sSeqId, dayMinusOne); } break; + + default: + break; } } } #else -void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/func_800EADB0.s") +void CutsceneCmd_ModifySequence(PlayState* play, CutsceneContext* csCtx, CsCmdModifySeq* cmd); +#pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/CutsceneCmd_ModifySequence.s") #endif -// Command 0x12F: Fade Ambience sequence -void Cutscene_Command_FadeAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if (csCtx->frames == cmd->startFrame && csCtx->frames < cmd->endFrame) { - u8 fadeTimer = cmd->endFrame - cmd->startFrame; +void CutsceneCmd_FadeOutAmbience(PlayState* play, CutsceneContext* csCtx, CsCmdFadeOutAmbience* cmd) { + if ((csCtx->curFrame == cmd->startFrame) && (csCtx->curFrame < cmd->endFrame)) { + u8 fadeOutDuration = cmd->endFrame - cmd->startFrame; - SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, fadeTimer); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, fadeOutDuration); } } -// Command 0x190: Rumble -void Cutscene_Command_Rumble(PlayState* play, CutsceneContext* csCtx, CsCmdRumble* cmd) { +void CutsceneCmd_RumbleController(PlayState* play, CutsceneContext* csCtx, CsCmdRumble* cmd) { switch (cmd->type) { - case 1: - if (csCtx->frames == cmd->startFrame) { + case CS_RUMBLE_ONCE: + if (csCtx->curFrame == cmd->startFrame) { Rumble_Request(0.0f, cmd->intensity, cmd->decayTimer, cmd->decayStep); } break; - case 2: - if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { - if ((csCtx->frames == cmd->startFrame) || (play->state.frames % 64 == 0)) { + case CS_RUMBLE_PULSE: + if ((csCtx->curFrame >= cmd->startFrame) && (csCtx->curFrame <= cmd->endFrame)) { + if ((csCtx->curFrame == cmd->startFrame) || (play->state.frames % 64 == 0)) { Rumble_Request(0.0f, cmd->intensity, cmd->decayTimer, cmd->decayStep); } } break; + + default: + break; } } -// Command 0x9B: -void Cutscene_Command_FadeColorScreen(PlayState* play, CutsceneContext* csCtx, CsCmdFadeScreen* cmd) { - if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { +void CutsceneCmd_TransitionGeneral(PlayState* play, CutsceneContext* csCtx, CsCmdTransitionGeneral* cmd) { + if ((csCtx->curFrame >= cmd->startFrame) && (cmd->endFrame >= csCtx->curFrame)) { f32 alpha; play->envCtx.fillScreen = true; - alpha = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames); + alpha = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->curFrame); - if (((cmd->unk0 == 1)) || (cmd->unk0 == 2)) { + if (((cmd->type == CS_TRANS_GENERAL_FILL_IN)) || (cmd->type == CS_TRANS_GENERAL_FILL_OUT)) { play->envCtx.screenFillColor[0] = cmd->color.r; play->envCtx.screenFillColor[1] = cmd->color.g; play->envCtx.screenFillColor[2] = cmd->color.b; - if (cmd->unk0 == 2) { + if (cmd->type == CS_TRANS_GENERAL_FILL_OUT) { play->envCtx.screenFillColor[3] = (1.0f - alpha) * 255.0f; } else { play->envCtx.screenFillColor[3] = 255.0f * alpha; @@ -536,43 +563,45 @@ void Cutscene_Command_FadeColorScreen(PlayState* play, CutsceneContext* csCtx, C } } -// Command 0x9D: Set Time of Day & Environment Time -void Cutscene_Command_SetTime(PlayState* play, CutsceneContext* csCtx, CsCmdDayTime* cmd) { - u16 nextTime; +void CutsceneCmd_SetTime(PlayState* play, CutsceneContext* csCtx, CsCmdTime* cmd) { u16 hourAsMinutes; u16 minutes; - if (csCtx->frames == cmd->startFrame) { + if (csCtx->curFrame == cmd->startFrame) { hourAsMinutes = CLOCK_TIME_ALT_F(cmd->hour, 0); minutes = CLOCK_TIME_ALT_F(0, cmd->minute + 1); - nextTime = hourAsMinutes + minutes; - gSaveContext.save.time = nextTime; - gSaveContext.skyboxTime = nextTime; + gSaveContext.save.time = hourAsMinutes + minutes; + gSaveContext.skyboxTime = hourAsMinutes + minutes; } } -void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - csCtx->state = CS_STATE_4; +void CutsceneCmd_DestinationDefault(PlayState* play, CutsceneContext* csCtx, CsCmdDestination* cmd) { + csCtx->state = CS_STATE_RUN_UNSTOPPABLE; Play_DisableMotionBlur(); Audio_SetCutsceneFlag(false); gSaveContext.cutsceneTransitionControl = 1; - if ((gSaveContext.gameMode != GAMEMODE_NORMAL) && (csCtx->frames != cmd->startFrame)) { + // `hudVisibilityForceButtonAlphasByStatus` has a secondary purpose, which is to signal to the title + // screen actor that it should display immediately. This occurs when a title screen cutscene that + // is not the main clock town scene is skipped. + if ((gSaveContext.gameMode != GAMEMODE_NORMAL) && (csCtx->curFrame != cmd->startFrame)) { gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; } - gSaveContext.save.cutscene = 0; - if (cmd->base == 1) { - play->nextEntrance = play->csCtx.sceneCsList[play->csCtx.currentCsIndex].nextEntrance; + gSaveContext.save.cutsceneIndex = 0; + + if (cmd->type == CS_DESTINATION_DEFAULT) { + play->nextEntrance = play->csCtx.scriptList[play->csCtx.scriptIndex].nextEntrance; gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; + if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) { Scene_SetExitFade(play); } else { - D_801BB12C++; - if (D_801BB12C >= 2) { - D_801BB12C = 0; + gOpeningEntranceIndex++; + if (gOpeningEntranceIndex >= 2) { + gOpeningEntranceIndex = 0; } play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; } @@ -585,19 +614,18 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* } } -// Command 0x15E -void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if (cmd->base == 1) { - if (csCtx->frames == cmd->startFrame) { - Cutscene_TerminatorImpl(play, csCtx, cmd); +void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDestination* cmd) { + if (cmd->type == CS_DESTINATION_DEFAULT) { + if (csCtx->curFrame == cmd->startFrame) { + CutsceneCmd_DestinationDefault(play, csCtx, cmd); } - } else if (cmd->base == 2) { - if (csCtx->frames == cmd->startFrame) { + } else if (cmd->type == CS_DESTINATION_BOSS_WARP) { + if (csCtx->curFrame == cmd->startFrame) { Play_DisableMotionBlur(); - switch (D_801F4DE2) { - case 0x1F: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + switch (gDungeonBossWarpSceneId) { + case SCENE_MITURIN_BS: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; @@ -609,8 +637,8 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB } break; - case 0x44: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + case SCENE_HAKUGIN_BS: + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; @@ -622,36 +650,38 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB } break; - case 0x5F: - SET_WEEKEVENTREG(WEEKEVENTREG_55_80); + case SCENE_SEA_BS: + SET_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE); play->nextEntrance = ENTRANCE(ZORA_CAPE, 8); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; - case 0x36: - SET_WEEKEVENTREG(WEEKEVENTREG_52_20); + case SCENE_INISIE_BS: + SET_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE); play->nextEntrance = ENTRANCE(IKANA_CANYON, 0); gSaveContext.nextCutsceneIndex = 0xFFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; + + default: + break; } } } } -// Command 0x15F: Chooses between a cutscene or a rotating mask depending on whether the player has the corresponding -// mask -void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(SEQ_PLAYER_BGM_MAIN, true) != 0xFF)) { - switch (cmd->base) { - case 1: - Cutscene_TerminatorImpl(play, csCtx, cmd); +// Chooses between a cutscene or a rotating mask depending on whether the player has the corresponding mask +void CutsceneCmd_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCtx, CsCmdChooseCreditsScene* cmd) { + if ((csCtx->curFrame >= cmd->startFrame) && (func_801A3950(SEQ_PLAYER_BGM_MAIN, true) != 0xFF)) { + switch (cmd->type) { + case CS_CREDITS_DESTINATION: + CutsceneCmd_DestinationDefault(play, csCtx, (CsCmdDestination*)cmd); break; - case 2: + case CS_CREDITS_MASK_KAMARO: if (INV_CONTENT(ITEM_MASK_KAMARO) == ITEM_MASK_KAMARO) { play->nextEntrance = ENTRANCE(MILK_BAR, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; @@ -662,7 +692,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 3: + case CS_CREDITS_MASK_GREAT_FAIRY: if (INV_CONTENT(ITEM_MASK_GREAT_FAIRY) == ITEM_MASK_GREAT_FAIRY) { play->nextEntrance = ENTRANCE(FAIRY_FOUNTAIN, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; @@ -673,7 +703,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 4: + case CS_CREDITS_MASK_ROMANI: if (INV_CONTENT(ITEM_MASK_ROMANI) == ITEM_MASK_ROMANI) { play->nextEntrance = ENTRANCE(ROMANI_RANCH, 0); gSaveContext.nextCutsceneIndex = 0xFFF1; @@ -684,7 +714,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 5: + case CS_CREDITS_MASK_BLAST: if (INV_CONTENT(ITEM_MASK_BLAST) == ITEM_MASK_BLAST) { play->nextEntrance = ENTRANCE(WEST_CLOCK_TOWN, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; @@ -695,7 +725,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 6: + case CS_CREDITS_MASK_CIRCUS_LEADER: if (INV_CONTENT(ITEM_MASK_CIRCUS_LEADER) == ITEM_MASK_CIRCUS_LEADER) { play->nextEntrance = ENTRANCE(MILK_BAR, 0); gSaveContext.nextCutsceneIndex = 0xFFF1; @@ -706,7 +736,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 7: + case CS_CREDITS_MASK_BREMEN: if (INV_CONTENT(ITEM_MASK_BREMEN) == ITEM_MASK_BREMEN) { play->nextEntrance = ENTRANCE(MILK_BAR, 0); gSaveContext.nextCutsceneIndex = 0xFFF3; @@ -717,13 +747,13 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 8: + case CS_CREDITS_IKANA: play->nextEntrance = ENTRANCE(IKANA_CANYON, 0); gSaveContext.nextCutsceneIndex = 0xFFF3; play->transitionTrigger = TRANS_TRIGGER_START; break; - case 9: + case CS_CREDITS_MASK_COUPLE: if (INV_CONTENT(ITEM_MASK_COUPLE) == ITEM_MASK_COUPLE) { play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0); gSaveContext.nextCutsceneIndex = 0xFFF8; @@ -734,7 +764,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 10: + case CS_CREDITS_MASK_BUNNY: if (INV_CONTENT(ITEM_MASK_BUNNY) == ITEM_MASK_BUNNY) { play->nextEntrance = ENTRANCE(CUCCO_SHACK, 0); gSaveContext.nextCutsceneIndex = 0xFFF0; @@ -745,7 +775,7 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt play->transitionTrigger = TRANS_TRIGGER_START; break; - case 11: + case CS_CREDITS_MASK_POSTMAN: if (INV_CONTENT(ITEM_MASK_POSTMAN) == ITEM_MASK_POSTMAN) { play->nextEntrance = ENTRANCE(TERMINA_FIELD, 1); gSaveContext.nextCutsceneIndex = 0xFFF8; @@ -755,35 +785,36 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt } play->transitionTrigger = TRANS_TRIGGER_START; break; + + default: + break; } } } -// Command 0x99: Motion blur -void Cutscene_Command_MotionBlur(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { - if ((csCtx->frames == cmd->startFrame) && (cmd->base == 1)) { +void CutsceneCmd_MotionBlur(PlayState* play, CutsceneContext* csCtx, CsCmdMotionBlur* cmd) { + if ((csCtx->curFrame >= cmd->startFrame) && (cmd->endFrame >= csCtx->curFrame)) { + if ((csCtx->curFrame == cmd->startFrame) && (cmd->type == CS_MOTION_BLUR_ENABLE)) { Play_EnableMotionBlur(180); } - if (cmd->base == 2) { - f32 progress = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames); + if (cmd->type == CS_MOTION_BLUR_DISABLE) { + f32 lerp = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->curFrame); - if (progress >= 0.9f) { + if (lerp >= 0.9f) { Play_DisableMotionBlur(); } else { - Play_SetMotionBlurAlpha((1.0f - progress) * 180.0f); + Play_SetMotionBlurAlpha((1.0f - lerp) * 180.0f); } } } } -// Command 0x9A: Gives Tatl to the player -void Cutscene_Command_GiveTatlToPlayer(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { +void CutsceneCmd_GiveTatlToPlayer(PlayState* play, CutsceneContext* csCtx, CsCmdGiveTatl* cmd) { Player* player = GET_PLAYER(play); - if (csCtx->frames == cmd->startFrame) { - if (cmd->base == 1) { + if (csCtx->curFrame == cmd->startFrame) { + if (cmd->giveTatl == true) { gSaveContext.save.hasTatl = true; if (player->tatlActor != NULL) { return; @@ -794,109 +825,112 @@ void Cutscene_Command_GiveTatlToPlayer(PlayState* play, CutsceneContext* csCtx, } } -// Command 0x98 -void Cutscene_Command_TransitionFX(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { - f32 temp_f0; +void CutsceneCmd_Transition(PlayState* play, CutsceneContext* csCtx, CsCmdTransition* cmd) { + if ((csCtx->curFrame >= cmd->startFrame) && (cmd->endFrame >= csCtx->curFrame)) { + f32 lerp; play->envCtx.fillScreen = true; - temp_f0 = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames); + lerp = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->curFrame); - switch (cmd->base) { - case 1: - case 5: + switch (cmd->type) { + case CS_TRANS_GRAY_FILL_IN: + case CS_TRANS_GRAY_FILL_OUT: play->envCtx.screenFillColor[0] = 160; play->envCtx.screenFillColor[1] = 160; play->envCtx.screenFillColor[2] = 160; - if (cmd->base == 1) { - play->envCtx.screenFillColor[3] = 255.0f * temp_f0; - if (temp_f0 == 0.0f) { + + if (cmd->type == CS_TRANS_GRAY_FILL_IN) { + play->envCtx.screenFillColor[3] = 255.0f * lerp; + if (lerp == 0.0f) { func_8019F128(NA_SE_EV_S_STONE_FLASH); } } else { - play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - lerp) * 255.0f; } break; - case 2: - case 6: + case CS_TRANS_BLUE_FILL_IN: + case CS_TRANS_BLUE_FILL_OUT: play->envCtx.screenFillColor[0] = 0; play->envCtx.screenFillColor[1] = 0; play->envCtx.screenFillColor[2] = 255; - if (cmd->base == 2) { - play->envCtx.screenFillColor[3] = 255.0f * temp_f0; + if (cmd->type == CS_TRANS_BLUE_FILL_IN) { + play->envCtx.screenFillColor[3] = 255.0f * lerp; } else { - play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; + play->envCtx.screenFillColor[3] = (1.0f - lerp) * 255.0f; } break; - case 3: - case 7: + case CS_TRANS_RED_FILL_OUT: + case CS_TRANS_RED_FILL_IN: play->envCtx.screenFillColor[0] = 255; play->envCtx.screenFillColor[1] = 0; play->envCtx.screenFillColor[2] = 0; - if (cmd->base == 3) { - play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; + if (cmd->type == CS_TRANS_RED_FILL_OUT) { + play->envCtx.screenFillColor[3] = (1.0f - lerp) * 255.0f; } else { - play->envCtx.screenFillColor[3] = 255.0f * temp_f0; + play->envCtx.screenFillColor[3] = 255.0f * lerp; } break; - case 4: - case 8: + case CS_TRANS_GREEN_FILL_OUT: + case CS_TRANS_GREEN_FILL_IN: play->envCtx.screenFillColor[0] = 0; play->envCtx.screenFillColor[1] = 255; play->envCtx.screenFillColor[2] = 0; - if (cmd->base == 4) { - play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; + if (cmd->type == CS_TRANS_GREEN_FILL_OUT) { + play->envCtx.screenFillColor[3] = (1.0f - lerp) * 255.0f; } else { - play->envCtx.screenFillColor[3] = 255.0f * temp_f0; + play->envCtx.screenFillColor[3] = 255.0f * lerp; } break; - case 9: + case CS_TRANS_TRIGGER_INSTANCE: gSaveContext.cutsceneTransitionControl = 1; break; - case 10: - case 11: + case CS_TRANS_BLACK_FILL_OUT: + case CS_TRANS_BLACK_FILL_IN: play->envCtx.screenFillColor[0] = 0; play->envCtx.screenFillColor[1] = 0; play->envCtx.screenFillColor[2] = 0; - if (cmd->base == 10) { - play->envCtx.screenFillColor[3] = (1.0f - temp_f0) * 255.0f; + if (cmd->type == CS_TRANS_BLACK_FILL_OUT) { + play->envCtx.screenFillColor[3] = (1.0f - lerp) * 255.0f; } else { - play->envCtx.screenFillColor[3] = 255.0f * temp_f0; + play->envCtx.screenFillColor[3] = 255.0f * lerp; } break; - case 12: - play->envCtx.screenFillColor[0] = (160.0f * (1.0f - temp_f0)); + case CS_TRANS_GRAY_TO_BLACK: + play->envCtx.screenFillColor[0] = (1.0f - lerp) * 160.0f; play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[0]; play->envCtx.screenFillColor[2] = play->envCtx.screenFillColor[0]; play->envCtx.screenFillColor[3] = 255; break; - case 13: - play->envCtx.screenFillColor[0] = (160.0f * temp_f0); + case CS_TRANS_BLACK_TO_GRAY: + play->envCtx.screenFillColor[0] = 160.0f * lerp; play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[0]; play->envCtx.screenFillColor[2] = play->envCtx.screenFillColor[0]; play->envCtx.screenFillColor[3] = 255; break; + + default: + break; } } } -// Command 0x5A: Camera -s32 Cutscene_Command_Camera(PlayState* play, u8* cmd) { - s32 sp1C = 0; +s32 CutsceneCmd_UpdateCamSpline(PlayState* play, u8* script) { + s32 cmdBytes = 0; + + bcopy(script, &cmdBytes, sizeof(cmdBytes)); + script += sizeof(cmdBytes); - bcopy(cmd, &sp1C, sizeof(s32)); - cmd += sizeof(s32); if (!Play_IsDebugCamEnabled()) { - func_80161998(cmd, &sCutsceneCameraInfo); + CutsceneCamera_UpdateSplines(script, &sCutsceneCameraInfo); } - return sp1C + sizeof(s32); + return cmdBytes + sizeof(cmdBytes); } /** @@ -970,144 +1004,146 @@ s32 Cutscene_CountNormalMasks(void) { return count; } -// Command 0xA: Textbox -void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdTextbox* cmd) { - static s32 D_801BB160 = CS_TEXTBOX_TYPE_DEFAULT; +void CutsceneCmd_Text(PlayState* play, CutsceneContext* csCtx, CsCmdText* cmd) { + static s32 sCutsceneTextboxType = CS_TEXT_TYPE_DEFAULT; u8 talkState; s32 pad; - u16 originalCsFrames; - s32 pad2; + u16 endFrame; - if ((cmd->startFrame >= csCtx->frames) || ((cmd->endFrame < csCtx->frames))) { + if ((csCtx->curFrame <= cmd->startFrame) || (csCtx->curFrame > cmd->endFrame)) { return; } - if (cmd->type != CS_TEXTBOX_TYPE_LEARN_SONG) { - if (D_801BB124 != cmd->base) { - if (D_801BB160 == CS_TEXTBOX_TYPE_3) { - csCtx->frames--; + if (cmd->type != CS_TEXT_OCARINA_ACTION) { + if (sCurTextId != cmd->textId) { + if (sCutsceneTextboxType == CS_TEXT_TYPE_3) { + csCtx->curFrame--; } - D_801BB160 = CS_TEXTBOX_TYPE_1; - D_801BB124 = cmd->base; - if (cmd->type == CS_TEXTBOX_TYPE_BOSSES_REMAINS) { + sCutsceneTextboxType = CS_TEXT_TYPE_1; + sCurTextId = cmd->textId; + if (cmd->type == CS_TEXT_TYPE_BOSSES_REMAINS) { if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { - if (cmd->textId1 != 0xFFFF) { - Message_StartTextbox(play, cmd->textId1, NULL); + if (cmd->altTextId1 != 0xFFFF) { + Message_StartTextbox(play, cmd->altTextId1, NULL); } } else { - Message_StartTextbox(play, cmd->base, NULL); + Message_StartTextbox(play, cmd->textId, NULL); } - } else if (cmd->type == CS_TEXTBOX_TYPE_ALL_NORMAL_MASKS) { + } else if (cmd->type == CS_TEXT_TYPE_ALL_NORMAL_MASKS) { if (Cutscene_CountNormalMasks() == 20) { - if (cmd->textId1 != 0xFFFF) { - Message_StartTextbox(play, cmd->textId1, NULL); + if (cmd->altTextId1 != 0xFFFF) { + Message_StartTextbox(play, cmd->altTextId1, NULL); } } else { - Message_StartTextbox(play, cmd->base, NULL); + Message_StartTextbox(play, cmd->textId, NULL); } } else { - Message_StartTextbox(play, cmd->base, NULL); + Message_StartTextbox(play, cmd->textId, NULL); } - } else { - goto else_label; + //! FAKE: return; + goto end; } - } else if (D_801BB128 != cmd->base) { - D_801BB160 = CS_TEXTBOX_TYPE_LEARN_SONG; - D_801BB128 = cmd->base; - func_80152434(play, cmd->base); } else { - else_label: - if (csCtx->frames >= cmd->endFrame) { - // The Textbox command can change the current cutscene frame, mainly to prevent advancing the cutscene when - // a textbox that is expected to be closed by the user is still open. - - originalCsFrames = csCtx->frames; - talkState = Message_GetState(&play->msgCtx); - if ((talkState != TEXT_STATE_CLOSING) && (talkState != TEXT_STATE_NONE) && (talkState != TEXT_STATE_7) && - (talkState != TEXT_STATE_8)) { - csCtx->frames--; - if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { - if (play->msgCtx.choiceIndex == 0) { - if (cmd->base == 0x33BD) { - func_8019F230(); - } - - if (cmd->textId1 != 0xFFFF) { - Message_ContinueTextbox(play, cmd->textId1); - if (cmd->type == CS_TEXTBOX_TYPE_3) { - D_801BB160 = CS_TEXTBOX_TYPE_3; - if (cmd->textId2 != 0xFFFF) { - csCtx->frames++; - } - } - } else { - Message_CloseTextbox(play); - csCtx->frames++; - } - } else { - if (cmd->base == 0x33BD) { - func_8019F208(); - } - - if (cmd->textId2 != 0xFFFF) { - Message_ContinueTextbox(play, cmd->textId2); - if (cmd->type == CS_TEXTBOX_TYPE_3) { - D_801BB160 = CS_TEXTBOX_TYPE_3; - if (cmd->textId1 != 0xFFFF) { - csCtx->frames++; - } - } - } else { - Message_CloseTextbox(play); - csCtx->frames++; - } - } - } - - if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { - func_80152434(play, cmd->base); - } - } - - if ((talkState == TEXT_STATE_CLOSING) && (D_801BB160 == CS_TEXTBOX_TYPE_3)) { - csCtx->frames--; - D_801BB124++; - } - - if (originalCsFrames == csCtx->frames) { - Interface_SetHudVisibility(HUD_VISIBILITY_NONE); - D_801BB124 = 0; - D_801BB128 = 0; - func_80161C0C(); - } else { - func_80161BE0(1); - } + if (sCurOcarinaAction != cmd->textId) { + sCutsceneTextboxType = CS_TEXT_OCARINA_ACTION; + sCurOcarinaAction = cmd->textId; + func_80152434(play, cmd->textId); + return; } } -} -// Related to actorActions. Maybe a generic actorAction setter? -void func_800ECD7C(CutsceneContext* csCtx, u8** cutscenePtr, s16 index) { - s32 i; - s32 count; + if (csCtx->curFrame >= cmd->endFrame) { + // The Textbox command can change the current cutscene frame, mainly to prevent advancing the cutscene when + // a textbox that is expected to be closed by the user is still open. + endFrame = csCtx->curFrame; + talkState = Message_GetState(&play->msgCtx); + if ((talkState != TEXT_STATE_CLOSING) && (talkState != TEXT_STATE_NONE) && (talkState != TEXT_STATE_7) && + (talkState != TEXT_STATE_8)) { + csCtx->curFrame--; - bcopy(*cutscenePtr, &count, sizeof(s32)); - *cutscenePtr += sizeof(s32); + if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { + if (play->msgCtx.choiceIndex == 0) { + if (cmd->textId == 0x33BD) { + // Gorman Track: do you understand? + func_8019F230(); + } - for (i = 0; i < count; i++) { - CsCmdActorAction* actorAction = *(CsCmdActorAction**)cutscenePtr; + if (cmd->altTextId1 != 0xFFFF) { + Message_ContinueTextbox(play, cmd->altTextId1); + if (cmd->type == CS_TEXT_TYPE_3) { + sCutsceneTextboxType = CS_TEXT_TYPE_3; + if (cmd->altTextId2 != 0xFFFF) { + csCtx->curFrame++; + } + } + } else { + Message_CloseTextbox(play); + csCtx->curFrame++; + } + } else { + if (cmd->textId == 0x33BD) { + // Gorman Track: do you understand? + func_8019F208(); + } - if ((csCtx->frames >= actorAction->startFrame) && (csCtx->frames < actorAction->endFrame)) { - csCtx->actorActions[index] = actorAction; + if (cmd->altTextId2 != 0xFFFF) { + Message_ContinueTextbox(play, cmd->altTextId2); + if (cmd->type == CS_TEXT_TYPE_3) { + sCutsceneTextboxType = CS_TEXT_TYPE_3; + if (cmd->altTextId1 != 0xFFFF) { + csCtx->curFrame++; + } + } + } else { + Message_CloseTextbox(play); + csCtx->curFrame++; + } + } + } + + if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { + func_80152434(play, cmd->textId); + } } - *cutscenePtr += sizeof(CsCmdActorAction); + if ((talkState == TEXT_STATE_CLOSING) && (sCutsceneTextboxType == CS_TEXT_TYPE_3)) { + csCtx->curFrame--; + sCurTextId++; + } + + if (endFrame == csCtx->curFrame) { + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); + sCurTextId = 0; + sCurOcarinaAction = 0; + CutsceneCamera_Reset(); + } else { + CutsceneCamera_SetState(CS_CAM_STATE_UPDATE_SPLINE); + } + } +end:; +} + +void Cutscene_SetActorCue(CutsceneContext* csCtx, u8** script, s16 cueChannel) { + s32 i; + s32 numCues; + + bcopy(*script, &numCues, sizeof(numCues)); + *script += sizeof(numCues); + + for (i = 0; i < numCues; i++) { + CsCmdActorCue* cue = *(CsCmdActorCue**)script; + + if ((csCtx->curFrame >= cue->startFrame) && (csCtx->curFrame < cue->endFrame)) { + csCtx->actorCues[cueChannel] = cue; + } + + *script += sizeof(CsCmdActorCue); } } /** - * Loops over the cutscene data itself (`cutscenePtr`), applying the effects of each command instantaneously (for most + * Loops over the cutscene data itself (`script`), applying the effects of each command instantaneously (for most * commands). * * The cutscene data is an irregularly-structured array of words, which is made up of @@ -1124,15 +1160,15 @@ void func_800ECD7C(CutsceneContext* csCtx, u8** cutscenePtr, s16 index) { * has (N). This is followed by N commands of the said category. (The exception is Camera, which has the length of the * list in bytes instead of the number of commands). * - * For most command lists categories (all but the actorActions and Camera commands): + * For most command lists categories (all but the actorCues and Camera commands): * - For each command list found, read the number of commands and loop over them, passing each one to the corresponding * function which handles the command, applying its effects and checking the frame range stored in the command. * * This function is invoked once per frame that a cutscene is active. * - * TODO: consider changing the type of `cutscenePtr` to `uintptr_t` when this function matches. + * TODO: consider changing the type of `script` to `uintptr_t` when this function matches. */ -void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr) { +void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) { s32 i; s32 j; s32 pad; @@ -1140,44 +1176,46 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc u32 cmdType; s32 cmdEntries; s32 pad2; - s32 cutsceneEndFrame; - CsCmdBase* cmd; + s32 csFrameCount; + void* cmd; // Read the command list count and the ending frame for this cutscene - bcopy(cutscenePtr, &totalEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); - bcopy(cutscenePtr, &cutsceneEndFrame, sizeof(s32)); - cutscenePtr += sizeof(s32); + bcopy(script, &totalEntries, sizeof(totalEntries)); + script += sizeof(totalEntries); - if (((u16)cutsceneEndFrame < csCtx->frames) && (play->transitionTrigger != TRANS_TRIGGER_START) && - (csCtx->state != CS_STATE_4)) { - csCtx->state = CS_STATE_3; + bcopy(script, &csFrameCount, sizeof(csFrameCount)); + script += sizeof(csFrameCount); + + if ((csCtx->curFrame > (u16)csFrameCount) && (play->transitionTrigger != TRANS_TRIGGER_START) && + (csCtx->state != CS_STATE_RUN_UNSTOPPABLE)) { + csCtx->state = CS_STATE_STOP; return; } // Loop over every command list for (i = 0; i < totalEntries; i++) { // Read the command type of the current command list. - bcopy(cutscenePtr, &cmdType, sizeof(u32)); - cutscenePtr += sizeof(u32); + bcopy(script, &cmdType, sizeof(cmdType)); + script += sizeof(cmdType); - // TODO: This should probably be added to the CutsceneCmd enum. Consider doing it when this function matches. - if (cmdType == 0xFFFFFFFF) { + if (cmdType == CS_CAM_STOP) { break; } - // Check special cases of command types. This are generic ActorActions - // Ranges: [0x64, 0x96), 0xC9, [0x1C2, 0x258) - if (((cmdType >= 100) && (cmdType < 150)) || (cmdType == 201) || ((cmdType >= 450) && (cmdType < 600))) { - for (j = 0; j < ARRAY_COUNT(D_801F4DC8); j = (s16)(j + 1)) { - if (D_801F4DC8[j] == (u16)cmdType) { - func_800ECD7C(csCtx, &cutscenePtr, j); - cmdType = -2; + if (((cmdType >= CS_CMD_ACTOR_CUE_100) && (cmdType <= CS_CMD_ACTOR_CUE_149)) || + (cmdType == CS_CMD_ACTOR_CUE_201) || + ((cmdType >= CS_CMD_ACTOR_CUE_450) && (cmdType <= CS_CMD_ACTOR_CUE_599))) { + for (j = 0; j < ARRAY_COUNT(sCueTypeList); j = (s16)(j + 1)) { + if (sCueTypeList[j] == (u16)cmdType) { + Cutscene_SetActorCue(csCtx, &script, j); + cmdType = CS_CMD_ACTOR_CUE_POST_PROCESS; break; - } else if (D_801F4DC8[j] == 0) { - D_801F4DC8[j] = cmdType; - func_800ECD7C(csCtx, &cutscenePtr, j); - cmdType = -2; + } + + if (sCueTypeList[j] == 0) { + sCueTypeList[j] = cmdType; + Cutscene_SetActorCue(csCtx, &script, j); + cmdType = CS_CMD_ACTOR_CUE_POST_PROCESS; break; } } @@ -1185,203 +1223,227 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc switch (cmdType) { case CS_CMD_MISC: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_Misc(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_Misc(play, csCtx, (CsCmdMisc*)script); + script += sizeof(CsCmdMisc); } break; - case CS_CMD_SET_LIGHTING: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_LIGHT_SETTING: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_SetLighting(play, csCtx, (CsCmdEnvLighting*)cutscenePtr); - cutscenePtr += sizeof(CsCmdEnvLighting); + CutsceneCmd_SetLightSetting(play, csCtx, (CsCmdLightSetting*)script); + script += sizeof(CsCmdLightSetting); } break; - case CS_CMD_PLAYSEQ: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_START_SEQ: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_PlaySequence(play, csCtx, (CsCmdSequenceChange*)cutscenePtr); - cutscenePtr += sizeof(CsCmdSequenceChange); + CutsceneCmd_StartSequence(play, csCtx, (CsCmdStartSeq*)script); + script += sizeof(CsCmdStartSeq); } break; - case CS_CMD_STOPSEQ: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_STOP_SEQ: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_StopSequence(play, csCtx, (CsCmdSequenceChange*)cutscenePtr); - cutscenePtr += sizeof(CsCmdSequenceChange); + CutsceneCmd_StopSequence(play, csCtx, (CsCmdStopSeq*)script); + script += sizeof(CsCmdStartSeq); } break; - case CS_CMD_FADESEQ: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_FADE_OUT_SEQ: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeSequence(play, csCtx, (CsCmdSequenceFade*)cutscenePtr); - cutscenePtr += sizeof(CsCmdSequenceFade); + CutsceneCmd_FadeOutSequence(play, csCtx, (CsCmdFadeOutSeq*)script); + script += sizeof(CsCmdFadeOutSeq); } break; - case CS_CMD_PLAYAMBIENCE: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_START_AMBIENCE: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_PlayAmbienceSequence(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_StartAmbience(play, csCtx, (CsCmdStartAmbience*)script); + script += sizeof(CsCmdStartAmbience); } break; - case CS_CMD_FADEAMBIENCE: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_FADE_OUT_AMBIENCE: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeAmbienceSequence(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_FadeOutAmbience(play, csCtx, (CsCmdFadeOutAmbience*)script); + script += sizeof(CsCmdFadeOutAmbience); } break; - case CS_CMD_130: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_SFX_REVERB_INDEX_2: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - func_800EAD48(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + Cutscene_SetSfxReverbIndexTo2(play, csCtx, (CsCmdSfxReverbIndexTo2*)script); + script += sizeof(CsCmdSfxReverbIndexTo2); } break; - case CS_CMD_131: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_SFX_REVERB_INDEX_1: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - func_800EAD7C(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + Cutscene_SetSfxReverbIndexTo1(play, csCtx, (CsCmdSfxReverbIndexTo1*)script); + script += sizeof(CsCmdSfxReverbIndexTo1); } break; - case CS_CMD_132: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_MODIFY_SEQ: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - func_800EADB0(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_ModifySequence(play, csCtx, (CsCmdModifySeq*)script); + script += sizeof(CsCmdModifySeq); } break; case CS_CMD_RUMBLE: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_Rumble(play, csCtx, (CsCmdRumble*)cutscenePtr); - cutscenePtr += sizeof(CsCmdRumble); + CutsceneCmd_RumbleController(play, csCtx, (CsCmdRumble*)script); + script += sizeof(CsCmdRumble); } break; - case CS_CMD_FADESCREEN: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_TRANSITION_GENERAL: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_FadeColorScreen(play, csCtx, (CsCmdFadeScreen*)cutscenePtr); - cutscenePtr += sizeof(CsCmdFadeScreen); + CutsceneCmd_TransitionGeneral(play, csCtx, (CsCmdTransitionGeneral*)script); + script += sizeof(CsCmdTransitionGeneral); } break; - case CS_CMD_SETTIME: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_TIME: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_SetTime(play, csCtx, (CsCmdDayTime*)cutscenePtr); - cutscenePtr += sizeof(CsCmdDayTime); + CutsceneCmd_SetTime(play, csCtx, (CsCmdTime*)script); + script += sizeof(CsCmdTime); } break; - case CS_CMD_SET_PLAYER_ACTION: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_PLAYER_CUE: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame <= csCtx->frames) && (csCtx->frames < cmd->endFrame)) { - csCtx->playerAction = (CsCmdActorAction*)cmd; + cmd = script; + + if ((((CsCmdActorCue*)cmd)->startFrame <= csCtx->curFrame) && + (csCtx->curFrame < ((CsCmdActorCue*)cmd)->endFrame)) { + csCtx->playerCue = (CsCmdActorCue*)cmd; } - cutscenePtr += sizeof(CsCmdActorAction); + script += sizeof(CsCmdActorCue); } break; - case CS_CMD_CAMERA: - cutscenePtr += Cutscene_Command_Camera(play, cutscenePtr); + case CS_CMD_CAMERA_SPLINE: + script += CutsceneCmd_UpdateCamSpline(play, script); break; - case CS_CMD_TERMINATOR: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_DESTINATION: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_Terminator(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_Destination(play, csCtx, (CsCmdDestination*)script); + script += sizeof(CsCmdDestination); } break; case CS_CMD_CHOOSE_CREDITS_SCENES: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_ChooseCreditsScenes(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_ChooseCreditsScenes(play, csCtx, (CsCmdChooseCreditsScene*)script); + script += sizeof(CsCmdChooseCreditsScene); } break; - case CS_CMD_TEXTBOX: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_TEXT: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - cmd = (CsCmdBase*)cutscenePtr; - if (cmd->base != 0xFFFF) { - Cutscene_Command_Textbox(play, csCtx, (CsCmdTextbox*)cmd); + cmd = script; + + if (((CsCmdText*)cmd)->textId != 0xFFFF) { + CutsceneCmd_Text(play, csCtx, (CsCmdText*)cmd); } - cutscenePtr += sizeof(CsCmdTextbox); + script += sizeof(CsCmdText); } break; - case CS_CMD_SCENE_TRANS_FX: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_TRANSITION: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_TransitionFX(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_Transition(play, csCtx, (CsCmdTransition*)script); + script += sizeof(CsCmdTransition); } break; - case CS_CMD_MOTIONBLUR: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_MOTION_BLUR: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_MotionBlur(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_MotionBlur(play, csCtx, (CsCmdMotionBlur*)script); + script += sizeof(CsCmdMotionBlur); } break; - case CS_CMD_GIVETATL: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + case CS_CMD_GIVE_TATL: + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - Cutscene_Command_GiveTatlToPlayer(play, csCtx, (CsCmdBase*)cutscenePtr); - cutscenePtr += sizeof(CsCmdBase); + CutsceneCmd_GiveTatlToPlayer(play, csCtx, (CsCmdGiveTatl*)script); + script += sizeof(CsCmdGiveTatl); } break; - case -2: + case CS_CMD_ACTOR_CUE_POST_PROCESS: break; default: - bcopy(cutscenePtr, &cmdEntries, sizeof(s32)); - cutscenePtr += sizeof(s32); + bcopy(script, &cmdEntries, sizeof(cmdEntries)); + script += sizeof(cmdEntries); + for (j = 0; j < cmdEntries; j++) { - cutscenePtr += sizeof(CsCmdBase); + script += sizeof(CsCmdUnimplemented); } break; } @@ -1390,120 +1452,125 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc /* End of command handling section */ -void func_800ED980(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutscene >= 0xFFF0) { - csCtx->frames++; - Cutscene_ProcessCommands(play, csCtx, (u8*)play->csCtx.csData); +void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { + if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { + csCtx->curFrame++; + Cutscene_ProcessScript(play, csCtx, (u8*)play->csCtx.script); } } -void func_800ED9C4(PlayState* play, CutsceneContext* csCtx) { - if (func_800EA220(play, csCtx, 0.0f)) { +void CutsceneHandler_StopManual(PlayState* play, CutsceneContext* csCtx) { + if (Cutscene_StepTimer(play, csCtx, 0.0f)) { Audio_SetCutsceneFlag(false); - csCtx->state = CS_STATE_0; + csCtx->state = CS_STATE_IDLE; } } -// unused -void func_800EDA04(PlayState* play, CutsceneContext* csCtx) { - if (func_800EA220(play, csCtx, 0.0f)) { +void CutsceneHandler_StopScript(PlayState* play, CutsceneContext* csCtx) { + if (Cutscene_StepTimer(play, csCtx, 0.0f)) { s16 i; - csCtx->playerAction = NULL; + csCtx->playerCue = NULL; - for (i = 0; i < ARRAY_COUNT(csCtx->actorActions); i++) { - csCtx->actorActions[i] = NULL; + for (i = 0; i < ARRAY_COUNT(csCtx->actorCues); i++) { + csCtx->actorCues[i] = NULL; } - gSaveContext.save.cutscene = 0; + gSaveContext.save.cutsceneIndex = 0; gSaveContext.gameMode = GAMEMODE_NORMAL; - ActorCutscene_Stop(0x7F); + + CutsceneManager_Stop(CS_ID_GLOBAL_END); Audio_SetCutsceneFlag(false); - csCtx->state = CS_STATE_0; + csCtx->state = CS_STATE_IDLE; } } -void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { - if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_0) && !Player_InCsMode(play)) { - gSaveContext.save.cutscene = 0xFFFD; +void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx) { + if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { + gSaveContext.save.cutsceneIndex = 0xFFFD; } - if ((gSaveContext.save.cutscene >= 0xFFF0) && (csCtx->state == CS_STATE_0)) { + if ((gSaveContext.save.cutsceneIndex >= 0xFFF0) && (csCtx->state == CS_STATE_IDLE)) { s16 i; - D_801BB124 = 0; - D_801BB128 = 0; - csCtx->playerAction = NULL; + sCurTextId = 0; + sCurOcarinaAction = 0; + csCtx->playerCue = NULL; - for (i = 0; i < ARRAY_COUNT(csCtx->actorActions); i++) { - csCtx->actorActions[i] = NULL; + for (i = 0; i < ARRAY_COUNT(csCtx->actorCues); i++) { + csCtx->actorCues[i] = NULL; } - csCtx->state++; - if (csCtx->state == CS_STATE_1) { + csCtx->state++; // CS_STATE_START + + if (csCtx->state == CS_STATE_START) { Audio_SetCutsceneFlag(true); - csCtx->frames = 0xFFFF; - csCtx->subCamId = ActorCutscene_GetCurrentSubCamId(0x7F); - func_8016119C(Play_GetCamera(play, csCtx->subCamId), &sCutsceneCameraInfo); - csCtx->unk_18 = 0xFFFF; + csCtx->curFrame = 0xFFFF; + + csCtx->subCamId = CutsceneManager_GetCurrentSubCamId(CS_ID_GLOBAL_END); + CutsceneCamera_Init(Play_GetCamera(play, csCtx->subCamId), &sCutsceneCameraInfo); + + // OoT Remnant + csCtx->camEyeSplinePointsAppliedFrame = CS_CAM_DATA_NOT_APPLIED; if (gSaveContext.cutsceneTrigger == 0) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_Letterbox_SetSizeTarget(32); ShrinkWindow_Letterbox_SetSize(32); - csCtx->state++; + csCtx->state++; // CS_STATE_RUN } - func_800ED980(play, csCtx); + CutsceneHandler_RunScript(play, csCtx); } gSaveContext.cutsceneTrigger = 0; } } -// HandleFlags? -void func_800EDBE0(PlayState* play) { +void Cutscene_HandleEntranceTriggers(PlayState* play) { s32 pad; - s16 sp2A; - SceneTableEntry* sp24; - s32 temp_v0_3; + s16 csId; + SceneTableEntry* scene; + s32 scriptIndex; if (((gSaveContext.gameMode == GAMEMODE_NORMAL) || (gSaveContext.gameMode == GAMEMODE_TITLE_SCREEN)) && (gSaveContext.respawnFlag <= 0)) { - sp2A = func_800F21CC(); - if (sp2A != -1) { - temp_v0_3 = func_800F2138(sp2A); - if (temp_v0_3 != -1) { - if ((play->csCtx.sceneCsList[temp_v0_3].unk7 != 0xFF) && (gSaveContext.respawnFlag == 0)) { - if (play->csCtx.sceneCsList[temp_v0_3].unk7 == 0xFE) { - ActorCutscene_Start(sp2A, NULL); + // Try to find an actor cutscene that's triggered by the current spawn + csId = CutsceneManager_FindEntranceCsId(); + if (csId != CS_ID_NONE) { + scriptIndex = CutsceneManager_GetCutsceneScriptIndex(csId); + if (scriptIndex != CS_SCRIPT_ID_NONE) { + // A scripted cutscene is triggered by a spawn + if ((play->csCtx.scriptList[scriptIndex].spawnFlags != CS_SPAWN_FLAG_NONE) && + (gSaveContext.respawnFlag == 0)) { + if (play->csCtx.scriptList[scriptIndex].spawnFlags == CS_SPAWN_FLAG_ALWAYS) { + // Entrance cutscenes that always run + CutsceneManager_Start(csId, NULL); gSaveContext.showTitleCard = false; - } else if (!(((void)0, gSaveContext.save.saveInfo - .weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) & - (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)))) { - // TODO: macros for this kind of weekEventReg access - gSaveContext.save.saveInfo.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)] = - ((void)0, - gSaveContext.save.saveInfo.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) | - (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)); - ActorCutscene_Start(sp2A, NULL); + + } else if (!CHECK_CS_SPAWN_FLAG_WEEKEVENTREG(play->csCtx.scriptList[scriptIndex].spawnFlags)) { + // Entrance cutscenes that only run once + SET_CS_SPAWN_FLAG_WEEKEVENTREG(play->csCtx.scriptList[scriptIndex].spawnFlags); + CutsceneManager_Start(csId, NULL); + // The title card will be used by the cs misc command if necessary. gSaveContext.showTitleCard = false; } } } else { - ActorCutscene_StartAndSetUnkLinkFields(sp2A, NULL); + // A non-scripted cutscene is triggered by a spawn + CutsceneManager_StartWithPlayerCs(csId, NULL); } } } if ((gSaveContext.respawnFlag == 0) || (gSaveContext.respawnFlag == -2)) { - sp24 = play->loadedScene; - if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) { + scene = play->loadedScene; + if ((scene->titleTextId != 0) && gSaveContext.showTitleCard) { if ((Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneLayer)) & 0x4000) != 0) { - func_80151A68(play, sp24->titleTextId); + func_80151A68(play, scene->titleTextId); } } @@ -1517,10 +1584,10 @@ void func_800EDDB0(PlayState* play) { void func_800EDDBC(UNK_TYPE arg0, UNK_TYPE arg1) { } -void Cutscene_LoadCutsceneData(PlayState* play, u8 csIndex) { - if (dREG(95) == 0) { - play->csCtx.currentCsIndex = csIndex; - play->csCtx.csData = Lib_SegmentedToVirtual(play->csCtx.sceneCsList[csIndex].segmentedData); +void Cutscene_StartScripted(PlayState* play, u8 scriptIndex) { + if (!R_USE_DEBUG_CUTSCENE) { + play->csCtx.scriptIndex = scriptIndex; + play->csCtx.script = Lib_SegmentedToVirtual(play->csCtx.scriptList[scriptIndex].script); } gSaveContext.cutsceneTrigger = 1; @@ -1532,32 +1599,32 @@ void Cutscene_LoadCutsceneData(PlayState* play, u8 csIndex) { * Interpolates the actor's position based on the corresponding actor action's position * and the current cutscene frame */ -void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 actorActionIndex) { - Vec3f start; - Vec3f end; - CsCmdActorAction* entry = play->csCtx.actorActions[actorActionIndex]; - f32 progress; +void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 cueChannel) { + Vec3f startPos; + Vec3f endPos; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + f32 lerp; - start.x = entry->startPos.x; - start.y = entry->startPos.y; - start.z = entry->startPos.z; - end.x = entry->endPos.x; - end.y = entry->endPos.y; - end.z = entry->endPos.z; + startPos.x = cue->startPos.x; + startPos.y = cue->startPos.y; + startPos.z = cue->startPos.z; + endPos.x = cue->endPos.x; + endPos.y = cue->endPos.y; + endPos.z = cue->endPos.z; - progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, play->csCtx.frames); + lerp = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); - VEC3F_LERPIMPDST(&actor->world.pos, &start, &end, progress); + VEC3F_LERPIMPDST(&actor->world.pos, &startPos, &endPos, lerp); } /** * Interpolates the actor's position based on the corresponding actor action's position * and the current cutscene frame, and sets the actor's yaw using the actor action yaw */ -void Cutscene_ActorTranslateAndYaw(Actor* actor, PlayState* play, s32 actorActionIndex) { - Cutscene_ActorTranslate(actor, play, actorActionIndex); +void Cutscene_ActorTranslateAndYaw(Actor* actor, PlayState* play, s32 cueChannel) { + Cutscene_ActorTranslate(actor, play, cueChannel); - actor->world.rot.y = play->csCtx.actorActions[actorActionIndex]->urot.y; + actor->world.rot.y = play->csCtx.actorCues[cueChannel]->rot.y; actor->shape.rot.y = actor->world.rot.y; } @@ -1565,25 +1632,25 @@ void Cutscene_ActorTranslateAndYaw(Actor* actor, PlayState* play, s32 actorActio * Interpolates the actor's position and yaw based on the corresponding actor action's * position and the current cutscene frame */ -void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex) { - Vec3f start; - Vec3f end; - CsCmdActorAction* entry; - f32 progress; +void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, PlayState* play, s32 cueChannel) { + Vec3f startPos; + Vec3f endPos; + CsCmdActorCue* cue; + f32 lerp; - start.x = play->csCtx.actorActions[actorActionIndex]->startPos.x; - start.y = play->csCtx.actorActions[actorActionIndex]->startPos.y; - start.z = play->csCtx.actorActions[actorActionIndex]->startPos.z; - end.x = play->csCtx.actorActions[actorActionIndex]->endPos.x; - end.y = play->csCtx.actorActions[actorActionIndex]->endPos.y; - end.z = play->csCtx.actorActions[actorActionIndex]->endPos.z; + startPos.x = play->csCtx.actorCues[cueChannel]->startPos.x; + startPos.y = play->csCtx.actorCues[cueChannel]->startPos.y; + startPos.z = play->csCtx.actorCues[cueChannel]->startPos.z; + endPos.x = play->csCtx.actorCues[cueChannel]->endPos.x; + endPos.y = play->csCtx.actorCues[cueChannel]->endPos.y; + endPos.z = play->csCtx.actorCues[cueChannel]->endPos.z; - entry = play->csCtx.actorActions[actorActionIndex]; - progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, play->csCtx.frames); + cue = play->csCtx.actorCues[cueChannel]; + lerp = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); - VEC3F_LERPIMPDST(&actor->world.pos, &start, &end, progress); + VEC3F_LERPIMPDST(&actor->world.pos, &startPos, &endPos, lerp); - Math_SmoothStepToS(&actor->world.rot.y, Math_Vec3f_Yaw(&start, &end), 10, 1000, 1); + Math_SmoothStepToS(&actor->world.rot.y, Math_Vec3f_Yaw(&startPos, &endPos), 10, 1000, 1); actor->shape.rot.y = actor->world.rot.y; } @@ -1591,24 +1658,24 @@ void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, PlayState* play, s32 acto * Interpolates the actor's XZ position and yaw based on the corresponding actor action's * position and the current cutscene frame */ -void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex) { - Vec3f start; - Vec3f end; - CsCmdActorAction* entry; - f32 progress; +void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 cueChannel) { + Vec3f startPos; + Vec3f endPos; + CsCmdActorCue* cue; + f32 lerp; - start.x = play->csCtx.actorActions[actorActionIndex]->startPos.x; - start.z = play->csCtx.actorActions[actorActionIndex]->startPos.z; - end.x = play->csCtx.actorActions[actorActionIndex]->endPos.x; - end.z = play->csCtx.actorActions[actorActionIndex]->endPos.z; + startPos.x = play->csCtx.actorCues[cueChannel]->startPos.x; + startPos.z = play->csCtx.actorCues[cueChannel]->startPos.z; + endPos.x = play->csCtx.actorCues[cueChannel]->endPos.x; + endPos.z = play->csCtx.actorCues[cueChannel]->endPos.z; - entry = play->csCtx.actorActions[actorActionIndex]; - progress = Environment_LerpWeight(entry->endFrame, entry->startFrame, play->csCtx.frames); + cue = play->csCtx.actorCues[cueChannel]; + lerp = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); - actor->world.pos.x = start.x + (end.x - start.x) * progress; - actor->world.pos.z = start.z + (end.z - start.z) * progress; + actor->world.pos.x = startPos.x + (endPos.x - startPos.x) * lerp; + actor->world.pos.z = startPos.z + (endPos.z - startPos.z) * lerp; - Math_SmoothStepToS(&actor->world.rot.y, Math_Vec3f_Yaw(&start, &end), 10, 1000, 1); + Math_SmoothStepToS(&actor->world.rot.y, Math_Vec3f_Yaw(&startPos, &endPos), 10, 1000, 1); actor->shape.rot.y = actor->world.rot.y; } @@ -1621,25 +1688,35 @@ s32 Cutscene_GetSceneLayer(PlayState* play) { return sceneLayer; } -s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd) { +/** + * @param play See `PlayState` + * @param cueType See `cmdType` + * @return cue channel + */ +s32 Cutscene_GetCueChannel(PlayState* play, u16 cueType) { s32 i; - s32 index = -1; + s32 cueChannel = -1; - for (i = 0; i < ARRAY_COUNT(D_801F4DC8); i++) { - if (actorActionCmd == D_801F4DC8[i]) { - index = i; + for (i = 0; i < ARRAY_COUNT(sCueTypeList); i++) { + if (cueType == sCueTypeList[i]) { + cueChannel = i; } } - return index; + return cueChannel; } -s32 Cutscene_CheckActorAction(PlayState* play, u16 actorActionCmd) { - if (play->csCtx.state != CS_STATE_0) { - s32 index = Cutscene_GetActorActionIndex(play, actorActionCmd); +/** + * @param play See `PlayState` + * @param cueType See `cmdType` + * @return is cuetype in a channel + */ +s32 Cutscene_IsCueInChannel(PlayState* play, u16 cueType) { + if (play->csCtx.state != CS_STATE_IDLE) { + s32 cueChannel = Cutscene_GetCueChannel(play, cueType); - if (index != -1) { - return play->csCtx.actorActions[index] != NULL; + if (cueChannel != -1) { + return play->csCtx.actorCues[cueChannel] != NULL; } } @@ -1647,7 +1724,7 @@ s32 Cutscene_CheckActorAction(PlayState* play, u16 actorActionCmd) { } u8 Cutscene_IsPlaying(PlayState* play) { - return (gSaveContext.cutsceneTrigger != 0) || (play->csCtx.state != CS_STATE_0); + return (gSaveContext.cutsceneTrigger != 0) || (play->csCtx.state != CS_STATE_IDLE); } /* End of actor utilities section */ diff --git a/src/code/z_env_flags.c b/src/code/z_env_flags.c index 06e216cd3..0057128e2 100644 --- a/src/code/z_env_flags.c +++ b/src/code/z_env_flags.c @@ -1,33 +1,33 @@ #include "global.h" -void EnvFlags_UnsetAll(PlayState* play) { +void CutsceneFlags_UnsetAll(PlayState* play) { u8 i; - for (i = 0; i < ARRAY_COUNT(play->envFlags); i++) { - play->envFlags[i] = 0; + for (i = 0; i < ARRAY_COUNT(play->cutsceneFlags); i++) { + play->cutsceneFlags[i] = 0; } } -void EnvFlags_Set(PlayState* play, s16 flag) { +void CutsceneFlags_Set(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = 1 << bit; - play->envFlags[index] |= mask; + play->cutsceneFlags[index] |= mask; } -void EnvFlags_Unset(PlayState* play, s16 flag) { +void CutsceneFlags_Unset(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = (1 << bit) ^ 0xFFFF; - play->envFlags[index] &= mask; + play->cutsceneFlags[index] &= mask; } -s32 EnvFlags_Get(PlayState* play, s16 flag) { +s32 CutsceneFlags_Get(PlayState* play, s16 flag) { s16 index = flag / 16; s16 bit = flag % 16; s16 mask = 1 << bit; - return play->envFlags[index] & mask; + return play->cutsceneFlags[index] & mask; } diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index 5b8b8dce3..2575899ca 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -1,52 +1,554 @@ +/** + * @file z_eventmgr.c + * + * Manages all cutscenes except for manual + */ #include "global.h" #include "z64shrink_window.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F1460.s") +ActorCutscene sGlobalCutsceneList[] = { + // CS_ID_GLOBAL_78 + { -100, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, 255, + 255 }, + // CS_ID_GLOBAL_79 + { -100, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, 255, + 255 }, + // CS_ID_GLOBAL_7A + { -100, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, 255, + 255 }, + // CS_ID_GLOBAL_ELEGY + { 2, -1, CS_CAM_ID_GLOBAL_ELEGY, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_NONE, + CS_END_CAM_0, 32 }, + // CS_ID_GLOBAL_TALK + { 32765, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, + CS_END_CAM_0, 255 }, + // CS_ID_GLOBAL_DOOR + { 32764, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE_ALT, 255, CS_HUD_VISIBILITY_ALL_ALT, + CS_END_CAM_0, 255 }, + // CS_ID_GLOBAL_RETURN_TO_CAM + { 32766, -2, CS_CAM_ID_GLOBAL_CONNECT, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE, 255, + CS_HUD_VISIBILITY_ALL_ALT, CS_END_CAM_0, 32 }, + // CS_ID_GLOBAL_END + { 0, -1, CS_CAM_ID_NONE, CS_SCRIPT_ID_NONE, CS_ID_NONE, CS_END_SFX_NONE, 255, CS_HUD_VISIBILITY_ALL_ALT, + CS_END_CAM_0, 32 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCutsceneImpl.s") +typedef enum { + /* 0 */ CS_START_0, + /* 1 */ CS_START_1, + /* 2 */ CS_START_2, +} ActorCutsceneStartMethod; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Init.s") +typedef struct { + /* 0x00 */ s16 csId; + /* 0x02 */ s16 length; + /* 0x04 */ s16 endCsId; + /* 0x06 */ s16 subCamId; + /* 0x08 */ Actor* targetActor; + /* 0x0C */ s32 startMethod; + /* 0x10 */ PlayState* play; + /* 0x14 */ s16 retCamId; + /* 0x16 */ s16 isCameraStored; +} CutsceneManager; // size = 0x18 -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F15D8.s") +CutsceneManager sCutsceneMgr = { + CS_ID_NONE, 0, CS_ID_NONE, SUB_CAM_ID_DONE, NULL, CS_START_0, NULL, CAM_ID_MAIN, false, +}; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_ClearWaiting.s") +s16 CutsceneManager_SetHudVisibility(s16 csHudVisibility) { + u16 hudVisibility; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_ClearNextCutscenes.s") + switch (csHudVisibility) { + case CS_HUD_VISIBILITY_NONE: + hudVisibility = HUD_VISIBILITY_NONE_ALT; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_MarkNextCutscenes.s") + case CS_HUD_VISIBILITY_ALL: + hudVisibility = HUD_VISIBILITY_ALL; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_End.s") + case CS_HUD_VISIBILITY_A_HEARTS_MAGIC: + hudVisibility = HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Update.s") + case CS_HUD_VISIBILITY_C_HEARTS_MAGIC: + hudVisibility = HUD_VISIBILITY_HEARTS_MAGIC_C; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_SetIntentToPlay.s") + case CS_HUD_VISIBILITY_ALL_NO_MINIMAP: + hudVisibility = HUD_VISIBILITY_ALL_NO_MINIMAP; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCanPlayNext.s") + case CS_HUD_VISIBILITY_A_B_C: + hudVisibility = HUD_VISIBILITY_A_B_C; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_StartAndSetUnkLinkFields.s") + case CS_HUD_VISIBILITY_B_MINIMAP: + hudVisibility = HUD_VISIBILITY_B_MINIMAP; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_StartAndSetFlag.s") + case CS_HUD_VISIBILITY_A: + hudVisibility = HUD_VISIBILITY_A; + break; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Start.s") + default: + hudVisibility = HUD_VISIBILITY_ALL; + break; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_Stop.s") + Interface_SetHudVisibility(hudVisibility); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentIndex.s") + return hudVisibility; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCutscene.s") +ActorCutscene* CutsceneManager_GetCutsceneEntryImpl(s16 csId) { + if (csId < CS_ID_GLOBAL_78) { + return &sSceneCutsceneList[csId]; + } else { + csId -= CS_ID_GLOBAL_78; + return &sGlobalCutsceneList[csId]; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetAdditionalCutscene.s") +void CutsceneManager_Init(PlayState* play, ActorCutscene* cutsceneList, s16 numEntries) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetLength.s") + sSceneCutsceneList = cutsceneList; + sSceneCutsceneCount = numEntries; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F2138.s") + for (i = 0; i < ARRAY_COUNT(sWaitingCutsceneList); i++) { + sWaitingCutsceneList[i] = 0; + sNextCutsceneList[i] = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F2178.s") + sCutsceneMgr.endCsId = CS_ID_NONE; + sCutsceneMgr.play = play; + sCutsceneMgr.length = -1; + sCutsceneMgr.targetActor = NULL; + sCutsceneMgr.subCamId = SUB_CAM_ID_DONE; + sCutsceneMgr.isCameraStored = false; + sCutsceneMgr.csId = sCutsceneMgr.endCsId; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentSubCamId.s") +/** + * Store camera into subCam 2, and keep subCam 2 INACTIVE to preserve the struct. + */ +void CutsceneManager_StoreCamera(Camera* camera) { + if (camera != NULL) { + memcpy(&sCutsceneMgr.play->subCameras[2], camera, sizeof(Camera)); + sCutsceneMgr.play->subCameras[2].camId = camera->camId; + Camera_ChangeStatus(&sCutsceneMgr.play->subCameras[2], CAM_STATUS_INACTIVE); + sCutsceneMgr.isCameraStored = true; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F21CC.s") +void CutsceneManager_ClearWaiting(void) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F22C4.s") + for (i = 0; i < ARRAY_COUNT(sWaitingCutsceneList); i++) { + sWaitingCutsceneList[i] = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/ActorCutscene_SetReturnCamera.s") +void CutsceneManager_ClearNextCutscenes(void) { + s32 i; + + for (i = 0; i < ARRAY_COUNT(sNextCutsceneList); i++) { + sNextCutsceneList[i] = 0; + } +} + +s16 CutsceneManager_MarkNextCutscenes(void) { + s16 bit; + s32 i; + s32 j; + s32 count = 0; + s16 csIdMax = CS_ID_NONE; + s16 priorityMax = SHT_MAX; // lower number means higher priority + s16 csId; + s16 priority; + + for (i = 0; i < ARRAY_COUNT(sNextCutsceneList); i++) { + for (bit = 1, j = 0; j < 8; j++) { + if (sWaitingCutsceneList[i] & bit) { + csId = (i << 3) | j; + priority = CutsceneManager_GetCutsceneEntryImpl(csId)->priority; + + if ((priority ^ 0) == -1) { + sNextCutsceneList[i] |= bit; + } else if ((priority < priorityMax) && (priority > 0)) { + csIdMax = csId; + priorityMax = priority; + } + count++; + } + bit <<= 1; + } + } + if (csIdMax != CS_ID_NONE) { + sNextCutsceneList[csIdMax >> 3] |= 1 << (csIdMax & 7); + } + return count; +} + +#define RET_CAM sCutsceneMgr.play->cameraPtrs[sCutsceneMgr.retCamId] +#define CUR_CAM sCutsceneMgr.play->cameraPtrs[sCutsceneMgr.subCamId] + +void CutsceneManager_End(void) { + ActorCutscene* csEntry; + s16 oldCamId; + s16 oldStateFlags; + + switch (sCutsceneMgr.startMethod) { + case CS_START_2: + sCutsceneMgr.targetActor->flags &= ~ACTOR_FLAG_100000; + // fallthrough + case CS_START_1: + func_800B7298(sCutsceneMgr.play, 0, PLAYER_CSMODE_END); + sCutsceneMgr.startMethod = CS_START_0; + break; + + default: + break; + } + + csEntry = CutsceneManager_GetCutsceneEntryImpl(sCutsceneMgr.csId); + + switch (csEntry->endSfx) { + case CS_END_SFX_TRE_BOX_APPEAR: + play_sound(NA_SE_SY_TRE_BOX_APPEAR); + break; + + case CS_END_SFX_CORRECT_CHIME: + play_sound(NA_SE_SY_CORRECT_CHIME); + break; + + default: // CS_END_SFX_NONE + break; + } + + switch (csEntry->endCam) { + case CS_END_CAM_SMOOTH: + Play_CopyCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId, sCutsceneMgr.subCamId); + RET_CAM->stateFlags = + (RET_CAM->stateFlags & ~CAM_STATE_UNDERWATER) | (CUR_CAM->stateFlags & CAM_STATE_UNDERWATER); + CutsceneManager_Queue(CS_ID_GLOBAL_RETURN_TO_CAM); + break; + + case CS_END_CAM_0: + default: + Play_CopyCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId, sCutsceneMgr.subCamId); + RET_CAM->stateFlags = + (RET_CAM->stateFlags & ~CAM_STATE_UNDERWATER) | (CUR_CAM->stateFlags & CAM_STATE_UNDERWATER); + break; + + case CS_END_CAM_1: + oldCamId = RET_CAM->camId; + oldStateFlags = RET_CAM->stateFlags; + + if (sCutsceneMgr.isCameraStored) { + // Restore the camera that was stored in subCam 2 + memcpy(RET_CAM, &sCutsceneMgr.play->subCameras[2], sizeof(Camera)); + + RET_CAM->stateFlags = + (RET_CAM->stateFlags & ~CAM_STATE_UNDERWATER) | (CUR_CAM->stateFlags & CAM_STATE_UNDERWATER); + + RET_CAM->stateFlags = (RET_CAM->stateFlags & ~CAM_STATE_2) | (oldStateFlags & CAM_STATE_2); + sCutsceneMgr.isCameraStored = false; + } + RET_CAM->camId = oldCamId; + break; + } + + if (sCutsceneMgr.subCamId != SUB_CAM_ID_DONE) { + Play_ClearCamera(sCutsceneMgr.play, sCutsceneMgr.subCamId); + Play_ChangeCameraStatus(sCutsceneMgr.play, sCutsceneMgr.retCamId, CAM_STATUS_ACTIVE); + } + + sCutsceneMgr.csId = CS_ID_NONE; + sCutsceneMgr.endCsId = CS_ID_NONE; + sCutsceneMgr.length = -1; + sCutsceneMgr.targetActor = NULL; + sCutsceneMgr.subCamId = SUB_CAM_ID_DONE; +} + +s16 CutsceneManager_Update(void) { + s16 sp1E = 0; + + if (CutsceneManager_IsNext(CS_ID_GLOBAL_RETURN_TO_CAM)) { + CutsceneManager_StartWithPlayerCs(CS_ID_GLOBAL_RETURN_TO_CAM, &GET_PLAYER(sCutsceneMgr.play)->actor); + } + + if (sCutsceneMgr.endCsId == CS_ID_NONE) { + if (sCutsceneMgr.csId != CS_ID_NONE) { + if (sCutsceneMgr.length > 0) { + sCutsceneMgr.length--; + } + sp1E = 1; + if (sCutsceneMgr.length == 0) { + CutsceneManager_Stop(sCutsceneMgr.csId); + } + } + } + + if (sCutsceneMgr.endCsId != CS_ID_NONE) { + CutsceneManager_End(); + sp1E = 2; + } + + CutsceneManager_ClearNextCutscenes(); + + if (sCutsceneMgr.csId == CS_ID_NONE) { + if ((CutsceneManager_MarkNextCutscenes() == 0) && (sp1E != 0)) { + ShrinkWindow_Letterbox_SetSizeTarget(0); + } else if (sp1E == 0) { + CutsceneManager_StoreCamera(Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId)); + } + } + return sp1E; +} + +void CutsceneManager_Queue(s16 csId) { + if (csId >= 0) { + sWaitingCutsceneList[csId >> 3] |= 1 << (csId & 7); + } +} + +s16 CutsceneManager_IsNext(s16 csId) { + if (csId == CS_ID_GLOBAL_END) { + if (sCutsceneMgr.csId == CS_ID_NONE) { + return 0x7F; + } else { + return 0; + } + } + if (csId <= CS_ID_NONE) { + return -1; + } + return (sNextCutsceneList[csId >> 3] & (1 << (csId & 7))) ? 1 : 0; +} + +/** + * Start an actor cutscene, activate Player Cutscene Mode "Wait" + */ +s16 CutsceneManager_StartWithPlayerCs(s16 csId, Actor* actor) { + s16 startCsId = CutsceneManager_Start(csId, actor); + + if (startCsId >= 0) { + func_800B7298(sCutsceneMgr.play, 0, PLAYER_CSMODE_WAIT); + if (sCutsceneMgr.length == 0) { + CutsceneManager_Stop(sCutsceneMgr.csId); + } + sCutsceneMgr.startMethod = CS_START_1; + } + return startCsId; +} + +/** + * Start an actor cutscene, activate Player Cutscene Mode "Wait", turn on ACTOR_FLAG_100000 + */ +s16 CutsceneManager_StartWithPlayerCsAndSetFlag(s16 csId, Actor* actor) { + s16 startCsId = CutsceneManager_Start(csId, actor); + + if (startCsId >= 0) { + func_800B7298(sCutsceneMgr.play, 0, PLAYER_CSMODE_WAIT); + if (sCutsceneMgr.length == 0) { + CutsceneManager_Stop(sCutsceneMgr.csId); + } + if (actor != NULL) { + actor->flags |= ACTOR_FLAG_100000; + sCutsceneMgr.startMethod = CS_START_2; + } else { + sCutsceneMgr.startMethod = CS_START_1; + } + } + return startCsId; +} + +s16 CutsceneManager_Start(s16 csId, Actor* actor) { + ActorCutscene* csEntry; + Camera* subCam; + Camera* retCam; + s32 csType = 0; + + if ((csId < 0) || (sCutsceneMgr.csId != CS_ID_NONE)) { + return csId; + } + + sCutsceneMgr.startMethod = CS_START_0; + csEntry = CutsceneManager_GetCutsceneEntryImpl(csId); + + ShrinkWindow_Letterbox_SetSizeTarget(csEntry->letterboxSize); + CutsceneManager_SetHudVisibility(csEntry->hudVisibility); + + if (csId == CS_ID_GLOBAL_END) { + csType = 1; + } else if (csEntry->scriptIndex != CS_SCRIPT_ID_NONE) { + // scripted cutscene + csType = 1; + } else if ((csId != CS_ID_GLOBAL_DOOR) && (csId != CS_ID_GLOBAL_TALK)) { + csType = 2; + } + + if (csType != 0) { + sCutsceneMgr.retCamId = Play_GetActiveCamId(sCutsceneMgr.play); + sCutsceneMgr.subCamId = Play_CreateSubCamera(sCutsceneMgr.play); + + subCam = Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.subCamId); + retCam = Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.retCamId); + + if ((retCam->setting == CAM_SET_START0) || (retCam->setting == CAM_SET_START2) || + (retCam->setting == CAM_SET_START1)) { + if (CutsceneManager_FindEntranceCsId() != csId) { + func_800E0348(retCam); + } else { + Camera_ClearFlags(retCam, CAM_STATE_2); + } + } + + memcpy(subCam, retCam, sizeof(Camera)); + subCam->camId = sCutsceneMgr.subCamId; + Camera_ClearFlags(subCam, CAM_STATE_6 | CAM_STATE_0); + + Play_ChangeCameraStatus(sCutsceneMgr.play, sCutsceneMgr.retCamId, CAM_STATUS_WAIT); + Play_ChangeCameraStatus(sCutsceneMgr.play, sCutsceneMgr.subCamId, CAM_STATUS_ACTIVE); + + subCam->target = sCutsceneMgr.targetActor = actor; + subCam->behaviorFlags = 0; + + if (csType == 1) { + Camera_ChangeSetting(subCam, CAM_SET_FREE0); + Cutscene_StartScripted(sCutsceneMgr.play, csEntry->scriptIndex); + sCutsceneMgr.length = csEntry->length; + } else { + if (csEntry->csCamId != CS_CAM_ID_NONE) { + Camera_ChangeDataIdx(subCam, csEntry->csCamId); + } else { + Camera_ChangeSetting(subCam, CAM_SET_FREE0); + } + sCutsceneMgr.length = csEntry->length; + } + } + sCutsceneMgr.csId = csId; + + return csId; +} + +s16 CutsceneManager_Stop(s16 csId) { + ActorCutscene* csEntry; + + if (csId < 0) { + return csId; + } + + csEntry = CutsceneManager_GetCutsceneEntryImpl(sCutsceneMgr.csId); + if ((sCutsceneMgr.length > 0) && (csEntry->scriptIndex == CS_SCRIPT_ID_NONE)) { + return -2; + } + if ((csId != CS_ID_GLOBAL_END) && (csEntry->scriptIndex != CS_SCRIPT_ID_NONE)) { + return -3; + } + + if (csId == CS_ID_GLOBAL_END) { + csId = sCutsceneMgr.csId; + } + if (csId == sCutsceneMgr.csId) { + sCutsceneMgr.endCsId = sCutsceneMgr.csId; + return sCutsceneMgr.endCsId; + } + return -1; +} + +s16 CutsceneManager_GetCurrentCsId(void) { + return sCutsceneMgr.csId; +} + +ActorCutscene* CutsceneManager_GetCutsceneEntry(s16 csId) { + return CutsceneManager_GetCutsceneEntryImpl(csId); +} + +s16 CutsceneManager_GetAdditionalCsId(s16 csId) { + if (csId < 0) { + return CS_ID_NONE; + } + return CutsceneManager_GetCutsceneEntryImpl(csId)->additionalCsId; +} + +s16 CutsceneManager_GetLength(s16 csId) { + if (csId < 0) { + return -1; + } + return CutsceneManager_GetCutsceneEntryImpl(csId)->length; +} + +s16 CutsceneManager_GetCutsceneScriptIndex(s16 csId) { + if (csId < 0) { + return -1; + } + return CutsceneManager_GetCutsceneEntryImpl(csId)->scriptIndex; +} + +s16 CutsceneManager_GetCutsceneCustomValue(s16 csId) { + if (csId < 0) { + return -1; + } + return CutsceneManager_GetCutsceneEntryImpl(csId)->customValue; +} + +s16 CutsceneManager_GetCurrentSubCamId(s16 csId) { + return sCutsceneMgr.subCamId; +} + +s16 CutsceneManager_FindEntranceCsId(void) { + PlayState* play; + s32 csId; + + for (csId = 0; csId < sSceneCutsceneCount; csId++) { + //! FAKE: + if ((sSceneCutsceneList[csId].scriptIndex != CS_SCRIPT_ID_NONE) && + (sSceneCutsceneList[csId].scriptIndex < (play = sCutsceneMgr.play)->csCtx.scriptListCount) && + (sCutsceneMgr.play->curSpawn == + sCutsceneMgr.play->csCtx.scriptList[sSceneCutsceneList[csId].scriptIndex].spawn)) { + return csId; + } + } + + for (csId = 0; csId < sSceneCutsceneCount; csId++) { + if ((sSceneCutsceneList[csId].customValue >= 100) && + (sSceneCutsceneList[csId].customValue == (sCutsceneMgr.play->curSpawn + 100))) { + return csId; + } + } + + return -1; +} + +s32 func_800F22C4(s16 csId, Actor* actor) { + f32 dist; + s16 screenPosX; + s16 screenPosY; + + if ((sCutsceneMgr.csId == CS_ID_NONE) || (csId == CS_ID_NONE)) { + return 4; + } + + Actor_GetScreenPos(sCutsceneMgr.play, actor, &screenPosX, &screenPosY); + + dist = OLib_Vec3fDist(&actor->focus.pos, &Play_GetCamera(sCutsceneMgr.play, sCutsceneMgr.subCamId)->eye); + + if ((screenPosX > 40) && (screenPosX < SCREEN_WIDTH - 40) && (screenPosY > 40) && + (screenPosY < SCREEN_HEIGHT - 40) && (dist < 700.0f)) { + return 1; + } + if (sCutsceneMgr.length < 6) { + return 2; + } + if (csId == sCutsceneMgr.csId) { + return 0; + } + return 3; +} + +void CutsceneManager_SetReturnCamera(s16 camId) { + sCutsceneMgr.retCamId = camId; +} diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index f873ea8ff..148aad84e 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -92,7 +92,7 @@ void KaleidoSetup_Update(PlayState* play) { if ((pauseCtx->state == PAUSE_STATE_OFF) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { - if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) { + if ((gSaveContext.save.cutsceneIndex < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) { if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) { if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 1072587af..88b8f14cc 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1990,7 +1990,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { } if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { - if (ActorCutscene_GetCurrentIndex() == -1) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } } @@ -2267,7 +2267,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { s32 pad; s32 restoreHudVisibility = false; - if (gSaveContext.save.cutscene < 0xFFF0) { + if (gSaveContext.save.cutsceneIndex < 0xFFF0) { gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || (!(CHECK_EVENTINF(EVENTINF_41)) && (play->unk_1887C >= 2))) { @@ -2434,7 +2434,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { sPictoState = PICTO_BOX_STATE_OFF; } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || (func_801A5100() == 1)) { if (!(CHECK_EVENTINF(EVENTINF_41)) || - ((CHECK_EVENTINF(EVENTINF_41)) && (ActorCutscene_GetCurrentIndex() == -1))) { + ((CHECK_EVENTINF(EVENTINF_41)) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) { play_sound(NA_SE_SY_CAMERA_SHUTTER); SREG(89) = 1; play->haltAllActors = true; diff --git a/src/code/z_play.c b/src/code/z_play.c index 99073fb5c..bd4db8fec 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -567,11 +567,13 @@ void Play_UpdateTransition(PlayState* this) { if ((!(Entrance_GetTransitionFlags(this->nextEntrance + sceneLayer) & 0x8000) || ((this->nextEntrance == ENTRANCE(PATH_TO_MOUNTAIN_VILLAGE, 1)) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) || + !CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) || ((this->nextEntrance == ENTRANCE(ROAD_TO_SOUTHERN_SWAMP, 1)) && - !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) || - ((this->nextEntrance == ENTRANCE(TERMINA_FIELD, 2)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) || - ((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20))) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) || + ((this->nextEntrance == ENTRANCE(TERMINA_FIELD, 2)) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) || + ((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE))) && (!func_800FE590(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) || (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) { func_801A4058(20); @@ -983,8 +985,8 @@ void Play_UpdateMain(PlayState* this) { if (!this->haltAllActors) { Actor_UpdateAll(this, &this->actorCtx); } - Cutscene_Update1(this, &this->csCtx); - Cutscene_Update2(this, &this->csCtx); + Cutscene_UpdateManual(this, &this->csCtx); + Cutscene_UpdateScripted(this, &this->csCtx); Effect_UpdateAll(this); EffectSS_UpdateAllParticles(this); EffFootmark_Update(this); @@ -1502,8 +1504,8 @@ void Play_Main(GameState* thisx) { *CONTROLLER1(&this->state) = input; } - ActorCutscene_Update(); - ActorCutscene_ClearWaiting(); + CutsceneManager_Update(); + CutsceneManager_ClearWaiting(); } s32 Play_InCsMode(PlayState* this) { @@ -2016,37 +2018,47 @@ s32 Play_IsDebugCamEnabled(void) { return gDbgCamEnabled; } -// A mapping from playerActorCsIds to sGlobalCamDataSettings indices. -s16 D_801D0D64[] = { -3, -2, -4, -5, -7, -11, -8, -9, -6, -16 }; +// A mapping from playerCsIds to sGlobalCamDataSettings indices. +s16 sPlayerCsIdToCsCamId[] = { + CS_CAM_ID_GLOBAL_ITEM_OCARINA, // PLAYER_CS_ID_ITEM_OCARINA + CS_CAM_ID_GLOBAL_ITEM_GET, // PLAYER_CS_ID_ITEM_GET + CS_CAM_ID_GLOBAL_ITEM_BOTTLE, // PLAYER_CS_ID_ITEM_BOTTLE + CS_CAM_ID_GLOBAL_ITEM_SHOW, // PLAYER_CS_ID_ITEM_SHOW + CS_CAM_ID_GLOBAL_WARP_PAD_MOON, // PLAYER_CS_ID_WARP_PAD_MOON + CS_CAM_ID_GLOBAL_MASK_TRANSFORMATION, // PLAYER_CS_ID_MASK_TRANSFORMATION + CS_CAM_ID_GLOBAL_DEATH, // PLAYER_CS_ID_DEATH + CS_CAM_ID_GLOBAL_REVIVE, // PLAYER_CS_ID_REVIVE + CS_CAM_ID_GLOBAL_SONG_WARP, // PLAYER_CS_ID_SONG_WARP + CS_CAM_ID_GLOBAL_WARP_PAD_ENTRANCE, // PLAYER_CS_ID_WARP_PAD_ENTRANCE +}; // Used by Player /** - * Extract the common actor cutscene ids used by Player from the scene and set the actor cutscene ids in - * this->playerActorCsIds. If a playerActorCsId is not present in the scene, then that particular id is set - * to -1. Otherwise, if there is an ActorCutscene where csCamSceneDataId matches the appropriate element of D_801D0D64, - * set the corresponding playerActorCsId (and possibly change its priority for the zeroth one) + * Extract the common cutscene ids used by Player from the scene and set the cutscene ids in this->playerCsIds. + * If a playerCsId is not present in the scene, then that particular id is set to CS_ID_NONE. + * Otherwise, if there is an ActorCutscene where csCamId matches the appropriate element of sPlayerCsIdToCsCamId, + * set the corresponding playerActorCsId (and possibly change its priority for the zeroth one). */ -void Play_AssignPlayerActorCsIdsFromScene(GameState* thisx, s32 startActorCsId) { +void Play_AssignPlayerCsIdsFromScene(GameState* thisx, s32 spawnCsId) { PlayState* this = (PlayState*)thisx; s32 i; - s16* curPlayerActorCsId = this->playerActorCsIds; - s16* phi_s1 = D_801D0D64; + s16* curPlayerCsId = this->playerCsIds; + s16* csCamId = sPlayerCsIdToCsCamId; - for (i = 0; i < ARRAY_COUNT(this->playerActorCsIds); i++, curPlayerActorCsId++, phi_s1++) { - ActorCutscene* actorCutscene; - s32 curActorCsId; + for (i = 0; i < ARRAY_COUNT(this->playerCsIds); i++, curPlayerCsId++, csCamId++) { + ActorCutscene* csEntry; + s32 curCsId; - *curPlayerActorCsId = -1; + *curPlayerCsId = CS_ID_NONE; - for (curActorCsId = startActorCsId; curActorCsId != -1; curActorCsId = actorCutscene->additionalCutscene) { - actorCutscene = ActorCutscene_GetCutscene(curActorCsId); + for (curCsId = spawnCsId; curCsId != CS_ID_NONE; curCsId = csEntry->additionalCsId) { + csEntry = CutsceneManager_GetCutsceneEntry(curCsId); - if (actorCutscene->csCamSceneDataId == *phi_s1) { - if ((actorCutscene->csCamSceneDataId == -3) && - (actorCutscene->priority == 700)) { // override ocarina cs priority - actorCutscene->priority = 550; + if (csEntry->csCamId == *csCamId) { + if ((csEntry->csCamId == CS_CAM_ID_GLOBAL_ITEM_OCARINA) && (csEntry->priority == 700)) { + csEntry->priority = 550; } - *curPlayerActorCsId = curActorCsId; + *curPlayerCsId = curCsId; break; } } @@ -2101,7 +2113,7 @@ void Play_Init(GameState* thisx) { scene = ((void)0, gSaveContext.save.entrance) >> 9; spawn = (((void)0, gSaveContext.save.entrance) >> 4) & 0x1F; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { if (scene == ENTR_SCENE_MOUNTAIN_VILLAGE_WINTER) { scene = ENTR_SCENE_MOUNTAIN_VILLAGE_SPRING; } else if (scene == ENTR_SCENE_GORON_VILLAGE_WINTER) { @@ -2115,7 +2127,7 @@ void Play_Init(GameState* thisx) { } } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { if (scene == ENTR_SCENE_SOUTHERN_SWAMP_POISONED) { scene = ENTR_SCENE_SOUTHERN_SWAMP_CLEARED; } else if (scene == ENTR_SCENE_WOODFALL) { @@ -2123,11 +2135,11 @@ void Play_Init(GameState* thisx) { } } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && (scene == ENTR_SCENE_IKANA_CANYON)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) && (scene == ENTR_SCENE_IKANA_CANYON)) { gSaveContext.nextCutsceneIndex = 0xFFF2; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80) && + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE) && ((scene == ENTR_SCENE_GREAT_BAY_COAST) || (scene == ENTR_SCENE_ZORA_CAPE))) { gSaveContext.nextCutsceneIndex = 0xFFF0; } @@ -2179,15 +2191,15 @@ void Play_Init(GameState* thisx) { EffectSS_Init(this, 100); CollisionCheck_InitContext(this, &this->colChkCtx); AnimationContext_Reset(&this->animationCtx); - Cutscene_Init(this, &this->csCtx); + Cutscene_InitContext(this, &this->csCtx); if (gSaveContext.nextCutsceneIndex != 0xFFEF) { - gSaveContext.save.cutscene = gSaveContext.nextCutsceneIndex; + gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex; gSaveContext.nextCutsceneIndex = 0xFFEF; } - if (gSaveContext.save.cutscene == 0xFFFD) { - gSaveContext.save.cutscene = 0; + if (gSaveContext.save.cutsceneIndex == 0xFFFD) { + gSaveContext.save.cutsceneIndex = 0; } if (gSaveContext.nextDayTime != 0xFFFF) { @@ -2204,13 +2216,13 @@ void Play_Init(GameState* thisx) { func_800EDDB0(this); if (((gSaveContext.gameMode != GAMEMODE_NORMAL) && (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN)) || - (gSaveContext.save.cutscene >= 0xFFF0)) { + (gSaveContext.save.cutsceneIndex >= 0xFFF0)) { gSaveContext.unk_3DC0 = 0; Magic_Reset(this); - gSaveContext.sceneLayer = (gSaveContext.save.cutscene & 0xF) + 1; + gSaveContext.sceneLayer = (gSaveContext.save.cutsceneIndex & 0xF) + 1; // Set saved cutscene to 0 so it doesn't immediately play, but instead let the `CutsceneManager` handle it. - gSaveContext.save.cutscene = 0; + gSaveContext.save.cutsceneIndex = 0; } else { gSaveContext.sceneLayer = 0; } @@ -2296,7 +2308,7 @@ void Play_Init(GameState* thisx) { D_801F6D4C->envColor.g = 0; D_801F6D4C->envColor.b = 0; D_801F6D4C->envColor.a = 0; - EnvFlags_UnsetAll(this); + CutsceneFlags_UnsetAll(this); THA_GetRemaining(&this->state.heap); zAllocSize = THA_GetRemaining(&this->state.heap); zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.heap, zAllocSize); @@ -2319,13 +2331,13 @@ void Play_Init(GameState* thisx) { Camera_ChangeDataIdx(&this->mainCamera, player->actor.params & 0xFF); } - func_800F15D8(&this->mainCamera); + CutsceneManager_StoreCamera(&this->mainCamera); Interface_SetSceneRestrictions(this); func_800FB758(this); gSaveContext.seqId = this->sequenceCtx.seqId; gSaveContext.ambienceId = this->sequenceCtx.ambienceId; AnimationContext_Update(this, &this->animationCtx); - func_800EDBE0(this); + Cutscene_HandleEntranceTriggers(this); gSaveContext.respawnFlag = 0; sBombersNotebookOpen = false; BombersNotebook_Init(&sBombersNotebook); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 4c72496d0..f8b33b853 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -359,9 +359,9 @@ void func_80122F28(Player* player) { PLAYER_STATE1_20000000))) && (!(player->stateFlags2 & PLAYER_STATE2_1))) { if (player->doorType <= PLAYER_DOORTYPE_TALKING) { - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); } else { - ActorCutscene_SetIntentToPlay(0x7D); + CutsceneManager_Queue(CS_ID_GLOBAL_DOOR); } } } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index fc47c9bf7..26dc39507 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -402,7 +402,7 @@ void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; - if ((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutscene < 0xFFF0)) { + if ((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < 0xFFF0)) { gSaveContext.skyboxTime = gSaveContext.save.time; if ((gSaveContext.skyboxTime >= CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(6, 30))) { @@ -470,15 +470,15 @@ void Scene_CommandAltHeaderList(PlayState* play, SceneCmd* cmd) { } } -// SceneTableEntry Header Command 0x17: Cutscene List -void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) { - play->csCtx.sceneCsCount = cmd->cutsceneList.sceneCsCount; - play->csCtx.sceneCsList = Lib_SegmentedToVirtual(cmd->cutsceneList.segment); +// SceneTableEntry Header Command 0x17: Cutscene Script List +void Scene_CommandCutsceneScriptList(PlayState* play, SceneCmd* cmd) { + play->csCtx.scriptListCount = cmd->scriptList.scriptListCount; + play->csCtx.scriptList = Lib_SegmentedToVirtual(cmd->scriptList.segment); } -// SceneTableEntry Header Command 0x1B: Actor Cutscene List -void Scene_CommandActorCutsceneList(PlayState* play, SceneCmd* cmd) { - ActorCutscene_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num); +// SceneTableEntry Header Command 0x1B: Cutscene List +void Scene_CommandCutsceneList(PlayState* play, SceneCmd* cmd) { + CutsceneManager_Init(play, Lib_SegmentedToVirtual(cmd->cutsceneList.segment), cmd->cutsceneList.num); } // SceneTableEntry Header Command 0x1C: Mini Maps @@ -560,11 +560,11 @@ void (*sSceneCmdHandlers[])(PlayState*, SceneCmd*) = { NULL, Scene_CommandSoundSettings, Scene_CommandEchoSetting, - Scene_CommandCutsceneList, + Scene_CommandCutsceneScriptList, Scene_CommandAltHeaderList, Scene_CommandSetRegionVisitedFlag, Scene_CommandAnimatedMaterials, - Scene_CommandActorCutsceneList, + Scene_CommandCutsceneList, Scene_CommandMiniMap, Scene_Command1D, Scene_CommandMiniMapCompassInfo, @@ -601,7 +601,7 @@ u16 Entrance_Create(s32 scene, s32 spawn, s32 layer) { } /** - * Creates an layer 0 entranace from the current entrance and the given spawn. + * Creates an layer 0 entrance from the current entrance and the given spawn. */ u16 Entrance_CreateFromSpawn(s32 spawn) { return Entrance_Create((u32)gSaveContext.save.entrance >> 9, spawn, 0); diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index c269e30f4..c10c1943e 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -939,10 +939,9 @@ void Sram_InitDebugSave(void) { Sram_GenerateRandomSaveFields(); } -// Unused -void func_80144A94(SramContext* sramCtx) { +void Sram_ResetSaveFromMoonCrash(SramContext* sramCtx) { s32 i; - s32 cutscene = gSaveContext.save.cutscene; + s32 cutsceneIndex = gSaveContext.save.cutsceneIndex; bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); @@ -957,7 +956,7 @@ void func_80144A94(SramContext* sramCtx) { D_801C67F0[gSaveContext.fileNum * 2 + 1]); Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save)); } - gSaveContext.save.cutscene = cutscene; + gSaveContext.save.cutsceneIndex = cutsceneIndex; for (i = 0; i < ARRAY_COUNT(gSaveContext.eventInf); i++) { gSaveContext.eventInf[i] = 0; @@ -1067,10 +1066,10 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) { } else { gSaveContext.save.entrance = D_801C6A58[(void)0, gSaveContext.save.owlSaveLocation]; if ((gSaveContext.save.entrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && - CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { gSaveContext.save.entrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10); } else if ((gSaveContext.save.entrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) && - CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { gSaveContext.save.entrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8); } @@ -1532,7 +1531,7 @@ void Sram_InitSave(FileSelectState* fileSelect2, SramContext* sramCtx) { if (gSaveContext.unk_3F3F) { Sram_InitNewSave(); if (fileSelect->unk_24480 == 0) { - gSaveContext.save.cutscene = 0xFFF0; + gSaveContext.save.cutsceneIndex = 0xFFF0; } for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.playerName); phi_v0++) { @@ -1634,7 +1633,7 @@ void Sram_SaveSpecialEnterClockTown(PlayState* play) { * Saves when beating the game, after showing the "Dawn of the New Day" message */ void Sram_SaveSpecialNewDay(PlayState* play) { - s32 cutscene = gSaveContext.save.cutscene; + s32 cutsceneIndex = gSaveContext.save.cutsceneIndex; s32 day; u16 time = gSaveContext.save.time; @@ -1647,7 +1646,7 @@ void Sram_SaveSpecialNewDay(PlayState* play) { gSaveContext.save.day = day; gSaveContext.save.time = time; - gSaveContext.save.cutscene = cutscene; + gSaveContext.save.cutsceneIndex = cutsceneIndex; func_80185F64(play->sramCtx.saveBuf, D_801C67C8[gSaveContext.fileNum * 2], D_801C67F0[gSaveContext.fileNum * 2]); } diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 210d6c36f..a4d95af64 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -1386,48 +1386,53 @@ void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* a *curAnimIndex = nextAnimIndex; } -s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type) { +s32 SubS_StartCutscene(Actor* actor, s16 nextCsId, s16 curCsId, s32 type) { s32 isStarted = false; - if ((curCutscene != -1) && (ActorCutscene_GetCurrentIndex() == curCutscene)) { - ActorCutscene_Stop(curCutscene); - ActorCutscene_SetIntentToPlay(nextCutscene); - } else if (ActorCutscene_GetCanPlayNext(nextCutscene)) { + if ((curCsId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == curCsId)) { + CutsceneManager_Stop(curCsId); + CutsceneManager_Queue(nextCsId); + } else if (CutsceneManager_IsNext(nextCsId)) { switch (type) { - case SUBS_CUTSCENE_SET_UNK_LINK_FIELDS: - ActorCutscene_StartAndSetUnkLinkFields(nextCutscene, actor); + case SUBS_CUTSCENE_WITH_PLAYER: + CutsceneManager_StartWithPlayerCs(nextCsId, actor); break; + case SUBS_CUTSCENE_NORMAL: - ActorCutscene_Start(nextCutscene, actor); + CutsceneManager_Start(nextCsId, actor); break; - case SUBS_CUTSCENE_SET_FLAG: - ActorCutscene_StartAndSetFlag(nextCutscene, actor); + + case SUBS_CUTSCENE_WITH_PLAYER_SET_FLAG: + CutsceneManager_StartWithPlayerCsAndSetFlag(nextCsId, actor); + break; + + default: break; } isStarted = true; } else { - ActorCutscene_SetIntentToPlay(nextCutscene); + CutsceneManager_Queue(nextCsId); } return isStarted; } -s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes) { - s16 cs; +s32 SubS_FillCutscenesList(Actor* actor, s16 csIdList[], s16 numCutscenes) { + s16 csId; s32 i; for (i = 0; i < numCutscenes; i++) { - cutscenes[i] = -1; + csIdList[i] = CS_ID_NONE; } - cs = actor->cutscene; + csId = actor->csId; i = 0; - while (cs != -1) { - // Note: Infinite loop if numCutscenes is less than possible additional cutscenes + while (csId != CS_ID_NONE) { + // Note: Infinite loop if numCutscenes is less than possible additional csIdList if (i < numCutscenes) { - cutscenes[i] = cs; - cs = ActorCutscene_GetAdditionalCutscene(cs); + csIdList[i] = csId; + csId = CutsceneManager_GetAdditionalCsId(csId); i++; } } diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c index a2af1839d..59348962a 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c @@ -113,7 +113,7 @@ void BgAstrBombwall_Init(Actor* thisx, PlayState* play) { return; } BgAstrBombwall_InitCollider(&sTrisInit, &this->dyna.actor.world.pos, &this->dyna.actor.shape.rot, &this->collider); - SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->dyna.actor, this->csIdList, ARRAY_COUNT(this->csIdList)); func_80C0A378(this); } @@ -175,7 +175,7 @@ void func_80C0A400(BgAstrBombwall* this, PlayState* play) { } void func_80C0A418(BgAstrBombwall* this, PlayState* play) { - if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->dyna.actor, this->csIdList[0], CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { func_80C0A458(this, play); } } diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h index 4f42a8b3c..224d94d7a 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.h @@ -13,6 +13,6 @@ typedef struct BgAstrBombwall { /* 0x15C */ BgAstrBombwallActionFunc actionFunc; /* 0x160 */ ColliderTris collider; /* 0x180 */ ColliderTrisElement colliderElements[2]; - /* 0x238 */ s16 cutscenes[1]; + /* 0x238 */ s16 csIdList[1]; } BgAstrBombwall; #endif // Z_BG_ASTR_BOMBWALL_H diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 4c73987ec..b2e59a51b 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -153,7 +153,7 @@ s32 func_808B7380(BgBreakwall* this, PlayState* play) { } s32 func_808B73C4(BgBreakwall* this, PlayState* play) { - return CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_21_01); + return CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE) || CHECK_WEEKEVENTREG(WEEKEVENTREG_21_01); } s32 func_808B73FC(BgBreakwall* this, PlayState* play) { @@ -176,7 +176,7 @@ s32 func_808B7460(BgBreakwall* this, PlayState* play) { } s32 func_808B74A8(BgBreakwall* this, PlayState* play) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { return false; } return true; @@ -285,7 +285,7 @@ void func_808B782C(BgBreakwall* this, PlayState* play) { } void func_808B78A4(BgBreakwall* this, PlayState* play) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c index 5ee73366a..adf9b3c96 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c @@ -163,8 +163,8 @@ void BgCtowerGear_Update(Actor* thisx, PlayState* play) { void BgCtowerGear_UpdateOrgan(Actor* thisx, PlayState* play) { BgCtowerGear* this = THIS; - if (Cutscene_CheckActorAction(play, 104)) { - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 104)]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_104)) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_104)]->id) { case 1: this->dyna.actor.draw = NULL; DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c index e94b28d88..571523fcb 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c @@ -88,7 +88,7 @@ void BgCtowerRot_CorridorRotate(BgCtowerRot* this, PlayState* play) { Camera_ChangeSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); this->dyna.actor.shape.rot.z = rotZ * 16.384f; - if (play->csCtx.frames == 132) { + if (play->csCtx.curFrame == 132) { play_sound(NA_SE_SY_SPIRAL_DASH); } } @@ -100,7 +100,7 @@ void BgCtowerRot_DoorClose(BgCtowerRot* this, PlayState* play) { if (!Math_SmoothStepToF(&this->timer, 0.0f, 0.1f, 15.0f, 0.1f)) { if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } this->actionFunc = BgCtowerRot_DoorDoNothing; } else if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) { @@ -119,19 +119,19 @@ void BgCtowerRot_DoorIdle(BgCtowerRot* this, PlayState* play) { Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); if (offset.z > 30.0f) { this->unk160 = 0.0f; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = BgCtowerRot_SetupDoorClose; } } void BgCtowerRot_SetupDoorClose(BgCtowerRot* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { if (this->dyna.actor.params == BGCTOWERROT_STONE_DOOR_MAIN) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); } this->actionFunc = BgCtowerRot_DoorClose; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c index 51797185a..2a59a9b8f 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c @@ -627,16 +627,16 @@ void func_80B83518(Actor* thisx, PlayState* play) { if (this->unk_17F == 2) { this->unk_17E--; if (this->unk_17E <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); this->unk_17F = 0; } } else if ((this->unk_17F != 0) && (this->unk_17F == 1)) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->unk_17F = 2; this->unk_17E = 0x50; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } this->unk_16C = this->unk_170; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 960006b93..570369f07 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -97,7 +97,7 @@ static AnimatedMaterial* sTexAnims[] = { s16 D_80A2B96C[] = { 0, 0x16C, -0x16C, 0 }; -s16 D_80A2B974[] = { -1, -1 }; +static s16 sCsIdList[] = { CS_ID_NONE, CS_ID_NONE }; static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE), @@ -197,7 +197,7 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) { this->xluDList = sXluDLists[this->unk_160]; this->texAnim = sTexAnims[this->unk_160]; - SubS_FillCutscenesList(&this->dyna.actor, this->unk_1B6, ARRAY_COUNT(this->unk_1B6)); + SubS_FillCutscenesList(&this->dyna.actor, this->csIdList, ARRAY_COUNT(this->csIdList)); switch (this->unk_160) { case 1: @@ -254,8 +254,8 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) { this->unk_2F8[1] = NULL; this->unk_2F8[0] = NULL; label: - for (i = 0; i < ARRAY_COUNT(D_80A2B974); i++) { - D_80A2B974[i] = this->unk_1B6[i]; + for (i = 0; i < ARRAY_COUNT(sCsIdList); i++) { + sCsIdList[i] = this->csIdList[i]; } this->unk_178 = func_80A29A80(play, this->unk_1C0, this->unk_1BC); this->unk_1CC = D_80A2B96C[this->unk_178]; @@ -385,8 +385,8 @@ void func_80A2A32C(BgDblueMovebg* this, PlayState* play) { } if (phi_v1) { - this->unk_180 = func_800F2178(this->unk_1B6[0]); - this->unk_1D2 = this->unk_1B6[0]; + this->unk_180 = CutsceneManager_GetCutsceneCustomValue(this->csIdList[0]); + this->csId = this->csIdList[0]; this->unk_172 |= 8; this->actionFunc = func_80A2A444; } else { @@ -447,7 +447,7 @@ void func_80A2A670(BgDblueMovebg* this, PlayState* play) { void func_80A2A688(BgDblueMovebg* this, PlayState* play) { this->unk_180--; if (this->unk_180 <= 0) { - ActorCutscene_Stop(this->unk_1B6[0]); + CutsceneManager_Stop(this->csIdList[0]); } if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 60.0f, 2.0f) && @@ -477,8 +477,8 @@ void func_80A2A714(BgDblueMovebg* this, PlayState* play) { } this->unk_17E = phi_v0 * phi_f0; - this->unk_180 = func_800F2178(this->unk_1B6[0]); - this->unk_1D2 = this->unk_1B6[0]; + this->unk_180 = CutsceneManager_GetCutsceneCustomValue(this->csIdList[0]); + this->csId = this->csIdList[0]; this->unk_172 |= 8; this->actionFunc = func_80A2A7F8; } @@ -549,12 +549,12 @@ void func_80A2AAB8(BgDblueMovebg* this, PlayState* play) { s32 sp18; if (this->unk_180-- <= 0) { - ActorCutscene_Stop(this->unk_1B6[0]); + CutsceneManager_Stop(this->csIdList[0]); } sp18 = false; - if ((this->unk_1D0 > 0) && ((D_80A2B974[0] >= 0) || (D_80A2B974[1] >= 0))) { - if (ActorCutscene_GetCurrentIndex() != -1) { + if ((this->unk_1D0 > 0) && ((sCsIdList[0] >= 0) || (sCsIdList[1] >= 0))) { + if (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) { sp18 = true; } } @@ -642,13 +642,13 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { switch (temp_v0_3) { case 1: case 2: - this->unk_1D2 = this->unk_1B6[0]; + this->csId = this->csIdList[0]; this->unk_17E = 40; break; case 0: case 3: - this->unk_1D2 = this->unk_1B6[1]; + this->csId = this->csIdList[1]; this->unk_17E = 15; break; } @@ -721,7 +721,7 @@ void BgDblueMovebg_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->unk_172 & 8) { - if (SubS_StartActorCutscene(&this->dyna.actor, this->unk_1D2, -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->dyna.actor, this->csId, CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { this->unk_172 &= ~8; } } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h index 8fc016585..6e81c24c1 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h @@ -37,7 +37,7 @@ typedef struct BgDblueMovebg { /* 0x19C */ Vec3f unk_19C; /* 0x1A8 */ Vec3f unk_1A8; /* 0x1B4 */ UNK_TYPE1 unk1B4[2]; - /* 0x1B6 */ s16 unk_1B6[2]; + /* 0x1B6 */ s16 csIdList[2]; /* 0x1BC */ s32 unk_1BC; /* 0x1C0 */ s32 unk_1C0; /* 0x1C4 */ s32 unk_1C4; @@ -45,7 +45,7 @@ typedef struct BgDblueMovebg { /* 0x1CC */ s16 unk_1CC; /* 0x1CE */ s16 unk_1CE; /* 0x1D0 */ s16 unk_1D0; - /* 0x1D2 */ s16 unk_1D2; + /* 0x1D2 */ s16 csId; /* 0x1D4 */ f32 unk_1D4; /* 0x1D8 */ s16 unk_1D8[2][8]; /* 0x1F8 */ f32 unk_1F8[2][8]; diff --git a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c index 3ba003ee5..8f3de2b2e 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c @@ -423,13 +423,13 @@ void func_80B84928(BgDblueWaterfall* this, PlayState* play) { if (sp30 != 0) { func_80B83EA4(this, play); if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x800) { - this->unk_1A4 = this->actor.cutscene; + this->csId = this->actor.csId; func_80B84AD4(this, play); } } else { func_80B841A0(this, play); if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000) { - this->unk_1A4 = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); func_80B84AD4(this, play); } } @@ -448,9 +448,9 @@ void func_80B84AEC(BgDblueWaterfall* this, PlayState* play) { s32 pad; s32 sp20; - if (ActorCutscene_GetCanPlayNext(this->unk_1A4)) { + if (CutsceneManager_IsNext(this->csId)) { sp20 = func_80B83D04(this, play); - ActorCutscene_StartAndSetUnkLinkFields(this->unk_1A4, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_1A3 = true; if (sp20) { func_80B83D94(this, play); @@ -460,7 +460,7 @@ void func_80B84AEC(BgDblueWaterfall* this, PlayState* play) { func_80B84B9C(this, play); } } else { - ActorCutscene_SetIntentToPlay(this->unk_1A4); + CutsceneManager_Queue(this->csId); } } @@ -533,7 +533,7 @@ void func_80B84BCC(BgDblueWaterfall* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } else { if (this->unk_1A3) { - ActorCutscene_Stop(this->unk_1A4); + CutsceneManager_Stop(this->csId); } func_80B8484C(this, play); } @@ -572,7 +572,7 @@ void func_80B84F20(BgDblueWaterfall* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EV_ICE_MELT_LEVEL - SFX_FLAG); } else { if (this->unk_1A3) { - ActorCutscene_Stop(this->unk_1A4); + CutsceneManager_Stop(this->csId); } func_80B8484C(this, play); } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h index 5ab64495e..fae5cca6a 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h +++ b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.h @@ -22,7 +22,7 @@ typedef struct BgDblueWaterfall { /* 0x1A0 */ u8 unk_1A0; /* 0x1A1 */ UNK_TYPE1 unk1A1[2]; /* 0x1A3 */ s8 unk_1A3; - /* 0x1A4 */ s16 unk_1A4; + /* 0x1A4 */ s16 csId; /* 0x1A6 */ UNK_TYPE1 unk1A6[1]; /* 0x1A7 */ s8 unk_1A7; /* 0x1A8 */ f32 unk_1A8; diff --git a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c index eb1848c56..e9f8916d0 100644 --- a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c +++ b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c @@ -146,7 +146,7 @@ void BgDkjailIvy_WaitForCut(BgDkjailIvy* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; this->dyna.actor.flags |= ACTOR_FLAG_10; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); BgDkjailIvy_SetupCutscene(this); } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); @@ -158,8 +158,8 @@ void BgDkjailIvy_SetupCutscene(BgDkjailIvy* this) { } void BgDkjailIvy_BeginCutscene(BgDkjailIvy* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->fadeOutTimer = 50; DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); Flags_SetSwitch(play, BG_DKJAIL_GET_SWITCH(&this->dyna.actor)); @@ -167,7 +167,7 @@ void BgDkjailIvy_BeginCutscene(BgDkjailIvy* this, PlayState* play) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GRASS_WALL_BROKEN); BgDkjailIvy_SetupFadeOut(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c index a39e10559..be1958cb4 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c @@ -157,16 +157,16 @@ s32 func_80BC3B00(BgF40Block* this) { } s32 func_80BC3CA4(BgF40Block* this) { - if (this->dyna.actor.cutscene == -1) { + if (this->dyna.actor.csId == CS_ID_NONE) { return true; } - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); return true; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); return false; } @@ -277,13 +277,13 @@ void func_80BC4228(BgF40Block* this, PlayState* play) { this->unk_164 = this->unk_160 + 1; } else { this->actionFunc = func_80BC4530; - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_C); } } if (func_80BC3D08(this, play, 0)) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); this->actionFunc = func_80BC41AC; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); return; @@ -337,13 +337,13 @@ void func_80BC4448(BgF40Block* this, PlayState* play) { this->unk_164 = this->unk_160 - 1; } else { this->actionFunc = func_80BC4380; - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_C); } } if (func_80BC3D08(this, play, 0)) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); this->actionFunc = func_80BC43CC; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); } diff --git a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c index ffa9491d6..67703f0cd 100644 --- a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c +++ b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c @@ -147,7 +147,7 @@ void BgF40Switch_Press(BgF40Switch* this, PlayState* play) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_SWITCH); Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); if (this->isInitiator) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); this->isInitiator = false; } this->actionFunc = BgF40Switch_IdlePressed; @@ -157,19 +157,19 @@ void BgF40Switch_Press(BgF40Switch* this, PlayState* play) { } void BgF40Switch_WaitToPress(BgF40Switch* this, PlayState* play) { - if (!this->isInitiator || this->dyna.actor.cutscene == -1) { + if (!this->isInitiator || (this->dyna.actor.csId == CS_ID_NONE)) { this->actionFunc = BgF40Switch_Press; if (this->isInitiator) { Flags_SetSwitch(play, BGF40SWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } - } else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + } else if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->actionFunc = BgF40Switch_Press; if (this->isInitiator) { Flags_SetSwitch(play, BGF40SWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index 8b02330f3..7d0ed6a1a 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -42,7 +42,7 @@ void func_80B40080(BgGoronOyu* this) { void func_80B4009C(BgGoronOyu* this) { this->unk_17E = 0; - this->initialActorCutscene = this->dyna.actor.cutscene; + this->initCsId = this->dyna.actor.csId; this->actionFunc = func_80B40100; this->unk_164 = 20.0f; } @@ -53,11 +53,11 @@ void func_80B400C8(BgGoronOyu* this, PlayState* play) { } void func_80B40100(BgGoronOyu* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->initialActorCutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->initialActorCutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->initCsId)) { + CutsceneManager_StartWithPlayerCs(this->initCsId, &this->dyna.actor); this->actionFunc = func_80B40160; } else { - ActorCutscene_SetIntentToPlay(this->initialActorCutscene); + CutsceneManager_Queue(this->initCsId); } } @@ -69,7 +69,7 @@ void func_80B40160(BgGoronOyu* this, PlayState* play) { BgGoronOyu_UpdateWaterBoxInfo(this, play); if (this->unk_164 <= 0.0f) { - ActorCutscene_Stop(this->initialActorCutscene); + CutsceneManager_Stop(this->initCsId); this->unk_164 = 0.0f; func_80B40080(this); } diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h index d17ff87b3..57459364b 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.h @@ -15,7 +15,7 @@ typedef struct BgGoronOyu { /* 0x168 */ Vec3f waterBoxPos; /* 0x174 */ f32 waterBoxXLength; /* 0x178 */ f32 waterBoxZLength; - /* 0x17C */ s16 initialActorCutscene; + /* 0x17C */ s16 initCsId; /* 0x17E */ u16 unk_17E; } BgGoronOyu; // size = 0x180 diff --git a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c index 387f5ec83..fc209773b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c @@ -191,13 +191,13 @@ void func_80BD6274(BgHakaBombwall* this, PlayState* play) { void BgHakaBombwall_SetupPlayCutscene(BgHakaBombwall* this) { this->dyna.actor.flags |= ACTOR_FLAG_10; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = BgHakaBombwall_PlayCutscene; } void BgHakaBombwall_PlayCutscene(BgHakaBombwall* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); func_80BD5E6C(this, play); this->dyna.actor.draw = NULL; Flags_SetSwitch(play, BGHAKABOMBWALL_GET_7F(&this->dyna.actor)); @@ -205,7 +205,7 @@ void BgHakaBombwall_PlayCutscene(BgHakaBombwall* this, PlayState* play) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); BgHakaBombwall_SetupEndCutscene(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -217,7 +217,7 @@ void BgHakaBombwall_SetupEndCutscene(BgHakaBombwall* this) { void BgHakaBombwall_EndCutscene(BgHakaBombwall* this, PlayState* play) { this->csTimer--; if (this->csTimer <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c index b90774172..dfc176eff 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c +++ b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c @@ -79,12 +79,12 @@ void func_80B6DCEC(BgHakaCurtain* this) { } void func_80B6DD00(BgHakaCurtain* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); func_80B6DD5C(this); return; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } void func_80B6DD5C(BgHakaCurtain* this) { @@ -123,11 +123,11 @@ void func_80B6DEA8(BgHakaCurtain* this, PlayState* play) { void BgHakaCurtain_Update(Actor* thisx, PlayState* play) { BgHakaCurtain* this = THIS; - CsCmdActorAction* actorAction; + CsCmdActorCue* cue; - if (Cutscene_CheckActorAction(play, 469)) { - actorAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 469)]; - if (actorAction->startFrame == play->csCtx.frames && actorAction->action == 2) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_469)) { + cue = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_469)]; + if ((cue->startFrame == play->csCtx.curFrame) && (cue->id == 2)) { func_80B6DD80(this); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c index 94e7c57dc..693fff484 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c @@ -47,7 +47,7 @@ void BgHakaTomb_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_000EE8); - SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->dyna.actor, this->csIdList, ARRAY_COUNT(this->csIdList)); func_80BD6624(this); } @@ -61,15 +61,15 @@ void func_80BD6624(BgHakaTomb* this) { this->actionFunc = func_80BD66AC; } -s32 func_80BD6638(s16* arg0, s16* arg1, s32 arg2) { +s32 func_80BD6638(s16* csId, s16* csIdList, s32 numCutscenes) { s32 pad; s32 retVal = false; s32 i; - *arg0 = ActorCutscene_GetCurrentIndex(); - if (*arg0 >= 0) { - for (i = 0; i < arg2; i++) { - if (*arg0 == arg1[i]) { + *csId = CutsceneManager_GetCurrentCsId(); + if (*csId >= 0) { + for (i = 0; i < numCutscenes; i++) { + if (*csId == csIdList[i]) { retVal = true; break; } @@ -80,12 +80,13 @@ s32 func_80BD6638(s16* arg0, s16* arg1, s32 arg2) { } void func_80BD66AC(BgHakaTomb* this, PlayState* play) { - s16 temp; + s16 csId; if (Flags_GetClear(play, this->dyna.actor.room)) { this->dyna.actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); } - if (!func_80BD6638(&temp, this->cutscenes, 1) && (temp < 0) && Flags_GetClear(play, this->dyna.actor.room)) { + if (!func_80BD6638(&csId, this->csIdList, ARRAY_COUNT(this->csIdList)) && (csId < 0) && + Flags_GetClear(play, this->dyna.actor.room)) { this->dyna.actor.flags |= ACTOR_FLAG_1; if (this->dyna.actor.isTargeted) { func_80BD6754(this); @@ -100,7 +101,7 @@ void func_80BD6754(BgHakaTomb* this) { } void func_80BD6768(BgHakaTomb* this, PlayState* play) { - if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->dyna.actor, this->csIdList[0], CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { BgHakaTomb_SetupDoNothing(this); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h index 3c607e0e2..fa06a8695 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h +++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.h @@ -10,7 +10,7 @@ typedef void (*BgHakaTombActionFunc)(struct BgHakaTomb*, PlayState*); typedef struct BgHakaTomb { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgHakaTombActionFunc actionFunc; - /* 0x160 */ s16 cutscenes[1]; + /* 0x160 */ s16 csIdList[1]; } BgHakaTomb; // size = 0x164 #endif // Z_BG_HAKA_TOMB_H diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c index 41112ccdc..99a5a759c 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Bombwall/z_bg_hakugin_bombwall.c @@ -382,7 +382,7 @@ void func_80ABCCE4(BgHakuginBombwall* this, PlayState* play) { if (ptr->unk_20(this, play)) { this->dyna.actor.flags |= ACTOR_FLAG_10; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = func_80ABCD98; } else { this->collider.base.acFlags &= ~AC_HIT; @@ -393,10 +393,10 @@ void func_80ABCCE4(BgHakuginBombwall* this, PlayState* play) { void func_80ABCD98(BgHakuginBombwall* this, PlayState* play) { s32 pad; - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { BgHakuginBombwallStruct* ptr = &D_80ABCFC0[BGHAKUGIN_BOMBWALL_100(&this->dyna.actor)]; - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); ptr->unk_24(this, play); this->dyna.actor.draw = NULL; this->unk_1AC = 20; @@ -404,7 +404,7 @@ void func_80ABCD98(BgHakuginBombwall* this, PlayState* play) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80ABCE60; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -413,7 +413,7 @@ void func_80ABCE60(BgHakuginBombwall* this, PlayState* play) { this->unk_1AC--; if (this->unk_1AC <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); } else if (this->unk_1AC == ptr->unk_2C) { ptr->unk_28(this, play); diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c index 42a7c4e05..7cd94bd86 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Elvpole/z_bg_hakugin_elvpole.c @@ -104,15 +104,15 @@ void func_80ABD92C(BgHakuginElvpole* this, PlayState* play) { this->unk_15C = 0; } if (this->unk_160) { - if (this->dyna.actor.cutscene == -1) { + if (this->dyna.actor.csId == CS_ID_NONE) { this->unk_160 = false; return; - } else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + } else if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->unk_160 = false; return; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index 5a06fe415..a8b6ce702 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -28,9 +28,9 @@ void func_80A9CE00(BgHakuginPost* this); void func_80A9CE1C(BgHakuginPost* this, PlayState* play); void func_80A9D0A0(BgHakuginPost* this); void func_80A9D0B4(BgHakuginPost* this, PlayState* play); -void func_80A9D1E0(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 arg3, s16 arg4); +void func_80A9D1E0(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 csLength, s16 csId); void func_80A9D260(BgHakuginPost* this, PlayState* play); -void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 arg3, s16 arg4); +void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 csId, s16 additionalCsId); void func_80A9D360(BgHakuginPost* this, PlayState* play); void func_80A9D3E4(BgHakuginPost* this); void func_80A9D434(BgHakuginPost* this, PlayState* play); @@ -162,12 +162,12 @@ void func_80A9AFB4(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* } else { unkStruct->unk_0000[i].unk_34 = 1; } - unkStruct->unk_0000[i].unk_2A = this->dyna.actor.cutscene; - unkStruct->unk_0000[i].unk_2C = ActorCutscene_GetAdditionalCutscene(unkStruct->unk_0000[i].unk_2A); + unkStruct->unk_0000[i].csId = this->dyna.actor.csId; + unkStruct->unk_0000[i].additionalCsId = CutsceneManager_GetAdditionalCsId(unkStruct->unk_0000[i].csId); } else { unkStruct->unk_0000[i].unk_34 = 1; - unkStruct->unk_0000[i].unk_2A = -1; - unkStruct->unk_0000[i].unk_2C = -1; + unkStruct->unk_0000[i].csId = CS_ID_NONE; + unkStruct->unk_0000[i].additionalCsId = CS_ID_NONE; } unkStruct->unk_0000[i].unk_2F = 1; @@ -783,7 +783,7 @@ void func_80A9CC84(BgHakuginPost* this) { void func_80A9CCA0(BgHakuginPost* this, PlayState* play) { if (this->unk_174 != 0) { func_80A9D1E0(this, func_80A9CD00, (this->unk_164 - this->dyna.actor.home.pos.y) + 100.0f, 60, - this->dyna.actor.cutscene); + this->dyna.actor.csId); } } @@ -823,7 +823,7 @@ void func_80A9CE1C(BgHakuginPost* this, PlayState* play) { if (this->unk_170 != 0) { func_80A9D1E0(this, func_80A9D0A0, (this->unk_164 - this->dyna.actor.home.pos.y) + 100.0f, 0x3C, - ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene)); + CutsceneManager_GetAdditionalCsId(this->dyna.actor.csId)); return; } @@ -843,8 +843,8 @@ void func_80A9CE1C(BgHakuginPost* this, PlayState* play) { func_8019F128(NA_SE_EV_SLIDE_DOOR_OPEN); Flags_SetSwitch(play, D_80A9E028.unk_0000[i].unk_2E); this->unk_178 = 20; - func_80A9D2C4(this, func_80A9CE00, D_80A9E028.unk_0000[i].unk_14.y + 50.0f, - D_80A9E028.unk_0000[i].unk_2A, D_80A9E028.unk_0000[i].unk_2C); + func_80A9D2C4(this, func_80A9CE00, D_80A9E028.unk_0000[i].unk_14.y + 50.0f, D_80A9E028.unk_0000[i].csId, + D_80A9E028.unk_0000[i].additionalCsId); break; } } @@ -884,12 +884,12 @@ void func_80A9D0B4(BgHakuginPost* this, PlayState* play) { } } -void func_80A9D1E0(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 arg3, s16 arg4) { +void func_80A9D1E0(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 csLength, s16 csId) { this->unkFunc = unkFunc; - this->unk_184 = arg4; - this->unk_180 = ActorCutscene_GetLength(arg4); - if (this->unk_180 < 0) { - this->unk_180 = arg3; + this->csId = csId; + this->csLength = CutsceneManager_GetLength(csId); + if (this->csLength < 0) { + this->csLength = csLength; } this->dyna.actor.focus.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.focus.pos.y = this->unk_16C + arg2; @@ -898,22 +898,22 @@ void func_80A9D1E0(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 } void func_80A9D260(BgHakuginPost* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_184)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_184, &this->dyna.actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->dyna.actor); this->unkFunc(this); } else { - ActorCutscene_SetIntentToPlay(this->unk_184); + CutsceneManager_Queue(this->csId); } } -void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 arg3, s16 arg4) { +void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 csId, s16 additionalCsId) { this->unkFunc = unkFunc; - this->unk_184 = arg3; - this->unk_186 = arg4; - this->unk_180 = -1; - this->unk_180 = ActorCutscene_GetLength(arg3); - if (this->unk_180 < 0) { - this->unk_180 = 15; + this->csId = csId; + this->additionalCsId = additionalCsId; + this->csLength = -1; + this->csLength = CutsceneManager_GetLength(csId); + if (this->csLength < 0) { + this->csLength = 15; } this->dyna.actor.focus.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.focus.pos.y = this->unk_16C + arg2; @@ -922,32 +922,32 @@ void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 } void func_80A9D360(BgHakuginPost* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_184)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_184, &this->dyna.actor); - if (this->unk_186 >= 0) { + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->dyna.actor); + if (this->additionalCsId >= 0) { func_80A9D3E4(this); } else { this->unkFunc(this); } } else { - ActorCutscene_SetIntentToPlay(this->unk_184); + CutsceneManager_Queue(this->csId); } } void func_80A9D3E4(BgHakuginPost* this) { - this->unk_182 = ActorCutscene_GetLength(this->unk_186); - if (this->unk_182 < 0) { - this->unk_182 = 30; + this->additionalCsLength = CutsceneManager_GetLength(this->additionalCsId); + if (this->additionalCsLength < 0) { + this->additionalCsLength = 30; } this->actionFunc = func_80A9D434; } void func_80A9D434(BgHakuginPost* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_186) != 0) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_186, &this->dyna.actor); + if (CutsceneManager_IsNext(this->additionalCsId)) { + CutsceneManager_StartWithPlayerCs(this->additionalCsId, &this->dyna.actor); this->unkFunc(this); } else { - ActorCutscene_SetIntentToPlay(this->unk_186); + CutsceneManager_Queue(this->additionalCsId); } } @@ -956,17 +956,17 @@ void BgHakuginPost_Update(Actor* thisx, PlayState* play) { f32 temp; func_80A9B46C(this, play); - if ((this->unk_180 >= 0) && ((this->actionFunc != func_80A9D260) || (this->actionFunc != func_80A9D360))) { - this->unk_180--; - if (this->unk_180 < 0) { - ActorCutscene_Stop(this->unk_184); + if ((this->csLength >= 0) && ((this->actionFunc != func_80A9D260) || (this->actionFunc != func_80A9D360))) { + this->csLength--; + if (this->csLength < 0) { + CutsceneManager_Stop(this->csId); } } - if ((this->unk_182 >= 0) && (this->actionFunc != func_80A9D434)) { - this->unk_182--; - if (this->unk_182 < 0) { - ActorCutscene_Stop(this->unk_186); + if ((this->additionalCsLength >= 0) && (this->actionFunc != func_80A9D434)) { + this->additionalCsLength--; + if (this->additionalCsLength < 0) { + CutsceneManager_Stop(this->additionalCsId); } } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h index 5a23fa070..4797a684a 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.h @@ -19,8 +19,8 @@ typedef struct { /* 0x20 */ f32 unk_20; /* 0x24 */ f32 unk_24; /* 0x28 */ s16 unk_28; - /* 0x2A */ s16 unk_2A; - /* 0x2C */ s16 unk_2C; + /* 0x2A */ s16 csId; + /* 0x2C */ s16 additionalCsId; /* 0x2E */ u8 unk_2E; /* 0x2F */ u8 unk_2F; /* 0x30 */ s8 unk_30; @@ -64,10 +64,10 @@ typedef struct BgHakuginPost { /* 0x178 */ s8 unk_178; /* 0x179 */ s8 unk_179; /* 0x17C */ BgHakuginPostFunc unkFunc; - /* 0x180 */ s16 unk_180; - /* 0x182 */ s16 unk_182; - /* 0x184 */ s16 unk_184; - /* 0x186 */ s16 unk_186; + /* 0x180 */ s16 csLength; + /* 0x182 */ s16 additionalCsLength; + /* 0x184 */ s16 csId; + /* 0x186 */ s16 additionalCsId; } BgHakuginPost; // size = 0x188 #endif // Z_BG_HAKUGIN_POST_H diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c index 512a5b822..c7fa3d69e 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.c @@ -143,12 +143,12 @@ void BgHakuginSwitch_Init(Actor* thisx, PlayState* play) { this->collider.dim.yShift = 0x1D; this->unk_1A8 = object_goronswitch_DL_000268; - this->unk_1B8 = this->dyna.actor.cutscene; + this->csId = this->dyna.actor.csId; if (sp34 == 0) { - this->unk_1BA = -1; + this->additionalCsId = CS_ID_NONE; } else { - this->unk_1BA = ActorCutscene_GetAdditionalCutscene(this->unk_1B8); + this->additionalCsId = CutsceneManager_GetAdditionalCsId(this->csId); } if (sp30) { @@ -166,8 +166,8 @@ void BgHakuginSwitch_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); this->unk_1A8 = D_80B1688C[sp34].unk_10; - this->unk_1B8 = this->dyna.actor.cutscene; - this->unk_1BA = ActorCutscene_GetAdditionalCutscene(this->unk_1B8); + this->csId = this->dyna.actor.csId; + this->additionalCsId = CutsceneManager_GetAdditionalCsId(this->csId); if (sp30 == sp28) { func_80B15F3C(this, play); @@ -186,9 +186,9 @@ void BgHakuginSwitch_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80B15A4C(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2) { +void func_80B15A4C(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 csId) { this->unk_1B4 = func; - this->unk_1BC = arg2; + this->curCsId = csId; this->actionFunc = func_80B15A68; } @@ -197,14 +197,14 @@ void func_80B15A68(BgHakuginSwitch* this, PlayState* play) { BgHakuginSwitchStruct* s = &D_80B1688C[BGHAKUGINSWITCH_GET_7(&this->dyna.actor)]; s32 sp18 = !(s->unk_14 & 0x40); - if (ActorCutscene_GetCanPlayNext(this->unk_1BC)) { + if (CutsceneManager_IsNext(this->curCsId)) { if (sp18) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_1BC, &this->dyna.actor); + CutsceneManager_StartWithPlayerCs(this->curCsId, &this->dyna.actor); this->unk_1BF = 40; } this->unk_1B4(this, play); } else if (sp18) { - ActorCutscene_SetIntentToPlay(this->unk_1BC); + CutsceneManager_Queue(this->curCsId); } } @@ -281,7 +281,7 @@ void func_80B15B74(BgHakuginSwitch* this, PlayState* play) { D_80B16AF0 = play->gameplayFrames; if (sp38->unk_14 & 0x10) { - func_80B15A4C(this, func_80B15E0C, this->unk_1B8); + func_80B15A4C(this, func_80B15E0C, this->csId); } else { func_80B15E0C(this, play); } @@ -343,7 +343,7 @@ void func_80B15F88(BgHakuginSwitch* this, PlayState* play) { if (phi_a0 != phi_v1) { if ((sp18->unk_14 & 0xFF) & 0x20) { if (D_80B16AF0 < play->gameplayFrames) { - func_80B15A4C(this, func_80B1606C, this->unk_1BA); + func_80B15A4C(this, func_80B1606C, this->additionalCsId); } } else { func_80B1606C(this, play); @@ -372,16 +372,16 @@ void func_80B160DC(BgHakuginSwitch* this, PlayState* play) { } } -void func_80B16180(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2, s32 arg3) { +void func_80B16180(BgHakuginSwitch* this, BgHakuginSwitchUnkFunc func, s32 arg2, s32 csId) { this->unk_1B4 = func; this->unk_1BE = arg2; - this->unk_1BC = arg3; + this->curCsId = csId; this->actionFunc = func_80B161A0; } void func_80B161A0(BgHakuginSwitch* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_1BC)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_1BC, &this->dyna.actor); + if (CutsceneManager_IsNext(this->curCsId)) { + CutsceneManager_StartWithPlayerCs(this->curCsId, &this->dyna.actor); if (this->unk_1BE != 0) { Flags_SetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor)); } else { @@ -390,7 +390,7 @@ void func_80B161A0(BgHakuginSwitch* this, PlayState* play) { this->unk_1BF = 50; this->unk_1B4(this, play); } else { - ActorCutscene_SetIntentToPlay(this->unk_1BC); + CutsceneManager_Queue(this->curCsId); } } @@ -427,7 +427,7 @@ void func_80B162AC(BgHakuginSwitch* this, PlayState* play) { if (sp24) { if (sp28) { - func_80B16180(this, func_80B163C4, 1, this->unk_1B8); + func_80B16180(this, func_80B163C4, 1, this->csId); } else { func_80B163C4(this, play); } @@ -466,7 +466,7 @@ void func_80B16494(BgHakuginSwitch* this, PlayState* play) { void func_80B16520(BgHakuginSwitch* this, PlayState* play) { if (!Flags_GetSwitch(play, BGHAKUGINSWITCH_GET_SWITCHFLAG(&this->dyna.actor))) { if (BGHAKUGINSWITCH_GET_7(&this->dyna.actor) == BGHAKUGINSWITCH_GET_7_1) { - func_80B16180(this, func_80B165A0, 0, this->unk_1BA); + func_80B16180(this, func_80B165A0, 0, this->additionalCsId); } else { func_80B165A0(this, play); } @@ -498,7 +498,7 @@ void BgHakuginSwitch_Update(Actor* thisx, PlayState* play) { if ((this->actionFunc != func_80B15A68) && (this->actionFunc != func_80B161A0)) { this->unk_1BF--; if (this->unk_1BF == 0) { - ActorCutscene_Stop(this->unk_1BC); + CutsceneManager_Stop(this->curCsId); } } } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h index 164220b29..caf3c2f65 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h +++ b/src/overlays/actors/ovl_Bg_Hakugin_Switch/z_bg_hakugin_switch.h @@ -22,9 +22,9 @@ typedef struct BgHakuginSwitch { /* 0x1B0 */ s16 unk_1B0; /* 0x1B2 */ s8 unk_1B2; /* 0x1B4 */ BgHakuginSwitchUnkFunc unk_1B4; - /* 0x1B8 */ s16 unk_1B8; - /* 0x1BA */ s16 unk_1BA; - /* 0x1BC */ s16 unk_1BC; + /* 0x1B8 */ s16 csId; + /* 0x1BA */ s16 additionalCsId; + /* 0x1BC */ s16 curCsId; /* 0x1BE */ s8 unk_1BE; /* 0x1BF */ s8 unk_1BF; /* 0x1C0 */ s8 unk_1C0; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c index 622c84100..401d3543e 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.c @@ -358,13 +358,13 @@ void BgIkanaBlock_Update(Actor* thisx, PlayState* play) { if (this->unk_17E != 0) { if (this->unk_17F > 0) { this->unk_17F--; - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); this->unk_17E = 0; - } else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + } else if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->unk_17F = 30; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c index 88f606ac0..edcda4b37 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c @@ -319,13 +319,13 @@ void func_80BD4F9C(BgIkanaBombwall* this, PlayState* play) { void func_80BD4FF8(BgIkanaBombwall* this) { this->dyna.actor.flags |= ACTOR_FLAG_10; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = func_80BD503C; } void func_80BD503C(BgIkanaBombwall* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); if (!BGIKANABOMBWALL_GET_100(&this->dyna.actor)) { func_80BD4720(this, play); } else { @@ -339,7 +339,7 @@ void func_80BD503C(BgIkanaBombwall* this, PlayState* play) { } func_80BD5118(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -352,11 +352,11 @@ void func_80BD5134(BgIkanaBombwall* this, PlayState* play) { if (!BGIKANABOMBWALL_GET_100(&this->dyna.actor)) { this->unk_1AC--; if (this->unk_1AC <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); } - } else if (this->dyna.actor.cutscene >= 0) { - if (ActorCutscene_GetCurrentIndex() != this->dyna.actor.cutscene) { + } else if (this->dyna.actor.csId >= 0) { + if (CutsceneManager_GetCurrentCsId() != this->dyna.actor.csId) { Actor_Kill(&this->dyna.actor); } } else { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index aead34d28..44f81da9c 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -115,7 +115,7 @@ void BgIkanaDharma_Init(Actor* thisx, PlayState* play2) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_IKANA_DHARMA, this->dyna.actor.world.pos.x, segmentY, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, - BGIKANADHARMA_PARAMS(0, true, 0), this->dyna.actor.cutscene, + BGIKANADHARMA_PARAMS(0, true, 0), this->dyna.actor.csId, this->dyna.actor.halfDaysBits, NULL); } @@ -173,16 +173,16 @@ void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, PlayState* play) { } void BgIkanaDharma_SetupStartCutscene(BgIkanaDharma* this) { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = BgIkanaDharma_StartCutscene; } void BgIkanaDharma_StartCutscene(BgIkanaDharma* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); BgIkanaDharma_SetupWaitForCutsceneToEnd(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -200,7 +200,7 @@ void BgIkanaDharma_WaitForCutsceneToEnd(BgIkanaDharma* this, PlayState* play) { sFirstHitBgIkanaDharma = NULL; } - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index 432a5b5ff..7398dbfd9 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -179,7 +179,7 @@ void func_80B80440(BgIkanaRotaryroom* this, PlayState* play) { this->unk_204.unk_00 = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_BG_IKANA_BLOCK, sp50.x, sp50.y, sp50.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, -1, - ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene), this->dyna.actor.halfDaysBits, NULL); + CutsceneManager_GetAdditionalCsId(this->dyna.actor.csId), this->dyna.actor.halfDaysBits, NULL); Matrix_Pop(); } @@ -515,7 +515,7 @@ void func_80B81010(BgIkanaRotaryroom* this, PlayState* play) { CollisionPoly* sp7C; s32 sp78; - if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() == this->dyna.actor.csId) { phi_s7 = true; for (i = 0; i < ARRAY_COUNT(this->unk_3E0); i++) { @@ -582,7 +582,7 @@ void func_80B81234(BgIkanaRotaryroom* this, PlayState* play) { CollisionPoly* sp40; s32 sp3C; - if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() == this->dyna.actor.csId) { if (player == NULL) { return; } @@ -646,7 +646,7 @@ void func_80B81234(BgIkanaRotaryroom* this, PlayState* play) { void func_80B814B8(BgIkanaRotaryroom* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() == this->dyna.actor.csId) { if (player->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) { Player_PlaySfx(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->voiceSfxIdOffset); func_80169EFC(&play->state); @@ -791,14 +791,14 @@ void func_80B819DC(BgIkanaRotaryroom* this) { void func_80B819F0(Actor* thisx, PlayState* play) { BgIkanaRotaryroom* this = THIS; - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - if (this->dyna.actor.cutscene >= 0) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); + if (this->dyna.actor.csId >= 0) { + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); } func_80B81A64(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -926,7 +926,7 @@ void func_80B81DC8(Actor* thisx, PlayState* play) { this->unk_584--; if (this->unk_584 <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); func_80B818B4(this); } else if (this->unk_584 == 19) { s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); diff --git a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c index a7ba89cdc..f39ca3b8c 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c @@ -106,12 +106,12 @@ void func_80BD5878(BgIkanaShutter* this) { } void func_80BD5894(BgIkanaShutter* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); func_80BD58F0(this); return; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } void func_80BD58F0(BgIkanaShutter* this) { @@ -177,13 +177,13 @@ void func_80BD5B44(BgIkanaShutter* this) { } void func_80BD5B60(BgIkanaShutter* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); Flags_SetClear(play, this->dyna.actor.room); func_80BD5BC4(this); return; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } void func_80BD5BC4(BgIkanaShutter* this) { diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index 824c58ee6..5a69e3ca7 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -179,11 +179,11 @@ void func_80C0ACD4(BgIkninSusceil* this) { } void func_80C0ACE8(BgIkninSusceil* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); func_80C0AD44(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -198,7 +198,7 @@ void func_80C0AD64(BgIkninSusceil* this, PlayState* play) { if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 365.0f, 0.5f, this->dyna.actor.velocity.y, 1.0f) < 0.1f) { func_80C0A86C(this, play, 1, 14, 3); - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); func_80C0AB14(this); } else { func_800B9010(&this->dyna.actor, NA_SE_EV_ICE_PILLAR_RISING - SFX_FLAG); diff --git a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c index db343e84b..36f8e94fc 100644 --- a/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c +++ b/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.c @@ -80,16 +80,16 @@ void func_80C07220(BgIkninside* this, PlayState* play) { } void func_80C07230(BgIkninside* this, PlayState* play) { - if (this->dyna.actor.cutscene == -1) { + if (this->dyna.actor.csId == CS_ID_NONE) { this->actionFunc = func_80C07220; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->dyna.actor.csId); + } else if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->actionFunc = func_80C07220; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c index 9cbfaec61..2c24a5580 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.c @@ -51,9 +51,9 @@ void BgIknvDoukutu_Init(Actor* thisx, PlayState* play) { switch (BGIKNVDOUKUTU_GET_F(&this->dyna.actor)) { case BGIKNVDOUKUTU_F_0: this->actionFunc = func_80BD71BC; - this->csAction = 0x204; + this->cueType = CS_CMD_ACTOR_CUE_516; this->unk_160 = 1.0f; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { this->dyna.actor.draw = func_80BD7768; this->actionFunc = func_80BD73D0; play->envCtx.lightSettingOverride = 25; @@ -65,7 +65,7 @@ void BgIknvDoukutu_Init(Actor* thisx, PlayState* play) { case BGIKNVDOUKUTU_F_1: Actor_SetScale(&this->dyna.actor, 1.0f); this->dyna.actor.draw = func_80BD7820; - this->csAction = 0x204; + this->cueType = CS_CMD_ACTOR_CUE_516; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_iknv_obj_Colheader_012788, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); @@ -75,7 +75,7 @@ void BgIknvDoukutu_Init(Actor* thisx, PlayState* play) { break; case BGIKNVDOUKUTU_F_2: - this->csAction = 0x204; + this->cueType = CS_CMD_ACTOR_CUE_516; this->dyna.actor.draw = func_80BD78C4; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_iknv_obj_Colheader_0117C8, &colHeader); @@ -116,8 +116,8 @@ void func_80BD716C(BgIknvDoukutu* this, PlayState* play) { void func_80BD71BC(BgIknvDoukutu* this, PlayState* play) { play->envCtx.lightSettingOverride = 24; - if (Cutscene_CheckActorAction(play, this->csAction) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csAction)]->action == 2)) { + if (Cutscene_IsCueInChannel(play, this->cueType) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id == 2)) { this->actionFunc = func_80BD716C; this->dyna.actor.draw = func_80BD7538; } @@ -135,8 +135,8 @@ void func_80BD7250(BgIknvDoukutu* this, PlayState* play) { } void func_80BD72BC(BgIknvDoukutu* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, this->csAction) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csAction)]->action == 3)) { + if (Cutscene_IsCueInChannel(play, this->cueType) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id == 3)) { this->actionFunc = func_80BD7250; } @@ -146,8 +146,8 @@ void func_80BD72BC(BgIknvDoukutu* this, PlayState* play) { } void func_80BD7360(BgIknvDoukutu* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, this->csAction) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csAction)]->action == 2)) { + if (Cutscene_IsCueInChannel(play, this->cueType) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id == 2)) { this->actionFunc = func_80BD72BC; } } diff --git a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h index f36393869..beeeb0b81 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h +++ b/src/overlays/actors/ovl_Bg_Iknv_Doukutu/z_bg_iknv_doukutu.h @@ -18,7 +18,7 @@ enum { typedef struct BgIknvDoukutu { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ s16 unk_15C; // set and not used - /* 0x15E */ u16 csAction; + /* 0x15E */ u16 cueType; /* 0x160 */ f32 unk_160; /* 0x164 */ BgIknvDoukutuActionFunc actionFunc; } BgIknvDoukutu;// size = 0x168 diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 2651c52bc..1419c3466 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -107,20 +107,20 @@ void BgIknvObj_Destroy(Actor* thisx, PlayState* play) { } s32 func_80BD7CEC(BgIknvObj* this) { - if (this->dyna.actor.cutscene == -1) { + if (this->dyna.actor.csId == CS_ID_NONE) { return true; } - if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() == this->dyna.actor.csId) { return true; } - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); return true; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); return false; } @@ -131,8 +131,8 @@ void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, PlayState* play) { func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG); } - if ((play->csCtx.state != 0) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 4) && - (play->csCtx.frames == 1495)) { + if ((play->csCtx.state != 0) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 4) && + (play->csCtx.curFrame == 1495)) { func_8019F128(NA_SE_EV_DOOR_UNLOCK); } } @@ -166,7 +166,7 @@ void func_80BD7F4C(BgIknvObj* this, PlayState* play) { this->actionFunc = func_80BD7ED8; } if ((this->dyna.actor.home.rot.x == 1) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_58_80)) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); this->dyna.actor.home.rot.x = 0; } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 7ada76df8..502b29086 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -126,7 +126,7 @@ s32 func_80953DA8(BgIngate* this, PlayState* play) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); if (CHECK_EVENTINF(EVENTINF_35)) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); } else { SET_EVENTINF(EVENTINF_41); } @@ -169,7 +169,7 @@ void func_80953F14(BgIngate* this, PlayState* play) { if (this->timePath != NULL) { func_80953B40(this); } - this->unk16E = -1; + this->csId = CS_ID_NONE; this->actionFunc = func_80953F9C; } @@ -192,7 +192,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) { if (this->timePath->unk1 != 0xFF) { func_80953E38(play); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); this->dyna.actor.textId = 0x9E4; Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->unk16C += 1; @@ -206,13 +206,13 @@ void func_80953F9C(BgIngate* this, PlayState* play) { } this->actionFunc = func_809542A0; } - } else if ((ActorCutscene_GetCurrentIndex() == -1) && (this->timePath != NULL)) { + } else if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (this->timePath != NULL)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_CRUISER - SFX_FLAG); func_80953BEC(this); } } - if (ActorCutscene_GetCurrentIndex() != this->unk16E) { - if (ActorCutscene_GetCurrentIndex() != -1) { + if (CutsceneManager_GetCurrentCsId() != this->csId) { + if (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) { Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); player->stateFlags1 |= PLAYER_STATE1_20; play->actorCtx.flags &= ~ACTORCTX_FLAG_PICTO_BOX_ON; @@ -221,7 +221,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) { player->stateFlags1 &= ~PLAYER_STATE1_20; } } - this->unk16E = ActorCutscene_GetCurrentIndex(); + this->csId = CutsceneManager_GetCurrentCsId(); } void func_809541B8(BgIngate* this, PlayState* play) { @@ -231,7 +231,7 @@ void func_809541B8(BgIngate* this, PlayState* play) { if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->dyna.actor.xzDistToPlayer < 40.0f)) { if (this->dyna.actor.playerHeightRel > 15.0f) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); this->dyna.actor.textId = 0x9E6; Message_StartTextbox(play, this->dyna.actor.textId, NULL); this->actionFunc = func_809543D4; @@ -261,7 +261,7 @@ void func_809542A0(BgIngate* this, PlayState* play) { void func_80954340(BgIngate* this, PlayState* play) { if (!DECR(this->unk16A)) { if (this->timePath != NULL) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); this->timePath = &play->setupPathList[this->timePath->unk1]; func_80953F14(this, play); Environment_StopTime(); @@ -280,7 +280,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { break; case 0x9E5: if (play->msgCtx.choiceIndex == 0) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); this->unk160 &= ~0x4; this->actionFunc = func_809541B8; Environment_StartTime(); @@ -301,7 +301,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); func_8019F208(); } else { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); this->unk160 &= ~0x4; this->actionFunc = func_809541B8; Environment_StartTime(); @@ -330,7 +330,7 @@ void BgIngate_Init(Actor* thisx, PlayState* play2) { Actor_SetScale(&this->dyna.actor, 1.0f); this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), 0); this->dyna.actor.room = -1; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); } if (!CHECK_EVENTINF(EVENTINF_35) && CHECK_WEEKEVENTREG(WEEKEVENTREG_90_40)) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h index cc0befd19..6046fc31e 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h @@ -17,7 +17,7 @@ typedef struct BgIngate { /* 0x168 */ s16 timePathTimeSpeed; /* 0x16A */ s16 unk16A; /* 0x16C */ s16 unk16C; - /* 0x16E */ s16 unk16E; + /* 0x16E */ s16 csId; /* 0x170 */ Vec3f timePathTargetPos; /* 0x17C */ f32 timePathProgress; /* 0x180 */ s32 timePathTotalTime; diff --git a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c index 77139783e..a868b355c 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Bombwall/z_bg_kin2_bombwall.c @@ -171,7 +171,7 @@ void BgKin2Bombwall_SetupWait(BgKin2Bombwall* this) { void BgKin2Bombwall_Wait(BgKin2Bombwall* this, PlayState* play) { if (BgKin2Bombwall_IsHitFromNearby(this, play)) { this->collider.base.acFlags &= ~AC_HIT; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); BgKin2Bombwall_SetupPlayCutscene(this); } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); @@ -183,8 +183,8 @@ void BgKin2Bombwall_SetupPlayCutscene(BgKin2Bombwall* this) { } void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); @@ -193,7 +193,7 @@ void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play) { BgKin2Bombwall_SetupEndCutscene(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -205,7 +205,7 @@ void BgKin2Bombwall_SetupEndCutscene(BgKin2Bombwall* this) { void BgKin2Bombwall_EndCutscene(BgKin2Bombwall* this, PlayState* play) { this->timer--; if (this->timer <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index 1550711e1..66ac02634 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -217,13 +217,13 @@ void BgKin2Fence_SetupPlayOpenCutscene(BgKin2Fence* this) { } void BgKin2Fence_PlayOpenCutscene(BgKin2Fence* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); Flags_SetSwitch(play, this->dyna.actor.params & 0x7F); BgKin2Fence_SetupWaitBeforeOpen(this); return; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } void BgKin2Fence_SetupWaitBeforeOpen(BgKin2Fence* this) { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c index 2d7b61d0c..7da9237bc 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Picture/z_bg_kin2_picture.c @@ -202,7 +202,7 @@ void BgKin2Picture_Wait(BgKin2Picture* this, PlayState* play) { // hit by projectile if (this->colliderTris.base.acFlags & AC_HIT) { this->colliderTris.base.acFlags &= ~AC_HIT; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); BgKin2Picture_SetupPlayCutscene(this); } else { // Gold Skulltula can be heard behind Skullkid's painting. if (this->skulltulaNoiseTimer >= 0) { @@ -227,12 +227,12 @@ void BgKin2Picture_SetupPlayCutscene(BgKin2Picture* this) { } void BgKin2Picture_PlayCutscene(BgKin2Picture* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->cutsceneStarted = true; BgKin2Picture_SetupShiver(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -314,7 +314,7 @@ void BgKin2Picture_Fall(BgKin2Picture* this, PlayState* play) { this->dyna.actor.shape.yOffset = 40.0f; if (this->cutsceneStarted) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); diff --git a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c index aacd9b0a7..208babf77 100644 --- a/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c +++ b/src/overlays/actors/ovl_Bg_Ladder/z_bg_ladder.c @@ -90,20 +90,20 @@ void BgLadder_Destroy(Actor* thisx, PlayState* play) { void BgLadder_Wait(BgLadder* this, PlayState* play) { // Wait for the flag to be set, then trigger the cutscene if (Flags_GetSwitch(play, this->switchFlag)) { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->action = BgLadder_StartCutscene; } } void BgLadder_StartCutscene(BgLadder* this, PlayState* play) { // Trigger the cutscene, then make the ladder fade in - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->dyna.actor.draw = BgLadder_Draw; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SECRET_LADDER_APPEAR); this->action = BgLadder_FadeIn; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -112,7 +112,7 @@ void BgLadder_FadeIn(BgLadder* this, PlayState* play) { this->alpha += 5; if (this->alpha >= 255) { this->alpha = 255; - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.flags &= ~ACTOR_FLAG_10; // always update = off this->action = BgLadder_DoNothing; diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c index 63a973d8b..6085a93a2 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.c @@ -164,7 +164,7 @@ void BgLastBwall_Init(Actor* thisx, PlayState* play) { BgLastBwall_InitCollider(&sTrisInit, &this->dyna.actor.world.pos, &this->dyna.actor.shape.rot, &this->colliderTris, D_80C18AC0[this->type]); - SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->dyna.actor, this->csIdList, ARRAY_COUNT(this->csIdList)); func_80C187E4(this); } @@ -239,7 +239,7 @@ void func_80C1886C(BgLastBwall* this, PlayState* play) { } void func_80C18884(BgLastBwall* this, PlayState* play) { - if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->dyna.actor, this->csIdList[0], CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { func_80C188C4(this, play); } } diff --git a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h index 3fafc71ea..e6d752c28 100644 --- a/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h +++ b/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.h @@ -22,7 +22,7 @@ typedef struct BgLastBwall { /* 0x160 */ ColliderTris colliderTris; /* 0x180 */ ColliderTrisElement colliderTrisElement[2]; /* 0x238 */ u8 type; - /* 0x23A */ s16 cutscenes[1]; + /* 0x23A */ s16 csIdList[1]; } BgLastBwall; // size = 0x23C #endif // Z_BG_LAST_BWALL_H diff --git a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c index 4e9862001..3a11a2fdf 100644 --- a/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c +++ b/src/overlays/actors/ovl_Bg_Numa_Hana/z_bg_numa_hana.c @@ -217,13 +217,13 @@ void BgNumaHana_SetupClosedIdle(BgNumaHana* this) { void BgNumaHana_ClosedIdle(BgNumaHana* this, PlayState* play) { if (this->fire.state != FIRE_STATE_NOT_LIT) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_FLAME_IGNITION); - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); SET_WEEKEVENTREG(WEEKEVENTREG_12_01); Flags_SetSwitch(play, BG_NUMA_HANA_SWITCH_FLAG(&this->dyna.actor)); BgNumaHana_SetupUnfoldInnerPetals(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } } @@ -327,7 +327,7 @@ void BgNumaHana_RaiseFlower(BgNumaHana* this, PlayState* play) { this->flowerRotationalVelocity = 0x147; this->settleScale = 0.0f; - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); BgNumaHana_SetupOpenedIdle(this); } diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index 99950a407..6acbc8aa8 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -166,18 +166,18 @@ void func_80ACAEF0(BgOpenShutter* this, PlayState* play) { void BgOpenShutter_Update(Actor* thisx, PlayState* play2) { BgOpenShutter* this = THIS; PlayState* play = play2; - s32 index; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 0x7C)) { - index = Cutscene_GetActorActionIndex(play, 0x7C); - if (play->csCtx.actorActions[index]->action == BGOPENSHUTTER_DOOR_OPEN) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_124)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_124); + if (play->csCtx.actorCues[cueChannel]->id == BGOPENSHUTTER_DOOR_OPEN) { if (this->actionFunc == func_80ACAD88) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_OPEN); this->actionFunc = func_80ACAE5C; this->dyna.actor.velocity.y = 0.0f; } this->unk_164 = 0; - } else if (play->csCtx.actorActions[index]->action == BGOPENSHUTTER_DOOR_CLOSED) { + } else if (play->csCtx.actorCues[cueChannel]->id == BGOPENSHUTTER_DOOR_CLOSED) { if (this->actionFunc == func_80ACAE5C) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SLIDE_DOOR_CLOSE); this->actionFunc = func_80ACAEF0; diff --git a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c index dbe935b3f..275b1b565 100644 --- a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c +++ b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c @@ -47,13 +47,13 @@ void BgOpenSpot_Destroy(Actor* thisx, PlayState* play) { void BgOpenSpot_Update(Actor* thisx, PlayState* play) { BgOpenSpot* this = THIS; - u32 action; + u32 cueId; - if (Cutscene_CheckActorAction(play, 0x7D)) { - action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x7D)]->action; - if (action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_125)) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_125)]->id; + if (cueId == 1) { this->actor.draw = NULL; - } else if (action == 2) { + } else if (cueId == 2) { this->actor.draw = BgOpenSpot_Draw; } } diff --git a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c index 41ecaa19e..1b9e93009 100644 --- a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c +++ b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.c @@ -45,7 +45,7 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { Vec3f pos; s32 pad2; s32 shouldSpawnSeahorse; - s32 cs; + s32 csId; s32 i; DynaPolyActor_Init(&this->dyna, 0); @@ -54,11 +54,11 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&pos, &this->dyna.actor.world.pos); pos.x += Math_SinS(this->dyna.actor.world.rot.y + 0x8000) * 3000.0f; pos.z += Math_CosS(this->dyna.actor.world.rot.y + 0x8000) * 3000.0f; - cs = this->dyna.actor.cutscene; + csId = this->dyna.actor.csId; i = 0; // clang-format off - while (cs != -1) { this->cutscenes[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); i++; } + while (csId != CS_ID_NONE) { this->csIdList[i] = csId; csId = CutsceneManager_GetAdditionalCsId(csId); i++; } // clang-format on this->dyna.actor.scale.x = 0.1f; @@ -74,9 +74,9 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { if (this->deepPython != NULL) { EnDragon* dragon = (EnDragon*)this->deepPython; - dragon->grabCutsceneIndex = this->cutscenes[0]; - dragon->deathCutsceneIndex = this->cutscenes[1]; - dragon->actor.cutscene = this->dyna.actor.cutscene; + dragon->grabCsId = this->csIdList[0]; + dragon->deathCsId = this->csIdList[1]; + dragon->actor.csId = this->dyna.actor.csId; Math_Vec3f_Copy(&dragon->burrowEntrancePos, &this->dyna.actor.world.pos); dragon->pythonIndex = this->pythonIndex; } @@ -99,7 +99,7 @@ void BgSinkaiKabe_Init(Actor* thisx, PlayState* play) { pos.z += (Math_CosS(this->dyna.actor.world.rot.y + 0x8000) * 500.0f); if (shouldSpawnSeahorse) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, pos.x, pos.y, pos.z, 0, - this->dyna.actor.shape.rot.y, 0, 0x4000, this->dyna.actor.cutscene, + this->dyna.actor.shape.rot.y, 0, 0x4000, this->dyna.actor.csId, this->dyna.actor.halfDaysBits, NULL); } diff --git a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h index abb341797..96c771c62 100644 --- a/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h +++ b/src/overlays/actors/ovl_Bg_Sinkai_Kabe/z_bg_sinkai_kabe.h @@ -12,7 +12,7 @@ typedef struct BgSinkaiKabe { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgSinkaiKabeActionFunc actionFunc; /* 0x160 */ Actor* deepPython; - /* 0x164 */ s16 cutscenes[2]; + /* 0x164 */ s16 csIdList[2]; /* 0x168 */ UNK_TYPE1 unk_168[0x4]; /* 0x16C */ s32 pythonIndex; } BgSinkaiKabe; // size = 0x170 diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index 4bc3c87af..0ebae5c1e 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -229,7 +229,7 @@ void func_809CE234(BgSpdweb* this, PlayState* play) { } if (this->unk_162 == 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); return; } @@ -369,8 +369,8 @@ void func_809CE830(BgSpdweb* this, PlayState* play) { } if (this->unk_162 == 0) { - if (ActorCutscene_GetLength(this->dyna.actor.cutscene) == -1) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + if (CutsceneManager_GetLength(this->dyna.actor.csId) == -1) { + CutsceneManager_Stop(this->dyna.actor.csId); } Actor_Kill(&this->dyna.actor); return; @@ -470,16 +470,16 @@ void func_809CEBC0(BgSpdweb* this, PlayState* play) { } void func_809CEE74(BgSpdweb* this) { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = func_809CEEAC; } void func_809CEEAC(BgSpdweb* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); func_809CE1D0(this, play); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index 683bf322e..d4d2c7274 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -47,24 +47,24 @@ void func_80919F30(BgUmajump* this, PlayState* play) { } void BgUmajump_StopCutscene(BgUmajump* this, PlayState* play) { - if ((play->csCtx.frames >= 6) && !this->hasSoundPlayed) { + if ((play->csCtx.curFrame >= 6) && !this->hasSoundPlayed) { this->hasSoundPlayed = true; play_sound(NA_SE_EV_KID_HORSE_NEIGH); } - if (play->csCtx.state == CS_STATE_0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + if (play->csCtx.state == CS_STATE_IDLE) { + CutsceneManager_Stop(this->dyna.actor.csId); this->dyna.actor.update = Actor_Noop; } } void BgUmajump_PlayCutscene(BgUmajump* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); SET_WEEKEVENTREG(WEEKEVENTREG_89_20); this->actionFunc = BgUmajump_StopCutscene; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -95,7 +95,7 @@ void BgUmajump_Init(Actor* thisx, PlayState* play) { if ((thisx->params == BG_UMAJUMP_TYPE_2)) { if ((((play->sceneId == SCENE_F01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_89_20)) && !CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) && - (thisx->cutscene != -1)) { + (thisx->csId != CS_ID_NONE)) { this->actionFunc = BgUmajump_CheckDistance; thisx->update = func_8091A5A0; thisx->flags |= ACTOR_FLAG_10; diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 1454fefa3..eae9fe0b3 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -550,7 +550,7 @@ void Boss02_Init(Actor* thisx, PlayState* play) { s32 i; s32 pad[2]; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && (this->actor.params == TWINMOLD_RED)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) && (this->actor.params == TWINMOLD_RED)) { sBlueWarp = (DoorWarp1*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, 60.0f, 0.0f, 0, 0, 0, 1); Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, 30.0f, -150.0f, 0, 1, 0, 0); @@ -1631,7 +1631,7 @@ void func_809DD934(Boss02* this, PlayState* play) { switch (this->unk_1D18) { case 0: if (player->stateFlags1 & PLAYER_STATE1_100) { - Cutscene_Start(play, &play->csCtx); + Cutscene_StartManual(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -1751,7 +1751,7 @@ void func_809DD934(Boss02* this, PlayState* play) { this->unk_1D18 = 0; func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - Cutscene_End(play, &play->csCtx); + Cutscene_StopManual(play, &play->csCtx); this->actor.flags |= ACTOR_FLAG_1; player->stateFlags1 &= ~PLAYER_STATE1_100; this->unk_1D70 = 0.01f; @@ -2050,10 +2050,11 @@ void func_809DEAC4(Boss02* this, PlayState* play) { break; case 1: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) || ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) || + ((u32)(KREG(13) + 15) >= this->unk_1D1C)) { break; } - Cutscene_Start(play, &play->csCtx); + Cutscene_StartManual(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -2138,8 +2139,8 @@ void func_809DEAC4(Boss02* this, PlayState* play) { if (this->unk_1D1C == (u32)(BREG(27) + 335)) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); this->actor.flags |= ACTOR_FLAG_1; this->unk_1D20 = 0; sRedTwinmold->unk_0144 = sBlueTwinmold->unk_0144 = 3; @@ -2149,8 +2150,8 @@ void func_809DEAC4(Boss02* this, PlayState* play) { break; case 100: - if (ActorCutscene_GetCurrentIndex() == -1) { - Cutscene_Start(play, &play->csCtx); + if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { + Cutscene_StartManual(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -2199,8 +2200,8 @@ void func_809DEAC4(Boss02* this, PlayState* play) { if (this->unk_1D1C == 30) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); this->unk_1D20 = 0; this->actor.flags |= ACTOR_FLAG_1; sp68->unk_0144 = 10; diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 506f8a1fa..c4c38982e 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -48,8 +48,6 @@ * - Effect Update/Draw * - Seaweed */ - -#include "prevent_bss_reordering.h" #include "z_boss_03.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h" @@ -450,7 +448,7 @@ void Boss03_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; Vec3f sp70; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 0.0f, PLATFORM_HEIGHT, 200.0f, 0, 0, 0, ENDOORWARP1_FF_1); Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, 0.0f, PLATFORM_HEIGHT, 0.0f, 0, 0, 0, 0); @@ -1147,8 +1145,8 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { switch (this->csState) { case 0: if (player->actor.world.pos.y < 1350.0f) { - Cutscene_Start(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + Cutscene_StartManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -1369,8 +1367,8 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) { mainCam->at = this->subCamAt; func_80169AFC(play, this->subCamId, 0); - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); this->subCamId = SUB_CAM_ID_DONE; func_809E344C(this, play); @@ -1446,8 +1444,8 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { switch (this->csState) { case 0: - if (ActorCutscene_GetCurrentIndex() == -1) { - Cutscene_Start(play, &play->csCtx); + if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { + Cutscene_StartManual(play, &play->csCtx); func_800B7298(play, &this->actor, PLAYER_CSMODE_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); @@ -1628,8 +1626,8 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) { mainCam->at = this->subCamAt; func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); this->csState = 3; Play_DisableMotionBlur(); Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_INIT_OLD); @@ -1661,8 +1659,8 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { this->csTimer++; switch (this->csState) { case 0: - if (ActorCutscene_GetCurrentIndex() == -1) { - Cutscene_Start(play, &play->csCtx); + if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { + Cutscene_StartManual(play, &play->csCtx); func_800B7298(play, &this->actor, PLAYER_CSMODE_1); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); @@ -1723,8 +1721,8 @@ void Boss03_SpawnSmallFishesCutscene(Boss03* this, PlayState* play) { func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); func_809E344C(this, play); this->workTimer[WORK_TIMER_UNK1_A] = 50; diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 6a6bc0c1d..a39b10143 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -254,16 +254,16 @@ void func_809EC568(Boss04* this, PlayState* play) { this->unk_2D0 = 2000.0f; if ((player->stateFlags1 & PLAYER_STATE1_100000) && (this->actor.projectedPos.z > 0.0f) && (fabsf(this->actor.projectedPos.x) < 300.0f) && (fabsf(this->actor.projectedPos.y) < 300.0f)) { - if ((this->unk_704 >= 15) && (ActorCutscene_GetCurrentIndex() == -1)) { + if ((this->unk_704 >= 15) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE)) { Actor* boss; this->unk_708 = 10; this->unk_704 = 0; - Cutscene_Start(play, &play->csCtx); + Cutscene_StartManual(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); player->actor.world.pos.x = this->unk_6E8; player->actor.world.pos.z = this->unk_6F0 + 410.0f; player->actor.shape.rot.y = 0x7FFF; @@ -389,8 +389,8 @@ void func_809EC568(Boss04* this, PlayState* play) { mainCam->at = this->subCamAt; func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); Play_DisableMotionBlur(); SET_EVENTINF(EVENTINF_60); } diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 13908ec4d..3d8beb79d 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -195,12 +195,12 @@ void func_809F24C8(Boss06* this, PlayState* play) { switch (this->unk_1C9) { case 0: - if (ActorCutscene_GetCurrentIndex() != -1) { + if (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) { break; } - Cutscene_Start(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + Cutscene_StartManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -332,8 +332,8 @@ void func_809F24C8(Boss06* this, PlayState* play) { func_809F2ED0(this, play); func_80169AFC(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); D_809F4970->unk_151 = 0; } break; diff --git a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c index aa37e7b85..6882c189a 100644 --- a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c +++ b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.c @@ -34,7 +34,7 @@ static s16 sObjectBankIndices[] = { OBJECT_GI_MASK14, OBJECT_GI_SWORD_4 }; static s16 sGetItemDraws[] = { GID_MASK_GREAT_FAIRY, GID_SWORD_GREAT_FAIRY }; -static u16 sCsActionIndices[] = { 0x6E, 0x236 }; +static u16 sCueTypes[] = { CS_CMD_ACTOR_CUE_110, CS_CMD_ACTOR_CUE_566 }; void DemoGetitem_Init(Actor* thisx, PlayState* play) { s32 pad; @@ -49,7 +49,7 @@ void DemoGetitem_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.25f); this->actionFunc = func_80A4FB10; this->item = sGetItemDraws[itemIndex]; - this->csAction = sCsActionIndices[itemIndex]; + this->cueType = sCueTypes[itemIndex]; objectIndex = Object_GetIndex(&play->objectCtx, sObjectBankIndices[itemIndex]); if (objectIndex < 0) { Actor_Kill(&this->actor); @@ -74,14 +74,14 @@ void func_80A4FB68(DemoGetitem* this, PlayState* play2) { PlayState* play = play2; u16 sp22 = (play->gameplayFrames * 1000) & 0xFFFF; - if (Cutscene_CheckActorAction(play, this->csAction)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csAction)]->action != 4) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id != 4) { this->actor.shape.yOffset = 0.0f; } - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csAction)]->action) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id) { case 2: this->actor.draw = DemoGetitem_Draw; - Cutscene_ActorTranslate(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csAction)); + Cutscene_ActorTranslate(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); this->actor.shape.rot.y += 0x3E8; break; @@ -91,7 +91,7 @@ void func_80A4FB68(DemoGetitem* this, PlayState* play2) { case 4: this->actor.draw = DemoGetitem_Draw; - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csAction)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); this->actor.shape.yOffset = Math_SinS(sp22) * 15.0f; break; diff --git a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h index 91c7dc97e..ca00f6048 100644 --- a/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h +++ b/src/overlays/actors/ovl_Demo_Getitem/z_demo_getitem.h @@ -12,7 +12,7 @@ typedef void (*DemoGetitemActionFunc)(struct DemoGetitem*, PlayState*); typedef struct DemoGetitem { /* 0x000 */ Actor actor; /* 0x144 */ s16 item; - /* 0x146 */ u16 csAction; + /* 0x146 */ u16 cueType; /* 0x148 */ s8 objectIndex; /* 0x14C */ DemoGetitemActionFunc actionFunc; } DemoGetitem; // size = 0x150 diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index b1d5c7128..111ce284f 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -68,7 +68,7 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { this->unk_3E6 = 0; this->unk_3DC = NULL; this->unk_3E0 = NULL; - this->unk_3F2 = 0; + this->cueId = 0; this->unk_3D8 = 1.0f; switch (DEMOSYOTEN_GET_F(&this->actor)) { @@ -81,7 +81,7 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { this->actor.child = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_DUST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); - this->unk_3F0 = 0x215; + this->cueType = CS_CMD_ACTOR_CUE_533; Actor_SetScale(&this->actor, 0.05f); break; @@ -91,14 +91,14 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { this->unk_3E0 = Lib_SegmentedToVirtual(&object_syoten_Matanimheader_001448); this->unk_3E4 |= 1; this->actionFunc = func_80C16BD4; - this->unk_3F0 = 0x215; + this->cueType = CS_CMD_ACTOR_CUE_533; Actor_SetScale(&this->actor, 0.05f); break; case DEMOSYOTEN_F_2: this->unk_3DC = object_syoten_DL_001730; this->unk_3E0 = Lib_SegmentedToVirtual(&object_syoten_Matanimheader_0018B8); - this->unk_3F0 = 0x216; + this->cueType = CS_CMD_ACTOR_CUE_534; this->actionFunc = func_80C16DD4; this->unk_3E4 |= 2; Actor_SetScale(&this->actor, 4.0f); @@ -107,7 +107,7 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { case DEMOSYOTEN_F_3: this->unk_3DC = object_syoten_DL_001DD0; this->unk_3E0 = Lib_SegmentedToVirtual(&object_syoten_Matanimheader_002B98); - this->unk_3F0 = 0x218; + this->cueType = CS_CMD_ACTOR_CUE_536; this->unk_3E4 |= 8; this->actionFunc = func_80C16EAC; Actor_SetScale(&this->actor, 0.5f); @@ -118,7 +118,7 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { this->unk_3E0 = Lib_SegmentedToVirtual(&object_syoten_Matanimheader_002B88); this->unk_3E4 |= 2; this->actionFunc = func_80C17008; - this->unk_3F0 = 0x217; + this->cueType = CS_CMD_ACTOR_CUE_535; this->unk_3E4 |= 1; this->unk_3E4 |= 8; this->actor.draw = func_80C17690; @@ -219,20 +219,20 @@ void func_80C16A64(DemoSyoten* this, PlayState* play) { } void func_80C16A74(DemoSyoten* this, PlayState* play) { - u16 temp_a0; + u16 cueId; func_80183DE0(&this->unk_144); - if (Cutscene_CheckActorAction(play, this->unk_3F0)) { - if ((play->csCtx.frames >= 160) && (play->csCtx.frames < 322)) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + if ((play->csCtx.curFrame >= 160) && (play->csCtx.curFrame < 322)) { func_800B9010(&this->actor, NA_SE_EV_IKANA_SOUL_LV - SFX_FLAG); - } else if (play->csCtx.frames == 322) { + } else if (play->csCtx.curFrame == 322) { Actor_PlaySfx(&this->actor, NA_SE_EV_IKANA_SOUL_TRANSFORM); } - temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; - if (this->unk_3F2 != temp_a0) { - this->unk_3F2 = temp_a0; - switch (temp_a0) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + if (this->cueId != cueId) { + this->cueId = cueId; + switch (cueId) { case 1: this->actor.draw = NULL; break; @@ -251,7 +251,7 @@ void func_80C16A74(DemoSyoten* this, PlayState* play) { } } - if (temp_a0 == 3) { + if (cueId == 3) { if (this->unk_3D8 > 0.0125f) { this->unk_3D8 -= 0.0125f; if (this->actor.child != NULL) { @@ -271,13 +271,13 @@ void func_80C16A74(DemoSyoten* this, PlayState* play) { void func_80C16BD4(DemoSyoten* this, PlayState* play) { s32 pad; - u16 temp_a0; + u16 cueId; - if (Cutscene_CheckActorAction(play, this->unk_3F0)) { - temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; - if (this->unk_3F2 != temp_a0) { - this->unk_3F2 = temp_a0; - switch (temp_a0) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + if (this->cueId != cueId) { + this->cueId = cueId; + switch (cueId) { default: this->actor.draw = NULL; break; @@ -304,7 +304,7 @@ void func_80C16BD4(DemoSyoten* this, PlayState* play) { } } - switch (temp_a0) { + switch (cueId) { case 3: if (this->actor.scale.x < 0.05f) { this->actor.scale.x += 0.000625f; @@ -314,7 +314,7 @@ void func_80C16BD4(DemoSyoten* this, PlayState* play) { case 4: this->actor.speed = - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->urot.z * 0.005493164f; + play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->rot.z * 0.005493164f; if (this->unk_3EC < this->unk_3E8->count) { if (func_80C16818(this)) { this->unk_3EC++; @@ -330,13 +330,13 @@ void func_80C16BD4(DemoSyoten* this, PlayState* play) { void func_80C16DD4(DemoSyoten* this, PlayState* play) { s32 pad; - u16 temp_a0; + u16 cueId; - if (Cutscene_CheckActorAction(play, this->unk_3F0)) { - temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; - if (this->unk_3F2 != temp_a0) { - this->unk_3F2 = temp_a0; - switch (temp_a0) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + if (this->cueId != cueId) { + this->cueId = cueId; + switch (cueId) { case 1: this->actor.draw = NULL; break; @@ -349,7 +349,7 @@ void func_80C16DD4(DemoSyoten* this, PlayState* play) { } } - if ((temp_a0 == 2) && (this->unk_3E6 < 40)) { + if ((cueId == 2) && (this->unk_3E6 < 40)) { this->unk_3E6++; } } else { @@ -359,13 +359,13 @@ void func_80C16DD4(DemoSyoten* this, PlayState* play) { void func_80C16EAC(DemoSyoten* this, PlayState* play) { s32 pad; - u16 temp_a0; + u16 cueId; - if (Cutscene_CheckActorAction(play, this->unk_3F0)) { - temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; - if (this->unk_3F2 != temp_a0) { - this->unk_3F2 = temp_a0; - switch (temp_a0) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + if (this->cueId != cueId) { + this->cueId = cueId; + switch (cueId) { case 1: this->actor.draw = NULL; this->unk_3D8 = 0.0f; @@ -378,7 +378,7 @@ void func_80C16EAC(DemoSyoten* this, PlayState* play) { } } - if (temp_a0 == 2) { + if (cueId == 2) { if (this->actor.scale.x < 8.0f) { this->actor.scale.x += 0.1875f; } @@ -401,13 +401,13 @@ void func_80C16EAC(DemoSyoten* this, PlayState* play) { } void func_80C17008(DemoSyoten* this, PlayState* play) { - u16 temp_a0; + u16 cueId; - if (Cutscene_CheckActorAction(play, this->unk_3F0)) { - temp_a0 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_3F0)]->action; - if (this->unk_3F2 != temp_a0) { - this->unk_3F2 = temp_a0; - switch (temp_a0) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + if (this->cueId != cueId) { + this->cueId = cueId; + switch (cueId) { case 1: this->actor.draw = NULL; break; @@ -419,7 +419,7 @@ void func_80C17008(DemoSyoten* this, PlayState* play) { } } - if ((temp_a0 == 2) && (this->unk_3E6 < 15)) { + if ((cueId == 2) && (this->unk_3E6 < 15)) { this->unk_3E6++; } } else { diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h index 7b60ae951..1997a2bc5 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h @@ -32,8 +32,8 @@ typedef struct DemoSyoten { /* 0x3E6 */ s16 unk_3E6; /* 0x3E8 */ Path* unk_3E8; /* 0x3EC */ s32 unk_3EC; - /* 0x3F0 */ u16 unk_3F0; - /* 0x3F2 */ u16 unk_3F2; + /* 0x3F0 */ u16 cueType; + /* 0x3F2 */ u16 cueId; /* 0x3F4 */ DemoSyotenActionFunc actionFunc; } DemoSyoten; // size = 0x3F8 diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index ccf41077d..b640b9ba4 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -124,23 +124,23 @@ Actor* func_80C1D78C(PlayState* play) { void func_80C1D7FC(DmAh* this, PlayState* play) { s32 D_80C1DE00[] = { 0, 0, 0, 0, 0 }; - u16 csAction; - s32 actionIndex; + u16 cueId; + s32 cueChannel; if (play->csCtx.state != 0) { if (!this->unk_29C) { - this->action = 0xFF; + this->cueId = 255; this->unk_29C = true; this->animationIndex2 = this->animationIndex; } - if (Cutscene_CheckActorAction(play, 0x232)) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x232); - csAction = play->csCtx.actorActions[actionIndex]->action; - if (this->action != (u8)csAction) { - this->action = csAction; - func_80C1D410(this, D_80C1DE00[csAction]); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_562)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_562); + cueId = play->csCtx.actorCues[cueChannel]->id; + if (this->cueId != (u8)cueId) { + this->cueId = cueId; + func_80C1D410(this, D_80C1DE00[cueId]); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } else if (this->unk_29C) { this->unk_29C = false; diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h index df179c6f6..b1e16f6e0 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.h @@ -19,7 +19,7 @@ typedef struct DmAh { /* 0x1B0 */ Vec3s morphTable[OBJECT_AH_LIMB_MAX]; /* 0x216 */ Vec3s jointTable[OBJECT_AH_LIMB_MAX]; /* 0x27C */ u16 unk_27C; - /* 0x27E */ u8 action; + /* 0x27E */ u8 cueId; /* 0x280 */ Actor* unk_280; /* 0x284 */ s16 unk_284; /* 0x286 */ s16 unk_286; diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c index 2d1e58678..d624f85ca 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c @@ -48,23 +48,23 @@ s32 DmAl_ChangeAnim(DmAl* this, s32 animIndex) { void func_80C1BDD8(DmAl* this, PlayState* play) { s32 D_80C1C280[] = { 0, 0, 0, 0, 0 }; - u16 csAction; - s32 actionIndex; + u16 cueId; + s32 cueChannel; if (play->csCtx.state != 0) { if (!this->unk_45C) { - this->action = 0xFF; + this->cueId = 255; this->unk_45C = true; this->animIndex2 = this->animIndex; } - if (Cutscene_CheckActorAction(play, 0x232)) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x232); - csAction = play->csCtx.actorActions[actionIndex]->action; - if (this->action != (u8)csAction) { - this->action = csAction; - DmAl_ChangeAnim(this, D_80C1C280[csAction]); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_562)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_562); + cueId = play->csCtx.actorCues[cueChannel]->id; + if (this->cueId != (u8)cueId) { + this->cueId = cueId; + DmAl_ChangeAnim(this, D_80C1C280[cueId]); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } else if (this->unk_45C) { this->unk_45C = false; diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.h b/src/overlays/actors/ovl_Dm_Al/z_dm_al.h index 57e462de1..4114b9f9c 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.h +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.h @@ -15,7 +15,7 @@ typedef struct DmAl { /* 0x18C */ MtxF shawlMatrices[6]; /* 0x30C */ Vec3s jointTable[MADAME_AROMA_LIMB_MAX]; /* 0x3AE */ Vec3s morphTable[MADAME_AROMA_LIMB_MAX]; - /* 0x450 */ u8 action; + /* 0x450 */ u8 cueId; /* 0x454 */ s32 animIndex; /* 0x458 */ s32 animIndex2; /* 0x45C */ s32 unk_45C; diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index 555a04cc5..a9276d13b 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -195,28 +195,28 @@ void func_80C1C958(DmAn* this, PlayState* play) { void func_80C1CAB0(DmAn* this, PlayState* play) { s32 sp28[] = { 0, 0, 12, 2, 4, 6, 8, 10, 11, 3 }; - u16 action; - s32 sp20; + u16 cueId; + s32 cueChannel; if (play->csCtx.state != 0) { if (this->unk_2D0 == 0) { - this->unk_2B0 = 255; + this->cueId = 255; this->unk_2D0 = 1; this->unk_2D4 = 0; this->unk_2CC = this->unk_2C8; } - if (Cutscene_CheckActorAction(play, 0x22D)) { - sp20 = Cutscene_GetActorActionIndex(play, 0x22D); - action = play->csCtx.actorActions[sp20]->action; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_557)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_557); + cueId = play->csCtx.actorCues[cueChannel]->id; - if (this->unk_2B0 != (action & 0xFF)) { - this->unk_2B0 = action; + if (this->cueId != (u8)cueId) { + this->cueId = cueId; this->unk_2D4 = 1; - func_80C1C4D8(this, play, sp28[action]); + func_80C1C4D8(this, play, sp28[cueId]); } - switch (this->unk_2B0) { + switch (this->cueId) { case 2: case 4: case 5: @@ -230,7 +230,7 @@ void func_80C1CAB0(DmAn* this, PlayState* play) { } break; } - Cutscene_ActorTranslateAndYaw(&this->actor, play, sp20); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } else if (this->unk_2D0 != 0) { this->unk_2D0 = 0; diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.h b/src/overlays/actors/ovl_Dm_An/z_dm_an.h index 2001a8ba6..6908e9342 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.h +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.h @@ -21,7 +21,7 @@ typedef struct DmAn { /* 0x2AC */ s8 unk_2AC; /* 0x2AD */ s8 unk_2AD; /* 0x2AE */ u16 unk_2AE; - /* 0x2B0 */ u8 unk_2B0; + /* 0x2B0 */ u8 cueId; /* 0x2B4 */ Actor* unk_2B4; /* 0x2B8 */ s16 unk_2B8; /* 0x2BA */ s16 unk_2BA; diff --git a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c index cfd804410..9e5ffed89 100644 --- a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c +++ b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c @@ -74,15 +74,15 @@ void DmBal_DoNothing(DmBal* this, PlayState* play) { } void func_80C1EAE8(DmBal* this, PlayState* play) { - static u16 D_80C1F2C0 = 0x63; - s32 actionIndex; + static u16 sCueId = 99; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 0x238)) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x238); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_568)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_568); - if (D_80C1F2C0 != play->csCtx.actorActions[actionIndex]->action) { - D_80C1F2C0 = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (sCueId != play->csCtx.actorCues[cueChannel]->id) { + sCueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->keepEyesShut = false; this->eyeIndex = 0; @@ -96,7 +96,7 @@ void func_80C1EAE8(DmBal* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 13); break; } - } else if (D_80C1F2C0 == 3) { + } else if (sCueId == 3) { if (Animation_OnFrame(&this->skelAnime, 0.0f)) { this->keepEyesShut = true; } else if (Animation_OnFrame(&this->skelAnime, 29.0f)) { @@ -104,12 +104,12 @@ void func_80C1EAE8(DmBal* this, PlayState* play) { this->eyeIndex = 0; } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); this->actor.home.pos = this->actor.world.pos; } else { this->keepEyesShut = false; this->eyeIndex = 0; - D_80C1F2C0 = 0x63; + sCueId = 99; } } diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 997004fea..210f2ad37 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -150,7 +150,7 @@ void func_80AA5580(SkelAnime* skelAnime, AnimationInfo* animation, u16 idx) { void func_80AA561C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames + 20) { + switch (play->csCtx.curFrame + 20) { case 503: case 926: case 979: @@ -169,7 +169,7 @@ void func_80AA561C(DmChar00* this, PlayState* play) { break; } } else { - switch (play->csCtx.frames + 20) { + switch (play->csCtx.curFrame + 20) { case 503: case 926: case 979: @@ -188,14 +188,14 @@ void func_80AA561C(DmChar00* this, PlayState* play) { } void func_80AA5720(DmChar00* this, PlayState* play) { - if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.frames == 505)) { + if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.curFrame == 505)) { Actor_PlaySfx(&this->actor, NA_SE_EV_SPOT_LIGHT_OPEN); } } void func_80AA575C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 474: case 489: case 495: @@ -227,24 +227,24 @@ void func_80AA575C(DmChar00* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_BRAKE); break; } - } else if (play->csCtx.frames == 660) { + } else if (play->csCtx.curFrame == 660) { Actor_PlaySfx(&this->actor, NA_SE_EV_MONDO_SURPRISE); } } void func_80AA5890(DmChar00* this, PlayState* play) { - if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.frames == 20)) { + if ((DMCHAR00_GET(&this->actor) == DMCHAR00_0) && (play->csCtx.curFrame == 20)) { Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } } void func_80AA58CC(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - if (play->csCtx.frames == 568) { + if (play->csCtx.curFrame == 568) { Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); } } else { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 375: case 479: Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); @@ -262,11 +262,11 @@ void func_80AA5950(DmChar00* this, PlayState* play) { void func_80AA5960(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - if (play->csCtx.frames == 280) { + if (play->csCtx.curFrame == 280) { Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); } } else { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 87: case 190: Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); @@ -281,7 +281,7 @@ void func_80AA5960(DmChar00* this, PlayState* play) { void func_80AA59E4(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 125: Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; @@ -291,14 +291,14 @@ void func_80AA59E4(DmChar00* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); break; } - } else if (play->csCtx.frames == 125) { + } else if (play->csCtx.curFrame == 125) { Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } void func_80AA5A6C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 44: Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; @@ -308,14 +308,14 @@ void func_80AA5A6C(DmChar00* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_SY_WHITE_OUT_INTO_MOON); break; } - } else if (play->csCtx.frames == 44) { + } else if (play->csCtx.curFrame == 44) { Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } void func_80AA5AF4(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 352: case 401: Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); @@ -330,7 +330,7 @@ void func_80AA5AF4(DmChar00* this, PlayState* play) { break; } } else { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 362: case 401: Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); @@ -341,7 +341,7 @@ void func_80AA5AF4(DmChar00* this, PlayState* play) { break; } - if ((play->csCtx.frames >= 500) && (play->csCtx.frames < 602)) { + if ((play->csCtx.curFrame >= 500) && (play->csCtx.curFrame < 602)) { Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SHIVER - SFX_FLAG); } } @@ -349,7 +349,7 @@ void func_80AA5AF4(DmChar00* this, PlayState* play) { void func_80AA5BF8(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 762: Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_SHOT_DASH); break; @@ -358,7 +358,7 @@ void func_80AA5BF8(DmChar00* this, PlayState* play) { break; } } else { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 762: Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_SHOT_DASH); break; @@ -375,14 +375,14 @@ void func_80AA5BF8(DmChar00* this, PlayState* play) { } void func_80AA5CD4(DmChar00* this, PlayState* play) { - if ((DMCHAR00_GET(&this->actor) != DMCHAR00_0) && (play->csCtx.frames == 467)) { + if ((DMCHAR00_GET(&this->actor) != DMCHAR00_0) && (play->csCtx.curFrame == 467)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BLACK_FAIRY_DASH); } } void func_80AA5D10(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 8: Actor_PlaySfx(&this->actor, NA_SE_EV_FAIRY_SURPRISE); break; @@ -396,7 +396,7 @@ void func_80AA5D10(DmChar00* this, PlayState* play) { void func_80AA5D6C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 2: case 166: Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); @@ -411,7 +411,7 @@ void func_80AA5D6C(DmChar00* this, PlayState* play) { void func_80AA5DC8(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_0) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 233: case 415: case 593: @@ -427,7 +427,7 @@ void func_80AA5DC8(DmChar00* this, PlayState* play) { void func_80AA5E2C(DmChar00* this, PlayState* play) { if (DMCHAR00_GET(&this->actor) == DMCHAR00_1) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 32: Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); break; @@ -458,11 +458,11 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) { case SCENE_OPENINGDAN: if (gSaveContext.sceneLayer == 0) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { func_80AA5720(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { func_80AA575C(this, play); - } else if (play->csCtx.currentCsIndex == 2) { + } else if (play->csCtx.scriptIndex == 2) { func_80AA5890(this, play); } } @@ -470,17 +470,17 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) { case SCENE_OKUJOU: if (gSaveContext.sceneLayer == 0) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { func_80AA58CC(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { func_80AA5950(this, play); - } else if (play->csCtx.currentCsIndex == 2) { + } else if (play->csCtx.scriptIndex == 2) { func_80AA5960(this, play); } } else if (gSaveContext.sceneLayer == 2) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { func_80AA59E4(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { func_80AA5A6C(this, play); } } @@ -488,34 +488,34 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) { case SCENE_00KEIKOKU: if (gSaveContext.sceneLayer == 3) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { func_80AA5AF4(this, play); - } else if (play->csCtx.currentCsIndex == 2) { + } else if (play->csCtx.scriptIndex == 2) { func_80AA5E2C(this, play); } } else if (gSaveContext.sceneLayer == 7) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { func_80AA5BF8(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { func_80AA5CD4(this, play); } } break; case SCENE_MITURIN: - if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 1)) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 1)) { func_80AA5DC8(this, play); } break; case SCENE_INSIDETOWER: - if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0)) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 0)) { func_80AA5D10(this, play); } break; case SCENE_PIRATE: - if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0)) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 0)) { func_80AA5D6C(this, play); } break; @@ -535,7 +535,7 @@ void DmChar00_Init(Actor* thisx, PlayState* play) { this->unk_250 = D_80AA77D8[DMCHAR00_GET(thisx)]; thisx->targetArrowOffset = 3000.0f; - this->unk_260 = 99; + this->cueId = 99; this->unk_262 = DMCHAR00_GET_F800(thisx); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 24.0f); @@ -551,18 +551,18 @@ void DmChar00_Destroy(Actor* thisx, PlayState* play) { } void func_80AA62FC(DmChar00* this, PlayState* play) { - u16 sp26 = DMCHAR00_GET(&this->actor) + 113; - s32 temp_v0; + u16 cueType = CS_CMD_ACTOR_CUE_113 + DMCHAR00_GET(&this->actor); + s32 cueChannel; s32 pad; - if (Cutscene_CheckActorAction(play, sp26)) { - temp_v0 = Cutscene_GetActorActionIndex(play, sp26); + if (Cutscene_IsCueInChannel(play, cueType)) { + cueChannel = Cutscene_GetCueChannel(play, cueType); - if (play->csCtx.frames == play->csCtx.actorActions[temp_v0]->startFrame) { - if (this->unk_260 != play->csCtx.actorActions[temp_v0]->action) { - this->unk_260 = play->csCtx.actorActions[temp_v0]->action; + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; - switch (play->csCtx.actorActions[temp_v0]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 0x1: this->unk_261 = 0; break; @@ -786,9 +786,9 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } else { - this->unk_260 = 99; + this->cueId = 99; } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -853,7 +853,7 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { void func_80AA67F8(DmChar00* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((play->csCtx.state == 0) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 1)) { + if ((play->csCtx.state == 0) && (gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 1)) { if (this->unk_261 != 42) { this->unk_261 = 42; func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); @@ -916,7 +916,7 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) { if ((play->csCtx.state == 0) && ((play->sceneId != SCENE_OPENINGDAN) || (gSaveContext.sceneLayer != 0) || (play->roomCtx.curRoom.num != 0) || - (play->csCtx.currentCsIndex != 1) || (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { + (play->csCtx.scriptIndex != 1) || (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { return; } diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h index 62ee0cb40..b4679647b 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h @@ -23,7 +23,7 @@ typedef struct DmChar00 { /* 0x23C */ DmChar00ActionFunc actionFunc; /* 0x240 */ Color_RGBAf unk_240; /* 0x250 */ Color_RGBAf unk_250; - /* 0x260 */ u8 unk_260; + /* 0x260 */ u8 cueId; /* 0x261 */ u8 unk_261; /* 0x262 */ u16 unk_262; } DmChar00; // size = 0x264 diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index e49a1ec56..7b700f4eb 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -67,7 +67,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { switch (DMCHAR01_GET(&this->dyna.actor)) { case DMCHAR01_0: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { this->unk_34C = 2; this->actionFunc = func_80AA8F1C; break; @@ -97,7 +97,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { break; case DMCHAR01_1: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02) || (gSaveContext.sceneLayer == 1)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE) || (gSaveContext.sceneLayer == 1)) { this->unk_34C = 1; this->actionFunc = func_80AA8F1C; } else { @@ -134,7 +134,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryTempleRampAndPlatformCol); this->unk_34D = true; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { this->actionFunc = func_80AA9020; this->dyna.actor.world.pos.y -= 120.0f; } else { @@ -187,19 +187,20 @@ void func_80AA8698(DmChar01* this, PlayState* play) { } void func_80AA884C(DmChar01* this, PlayState* play) { - s16 sp1E = this->dyna.actor.cutscene; + s16 csId = this->dyna.actor.csId; - if (ActorCutscene_GetCanPlayNext(sp1E)) { - ActorCutscene_Start(sp1E, &this->dyna.actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_Start(csId, &this->dyna.actor); this->actionFunc = func_80AA88A8; } else { - ActorCutscene_SetIntentToPlay(sp1E); + CutsceneManager_Queue(csId); } } void func_80AA88A8(DmChar01* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 135)) { - if (play->csCtx.frames == play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 135)]->startFrame) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_135)) { + if (play->csCtx.curFrame == + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_135)]->startFrame) { D_80AAAE24 = 1; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_FORT_RISING); } @@ -344,11 +345,11 @@ void func_80AA8F2C(DmChar01* this, PlayState* play) { } void func_80AA9020(DmChar01* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 135)) { - CsCmdActorAction* temp_v1 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 135)]; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_135)) { + CsCmdActorCue* cue = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_135)]; - if ((temp_v1->startFrame == play->csCtx.frames) && (temp_v1->action == 2)) { - SET_WEEKEVENTREG(WEEKEVENTREG_20_02); + if ((cue->startFrame == play->csCtx.curFrame) && (cue->id == 2)) { + SET_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE); this->actionFunc = func_80AA90AC; } } diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index f1759b7fb..7841d22f5 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -61,7 +61,7 @@ void DmChar02_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animationInfo, u16 } void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 95: Actor_PlaySfx(&this->actor, NA_SE_EV_OCARINA_BOUND_0); break; @@ -75,7 +75,7 @@ void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) } void DmChar02_PlaySfxForCutscenes(DmChar02* this, PlayState* play) { - if ((play->csCtx.state != 0) && (play->sceneId == SCENE_OKUJOU) && (play->csCtx.currentCsIndex == 1)) { + if ((play->csCtx.state != 0) && (play->sceneId == SCENE_OKUJOU) && (play->csCtx.scriptIndex == 1)) { DmChar02_PlaySfxForDroppingOcarinaCutscene(this, play); } } @@ -101,12 +101,12 @@ void DmChar02_Destroy(Actor* thisx, PlayState* play) { void DmChar02_PerformCutsceneActions(DmChar02* this, PlayState* play) { u8 shouldChangeAnimation = true; - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 0x83)) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x83); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - switch (play->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_131)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_131); + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + switch (play->csCtx.actorCues[cueChannel]->id) { default: this->animIndex = DMCHAR02_ANIM_HIT_GROUND; shouldChangeAnimation = false; @@ -130,7 +130,7 @@ void DmChar02_PerformCutsceneActions(DmChar02* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -174,8 +174,8 @@ void DmChar02_Draw(Actor* thisx, PlayState* play) { if ((play->csCtx.state == 0) && (this->actor.world.pos.y < 100.0f)) { shouldDraw = true; - } else if (Cutscene_CheckActorAction(play, 0x6B)) { - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x6B)]->action) { + } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_107)) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_107)]->id) { case 0x17: case 0x1C: case 0x26: diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c index b960ce698..21b9f94df 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c @@ -76,14 +76,14 @@ void func_80AAB5F8(DmChar03* this, PlayState* play) { } void func_80AAB644(DmChar03* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x88)) { - s32 index = Cutscene_GetActorActionIndex(play, 0x88); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_136)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_136); - if (play->csCtx.actorActions[index]->action == 4) { + if (play->csCtx.actorCues[cueChannel]->id == 4) { this->unk_18E = true; - this->offset.x = play->csCtx.actorActions[index]->startPos.x; - this->offset.y = play->csCtx.actorActions[index]->startPos.y; - this->offset.z = play->csCtx.actorActions[index]->startPos.z; + this->offset.x = play->csCtx.actorCues[cueChannel]->startPos.x; + this->offset.y = play->csCtx.actorCues[cueChannel]->startPos.y; + this->offset.z = play->csCtx.actorCues[cueChannel]->startPos.z; } } } @@ -94,11 +94,11 @@ void DmChar03_DoNothing(DmChar03* this, PlayState* play) { void func_80AAB710(DmChar03* this, PlayState* play) { u8 shouldChangeAnim = true; - if (Cutscene_CheckActorAction(play, 0x88)) { - s32 index = Cutscene_GetActorActionIndex(play, 0x88); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_136)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_136); - if (play->csCtx.frames == play->csCtx.actorActions[index]->startFrame) { - switch (play->csCtx.actorActions[index]->action) { + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: shouldChangeAnim = false; break; @@ -124,7 +124,7 @@ void func_80AAB710(DmChar03* this, PlayState* play) { DmChar03_ChangeAnim(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, index); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } @@ -140,8 +140,8 @@ void func_80AAB838(DmChar03* this, PlayState* play) { void DmChar03_Update(Actor* thisx, PlayState* play) { DmChar03* this = THIS; - if (Cutscene_CheckActorAction(play, 0x88) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x88)]->action == 2)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_136) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_136)]->id == 2)) { SkelAnime_Update(&this->skelAnime); } this->actionFunc(this, play); @@ -163,8 +163,8 @@ void DmChar03_Draw(Actor* thisx, PlayState* play) { DmChar03* this = THIS; if (!this->unk_18E) { - if ((Cutscene_CheckActorAction(play, 0x88)) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x88)]->action != 1)) { + if ((Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_136)) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_136)]->id != 1)) { func_8012C28C(play->state.gfxCtx); SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, DmChar03_OverrideLimbDraw, DmChar03_PostLimbDraw, diff --git a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c index 5c835152d..ac479344d 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.c @@ -66,7 +66,7 @@ void DmChar04_Init(Actor* thisx, PlayState* play) { this->primColors = sPrimColors[this->actor.params]; this->envColors = sEnvColors[this->actor.params]; this->actor.targetArrowOffset = 3000.0f; - this->csAction = 0x63; + this->cueId = 99; this->timer = this->actor.params << 0xB; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable, @@ -81,15 +81,15 @@ void DmChar04_Destroy(Actor* thisx, PlayState* play) { } void func_80AABE34(DmChar04* this, PlayState* play) { - u16 params = this->actor.params + 0x71; + u16 cueType = CS_CMD_ACTOR_CUE_113 + this->actor.params; - if (Cutscene_CheckActorAction(play, params)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, params); + if (Cutscene_IsCueInChannel(play, cueType)) { + s32 cueChannel = Cutscene_GetCueChannel(play, cueType); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { - this->csAction = play->csCtx.actorActions[actionIndex]->action; - if (play->csCtx.actorActions[actionIndex]->action == 1) { + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + if (play->csCtx.actorCues[cueChannel]->id == 1) { this->animIndex = 0; } else { this->animIndex = 0; @@ -97,9 +97,9 @@ void func_80AABE34(DmChar04* this, PlayState* play) { DmChar04_ChangeAnim(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } else { - this->csAction = 0x63; + this->cueId = 99; } } diff --git a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h index 0f0fcb6a1..c3d809c63 100644 --- a/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h +++ b/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.h @@ -15,7 +15,7 @@ typedef struct DmChar04 { /* 0x023C */ DmChar04ActionFunc actionFunc; /* 0x240 */ Color_RGBAf primColors; /* 0x250 */ Color_RGBAf envColors; - /* 0x260 */ u8 csAction; + /* 0x260 */ u8 cueId; /* 0x261 */ u8 animIndex; /* 0x262 */ u16 timer; } DmChar04; // size = 0x264 diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c index 77c7c5dab..6b85df5d3 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -177,14 +177,14 @@ void func_80AAC990(DmChar05* this, PlayState* play) { } void func_80AAC9DC(DmChar05* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 109) != 0) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 109); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_109)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_109); - if (play->csCtx.actorActions[actionIndex]->action == 4) { + if (play->csCtx.actorCues[cueChannel]->id == 4) { this->unk_18E = 1; - this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorCues[cueChannel]->startPos.x; + this->unk_190.y = play->csCtx.actorCues[cueChannel]->startPos.y; + this->unk_190.z = play->csCtx.actorCues[cueChannel]->startPos.z; } } } @@ -199,17 +199,17 @@ void func_80AACA98(DmChar05* this, PlayState* play) { } void func_80AACAE4(DmChar05* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 564)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 564); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_564)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_564); - if (play->csCtx.actorActions[actionIndex]->action == 2) { - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + if (play->csCtx.actorCues[cueChannel]->id == 2) { + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { Item_Give(play, ITEM_MASK_COUPLE); } this->unk_18E = 1; - this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorCues[cueChannel]->startPos.x; + this->unk_190.y = play->csCtx.actorCues[cueChannel]->startPos.y; + this->unk_190.z = play->csCtx.actorCues[cueChannel]->startPos.z; } else { this->unk_18E = 0; } @@ -277,13 +277,13 @@ void func_80AACD1C(DmChar05* this, PlayState* play) { } void func_80AACD68(DmChar05* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 473)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 473); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_473)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_473); this->unk_18E = 1; - this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorCues[cueChannel]->startPos.x; + this->unk_190.y = play->csCtx.actorCues[cueChannel]->startPos.y; + this->unk_190.z = play->csCtx.actorCues[cueChannel]->startPos.z; } } @@ -297,27 +297,27 @@ void func_80AACE10(DmChar05* this, PlayState* play) { } void func_80AACE5C(DmChar05* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 518)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 518); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_518)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_518); this->unk_18E = 1; - this->unk_190.x = play->csCtx.actorActions[actionIndex]->startPos.x; - this->unk_190.y = play->csCtx.actorActions[actionIndex]->startPos.y; - this->unk_190.z = play->csCtx.actorActions[actionIndex]->startPos.z; + this->unk_190.x = play->csCtx.actorCues[cueChannel]->startPos.x; + this->unk_190.y = play->csCtx.actorCues[cueChannel]->startPos.y; + this->unk_190.z = play->csCtx.actorCues[cueChannel]->startPos.z; } } void func_80AACF04(DmChar05* this, PlayState* play) { u8 sp2F = true; - s32 actionIndex; + s32 cueChannel; switch (DMCHAR05_GET(&this->actor)) { case DMCHAR05_0: - if (Cutscene_CheckActorAction(play, 109)) { - actionIndex = Cutscene_GetActorActionIndex(play, 109); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_109)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_109); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - switch (play->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: sp2F = false; break; @@ -351,16 +351,16 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } break; case DMCHAR05_1: - if (Cutscene_CheckActorAction(play, 473)) { - actionIndex = Cutscene_GetActorActionIndex(play, 473); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_473)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_473); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - switch (play->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: sp2F = false; break; @@ -395,16 +395,16 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } break; case DMCHAR05_2: - if (Cutscene_CheckActorAction(play, 518)) { - actionIndex = Cutscene_GetActorActionIndex(play, 518); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_518)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_518); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - switch (play->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: sp2F = false; break; @@ -438,16 +438,16 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } break; case DMCHAR05_3: - if (Cutscene_CheckActorAction(play, 559)) { - actionIndex = Cutscene_GetActorActionIndex(play, 559); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_559)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_559); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - switch (play->csCtx.actorActions[actionIndex]->action) { + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + switch (play->csCtx.actorCues[cueChannel]->id) { default: sp2F = false; break; @@ -474,10 +474,10 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } } - if (play->csCtx.actorActions[actionIndex]->action != 4) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + if (play->csCtx.actorCues[cueChannel]->id != 4) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } else { - Cutscene_ActorTranslate(&this->actor, play, actionIndex); + Cutscene_ActorTranslate(&this->actor, play, cueChannel); } } @@ -492,29 +492,29 @@ void func_80AACF04(DmChar05* this, PlayState* play) { } void func_80AAD3F8(DmChar05* this, PlayState* play) { - if (play->csCtx.frames == 490) { + if (play->csCtx.curFrame == 490) { Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER); } - if (play->csCtx.frames > 550) { + if (play->csCtx.curFrame > 550) { Actor_PlaySfx(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); } } void func_80AAD450(DmChar05* this, PlayState* play) { - if (play->csCtx.frames == 262) { + if (play->csCtx.curFrame == 262) { Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER); } - if (play->csCtx.frames > 318) { + if (play->csCtx.curFrame > 318) { Actor_PlaySfx(&this->actor, NA_SE_EN_MASK_FLOAT - SFX_FLAG); } } void func_80AAD4A8(DmChar05* this, PlayState* play) { if (DMCHAR05_GET(&this->actor) == DMCHAR05_0) { - if (Cutscene_CheckActorAction(play, 109) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 109)]->action == 3)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_109) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_109)]->id == 3)) { if (Animation_OnFrame(&this->skelAnime, 14.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_0); } else if (Animation_OnFrame(&this->skelAnime, 19.0f)) { @@ -522,15 +522,15 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) { } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_1) { - if (Cutscene_CheckActorAction(play, 473)) { - if ((play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 473)]->action == 3) && + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_473)) { + if ((play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_473)]->id == 3) && Animation_OnFrame(&this->skelAnime, 5.0f)) { Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_SAND); } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_2) { - if (Cutscene_CheckActorAction(play, 518) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 518)]->action == 2)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_518) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_518)]->id == 2)) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfx(&this->actor, NA_SE_IT_MASK_BOUND_0); } @@ -546,18 +546,18 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) { } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_3) { if (play->sceneId == SCENE_OKUJOU) { if (gSaveContext.sceneLayer == 2) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { func_80AAD3F8(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { func_80AAD450(this, play); } } } else if (play->sceneId == SCENE_SPOT00) { if (gSaveContext.sceneLayer == 9) { - if ((play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 255)) { + if ((play->csCtx.scriptIndex == 0) && (play->csCtx.curFrame == 255)) { Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER); } - } else if ((gSaveContext.sceneLayer == 0xB) && (play->csCtx.frames == 115)) { + } else if ((gSaveContext.sceneLayer == 0xB) && (play->csCtx.curFrame == 115)) { Actor_PlaySfx(&this->actor, NA_SE_EN_EVIL_POWER_PREDEMO); } } @@ -568,25 +568,25 @@ void DmChar05_Update(Actor* thisx, PlayState* play) { DmChar05* this = THIS; func_80AACF04(this, play); - if (Cutscene_CheckActorAction(play, 109)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 109)]->action == 3) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_109)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_109)]->id == 3) { SkelAnime_Update(&this->skelAnime); } - } else if (Cutscene_CheckActorAction(play, 473)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 473)]->action == 3) { + } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_473)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_473)]->id == 3) { SkelAnime_Update(&this->skelAnime); } - } else if (Cutscene_CheckActorAction(play, 518)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 518)]->action == 2) { + } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_518)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_518)]->id == 2) { SkelAnime_Update(&this->skelAnime); } - } else if (Cutscene_CheckActorAction(play, 559)) { - if ((play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 559)]->action == 2) || - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 559)]->action == 3)) { + } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_559)) { + if ((play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_559)]->id == 2) || + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_559)]->id == 3)) { SkelAnime_Update(&this->skelAnime); } - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 559)]->action == 4) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_559)]->id == 4) { this->actor.world.rot.y += 0x258; this->actor.shape.rot.y += 0x258; } @@ -607,8 +607,8 @@ void func_80AAD998(Actor* thisx, PlayState* play) { s32 pad[2]; if (this->unk_18E == 0) { - if (Cutscene_CheckActorAction(play, 109) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 109)]->action != 1)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_109) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_109)]->id != 1)) { OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); @@ -628,8 +628,8 @@ void func_80AADA90(Actor* thisx, PlayState* play) { DmChar05* this = THIS; if (this->unk_18E == 0) { - if (Cutscene_CheckActorAction(play, 473) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 473)]->action != 1)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_473) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_473)]->id != 1)) { func_8012C28C(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); @@ -643,8 +643,8 @@ void func_80AADB4C(Actor* thisx, PlayState* play) { DmChar05* this = THIS; if (this->unk_18E == 0) { - if (Cutscene_CheckActorAction(play, 518) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 518)]->action != 1)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_518) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_518)]->id != 1)) { func_8012C28C(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); @@ -657,19 +657,18 @@ void func_80AADB4C(Actor* thisx, PlayState* play) { void func_80AADC00(Actor* thisx, PlayState* play) { s32 pad; DmChar05* this = THIS; - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 559)) { - actionIndex = Cutscene_GetActorActionIndex(play, 559); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_559)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_559); - if ((play->csCtx.actorActions[actionIndex]->action != 1) && - (play->csCtx.actorActions[actionIndex]->action != 4)) { + if ((play->csCtx.actorCues[cueChannel]->id != 1) && (play->csCtx.actorCues[cueChannel]->id != 4)) { func_8012C28C(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar05_OverrideLimbDraw, DmChar05_PostLimbDraw, &this->actor); } - if (play->csCtx.actorActions[actionIndex]->action == 4) { + if (play->csCtx.actorCues[cueChannel]->id == 4) { Matrix_Translate(-600.0f, 0.0f, 0.0f, MTXMODE_APPLY); Gfx_DrawDListOpa(play, object_dmask_DL_001E70); } diff --git a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c index 0385a82d4..747b2e0c9 100644 --- a/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c +++ b/src/overlays/actors/ovl_Dm_Char06/z_dm_char06.c @@ -37,7 +37,7 @@ void DmChar06_SetupAction(DmChar06* this, DmChar06ActionFunc actionFunc) { void DmChar06_Init(Actor* thisx, PlayState* play) { DmChar06* this = THIS; - SET_WEEKEVENTREG(WEEKEVENTREG_33_80); + SET_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE); Actor_SetScale(&this->actor, 1.0f); this->alpha = 255; DmChar06_SetupAction(this, func_80AAE6F0); @@ -47,17 +47,17 @@ void DmChar06_Destroy(Actor* thisx, PlayState* play) { } void func_80AAE6F0(DmChar06* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x1CF)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 0x1CF); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_463)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_463); - if ((play->csCtx.frames >= play->csCtx.actorActions[actionIndex]->startFrame) && - (play->csCtx.actorActions[actionIndex]->endFrame >= play->csCtx.frames)) { - if (play->csCtx.actorActions[actionIndex]->action == 1) { + if ((play->csCtx.curFrame >= play->csCtx.actorCues[cueChannel]->startFrame) && + (play->csCtx.actorCues[cueChannel]->endFrame >= play->csCtx.curFrame)) { + if (play->csCtx.actorCues[cueChannel]->id == 1) { this->alpha = 255; - } else if (play->csCtx.actorActions[actionIndex]->action == 2) { - f32 lerp = 1.0f - Environment_LerpWeight(play->csCtx.actorActions[actionIndex]->endFrame, - play->csCtx.actorActions[actionIndex]->startFrame, - play->csCtx.frames); + } else if (play->csCtx.actorCues[cueChannel]->id == 2) { + f32 lerp = + 1.0f - Environment_LerpWeight(play->csCtx.actorCues[cueChannel]->endFrame, + play->csCtx.actorCues[cueChannel]->startFrame, play->csCtx.curFrame); this->alpha = 255 * lerp; } } diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c index a1853d04d..1b6d667c2 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c @@ -275,27 +275,27 @@ void DmChar08_WaitForSong(DmChar08* this, PlayState* play) { } void DmChar08_SetupAppearCs(DmChar08* this, PlayState* play) { - s16 cs1 = this->dyna.actor.cutscene; - s16 cs = ActorCutscene_GetAdditionalCutscene( - ActorCutscene_GetAdditionalCutscene(ActorCutscene_GetAdditionalCutscene(cs1))); + s16 csId = this->dyna.actor.csId; + s16 additionalCsId = + CutsceneManager_GetAdditionalCsId(CutsceneManager_GetAdditionalCsId(CutsceneManager_GetAdditionalCsId(csId))); if (CHECK_WEEKEVENTREG(WEEKEVENTREG_93_08)) { - cs1 = cs; + csId = additionalCsId; } - if (ActorCutscene_GetCanPlayNext(cs1)) { - ActorCutscene_Start(cs1, &this->dyna.actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_Start(csId, &this->dyna.actor); SET_WEEKEVENTREG(WEEKEVENTREG_53_20); SET_WEEKEVENTREG(WEEKEVENTREG_93_08); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); this->actionFunc = func_80AAF884; } else { - ActorCutscene_SetIntentToPlay(cs1); + CutsceneManager_Queue(csId); } } void func_80AAF884(DmChar08* this, PlayState* play) { - if (play->csCtx.state == CS_STATE_0) { + if (play->csCtx.state == CS_STATE_IDLE) { DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); DynaPolyActor_LoadMesh(play, &this->dyna, &gTurtleZoraCapeAwakeCol); this->dyna.actor.flags |= ACTOR_FLAG_1; @@ -321,22 +321,22 @@ void func_80AAF8F4(DmChar08* this, PlayState* play) { } void func_80AAFA18(DmChar08* this, PlayState* play) { - s16 nextCs; - s16 nextCs2; - s16 nextCs1; + s16 nextCsId; + s16 nextCsId2; + s16 nextCsId1; - nextCs1 = ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene); - nextCs2 = nextCs1; - nextCs1 = ActorCutscene_GetAdditionalCutscene(nextCs1); + nextCsId1 = CutsceneManager_GetAdditionalCsId(this->dyna.actor.csId); + nextCsId2 = nextCsId1; + nextCsId1 = CutsceneManager_GetAdditionalCsId(nextCsId1); - nextCs = CHECK_WEEKEVENTREG(WEEKEVENTREG_53_40) ? nextCs1 : nextCs2; + nextCsId = CHECK_WEEKEVENTREG(WEEKEVENTREG_53_40) ? nextCsId1 : nextCsId2; - if (ActorCutscene_GetCanPlayNext(nextCs) != 0) { + if (CutsceneManager_IsNext(nextCsId)) { SET_WEEKEVENTREG(WEEKEVENTREG_53_40); - ActorCutscene_Start(nextCs, &this->dyna.actor); + CutsceneManager_Start(nextCsId, &this->dyna.actor); this->actionFunc = DmChar08_DoNothing; } else { - ActorCutscene_SetIntentToPlay(nextCs); + CutsceneManager_Queue(nextCsId); } } @@ -390,7 +390,7 @@ void DmChar08_SpawnBubbles(DmChar08* this, PlayState* play) { void func_80AAFCCC(DmChar08* this, PlayState* play) { switch (play->sceneId) { case SCENE_31MISAKI: - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { switch (this->unk_206) { case 0: break; @@ -455,15 +455,15 @@ void DmChar08_DoNothing(DmChar08* this, PlayState* play) { } void func_80AAFE88(DmChar08* this, PlayState* play) { - s32 actorActionIndex; - CsCmdActorAction* csAction; + s32 cueChannel; + s32 pad; f32 phi_f12; - if (Cutscene_CheckActorAction(play, 474)) { - actorActionIndex = Cutscene_GetActorActionIndex(play, 474); - if (this->unk_1F6 != play->csCtx.actorActions[actorActionIndex]->action) { - this->unk_1F6 = play->csCtx.actorActions[actorActionIndex]->action; - switch (play->csCtx.actorActions[actorActionIndex]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_474)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_474); + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->animIndex = TURTLE_ANIM_IDLE; break; @@ -514,12 +514,12 @@ void func_80AAFE88(DmChar08* this, PlayState* play) { break; } } - switch (play->csCtx.actorActions[actorActionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 2: this->unk_1FF = 1; - phi_f12 = 2.0f * Environment_LerpWeight(play->csCtx.actorActions[actorActionIndex]->endFrame, - play->csCtx.actorActions[actorActionIndex]->startFrame, - play->csCtx.frames); + phi_f12 = + 2.0f * Environment_LerpWeight(play->csCtx.actorCues[cueChannel]->endFrame, + play->csCtx.actorCues[cueChannel]->startFrame, play->csCtx.curFrame); if (phi_f12 > 1.0f) { phi_f12 = 1.0f; } @@ -529,30 +529,30 @@ void func_80AAFE88(DmChar08* this, PlayState* play) { this->unk_1FF = 2; } - Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, actorActionIndex); + Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, cueChannel); break; case 5: - Cutscene_ActorTranslateAndYawSmooth(&this->dyna.actor, play, actorActionIndex); + Cutscene_ActorTranslateAndYawSmooth(&this->dyna.actor, play, cueChannel); break; case 14: - Cutscene_ActorTranslate(&this->dyna.actor, play, actorActionIndex); - Math_SmoothStepToS(&this->dyna.actor.world.rot.y, play->csCtx.actorActions[actorActionIndex]->rot.y, - 0xA, 0xDC, 1); + Cutscene_ActorTranslate(&this->dyna.actor, play, cueChannel); + Math_SmoothStepToS(&this->dyna.actor.world.rot.y, play->csCtx.actorCues[cueChannel]->rot.y, 0xA, 0xDC, + 1); this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; break; default: - Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, actorActionIndex); + Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, cueChannel); break; } this->targetYPos = this->dyna.actor.world.pos.y; - if ((this->unk_1FF >= 2) || (play->csCtx.actorActions[actorActionIndex]->action == 2)) { + if ((this->unk_1FF >= 2) || (play->csCtx.actorCues[cueChannel]->id == 2)) { Math_SmoothStepToF(&this->unk_1F0, 1.0f, 0.02f, 0.1f, 0.00001f); } } else { - this->unk_1F6 = 99; + this->cueId = 99; } } @@ -894,8 +894,8 @@ void func_80AB032C(DmChar08* this, PlayState* play) { void func_80AB096C(DmChar08* this, PlayState* play) { if ((play->csCtx.state != 0) && (play->sceneId == SCENE_31MISAKI) && (gSaveContext.sceneLayer == 0) && - (play->csCtx.currentCsIndex == 0)) { - if ((play->csCtx.frames >= 890) && (play->csCtx.frames < 922)) { + (play->csCtx.scriptIndex == 0)) { + if ((play->csCtx.curFrame >= 890) && (play->csCtx.curFrame < 922)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); } } @@ -1097,7 +1097,7 @@ void DmChar08_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sBigTurtleEyeTextures[this->eyeIndex])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sBigTurtleEyeTextures[this->eyeIndex])); - if ((this->unk_1FF > 0) || (play->csCtx.state != CS_STATE_0)) { + if ((this->unk_1FF > 0) || (play->csCtx.state != CS_STATE_IDLE)) { SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, DmChar08_OverrideLimbDraw, DmChar08_PostLimbDraw, DmChar08_TransformLimbDraw, &this->dyna.actor); diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h index f339bceaa..9fdbade43 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.h @@ -22,7 +22,7 @@ typedef struct DmChar08 { /* 0x1E8 */ UNK_TYPE1 unk_1E8[8]; /* 0x1F0 */ f32 unk_1F0; /* 0x1F4 */ s16 unk_1F4; - /* 0x1F6 */ s16 unk_1F6; + /* 0x1F6 */ s16 cueId; /* 0x1F6 */ s16 blinkTimer; /* 0x1FA */ s16 unk_1FA; /* 0x1FC */ u16 unk_1FC; diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c index 442058677..567b33685 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c @@ -127,24 +127,24 @@ void func_80AB2268(DmChar09* this, PlayState* play) { Path* path; s32 pad; s32 i; - s32 actionIndex; + s32 cueChannel; s32 max = 0; s32 pathnum; u8 temp = false; if (!DMCHAR09_GET_F(&this->actor)) { - if (play->csCtx.currentCsIndex == 1) { + if (play->csCtx.scriptIndex == 1) { temp = true; } - } else if (play->csCtx.currentCsIndex == 0) { + } else if (play->csCtx.scriptIndex == 0) { temp = true; } - if (Cutscene_CheckActorAction(play, 0x1F7) && temp) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x1F7); - if (this->unk_22F != play->csCtx.actorActions[actionIndex]->action) { - this->unk_22F = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_503) && temp) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_503); + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 2: max = 0; break; @@ -159,7 +159,7 @@ void func_80AB2268(DmChar09* this, PlayState* play) { break; } - if (play->csCtx.actorActions[actionIndex]->action >= 2) { + if (play->csCtx.actorCues[cueChannel]->id >= 2) { pathnum = DMCHAR09_GET_PATH(&this->actor); path = &play->setupPathList[pathnum]; @@ -175,7 +175,7 @@ void func_80AB2268(DmChar09* this, PlayState* play) { this->unk_220 = 1; this->unk_22E = true; - this->speed = (u16)play->csCtx.actorActions[actionIndex]->rot.z * 0.00390625f; + this->speed = (u16)play->csCtx.actorCues[cueChannel]->rot.z * 0.00390625f; this->actionFunc = func_80AB1FDC; } else { this->unk_22E = false; @@ -183,7 +183,7 @@ void func_80AB2268(DmChar09* this, PlayState* play) { } } } else { - this->unk_22F = 0x63; + this->cueId = 99; } } diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h index dffe65975..cfb3523e6 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h @@ -31,7 +31,7 @@ typedef struct DmChar09 { /* 0x22A */ s16 unk_22A; /* 0x22C */ UNK_TYPE1 pad22C[2]; /* 0x22E */ u8 unk_22E; - /* 0x22F */ u8 unk_22F; + /* 0x22F */ u8 cueId; } DmChar09; // size = 0x230 #endif // Z_DM_CHAR09_H diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index 177a21394..f20c87cb4 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -195,28 +195,28 @@ void func_80C248A8(DmGm* this, PlayState* play) { void func_80C24A00(DmGm* this, PlayState* play) { s32 sp28[] = { 0, 0, 12, 2, 4, 6, 8, 10, 11, 3 }; - u16 action; - s32 sp20; + u16 cueId; + s32 cueChannel; if (play->csCtx.state != 0) { if (this->unk_2D0 == 0) { - this->unk_2B0 = 255; + this->cueId = 255; this->unk_2D0 = 1; this->unk_2D4 = 0; this->unk_2CC = this->unk_2C8; } - if (Cutscene_CheckActorAction(play, 0x22D)) { - sp20 = Cutscene_GetActorActionIndex(play, 0x22D); - action = play->csCtx.actorActions[sp20]->action; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_557)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_557); + cueId = play->csCtx.actorCues[cueChannel]->id; - if (this->unk_2B0 != (action & 0xFF)) { - this->unk_2B0 = action; + if (this->cueId != (u8)cueId) { + this->cueId = cueId; this->unk_2D4 = 1; - func_80C24428(this, play, sp28[action]); + func_80C24428(this, play, sp28[cueId]); } - switch (this->unk_2B0) { + switch (this->cueId) { case 2: case 4: case 5: @@ -230,7 +230,7 @@ void func_80C24A00(DmGm* this, PlayState* play) { } break; } - Cutscene_ActorTranslateAndYaw(&this->actor, play, sp20); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } else if (this->unk_2D0 != 0) { this->unk_2D0 = 0; diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h index 54db8d30f..8b6b3f652 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.h @@ -21,7 +21,7 @@ typedef struct DmGm { /* 0x2AC */ s8 unk_2AC; /* 0x2AD */ s8 unk_2AD; /* 0x2AE */ u16 unk_2AE; - /* 0x2B0 */ u8 unk_2B0; + /* 0x2B0 */ u8 cueId; /* 0x2B4 */ Actor* unk_2B4; /* 0x2B8 */ s16 unk_2B8; /* 0x2BA */ s16 unk_2BA; diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index e9fa1cddd..da2bd225a 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -43,23 +43,23 @@ s32 func_80C1DED0(DmNb* this, s32 arg1) { void func_80C1DF18(DmNb* this, PlayState* play) { s32 sp2C[] = { 0, 0, 0, 0, 0 }; - u16 csAction; - s32 csActionIndex; + u16 cueId; + s32 cueChannel; if (play->csCtx.state != 0) { if (this->unk1F8 == 0) { - this->unk1EC = 0xFF; + this->cueId = 255; this->unk1F8 = 1; this->unk1F4 = this->unk1F0; } - if (Cutscene_CheckActorAction(play, 0x232)) { - csActionIndex = Cutscene_GetActorActionIndex(play, 0x232); - csAction = play->csCtx.actorActions[csActionIndex]->action; - if (this->unk1EC != (u8)csAction) { - this->unk1EC = csAction; - func_80C1DED0(this, sp2C[csAction]); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_562)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_562); + cueId = play->csCtx.actorCues[cueChannel]->id; + if (this->cueId != (u8)cueId) { + this->cueId = cueId; + func_80C1DED0(this, sp2C[cueId]); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, csActionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } else if (this->unk1F8 != 0) { this->unk1F8 = 0; diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h index 3f35beea0..7bb7b39cd 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.h @@ -14,7 +14,7 @@ typedef struct DmNb { /* 0x188 */ DmNbActionFunc actionFunc; /* 0x18C */ Vec3s jointTable[NB_LIMB_MAX]; /* 0x1BC */ Vec3s morphTable[NB_LIMB_MAX]; - /* 0x1EC */ u8 unk1EC; + /* 0x1EC */ u8 cueId; /* 0x1F0 */ s32 unk1F0; /* 0x1F4 */ s32 unk1F4; /* 0x1F8 */ s32 unk1F8; diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c index db76db278..e0d2fc2a3 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c @@ -70,24 +70,24 @@ void DmOpstage_Destroy(Actor* thisx, PlayState* play) { } void DmOpstage_FollowCutsceneScript(DmOpstage* this, PlayState* play) { - s32 actionIndex; + s32 cueChannel; if (DMOPSTAGE_GET_TYPE(&this->dyna.actor) == DMOPSTAGE_TYPE_GROUND) { - if (Cutscene_CheckActorAction(play, 0x73)) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x73); - if (play->csCtx.actorActions[actionIndex]->action == 2) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_115)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_115); + if (play->csCtx.actorCues[cueChannel]->id == 2) { this->dyna.actor.scale.x = 0.075f; this->dyna.actor.scale.z = 0.3f; } else { this->dyna.actor.scale.x = 0.1f; this->dyna.actor.scale.z = 0.1f; } - Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->dyna.actor, play, cueChannel); } - } else if (Cutscene_CheckActorAction(play, DMOPSTAGE_GET_ACTORACTION(&this->dyna.actor) + 0x74)) { + } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_116 + DMOPSTAGE_GET_CUE_TYPE_OFFSET(&this->dyna.actor))) { Cutscene_ActorTranslateAndYaw( &this->dyna.actor, play, - Cutscene_GetActorActionIndex(play, DMOPSTAGE_GET_ACTORACTION(&this->dyna.actor) + 0x74)); + Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_116 + DMOPSTAGE_GET_CUE_TYPE_OFFSET(&this->dyna.actor))); } } @@ -95,7 +95,7 @@ void DmOpstage_Update(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; this->actionFunc(this, play); - if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 0) && (play->csCtx.frames == 480)) { + if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 0) && (play->csCtx.curFrame == 480)) { // This actor is responsible for playing the fairy sound during the exposition in the intro, // during the transition to Lost Woods, before Ocarina gets stolen. func_8019F128(NA_SE_EV_NAVY_FLY_REBIRTH); diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h index 3d9195413..03fd093f3 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.h @@ -4,7 +4,7 @@ #include "global.h" #define DMOPSTAGE_GET_TYPE(thisx) ((thisx)->params & 0xFF) -#define DMOPSTAGE_GET_ACTORACTION(thisx) (((thisx)->params >> 8) & 0xFF) +#define DMOPSTAGE_GET_CUE_TYPE_OFFSET(thisx) (((thisx)->params >> 8) & 0xFF) struct DmOpstage; diff --git a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c index cd6890505..42a846357 100644 --- a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c +++ b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c @@ -63,7 +63,7 @@ void DmRavine_Update(Actor* thisx, PlayState* play) { play->roomCtx.unk7A[1]++; if (play->roomCtx.unk7A[1] > 254) { play->roomCtx.unk7A[1] = 254; - if (play->csCtx.frames > 700) { + if (play->csCtx.curFrame > 700) { play->roomCtx.unk7A[1] = 255; play->roomCtx.unk7A[0] = 0; this->state++; // -> DM_RAVINE_STATE_PENDING_DEATH diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index f8210a9de..164d6ea53 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -336,7 +336,7 @@ void DmStk_ChangeAnim(DmStk* this, PlayState* play, SkelAnime* skelAnime, Animat * after Skull Kid steals Epona. */ void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, PlayState* play) { - switch (play->csCtx.frames + 20) { + switch (play->csCtx.curFrame + 20) { case 1195: Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); break; @@ -427,7 +427,7 @@ void DmStk_PlaySfxForIntroCutsceneFirstPart(DmStk* this, PlayState* play) { * any sound in-game, since all sound effects are muted when it plays. */ void DmStk_PlaySfxForTitleCutscene(DmStk* this, PlayState* play) { - if (play->csCtx.frames == 535) { + if (play->csCtx.curFrame == 535) { func_8019F128(NA_SE_EV_CLOCK_TOWER_BELL); } } @@ -437,7 +437,7 @@ void DmStk_PlaySfxForTitleCutscene(DmStk* this, PlayState* play) { * that starts after the fade-to-white and ends when the player gains control. */ void DmStk_PlaySfxForIntroCutsceneSecondPart(DmStk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 78: case 89: case 100: @@ -469,7 +469,7 @@ void DmStk_PlaySfxForIntroCutsceneSecondPart(DmStk* this, PlayState* play) { * the Happy Mask Salesman. */ void DmStk_PlaySfxForObtainingMajorasMaskCutscene(DmStk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 18: Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_GASAGOSO); break; @@ -490,7 +490,7 @@ void DmStk_PlaySfxForObtainingMajorasMaskCutscene(DmStk* this, PlayState* play) * the hallucinatory Deku Scrubs scene. */ void DmStk_PlaySfxForCurseCutsceneFirstPart(DmStk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 415: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 100); break; @@ -518,7 +518,7 @@ void DmStk_PlaySfxForCurseCutsceneFirstPart(DmStk* this, PlayState* play) { void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, PlayState* play) { Player* player = GET_PLAYER(play); - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 10: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 50); break; @@ -558,7 +558,7 @@ void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, PlayState* play) { if (player) {} - if ((play->csCtx.frames >= 263) && (play->csCtx.frames < 698)) { + if ((play->csCtx.curFrame >= 263) && (play->csCtx.curFrame < 698)) { Actor_PlaySfx(&player->actor, NA_SE_EN_STALKIDS_BODY_LEV - SFX_FLAG); } } @@ -571,7 +571,7 @@ void DmStk_PlaySfxForCurseCutsceneSecondPart(DmStk* this, PlayState* play) { void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* play) { static s32 sMoonCallTimer = 0; - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 140: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 80); break; @@ -594,7 +594,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* pla break; } - if ((this->animIndex == SK_ANIM_OCARINA_JUGGLE) && (play->csCtx.frames < 700)) { + if ((this->animIndex == SK_ANIM_OCARINA_JUGGLE) && (play->csCtx.curFrame < 700)) { if (Animation_OnFrame(&this->skelAnime, 5.0f) || Animation_OnFrame(&this->skelAnime, 25.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_OTEDAMA1); } else if (Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 40.0f)) { @@ -602,7 +602,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* pla } } - if (play->csCtx.frames >= 700) { + if (play->csCtx.curFrame >= 700) { if (sMoonCallTimer < 128) { if ((sMoonCallTimer & 0x1F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL20_CALL_MOON); @@ -621,7 +621,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(DmStk* this, PlayState* pla * Handles sound effects for the cutscene where Skull Kid drops the Ocarina of Time. */ void DmStk_PlaySfxForDroppingOcarinaCutscene(DmStk* this, PlayState* play) { - if (play->csCtx.frames == 3) { + if (play->csCtx.curFrame == 3) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL06_SURPRISED); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_DOWN_K); } @@ -631,7 +631,7 @@ void DmStk_PlaySfxForDroppingOcarinaCutscene(DmStk* this, PlayState* play) { * Handles sound effects for the cutscene where Skull Kid is shivering in the rain. */ void DmStk_PlaySfxForShiveringInRainCutscene(DmStk* this, PlayState* play) { - if ((play->csCtx.frames >= 642) && (play->csCtx.frames < 845)) { + if ((play->csCtx.curFrame >= 642) && (play->csCtx.curFrame < 845)) { Actor_PlaySfx(&this->actor, NA_SE_NE_STAL23_COLD - SFX_FLAG); } } @@ -641,7 +641,7 @@ void DmStk_PlaySfxForShiveringInRainCutscene(DmStk* this, PlayState* play) { * in Termina Field. */ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 58: case 61: case 68: @@ -668,7 +668,7 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) { * the Giants are walking away. */ void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 5: Audio_PlayAmbience(AMBIENCE_ID_0C); break; @@ -686,7 +686,7 @@ void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, PlayState* play) { void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { Player* player = GET_PLAYER(play); - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 5: Audio_PlayAmbience(AMBIENCE_ID_0C); break; @@ -760,7 +760,7 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { void DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(DmStk* this, PlayState* play) { static s32 sMoonCallTimer = 0; - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 40: func_801A479C(&this->actor.projectedPos, NA_SE_EN_STALKIDS_FLOAT, 80); break; @@ -779,7 +779,7 @@ void DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(DmStk* this, PlayState* pla break; } - if (play->csCtx.frames >= 408) { + if (play->csCtx.curFrame >= 408) { if (sMoonCallTimer < 128) { if ((sMoonCallTimer & 0x1F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL20_CALL_MOON); @@ -803,7 +803,7 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla this->oathToOrderCutsceneVoicePos.y = this->actor.projectedPos.y; this->oathToOrderCutsceneVoicePos.z = this->actor.projectedPos.z; - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 64: Audio_PlaySfxAtPos(&this->oathToOrderCutsceneVoicePos, NA_SE_EN_STAL06_SURPRISED); break; @@ -847,13 +847,13 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla if (1) {} - if ((play->csCtx.frames >= 62) && (play->csCtx.frames < 273)) { + if ((play->csCtx.curFrame >= 62) && (play->csCtx.curFrame < 273)) { if ((Rand_ZeroOne() < 0.75f) && ((play->state.frames % 2) != 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_EARTHQUAKE); } } - if ((play->csCtx.frames >= 498) && (play->csCtx.frames < 577)) { + if ((play->csCtx.curFrame >= 498) && (play->csCtx.curFrame < 577)) { if ((play->state.frames % 4) == 0) { if ((play->state.frames & 4) != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_BODY_LEV); @@ -863,7 +863,7 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla } } - if (play->csCtx.frames >= 290) { + if (play->csCtx.curFrame >= 290) { func_8019F128(NA_SE_EV_KYOJIN_VOICE_SUCCESS - SFX_FLAG); } } @@ -874,7 +874,7 @@ void DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(DmStk* this, PlayState* pla * moon, which is slightly longer. */ void DmStk_PlaySfxForMoonWarpCutsceneVersion1(DmStk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 551: Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_PULLED); break; @@ -896,7 +896,7 @@ void DmStk_PlaySfxForMoonWarpCutsceneVersion1(DmStk* this, PlayState* play) { * warps to the moon, which is slightly shorter. */ void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 311: Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_PULLED); break; @@ -923,7 +923,7 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { DmStk_PlaySfxForIntroCutsceneFirstPart(this, play); } else if (gSaveContext.sceneLayer == 0) { DmStk_PlaySfxForIntroCutsceneSecondPart(this, play); - } else if ((gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) { + } else if ((gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) { DmStk_PlaySfxForObtainingMajorasMaskCutscene(this, play); } break; @@ -936,9 +936,9 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { case SCENE_OPENINGDAN: if (gSaveContext.sceneLayer == 0) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { DmStk_PlaySfxForCurseCutsceneFirstPart(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { DmStk_PlaySfxForCurseCutsceneSecondPart(this, play); } } @@ -946,19 +946,19 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { case SCENE_OKUJOU: if (gSaveContext.sceneLayer == 0) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { DmStk_PlaySfxForDroppingOcarinaCutscene(this, play); - } else if (play->csCtx.currentCsIndex == 2) { + } else if (play->csCtx.scriptIndex == 2) { DmStk_PlaySfxForClockTowerIntroCutsceneVersion2(this, play); - } else if (play->csCtx.currentCsIndex == 3) { + } else if (play->csCtx.scriptIndex == 3) { DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(this, play); } } else if (gSaveContext.sceneLayer == 2) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { DmStk_PlaySfxForMoonWarpCutsceneVersion1(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { DmStk_PlaySfxForMoonWarpCutsceneVersion2(this, play); } } @@ -966,15 +966,15 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { case SCENE_00KEIKOKU: if (gSaveContext.sceneLayer == 3) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { DmStk_PlaySfxForShiveringInRainCutscene(this, play); - } else if (play->csCtx.currentCsIndex == 2) { + } else if (play->csCtx.scriptIndex == 2) { DmStk_PlaySfxForPlayingWithFairiesCutscene(this, play); } } else if (gSaveContext.sceneLayer == 7) { - if (play->csCtx.currentCsIndex == 0) { + if (play->csCtx.scriptIndex == 0) { DmStk_PlaySfxForEndingCutsceneFirstPart(this, play); - } else if (play->csCtx.currentCsIndex == 1) { + } else if (play->csCtx.scriptIndex == 1) { DmStk_PlaySfxForEndingCutsceneSecondPart(this, play); } } @@ -1119,7 +1119,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->fadeOutTimer = 0; this->alpha = this->alpha; this->actor.targetArrowOffset = 1100.0f; - this->csAction = 99; + this->cueId = 99; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gSkullKidSkel, NULL, NULL, NULL, 0); DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); @@ -1127,7 +1127,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); - if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.currentCsIndex > 0)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.scriptIndex > 0)) { play->envCtx.unk_17 = 15; play->envCtx.unk_18 = 15; } @@ -1165,35 +1165,35 @@ void DmStk_WaitForTelescope(DmStk* this, PlayState* play) { * Plays the cutscene in the telescope where the Moon's Tear falls. */ void DmStk_StartTelescopeCutscene(DmStk* this, PlayState* play) { - s16 dayOneAndTwoCutscene = this->actor.cutscene; - s16 dayThreeCutscene = ActorCutscene_GetAdditionalCutscene(dayOneAndTwoCutscene); - s16 finalHoursCutscene = ActorCutscene_GetAdditionalCutscene(dayThreeCutscene); - s16 cutscene; + s16 dayOneAndTwoCsId = this->actor.csId; + s16 dayThreeCsId = CutsceneManager_GetAdditionalCsId(dayOneAndTwoCsId); + s16 finalHoursCsId = CutsceneManager_GetAdditionalCsId(dayThreeCsId); + s16 csId; if (gSaveContext.save.day < 3) { - cutscene = dayOneAndTwoCutscene; + csId = dayOneAndTwoCsId; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40) || ((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { - cutscene = finalHoursCutscene; + csId = finalHoursCsId; } else { - cutscene = dayThreeCutscene; + csId = dayThreeCsId; } - if (ActorCutscene_GetCanPlayNext(cutscene)) { - ActorCutscene_Start(cutscene, &this->actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_Start(csId, &this->actor); Environment_StartTime(); this->actionFunc = DmStk_DoNothing; } else { - ActorCutscene_SetIntentToPlay(cutscene); + CutsceneManager_Queue(csId); } } void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(9)) { - ActorCutscene_Start(9, &this->actor); + if (CutsceneManager_IsNext(9)) { + CutsceneManager_Start(9, &this->actor); this->actionFunc = DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd; } else { - ActorCutscene_SetIntentToPlay(9); + CutsceneManager_Queue(9); } } @@ -1207,11 +1207,11 @@ void DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd(DmStk* this, PlayState* } void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(11)) { - ActorCutscene_Start(11, &this->actor); + if (CutsceneManager_IsNext(11)) { + CutsceneManager_Start(11, &this->actor); this->actionFunc = DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd; } else { - ActorCutscene_SetIntentToPlay(11); + CutsceneManager_Queue(11); } } @@ -1224,21 +1224,21 @@ void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, PlayState* } void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(10)) { + if (CutsceneManager_IsNext(10)) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_DAMAGE); - ActorCutscene_Start(10, &this->actor); + CutsceneManager_Start(10, &this->actor); this->actor.shape.rot.x = 0; this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.shape.rot.y = this->actor.shape.rot.x; this->actor.world.rot.y = this->actor.shape.rot.x; this->actionFunc = DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd; } else { - ActorCutscene_SetIntentToPlay(10); + CutsceneManager_Queue(10); } } void DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd(DmStk* this, PlayState* play) { - if ((play->csCtx.state != 0) && (play->csCtx.frames > 20)) { + if ((play->csCtx.state != 0) && (play->csCtx.curFrame > 20)) { this->actionFunc = DmStk_ClockTower_Idle; } } @@ -1307,21 +1307,21 @@ void DmStk_ClockTower_WaitForDeflectionToEnd(DmStk* this, PlayState* play) { */ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { s32 pad; - s32 actorActionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 107)) { - actorActionIndex = Cutscene_GetActorActionIndex(play, 107); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_107)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_107); - if (play->csCtx.frames == play->csCtx.actorActions[actorActionIndex]->startFrame) { - if (this->csAction != play->csCtx.actorActions[actorActionIndex]->action) { - this->csAction = play->csCtx.actorActions[actorActionIndex]->action; + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; if (play->sceneId == SCENE_CLOCKTOWER) { this->handType = SK_HAND_TYPE_HOLDING_FLUTE; } else { this->handType = SK_HAND_TYPE_DEFAULT; } - switch (play->csCtx.actorActions[actorActionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 0: case 1: this->animIndex = SK_ANIM_IDLE; @@ -1581,9 +1581,9 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actorActionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } else { - this->csAction = 99; + this->cueId = 99; } if (this->fadeInState == SK_FADE_IN_STATE_START) { @@ -1794,12 +1794,12 @@ void DmStk_Update(Actor* thisx, PlayState* play) { break; case SK_DEKU_PIPES_CS_STATE_PLAYER_USED_OCARINA: - if (ActorCutscene_GetCanPlayNext(16)) { + if (CutsceneManager_IsNext(16)) { this->dekuPipesCutsceneState = SK_DEKU_PIPES_CS_STATE_START; - ActorCutscene_Start(16, &this->actor); + CutsceneManager_Start(16, &this->actor); this->actionFunc = DmStk_ClockTower_Idle; } else { - ActorCutscene_SetIntentToPlay(16); + CutsceneManager_Queue(16); } break; @@ -1814,7 +1814,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { // Skull Kid is always loaded in the scene, even if he isn't visible, hence why time always passes. if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) && - (play->transitionTrigger == TRANS_TRIGGER_OFF) && (ActorCutscene_GetCurrentIndex() == -1) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (play->csCtx.state == 0)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; if (R_TIME_SPEED != 0) { @@ -1824,7 +1824,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { } } - if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.currentCsIndex > 0)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.scriptIndex > 0)) { play->envCtx.unk_17 = 15; play->envCtx.unk_18 = 15; } @@ -1888,7 +1888,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot case SK_MASK_TYPE_NORMAL: if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1) && - (play->csCtx.frames < 1400)) { + (play->csCtx.curFrame < 1400)) { if (this->fogN == this->fogF) { this->fogF = this->fogN; } @@ -1905,8 +1905,8 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMask1DL); gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMaskEyesDL); - if (Cutscene_CheckActorAction(play, 513) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 513)]->action == 2) && + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_513) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_513)]->id == 2) && (this->objectStk2ObjectIndex >= 0)) { Matrix_Push(); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h index f55321ef7..0f58c534d 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.h @@ -41,7 +41,7 @@ typedef struct DmStk { /* 0x32E */ u8 fadeInState; /* 0x32F */ u8 fadeOutState; /* 0x330 */ s32 fadeOutTimer; - /* 0x334 */ u8 csAction; + /* 0x334 */ u8 cueId; /* 0x335 */ u8 hasBeenHit; // set but never used /* 0x336 */ s8 objectStkObjectIndex; /* 0x337 */ s8 objectStk2ObjectIndex; diff --git a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c index 13a7e264f..fd945787d 100644 --- a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c +++ b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c @@ -65,37 +65,37 @@ Actor* func_80C22350(DmTag* this, PlayState* play, u8 actorCat, s16 actorId) { return foundActor; } -s32 func_80C22400(DmTag* this, s16 arg1) { +s32 func_80C22400(DmTag* this, s16 csId) { s32 ret = false; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(arg1); - } else if (ActorCutscene_GetCanPlayNext(arg1)) { - ActorCutscene_StartAndSetUnkLinkFields(arg1, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(csId); + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); ret = true; } else { - ActorCutscene_SetIntentToPlay(arg1); + CutsceneManager_Queue(csId); } return ret; } -s16 func_80C2247C(DmTag* this, s32 arg1) { +s16 func_80C2247C(DmTag* this, s32 numCutscenes) { s32 i; - s16 cs = this->actor.cutscene; + s16 csId = this->actor.csId; - for (i = 0; i < arg1; i++) { - cs = ActorCutscene_GetAdditionalCutscene(cs); + for (i = 0; i < numCutscenes; i++) { + csId = CutsceneManager_GetAdditionalCsId(csId); } - return cs; + return csId; } s32 func_80C224D8(DmTag* this, PlayState* play) { s32 pad; Actor* sp30; Actor* sp2C; - s16 sp2A = this->actor.cutscene; + s16 csId = this->actor.csId; s32 ret = false; sp30 = func_80C22350(this, play, ACTORCAT_NPC, ACTOR_EN_AN); @@ -103,9 +103,9 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { switch (this->unk_1A4) { case 0: - if (func_80C22400(this, sp2A)) { + if (func_80C22400(this, csId)) { if ((sp2C != NULL) && (sp2C->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), sp2C); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), sp2C); } this->unk_1A4++; ret = true; @@ -114,7 +114,7 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { case 1: if ((sp30 != NULL) && (sp30->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(func_80C2247C(this, 0))), + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(func_80C2247C(this, 0))), sp30); } this->unk_1A4++; @@ -122,7 +122,7 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { break; case 2: - ActorCutscene_Stop(func_80C2247C(this, 0)); + CutsceneManager_Stop(func_80C2247C(this, 0)); if (func_80C22400(this, func_80C2247C(this, 1))) { this->unk_1A4++; ret = true; @@ -130,7 +130,7 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { break; case 3: - ActorCutscene_Stop(func_80C2247C(this, 1)); + CutsceneManager_Stop(func_80C2247C(this, 1)); if (func_80C22400(this, func_80C2247C(this, 2))) { this->unk_1A4++; ret = true; @@ -138,7 +138,7 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { break; case 4: - ActorCutscene_Stop(func_80C2247C(this, 2)); + CutsceneManager_Stop(func_80C2247C(this, 2)); if (func_80C22400(this, func_80C2247C(this, 3))) { this->unk_1A4++; ret = true; @@ -146,7 +146,7 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { break; case 5: - ActorCutscene_Stop(func_80C2247C(this, 3)); + CutsceneManager_Stop(func_80C2247C(this, 3)); if (func_80C22400(this, func_80C2247C(this, 4))) { this->unk_1A4++; ret = true; diff --git a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c index a671fe3f2..4d2b4a54a 100644 --- a/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c +++ b/src/overlays/actors/ovl_Dm_Zl/z_dm_zl.c @@ -131,14 +131,14 @@ void DmZl_DoNothing(DmZl* this, PlayState* play) { } void DmZl_UpdateCutscene(DmZl* this, PlayState* play) { - s32 actionIndex; + s32 cueChannel; // reused as animIndex - if (Cutscene_CheckActorAction(play, 0x66)) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x66); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_102)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_102); + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { s16 nextAnimIndex = ZELDA_ANIM_FACING_AWAY; - switch (play->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { default: case 1: break; @@ -159,14 +159,14 @@ void DmZl_UpdateCutscene(DmZl* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - actionIndex = this->animIndex; + cueChannel = this->animIndex; - if ((actionIndex == ZELDA_ANIM_TURNING_TOWARD_PLAYER) || (actionIndex == ZELDA_ANIM_GIVING_OCARINA_START) || - (actionIndex == ZELDA_ANIM_PLAYING_OCARINA_START)) { + if ((cueChannel == ZELDA_ANIM_TURNING_TOWARD_PLAYER) || (cueChannel == ZELDA_ANIM_GIVING_OCARINA_START) || + (cueChannel == ZELDA_ANIM_PLAYING_OCARINA_START)) { // these animations don't loop at the end, they lead into the next animation this->animIndex++; DmZl_ChangeAnimation(&this->skelAnime, &sAnimationInfo[this->animIndex], 0); diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 1e2a59b76..c889de158 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -100,7 +100,7 @@ void DoorAna_WaitClosed(DoorAna* this, PlayState* play) { if (grottoType == DOORANA_TYPE_HIDDEN_STORMS) { //! @bug Implementation from OoT is not updated for MM, grotto does not open on Song of Storms - if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && EnvFlags_Get(play, 5)) { + if (this->actor.xyzDistToPlayerSq < SQ(200.0f) && CutsceneFlags_Get(play, 5)) { grottoIsOpen = true; this->actor.flags &= ~ACTOR_FLAG_10; // always update OFF } @@ -176,11 +176,11 @@ void DoorAna_GrabLink(DoorAna* this, PlayState* play) { Player* player; s8 pad[2]; - if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetCurrentCsId() != this->actor.csId) { + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index a0eefb83a..f8fef514d 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -310,20 +310,20 @@ s32 func_808A0E28(DoorShutter* this, PlayState* play) { void func_808A0F88(DoorShutter* this, PlayState* play) { if (Flags_GetClear(play, this->actor.room) || Flags_GetClearTemp(play, this->actor.room)) { - this->unk_160 = this->actor.cutscene; + this->csId = this->actor.csId; if (this->doorType == 7) { - if (this->unk_160 != -1) { - this->unk_160 = ActorCutscene_GetAdditionalCutscene(this->unk_160); + if (this->csId != CS_ID_NONE) { + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); } } - if (ActorCutscene_GetCanPlayNext(this->unk_160)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_160, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); Flags_SetClear(play, this->actor.room); DoorShutter_SetupAction(this, func_808A1784); this->unk_167 = -1; } else { - ActorCutscene_SetIntentToPlay(this->unk_160); + CutsceneManager_Queue(this->csId); } } else if (func_808A0E28(this, play)) { Player* player = GET_PLAYER(play); @@ -454,7 +454,7 @@ s32 func_808A1478(DoorShutter* this, PlayState* play, f32 arg2) { Actor_PlaySfx(&this->actor, NA_SE_EV_METALDOOR_OPEN); } - if ((this->unk_160 != -1) && (ActorCutscene_GetCurrentIndex() == this->unk_160)) { + if ((this->csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->csId)) { func_800B724C(play, &this->actor, PLAYER_CSMODE_1); } } @@ -468,13 +468,13 @@ s32 func_808A1478(DoorShutter* this, PlayState* play, f32 arg2) { void func_808A1548(DoorShutter* this, PlayState* play) { if (func_808A1478(this, play, 1.0f)) { if (Flags_GetSwitch(play, DOORSHUTTER_GET_7F(&this->actor))) { - this->unk_160 = this->actor.cutscene; - if (ActorCutscene_GetCanPlayNext(this->unk_160)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_160, &this->actor); + this->csId = this->actor.csId; + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); DoorShutter_SetupAction(this, func_808A1784); this->unk_167 = -1; } else { - ActorCutscene_SetIntentToPlay(this->unk_160); + CutsceneManager_Queue(this->csId); } } else if (func_808A0E28(this, play)) { Player* player = GET_PLAYER(play); @@ -521,7 +521,7 @@ void func_808A1684(DoorShutter* this, PlayState* play) { void func_808A1784(DoorShutter* this, PlayState* play) { if (this->unk_167 != 0) { - if (func_800F22C4(this->unk_160, &this->actor)) { + if (func_800F22C4(this->csId, &this->actor) != 0) { if (this->unk_167 < 0) { if ((play->state.frames % 2) != 0) { this->unk_167++; @@ -569,9 +569,9 @@ void func_808A1884(DoorShutter* this, PlayState* play) { if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_800)) { DoorShutter_SetupAction(this, func_808A1C50); - if (ActorCutscene_GetCurrentIndex() == 0x7D) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR) { func_801226E0(play, ((void)0, gSaveContext.respawn[RESPAWN_MODE_DOWN].data)); - player->unk_A86 = -1; + player->csId = CS_ID_NONE; func_800B7298(play, NULL, PLAYER_CSMODE_115); } } @@ -624,7 +624,7 @@ void func_808A1B48(DoorShutter* this, PlayState* play) { void func_808A1C50(DoorShutter* this, PlayState* play) { if (this->unk_167++ > 30) { if (GET_PLAYER(play)->csMode == PLAYER_CSMODE_115) { - func_800B7298(play, NULL, PLAYER_CSMODE_6); + func_800B7298(play, NULL, PLAYER_CSMODE_END); } DoorShutter_SetupDoor(this, play); } diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index c64d3d523..7f18e0546 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -17,7 +17,7 @@ typedef struct DoorShutter { /* 0x0144 */ UNK_TYPE1 unk144[0x18]; /* 0x015C */ s16 unk_15C; /* 0x015E */ s16 unk_15E; - /* 0x0160 */ s16 unk_160; + /* 0x0160 */ s16 csId; /* 0x0162 */ u8 doorType; /* 0x0163 */ u8 unk_163; /* 0x0164 */ u8 unk_164; diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index d942903a1..0b4b59f1c 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -280,15 +280,15 @@ void func_808B8E78(DoorWarp1* this, PlayState* play) { } s32 func_808B900C(DoorWarp1* this, PlayState* play) { - s32 index; + s32 cueChannel; u8 ret = false; - if (Cutscene_CheckActorAction(play, 569)) { - index = Cutscene_GetActorActionIndex(play, 569); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_569)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_569); - if (this->unk_208 != play->csCtx.actorActions[index]->action) { - this->unk_208 = play->csCtx.actorActions[index]->action; - if (play->csCtx.actorActions[index]->action == 2) { + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + if (play->csCtx.actorCues[cueChannel]->id == 2) { ret = true; } } @@ -345,7 +345,7 @@ void func_808B921C(DoorWarp1* this, PlayState* play) { } if (func_808B866C(this, play) && !Play_InCsMode(play)) { - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); Message_StartTextbox(play, 0xF2, &this->dyna.actor); DoorWarp1_SetupAction(this, func_808B93A0); } @@ -368,7 +368,7 @@ void func_808B93A0(DoorWarp1* this, PlayState* play) { DoorWarp1_SetupAction(this, func_808B9524); } else { func_8019F230(); - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); DoorWarp1_SetupAction(this, func_808B94A4); } } @@ -377,7 +377,7 @@ void func_808B93A0(DoorWarp1* this, PlayState* play) { } void func_808B94A4(DoorWarp1* this, PlayState* play) { - if (!func_808B866C(this, play) && (ActorCutscene_GetCurrentIndex() != play->playerActorCsIds[8])) { + if (!func_808B866C(this, play) && (CutsceneManager_GetCurrentCsId() != play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { DoorWarp1_SetupAction(this, func_808B921C); } func_808BB8D4(this, play, 1); @@ -385,10 +385,10 @@ void func_808B94A4(DoorWarp1* this, PlayState* play) { } void func_808B9524(DoorWarp1* this, PlayState* play) { - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[9])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[9]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE]); } else { - ActorCutscene_Start(play->playerActorCsIds[9], NULL); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE], NULL); DoorWarp1_SetupAction(this, func_808B958C); } } @@ -458,10 +458,10 @@ void func_808B977C(DoorWarp1* this, PlayState* play) { } void func_808B9840(DoorWarp1* this, PlayState* play) { - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[9])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[9]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE]); } else { - ActorCutscene_Start(play->playerActorCsIds[9], NULL); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE], NULL); DoorWarp1_SetupAction(this, func_808B98A8); } } @@ -617,10 +617,10 @@ void func_808B9FD0(DoorWarp1* this, PlayState* play) { return; } - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[9])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[9]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE]); } else { - ActorCutscene_Start(play->playerActorCsIds[9], NULL); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_ENTRANCE], NULL); AudioSfx_PlaySfx(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 1.0f, Animation_GetLastFrame(&gWarpCrystalAnim), @@ -638,7 +638,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { if ((play->sceneId == SCENE_MITURIN_BS) || (play->sceneId == SCENE_HAKUGIN_BS) || (play->sceneId == SCENE_INISIE_BS) || (play->sceneId == SCENE_SEA_BS)) { - D_801F4DE2 = play->sceneId; + gDungeonBossWarpSceneId = play->sceneId; if (play->sceneId == SCENE_MITURIN_BS) { phi_v0_2 = 0; } else if (play->sceneId == SCENE_HAKUGIN_BS) { @@ -711,7 +711,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { } else { switch (phi_v0_2) { case 0: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { // Skips the entrance cutscene as this flag is attached to `ENTRANCE(WOODFALL_TEMPLE, 1)` SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_WOODFALL_TEMPLE_PRISON); play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1); @@ -728,7 +728,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { break; case 1: - SET_WEEKEVENTREG(WEEKEVENTREG_33_80); + SET_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE); play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7); play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; @@ -736,14 +736,14 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { break; case 3: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { play->nextEntrance = ENTRANCE(ZORA_CAPE, 9); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; } else { - SET_WEEKEVENTREG(WEEKEVENTREG_55_80); + SET_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE); play->nextEntrance = ENTRANCE(ZORA_CAPE, 8); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -753,7 +753,7 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { break; case 2: - SET_WEEKEVENTREG(WEEKEVENTREG_52_20); + SET_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE); play->nextEntrance = ENTRANCE(IKANA_CANYON, 15); gSaveContext.nextCutsceneIndex = 0xFFF2; play->transitionTrigger = TRANS_TRIGGER_START; @@ -880,7 +880,7 @@ void func_808BA550(DoorWarp1* this, PlayState* play) { void func_808BAAF4(DoorWarp1* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 cutscene; + s16 csId; f32 phi_f2; phi_f2 = 200.0f; @@ -891,14 +891,14 @@ void func_808BAAF4(DoorWarp1* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_80) && (fabsf(this->dyna.actor.xzDistToPlayer) < phi_f2) && ((player->actor.world.pos.y - 20.0f) < this->dyna.actor.world.pos.y) && (this->dyna.actor.world.pos.y < (player->actor.world.pos.y + 20.0f))) { - cutscene = this->dyna.actor.cutscene; + csId = this->dyna.actor.csId; - if (ActorCutscene_GetCanPlayNext(cutscene)) { - ActorCutscene_Start(cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_Start(csId, &this->dyna.actor); SET_WEEKEVENTREG(WEEKEVENTREG_86_80); DoorWarp1_SetupAction(this, func_808BABF4); } else { - ActorCutscene_SetIntentToPlay(cutscene); + CutsceneManager_Queue(csId); } } } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h index 076999e57..1bc7e13bc 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.h @@ -53,7 +53,7 @@ typedef struct DoorWarp1 { /* 0x202 */ u8 unk_202; /* 0x203 */ u8 unk_203; /* 0x204 */ f32 unk_204; - /* 0x208 */ u8 unk_208; + /* 0x208 */ u8 cueId; } DoorWarp1; // size = 0x20C #endif // Z_DOOR_WARP1_H diff --git a/src/overlays/actors/ovl_Eff_Change/z_eff_change.c b/src/overlays/actors/ovl_Eff_Change/z_eff_change.c index 9174fafc0..65fb8da2f 100644 --- a/src/overlays/actors/ovl_Eff_Change/z_eff_change.c +++ b/src/overlays/actors/ovl_Eff_Change/z_eff_change.c @@ -56,7 +56,7 @@ void EffChange_Init(Actor* thisx, PlayState* play) { this->step = 0; this->actor.shape.rot.y = 0; this->skeletonInfo.frameCtrl.unk_C = (2.0f / 3.0f); - ActorCutscene_SetIntentToPlay(0x7B); + CutsceneManager_Queue(CS_ID_GLOBAL_ELEGY); } void EffChange_Destroy(Actor* thisx, PlayState* play) { @@ -80,7 +80,7 @@ void func_80A4C5CC(EffChange* this, PlayState* play) { if (func_80183DE0(&this->skeletonInfo)) { Actor_Kill(&this->actor); - ActorCutscene_Stop(0x7B); + CutsceneManager_Stop(CS_ID_GLOBAL_ELEGY); func_800FD2B4(play, 0.0f, 850.0f, 0.2f, 0.0f); return; } @@ -109,11 +109,11 @@ void func_80A4C5CC(EffChange* this, PlayState* play) { phi_fv0 = 0.0f; } func_800FD2B4(play, phi_fv0, 850.0f, 0.2f, 0.0f); - if (ActorCutscene_GetCurrentIndex() != 0x7B) { - if (ActorCutscene_GetCanPlayNext(0x7B)) { - ActorCutscene_Start(0x7B, &this->actor); + if (CutsceneManager_GetCurrentCsId() != CS_ID_GLOBAL_ELEGY) { + if (CutsceneManager_IsNext(CS_ID_GLOBAL_ELEGY)) { + CutsceneManager_Start(CS_ID_GLOBAL_ELEGY, &this->actor); } else { - ActorCutscene_SetIntentToPlay(0x7B); + CutsceneManager_Queue(CS_ID_GLOBAL_ELEGY); } } } diff --git a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c index 0ebb5139d..fbe4c27cf 100644 --- a/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c +++ b/src/overlays/actors/ovl_Eff_Kamejima_Wave/z_eff_kamejima_wave.c @@ -82,9 +82,9 @@ void func_80BCEBC0(EffKamejimaWave* this, PlayState* play) { } void func_80BCEC6C(EffKamejimaWave* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x1E0)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 0x1E0)); - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x1E0)]->action == 2) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_480)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_480)); + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_480)]->id == 2) { this->scaleOffset = 0.05f; this->actionFunc = func_80BCEBC0; this->actor.draw = EffKamejimaWave_Draw; @@ -117,9 +117,9 @@ void func_80BCED34(EffKamejimaWave* this, PlayState* play) { } void func_80BCEDE0(EffKamejimaWave* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x1F6)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 0x1F6)); - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x1F6)]->action == 2) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_502)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_502)); + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_502)]->id == 2) { this->scaleOffset = 0.03f; this->actor.scale.x = 0.35f; this->actionFunc = func_80BCED34; diff --git a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c index 015e9e715..a37f4ec07 100644 --- a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c +++ b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.c @@ -49,7 +49,7 @@ void EffLastday_Init(Actor* thisx, PlayState* play2) { case EFFLASTDAY_PARAMS_1: this->dList = object_lastday_DL_000510; this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000608); - this->csActionCmd = 0x1FC; + this->cueType = CS_CMD_ACTOR_CUE_508; this->actionFunc = func_80BEBDF8; Actor_SetScale(&this->actor, 1.0f); break; @@ -57,7 +57,7 @@ void EffLastday_Init(Actor* thisx, PlayState* play2) { case EFFLASTDAY_PARAMS_2: this->dList = object_lastday_DL_000210; this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000308); - this->csActionCmd = 0x1FD; + this->cueType = CS_CMD_ACTOR_CUE_509; this->actionFunc = func_80BEBEB8; Actor_SetScale(&this->actor, 0.5f); break; @@ -65,7 +65,7 @@ void EffLastday_Init(Actor* thisx, PlayState* play2) { case EFFLASTDAY_PARAMS_3: this->dList = object_lastday_DL_000060; this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000148); - this->csActionCmd = 0x1FE; + this->cueType = CS_CMD_ACTOR_CUE_510; this->actionFunc = func_80BEBF78; Actor_SetScale(&this->actor, 0.2f); this->actor.home.rot.z = 0; @@ -74,7 +74,7 @@ void EffLastday_Init(Actor* thisx, PlayState* play2) { default: this->dList = object_lastday_DL_000370; this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000448); - this->csActionCmd = 0x1FB; + this->cueType = CS_CMD_ACTOR_CUE_507; this->actionFunc = func_80BEBD0C; Actor_SetScale(&this->actor, 1.0f); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_LASTDAY, this->actor.world.pos.x, @@ -94,12 +94,12 @@ void EffLastday_Destroy(Actor* thisx, PlayState* play) { } void func_80BEBD0C(EffLastday* this, PlayState* play) { - u16 csAction; + u16 cueId; - if ((Cutscene_CheckActorAction(play, this->csActionCmd))) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); - csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; - switch (csAction) { + if ((Cutscene_IsCueInChannel(play, this->cueType))) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + switch (cueId) { default: this->actor.draw = NULL; this->alpha = 0; @@ -128,12 +128,12 @@ void func_80BEBD0C(EffLastday* this, PlayState* play) { } void func_80BEBDF8(EffLastday* this, PlayState* play) { - u16 csAction; + u16 cueId; - if (Cutscene_CheckActorAction(play, this->csActionCmd)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); - csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; - switch (csAction) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + switch (cueId) { default: this->actor.draw = NULL; this->step = 0; @@ -154,12 +154,12 @@ void func_80BEBDF8(EffLastday* this, PlayState* play) { } void func_80BEBEB8(EffLastday* this, PlayState* play) { - u16 csAction; + u16 cueId; - if (Cutscene_CheckActorAction(play, this->csActionCmd)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); - csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; - switch (csAction) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + switch (cueId) { default: this->actor.draw = NULL; this->step = 0; @@ -180,12 +180,12 @@ void func_80BEBEB8(EffLastday* this, PlayState* play) { } void func_80BEBF78(EffLastday* this, PlayState* play) { - u16 csAction; + u16 cueId; - if (Cutscene_CheckActorAction(play, this->csActionCmd)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd)); - csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action; - switch (csAction) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + switch (cueId) { default: this->actor.draw = NULL; this->alpha = 0; diff --git a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h index 89266d744..0b5002863 100644 --- a/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h +++ b/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.h @@ -15,7 +15,7 @@ typedef struct EffLastday { /* 0x148 */ AnimatedMaterial* matAnim; /* 0x14C */ s16 step; /* 0x14E */ s16 alpha; - /* 0x150 */ s16 csActionCmd; + /* 0x150 */ s16 cueType; /* 0x154 */ EffLastdayActionFunc actionFunc; } EffLastday; // size = 0x158 diff --git a/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c b/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c index 842ae4b9e..2b1c01c59 100644 --- a/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c +++ b/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.c @@ -43,12 +43,12 @@ void EffZoraband_Destroy(Actor* thisx, PlayState* play) { } void EffZoraband_MikauFadeOut(EffZoraband* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x20F)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_527)) { if ((EFFZORABAND_GET_F(&this->actor) + 2) == - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x20F)]->action) { + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_527)]->id) { this->stateFlags |= 2; } - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x20F)]->action == 7) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_527)]->id == 7) { this->actor.draw = NULL; } else { this->actor.draw = EffZoraband_Draw; diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index 3d7df7c27..c88835373 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -111,21 +111,21 @@ void func_8092E284(ElfMsg* this, PlayState* play) { if ((player->tatlActor != NULL) && ((func_8092E1FC(this)))) { player->tatlTextId = func_8092E1D0(this); - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); tatl->elfMsg = &this->actor; - if (this->actor.cutscene == -1) { - this->actor.cutscene = 0x7C; + if (this->actor.csId == CS_ID_NONE) { + this->actor.csId = CS_ID_GLOBAL_TALK; } if ((player->tatlTextId < 0) && (this->actor.home.rot.x < 0)) { - if (ActorCutscene_GetCurrentIndex() == 0x7D) { - ActorCutscene_Stop(0x7D); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR) { + CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { this->actor.home.rot.x = 0; - ActorCutscene_Start(this->actor.cutscene, &this->actor); + CutsceneManager_Start(this->actor.csId, &this->actor); func_800E0348(play->cameraPtrs[CAM_ID_MAIN]); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index a29b226b0..8244c7fb6 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -100,9 +100,9 @@ s32 func_8096EE50(ElfMsg2* this) { void func_8096EE64(ElfMsg2* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.cutscene != -1) { - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); + if (this->actor.csId != CS_ID_NONE) { + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { + CutsceneManager_Stop(this->actor.csId); } } @@ -115,14 +115,14 @@ void func_8096EE64(ElfMsg2* this, PlayState* play) { } ElfMsg2_SetupAction(this, func_8096EF98); - } else if ((this->actor.cutscene != -1) && (ActorCutscene_GetCurrentIndex() != this->actor.cutscene)) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + } else if ((this->actor.csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() != this->actor.csId)) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } diff --git a/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c b/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c index da6b29180..e3e8b7bc5 100644 --- a/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c +++ b/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.c @@ -110,20 +110,20 @@ void func_80A2CF7C(ElfMsg3* this, PlayState* play) { ((player->actor.world.pos.y - this->actor.world.pos.y) < (100.0f * this->actor.scale.y))) && (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z))) { player->tatlTextId = func_80A2CF50(this); - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); tatl->elfMsg = &this->actor; - if (this->actor.cutscene == -1) { - this->actor.cutscene = 0x7C; + if (this->actor.csId == CS_ID_NONE) { + this->actor.csId = CS_ID_GLOBAL_TALK; } if ((player->tatlTextId < 0) && (this->actor.home.rot.x < 0)) { - if (ActorCutscene_GetCurrentIndex() == 0x7D) { - ActorCutscene_Stop(0x7D); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR) { + CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); func_800E0348(play->cameraPtrs[CAM_ID_MAIN]); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } diff --git a/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c b/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c index 7fbf402fa..c917f01a7 100644 --- a/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c +++ b/src/overlays/actors/ovl_Elf_Msg4/z_elf_msg4.c @@ -115,20 +115,20 @@ void func_80AFD668(ElfMsg4* this, PlayState* play) { if ((player->tatlActor != NULL) && func_80AFD5E0(this)) { player->tatlTextId = ElfMsg4_GetTextId(this); - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); tatl->elfMsg = this->elfMsg5; - if (this->actor.cutscene == -1) { - this->actor.cutscene = 0x7C; + if (this->actor.csId == CS_ID_NONE) { + this->actor.csId = CS_ID_GLOBAL_TALK; } if ((player->tatlTextId < 0) && (this->actor.home.rot.x < 0)) { - if (ActorCutscene_GetCurrentIndex() == 0x7D) { - ActorCutscene_Stop(0x7D); - ActorCutscene_SetIntentToPlay((s16)this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext((s16)this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR) { + CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); func_800E0348(play->cameraPtrs[CAM_ID_MAIN]); } else { - ActorCutscene_SetIntentToPlay((s16)this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } @@ -139,7 +139,7 @@ void func_80AFD770(ElfMsg4* this, PlayState* play) { while (bgActor != NULL) { if ((bgActor->id != ACTOR_ELF_MSG5) || (ELFMSG4_GET_TEXT(&this->actor) != ELFMSG5_GET_FF(bgActor)) || - (this->actor.cutscene != bgActor->cutscene)) { + (this->actor.csId != bgActor->csId)) { bgActor = bgActor->next; } else { this->elfMsg5 = bgActor; diff --git a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c index d05c099e9..89fbd9f6b 100644 --- a/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c +++ b/src/overlays/actors/ovl_Elf_Msg6/z_elf_msg6.c @@ -154,8 +154,8 @@ void ElfMsg6_Init(Actor* thisx, PlayState* play) { case 1: this->actionFunc = func_80BA1F80; - if ((this->actor.cutscene == -1) || ((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && - Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor)))) { + if ((this->actor.csId == CS_ID_NONE) || ((ELFMSG6_SWITCHFLAG(&this->actor) != 0x7F) && + Flags_GetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor)))) { Actor_Kill(&this->actor); return; } @@ -246,10 +246,10 @@ void func_80BA1C88(ElfMsg6* this, PlayState* play, s16 arg2) { if (player->tatlActor != NULL) { player->tatlTextId = arg2; - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); sp20->elfMsg = &this->actor; - if (this->actor.cutscene == -1) { - this->actor.cutscene = 0x7C; + if (this->actor.csId == CS_ID_NONE) { + this->actor.csId = CS_ID_GLOBAL_TALK; } } } @@ -280,10 +280,10 @@ void func_80BA1CF8(ElfMsg6* this, PlayState* play) { this->actor.textId = 0x25B; } else if (func_80BA1C00(this) && (player->actor.speed > 1.0f)) { player->tatlTextId = -this->actor.textId; - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); sp20->elfMsg = &this->actor; - if (this->actor.cutscene == -1) { - this->actor.cutscene = 0x7C; + if (this->actor.csId == CS_ID_NONE) { + this->actor.csId = CS_ID_GLOBAL_TALK; } } } @@ -321,10 +321,10 @@ void func_80BA1E30(ElfMsg6* this, PlayState* play) { if (func_80BA1C00(this) && (player->actor.speed > 1.0f)) { player->tatlTextId = -this->actor.textId; - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); sp20->elfMsg = &this->actor; - if (this->actor.cutscene == -1) { - this->actor.cutscene = 0x7C; + if (this->actor.csId == CS_ID_NONE) { + this->actor.csId = CS_ID_GLOBAL_TALK; } } } @@ -336,14 +336,14 @@ void func_80BA1F80(ElfMsg6* this, PlayState* play) { } if (func_80BA1C00(this)) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, NULL); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, NULL); Flags_SetSwitch(play, ELFMSG6_SWITCHFLAG(&this->actor)); Actor_Kill(&this->actor); return; } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 99779f20b..41dba0aab 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -1417,14 +1417,14 @@ void func_80BEF518(EnAkindonuts* this, PlayState* play) { } if (this->unk_35E == 0) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_35E = 1; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); return; } } @@ -1546,14 +1546,14 @@ void func_80BEFAF0(EnAkindonuts* this, PlayState* play) { if (func_80BECD10(this, this->path, this->unk_334) && (sp34 < 10.0f)) { if (this->unk_334 >= (this->path->count - 1)) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->actionFunc = func_80BEFD74; } else { this->unk_334++; } } } else if (this->actor.playerHeightRel > 500.0f) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->actionFunc = func_80BEFD74; } @@ -1569,17 +1569,17 @@ void func_80BEFAF0(EnAkindonuts* this, PlayState* play) { func_80BECBE0(this, sp32); if (this->unk_35E == 2) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_35E = 3; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); return; } } else if ((this->unk_35E == 1) && (this->unk_356 == 20)) { - ActorCutscene_Stop(this->cutscene); - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + CutsceneManager_Queue(this->csId); this->unk_35E = 2; } this->unk_356++; @@ -1617,7 +1617,7 @@ void EnAkindonuts_Init(Actor* thisx, PlayState* play) { this->unk_32C |= 0x2; this->unk_32C |= 0x4; this->unk_338 = 4; - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; func_80BEE938(this, play); this->actionFunc = func_80BEEB20; } diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h index 72c932d0c..180d73ed4 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h @@ -43,7 +43,7 @@ typedef struct EnAkindonuts { /* 0x358 */ f32 unk_358; /* 0x35C */ s16 unk_35C; /* 0x35E */ s16 unk_35E; - /* 0x360 */ s16 cutscene; + /* 0x360 */ s16 csId; /* 0x362 */ s16 unk_362; /* 0x364 */ s16 unk_364; /* 0x366 */ s8 unk_366; diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index 443065633..87b83e670 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -219,30 +219,30 @@ Actor* func_80BDE384(EnAl* this, PlayState* play) { return actor; } -s32 func_80BDE408(EnAl* this, s16 arg1) { +s32 func_80BDE408(EnAl* this, s16 csId) { s32 ret = false; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(arg1); - } else if (ActorCutscene_GetCanPlayNext(arg1)) { - ActorCutscene_StartAndSetUnkLinkFields(arg1, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(csId); + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); ret = true; } else { - ActorCutscene_SetIntentToPlay(arg1); + CutsceneManager_Queue(csId); } return ret; } -s16 func_80BDE484(EnAl* this, s32 arg1) { - s16 cs = this->actor.cutscene; +s16 func_80BDE484(EnAl* this, s32 numCutscenes) { + s16 csId = this->actor.csId; s32 i; - for (i = 0; i < arg1; i++) { - cs = ActorCutscene_GetAdditionalCutscene(cs); + for (i = 0; i < numCutscenes; i++) { + csId = CutsceneManager_GetAdditionalCsId(csId); } - return cs; + return csId; } s32 func_80BDE4E0(EnAl* this, s16* arg1, s16 arg2) { @@ -317,13 +317,13 @@ s32 func_80BDE678(EnAl* this, s16* arg1, s16 arg2) { s32 func_80BDE7FC(EnAl* this, PlayState* play) { s32 pad; - s16 sp2A = func_80BDE484(this, 0); + s16 csId = func_80BDE484(this, 0); s32 pad2; s32 sp20 = false; switch (this->unk_4E6) { case 0: - if (!func_80BDE408(this, sp2A)) { + if (!func_80BDE408(this, csId)) { break; } @@ -332,7 +332,8 @@ s32 func_80BDE7FC(EnAl* this, PlayState* play) { case 6: case 8: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), + this->actor.child); } this->unk_4E6++; sp20 = true; @@ -342,13 +343,13 @@ s32 func_80BDE7FC(EnAl* this, PlayState* play) { case 3: case 5: case 7: - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), &this->actor); this->unk_4E6++; sp20 = true; break; case 9: - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); this->unk_4E6++; sp20 = true; break; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 6d6488383..d4c980055 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -305,15 +305,15 @@ void EnAni_Update(Actor* thisx, PlayState* play) { this->blinkFunc(this); if (this->stateFlags & ANI_STATE_FALLING) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { this->stateFlags &= ~ANI_STATE_FALLING; - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->actor.cutscene)), + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); + this->actor.csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); + Camera_SetToTrackActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->actor.csId)), &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 0f66d5cf4..5aa746298 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -130,7 +130,7 @@ void func_809C11EC(EnAob01* this, PlayState* play) { this->unk_3F8[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_DG, D_809C384C[i].unk_00.x, D_809C384C[i].unk_00.y, D_809C384C[i].unk_00.z, - 0, DEG_TO_BINANG(D_809C384C[i].unk_04), 0, enDgParams, 0xFFFF, this->actor.halfDaysBits, NULL); + 0, DEG_TO_BINANG(D_809C384C[i].unk_04), 0, enDgParams, (u16)CS_ID_NONE, this->actor.halfDaysBits, NULL); } } @@ -140,7 +140,7 @@ void func_809C1304(EnAob01* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(this->unk_3F8); i++) { this->unk_3F8[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_RACEDOG, (i * 15.0f) + -3897.0f, 130.0f, 1290.0f - (i * 10.0f), 0, 0x1555, - 0, (i << 5) | ENAOB01_GET_7E00_1(&this->actor), 0xFFFF, this->actor.halfDaysBits, NULL); + 0, (i << 5) | ENAOB01_GET_7E00_1(&this->actor), (u16)CS_ID_NONE, this->actor.halfDaysBits, NULL); } } @@ -394,7 +394,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { if (this->unk_2D2 & 2) { this->unk_2D2 &= ~2; Rupees_ChangeBy(-this->unk_434); - func_800B7298(play, NULL, PLAYER_CSMODE_7); + func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->actionFunc = func_809C1C9C; @@ -602,10 +602,11 @@ s32 func_809C2504(EnAob01* this, PlayState* play) { Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; while (npc != NULL) { - if ((npc->id == ACTOR_EN_RACEDOG) && (func_800F2178(this->unk_430) == ((EnRacedog*)npc)->currentPoint)) { - ActorCutscene_Stop(this->unk_430); + if ((npc->id == ACTOR_EN_RACEDOG) && + (CutsceneManager_GetCutsceneCustomValue(this->csId) == ((EnRacedog*)npc)->currentPoint)) { + CutsceneManager_Stop(this->csId); this->unk_3F4 = npc; - this->unk_430 = ActorCutscene_GetAdditionalCutscene(this->unk_430); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); return true; } npc = npc->next; @@ -650,22 +651,22 @@ s32 func_809C25E4(EnAob01* this, PlayState* play) { } s32 func_809C2680(EnAob01* this) { - if ((ActorCutscene_GetLength(this->unk_430) > 0) && (ActorCutscene_GetCurrentIndex() != this->unk_430)) { - this->unk_430 = ActorCutscene_GetAdditionalCutscene(this->unk_430); + if ((CutsceneManager_GetLength(this->csId) > 0) && (CutsceneManager_GetCurrentCsId() != this->csId)) { + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); return true; } return false; } void func_809C26E4(EnAob01* this, PlayState* play) { - ActorCutscene_Stop(this->unk_430); - this->unk_430 = ActorCutscene_GetAdditionalCutscene(this->unk_430); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); this->actionFunc = func_809C2824; } void func_809C2730(EnAob01* this, PlayState* play) { if (func_809C2504(this, play) || func_809C2680(this)) { - ActorCutscene_SetIntentToPlay(this->unk_430); + CutsceneManager_Queue(this->csId); this->actionFunc = func_809C2824; } } @@ -684,9 +685,9 @@ void func_809C2788(EnAob01* this, PlayState* play) { } void func_809C2824(EnAob01* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_430)) { - ActorCutscene_Start(this->unk_430, this->unk_3F4); - switch (func_800F2178(this->unk_430)) { + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, this->unk_3F4); + switch (CutsceneManager_GetCutsceneCustomValue(this->csId)) { case 255: this->actionFunc = func_809C26E4; break; @@ -699,7 +700,7 @@ void func_809C2824(EnAob01* this, PlayState* play) { this->actionFunc = func_809C2730; } } else { - ActorCutscene_SetIntentToPlay(this->unk_430); + CutsceneManager_Queue(this->csId); } } @@ -947,9 +948,9 @@ void EnAob01_Init(Actor* thisx, PlayState* play) { this->unk_440 = 500; func_809C1304(this, play); this->actor.draw = NULL; - this->unk_430 = this->actor.cutscene; + this->csId = this->actor.csId; func_809C2594(this, play); - ActorCutscene_SetIntentToPlay(this->unk_430); + CutsceneManager_Queue(this->csId); this->actor.flags &= ~ACTOR_FLAG_1; func_809C2F34(this, play); this->actionFunc = func_809C2824; diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h index 2507b1728..5432f74ae 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h @@ -34,7 +34,7 @@ typedef struct EnAob01 { /* 0x3F0 */ s16 blinkTimer; /* 0x3F4 */ Actor* unk_3F4; /* 0x3F8 */ Actor* unk_3F8[14]; - /* 0x430 */ s16 unk_430; + /* 0x430 */ s16 csId; /* 0x432 */ s16 unk_432; /* 0x434 */ s32 unk_434; /* 0x438 */ UNK_TYPE1 unk438[4]; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 2878d1fc6..1c2cdf533 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -253,7 +253,7 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { if (this->unk_2F8 == 0) { this->unk_374 |= 2; } - SubS_FillCutscenesList(&this->actor, this->unk_3D0, ARRAY_COUNT(this->unk_3D0)); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); if (D_80A9913C == NULL) { D_80A9913C = THIS; this->unk_374 |= 1; @@ -595,7 +595,7 @@ void func_80A95CEC(EnAz* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } - if (SubS_StartActorCutscene(&this->actor, 0x7C, this->unk_3D0[0], SUBS_CUTSCENE_NORMAL)) { + if (SubS_StartCutscene(&this->actor, CS_ID_GLOBAL_TALK, this->csIdList[0], SUBS_CUTSCENE_NORMAL)) { func_80A97C0C(this, play); } } @@ -649,10 +649,10 @@ void func_80A95F94(EnAz* this, PlayState* play) { void func_80A95FE8(EnAz* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (ActorCutscene_GetCanPlayNext(this->unk_3D0[0])) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_3D0[0], &this->actor); + if (CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->unk_3D0[0]); + CutsceneManager_Queue(this->csIdList[0]); } if (Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos) > 20.0f) { func_800B9010(&this->actor, NA_SE_EV_BEAVER_SWIM_MOTOR - SFX_FLAG); @@ -672,7 +672,7 @@ void func_80A95FE8(EnAz* this, PlayState* play) { this->actor.shape.rot.x = 0; this->actor.gravity = 0.0f; func_80A97C0C(this, play); - ActorCutscene_Stop(this->unk_3D0[0]); + CutsceneManager_Stop(this->csIdList[0]); } Actor_MoveWithGravity(&this->actor); } @@ -688,7 +688,8 @@ s32 func_80A9617C(EnAz* this, PlayState* play) { case TEXT_STATE_5: case TEXT_STATE_DONE: if ((play->msgCtx.currentTextId == 0x10DD) && (this->unk_374 & 0x8000)) { - if (SubS_StartActorCutscene(&brother->actor, brother->unk_3D0[0], 0x7C, SUBS_CUTSCENE_NORMAL)) { + if (SubS_StartCutscene(&brother->actor, brother->csIdList[0], CS_ID_GLOBAL_TALK, + SUBS_CUTSCENE_NORMAL)) { brother->unk_374 |= 0x8000; play->msgCtx.msgMode = 0x44; ret = 0; @@ -1398,7 +1399,7 @@ void func_80A97A28(EnAz* this, PlayState* play) { } void func_80A97A40(EnAz* this, PlayState* play) { - if (SubS_StartActorCutscene(&this->actor, 0, -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->actor, 0, CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { play->msgCtx.msgMode = 0; play->msgCtx.msgLength = 0; func_80A97A9C(this, play); diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.h b/src/overlays/actors/ovl_En_Az/z_en_az.h index 2a219eb24..a4c1785fe 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.h +++ b/src/overlays/actors/ovl_En_Az/z_en_az.h @@ -45,7 +45,7 @@ typedef struct EnAz { /* 0x3C4 */ s16 unk_3C4; /* 0x3C6 */ UNK_TYPE1 unk3C6[6]; /* 0x3CC */ s32 getItemId; - /* 0x3D0 */ s16 unk_3D0[1]; + /* 0x3D0 */ s16 csIdList[1]; /* 0x3D2 */ u16 unk_3D2; /* 0x3D4 */ s16 unk_3D4; /* 0x3D6 */ s16 unk_3D6; diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index 9e2d8abe2..963bc4104 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -165,7 +165,7 @@ void EnBat_Init(Actor* thisx, PlayState* play) { &play->actorCtx, play, ACTOR_EN_BAT, thisx->world.pos.x + randPlusMinusPoint5Scaled(200.0f), thisx->world.pos.y + randPlusMinusPoint5Scaled(100.0f), thisx->world.pos.z + randPlusMinusPoint5Scaled(200.0f), randPlusMinusPoint5Scaled(0x2000), - 0xFFFF * Rand_ZeroOne(), 0, BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), -1, + 0xFFFF * Rand_ZeroOne(), 0, BAD_BAT_PARAMS(this->switchFlag, this->paramFlags, 0), CS_ID_NONE, thisx->halfDaysBits, NULL); BAD_BAT_GET_NUMBER_TO_SPAWN(thisx)--; } diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.c b/src/overlays/actors/ovl_En_Bee/z_en_bee.c index 80ad3e7a2..f93d18bf5 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.c +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.c @@ -104,7 +104,7 @@ void EnBee_Init(Actor* thisx, PlayState* play) { sNumLoadedBees++; this->actor.shape.shadowScale = 12.0f; - if (ActorCutscene_GetCurrentIndex() != -1) { + if (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) { func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); } @@ -149,7 +149,7 @@ void EnBee_FlyIdle(EnBee* this, PlayState* play) { Vec3f nextPos; s32 pad[2]; - if ((this->actor.category != ACTORCAT_ENEMY) && (ActorCutscene_GetCurrentIndex() == -1)) { + if ((this->actor.category != ACTORCAT_ENEMY) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE)) { func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 2ffe6c8ef..f331666d3 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -102,9 +102,9 @@ void EnBigokuta_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->shellCollider, &this->picto.actor, &sShellCylinderInit); Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->picto.actor, &sBodyCylinderInit); CollisionCheck_SetInfo(&this->picto.actor.colChkInfo, NULL, &sColChkInfoInit); - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->picto.actor.cutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->picto.actor.csId); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02) || + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE) || ((this->picto.actor.params != 0xFF) && Flags_GetSwitch(play, this->picto.actor.params))) { Actor_Kill(&this->picto.actor); } else { @@ -129,8 +129,8 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { void EnBigokuta_SetupCutsceneCamera(EnBigokuta* this, PlayState* play, Vec3f* subCamAt, Vec3f* subCamEye) { s16 angle; - ActorCutscene_Start(this->picto.actor.cutscene, &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_Start(this->picto.actor.csId, &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); Play_SetCameraAtEye(play, this->subCamId, subCamAt, subCamEye); angle = BINANG_SUB(Actor_WorldYawTowardPoint(&this->picto.actor, subCamEye), this->picto.actor.home.rot.y); @@ -160,7 +160,7 @@ void EnBigokuta_ResetCamera(EnBigokuta* this, PlayState* play) { subCam = Play_GetCamera(play, this->subCamId); Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; - ActorCutscene_Stop(this->picto.actor.cutscene); + CutsceneManager_Stop(this->picto.actor.csId); } } @@ -267,15 +267,15 @@ void EnBigokuta_IdleAboveWater(EnBigokuta* this, PlayState* play) { } void EnBigokuta_UpdateOrSetupCam(EnBigokuta* this, PlayState* play) { - if (this->picto.actor.cutscene != -1) { + if (this->picto.actor.csId != CS_ID_NONE) { if (this->subCamId != SUB_CAM_ID_DONE) { EnBigokuta_MoveCamera(this, play); - } else if (ActorCutscene_GetCanPlayNext(this->picto.actor.cutscene)) { + } else if (CutsceneManager_IsNext(this->picto.actor.csId)) { Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); EnBigokuta_SetupCutsceneCamera(this, play, &mainCam->at, &mainCam->eye); } else { - ActorCutscene_SetIntentToPlay(this->picto.actor.cutscene); + CutsceneManager_Queue(this->picto.actor.csId); } } } @@ -289,7 +289,7 @@ void EnBigokuta_SetupSuckInPlayer(EnBigokuta* this, PlayState* play) { this->timer = 0; Animation_Change(&this->skelAnime, &gBigOctoIdleAnim, 1.0f, 12.0f, 12.0f, ANIMMODE_ONCE, -3.0f); - ActorCutscene_SetIntentToPlay(this->picto.actor.cutscene); + CutsceneManager_Queue(this->picto.actor.csId); this->playerHoldPos.x = (Math_SinS(this->picto.actor.shape.rot.y) * 66.0f) + this->picto.actor.world.pos.x; this->playerHoldPos.y = (this->picto.actor.home.pos.y - 49.5f) + 42.899998f; @@ -355,7 +355,7 @@ void EnBigokuta_HoldPlayer(EnBigokuta* this, PlayState* play) { } void EnBigokuta_SetupDeathCutscene(EnBigokuta* this) { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); this->timer = 0; this->bodyCollider.base.acFlags &= ~AC_ON; this->actionFunc = EnBigokuta_PlayDeathCutscene; @@ -374,11 +374,11 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { Actor_SpawnIceEffects(play, &this->picto.actor, this->limbPos, ARRAY_COUNT(this->limbPos), 2, 0.5f, 0.35f); EnBigokuta_SetupDeathEffects(this); } - } else if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->picto.actor); + } else if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->picto.actor); if (!CHECK_EVENTINF(EVENTINF_41) && !CHECK_EVENTINF(EVENTINF_35)) { - func_800B724C(play, &this->picto.actor, PLAYER_CSMODE_7); + func_800B724C(play, &this->picto.actor, PLAYER_CSMODE_WAIT); } else { player = GET_PLAYER(play); player->stateFlags1 |= PLAYER_STATE1_20; @@ -390,7 +390,7 @@ void EnBigokuta_PlayDeathCutscene(EnBigokuta* this, PlayState* play) { EnBigokuta_SetupDeathEffects(this); } } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } @@ -450,11 +450,11 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) { Flags_SetSwitch(play, this->picto.actor.params); } - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); Actor_Kill(&this->picto.actor); if (!CHECK_EVENTINF(EVENTINF_41) && !CHECK_EVENTINF(EVENTINF_35)) { - func_800B724C(play, &this->picto.actor, PLAYER_CSMODE_6); + func_800B724C(play, &this->picto.actor, PLAYER_CSMODE_END); } else { Player* player = GET_PLAYER(play); diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index 6bcfa79fb..41ae325e0 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -16,7 +16,7 @@ typedef struct EnBigokuta { /* 0x190 */ u8 drawDmgEffType; /* 0x192 */ s16 timer; /* 0x194 */ s16 subCamId; - /* 0x196 */ s16 cutscene; + /* 0x196 */ s16 csId; /* 0x198 */ Vec3s jointTable[BIGOKUTA_LIMB_MAX]; /* 0x210 */ Vec3s morphTable[BIGOKUTA_LIMB_MAX]; /* 0x288 */ f32 drawDmgEffAlpha; diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 30f857a89..c360681e8 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -293,22 +293,22 @@ void EnBigpo_WellWaitForProximity(EnBigpo* this, PlayState* play) { } void EnBigpo_SetupSpawnCutscene(EnBigpo* this) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = EnBigpo_WaitCutsceneQueue; } void EnBigpo_WaitCutsceneQueue(EnBigpo* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); - func_800B724C(play, &this->actor, PLAYER_CSMODE_7); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); + func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); if (this->actor.params == ENBIGPO_REGULAR) { // and SUMMONED, got switched earlier EnBigpo_SpawnCutsceneStage1(this, play); } else { // ENBIGPO_REVEALEDFIRE EnBigpo_SetupFlameCirclePositions(this, play); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -464,14 +464,14 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { dampe = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_TK); if (dampe != NULL) { // if dampe exists, switch to viewing his running away cutscene - dampe->params = this->actor.cutscene; + dampe->params = this->actor.csId; } else { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); } } else { // ENBIGPO_REGULAR - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); } - func_800B724C(play, &this->actor, PLAYER_CSMODE_6); + func_800B724C(play, &this->actor, PLAYER_CSMODE_END); EnBigpo_SetupIdleFlying(this); // setup idle flying } } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 47df4b75b..c9b31571f 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -347,7 +347,7 @@ void EnBigslime_Init(Actor* thisx, PlayState* play2) { return; } - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; this->actor.scale.x = this->actor.scale.z = 0.15f; this->actor.scale.y = 0.075f; this->vtxScaleX = this->vtxScaleZ = 0.015000001f; @@ -847,9 +847,9 @@ void EnBigslime_EndCutscene(EnBigslime* this, PlayState* play) { subCam = Play_GetCamera(play, this->subCamId); Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; - ActorCutscene_Stop(this->cutscene); - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - func_800B724C(play, &this->actor, PLAYER_CSMODE_6); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); + func_800B724C(play, &this->actor, PLAYER_CSMODE_END); } } @@ -986,7 +986,7 @@ void EnBigslime_SetupCallMinislime(EnBigslime* this, PlayState* play) { Animation_MorphToPlayOnce(&this->skelAnime, &gGekkoCallAnim, 5.0f); EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_GREET); this->callTimer = 0; - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); this->actionFunc = EnBigslime_CallMinislime; } @@ -2523,31 +2523,31 @@ void EnBigslime_InitEntrance(EnBigslime* this, PlayState* play) { } void EnBigslime_SetupCutscene(EnBigslime* this) { - if (ActorCutscene_GetCurrentIndex() == 0x7D) { - ActorCutscene_Stop(0x7D); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR) { + CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); } if (this->actor.colChkInfo.health == 0) { - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); this->actionFuncStored = this->actionFunc; this->actionFunc = EnBigslime_PlayCutscene; this->actor.speed = 0.0f; } void EnBigslime_PlayCutscene(EnBigslime* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() == 0x7D) { - ActorCutscene_Stop(0x7D); - ActorCutscene_SetIntentToPlay(this->cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR) { + CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); + CutsceneManager_Queue(this->csId); + } else if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->actor); if (this->actionFuncStored != EnBigslime_SquishFlat) { - func_800B724C(play, &this->actor, PLAYER_CSMODE_7); + func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); } - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->cutscene); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->csId); if (this->actor.colChkInfo.health == 0) { EnBigslime_SetupCutsceneDefeat(this, play); } else if ((this->actionFuncStored == EnBigslime_DamageGekko) || @@ -2560,7 +2560,7 @@ void EnBigslime_PlayCutscene(EnBigslime* this, PlayState* play) { EnBigslime_SetupCutsceneStartBattle(this, play); } } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h index 52a29013c..f10938b37 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h @@ -66,7 +66,7 @@ typedef struct EnBigslime { /* 0x02B4 */ u8 shockwaveAlpha; /* 0x02B5 */ u8 gekkoDrawDmgEffType; /* 0x02B6 */ s16 gekkoYaw; - /* 0x02B8 */ s16 cutscene; + /* 0x02B8 */ s16 csId; /* 0x02BA */ union { // multi-use timer s16 idleTimer; s16 noticeTimer; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 6cdca73a7..43e87a90a 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -337,7 +337,7 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { this->animIndex = -1; Actor_SetScale(&this->actor, 0.01f); - SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); this->moonsTear = (ObjMoonStone*)SubS_FindActor(play, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); switch (gSaveContext.save.entrance) { diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h index 29afaf533..84c346a1c 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.h @@ -31,7 +31,7 @@ typedef struct EnBji01 { /* 0x2A6 */ s16 headZRotStep; /* 0x2A8 */ s16 headXRotStep; /* 0x2AA */ u16 textId; - /* 0x2AC */ s16 cutscenes[1]; + /* 0x2AC */ s16 csIdList[1]; /* 0x2B0 */ ObjMoonStone* moonsTear; } EnBji01; // size = 0x2B4 diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 6b54c387c..ae45b0cc5 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -99,8 +99,8 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { if ((gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_73_80) && !CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { - this->unk_2D6 = this->actor.cutscene; - if (this->unk_2D6 == 0) { + this->csId3 = this->actor.csId; + if (this->csId3 == 0) { Actor_Kill(&this->actor); } func_809C52B4(this); @@ -192,11 +192,11 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { } } - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D0); - } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D0)) { - ActorCutscene_SetIntentToPlay(this->unk_2D0); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId1); + } else if (!CutsceneManager_IsNext(this->csId1)) { + CutsceneManager_Queue(this->csId1); } func_809C493C(this, 3, 1.0f); @@ -214,18 +214,18 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { if (this->unk_2B8 == 0) { Player* player = GET_PLAYER(play); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D0); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId1); return; } - if (!ActorCutscene_GetCanPlayNext(this->unk_2D0)) { - ActorCutscene_SetIntentToPlay(this->unk_2D0); + if (!CutsceneManager_IsNext(this->csId1)) { + CutsceneManager_Queue(this->csId1); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D0, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId1, &this->actor); this->unk_2B8 = 1; this->unk_2C0 = 0; this->unk_2D4 = this->actor.yawTowardsPlayer; @@ -248,7 +248,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { case 0: this->unk_2C0 = 1; D_809C6104 = 1; - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->unk_2D0)), + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csId1)), &this->unk_2D8[0]->actor); this->unk_2D4 = 0; this->unk_2BC = 10; @@ -268,7 +268,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { case 2: if (player->transformation == PLAYER_FORM_HUMAN) { this->unk_2B8 = 2; - ActorCutscene_Stop(this->unk_2D0); + CutsceneManager_Stop(this->csId1); func_809C59A4(this, play); sp28 = true; } else { @@ -276,13 +276,13 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { play->msgCtx.msgLength = 0; func_809C493C(this, 1, 1.0f); D_809C6100 = 1; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D2); - } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D2)) { - ActorCutscene_SetIntentToPlay(this->unk_2D2); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId2); + } else if (!CutsceneManager_IsNext(this->csId2)) { + CutsceneManager_Queue(this->csId2); } - ActorCutscene_Stop(this->unk_2D0); + CutsceneManager_Stop(this->csId1); this->actionFunc = func_809C5B1C; sp28 = true; } @@ -299,7 +299,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { case 4: if (this->unk_2B8 != 2) { - ActorCutscene_Stop(this->unk_2D0); + CutsceneManager_Stop(this->csId1); } play->msgCtx.msgLength = 0; func_809C493C(this, 1, 1.0f); @@ -365,7 +365,7 @@ void func_809C5310(EnBomBowlMan* this, PlayState* play) { if (player->actor.world.pos.x < 1510.0f) { if (player->transformation != PLAYER_FORM_DEKU) { if (this->actor.xzDistToPlayer < this->unk_2C8) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); func_809C53A4(this); } } else { @@ -423,7 +423,7 @@ void func_809C5598(EnBomBowlMan* this, PlayState* play) { } else if (this->actor.textId == 0x734) { this->actor.textId = 0x715; } else if (this->actor.textId == 0x715) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); func_809C493C(this, 17, 1.0f); func_809C59A4(this, play); return; @@ -435,7 +435,7 @@ void func_809C5598(EnBomBowlMan* this, PlayState* play) { func_80151BB4(play, 0x24); func_80151BB4(play, 0x25); func_80151BB4(play, 0); - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); this->actionFunc = func_809C5738; return; } @@ -452,25 +452,25 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { ((play->msgCtx.msgMode == 0) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE))) { this->unk_2C2 = 1; func_809C4B6C(this); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D6); - } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { - ActorCutscene_SetIntentToPlay(this->unk_2D6); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId3); + } else if (!CutsceneManager_IsNext(this->csId3)) { + CutsceneManager_Queue(this->csId3); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor); this->unk_2C2 = 2; func_809C493C(this, 18, 1.0f); } } } else if (this->unk_2C2 == 1) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D6); - } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { - ActorCutscene_SetIntentToPlay(this->unk_2D6); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId3); + } else if (!CutsceneManager_IsNext(this->csId3)) { + CutsceneManager_Queue(this->csId3); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor); this->unk_2C2 = 2; func_809C493C(this, 18, 1.0f); } @@ -485,7 +485,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { if (this->unk_298 >= this->path->count) { SET_WEEKEVENTREG(WEEKEVENTREG_84_80); CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); - ActorCutscene_Stop(this->unk_2D6); + CutsceneManager_Stop(this->csId3); Actor_Kill(&this->actor); return; } @@ -530,13 +530,13 @@ void func_809C5AA4(EnBomBowlMan* this, PlayState* play) { } void func_809C5B1C(EnBomBowlMan* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D2); - } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D2)) { - ActorCutscene_SetIntentToPlay(this->unk_2D2); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId2); + } else if (!CutsceneManager_IsNext(this->csId2)) { + CutsceneManager_Queue(this->csId2); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D2, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId2, &this->actor); func_809C5BA0(this); } } @@ -574,7 +574,7 @@ void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { } if (this->unk_2F4 == 0) { - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->unk_2D2)); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csId2)); if (D_809C6100 > 5) { Player* player = GET_PLAYER(play); diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index fc911dd04..e958b84a1 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -17,44 +17,44 @@ typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, PlayState*); #define ENBOMBOWLMAN_FF00_MINUS1 -1 typedef struct EnBomBowlMan { - /* 0x0000 */ Actor actor; - /* 0x0144 */ SkelAnime skelAnime; - /* 0x0188 */ Vec3s jointTable[21]; - /* 0x0206 */ Vec3s morphTable[21]; - /* 0x0284 */ EnBomBowlManActionFunc actionFunc; - /* 0x0288 */ s16 unk_288; - /* 0x028A */ s16 unk_28A; - /* 0x028C */ UNK_TYPE1 unk28C[2]; - /* 0x028E */ s16 unk_28E; - /* 0x0290 */ s16 unk_290; - /* 0x0292 */ UNK_TYPE1 unk292[2]; - /* 0x0294 */ Path* path; - /* 0x0298 */ s16 unk_298; - /* 0x029A */ s16 unk_29A; - /* 0x029C */ s16 unk_29C; - /* 0x029E */ s16 unk_29E; - /* 0x02A0 */ Vec3f unk_2A0; - /* 0x02AC */ UNK_TYPE1 unk2AC[0xC]; - /* 0x02B8 */ s16 unk_2B8; - /* 0x02BA */ s16 unk_2BA; - /* 0x02BC */ s16 unk_2BC; - /* 0x02BE */ UNK_TYPE1 unk2BE[2]; - /* 0x02C0 */ s16 unk_2C0; - /* 0x02C2 */ s16 unk_2C2; - /* 0x02C4 */ f32 unk_2C4; - /* 0x02C8 */ f32 unk_2C8; - /* 0x02CC */ s16 unk_2CC[2]; - /* 0x02D0 */ s16 unk_2D0; - /* 0x02D2 */ s16 unk_2D2; - /* 0x02D4 */ s16 unk_2D4; - /* 0x02D6 */ s16 unk_2D6; - /* 0x02D8 */ struct EnBomBowlMan* unk_2D8[5]; - /* 0x02EC */ UNK_TYPE1 unk2EC[0x4]; - /* 0x02F0 */ s16 unk_2F0; - /* 0x02F2 */ s16 unk_2F2; - /* 0x02F4 */ s16 unk_2F4; - /* 0x02F6 */ s16 unk_2F6; - /* 0x02F8 */ s32 unk_2F8; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[21]; + /* 0x206 */ Vec3s morphTable[21]; + /* 0x284 */ EnBomBowlManActionFunc actionFunc; + /* 0x288 */ s16 unk_288; + /* 0x28A */ s16 unk_28A; + /* 0x28C */ UNK_TYPE1 unk28C[2]; + /* 0x28E */ s16 unk_28E; + /* 0x290 */ s16 unk_290; + /* 0x292 */ UNK_TYPE1 unk292[2]; + /* 0x294 */ Path* path; + /* 0x298 */ s16 unk_298; + /* 0x29A */ s16 unk_29A; + /* 0x29C */ s16 unk_29C; + /* 0x29E */ s16 unk_29E; + /* 0x2A0 */ Vec3f unk_2A0; + /* 0x2AC */ UNK_TYPE1 unk2AC[0xC]; + /* 0x2B8 */ s16 unk_2B8; + /* 0x2BA */ s16 unk_2BA; + /* 0x2BC */ s16 unk_2BC; + /* 0x2BE */ UNK_TYPE1 unk2BE[2]; + /* 0x2C0 */ s16 unk_2C0; + /* 0x2C2 */ s16 unk_2C2; + /* 0x2C4 */ f32 unk_2C4; + /* 0x2C8 */ f32 unk_2C8; + /* 0x2CC */ s16 csIdList[2]; + /* 0x2D0 */ s16 csId1; + /* 0x2D2 */ s16 csId2; + /* 0x2D4 */ s16 unk_2D4; + /* 0x2D6 */ s16 csId3; + /* 0x2D8 */ struct EnBomBowlMan* unk_2D8[5]; + /* 0x2EC */ UNK_TYPE1 unk2EC[0x4]; + /* 0x2F0 */ s16 unk_2F0; + /* 0x2F2 */ s16 unk_2F2; + /* 0x2F4 */ s16 unk_2F4; + /* 0x2F6 */ s16 unk_2F6; + /* 0x2F8 */ s32 unk_2F8; } EnBomBowlMan; // size = 0x2FC #endif // Z_EN_BOM_BOWL_MAN_H diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index c8c8b8ed3..b67ca6820 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -66,7 +66,7 @@ void EnBombal_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 6; this->actor.colChkInfo.health = 1; this->scale = 0.1f; - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; func_80C05B24(this); } @@ -109,16 +109,16 @@ void func_80C05C44(EnBombal* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->cutscene); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId); return; } - if (!ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_SetIntentToPlay(this->cutscene); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); phi_s0 = true; } } else { @@ -147,7 +147,7 @@ void func_80C05DE8(EnBombal* this, PlayState* play) { if (this->timer == 0) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); } Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h index 7c72f3eea..67550c59b 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h @@ -23,7 +23,7 @@ typedef struct EnBombal { /* 0x144 */ EnBombalActionFunc actionFunc; /* 0x148 */ s16 timer; /* 0x14A */ s16 isPopped; - /* 0x14C */ s16 cutscene; + /* 0x14C */ s16 csId; /* 0x150 */ f32 scale; /* 0x154 */ f32 oscillationAngle; /* 0x158 */ ColliderCylinder collider; diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index 5086513db..64f900f32 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -124,11 +124,11 @@ void EnBombers_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); if (bomBowlMan != NULL) { - s32 cs = this->actor.cutscene; + s32 csId = this->actor.csId; s32 i = 0; // clang-format off - while (cs != -1) { bomBowlMan->unk_2CC[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); i++; } + while (csId != CS_ID_NONE) { bomBowlMan->csIdList[i] = csId; csId = CutsceneManager_GetAdditionalCsId(csId); i++; } // clang-format on CLEAR_WEEKEVENTREG(WEEKEVENTREG_76_01); diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index 9591fbbb9..b47a9630f 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -101,8 +101,8 @@ void EnBombers2_Init(Actor* thisx, PlayState* play) { this->unk_2AC = 1; this->actor.world.pos.z += cos; } - this->cutscene = this->actor.cutscene; - if (this->cutscene == 0) { + this->csId = this->actor.csId; + if (this->csId == 0) { Actor_Kill(&this->actor); } func_80C04B40(this); @@ -309,13 +309,13 @@ void func_80C050B8(EnBombers2* this, PlayState* play) { void func_80C0520C(EnBombers2* this, PlayState* play) { if (this->unk_2A8 == 0) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->cutscene) == 0) { - ActorCutscene_SetIntentToPlay(this->cutscene); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId); + } else if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_2A8 = 1; } } else { @@ -332,7 +332,7 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { this->unk_2A8 = 0; this->unk_2C0 = 1; SET_WEEKEVENTREG(WEEKEVENTREG_73_80); - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->unk_2AC = 1; this->actor.textId = sTextIds[this->textIdIndex]; Message_StartTextbox(play, this->actor.textId, &this->actor); diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h index 4a79e6615..9e6f6b577 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h @@ -27,7 +27,7 @@ typedef struct EnBombers2 { /* 0x2A8 */ s32 unk_2A8; /* 0x2AC */ u8 unk_2AC; /* 0x2AE */ s16 animIndex; - /* 0x2B0 */ s16 cutscene; + /* 0x2B0 */ s16 csId; /* 0x2B2 */ s16 unk_2B2; /* 0x2B4 */ s16 unk_2B4; /* 0x2B6 */ s16 unk_2B6; diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index a1a1b0a32..aad6d9bc3 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -119,7 +119,7 @@ s16 D_80C00AF8[] = { void EnBomjima_Init(Actor* thisx, PlayState* play) { EnBomjima* this = THIS; - s32 cs; + s32 csId; s32 i; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -135,12 +135,12 @@ void EnBomjima_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (this->unk_2E6 == 0) { - cs = this->actor.cutscene; + csId = this->actor.csId; i = 0; - while (cs != -1) { + while (csId != CS_ID_NONE) { // clang-format off - this->cutscenes[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); + this->csIdList[i] = csId; csId = CutsceneManager_GetAdditionalCsId(csId); // clang-format on i++; } @@ -340,8 +340,8 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) { this->bombal = (EnBombal*)actor; Math_Vec3f_Copy(&this->unk_2B0, &actor->world.pos); - if (this->bombalCutscene == 0) { - this->bombalCutscene = this->bombal->actor.cutscene; + if (this->bombalCsId == 0) { + this->bombalCsId = this->bombal->actor.csId; } func_80BFEB1C(this); break; @@ -389,7 +389,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { return; } - if (ActorCutscene_GetCurrentIndex() == -1) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { func_800B8614(&this->actor, play, 70.0f); } @@ -465,17 +465,17 @@ void func_80BFEFF0(EnBomjima* this) { void func_80BFF03C(EnBomjima* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->cutscenes[0]); - } else if (!ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { - ActorCutscene_SetIntentToPlay(this->cutscenes[0]); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[0]); + } else if (!CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Queue(this->csIdList[0]); } else { player->stateFlags1 &= ~PLAYER_STATE1_20; CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); - ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->actor); func_80BFF120(this); } } @@ -494,7 +494,7 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->cutsceneTimer == 1) { - ActorCutscene_Stop(this->cutscenes[0]); + CutsceneManager_Stop(this->csIdList[0]); this->cutsceneEnded = true; } @@ -576,7 +576,7 @@ void func_80BFF430(EnBomjima* this, PlayState* play) { if (bombal != NULL) { bombal->scale = 0.0f; - bombal->cutscene = this->bombalCutscene; + bombal->csId = this->bombalCsId; Actor_ChangeFocus(&this->actor, play, &bombal->actor); CLEAR_WEEKEVENTREG(WEEKEVENTREG_83_04); func_80BFE65C(this); @@ -653,14 +653,14 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { f32 y; f32 z; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->cutscenes[1]); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[1]); return; } - if (!ActorCutscene_GetCanPlayNext(this->cutscenes[1])) { - ActorCutscene_SetIntentToPlay(this->cutscenes[1]); + if (!CutsceneManager_IsNext(this->csIdList[1])) { + CutsceneManager_Queue(this->csIdList[1]); return; } @@ -690,7 +690,7 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { } D_80C009F0 = 0; - ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor); + CutsceneManager_StartWithPlayerCs(this->csIdList[1], &this->actor); this->actionFunc = func_80BFF9B0; } @@ -774,7 +774,7 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_86; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; - ActorCutscene_Stop(this->cutscenes[1]); + CutsceneManager_Stop(this->csIdList[1]); } } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h index 6a434be42..b8196b344 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h @@ -40,7 +40,7 @@ typedef struct EnBomjima { /* 0x2CA */ s16 unk_2CA; /* 0x2CC */ f32 animLastFrame; /* 0x2D0 */ f32 unk_2D0; - /* 0x2D4 */ s16 cutscenes[2]; + /* 0x2D4 */ s16 csIdList[2]; /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above? /* 0x2DC */ s16 unk_2DC; /* 0x2DE */ s16 cutsceneEnded; @@ -52,7 +52,7 @@ typedef struct EnBomjima { /* 0x2EA */ s16 unk_2EA; /* 0x2EC */ s32 animIndex; /* 0x2F0 */ EnBombal* bombal; - /* 0x2F4 */ s16 bombalCutscene; + /* 0x2F4 */ s16 bombalCsId; /* 0x2F8 */ ColliderCylinder collider; } EnBomjima; // size = 0x344 diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index dbe25cdf4..302547c26 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -187,7 +187,7 @@ void EnBox_ClipToGround(EnBox* this, PlayState* play) { void EnBox_Init(Actor* thisx, PlayState* play) { s32 pad; EnBox* this = THIS; - s16 cutsceneIdx; + s16 csId; CollisionHeader* colHeader; f32 animFrame; f32 animFrameEnd; @@ -290,17 +290,17 @@ void EnBox_Init(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->dyna.actor, 40.0f); } - this->cutsceneIdxA = -1; - this->cutsceneIdxB = -1; - cutsceneIdx = this->dyna.actor.cutscene; + this->csId1 = CS_ID_NONE; + this->csId2 = CS_ID_NONE; + csId = this->dyna.actor.csId; - while (cutsceneIdx != -1) { - if (func_800F2178(cutsceneIdx) == 1) { - this->cutsceneIdxB = cutsceneIdx; + while (csId != CS_ID_NONE) { + if (CutsceneManager_GetCutsceneCustomValue(csId) == 1) { + this->csId2 = csId; } else { - this->cutsceneIdxA = cutsceneIdx; + this->csId1 = csId; } - cutsceneIdx = ActorCutscene_GetAdditionalCutscene(cutsceneIdx); + csId = CutsceneManager_GetAdditionalCsId(csId); } func_80867BDC(&this->unk_1F4, play, &this->dyna.actor.home.pos); } @@ -388,12 +388,12 @@ void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) { void EnBox_AppearSwitchFlag(EnBox* this, PlayState* play) { Actor_SetClosestSecretDistance(&this->dyna.actor, play); if (Flags_GetSwitch(play, this->switchFlag)) { - if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor); + if (CutsceneManager_IsNext(this->csId1)) { + CutsceneManager_StartWithPlayerCs(this->csId1, &this->dyna.actor); EnBox_SetupAction(this, func_80868AFC); this->unk_1A0 = -30; } else { - ActorCutscene_SetIntentToPlay(this->cutsceneIdxA); + CutsceneManager_Queue(this->csId1); } } } @@ -401,19 +401,19 @@ void EnBox_AppearSwitchFlag(EnBox* this, PlayState* play) { void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) { Actor_SetClosestSecretDistance(&this->dyna.actor, play); if (Flags_GetClearTemp(play, this->dyna.actor.room)) { - if (ActorCutscene_GetCanPlayNext(this->cutsceneIdxA)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutsceneIdxA, &this->dyna.actor); + if (CutsceneManager_IsNext(this->csId1)) { + CutsceneManager_StartWithPlayerCs(this->csId1, &this->dyna.actor); Flags_SetClear(play, this->dyna.actor.room); EnBox_SetupAction(this, func_80868AFC); this->unk_1A0 = -30; } else { - ActorCutscene_SetIntentToPlay(this->cutsceneIdxA); + CutsceneManager_Queue(this->csId1); } } } void func_80868AFC(EnBox* this, PlayState* play) { - if ((func_800F22C4(this->cutsceneIdxA, &this->dyna.actor) != 0) || (this->unk_1A0 != 0)) { + if ((func_800F22C4(this->csId1, &this->dyna.actor) != 0) || (this->unk_1A0 != 0)) { EnBox_SetupAction(this, func_80868B74); this->unk_1A0 = 0; func_80867FBC(&this->unk_1F4, play, (this->movementFlags & ENBOX_MOVE_0x80) != 0); @@ -432,7 +432,7 @@ void func_80868B74(EnBox* this, PlayState* play) { this->dyna.actor.world.pos.y += 1.25f; } this->unk_1A0++; - if ((this->cutsceneIdxA != -1) && ActorCutscene_GetCurrentIndex() == this->cutsceneIdxA) { + if ((this->csId1 != -1) && CutsceneManager_GetCurrentCsId() == this->csId1) { if (this->unk_1A0 == 2) { func_800B724C(play, &this->dyna.actor, PLAYER_CSMODE_4); } else if (this->unk_1A0 == 22) { @@ -445,7 +445,7 @@ void func_80868B74(EnBox* this, PlayState* play) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; } else { EnBox_SetupAction(this, EnBox_WaitOpen); - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } } @@ -460,8 +460,8 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { this->alpha = 255; this->movementFlags |= ENBOX_MOVE_IMMOBILE; - if ((this->unk_1EC != 0) && ((this->cutsceneIdxB < 0) || (ActorCutscene_GetCurrentIndex() == this->cutsceneIdxB) || - (ActorCutscene_GetCurrentIndex() == -1))) { + if ((this->unk_1EC != 0) && ((this->csId2 < 0) || (CutsceneManager_GetCurrentCsId() == this->csId2) || + (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) { if (this->unk_1EC < 0) { animHeader = &gBoxChestOpenAnim; playbackSpeed = 1.5f; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.h b/src/overlays/actors/ovl_En_Box/z_en_box.h index 9cb5af18d..75d9f09c9 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -60,8 +60,8 @@ typedef struct EnBox { /* 0x1F2 */ u8 iceSmokeTimer; /* 0x1F3 */ s8 unk_1F3; /* 0x1F4 */ struct_80867BDC_a0 unk_1F4; - /* 0x218 */ s16 cutsceneIdxA; - /* 0x21A */ s16 cutsceneIdxB; + /* 0x218 */ s16 csId1; + /* 0x21A */ s16 csId2; /* 0x21C */ s32 getItemId; /* 0x220 */ s32 collectableFlag; } EnBox; // size = 0x224 diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index 92030934f..cbe96e0f0 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -72,13 +72,13 @@ void EnCha_Destroy(Actor* thisx, PlayState* play) { void EnCha_Ring(EnCha* this, PlayState* play) { EnCha_Idle(this, play); - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { this->actionFunc = EnCha_Idle; - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = EnCha_Idle; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 15d087ea7..21278af9f 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -556,7 +556,7 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { } break; case 1: - Cutscene_Start(play, &play->csCtx); + Cutscene_StartManual(play, &play->csCtx); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE); @@ -585,8 +585,8 @@ void EnClearTag_UpdateCamera(EnClearTag* this, PlayState* play) { mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; func_80169AFC(play, this->subCamId, 0); - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); this->cameraState = 0; this->subCamId = SUB_CAM_ID_DONE; this->activeTimer = 20; diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index fbd829212..7b3f97ded 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -176,13 +176,13 @@ s32 func_80B3E5DC(EnDai* this, s32 arg1) { s32 func_80B3E69C(EnDai* this, PlayState* play) { s32 ret = false; - if ((play->csCtx.state != CS_STATE_0) && (play->sceneId == SCENE_12HAKUGINMAE) && - (play->csCtx.currentCsIndex == 0) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_30_01)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->sceneId == SCENE_12HAKUGINMAE) && + (play->csCtx.scriptIndex == 0) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_30_01)) { if (!(this->unk_1CE & 0x10)) { Flags_SetSwitch(play, 20); this->unk_1CE |= (0x80 | 0x10); this->unk_1CE &= ~(0x100 | 0x20); - this->unk_1CC = 0xFF; + this->cueId = 255; this->unk_1DC = 0; this->unk_1CD = 0; this->unk_1F0 = D_80B3FBF0; @@ -240,7 +240,7 @@ static s32 D_80B3FC8C[] = { 0x920C0F0C, 0x930C1211, 0x5520100E, 0x0C940C12, 0x10000000, }; -s16 func_80B3E8BC(EnDai* this, s32 arg1) { +s16 func_80B3E8BC(EnDai* this, s32 cueId) { static f32 D_80B3FCB4[] = { 1.0f, 6.0f, 16.0f, 19.0f, 46.0f, 48.0f, 50.0f, 52.0f, 54.0f, 1.0f, 6.0f, 36.0f, }; @@ -256,10 +256,10 @@ s16 func_80B3E8BC(EnDai* this, s32 arg1) { s32 i; s32 end; - if (arg1 == 3) { + if (cueId == 3) { end = 9; i = 0; - } else if (arg1 == 4) { + } else if (cueId == 4) { end = 12; i = 9; } else { @@ -402,12 +402,12 @@ s32 func_80B3ED88(EnDai* this) { } void func_80B3EE8C(EnDai* this, PlayState* play) { - s16 cutscene = this->actor.cutscene; + s16 csId = this->actor.csId; - if (ActorCutscene_GetCanPlayNext(cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(cutscene, &this->actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); } else { - ActorCutscene_SetIntentToPlay(cutscene); + CutsceneManager_Queue(csId); } } @@ -445,15 +445,15 @@ void func_80B3F044(EnDai* this, PlayState* play) { static s32 D_80B3FE38[] = { 0, 0, 6, 7, 8, }; - s32 sp2C = 0; - s32 sp28; + s32 cueChannel = 0; + s32 cueId; - if (Cutscene_CheckActorAction(play, 472)) { - sp2C = Cutscene_GetActorActionIndex(play, 472); - sp28 = play->csCtx.actorActions[sp2C]->action; - if (this->unk_1CC != (u8)sp28) { - func_80B3E5DC(this, D_80B3FE38[sp28]); - switch (sp28) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_472)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_472); + cueId = play->csCtx.actorCues[cueChannel]->id; + if (this->cueId != (u8)cueId) { + func_80B3E5DC(this, D_80B3FE38[cueId]); + switch (cueId) { case 1: this->unk_1E0 = 0.0f; break; @@ -467,10 +467,10 @@ void func_80B3F044(EnDai* this, PlayState* play) { break; } } - this->unk_1CC = sp28; + this->cueId = cueId; } - switch (this->unk_1CC) { + switch (this->cueId) { case 1: this->unk_1E0 += 1.0f; if (this->unk_1E0 < 30.0f) { @@ -481,20 +481,20 @@ void func_80B3F044(EnDai* this, PlayState* play) { break; case 2: - if (play->csCtx.frames == 360) { + if (play->csCtx.curFrame == 360) { Actor_PlaySfx(&this->actor, NA_SE_EN_DAIGOLON_SLEEP3 - SFX_FLAG); } if (Animation_OnFrame(&this->skelAnime, 43.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_GORON_BOUND_1); } - this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC); + this->unk_1D6 = func_80B3E8BC(this, this->cueId); break; case 3: if (Animation_OnFrame(&this->skelAnime, 6.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DAIGOLON_SLEEP1); } - this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC); + this->unk_1D6 = func_80B3E8BC(this, this->cueId); break; case 4: @@ -504,11 +504,11 @@ void func_80B3F044(EnDai* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 35.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_GORON_BOUND_0); } - this->unk_1D6 = func_80B3E8BC(this, this->unk_1CC); + this->unk_1D6 = func_80B3E8BC(this, this->cueId); break; } - Cutscene_ActorTranslateAndYaw(&this->actor, play, sp2C); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } void EnDai_Init(Actor* thisx, PlayState* play) { @@ -525,7 +525,7 @@ void EnDai_Init(Actor* thisx, PlayState* play) { this->unk_1CE = 0; this->unk_1D6 = 0; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { SubS_UpdateFlags(&this->unk_1CE, 3, 7); this->unk_1CE |= 0x80; this->unk_1CD = 0xFF; diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.h b/src/overlays/actors/ovl_En_Dai/z_en_dai.h index 4dc059c39..35928388f 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.h +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.h @@ -26,7 +26,7 @@ typedef struct EnDai { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnDaiActionFunc actionFunc; /* 0x18C */ MtxF unk_18C; - /* 0x1CC */ u8 unk_1CC; + /* 0x1CC */ u8 cueId; /* 0x1CD */ u8 unk_1CD; /* 0x1CE */ u16 unk_1CE; /* 0x1D0 */ s32 unk_1D0; diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 3ccf3fb6d..535b0d65f 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -248,7 +248,7 @@ static TexturePtr D_8089E33C[] = { object_dinofos_Tex_009030, }; -static s16 D_8089E34C = -1; +static s16 sCsId = CS_ID_NONE; static s32 D_8089E350 = 0; static InitChainEntry sInitChain[] = { @@ -291,13 +291,13 @@ void EnDinofos_Init(Actor* thisx, PlayState* play) { } this->unk_28B = 0; - if (thisx->cutscene == -1) { + if (thisx->csId == CS_ID_NONE) { func_8089B7B0(this); } else { this->actor.flags |= ACTOR_FLAG_100000; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - D_8089E34C = thisx->cutscene; + sCsId = thisx->csId; func_8089D2E0(this); } @@ -367,9 +367,9 @@ void func_8089ABF4(EnDinofos* this, PlayState* play) { Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); if (this->actor.colChkInfo.health == 0) { - func_800B724C(play, &this->actor, PLAYER_CSMODE_6); + func_800B724C(play, &this->actor, PLAYER_CSMODE_END); } } } @@ -584,7 +584,7 @@ void func_8089B72C(EnDinofos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { func_8089ABF4(this, play); this->actor.flags &= ~ACTOR_FLAG_100000; - this->actor.cutscene = -1; + this->actor.csId = CS_ID_NONE; func_8089B7B0(this); } } @@ -972,7 +972,7 @@ void func_8089C7B8(EnDinofos* this, PlayState* play) { if (this->unk_290 == 0) { func_8089ACEC(this, play); if (this->actor.colChkInfo.health == 0) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { func_8089CFAC(this); } else { func_8089D2E0(this); @@ -1004,7 +1004,7 @@ void func_8089C938(EnDinofos* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { func_8089CFAC(this); } else { func_8089D2E0(this); @@ -1196,21 +1196,21 @@ void func_8089D1E0(EnDinofos* this, PlayState* play) { } void func_8089D2E0(EnDinofos* this) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_8089D318; } void func_8089D318(EnDinofos* this, PlayState* play) { Vec3f subCamEye; - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_IsNext(this->actor.csId)) { if (this->actor.colChkInfo.health == 0) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); - func_800B724C(play, &this->actor, PLAYER_CSMODE_7); + CutsceneManager_Start(this->actor.csId, &this->actor); + func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); if (this->actor.colChkInfo.health == 0) { subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y; @@ -1221,7 +1221,7 @@ void func_8089D318(EnDinofos* this, PlayState* play) { func_8089B100(this, play); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -1273,12 +1273,12 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); D_8089E350--; if (D_8089E350 == 0) { - if (D_8089E34C != -1) { - this->actor.cutscene = D_8089E34C; + if (sCsId != CS_ID_NONE) { + this->actor.csId = sCsId; } } - if (this->actor.cutscene != -1) { + if (this->actor.csId != CS_ID_NONE) { Audio_RestorePrevBgm(); } } diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index fd60eca75..427e206aa 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -213,8 +213,8 @@ void func_80A51648(EnDnk* this, PlayState* play) { } void func_80A51890(EnDnk* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 126)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 126)); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_126)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_126)); } } @@ -423,7 +423,7 @@ void func_80A52018(Actor* thisx, PlayState* play) { } void func_80A52074(EnDnk* this, PlayState* play) { - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 80: func_8019F128(NA_SE_EN_DEKNUTS_DANCE1); break; @@ -441,7 +441,7 @@ void func_80A52074(EnDnk* this, PlayState* play) { break; } - if ((play->csCtx.frames >= 198) && (play->csCtx.frames < 438)) { + if ((play->csCtx.curFrame >= 198) && (play->csCtx.curFrame < 438)) { func_8019F128(NA_SE_EN_DEKNUTS_DANCE - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index d42e2e233..a9128b1bd 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -243,7 +243,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) { this->unk_3BE = 0x3E93; this->unk_3C0 = 60.0f; this->unk_3B0 = 0; - this->unk_468 = 99; + this->cueId = 99; this->skelAnime.playSpeed = 0.0f; switch (EN_DNO_GET_C000(thisx)) { @@ -916,12 +916,12 @@ void func_80A732C8(EnDno* this, PlayState* play) { void func_80A73408(EnDno* this, PlayState* play) { s32 phi_a2; u8 sp33 = true; - s32 temp_v0; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 475)) { - temp_v0 = Cutscene_GetActorActionIndex(play, 475); - if (this->unk_468 != play->csCtx.actorActions[temp_v0]->action) { - switch (play->csCtx.actorActions[temp_v0]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_475)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_475); + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: phi_a2 = 13; break; @@ -940,7 +940,7 @@ void func_80A73408(EnDno* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->animIndex); } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.h b/src/overlays/actors/ovl_En_Dno/z_en_dno.h index 470c82ee8..f9a55cd4e 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.h +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.h @@ -47,7 +47,7 @@ typedef struct EnDno { /* 0x460 */ Actor* unk_460; /* 0x464 */ u16 textId; /* 0x466 */ s16 unk_466; - /* 0x468 */ u8 unk_468; + /* 0x468 */ u8 cueId; } EnDno; // size = 0x46C #endif // Z_EN_DNO_H diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 745987344..dedbe30b4 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -269,7 +269,7 @@ s32 func_80B3D044(EnDnp* this, PlayState* play) { if (!(this->unk_322 & 0x200)) { this->unk_322 |= (0x200 | 0x10); this->actor.flags &= ~ACTOR_FLAG_1; - this->unk_324 = 0xFF; + this->cueId = 255; } SubS_UpdateFlags(&this->unk_322, 0, 7); this->actionFunc = func_80B3D11C; @@ -292,20 +292,19 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { EN_DNP_ANIM_ANGRY_START, EN_DNP_ANIM_JUMP, EN_DNP_ANIM_BOUNCE_START, EN_DNP_ANIM_GLARE_START, EN_DNP_ANIM_BOW, }; - s32 temp_v0; - s32 val; + s32 cueChannel; + s32 cueId; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40) && (play->sceneId == SCENE_MITURIN) && - (play->csCtx.currentCsIndex == 0)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40) && (play->sceneId == SCENE_MITURIN) && (play->csCtx.scriptIndex == 0)) { this->unk_322 |= 0x20; SET_WEEKEVENTREG(WEEKEVENTREG_29_40); } - if (Cutscene_CheckActorAction(play, 101)) { - temp_v0 = Cutscene_GetActorActionIndex(play, 101); - val = play->csCtx.actorActions[temp_v0]->action; - if (this->unk_324 != (u8)val) { - EnDnp_ChangeAnim(this, sCsAnimations[val]); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_101)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_101); + cueId = play->csCtx.actorCues[cueChannel]->id; + if (this->cueId != (u8)cueId) { + EnDnp_ChangeAnim(this, sCsAnimations[cueId]); if (this->animIndex == EN_DNP_ANIM_CUTSCENE_IDLE) { this->unk_322 |= 8; } else { @@ -323,14 +322,14 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { } } - this->unk_324 = val; + this->cueId = cueId; if (((this->animIndex == EN_DNP_ANIM_THINK_START) || (this->animIndex == EN_DNP_ANIM_ARMS_TOGETHER_START) || (this->animIndex == EN_DNP_ANIM_LAUGH_START) || (this->animIndex == EN_DNP_ANIM_ANGRY_START) || (this->animIndex == EN_DNP_ANIM_BOUNCE_START) || (this->animIndex == EN_DNP_ANIM_GLARE_START)) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnDnp_ChangeAnim(this, this->animIndex + 1); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } @@ -387,11 +386,11 @@ void func_80B3D47C(EnDnp* this, PlayState* play) { } void func_80B3D558(EnDnp* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); SET_WEEKEVENTREG(WEEKEVENTREG_23_20); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -415,7 +414,7 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { SubS_UpdateFlags(&this->unk_322, 0, 7); this->actor.shape.rot.x = 0; this->actor.world.rot.x = this->actor.shape.rot.x; - this->actor.cutscene = 0x10; + this->actor.csId = 16; this->actionFunc = func_80B3D47C; } else if (((EN_DNP_GET_TYPE(&this->actor) == EN_DNP_TYPE_WOODFALL_TEMPLE) && !Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) || diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h index a41a63615..64f0baf93 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.h @@ -26,7 +26,7 @@ typedef struct EnDnp { /* 0x1EA */ Vec3s jointTable[DEKU_PRINCESS_LIMB_MAX]; /* 0x286 */ Vec3s morphTable[DEKU_PRINCESS_LIMB_MAX]; /* 0x322 */ u16 unk_322; - /* 0x324 */ u8 unk_324; + /* 0x324 */ u8 cueId; /* 0x328 */ s32 unk_328; /* 0x32C */ UNK_TYPE1 unk_32C[0x2]; /* 0x32E */ s16 unk_32E; diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 0c5227bd4..ea5bd4e94 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -124,7 +124,7 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { if (play->csCtx.state != 0) { if (!(this->unk_37C & 0x20)) { this->picto.actor.flags &= ~ACTOR_FLAG_1; - this->unk_1DC = 0xFF; + this->cueId = 255; this->unk_37C |= 0x20; } SubS_UpdateFlags(&this->unk_37C, 0, 7); @@ -132,7 +132,7 @@ s32 func_80A52648(EnDnq* this, PlayState* play) { } else { if (this->unk_37C & 0x20) { this->picto.actor.flags |= ACTOR_FLAG_1; - this->unk_1DC = 0xFF; + this->cueId = 255; this->unk_37C &= ~0x20; SubS_UpdateFlags(&this->unk_37C, 3, 7); } @@ -346,7 +346,7 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_23_20)) { this->unk_390 = 70.0f; if (Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !Play_InCsMode(play) && - (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (ActorCutscene_GetCurrentIndex() == -1)) { + (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE)) { if ((DECR(this->unk_384) == 0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_29_40)) { Message_StartTextbox(play, 0x969, NULL); this->unk_384 = 200; @@ -391,15 +391,15 @@ void func_80A53038(EnDnq* this, PlayState* play) { static s32 D_80A535FC[] = { 0, 1, 2, 3, 5, 6, }; - s32 temp_v0; - u32 temp_v1; + s32 cueChannel; + u32 cueId; - if (Cutscene_CheckActorAction(play, 105)) { - temp_v0 = Cutscene_GetActorActionIndex(play, 105); - temp_v1 = play->csCtx.actorActions[temp_v0]->action; - if (this->unk_1DC != (u8)temp_v1) { - func_80A5257C(this, D_80A535FC[temp_v1]); - this->unk_1DC = temp_v1; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_105)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_105); + cueId = play->csCtx.actorCues[cueChannel]->id; + if (this->cueId != (u8)cueId) { + func_80A5257C(this, D_80A535FC[cueId]); + this->cueId = cueId; } if ((this->unk_398 == 4) && Animation_OnFrame(&this->skelAnime, 2.0f)) { @@ -411,7 +411,7 @@ void func_80A53038(EnDnq* this, PlayState* play) { func_80A5257C(this, this->unk_398 + 1); } - Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, cueChannel); } } diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h index 5afb8bdf8..6ede37a55 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.h @@ -14,7 +14,7 @@ typedef struct EnDnq { /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ EnDnqActionFunc actionFunc; /* 0x190 */ ColliderCylinder collider; - /* 0x1DC */ u8 unk_1DC; + /* 0x1DC */ u8 cueId; /* 0x1E0 */ s32 unk_1E0; /* 0x1E4 */ Vec3s jointTable[DEKU_KING_LIMB_MAX]; /* 0x2AA */ Vec3s morphTable[DEKU_KING_LIMB_MAX]; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 7a540ad49..6837e5367 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -205,19 +205,19 @@ s32* func_8092C9BC(EnDns* this, PlayState* play) { return 0; } -s32 func_8092CA74(EnDns* this) { +s32 EnDns_GetCueType(EnDns* this) { switch (ENDNS_GET_7(&this->actor)) { case ENDNS_GET_7_0: - return 465; + return CS_CMD_ACTOR_CUE_465; case ENDNS_GET_7_1: - return 466; + return CS_CMD_ACTOR_CUE_466; case ENDNS_GET_7_2: - return 467; + return CS_CMD_ACTOR_CUE_467; case ENDNS_GET_7_3: - return 468; + return CS_CMD_ACTOR_CUE_468; } return 0; @@ -251,11 +251,11 @@ s32 func_8092CB98(EnDns* this, PlayState* play) { if (play->csCtx.state != 0) { if (!(this->unk_2C6 & 0x80)) { - this->unk_2C8 = func_8092CA74(this); + this->cueType = EnDns_GetCueType(this); this->actor.flags &= ~ACTOR_FLAG_1; SubS_UpdateFlags(&this->unk_2C6, 0, 7); this->unk_2C6 |= 0x80; - this->unk_1D8 = 0xFF; + this->cueId = 255; } phi_v1 = 1; } else if (this->unk_2C6 & 0x80) { @@ -479,15 +479,15 @@ void func_8092D5E8(EnDns* this, PlayState* play) { EN_DNS_ANIM_SURPRISE_START, EN_DNS_ANIM_RUN_START, }; - s32 temp_v0; - u32 temp_v1; + s32 cueChannel; + u32 cueId; - if (Cutscene_CheckActorAction(play, this->unk_2C8)) { - temp_v0 = Cutscene_GetActorActionIndex(play, this->unk_2C8); - temp_v1 = play->csCtx.actorActions[temp_v0]->action; - if (this->unk_1D8 != (u8)temp_v1) { - func_8092C63C(this, D_8092DE0C[temp_v1]); - this->unk_1D8 = temp_v1; + if (Cutscene_IsCueInChannel(play, this->cueType)) { + cueChannel = Cutscene_GetCueChannel(play, this->cueType); + cueId = play->csCtx.actorCues[cueChannel]->id; + if (this->cueId != (u8)cueId) { + func_8092C63C(this, D_8092DE0C[cueId]); + this->cueId = cueId; } if (((this->animIndex == EN_DNS_ANIM_SURPRISE_START) || (this->animIndex == EN_DNS_ANIM_RUN_START)) && @@ -495,7 +495,7 @@ void func_8092D5E8(EnDns* this, PlayState* play) { func_8092C63C(this, this->animIndex + 1); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.h b/src/overlays/actors/ovl_En_Dns/z_en_dns.h index b54e49a6a..4b730abd3 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -25,8 +25,7 @@ typedef struct EnDns { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnDnsActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ u8 unk_1D8; - /* 0x1D9 */ UNK_TYPE1 unk_1D9[0x3]; + /* 0x1D8 */ u8 cueId; /* 0x1DC */ s32 unk_1DC; /* 0x1E0 */ s32* unk_1E0; /* 0x1E4 */ Gfx* unk_1E4[13]; @@ -35,7 +34,7 @@ typedef struct EnDns { /* 0x22A */ Vec3s jointTable[KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX]; /* 0x278 */ Vec3s morphTable[KINGS_CHAMBER_DEKU_GUARD_LIMB_MAX]; /* 0x2C6 */ u16 unk_2C6; - /* 0x2C8 */ u16 unk_2C8; + /* 0x2C8 */ u16 cueType; /* 0x2CA */ UNK_TYPE1 unk_2CA[0x2]; /* 0x2CC */ s16 unk_2CC; /* 0x2CE */ s16 unk_2CE; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index aa9d9c89a..e2b225e23 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -240,7 +240,7 @@ u8 D_80867744[] = { }; u8 D_8086775C[] = { - /* 0x00 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_52_20, 0x1B - 0x04), + /* 0x00 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE, 0x1B - 0x04), /* 0x04 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_75_20, 0x1B - 0x08), /* 0x08 */ SCHEDULE_CMD_CHECK_FLAG_S(WEEKEVENTREG_14_04, 0x0E - 0x0C), /* 0x0C */ SCHEDULE_CMD_RET_VAL_S(29), diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c index c5936c4e2..605d0d807 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c @@ -447,7 +447,7 @@ void EnDragon_Extend(EnDragon* this, PlayState* play) { } void EnDragon_SetSubCamEyeAt(EnDragon* this, PlayState* play, Vec3f subCamEye, Vec3f subCamAt) { - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); Math_Vec3f_Copy(&this->subCamEye, &subCamEye); Math_Vec3f_Copy(&this->subCamAt, &subCamAt); Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); @@ -458,10 +458,10 @@ void EnDragon_SetupGrab(EnDragon* this, PlayState* play) { Vec3f extendedPos; s16 yaw; - if (!ActorCutscene_GetCanPlayNext(this->grabCutsceneIndex)) { - ActorCutscene_SetIntentToPlay(this->grabCutsceneIndex); + if (!CutsceneManager_IsNext(this->grabCsId)) { + CutsceneManager_Queue(this->grabCsId); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->grabCutsceneIndex, &this->actor); + CutsceneManager_StartWithPlayerCs(this->grabCsId, &this->actor); Math_Vec3f_Copy(&extendedPos, &this->burrowEntrancePos); extendedPos.x += Math_SinS(this->actor.world.rot.y) * -530.0f; extendedPos.z += Math_CosS(this->actor.world.rot.y) * -530.0f; @@ -496,7 +496,7 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { Vec3f pos; // used as both the extended position and the camera eye Vec3f subCamAt; - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); SkelAnime_Update(&this->skelAnime); if (this->grabTimer == 0) { @@ -535,7 +535,7 @@ void EnDragon_Grab(EnDragon* this, PlayState* play) { if (this->grabTimer > sMaxGrabTimerPerPython[this->pythonIndex]) { if (this->state == DEEP_PYTHON_GRAB_STATE_START) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); this->state = DEEP_PYTHON_GRAB_STATE_GRABBED; } @@ -617,7 +617,7 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { (this->collider.elements[2].info.bumperFlags & BUMP_HIT)) { player->actor.parent = NULL; this->grabWaitTimer = 30; - ActorCutscene_Stop(this->grabCutsceneIndex); + CutsceneManager_Stop(this->grabCsId); if (player->stateFlags2 & PLAYER_STATE2_80) { player->unk_AE8 = 100; } @@ -634,10 +634,10 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) { } void EnDragon_SetupDead(EnDragon* this, PlayState* play) { - if (!ActorCutscene_GetCanPlayNext(this->deathCutsceneIndex)) { - ActorCutscene_SetIntentToPlay(this->deathCutsceneIndex); + if (!CutsceneManager_IsNext(this->deathCsId)) { + CutsceneManager_Queue(this->deathCsId); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->deathCutsceneIndex, &this->actor); + CutsceneManager_StartWithPlayerCs(this->deathCsId, &this->actor); this->endFrame = Animation_GetLastFrame(&gDeepPythonSmallSideSwayAnim); Animation_Change(&this->skelAnime, &gDeepPythonSmallSideSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); this->timer = 20; @@ -682,7 +682,7 @@ void EnDragon_Dead(EnDragon* this, PlayState* play) { seahorsePos.y += -100.0f + BREG(33); seahorsePos.z += (Math_CosS((this->actor.parent->world.rot.y + 0x8000)) * (500.0f + BREG(38))); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, seahorsePos.x, seahorsePos.y, - seahorsePos.z, 0, this->actor.shape.rot.y, 0, 0x4000, this->actor.cutscene, + seahorsePos.z, 0, this->actor.shape.rot.y, 0, 0x4000, this->actor.csId, this->actor.halfDaysBits, NULL)) { SET_WEEKEVENTREG(WEEKEVENTREG_13_01); switch (this->pythonIndex) { diff --git a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h index cb2ab9490..2d5f31b54 100644 --- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h +++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.h @@ -47,8 +47,8 @@ typedef struct EnDragon { /* 0x2BA */ s16 action; /* 0x2BC */ UNK_TYPE1 unk_2BC[0x2]; /* 0x2BE */ s16 state; - /* 0x2C0 */ s16 grabCutsceneIndex; - /* 0x2C2 */ s16 deathCutsceneIndex; + /* 0x2C0 */ s16 grabCsId; + /* 0x2C2 */ s16 deathCsId; /* 0x2C4 */ UNK_TYPE1 unk_2C4[0x4]; /* 0x2C8 */ s16 subCamId; /* 0x2CA */ s16 grabTimer; // Counts up from the time a grab starts until the time the actor begins attacking diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index 8172ded90..6f9c0e73a 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -1043,11 +1043,11 @@ void EnEgol_Damaged(EnEgol* this, PlayState* play) { } void EnEgol_StartDeathCutscene(EnEgol* this, PlayState* play) { - if (!ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + if (!CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Queue(this->actor.csId); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); this->subCamFovTarget = 60.0f; EnEgol_ChangeAnim(this, EYEGORE_ANIM_DEATH); this->action = EYEGORE_ACTION_DYING; @@ -1075,7 +1075,7 @@ void EnEgol_Death(EnEgol* this, PlayState* play) { if (this->switchFlag > -1) { Flags_SetSwitch(play, this->switchFlag); } - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); Actor_Kill(&this->actor); } else { if (Animation_OnFrame(&this->skelAnime, 46.0f)) { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 751c24aab..f70b60b57 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -855,8 +855,8 @@ void func_8088E60C(EnElf* this, PlayState* play) { glowLightRadius = 0; } - if (Cutscene_CheckActorAction(play, 201)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 201)]->action == 6) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_201)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_201)]->id == 6) { glowLightRadius = 0; } } @@ -883,18 +883,18 @@ void func_8088E850(EnElf* this, PlayState* play) { Actor* arrowPointedActor; f32 xScale; f32 distFromLinksHead; - u32 sp38; + u32 cueChannel; func_8088F214(this, play); func_8088E5A8(this, play); xScale = 0.0f; - if (Cutscene_CheckActorAction(play, 201)) { - sp38 = Cutscene_GetActorActionIndex(play, 201); - func_808908D0(&nextPos, play, sp38); - this->actor.shape.rot.y = play->csCtx.actorActions[sp38]->urot.y; - this->actor.shape.rot.x = play->csCtx.actorActions[sp38]->urot.x; - if (play->csCtx.actorActions[sp38]->action == 5) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_201)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_201); + func_808908D0(&nextPos, play, cueChannel); + this->actor.shape.rot.y = play->csCtx.actorCues[cueChannel]->rot.y; + this->actor.shape.rot.x = play->csCtx.actorCues[cueChannel]->rot.x; + if (play->csCtx.actorCues[cueChannel]->id == 5) { func_8088F5F4(this, play, 16); } @@ -904,14 +904,13 @@ void func_8088E850(EnElf* this, PlayState* play) { func_8088D660(this, &nextPos, 0.2f); } - if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 0) && - (play->csCtx.currentCsIndex == 0) && - ((play->csCtx.frames == 149) || (play->csCtx.frames == 381) || (play->csCtx.frames == 591))) { + if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 0) && + ((play->csCtx.curFrame == 149) || (play->csCtx.curFrame == 381) || (play->csCtx.curFrame == 591))) { Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } - if ((play->sceneId == SCENE_SECOM) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 4) && - (play->csCtx.frames == 95)) { + if ((play->sceneId == SCENE_SECOM) && (gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 4) && + (play->csCtx.curFrame == 95)) { Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } } else { @@ -1016,7 +1015,7 @@ void func_8088E850(EnElf* this, PlayState* play) { func_8088E60C(this, play); - if (!Cutscene_CheckActorAction(play, 0xC9)) { + if (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_201)) { this->actor.shape.rot.y = this->unk_258; } } @@ -1107,8 +1106,8 @@ void func_8088F214(EnElf* this, PlayState* play) { s32 pad; if (play->csCtx.state != 0) { - if (Cutscene_CheckActorAction(play, 201)) { - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 201)]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_201)) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_201)]->id) { case 4: sp34 = 7; break; @@ -1325,19 +1324,19 @@ void func_8088FC34(EnElf* this, PlayState* play) { } void func_8088FD04(EnElf* this) { - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { this->unk_264 &= ~1; this->unk_264 |= 2; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); this->unk_264 |= 1; - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); this->unk_264 &= ~1; this->unk_264 |= 2; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->unk_264 |= 1; } } @@ -1348,8 +1347,8 @@ void func_8088FDCC(EnElf* this) { this->fairyFlags &= ~0x20; this->actor.focus.pos = this->actor.world.pos; this->unk_234 = NULL; - if ((this->unk_264 & 2) && (this->actor.cutscene != 0x7C)) { - ActorCutscene_Stop(this->actor.cutscene); + if ((this->unk_264 & 2) && (this->actor.csId != CS_ID_GLOBAL_TALK)) { + CutsceneManager_Stop(this->actor.csId); } this->unk_264 &= ~0x20; } @@ -1485,8 +1484,8 @@ void func_8089010C(Actor* thisx, PlayState* play) { func_8088C51C(this, 3); if (this->elfMsg != NULL) { this->elfMsg->flags |= ACTOR_FLAG_TALK_REQUESTED; - thisx->cutscene = this->elfMsg->cutscene; - if (thisx->cutscene != -1) { + thisx->csId = this->elfMsg->csId; + if (thisx->csId != CS_ID_NONE) { func_8088FD04(this); } if (this->elfMsg->home.rot.x == -0x961) { @@ -1494,7 +1493,7 @@ void func_8089010C(Actor* thisx, PlayState* play) { Actor_ChangeFocus(thisx, play, this->elfMsg); } } else { - thisx->cutscene = -1; + thisx->csId = CS_ID_NONE; } thisx->flags &= ~ACTOR_FLAG_10000; } else if (this->unk_264 & 4) { @@ -1580,8 +1579,8 @@ void EnElf_Draw(Actor* thisx, PlayState* play) { if (player->currentMask != PLAYER_MASK_GIANT) { if (!(this->fairyFlags & 8) && - (!Cutscene_CheckActorAction(play, 201) || - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 201)]->action != 6)) && + (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_201) || + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_201)]->id != 6)) && (!(player->stateFlags1 & PLAYER_STATE1_100000) || (kREG(90) < this->actor.projectedPos.z))) { Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, 4 * sizeof(Gfx)); f32 alphaScale; @@ -1624,17 +1623,17 @@ void EnElf_Draw(Actor* thisx, PlayState* play) { void func_808908D0(Vec3f* vec, PlayState* play, u32 action) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* npcAction = play->csCtx.actorActions[action]; + CsCmdActorCue* cue = play->csCtx.actorCues[action]; f32 lerp; - startPos.x = npcAction->startPos.x; - startPos.y = npcAction->startPos.y; - startPos.z = npcAction->startPos.z; + startPos.x = cue->startPos.x; + startPos.y = cue->startPos.y; + startPos.z = cue->startPos.z; - endPos.x = npcAction->endPos.x; - endPos.y = npcAction->endPos.y; - endPos.z = npcAction->endPos.z; + endPos.x = cue->endPos.x; + endPos.y = cue->endPos.y; + endPos.z = cue->endPos.z; - lerp = Environment_LerpWeight(npcAction->endFrame, npcAction->startFrame, play->csCtx.frames); + lerp = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); VEC3F_LERPIMPDST(vec, &startPos, &endPos, lerp); } diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index 7f6067d9c..a3f17f605 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -47,14 +47,14 @@ ActorInit En_Elfgrp_InitVars = { (ActorFunc)NULL, }; -void func_80A396B0(EnElfgrp* this, s32 arg1) { - while (arg1 > 0) { - if (this->actor.cutscene == -1) { +void func_80A396B0(EnElfgrp* this, s32 numCutscenes) { + while (numCutscenes > 0) { + if (this->actor.csId == CS_ID_NONE) { break; } - this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + this->actor.csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); - arg1--; + numCutscenes--; } } @@ -345,9 +345,9 @@ void func_80A3A044(PlayState* play) { } void func_80A3A0AC(EnElfgrp* this, PlayState* play) { - if (!Cutscene_CheckActorAction(play, 0x64)) { + if (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_100)) { this->actionFunc = func_80A3A600; - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); } } @@ -386,12 +386,12 @@ void func_80A3A210(EnElfgrp* this, PlayState* play) { } void func_80A3A274(EnElfgrp* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x64)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_100)) { if (this->unk_14A & 1) { func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); } - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x64)]->action) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_100)]->id) { case 2: if (!(this->unk_14A & 1)) { if (this->unk_147 == ENELFGRP_0) { @@ -414,8 +414,8 @@ void func_80A3A274(EnElfgrp* this, PlayState* play) { } void func_80A3A398(EnElfgrp* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = func_80A3A274; Flags_UnsetSwitch(play, ENELFGRP_GET_FE00(&this->actor)); if (this->unk_14A & 2) { @@ -431,7 +431,7 @@ void func_80A3A398(EnElfgrp* this, PlayState* play) { } this->unk_14A &= ~8; } else if (this->actor.xzDistToPlayer < 350.0f) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -443,9 +443,10 @@ void func_80A3A484(EnElfgrp* this, PlayState* play) { } void func_80A3A4AC(EnElfgrp* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x64)) { - s32 temp = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x64)]->action; - if (temp == 3) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_100)) { + s32 cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_100)]->id; + + if (cueId == 3) { this->actionFunc = func_80A3A484; this->unk_144 = 90; } @@ -453,10 +454,10 @@ void func_80A3A4AC(EnElfgrp* this, PlayState* play) { } void func_80A3A520(EnElfgrp* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x67)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_103)) { this->actionFunc = func_80A3A600; - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = func_80A3A4AC; Flags_SetSwitch(play, ENELFGRP_GET_FE00(&this->actor)); @@ -468,7 +469,7 @@ void func_80A3A520(EnElfgrp* this, PlayState* play) { Flags_SetSwitch(play, this->actor.home.rot.z); } } else if (this->actor.xzDistToPlayer < 350.0f) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 542d739e6..871665cc6 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -431,16 +431,16 @@ void EnElforg_ClockTownFairyCollected(EnElforg* this, PlayState* play) { player->stateFlags1 &= ~PLAYER_STATE1_20000000; Actor_Kill(&this->actor); SET_WEEKEVENTREG(WEEKEVENTREG_08_80); - ActorCutscene_Stop(0x7C); + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); return; } func_800B9010(&this->actor, NA_SE_PL_CHIBI_FAIRY_HEAL - SFX_FLAG); - if (ActorCutscene_GetCurrentIndex() != 0x7C) { - if (ActorCutscene_GetCanPlayNext(0x7C)) { - ActorCutscene_Start(0x7C, &this->actor); + if (CutsceneManager_GetCurrentCsId() != CS_ID_GLOBAL_TALK) { + if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { + CutsceneManager_Start(CS_ID_GLOBAL_TALK, &this->actor); } else { - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); } } } @@ -485,7 +485,7 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { // Bring me back to North Clock Town! Message_StartTextbox(play, 0x579, NULL); this->actionFunc = EnElforg_ClockTownFairyCollected; - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); return; } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index b83799ea6..94087bfb1 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -315,7 +315,7 @@ void EnFall_Setup(EnFall* this, PlayState* play) { void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { static s32 sGiantsCutsceneState = 0; - if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 0)) { switch (sGiantsCutsceneState) { case 0: if (play->csCtx.state != 0) { @@ -327,20 +327,20 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOLWA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_93_04)) { - if (ActorCutscene_GetCanPlayNext(0xC)) { - ActorCutscene_Start(0xC, &this->actor); + if (CutsceneManager_IsNext(12)) { + CutsceneManager_Start(12, &this->actor); sGiantsCutsceneState++; } else { - ActorCutscene_SetIntentToPlay(0xC); + CutsceneManager_Queue(12); } - } else if (ActorCutscene_GetCanPlayNext(0xB)) { - ActorCutscene_Start(0xB, &this->actor); + } else if (CutsceneManager_IsNext(11)) { + CutsceneManager_Start(11, &this->actor); SET_WEEKEVENTREG(WEEKEVENTREG_93_04); sGiantsCutsceneState++; } else { - ActorCutscene_SetIntentToPlay(0xB); + CutsceneManager_Queue(11); } - } else if (play->csCtx.frames > 1600) { + } else if (play->csCtx.curFrame > 1600) { play->nextEntrance = ENTRANCE(CLOCK_TOWER_ROOFTOP, 0); gSaveContext.nextCutsceneIndex = 0xFFF2; play->transitionTrigger = TRANS_TRIGGER_START; @@ -351,7 +351,7 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { break; case 9: - play->csCtx.frames--; + play->csCtx.curFrame--; break; } } @@ -359,15 +359,15 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { void EnFall_CrashingMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { EnFall_CrashingMoon_HandleGiantsCutscene(this, play); - if (Cutscene_CheckActorAction(play, 0x85)) { - if (Cutscene_CheckActorAction(play, 133) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133) && + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)]->id == 1) { this->actor.draw = NULL; } else { this->actor.draw = EnFall_Moon_Draw; - if (Cutscene_CheckActorAction(play, 133) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 2) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 133)); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133) && + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)]->id == 2) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)); } } } else { @@ -376,8 +376,8 @@ void EnFall_CrashingMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { } void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 133)) { - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133)) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)]->id) { case 3: if (this->eyeGlowIntensity == 0.0f) { Actor_PlaySfx(&this->actor, NA_SE_EV_MOON_EYE_FLASH); @@ -396,10 +396,10 @@ void EnFall_StoppedOpenMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* } void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 133)) { - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133)) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)]->id) { case 2: - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 133)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)); break; case 4: @@ -409,9 +409,9 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat } if ((play->sceneId == SCENE_OKUJOU) && (gSaveContext.sceneLayer == 2)) { - switch (play->csCtx.currentCsIndex) { + switch (play->csCtx.scriptIndex) { case 0: - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 1060: Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM1); break; @@ -424,13 +424,13 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; } - if (play->csCtx.frames >= 1145) { + if (play->csCtx.curFrame >= 1145) { func_800B9010(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); } break; case 1: - switch (play->csCtx.frames) { + switch (play->csCtx.curFrame) { case 561: Actor_PlaySfx(&this->actor, NA_SE_EN_MOON_SCREAM1); break; @@ -443,7 +443,7 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat Actor_PlaySfx(&this->actor, NA_SE_EV_SLIP_MOON); break; } - if (play->csCtx.frames >= 650) { + if (play->csCtx.curFrame >= 650) { func_800B9010(&this->actor, NA_SE_EV_FALL_POWER - SFX_FLAG); } break; @@ -463,16 +463,16 @@ void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, Pla void EnFall_Moon_PerformDefaultActions(EnFall* this, PlayState* play) { u16 currentDay; - if (Cutscene_CheckActorAction(play, 133)) { - if (Cutscene_CheckActorAction(play, 133) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133) && + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)]->id == 1) { this->actor.draw = NULL; } else { Actor_SetScale(&this->actor, this->scale * 3.6f); this->actor.draw = EnFall_Moon_Draw; - if (Cutscene_CheckActorAction(play, 133) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 133)]->action == 2) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 133)); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_133) && + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)]->id == 2) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_133)); } } } else { @@ -510,8 +510,9 @@ void EnFall_MoonsTear_DoNothing(EnFall* this, PlayState* play) { void EnFall_MoonsTear_Fall(EnFall* this, PlayState* play) { s32 pad; - if (Cutscene_CheckActorAction(play, 517) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 517)]->action == 2 && this->actor.draw == NULL) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_517) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_517)]->id == 2) && + (this->actor.draw == NULL)) { EnFall_MoonsTear_Initialize(this); } @@ -574,11 +575,11 @@ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 2)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 2)) { play->skyboxCtx.rot.y -= 0.05f; } - if (Cutscene_CheckActorAction(play, 450)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_450)) { this->actor.draw = EnFall_Fireball_Draw; if (this->flags & FLAG_FIRE_BALL_INTENSIFIES) { this->fireballIntensity += 0.01f; @@ -586,9 +587,9 @@ void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { this->fireballIntensity = 1.0f; } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 450)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, 450)); - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 450)]->action) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, 450)]->id) { default: this->actor.draw = NULL; this->fireballAlpha = 0; @@ -625,7 +626,7 @@ void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { this->actor.draw = NULL; } - if (Cutscene_CheckActorAction(play, 0x1C2) && this->fireballAlpha > 0) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_450) && (this->fireballAlpha > 0)) { func_8019F128(NA_SE_EV_MOON_FALL_LAST - SFX_FLAG); } Actor_SetScale(&this->actor, this->scale * 1.74f); @@ -682,9 +683,9 @@ s32 EnFall_RisingDebris_InitializeEffect(EnFall* this) { void EnFall_RisingDebris_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if (Cutscene_CheckActorAction(play, 451)) { - if (Cutscene_CheckActorAction(play, 451) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 451)]->action == 2) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_451)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_451) && + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_451)]->id == 2) { EnFall_RisingDebris_UpdateEffects(this); EnFall_RisingDebris_InitializeEffect(this); } else if (this->activeDebrisEffectCount != 0) { @@ -699,8 +700,8 @@ void EnFall_RisingDebris_Update(Actor* thisx, PlayState* play) { void EnFall_FireRing_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if (Cutscene_CheckActorAction(play, 450) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 450)]->action == 5) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_450) && + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_450)]->id == 5) { if (!(this->flags & FLAG_FIRE_RING_APPEARS)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c index 33cf9a64d..28a6cc74c 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c @@ -44,7 +44,7 @@ void EnFall2_Init(Actor* thisx, PlayState* play) { this->unk2DC = Lib_SegmentedToVirtual(object_fall2_Matanimheader_008840); Actor_SetScale(&this->actor, 0.02f); this->actionFunc = func_80C1B9D4; - this->csActionIndex = 0x231; + this->cueType = CS_CMD_ACTOR_CUE_561; this->alphaLevel = 0.0f; } @@ -92,13 +92,13 @@ void EnFall2_DoNothing(EnFall2* this, PlayState* play) { void func_80C1B8B4(EnFall2* this) { this->actor.draw = EnFall2_Draw; - if (this->csActorAction == 1) { + if (this->cueId == 1) { Actor_SetScale(&this->actor, 0.02f); } } void func_80C1B8F0(EnFall2* this) { - switch (this->csActorAction) { + switch (this->cueId) { case 1: if (this->alphaLevel < 1.0f) { this->alphaLevel += 1.0f / 30.0f; @@ -125,12 +125,10 @@ void func_80C1B8F0(EnFall2* this) { void func_80C1B9D4(EnFall2* this, PlayState* play) { func_80183DE0(&this->skeletonInfo); - if (Cutscene_CheckActorAction(play, this->csActionIndex)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionIndex)); - if (this->csActorAction != - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionIndex)]->action) { - this->csActorAction = - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionIndex)]->action; + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + if (this->cueId != play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id) { + this->cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; func_80C1B8B4(this); } func_80C1B8F0(this); diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h index 41f064498..3555595f3 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h @@ -15,8 +15,8 @@ typedef struct EnFall2 { /* 0x228 */ Vec3s unk228[30]; /* 0x2DC */ AnimatedMaterial* unk2DC; /* 0x2E0 */ f32 alphaLevel; - /* 0x2E4 */ s16 csActorAction; - /* 0x2E6 */ u16 csActionIndex; + /* 0x2E4 */ s16 cueId; + /* 0x2E6 */ u16 cueType; /* 0x2E8 */ EnFall2ActionFunc actionFunc; } EnFall2; // size = 0x2EC diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index 47244f9d3..b7952c1bc 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -151,7 +151,7 @@ s32 func_80B28478(EnFish2* this) { void EnFish2_Init(Actor* thisx, PlayState* play) { EnFish2* this = THIS; s32 i; - s32 cs; + s32 csId; Math_Vec3f_Copy(&this->unk_324, &this->actor.home.pos); this->unk_344 = D_80B2B2F0; @@ -187,12 +187,12 @@ void EnFish2_Init(Actor* thisx, PlayState* play) { this->unk_2C0 = 3; } } - cs = this->actor.cutscene; + csId = this->actor.csId; this->unk_330 = D_80B2B370[this->unk_2C0]; i = 0; // clang-format off - while (cs != -1) { this->unk_2BA[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); i++; } + while (csId != CS_ID_NONE) { this->csIdList[i] = csId; csId = CutsceneManager_GetAdditionalCsId(csId); i++; } // clang-format on Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); @@ -416,7 +416,7 @@ void func_80B28C14(EnFish2* this, PlayState* play) { if (this->unk_354 != NULL) { D_80B2B2E4 = 0; D_80B2B2E0 = 1; - fish->unk_2BA[0] = this->unk_2BA[0]; + fish->csIdList[0] = this->csIdList[0]; fish->unk_350 = this->unk_350; } } @@ -784,11 +784,11 @@ void func_80B29EE4(EnFish2* this, PlayState* play) { void func_80B2A01C(EnFish2* this, PlayState* play) { if (this->unk_2B4 == 0) { - if (!ActorCutscene_GetCanPlayNext(this->unk_2BA[0])) { - ActorCutscene_SetIntentToPlay(this->unk_2BA[0]); + if (!CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Queue(this->csIdList[0]); } else { this->unk_2B4 = 15; - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2BA[0], &this->actor); + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->actor); this->actionFunc = func_80B2A094; } } @@ -801,13 +801,13 @@ void func_80B2A094(EnFish2* this, PlayState* play) { D_80B2B2E4 = 1; } - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->unk_2BA[0]); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->csIdList[0]); if (D_80B2B2EC != 0) { D_80B2B2EC++; if (D_80B2B2EC > 200) { Actor_Kill(&this->actor); - ActorCutscene_Stop(this->unk_2BA[0]); + CutsceneManager_Stop(this->csIdList[0]); return; } } @@ -862,7 +862,7 @@ void func_80B2A23C(EnFish2* this, PlayState* play) { if ((this->unk_2B4 == 0) && (D_80B2B2E4 == 3)) { D_80B2B2E0 = D_80B2B2EC = D_80B2B2E4 = 0; D_80B2B2F4 = NULL; - ActorCutscene_Stop(this->unk_2BA[0]); + CutsceneManager_Stop(this->csIdList[0]); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h index 49941d67e..20b1ff21b 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.h @@ -28,7 +28,7 @@ typedef struct EnFish2 { /* 0x02B4 */ s16 unk_2B4; /* 0x02B6 */ s16 unk_2B6; /* 0x02B8 */ s16 unk_2B8; - /* 0x02BA */ s16 unk_2BA[3]; + /* 0x02BA */ s16 csIdList[3]; /* 0x02C0 */ s32 unk_2C0; /* 0x02C4 */ s32 unk_2C4; /* 0x02C8 */ u8 unk_2C8; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 4bbd4b5cc..306f1d94d 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -3,7 +3,7 @@ * Overlay: ovl_En_Fishing * Description: Fishing Pond Elements (Owner, Fish, Props, Effects...) */ - +#include "prevent_bss_reordering.h" #include "z_en_fishing.h" #include "z64rumble.h" #include "z64shrink_window.h" @@ -3776,7 +3776,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { player->unk_B28 = 3; Rumble_Override(0.0f, 1, 3, 1); D_809171D8++; - Cutscene_Start(play, &play->csCtx); + Cutscene_StartManual(play, &play->csCtx); D_8090CD4C = 100; D_80911F48 = 45.0f; D_8090CD14 = 5; @@ -5278,7 +5278,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { mainCam->at = sSubCamAt; } func_80169AFC(play, sSubCamId, 0); - Cutscene_End(play, &play->csCtx); + Cutscene_StopManual(play, &play->csCtx); D_8090CD4C = 0; sSubCamId = SUB_CAM_ID_DONE; func_800F6834(play, 0); @@ -5288,7 +5288,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { break; case 10: - Cutscene_Start(play, &play->csCtx); + Cutscene_StartManual(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); @@ -5318,8 +5318,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { mainCam->at = sSubCamAt; func_80169AFC(play, sSubCamId, 0); - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); D_8090CD4C = 0; sSubCamId = SUB_CAM_ID_DONE; D_8090CD50 = 30; @@ -5329,7 +5329,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { break; case 20: - Cutscene_Start(play, &play->csCtx); + Cutscene_StartManual(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STATUS_ACTIVE); @@ -5419,9 +5419,8 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { mainCam->eyeNext = sSubCamEye; mainCam->at = sSubCamAt; func_80169AFC(play, sSubCamId, 0); - Cutscene_End(play, &play->csCtx); - func_800B7298(play, &this->actor, - PLAYER_CSMODE_6); // arg2 changed from PLAYER_CSMODE_7 to PLAYER_CSMODE_6 in MM + Cutscene_StopManual(play, &play->csCtx); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); D_8090CD4C = 0; sSubCamId = SUB_CAM_ID_DONE; player->unk_B28 = -5; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 680f4f830..ffd456af4 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -176,7 +176,7 @@ void EnFloormas_Init(Actor* thisx, PlayState* play2) { this->actor.parent = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, params + 0x10, -1, this->actor.halfDaysBits, NULL); + this->actor.world.pos.z, 0, 0, 0, params + 0x10, CS_ID_NONE, this->actor.halfDaysBits, NULL); if (this->actor.parent == NULL) { Actor_Kill(&this->actor); return; @@ -184,7 +184,7 @@ void EnFloormas_Init(Actor* thisx, PlayState* play2) { this->actor.child = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_FLOORMAS, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - params + 0x10, -1, this->actor.halfDaysBits, NULL); + params + 0x10, CS_ID_NONE, this->actor.halfDaysBits, NULL); if (this->actor.child == NULL) { Actor_Kill(this->actor.parent); Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index 81e261a00..8130f3cc9 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -228,21 +228,21 @@ void EnFsn_UpdateCollider(EnFsn* this, PlayState* play) { } void EnFsn_HandleLookToShopkeeperBuyingCutscene(EnFsn* this) { - if ((this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) && - (this->lookToShopkeeperBuyingCutscene != this->cutscene) && (this->actor.textId == 0x29CE)) { - ActorCutscene_Stop(this->cutscene); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if ((this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) && (this->lookToShopkeeperBuyingCsId != this->csId) && + (this->actor.textId == 0x29CE)) { + CutsceneManager_Stop(this->csId); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperBuyingCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperBuyingCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENFSN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -387,7 +387,7 @@ void EnFsn_SpawnShopItems(EnFsn* this, PlayState* play) { void EnFsn_EndInteraction(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; } Actor_ProcessTalkRequest(&this->actor, &play->state); @@ -737,11 +737,11 @@ void EnFsn_Idle(EnFsn* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_WAITING; } this->actor.textId = EnFsn_GetWelcome(play); @@ -797,8 +797,8 @@ void EnFsn_Haggle(EnFsn* this, PlayState* play) { void EnFsn_BeginInteraction(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; if (Player_GetMask(play) == PLAYER_MASK_NONE) { func_8011552C(play, DO_ACTION_NEXT); @@ -812,7 +812,7 @@ void EnFsn_BeginInteraction(EnFsn* this, PlayState* play) { this->actionFunc = EnFsn_SetupEndInteractionImmediately; } } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -958,7 +958,7 @@ void EnFsn_MakeOffer(EnFsn* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; } switch (this->price) { @@ -1021,17 +1021,17 @@ void EnFsn_ResumeInteraction(EnFsn* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (ENFSN_IS_SHOP(&this->actor)) { if (!this->isSelling) { - this->cutscene = this->lookToShopkeeperBuyingCutscene; + this->csId = this->lookToShopkeeperBuyingCsId; this->actor.textId = 0x29D0; } else { - this->cutscene = this->lookToShopkeeperCutscene; + this->csId = this->lookToShopkeeperCsId; this->actor.textId = (this->numSellingItems <= 0) ? 0x29DE : 0x29D6; } Message_StartTextbox(play, this->actor.textId, &this->actor); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); this->actionFunc = EnFsn_ResumeShoppingInteraction; } else { EnFsn_HandleConversationBackroom(this, play); @@ -1044,8 +1044,8 @@ void EnFsn_ResumeInteraction(EnFsn* this, PlayState* play) { void EnFsn_ResumeShoppingInteraction(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; if (!this->isSelling) { this->actionFunc = EnFsn_AskCanBuyMore; @@ -1058,33 +1058,33 @@ void EnFsn_ResumeShoppingInteraction(EnFsn* this, PlayState* play) { this->actionFunc = EnFsn_FaceShopkeeperSelling; } } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = !this->isSelling ? this->lookToShopkeeperBuyingCutscene : this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = !this->isSelling ? this->lookToShopkeeperBuyingCsId : this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } } } void EnFsn_LookToShelf(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + CutsceneManager_Stop(this->csId); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShelfCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShelfCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENFSN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene) != 0) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; EnFsn_UpdateCursorPos(this, play); this->actionFunc = EnFsn_BrowseShelf; Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -1117,16 +1117,16 @@ void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) { void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, PlayState* play) { if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + CutsceneManager_Stop(this->csId); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperFromShelfCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperFromShelfCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENFSN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = true; @@ -1134,7 +1134,7 @@ void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, PlayState* play) { Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = EnFsn_FaceShopkeeperSelling; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -1148,7 +1148,7 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_33_04); case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENFSN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED; } func_8019F208(); @@ -1231,15 +1231,15 @@ void EnFsn_AskCanBuyMore(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } } if (talkState == TEXT_STATE_CHOICE) { @@ -1277,15 +1277,15 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENFSN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } } if (talkState == TEXT_STATE_CHOICE) { @@ -1380,10 +1380,10 @@ void EnFsn_ConverseBackroom(EnFsn* this, PlayState* play) { } void EnFsn_GetCutscenes(EnFsn* this) { - this->lookToShopkeeperCutscene = this->actor.cutscene; - this->lookToShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShopkeeperCutscene); - this->lookToShopkeeperFromShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShelfCutscene); - this->lookToShopkeeperBuyingCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShopkeeperFromShelfCutscene); + this->lookToShopkeeperCsId = this->actor.csId; + this->lookToShelfCsId = CutsceneManager_GetAdditionalCsId(this->lookToShopkeeperCsId); + this->lookToShopkeeperFromShelfCsId = CutsceneManager_GetAdditionalCsId(this->lookToShelfCsId); + this->lookToShopkeeperBuyingCsId = CutsceneManager_GetAdditionalCsId(this->lookToShopkeeperFromShelfCsId); } void EnFsn_Blink(EnFsn* this) { diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h index 35b654c3d..f214dcbd9 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h @@ -33,11 +33,11 @@ typedef struct EnFsn { /* 0x364 */ s16 eyeTexIndex; /* 0x366 */ s16 blinkTimer; /* 0x368 */ s16 cutsceneState; - /* 0x36A */ s16 cutscene; - /* 0x36C */ s16 lookToShopkeeperCutscene; - /* 0x36E */ s16 lookToShelfCutscene; - /* 0x370 */ s16 lookToShopkeeperFromShelfCutscene; - /* 0x372 */ s16 lookToShopkeeperBuyingCutscene; + /* 0x36A */ s16 csId; + /* 0x36C */ s16 lookToShopkeeperCsId; + /* 0x36E */ s16 lookToShelfCsId; + /* 0x370 */ s16 lookToShopkeeperFromShelfCsId; + /* 0x372 */ s16 lookToShopkeeperBuyingCsId; /* 0x374 */ s16 price; /* 0x376 */ u16 textId; /* 0x378 */ u8 isSelling; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 2626d1cbd..7435d0ddc 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -727,9 +727,9 @@ void func_80962D60(EnFu* this, PlayState* play) { void func_80962EBC(EnFu* this, PlayState* play) { if (this->unk_542 != 0) { - if (this->actor.cutscene != -1) { + if (this->actor.csId != CS_ID_NONE) { Camera_ChangeDataIdx(play->cameraPtrs[CAM_ID_MAIN], - ActorCutscene_GetCutscene(this->actor.cutscene)->csCamSceneDataId); + CutsceneManager_GetCutsceneEntry(this->actor.csId)->csCamId); } } } diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index b4542956c..add0814bd 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -219,13 +219,13 @@ void EnGakufu_GiveReward(EnGakufu* this, PlayState* play) { } void EnGakufu_PlayRewardCutscene(EnGakufu* this, PlayState* play) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { EnGakufu_GiveReward(this, play); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); EnGakufu_GiveReward(this, play); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 0575494c8..14afe3270 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -241,9 +241,9 @@ u16 func_80B0F97C(EnGb2* this) { } void func_80B0FA04(EnGb2* this) { - this->unk_282[0] = this->actor.cutscene; - this->unk_282[1] = ActorCutscene_GetAdditionalCutscene(this->unk_282[0]); - this->unk_282[2] = ActorCutscene_GetAdditionalCutscene(this->unk_282[1]); + this->csIdList[0] = this->actor.csId; + this->csIdList[1] = CutsceneManager_GetAdditionalCsId(this->csIdList[0]); + this->csIdList[2] = CutsceneManager_GetAdditionalCsId(this->csIdList[1]); } s32 func_80B0FA48(EnGb2* this, PlayState* play) { @@ -433,7 +433,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - func_800B7298(play, NULL, PLAYER_CSMODE_7); + func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); this->actionFunc = func_80B11344; break; @@ -451,10 +451,10 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { void func_80B10240(EnGb2* this, PlayState* play) { this->unk_27C = D_80B119B0[this->unk_280].unk_00; this->unk_27E = D_80B119B0[this->unk_280].unk_10; - this->unk_282[0] = this->actor.cutscene; + this->csIdList[0] = this->actor.csId; this->unk_268 = NULL; - if (ActorCutscene_GetCanPlayNext(this->unk_282[0])) { - ActorCutscene_Start(this->unk_282[0], &this->actor); + if (CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Start(this->csIdList[0], &this->actor); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, this->unk_27C, D_80B119B0[this->unk_280].unk_04.x, D_80B119B0[this->unk_280].unk_04.y, D_80B119B0[this->unk_280].unk_04.z, 0, 0, 0, this->unk_27E); @@ -463,7 +463,7 @@ void func_80B10240(EnGb2* this, PlayState* play) { } this->actionFunc = func_80B10344; } else { - ActorCutscene_SetIntentToPlay(this->unk_282[0]); + CutsceneManager_Queue(this->csIdList[0]); } } @@ -585,7 +585,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - func_800B7298(play, NULL, PLAYER_CSMODE_7); + func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); this->actionFunc = func_80B11344; } break; @@ -601,16 +601,16 @@ void func_80B10634(EnGb2* this, PlayState* play) { } void func_80B10868(EnGb2* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() != this->unk_282[2]) { - if (ActorCutscene_GetCanPlayNext(this->unk_282[this->unk_290])) { + if (CutsceneManager_GetCurrentCsId() != this->csIdList[2]) { + if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { this->actionFunc = func_80B10A48; - ActorCutscene_StartAndSetFlag(this->unk_282[this->unk_290], &this->actor); + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csIdList[this->csIdIndex], &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->unk_282[this->unk_290]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } else { - this->unk_290 = 1; - ActorCutscene_SetIntentToPlay(this->unk_282[this->unk_290]); + this->csIdIndex = 1; + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } @@ -656,12 +656,12 @@ void func_80B10A48(EnGb2* this, PlayState* play) { break; case ENGB2_7_1: - ActorCutscene_Stop(this->unk_282[this->unk_290]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); Actor_Kill(&this->actor); break; case ENGB2_7_2: - ActorCutscene_Stop(this->unk_282[this->unk_290]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); if (this->unk_26E == 0x14FB) { Flags_SetSwitch(play, ENGB2_GET_7F8(&this->actor)); Actor_Kill(&this->actor); @@ -694,7 +694,7 @@ void func_80B10B5C(EnGb2* this, PlayState* play) { this->unk_26C |= 2; } Message_StartTextbox(play, this->unk_26E, &this->actor); - this->unk_290 = 1; + this->csIdIndex = 1; this->unk_26C &= ~0x40; this->actionFunc = func_80B10DAC; } else if ((this->actor.xzDistToPlayer < 300.0f) && this->actor.isTargeted) { @@ -712,7 +712,7 @@ void func_80B10B5C(EnGb2* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_80_20); } this->unk_26C &= ~0x20; - this->unk_290 = 0; + this->csIdIndex = 0; this->unk_26C |= 0x80; this->actionFunc = func_80B10DAC; } else if (this->actor.xzDistToPlayer < 300.0f) { @@ -726,9 +726,9 @@ void func_80B10B5C(EnGb2* this, PlayState* play) { } void func_80B10DAC(EnGb2* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_282[this->unk_290])) { + if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { if (ENGB2_GET_7(&this->actor) == ENGB2_7_1) { - if (this->unk_290 != 2) { + if (this->csIdIndex != 2) { this->actionFunc = func_80B10E98; } else { Flags_SetSwitch(play, ENGB2_GET_7F8(&this->actor)); @@ -737,12 +737,12 @@ void func_80B10DAC(EnGb2* this, PlayState* play) { } else { this->actionFunc = func_80B110F8; } - ActorCutscene_StartAndSetFlag(this->unk_282[this->unk_290], &this->actor); + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csIdList[this->csIdIndex], &this->actor); } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->unk_282[this->unk_290]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } @@ -753,14 +753,14 @@ void func_80B10E98(EnGb2* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; if ((this->unk_26E != 0x14E8) && (this->unk_26E != 0x14EA)) { - ActorCutscene_Stop(this->unk_282[this->unk_290]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->actionFunc = func_80B10B5C; } else if (Flags_GetSwitch(play, ENGB2_GET_7F8(&this->actor))) { this->actionFunc = func_80B10A48; } else { - ActorCutscene_Stop(this->unk_282[this->unk_290]); - this->unk_290 = 2; - ActorCutscene_SetIntentToPlay(this->unk_282[this->unk_290]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 2; + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); this->actionFunc = func_80B10DAC; } } else { @@ -770,9 +770,9 @@ void func_80B10E98(EnGb2* this, PlayState* play) { Message_StartTextbox(play, this->unk_26E, &this->actor); temp = this->unk_26E; if ((temp == 0x14E7) || (temp == 0x14E9) || (temp == 0x14EC) || (temp == 0x14F0)) { - ActorCutscene_Stop(this->unk_282[this->unk_290]); - this->unk_290 = 1; - ActorCutscene_SetIntentToPlay(this->unk_282[this->unk_290]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 1; + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); this->actionFunc = func_80B10DAC; } } @@ -839,8 +839,8 @@ void func_80B111AC(EnGb2* this, PlayState* play) { void func_80B11268(EnGb2* this, PlayState* play) { if (play->roomCtx.curRoom.num == 1) { - this->unk_290 = 0; - this->unk_282[0] = this->actor.cutscene; + this->csIdIndex = 0; + this->csIdList[0] = this->actor.csId; if (Flags_GetClear(play, 2) && Flags_GetClear(play, 3) && Flags_GetClear(play, 4) && Flags_GetClear(play, 5)) { this->unk_28A = 0xFF; this->unk_26C &= ~0x100; @@ -887,7 +887,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { case ENGB2_7_0: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_80)) { Actor_Kill(&this->actor); - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { Actor_Kill(&this->actor); } @@ -927,8 +927,8 @@ void EnGb2_Init(Actor* thisx, PlayState* play) { break; case ENGB2_7_2: - this->unk_290 = 0; - this->unk_282[0] = this->actor.cutscene; + this->csIdIndex = 0; + this->csIdList[0] = this->actor.csId; if (Flags_GetSwitch(play, ENGB2_GET_7F8(thisx))) { Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h index ec3b379a1..87cee9e99 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.h @@ -31,11 +31,11 @@ typedef struct EnGb2 { /* 0x27C */ s16 unk_27C; /* 0x27E */ s16 unk_27E; /* 0x280 */ s16 unk_280; - /* 0x282 */ s16 unk_282[3]; + /* 0x282 */ s16 csIdList[3]; /* 0x288 */ s16 unk_288; /* 0x28A */ u8 unk_28A; /* 0x28C */ s32 unk_28C; - /* 0x290 */ s16 unk_290; + /* 0x290 */ s16 csIdIndex; } EnGb2; // size = 0x294 #endif // Z_EN_GB2_H diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index dd53d9ea8..6cfbb4718 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -88,7 +88,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { this->picto.actor.colChkInfo.mass = MASS_IMMOVABLE; this->picto.actor.targetMode = 6; Actor_SetScale(&this->picto.actor, 0.01f); - this->animIndex = this->csAction = -1; // GERUDO_WHITE_ANIM_NONE + this->animIndex = this->cueId = -1; // GERUDO_WHITE_ANIM_NONE this->stateFlags = 0; EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_ARMS_FOLDED, ANIMMODE_LOOP, 0.0f); this->actionFunc = EnGe1_Wait; @@ -255,16 +255,16 @@ void EnGe1_Wait(EnGe1* this, PlayState* play) { } void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { - s16 csAction; + s16 cueId; - if (SkelAnime_Update(&this->skelAnime) && (this->csAction == 3)) { + if (SkelAnime_Update(&this->skelAnime) && (this->cueId == 3)) { EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_STIFF_SHIVERING, ANIMMODE_LOOP, 0.0f); } - if (Cutscene_CheckActorAction(play, 121)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_121)) { this->picto.actor.draw = EnGe1_Draw; - csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 121)]->action; - switch (csAction) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_121)]->id; + switch (cueId) { case 8: this->stateFlags &= ~GERUDO_WHITE_STATE_DISABLE_MOVEMENT; break; @@ -275,14 +275,15 @@ void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { default: this->stateFlags &= ~GERUDO_WHITE_STATE_DISABLE_MOVEMENT; - Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetActorActionIndex(play, 0x79)); + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, + Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_121)); break; } - if (this->csAction != csAction) { - this->csAction = csAction; + if (this->cueId != cueId) { + this->cueId = cueId; - switch (this->csAction) { + switch (this->cueId) { // Aveil cutscene case 1: EnGe1_ChangeAnim(this, GERUDO_WHITE_ANIM_ARMS_FOLDED, ANIMMODE_LOOP, 0.0f); @@ -340,7 +341,7 @@ void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play) { this->picto.actor.draw = NULL; } - switch (this->csAction) { + switch (this->cueId) { case 9: if ((this->curPointIndex < this->path->count) && EnGe1_FollowPath(this)) { this->curPointIndex++; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index 1cf716b0f..63a2a3c7f 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -34,7 +34,7 @@ typedef struct EnGe1 { /* 0x2BA */ s16 blinkTimer; /* 0x2BC */ u16 stateFlags; /* 0x2BE */ s16 animIndex; - /* 0x2C0 */ s16 csAction; + /* 0x2C0 */ s16 cueId; /* 0x2C2 */ s16 screamTimer; /* 0x2C4 */ u8 hairstyle; /* 0x2C8 */ EnGe1ActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 3753ccf5c..922472f9a 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -100,7 +100,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->picto.actor.targetMode = 6; this->stateFlags = 0; this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED; - this->csAction = -1; + this->cueId = -1; this->picto.actor.terminalVelocity = -9.0f; this->picto.actor.gravity = -1.0f; @@ -592,33 +592,34 @@ void EnGe2_Walk(EnGe2* this, PlayState* play) { void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(play, 476)) { - s16 csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 476)]->action; - if (this->csAction != csAction) { - this->csAction = csAction; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_476)) { + s16 cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_476)]->id; - switch (csAction) { - case ENGE2_CSACTION_BEEHIVE_PATROL: + if (this->cueId != cueId) { + this->cueId = cueId; + + switch (cueId) { + case ENGE2_CUEID_BEEHIVE_PATROL: Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f); EnGe2_GetNextPath(this, play); break; - case ENGE2_CSACTION_BEEHIVE_RUN_AWAY: + case ENGE2_CUEID_BEEHIVE_RUN_AWAY: Animation_Change(&this->skelAnime, &gGerudoPurpleRunningAwayCutsceneAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), 0, -5.0f); this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f); break; - case ENGE2_CSACTION_BEEHIVE_EXIT: + case ENGE2_CUEID_BEEHIVE_EXIT: Actor_Kill(&this->picto.actor); break; - case ENGE2_CSACTION_GBT_ENTR_STAND_STILL: + case ENGE2_CUEID_GBT_ENTR_STAND_STILL: Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f, 2, 0.0f); break; - case ENGE2_CSACTION_GBT_ENTR_BLOWN_AWAY: + case ENGE2_CUEID_GBT_ENTR_BLOWN_AWAY: Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f, 2, 0.0f); EnGe2_SetupBlownAwayPath(this, play); this->stateFlags |= GERUDO_PURPLE_STATE_DISABLE_MOVEMENT; @@ -631,8 +632,8 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) { } } - switch (this->csAction) { - case ENGE2_CSACTION_BEEHIVE_RUN_AWAY: + switch (this->cueId) { + case ENGE2_CUEID_BEEHIVE_RUN_AWAY: EnGe2_FollowPath(this); this->picto.actor.speed = 5.0f; @@ -648,7 +649,7 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) { } break; - case ENGE2_CSACTION_GBT_ENTR_BLOWN_AWAY: + case ENGE2_CUEID_GBT_ENTR_BLOWN_AWAY: if ((this->curPointIndex < this->path->count) && EnGe2_FollowPathWithoutGravity(this)) { this->curPointIndex++; } @@ -704,7 +705,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->picto.actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if (Cutscene_CheckActorAction(play, 476)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_476)) { this->actionFunc = EnGe2_PerformCutsceneActions; this->stateFlags &= ~GERUDO_PURPLE_STATE_KO; this->stateFlags &= ~GERUDO_PURPLE_STATE_PATH_REVERSE; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 739e94277..0a85e3bfe 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -27,11 +27,11 @@ typedef enum { //! TODO: work out where to put this typedef enum { - /* 1 */ ENGE2_CSACTION_BEEHIVE_PATROL = 1, - /* 2 */ ENGE2_CSACTION_BEEHIVE_RUN_AWAY, - /* 3 */ ENGE2_CSACTION_BEEHIVE_EXIT, - /* 4 */ ENGE2_CSACTION_GBT_ENTR_STAND_STILL, - /* 5 */ ENGE2_CSACTION_GBT_ENTR_BLOWN_AWAY + /* 1 */ ENGE2_CUEID_BEEHIVE_PATROL = 1, + /* 2 */ ENGE2_CUEID_BEEHIVE_RUN_AWAY, + /* 3 */ ENGE2_CUEID_BEEHIVE_EXIT, + /* 4 */ ENGE2_CUEID_GBT_ENTR_STAND_STILL, + /* 5 */ ENGE2_CUEID_GBT_ENTR_BLOWN_AWAY } EnGe2CsAction; typedef struct EnGe2 { @@ -51,7 +51,7 @@ typedef struct EnGe2 { /* 0x2FC */ f32 verticalDetectRange; //!< vertical range to look for the player within /* 0x300 */ u8 timer; /* 0x301 */ u8 detectedStatus; - /* 0x302 */ s16 csAction; + /* 0x302 */ s16 cueId; /* 0x304 */ s16 unk304; // unused /* 0x306 */ s16 screamTimer; /* 0x308 */ EnGe2ActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.c b/src/overlays/actors/ovl_En_Geg/z_en_geg.c index 44cf5215e..4b5e8e311 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.c +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.c @@ -304,10 +304,10 @@ u8 func_80BB1B14(EnGeg* this, PlayState* play) { void func_80BB1C1C(EnGeg* this) { u16 i; - this->unk_49C[0] = this->actor.cutscene; + this->csIdList[0] = this->actor.csId; - for (i = 1; i < ARRAY_COUNT(this->unk_49C); i++) { - this->unk_49C[i] = ActorCutscene_GetAdditionalCutscene(this->unk_49C[i - 1]); + for (i = 1; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = CutsceneManager_GetAdditionalCsId(this->csIdList[i - 1]); } } @@ -432,15 +432,15 @@ void func_80BB221C(EnGeg* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 4)) { if (sp27 == 1) { this->unk_496 = 0xD66; - this->unk_49A = this->unk_49C[3]; + this->nextCsId = this->csIdList[3]; } else if (sp27 == 2) { this->unk_496 = 0xD64; - this->unk_49A = this->unk_49C[2]; + this->nextCsId = this->csIdList[2]; this->unk_230 &= ~4; } else if (sp27 == 3) { this->unk_230 |= 0x200; this->unk_496 = 0xD64; - this->unk_49A = this->unk_49C[2]; + this->nextCsId = this->csIdList[2]; this->unk_230 &= ~4; } Message_StartTextbox(play, this->unk_496, &this->actor); @@ -466,7 +466,7 @@ void func_80BB221C(EnGeg* this, PlayState* play) { } else if (Actor_ProcessTalkRequest(&this->actor, &play->state) && (this->unk_230 & 8)) { SET_WEEKEVENTREG(WEEKEVENTREG_35_40); this->unk_496 = 0xD5E; - this->unk_49A = this->unk_49C[0]; + this->nextCsId = this->csIdList[0]; Message_StartTextbox(play, this->unk_496, &this->actor); this->actionFunc = func_80BB2520; this->unk_230 &= ~8; @@ -481,18 +481,18 @@ void func_80BB221C(EnGeg* this, PlayState* play) { void func_80BB2520(EnGeg* this, PlayState* play) { if (this->unk_230 & 0x10) { - ActorCutscene_Stop(this->unk_498); + CutsceneManager_Stop(this->csId); this->unk_230 &= ~0x10; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->unk_498 = this->unk_49A; - ActorCutscene_SetIntentToPlay(this->unk_498); + this->csId = this->nextCsId; + CutsceneManager_Queue(this->csId); return; } - if (ActorCutscene_GetCanPlayNext(this->unk_498)) { - ActorCutscene_StartAndSetFlag(this->unk_498, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->unk_230 |= 0x10; switch (this->unk_496) { @@ -517,7 +517,7 @@ void func_80BB2520(EnGeg* this, PlayState* play) { break; case 0xD67: - this->unk_498 = this->unk_49C[5]; + this->csId = this->csIdList[5]; this->actionFunc = func_80BB2B1C; break; @@ -534,11 +534,11 @@ void func_80BB2520(EnGeg* this, PlayState* play) { break; } } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->unk_498 = this->unk_49A; - ActorCutscene_SetIntentToPlay(this->unk_498); + this->csId = this->nextCsId; + CutsceneManager_Queue(this->csId); } } @@ -546,12 +546,12 @@ void func_80BB26EC(EnGeg* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (this->unk_496) { case 0xD5E: - this->unk_49A = this->unk_49C[1]; + this->nextCsId = this->csIdList[1]; this->actionFunc = func_80BB2520; break; case 0xD61: - ActorCutscene_Stop(this->unk_498); + CutsceneManager_Stop(this->csId); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->unk_230 &= ~0x10; @@ -574,7 +574,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { break; case 0xD69: - this->unk_49A = this->unk_49C[6]; + this->nextCsId = this->csIdList[6]; play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->actionFunc = func_80BB2520; @@ -594,7 +594,7 @@ void func_80BB27D4(EnGeg* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->unk_230 &= ~0x10; - this->unk_49A = this->unk_49C[7]; + this->nextCsId = this->csIdList[7]; this->actionFunc = func_80BB2520; break; @@ -620,7 +620,7 @@ void func_80BB2944(EnGeg* this, PlayState* play) { if (this->unk_496 == 0xD67) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - this->unk_49A = this->unk_49C[4]; + this->nextCsId = this->csIdList[4]; this->actionFunc = func_80BB2520; } else { this->unk_496 = func_80BB16D0(this); @@ -632,7 +632,7 @@ void func_80BB2944(EnGeg* this, PlayState* play) { void func_80BB2A54(EnGeg* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_496 == 0xD65) { - ActorCutscene_Stop(this->unk_498); + CutsceneManager_Stop(this->csId); this->unk_230 &= ~0x10; this->unk_244 = 65; play->msgCtx.msgMode = 0x43; @@ -654,14 +654,14 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) { this->actor.child->world.pos = this->unk_4B4; this->actor.child->shape.rot = this->actor.shape.rot; - if (ActorCutscene_GetCurrentIndex() != this->unk_49C[4]) { - if (ActorCutscene_GetCanPlayNext(this->unk_498)) { + if (CutsceneManager_GetCurrentCsId() != this->csIdList[4]) { + if (CutsceneManager_IsNext(this->csId)) { SET_WEEKEVENTREG(WEEKEVENTREG_37_08); if (this->actor.child != NULL) { Actor_Kill(this->actor.child); } this->unk_230 |= 0x10; - ActorCutscene_StartAndSetFlag(this->unk_498, &this->actor); + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->unk_496 = 0xD68; Message_ContinueTextbox(play, this->unk_496); this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU); @@ -671,10 +671,10 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) { } this->actionFunc = func_80BB27D4; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->unk_498); + CutsceneManager_Queue(this->csId); } } else { temp_f20 = this->unk_4E0 * 0.005f; @@ -711,7 +711,7 @@ void func_80BB2E00(EnGeg* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; if (sp2E == sp2C) { - ActorCutscene_Stop(this->unk_498); + CutsceneManager_Stop(this->csId); this->unk_4AC = 20; func_80BB2020(this, play); this->actionFunc = func_80BB30B4; @@ -837,7 +837,7 @@ void func_80BB3318(EnGeg* this, PlayState* play) { this->actor.shape.rot.y, this->actor.floorPoly, this->actor.floorBgId); } - if (ActorCutscene_GetCurrentIndex() != this->unk_49C[7]) { + if (CutsceneManager_GetCurrentCsId() != this->csIdList[7]) { func_800AEF44(Effect_GetByIndex(this->unk_4DC)); Actor_Kill(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Geg/z_en_geg.h b/src/overlays/actors/ovl_En_Geg/z_en_geg.h index ea29fd6cf..71639bdac 100644 --- a/src/overlays/actors/ovl_En_Geg/z_en_geg.h +++ b/src/overlays/actors/ovl_En_Geg/z_en_geg.h @@ -33,9 +33,9 @@ typedef struct EnGeg { /* 0x484 */ Vec3f unk_484; /* 0x490 */ Vec3s unk_490; /* 0x496 */ u16 unk_496; - /* 0x498 */ s16 unk_498; - /* 0x49A */ s16 unk_49A; - /* 0x49C */ s16 unk_49C[8]; + /* 0x498 */ s16 csId; + /* 0x49A */ s16 nextCsId; + /* 0x49C */ s16 csIdList[8]; /* 0x4AC */ s32 unk_4AC; /* 0x4B0 */ s16 unk_4B0; /* 0x4B4 */ Vec3f unk_4B4; diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index b27d60302..ed10fd51a 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -265,15 +265,15 @@ void func_80B3556C(EnGg* this, PlayState* play) { void func_80B35634(EnGg* this, PlayState* play) { s32 pad; - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 119)) { - actionIndex = Cutscene_GetActorActionIndex(play, 119); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_119)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_119); - if (this->unk_2DB != play->csCtx.actorActions[actionIndex]->action) { - this->unk_2DB = play->csCtx.actorActions[actionIndex]->action; + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; - switch (play->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->unk_2DA = 0; this->unk_2E6 = 0; @@ -334,10 +334,10 @@ void func_80B35634(EnGg* this, PlayState* play) { func_80B358D8(this, play); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); this->actor.shape.yOffset = 0.0f; } else { - this->unk_2DB = 99; + this->cueId = 99; } } @@ -407,16 +407,16 @@ void func_80B359DC(EnGg* this, PlayState* play) { this->unk_307 = true; } - if (ActorCutscene_GetCanPlayNext(this->unk_2DC)) { - ActorCutscene_Start(this->unk_2DC, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->actor); this->unk_307 = false; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } if (this->unk_307) { - ActorCutscene_SetIntentToPlay(this->unk_2DC); + CutsceneManager_Queue(this->csId); } } } else { @@ -666,7 +666,7 @@ void EnGg_Init(Actor* thisx, PlayState* play) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10); this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; this->unk_310 = this->actor.home.pos.y; - this->unk_2DC = this->actor.cutscene; + this->csId = this->actor.csId; this->actor.flags |= ACTOR_FLAG_2000000; this->unk_308 = 0; this->unk_309 = 0; diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.h b/src/overlays/actors/ovl_En_Gg/z_en_gg.h index cb9f9e7cb..cc744cffa 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.h +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.h @@ -34,8 +34,8 @@ typedef struct EnGg { /* 0x25C */ Vec3s morphTable[20]; /* 0x2D4 */ UNK_TYPE1 unk_2D4[0x6]; /* 0x2DA */ u8 unk_2DA; - /* 0x2DB */ u8 unk_2DB; - /* 0x2DC */ s16 unk_2DC; + /* 0x2DB */ u8 cueId; + /* 0x2DC */ s16 csId; /* 0x2DE */ UNK_TYPE1 unk2DE[4]; /* 0x2E2 */ s16 unk_2E2; /* 0x2E4 */ s16 unk_2E4; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index 2ae04a6ec..fdd099fff 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -204,7 +204,7 @@ void func_80B3B120(EnGg2* this, PlayState* play) { void func_80B3B21C(EnGg2* this, PlayState* play) { this->actor.speed = 0.0f; if ((this->actor.xzDistToPlayer < 100.0f) && CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { - this->unk_2E4 = ActorCutscene_GetAdditionalCutscene(this->unk_2E4); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); this->actionFunc = func_80B3B5D4; } } @@ -274,14 +274,14 @@ void func_80B3B4B0(EnGg2* this, PlayState* play) { } void func_80B3B5D4(EnGg2* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_2E4)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2E4, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->actionFunc = func_80B3AE60; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->unk_2E4); + CutsceneManager_Queue(this->csId); } } @@ -376,7 +376,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { this->unk_2F2 = 0; this->unk_2F4 = 0; this->unk_2F6 = 0; - this->unk_2E4 = this->actor.cutscene; + this->csId = this->actor.csId; this->unk_2EC = 20; this->unk_2EA = 0; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h index f91310775..ff7aec4a6 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h @@ -21,7 +21,7 @@ typedef struct EnGg2 { /* 0x1EC */ Vec3s jointTable[20]; /* 0x264 */ Vec3s morphTable[20]; /* 0x2DC */ UNK_TYPE1 unk2DC[0x8]; - /* 0x2E4 */ s16 unk_2E4; + /* 0x2E4 */ s16 csId; /* 0x2E6 */ UNK_TYPE1 unk2E6[4]; /* 0x2EA */ s16 unk_2EA; /* 0x2EC */ s16 unk_2EC; diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index d62f9e6df..07c01b288 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -51,26 +51,26 @@ typedef enum { } GiantAnimation; /** - * Used as values for csAction. The UNKNOWN ones are never used in-game. + * Used as values for cueId. The UNKNOWN ones are never used in-game. */ typedef enum { - /* 0 */ GIANT_CS_ACTION_NONE, - /* 1 */ GIANT_CS_ACTION_IDLE, - /* 2 */ GIANT_CS_ACTION_WALKING, - /* 3 */ GIANT_CS_ACTION_LOOKING_UP, - /* 4 */ GIANT_CS_ACTION_RAISING_ARMS, - /* 5 */ GIANT_CS_ACTION_STRUGGLING, - /* 6 */ GIANT_CS_ACTION_FALLING_OVER, - /* 7 */ GIANT_CS_ACTION_IDLE_FADE_IN, - /* 8 */ GIANT_CS_ACTION_TALKING, - /* 9 */ GIANT_CS_ACTION_DONE_TALKING, - /* 10 */ GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER, - /* 11 */ GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER, - /* 12 */ GIANT_CS_ACTION_UNKNOWN_12, - /* 13 */ GIANT_CS_ACTION_UNKNOWN_13, - /* 14 */ GIANT_CS_ACTION_UNKNOWN_14, - /* 15 */ GIANT_CS_ACTION_HOLDING_UP_MOON_IN_CLOCK_TOWER -} GiantCsActionIndex; + /* 0 */ GIANT_CUE_ID_NONE, + /* 1 */ GIANT_CUE_ID_IDLE, + /* 2 */ GIANT_CUE_ID_WALKING, + /* 3 */ GIANT_CUE_ID_LOOKING_UP, + /* 4 */ GIANT_CUE_ID_RAISING_ARMS, + /* 5 */ GIANT_CUE_ID_STRUGGLING, + /* 6 */ GIANT_CUE_ID_FALLING_OVER, + /* 7 */ GIANT_CUE_ID_IDLE_FADE_IN, + /* 8 */ GIANT_CUE_ID_TALKING, + /* 9 */ GIANT_CUE_ID_DONE_TALKING, + /* 10 */ GIANT_CUE_ID_TEACHING_OATH_TO_ORDER, + /* 11 */ GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER, + /* 12 */ GIANT_CUE_ID_UNKNOWN_12, + /* 13 */ GIANT_CUE_ID_UNKNOWN_13, + /* 14 */ GIANT_CUE_ID_UNKNOWN_14, + /* 15 */ GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER +} GiantCueId; ActorInit En_Giant_InitVars = { ACTOR_EN_GIANT, @@ -154,31 +154,35 @@ void EnGiant_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGiantSkel, &gGiantLargeStrideAnim, this->jointTable, this->morphTable, GIANT_LIMB_MAX); EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); - this->csAction = GIANT_CS_ACTION_NONE; + this->cueId = GIANT_CUE_ID_NONE; this->actionFunc = EnGiant_PerformCutsceneActions; this->actor.draw = NULL; this->alpha = 0; this->actor.velocity.y = -10.0f; this->actor.terminalVelocity = -10.0f; this->actor.gravity = -5.0f; + switch (type) { case GIANT_TYPE_CANYON_TERMINA_FIELD: case GIANT_TYPE_CANYON_CLOCK_TOWER_SUCCESS: case GIANT_TYPE_CANYON_GIANTS_CHAMBER_AND_ENDING: - this->actorActionCommand = 454; + this->cueType = CS_CMD_ACTOR_CUE_454; break; + case GIANT_TYPE_SWAMP_TERMINA_FIELD: case GIANT_TYPE_SWAMP_CLOCK_TOWER_SUCCESS: case GIANT_TYPE_SWAMP_GIANTS_CHAMBER_AND_ENDING: - this->actorActionCommand = 455; + this->cueType = CS_CMD_ACTOR_CUE_455; break; + case GIANT_TYPE_OCEAN_TERMINA_FIELD: case GIANT_TYPE_OCEAN_CLOCK_TOWER_SUCCESS: case GIANT_TYPE_OCEAN_GIANTS_CHAMBER_AND_ENDING: - this->actorActionCommand = 456; + this->cueType = CS_CMD_ACTOR_CUE_456; break; + default: - this->actorActionCommand = 453; + this->cueType = CS_CMD_ACTOR_CUE_453; break; } @@ -188,7 +192,7 @@ void EnGiant_Init(Actor* thisx, PlayState* play) { return; } - this->actorActionCommand = 0x1C5; + this->cueType = CS_CMD_ACTOR_CUE_453; Actor_SetScale(&this->actor, 0.32f); this->actionFunc = EnGiant_PerformClockTowerSuccessActions; Animation_Change(&this->skelAnime, &gGiantRaisedArmsStartAnim, 0.0f, @@ -259,65 +263,80 @@ void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimIndex) } /** - * Immediately switches to the specified animation for this cutscene action. + * Immediately switches to the specified animation for this cueId. */ -void EnGiant_ChangeAnimBasedOnCsAction(EnGiant* this) { - switch (this->csAction) { - case GIANT_CS_ACTION_IDLE: +void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) { + switch (this->cueId) { + case GIANT_CUE_ID_IDLE: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; - case GIANT_CS_ACTION_WALKING: + + case GIANT_CUE_ID_WALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); break; - case GIANT_CS_ACTION_STRUGGLING: + + case GIANT_CUE_ID_STRUGGLING: EnGiant_ChangeAnim(this, GIANT_ANIM_STRUGGLE_START); break; - case GIANT_CS_ACTION_FALLING_OVER: + + case GIANT_CUE_ID_FALLING_OVER: EnGiant_ChangeAnim(this, GIANT_ANIM_FALLING_OVER); break; - case GIANT_CS_ACTION_IDLE_FADE_IN: + + case GIANT_CUE_ID_IDLE_FADE_IN: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); this->alpha = 0; break; - case GIANT_CS_ACTION_TALKING: + + case GIANT_CUE_ID_TALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_START); break; - case GIANT_CS_ACTION_DONE_TALKING: + + case GIANT_CUE_ID_DONE_TALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_END); break; - case GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER: + + case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_START); break; - case GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER: + + case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_END); break; - case GIANT_CS_ACTION_UNKNOWN_12: + + case GIANT_CUE_ID_UNKNOWN_12: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; - case GIANT_CS_ACTION_UNKNOWN_13: + + case GIANT_CUE_ID_UNKNOWN_13: EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); break; - case GIANT_CS_ACTION_UNKNOWN_14: + + case GIANT_CUE_ID_UNKNOWN_14: if (this->animIndex != GIANT_ANIM_WALKING_LOOP) { EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP); } break; - case GIANT_CS_ACTION_HOLDING_UP_MOON_IN_CLOCK_TOWER: + + case GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER: Animation_Change(&this->skelAnime, &gGiantRaisedArmsStartAnim, 0.0f, Animation_GetLastFrame(&gGiantRaisedArmsStartAnim) - 1.0f, Animation_GetLastFrame(&gGiantRaisedArmsStartAnim), ANIMMODE_ONCE, 0.0f); break; + + default: + break; } } void EnGiant_UpdateAlpha(EnGiant* this) { - switch (this->csAction) { - case GIANT_CS_ACTION_FALLING_OVER: + switch (this->cueId) { + case GIANT_CUE_ID_FALLING_OVER: if (this->skelAnime.curFrame >= 90.0f && this->alpha > 0) { this->alpha -= 12; } break; - case GIANT_CS_ACTION_UNKNOWN_14: + case GIANT_CUE_ID_UNKNOWN_14: this->alpha -= 12; break; default: @@ -336,30 +355,30 @@ void EnGiant_UpdateAlpha(EnGiant* this) { */ void EnGiant_PlayAndUpdateAnimation(EnGiant* this) { if (SkelAnime_Update(&this->skelAnime) && - (this->animIndex != GIANT_ANIM_FALLING_OVER || this->csAction != GIANT_CS_ACTION_FALLING_OVER)) { + (this->animIndex != GIANT_ANIM_FALLING_OVER || this->cueId != GIANT_CUE_ID_FALLING_OVER)) { EnGiant_ChangeAnim(this, this->animIndex); - switch (this->csAction) { - case GIANT_CS_ACTION_LOOKING_UP: + switch (this->cueId) { + case GIANT_CUE_ID_LOOKING_UP: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_LOOK_UP_START); break; - case GIANT_CS_ACTION_RAISING_ARMS: + case GIANT_CUE_ID_RAISING_ARMS: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_RAISED_ARMS_START); break; - case GIANT_CS_ACTION_STRUGGLING: + case GIANT_CUE_ID_STRUGGLING: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_STRUGGLE_START); break; - case GIANT_CS_ACTION_FALLING_OVER: + case GIANT_CUE_ID_FALLING_OVER: // Unused EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_FALLING_OVER); break; - case GIANT_CS_ACTION_TALKING: + case GIANT_CUE_ID_TALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_LOOP); break; - case GIANT_CS_ACTION_DONE_TALKING: - case GIANT_CS_ACTION_PLAYER_LEARNED_OATH_TO_ORDER: + case GIANT_CUE_ID_DONE_TALKING: + case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; - case GIANT_CS_ACTION_TEACHING_OATH_TO_ORDER: + case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_LOOP); break; } @@ -388,30 +407,28 @@ void EnGiant_PlaySound(EnGiant* this) { } } -void EnGiant_UpdatePosition(EnGiant* this, PlayState* play, u32 actionIndex) { - CsCmdActorAction* actorAction = play->csCtx.actorActions[actionIndex]; - f32 startPosY = actorAction->startPos.y; +void EnGiant_UpdatePosition(EnGiant* this, PlayState* play, u32 cueChannel) { + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + f32 startPosY = cue->startPos.y; s32 pad[2]; - f32 endPosY = actorAction->endPos.y; - f32 scale = Environment_LerpWeight(actorAction->endFrame, actorAction->startFrame, play->csCtx.frames); + f32 endPosY = cue->endPos.y; + f32 scale = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); this->actor.world.pos.y = ((endPosY - startPosY) * scale) + startPosY; } void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, this->actorActionCommand)) { - EnGiant_UpdatePosition(this, play, Cutscene_GetActorActionIndex(play, this->actorActionCommand)); - if (this->csAction != - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action) { - this->csAction = - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action; - EnGiant_ChangeAnimBasedOnCsAction(this); + if (Cutscene_IsCueInChannel(play, this->cueType)) { + EnGiant_UpdatePosition(this, play, Cutscene_GetCueChannel(play, this->cueType)); + if (this->cueId != play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id) { + this->cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + EnGiant_ChangeAnimBasedOnCueId(this); } EnGiant_UpdateAlpha(this); } EnGiant_PlaySound(this); - if (this->csAction == GIANT_CS_ACTION_STRUGGLING) { + if (this->cueId == GIANT_CUE_ID_STRUGGLING) { func_800B9010(&this->actor, NA_SE_IT_KYOJIN_BEARING - SFX_FLAG); } EnGiant_PlayAndUpdateAnimation(this); @@ -424,13 +441,11 @@ void EnGiant_PlayClockTowerFailureAnimation(EnGiant* this, PlayState* play) { void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play) { this->actor.draw = EnGiant_Draw; - if (Cutscene_CheckActorAction(play, this->actorActionCommand)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCommand)); - if (this->csAction != - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action) { - this->csAction = - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCommand)]->action; - EnGiant_ChangeAnimBasedOnCsAction(this); + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + if (this->cueId != play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id) { + this->cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + EnGiant_ChangeAnimBasedOnCueId(this); } EnGiant_UpdateAlpha(this); } diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.h b/src/overlays/actors/ovl_En_Giant/z_en_giant.h index 9ce182a98..45e89dd55 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.h +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.h @@ -48,8 +48,8 @@ typedef struct EnGiant { /* 0x188 */ Vec3s jointTable[GIANT_LIMB_MAX]; /* 0x1E8 */ Vec3s morphTable[GIANT_LIMB_MAX]; /* 0x248 */ s16 animIndex; - /* 0x24A */ u16 actorActionCommand; - /* 0x24C */ u16 csAction; + /* 0x24A */ u16 cueType; + /* 0x24C */ u16 cueId; /* 0x24E */ s16 alpha; /* 0x250 */ u16 sfxId; /* 0x254 */ MtxF headDrawMtxF; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 45dd9f749..38e6ad976 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -511,19 +511,19 @@ void func_80B51410(EnGk* this, PlayState* play) { this->unk_1E4 |= 0x20; } - if (ActorCutscene_GetCanPlayNext(this->unk_318)) { + if (CutsceneManager_IsNext(this->csId)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLONKID_SOB_TALK); - ActorCutscene_Start(this->unk_318, &this->actor); + CutsceneManager_Start(this->csId, &this->actor); this->unk_1E4 &= ~0x20; return; } - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } if (this->unk_1E4 & 0x20) { - ActorCutscene_SetIntentToPlay(this->unk_318); + CutsceneManager_Queue(this->csId); } } else { this->unk_1E4 &= ~0x20; @@ -532,16 +532,16 @@ void func_80B51410(EnGk* this, PlayState* play) { void func_80B51510(EnGk* this, PlayState* play) { s32 pad; - s32 actionIndex; + s32 cueChannel; if (this) {} - if (Cutscene_CheckActorAction(play, 479)) { - actionIndex = Cutscene_GetActorActionIndex(play, 479); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_479)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_479); - if (play->csCtx.actorActions[actionIndex]->action != this->unk_31B) { - this->unk_31B = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->unk_31A = 0; this->unk_2E4 = 0; @@ -585,10 +585,10 @@ void func_80B51510(EnGk* this, PlayState* play) { func_80B51308(this, play); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); this->actor.shape.yOffset = 0.0f; } else { - this->unk_31B = 0x63; + this->cueId = 99; } } @@ -662,9 +662,9 @@ void func_80B51970(EnGk* this, PlayState* play) { if (((talkState == TEXT_STATE_DONE) || (talkState == TEXT_STATE_5)) && Message_ShouldAdvance(play)) { if ((this->unk_31C == 0xE84) || (this->unk_31C == 0xE99)) { - ActorCutscene_Stop(this->unk_318); - this->unk_318 = ActorCutscene_GetAdditionalCutscene(this->unk_318); - ActorCutscene_SetIntentToPlay(this->unk_318); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + CutsceneManager_Queue(this->csId); this->actionFunc = func_80B51D9C; return; } @@ -773,8 +773,8 @@ void func_80B51B40(EnGk* this, PlayState* play) { void func_80B51D9C(EnGk* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (ActorCutscene_GetCanPlayNext(this->unk_318)) { - ActorCutscene_StartAndSetFlag(this->unk_318, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); if (this->unk_1E4 & 4) { this->unk_1E4 &= ~4; this->unk_2E4 = 6; @@ -791,10 +791,10 @@ void func_80B51D9C(EnGk* this, PlayState* play) { this->actionFunc = func_80B51970; } } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->unk_318); + CutsceneManager_Queue(this->csId); } func_80B50954(this); } @@ -810,7 +810,7 @@ void func_80B51EA4(EnGk* this, PlayState* play) { sp36 = this->actor.shape.rot.y - sp38.y; if (func_80B50C78(this, this->path, this->unk_1EC)) { if (this->unk_1EC >= (this->path->count - 1)) { - ActorCutscene_Stop(this->unk_318); + CutsceneManager_Stop(this->csId); Actor_Kill(&this->actor); } else { this->unk_1EC++; @@ -985,7 +985,7 @@ void func_80B525E0(EnGk* this, PlayState* play) { void func_80B52654(EnGk* this, PlayState* play) { this->unk_350 += 0x400; - if ((this->unk_1E4 & 0x80) && (play->csCtx.frames == 250)) { + if ((this->unk_1E4 & 0x80) && (play->csCtx.curFrame == 250)) { SET_WEEKEVENTREG(WEEKEVENTREG_22_04); } @@ -1023,12 +1023,12 @@ void EnGk_Init(Actor* thisx, PlayState* play) { if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { Actor_Kill(&this->actor); } else { - this->unk_318 = this->actor.cutscene; + this->csId = this->actor.csId; this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 0xF); this->actionFunc = func_80B51760; } } else if (play->sceneId == SCENE_GORONRACE) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { this->actionFunc = func_80B51760; } else if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 2)) { @@ -1053,7 +1053,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { } } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04)) { this->unk_2E4 = 0; - this->unk_318 = this->actor.cutscene; + this->csId = this->actor.csId; this->actor.flags |= ACTOR_FLAG_10; this->actor.flags |= ACTOR_FLAG_2000000; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.h b/src/overlays/actors/ovl_En_Gk/z_en_gk.h index bebe6c6c9..0f74c1d65 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.h +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.h @@ -39,9 +39,9 @@ typedef struct EnGk { /* 0x2F4 */ Vec3f unk_2F4; /* 0x300 */ Vec3f unk_300; /* 0x30C */ Vec3f unk_30C; - /* 0x318 */ s16 unk_318; + /* 0x318 */ s16 csId; /* 0x31A */ u8 unk_31A; - /* 0x31B */ u8 unk_31B; + /* 0x31B */ u8 cueId; /* 0x31C */ u16 unk_31C; /* 0x31E */ s16 unk_31E; /* 0x320 */ s16 unk_320; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 86dcead70..b76ed7066 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -425,48 +425,48 @@ void func_8094E2D0(EnGm* this) { } } -s32 func_8094E454(EnGm* this, s16 arg1) { +s32 func_8094E454(EnGm* this, s16 csId) { s32 ret = false; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(arg1); - } else if (ActorCutscene_GetCanPlayNext(arg1)) { - ActorCutscene_StartAndSetUnkLinkFields(arg1, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(csId); + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); ret = true; } else { - ActorCutscene_SetIntentToPlay(arg1); + CutsceneManager_Queue(csId); } return ret; } -s16 func_8094E4D0(EnGm* this, s32 arg1) { +s16 func_8094E4D0(EnGm* this, s32 numCutscenes) { s32 i; - s16 cutscene = this->actor.cutscene; + s16 csId = this->actor.csId; - for (i = 0; i < arg1; i++) { - cutscene = ActorCutscene_GetAdditionalCutscene(cutscene); + for (i = 0; i < numCutscenes; i++) { + csId = CutsceneManager_GetAdditionalCsId(csId); } - return cutscene; + return csId; } s32 func_8094E52C(EnGm* this, PlayState* play) { s32 pad; - s16 sp2A = func_8094E4D0(this, 0); + s16 csId = func_8094E4D0(this, 0); s32 ret = false; switch (this->unk_3E0) { case 0: - if (!func_8094E454(this, sp2A)) { + if (!func_8094E454(this, csId)) { break; } case 2: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_40) && (this->unk_3E0 == 2)) { - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); } else { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), &this->actor); } this->unk_3E0++; ret = true; @@ -474,14 +474,15 @@ s32 func_8094E52C(EnGm* this, PlayState* play) { case 1: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), + this->actor.child); } this->unk_3E0++; ret = true; break; case 3: - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); this->unk_3E0++; ret = true; break; @@ -492,7 +493,7 @@ s32 func_8094E52C(EnGm* this, PlayState* play) { s32 func_8094E69C(EnGm* this, PlayState* play) { Camera* subCam; - s16 sp4A = func_8094E4D0(this, 0); + s16 csId = func_8094E4D0(this, 0); s16 sp48; Vec3f sp3C; Vec3f sp30; @@ -530,10 +531,10 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { break; case 2: - if (func_8094E454(this, sp4A)) { + if (func_8094E454(this, csId)) { case 4: case 6: - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp4A)); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)); Camera_SetTargetActor(subCam, &this->actor); this->unk_3E0++; ret = true; @@ -544,7 +545,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { case 5: case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp4A)); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)); Camera_SetTargetActor(subCam, this->actor.child); } this->unk_3E0++; @@ -553,7 +554,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) { case 8: Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); - ActorCutscene_Stop(sp4A); + CutsceneManager_Stop(csId); this->unk_3E2 = 0; this->unk_3E0++; break; @@ -766,7 +767,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { func_8094E054(this, play, 0); this->unk_258 = 255; } - this->unk_259 = 255; + this->cueId = 255; this->unk_3F8 = 1; } ret = true; @@ -1634,20 +1635,20 @@ void func_80950F2C(EnGm* this, PlayState* play) { s32 pad; Vec3f sp3C; Vec3f sp30; - s32 sp2C; + s32 cueId; s16 yaw; - if (Cutscene_CheckActorAction(play, 526)) { - sp2C = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 526)]->action; - if (this->unk_259 != (sp2C & 0xFF)) { - if (sp2C == 3) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_526)) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_526)]->id; + if (this->cueId != (u8)cueId) { + if (cueId == 3) { Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL); } - this->unk_259 = sp2C; - func_8094E054(this, play, sp50[sp2C]); + this->cueId = cueId; + func_8094E054(this, play, sp50[cueId]); } - if ((this->unk_259 == 3) && (this->unk_268 != NULL) && (this->unk_268->update != NULL)) { + if ((this->cueId == 3) && (this->unk_268 != NULL) && (this->unk_268->update != NULL)) { Math_Vec3f_Copy(&sp3C, &player->actor.world.pos); Math_Vec3f_Copy(&sp30, &this->actor.world.pos); yaw = Math_Vec3f_Yaw(&sp30, &sp3C); @@ -1763,7 +1764,7 @@ void EnGm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f sp30; s32 pad2; - if ((ActorCutscene_GetCurrentIndex() == -1) && (limbIndex == 16)) { + if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == 16)) { Matrix_MultVec3f(&D_80951E24, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 3bed5335a..6eede0744 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -26,7 +26,7 @@ typedef struct EnGm { /* 0x250 */ s32 timePathWaypoint; /* 0x254 */ s32 timePathElapsedTime; /* 0x258 */ u8 unk_258; - /* 0x259 */ u8 unk_259; + /* 0x259 */ u8 cueId; /* 0x25C */ s32 unk_25C; /* 0x260 */ s8 unk_260; /* 0x261 */ s8 unk_261; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 02ee6d342..12a98228f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -539,7 +539,7 @@ s32 func_80A1222C(EnGo* this, PlayState* play) { (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) && (this->unk_3EC == 0) && (this->actor.xzDistToPlayer < 400.0f)) || (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_04) && (play->sceneId == SCENE_16GORON_HOUSE) && - (gSaveContext.sceneLayer == 0) && (this->unk_3EC == 0) && (play->csCtx.currentCsIndex == 1))) { + (gSaveContext.sceneLayer == 0) && (this->unk_3EC == 0) && (play->csCtx.scriptIndex == 1))) { ret = true; } return ret; @@ -712,10 +712,10 @@ s32 func_80A12868(EnGo* this, PlayState* play) { s32 func_80A12954(EnGo* this, PlayState* play) { if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (play->csCtx.state != 0) && (this->actor.draw != NULL) && (play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneLayer == 1) && - (play->csCtx.currentCsIndex == 0)) { + (play->csCtx.scriptIndex == 0)) { if (this->unk_3F0 == 0) { this->actor.flags &= ~ACTOR_FLAG_1; - this->unk_394 = 255; + this->cueId = 255; this->unk_3F0 = 1; this->unk_18C = this->actionFunc; } @@ -723,7 +723,7 @@ s32 func_80A12954(EnGo* this, PlayState* play) { this->actionFunc = func_80A14FC8; } else if (this->unk_3F0 != 0) { this->actor.flags |= ACTOR_FLAG_1; - this->unk_394 = 255; + this->cueId = 255; this->unk_3F0 = 0; SubS_UpdateFlags(&this->unk_390, 3, 7); this->actionFunc = this->unk_18C; @@ -995,14 +995,14 @@ void func_80A134B0(EnGo* this, PlayState* play, s32 arg2) { } } -s32 func_80A134F4(EnGo* this, s16 arg1) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - } else if (ActorCutscene_GetCanPlayNext(arg1)) { - ActorCutscene_StartAndSetUnkLinkFields(arg1, &this->actor); +s32 func_80A134F4(EnGo* this, s16 csId) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); return true; } - ActorCutscene_SetIntentToPlay(arg1); + CutsceneManager_Queue(csId); return false; } @@ -1112,8 +1112,8 @@ s32 func_80A13B1C(EnGo* this, PlayState* play) { switch (this->unk_3C0) { case 0: - this->unk_3B8 = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - if (func_80A134F4(this, this->unk_3B8)) { + this->csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); + if (func_80A134F4(this, this->csId)) { this->unk_3C4 = 1; this->unk_3C0 = 1; } else { @@ -1121,26 +1121,26 @@ s32 func_80A13B1C(EnGo* this, PlayState* play) { } case 1: - if (ActorCutscene_GetCurrentIndex() != this->unk_3B8) { - this->unk_3B8 = ActorCutscene_GetAdditionalCutscene(this->unk_3B8); + if (CutsceneManager_GetCurrentCsId() != this->csId) { + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); this->unk_3C0 = 2; } else { break; } case 2: - if (func_80A134F4(this, this->unk_3B8)) { + if (func_80A134F4(this, this->csId)) { this->unk_3C0 = 3; } else { break; } case 3: - if (ActorCutscene_GetCanPlayNext(0x7C)) { - ActorCutscene_StartAndSetUnkLinkFields(0x7C, NULL); + if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { + CutsceneManager_StartWithPlayerCs(CS_ID_GLOBAL_TALK, NULL); this->unk_3C0 = 4; - } else if (ActorCutscene_GetCurrentIndex() == this->unk_3B8) { - ActorCutscene_SetIntentToPlay(0x7C); + } else if (CutsceneManager_GetCurrentCsId() == this->csId) { + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); } } @@ -1230,8 +1230,8 @@ s32 func_80A13E80(EnGo* this, PlayState* play) { switch (this->unk_3C0) { case 0: - this->unk_3B8 = this->actor.cutscene; - if (func_80A134F4(this, this->unk_3B8)) { + this->csId = this->actor.csId; + if (func_80A134F4(this, this->csId)) { this->unk_3C0++; } break; @@ -1258,7 +1258,7 @@ s32 func_80A13E80(EnGo* this, PlayState* play) { case 3: if (this->unk_3C2 >= 60) { - ActorCutscene_Stop(this->unk_3B8); + CutsceneManager_Stop(this->csId); this->unk_3C2 = 0; this->unk_3C0 = 0; ret = true; @@ -1376,7 +1376,7 @@ void func_80A143A8(EnGo* this, PlayState* play) { void func_80A14430(EnGo* this, PlayState* play) { if (((gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 0)) || (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 2))) && - (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80))) { + (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE))) { func_80A14018(this, play); this->actionFunc = func_80A149B0; } else { @@ -1413,7 +1413,7 @@ void func_80A144F4(EnGo* this, PlayState* play) { void func_80A145AC(EnGo* this, PlayState* play) { if ((ENGO_GET_70(&this->actor) == ENGO_70_1) && (((play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneLayer == 1) && - (play->csCtx.currentCsIndex == 0)) || + (play->csCtx.scriptIndex == 0)) || !CHECK_WEEKEVENTREG(WEEKEVENTREG_21_08))) { this->actor.child = func_80A13400(this, play); this->actor.child->child = &this->actor; @@ -1611,7 +1611,7 @@ void func_80A14E14(EnGo* this, PlayState* play) { } void func_80A14E74(EnGo* this, PlayState* play) { - if (func_80A134F4(this, this->actor.cutscene)) { + if (func_80A134F4(this, this->actor.csId)) { this->actionFunc = func_80A14EB0; } } @@ -1625,7 +1625,7 @@ void func_80A14EB0(EnGo* this, PlayState* play) { this->unk_3A0 = (this->unk_39C / 0.9f) * 100.0f; func_80A139E4(this); } else { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); func_80A143A8(this, play); if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (ENGO_GET_70(&this->actor) == ENGO_70_1)) { SubS_UpdateFlags(&this->unk_390, 4, 7); @@ -1640,35 +1640,35 @@ void func_80A14FC8(EnGo* this, PlayState* play) { s32 sp38[] = { 0, 2, 6, 20, 18, 5, 5, 15, }; - u16 actorActionCmd = 0; - s32 sp30; - s32 actionIndex; + u16 cueType = 0; + s32 cueId; + s32 cueChannel; switch (ENGO_GET_70(&this->actor)) { case ENGO_70_0: - actorActionCmd = 128; + cueType = CS_CMD_ACTOR_CUE_128; break; case ENGO_70_1: - actorActionCmd = 129; + cueType = CS_CMD_ACTOR_CUE_129; break; } - if ((actorActionCmd == 128) || (actorActionCmd == 129)) { - if (Cutscene_CheckActorAction(play, actorActionCmd)) { - actionIndex = Cutscene_GetActorActionIndex(play, actorActionCmd); - sp30 = play->csCtx.actorActions[actionIndex]->action; + if ((cueType == CS_CMD_ACTOR_CUE_128) || (cueType == CS_CMD_ACTOR_CUE_129)) { + if (Cutscene_IsCueInChannel(play, cueType)) { + cueChannel = Cutscene_GetCueChannel(play, cueType); + cueId = play->csCtx.actorCues[cueChannel]->id; - if (this->unk_394 != (u8)sp30) { - this->unk_394 = sp30; - func_80A12C48(this, play, sp38[sp30]); + if (this->cueId != (u8)cueId) { + this->cueId = cueId; + func_80A12C48(this, play, sp38[cueId]); this->unk_390 = 0; this->unk_390 |= 0x20; this->unk_3BE = 0; this->unk_39C = 0.0f; this->unk_3A0 = 0.0f; - switch (sp30) { + switch (cueId) { case 1: this->unk_390 |= 0x80; this->skelAnime.curFrame = this->skelAnime.endFrame; @@ -1681,7 +1681,7 @@ void func_80A14FC8(EnGo* this, PlayState* play) { } } - switch (this->unk_394) { + switch (this->cueId) { case 3: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) && (this->unk_3DC == 20)) { func_80A12C48(this, play, 21); @@ -1706,8 +1706,8 @@ void func_80A14FC8(EnGo* this, PlayState* play) { break; } - if (actorActionCmd == 128) { - switch (play->csCtx.frames) { + if (cueType == 128) { + switch (play->csCtx.curFrame) { case 55: case 100: case 130: @@ -1730,8 +1730,8 @@ void func_80A14FC8(EnGo* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_VOICE_EATFULL); break; } - } else if (actorActionCmd == 129) { - switch (play->csCtx.frames) { + } else if (cueType == 129) { + switch (play->csCtx.curFrame) { case 360: case 390: Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_COLD); @@ -1752,7 +1752,7 @@ void func_80A14FC8(EnGo* this, PlayState* play) { } SubS_FillLimbRotTables(play, this->unk_3CE, this->unk_3C8, ARRAY_COUNT(this->unk_3CE)); - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } } } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index fd4876430..9d12dfdce 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -67,7 +67,7 @@ typedef struct EnGo { /* 0x38C */ Actor* unk_38C; /* 0x390 */ u16 unk_390; /* 0x392 */ u16 unk_392; - /* 0x394 */ u8 unk_394; + /* 0x394 */ u8 cueId; /* 0x398 */ f32 unk_398; /* 0x39C */ f32 unk_39C; /* 0x3A0 */ f32 unk_3A0; @@ -79,7 +79,7 @@ typedef struct EnGo { /* 0x3B2 */ s16 unk_3B2; /* 0x3B4 */ s16 unk_3B4; /* 0x3B6 */ s16 unk_3B6; - /* 0x3B8 */ s16 unk_3B8; + /* 0x3B8 */ s16 csId; /* 0x3BA */ s16 unk_3BA; /* 0x3BC */ s16 unk_3BC; /* 0x3BE */ s16 unk_3BE; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 003ac43e0..2f4257347 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -156,7 +156,7 @@ void EnGs_Init(Actor* thisx, PlayState* play) { this->unk_1F4 = this->unk_1FA; Math_Vec3f_Copy(&this->unk_1B0[0], &gOneVec3f); Math_Vec3f_Copy(&this->unk_1B0[1], &gOneVec3f); - SubS_FillCutscenesList(&this->actor, this->unk_212, ARRAY_COUNT(this->unk_212)); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); func_801A5080(0); if (this->actor.params == ENGS_1) { Actor_SetScale(&this->actor, 0.15f); @@ -262,7 +262,8 @@ void func_80997E4C(EnGs* this, PlayState* play) { } void func_80997FF0(EnGs* this, PlayState* play) { - if (SubS_StartActorCutscene(&this->actor, play->playerActorCsIds[0], -1, SUBS_CUTSCENE_NORMAL)) { + if (SubS_StartCutscene(&this->actor, play->playerCsIds[PLAYER_CS_ID_ITEM_OCARINA], CS_ID_NONE, + SUBS_CUTSCENE_NORMAL)) { func_80998040(this, play); } } @@ -338,8 +339,8 @@ void func_8099807C(EnGs* this, PlayState* play) { } void func_80998300(EnGs* this, PlayState* play) { - if (this->actor.cutscene != -1) { - ActorCutscene_Stop(play->playerActorCsIds[0]); + if (this->actor.csId != CS_ID_NONE) { + CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_ITEM_OCARINA]); } } @@ -372,7 +373,7 @@ void func_809984F4(EnGs* this, PlayState* play) { } } while (gossipStone != NULL); - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); this->actionFunc = func_809985B8; } @@ -380,7 +381,7 @@ void func_809985B8(EnGs* this, PlayState* play) { EnGs* gossipStone; Vec3f sp38; - if (SubS_StartActorCutscene(&this->actor, this->unk_212[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->actor, this->csIdList[0], CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { Player* player = GET_PLAYER(play); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); @@ -446,7 +447,7 @@ void func_8099874C(EnGs* this, PlayState* play) { if ((this->unk_19C == 5) && (this->unk_194 != 0)) { s32 i; - ActorCutscene_Stop(this->unk_212[0]); + CutsceneManager_Stop(this->csIdList[0]); phi_v0 = 1; for (i = 0; i < 4; i++) { @@ -1012,7 +1013,7 @@ void EnGs_Update(Actor* thisx, PlayState* play) { } else if (func_800B8718(&this->actor, &play->state)) { this->unk_19A |= 0x200; this->collider.base.acFlags &= ~AC_HIT; - if (this->actor.cutscene != -1) { + if (this->actor.csId != CS_ID_NONE) { this->actionFunc = func_80997FF0; } else { func_80998040(this, play); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/src/overlays/actors/ovl_En_Gs/z_en_gs.h index 51e899fcc..fb2d62816 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -49,7 +49,7 @@ typedef struct EnGs { /* 0x208 */ s32 unk_208; /* 0x20C */ s32 unk_20C; /* 0x210 */ u16 unk_210; - /* 0x212 */ s16 unk_212[2]; + /* 0x212 */ s16 csIdList[2]; /* 0x216 */ s16 unk_216; /* 0x218 */ s16 unk_218; /* 0x21A */ s16 unk_21A; diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index 8eaa6b444..c54703ef9 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -324,14 +324,14 @@ void func_80B23910(EnHanabi* this, PlayState* play) { void func_80B23934(EnHanabi* this, PlayState* play) { if ((gSaveContext.save.entrance == ENTRANCE(TERMINA_FIELD, 1)) && (gSaveContext.sceneLayer == 7)) { - if (play->csCtx.frames > 1650) { + if (play->csCtx.curFrame > 1650) { func_80B236C8(this, play); func_800B8FE8(&this->actor, NA_SE_EV_FIREWORKS_LAUNCH - SFX_FLAG); } } - if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 7) && (play->csCtx.currentCsIndex == 0) && - (play->csCtx.frames == 610)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 7) && (play->csCtx.scriptIndex == 0) && + (play->csCtx.curFrame == 610)) { Actor_PlaySfx(&this->actor, NA_SE_EV_KYOJIN_GROAN); } } diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 4b610de8f..b5ad5fa40 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -133,7 +133,7 @@ static u32 sHasSoundPlayed = false; void EnHg_Init(Actor* thisx, PlayState* play) { EnHg* this = THIS; - s16 currentCutscene = this->actor.cutscene; + s16 csId = this->actor.csId; s32 i; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 36.0f); @@ -142,18 +142,18 @@ void EnHg_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { Actor_Kill(&this->actor); } this->actor.targetMode = 1; this->actor.colChkInfo.health = 0; this->actor.gravity = -1.0f; - for (i = 0; i < ARRAY_COUNT(this->cutscenes); i++) { - if (currentCutscene == -1) { + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + if (csId == CS_ID_NONE) { break; } - this->cutscenes[i] = currentCutscene; - currentCutscene = ActorCutscene_GetAdditionalCutscene(currentCutscene); + this->csIdList[i] = csId; + csId = CutsceneManager_GetAdditionalCsId(csId); } EnHg_SetupWait(this); } @@ -171,12 +171,12 @@ void EnHg_SetupWait(EnHg* this) { void EnHg_Wait(EnHg* this, PlayState* play) { if (this->actor.colChkInfo.health == 1) { - if ((this->actor.xzDistToPlayer < 200.0f && this->actor.playerHeightRel < 40.0f) && - !Cutscene_CheckActorAction(play, 0x1E3)) { + if (((this->actor.xzDistToPlayer < 200.0f) && (this->actor.playerHeightRel < 40.0f)) && + !Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_483)) { EnHg_SetupChasePlayer(this); } - if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0) && - ((play->csCtx.frames == 20) || (play->csCtx.frames == 60))) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 0) && + ((play->csCtx.curFrame == 20) || (play->csCtx.curFrame == 60))) { Actor_PlaySfx(&this->actor, NA_SE_EN_HALF_REDEAD_SURPRISE); } } @@ -270,51 +270,51 @@ void EnHg_SetupCutscene(EnHg* this) { } void EnHg_PlayCutscene(EnHg* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscenes[this->cutsceneIndex])) { - ActorCutscene_Start(this->cutscenes[this->cutsceneIndex], &this->actor); + if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + CutsceneManager_Start(this->csIdList[this->csIdIndex], &this->actor); EnHg_SetupCsAction(this); } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIndex]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } void EnHg_SetupCsAction(EnHg* this) { - this->cutscenes[3] = 0x63; - this->cutscenes[2] = 0; + this->csIdList[3] = 99; + this->csIdList[2] = 0; this->actionFunc = EnHg_HandleCsAction; } void EnHg_HandleCsAction(EnHg* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 484)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 484); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_484)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_484); - if (this->cutscenes[3] != play->csCtx.actorActions[actionIndex]->action) { - this->cutscenes[3] = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (this->csIdList[3] != play->csCtx.actorCues[cueChannel]->id) { + this->csIdList[3] = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->animIndex = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_IDLE); break; case 2: - this->cutscenes[2] = 0; + this->csIdList[2] = 0; this->animIndex = HG_ANIM_LEAN_FORWARD; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_LEAN_FORWARD); break; case 3: - this->cutscenes[2] = 0; + this->csIdList[2] = 0; this->animIndex = HG_ANIM_CURL_UP; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_CURL_UP); break; case 4: - this->cutscenes[2] = 0; + this->csIdList[2] = 0; this->animIndex = HG_ANIM_PANIC; - if ((this->cutsceneIndex == HG_CS_GET_MASK) || (this->cutsceneIndex == HG_CS_SONG_OF_HEALING)) { + if ((this->csIdIndex == HG_CS_GET_MASK) || (this->csIdIndex == HG_CS_SONG_OF_HEALING)) { func_8019F128(NA_SE_EN_HALF_REDEAD_TRANS); } Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, HG_ANIM_PANIC); @@ -356,21 +356,20 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { break; case HG_ANIM_PANIC: - if ((this->cutsceneIndex == HG_CS_FIRST_ENCOUNTER) || - (this->cutsceneIndex == HG_CS_SUBSEQUENT_ENCOUNTER)) { + if ((this->csIdIndex == HG_CS_FIRST_ENCOUNTER) || (this->csIdIndex == HG_CS_SUBSEQUENT_ENCOUNTER)) { func_800B9010(&this->actor, NA_SE_EN_HALF_REDEAD_SCREAME - SFX_FLAG); } break; } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); return; } else if (play->csCtx.state == 0) { EnHg_SetupWait(this); } - this->cutscenes[3] = 0x63; + this->csIdList[3] = 99; } void EnHg_WaitForPlayerAction(EnHg* this, PlayState* play) { @@ -394,9 +393,9 @@ void EnHg_WaitForPlayerAction(EnHg* this, PlayState* play) { if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { if (INV_CONTENT(ITEM_MASK_GIBDO) == ITEM_MASK_GIBDO) { - this->cutsceneIndex = HG_CS_SONG_OF_HEALING; + this->csIdIndex = HG_CS_SONG_OF_HEALING; } else { - this->cutsceneIndex = HG_CS_GET_MASK; + this->csIdIndex = HG_CS_GET_MASK; } EnHg_SetupCutscene(this); @@ -407,9 +406,9 @@ void EnHg_WaitForPlayerAction(EnHg* this, PlayState* play) { if ((this->actionFunc != EnHg_PlayCutscene) && (this->actionFunc != EnHg_HandleCsAction)) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_61_02)) { SET_WEEKEVENTREG(WEEKEVENTREG_61_02); - this->cutsceneIndex = HG_CS_FIRST_ENCOUNTER; + this->csIdIndex = HG_CS_FIRST_ENCOUNTER; } else { - this->cutsceneIndex = HG_CS_SUBSEQUENT_ENCOUNTER; + this->csIdIndex = HG_CS_SUBSEQUENT_ENCOUNTER; } EnHg_SetupCutscene(this); diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.h b/src/overlays/actors/ovl_En_Hg/z_en_hg.h index 1211a4cf3..b79269e9b 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.h +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.h @@ -15,12 +15,12 @@ typedef struct EnHg { /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnHgActionFunc actionFunc; /* 0x1D8 */ MtxF mf; - /* 0x218 */ s32 cutsceneIndex; + /* 0x218 */ s32 csIdIndex; /* 0x21C */ s32 animIndex; /* 0x220 */ Vec3s jointTable[PAMELAS_FATHER_GIBDO_LIMB_MAX]; /* 0x292 */ Vec3s morphTable[PAMELAS_FATHER_GIBDO_LIMB_MAX]; /* 0x304 */ UNK_TYPE1 pad304[0xC]; - /* 0x310 */ u16 cutscenes[4]; + /* 0x310 */ u16 csIdList[4]; } EnHg; // size = 0x318 #endif // Z_EN_HG_H diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index af801ebd4..bbef58b1a 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -109,7 +109,7 @@ void EnHgo_Init(Actor* thisx, PlayState* play) { this->textId = 0; this->talkFlags = TALK_FLAG_NONE; this->isInCutscene = false; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { EnHgo_SetupTalk(this); } else { thisx->draw = NULL; @@ -276,13 +276,13 @@ void EnHgo_HandlePlayerChoice(EnHgo* this, PlayState* play) { } s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 486)) { - actionIndex = Cutscene_GetActorActionIndex(play, 486); - if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { - this->csAction = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_486)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_486); + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->animIndex = HGO_ANIM_ARMS_FOLDED; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); @@ -321,7 +321,7 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { (this->isInCutscene == false)) { this->isInCutscene = true; if ((gSaveContext.sceneLayer == 0) && - ((play->csCtx.currentCsIndex == 2) || (play->csCtx.currentCsIndex == 4))) { + ((play->csCtx.scriptIndex == 2) || (play->csCtx.scriptIndex == 4))) { Actor_PlaySfx(&this->actor, NA_SE_VO_GBVO02); } } @@ -338,11 +338,11 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); return true; } - if ((play->csCtx.state == CS_STATE_0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && + if ((play->csCtx.state == CS_STATE_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && (this->actionFunc == EnHgo_DoNothing)) { this->actor.shape.rot.y = this->actor.world.rot.y; Actor_Spawn(&play->actorCtx, play, ACTOR_ELF_MSG2, this->actor.focus.pos.x, this->actor.focus.pos.y, @@ -350,7 +350,7 @@ s32 EnHgo_HandleCsAction(EnHgo* this, PlayState* play) { EnHgo_SetupInitCollision(this); } - this->csAction = 0x63; + this->cueId = 99; return false; } diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h index 6882c1127..da7b7c40e 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.h @@ -24,7 +24,7 @@ typedef struct EnHgo { /* 0x310 */ s16 talkFlags; /* 0x312 */ s16 isInCutscene; /* 0x314 */ u16 textId; - /* 0x316 */ u16 csAction; + /* 0x316 */ u16 cueId; } EnHgo; // size = 0x318 #endif // Z_EN_HGO_H diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index c3052e80f..29a7c6a8e 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -105,7 +105,7 @@ void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { } this->path = SubS_GetPathByIndex(play, this->unk_21E, 0x3F); - this->unk_226 = this->actor.cutscene; + this->csId = this->actor.csId; func_801A5080(2); func_80BDB268(this); } @@ -243,18 +243,18 @@ void func_80BDB788(EnHiddenNuts* this) { void func_80BDB7E8(EnHiddenNuts* this, PlayState* play) { Vec3f sp3C; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_226); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId); return; } - if (!ActorCutscene_GetCanPlayNext(this->unk_226)) { - ActorCutscene_SetIntentToPlay(this->unk_226); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->unk_226, &this->actor); + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_228 = -1200.0f; Math_Vec3f_Copy(&sp3C, &this->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h index e40a89193..435e4662c 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h @@ -26,7 +26,7 @@ typedef struct EnHiddenNuts { /* 0x21E */ s16 unk_21E; /* 0x220 */ s32 unk_220; /* 0x224 */ s16 unk_224; - /* 0x226 */ s16 unk_226; + /* 0x226 */ s16 csId; /* 0x228 */ f32 unk_228; /* 0x22C */ f32 unk_22C; /* 0x230 */ UNK_TYPE1 unk230[4]; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 4b5878110..df4f17d4c 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -50,40 +50,40 @@ void func_80881290(EnHorse* this, PlayState* play); void func_8088159C(EnHorse* this, PlayState* play); void func_80881634(EnHorse* this); void func_8088168C(EnHorse* this); -void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* cue); void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play); -void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorCue* cue); void EnHorse_InitCutscene(EnHorse* this, PlayState* play); void EnHorse_InitHorsebackArchery(EnHorse* this); void EnHorse_UpdateHbaAnim(EnHorse* this); -void func_80883BEC(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80883D64(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80883DE0(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80883E10(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80883EA0(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80883F18(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80884010(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_808840C4(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80884194(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80884314(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_808843B4(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80884444(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_808844E0(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80884564(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_80884604(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_808846B4(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void func_808846DC(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void func_80883BEC(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80883D64(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80883DE0(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80883E10(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80883EA0(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80883F18(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80884010(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_808840C4(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80884194(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80884314(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_808843B4(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80884444(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_808844E0(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80884564(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_80884604(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_808846B4(EnHorse* this, PlayState* play, CsCmdActorCue* cue); +void func_808846DC(EnHorse* this, PlayState* play, CsCmdActorCue* cue); void func_808846F0(EnHorse* this, PlayState* play); void func_80884994(EnHorse* this); void func_80884D04(EnHorse* this, PlayState* play); @@ -91,7 +91,7 @@ void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle); s32 EnHorse_GetMountSide(EnHorse* this, PlayState* play); typedef struct { - s32 csAction; + s32 cueId; s32 csFuncIdx; } CsActionEntry; @@ -673,7 +673,7 @@ s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { (player->stateFlags1 & PLAYER_STATE1_100000) || (((this->stateFlags & ENHORSE_FLAG_19) || (this->stateFlags & ENHORSE_FLAG_29)) && !this->inRace) || (this->action == ENHORSE_ACTION_HBA) || (player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || - (play->csCtx.state != CS_STATE_0) || (ActorCutscene_GetCurrentIndex() != -1) || + (play->csCtx.state != CS_STATE_IDLE) || (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) || (player->stateFlags1 & PLAYER_STATE1_20) || (player->csMode != PLAYER_CSMODE_0)) { return false; } @@ -1001,7 +1001,7 @@ void EnHorse_Frozen(EnHorse* this, PlayState* play) { EnHorse_StartMountedIdleResetAnim(this); } else if (this->actor.params == ENHORSE_11) { this->actor.params = ENHORSE_7; - if (play->csCtx.state != CS_STATE_0) { + if (play->csCtx.state != CS_STATE_IDLE) { EnHorse_StartMountedIdle(this); } else { this->actor.speed = 8.0f; @@ -1642,8 +1642,8 @@ void EnHorse_Reverse(EnHorse* this, PlayState* play) { } else if (stickMag < 10.0f) { stickAngle = -0x7FFF; } - } else if ((player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || (play->csCtx.state != CS_STATE_0) || - (ActorCutscene_GetCurrentIndex() != -1) || (player->stateFlags1 & PLAYER_STATE1_20)) { + } else if ((player->actor.flags & ACTOR_FLAG_TALK_REQUESTED) || (play->csCtx.state != CS_STATE_IDLE) || + (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) || (player->stateFlags1 & PLAYER_STATE1_20)) { EnHorse_StartMountedIdleResetAnim(this); this->actor.speed = 0.0f; return; @@ -2479,20 +2479,20 @@ void func_808819D8(EnHorse* this, PlayState* play) { } } -void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { this->animIndex = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 1; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], this->actor.speed * 0.2f * 1.5f); } -void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { Vec3f endPos; s32 pad; - endPos.x = action->endPos.x; - endPos.y = action->endPos.y; - endPos.z = action->endPos.z; + endPos.x = cue->endPos.x; + endPos.y = cue->endPos.y; + endPos.z = cue->endPos.z; if (Math3D_Distance(&endPos, &this->actor.world.pos) > 8.0f) { EnHorse_RotateToPoint(this, play, &endPos, 0x320); @@ -2543,20 +2543,20 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play) { Rumble_Request(0.0f, 170, 10, 10); } -void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { EnHorse_CsSetAnimHighJump(this, play); this->cutsceneAction = 2; this->cutsceneFlags &= ~1; } -void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { f32 curFrame; f32 y; Vec3s* jointTable; s32 pad[2]; if (this->cutsceneFlags & 1) { - EnHorse_CsMoveToPoint(this, play, action); + EnHorse_CsMoveToPoint(this, play, cue); return; } @@ -2608,7 +2608,7 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } } -void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { this->animIndex = ENHORSE_ANIM_REARING; this->cutsceneAction = 3; this->cutsceneFlags &= ~4; @@ -2624,7 +2624,7 @@ void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* act Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { this->actor.speed = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { @@ -2652,13 +2652,13 @@ void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) } } -void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - this->actor.world.pos.x = action->startPos.x; - this->actor.world.pos.y = action->startPos.y; - this->actor.world.pos.z = action->startPos.z; +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + this->actor.world.pos.x = cue->startPos.x; + this->actor.world.pos.y = cue->startPos.y; + this->actor.world.pos.z = cue->startPos.z; this->actor.prevPos = this->actor.world.pos; - this->actor.world.rot.y = action->urot.y; + this->actor.world.rot.y = cue->rot.y; this->actor.shape.rot = this->actor.world.rot; this->animIndex = ENHORSE_ANIM_GALLOP; @@ -2667,13 +2667,13 @@ void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* acti this->actor.speed * 0.3f); } -void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { Vec3f endPos; s32 pad; - endPos.x = action->endPos.x; - endPos.y = action->endPos.y; - endPos.z = action->endPos.z; + endPos.x = cue->endPos.x; + endPos.y = cue->endPos.y; + endPos.z = cue->endPos.z; if (Math3D_Distance(&endPos, &this->actor.world.pos) > 8.0f) { EnHorse_RotateToPoint(this, play, &endPos, 0x320); @@ -2692,13 +2692,13 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* } } -void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - this->actor.world.pos.x = action->startPos.x; - this->actor.world.pos.y = action->startPos.y; - this->actor.world.pos.z = action->startPos.z; +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + this->actor.world.pos.x = cue->startPos.x; + this->actor.world.pos.y = cue->startPos.y; + this->actor.world.pos.z = cue->startPos.z; this->actor.prevPos = this->actor.world.pos; - this->actor.world.rot.y = action->urot.y; + this->actor.world.rot.y = cue->rot.y; this->actor.shape.rot = this->actor.world.rot; this->animIndex = ENHORSE_ANIM_REARING; @@ -2717,7 +2717,7 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { this->actor.speed = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { @@ -2752,16 +2752,16 @@ void EnHorse_InitCutscene(EnHorse* this, PlayState* play) { this->actor.speed = 0.0f; } -s32 EnHorse_GetCutsceneFunctionIndex(s32 csAction) { +s32 EnHorse_GetCutsceneFunctionIndex(s32 cueId) { s32 numActions = ARRAY_COUNT(sCsActionTable); // prevents unrolling s32 i; for (i = 0; i < numActions; i++) { - if (csAction == sCsActionTable[i].csAction) { + if (cueId == sCsActionTable[i].cueId) { return sCsActionTable[i].csFuncIdx; } - if (csAction < sCsActionTable[i].csAction) { + if (cueId < sCsActionTable[i].cueId) { return 0; } } @@ -2770,9 +2770,9 @@ s32 EnHorse_GetCutsceneFunctionIndex(s32 csAction) { void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play) { s32 csFunctionIdx; - CsCmdActorAction* playerAction = play->csCtx.playerAction; + CsCmdActorCue* playerCue = play->csCtx.playerCue; - if (play->csCtx.state == CS_STATE_3) { + if (play->csCtx.state == CS_STATE_STOP) { this->playerControlled = true; this->actor.params = ENHORSE_12; this->action = ENHORSE_ACTION_IDLE; @@ -2780,23 +2780,23 @@ void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play) { return; } - if (playerAction != NULL) { - csFunctionIdx = EnHorse_GetCutsceneFunctionIndex(playerAction->action); + if (playerCue != NULL) { + csFunctionIdx = EnHorse_GetCutsceneFunctionIndex(playerCue->id); if (csFunctionIdx != 0) { if (csFunctionIdx != this->cutsceneAction) { if (this->cutsceneAction == 0) { - this->actor.world.pos.x = playerAction->startPos.x; - this->actor.world.pos.y = playerAction->startPos.y; - this->actor.world.pos.z = playerAction->startPos.z; + this->actor.world.pos.x = playerCue->startPos.x; + this->actor.world.pos.y = playerCue->startPos.y; + this->actor.world.pos.z = playerCue->startPos.z; - this->actor.world.rot.y = playerAction->urot.y; + this->actor.world.rot.y = playerCue->rot.y; this->actor.shape.rot = this->actor.world.rot; this->actor.prevPos = this->actor.world.pos; } this->cutsceneAction = csFunctionIdx; - sCutsceneInitFuncs[csFunctionIdx](this, play, playerAction); + sCutsceneInitFuncs[csFunctionIdx](this, play, playerCue); } - sCutsceneActionFuncs[this->cutsceneAction](this, play, playerAction); + sCutsceneActionFuncs[this->cutsceneAction](this, play, playerCue); } } } @@ -2925,7 +2925,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { if (((this->hbaFlags & 1) || (this->hbaTimer > 45)) && (sp28 != 1) && (gSaveContext.minigameStatus != MINIGAME_STATUS_END)) { - gSaveContext.save.cutscene = 0; + gSaveContext.save.cutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_64; } @@ -3108,28 +3108,28 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) { } } -void func_80883B70(EnHorse* this, CsCmdActorAction* action) { - this->actor.world.pos.x = action->startPos.x; - this->actor.world.pos.y = action->startPos.y; - this->actor.world.pos.z = action->startPos.z; +void func_80883B70(EnHorse* this, CsCmdActorCue* cue) { + this->actor.world.pos.x = cue->startPos.x; + this->actor.world.pos.y = cue->startPos.y; + this->actor.world.pos.z = cue->startPos.z; - this->actor.world.rot.y = action->urot.y; + this->actor.world.rot.y = cue->rot.y; this->actor.shape.rot = this->actor.world.rot; this->actor.prevPos = this->actor.world.pos; } -void func_80883BEC(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - func_80883B70(this, action); +void func_80883BEC(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + func_80883B70(this, cue); this->animIndex = ENHORSE_ANIM_IDLE; - this->unk_3E0 = 1; + this->cueId = 1; this->stateFlags &= ~ENHORSE_SANDDUST_SOUND; Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); this->stateFlags |= ENHORSE_SANDDUST_SOUND; } -void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { EnHorse_IdleAnimSounds(this, play); if (SkelAnime_Update(&this->skin.skelAnime)) { this->animIndex = ENHORSE_ANIM_IDLE; @@ -3138,74 +3138,74 @@ void func_80883CB0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } } -void func_80883D64(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - func_80883B70(this, action); - this->unk_3E0 = 2; +void func_80883D64(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + func_80883B70(this, cue); + this->cueId = 2; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00A8DC, 0.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00A8DC), ANIMMODE_ONCE, 0.0f); } -void func_80883DE0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_80883DE0(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { SkelAnime_Update(&this->skin.skelAnime); } -void func_80883E10(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - func_80883B70(this, action); - this->unk_3E0 = 3; +void func_80883E10(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + func_80883B70(this, cue); + this->cueId = 3; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00A8DC, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00A8DC), ANIMMODE_ONCE, -3.0f); Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } -void func_80883EA0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_80883EA0(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00B3E0, 1.0f, 11.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00B3E0), ANIMMODE_ONCE, 0.0f); } } -void func_80883F18(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - func_80883B70(this, action); - this->unk_3E0 = 4; +void func_80883F18(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + func_80883B70(this, cue); + this->cueId = 4; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00AD08, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00AD08), ANIMMODE_ONCE, -3.0f); } -void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_80883F98(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { if (Animation_OnFrame(&this->skin.skelAnime, Animation_GetLastFrame(&object_horse_link_child_Anim_00AD08) - 1.0f)) { Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_LAND2); } SkelAnime_Update(&this->skin.skelAnime); } -void func_80884010(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - func_80883B70(this, action); - this->unk_3E0 = 5; +void func_80884010(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + func_80883B70(this, cue); + this->cueId = 5; this->animIndex = ENHORSE_ANIM_WALK; Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); } -void func_808840C4(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_808840C4(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { EnHorse_PlayWalkingSound(this); - Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->cueChannel); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); } } -void func_80884194(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - func_80883B70(this, action); - this->unk_3E0 = 6; +void func_80884194(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + func_80883B70(this, cue); + this->cueId = 6; this->animIndex = ENHORSE_ANIM_GALLOP; Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, -3.0f); func_8087C1C0(this); } -void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); +void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->cueChannel); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animIndex], 1.0f, 0.0f, Animation_GetLastFrame(sAnimationHeaders[this->type][this->animIndex]), ANIMMODE_ONCE, 0.0f); @@ -3213,36 +3213,36 @@ void func_8088424C(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } } -void func_80884314(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_80884314(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 20.0f); - func_80883B70(this, action); - this->unk_3E0 = 7; + func_80883B70(this, cue); + this->cueId = 7; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00D178, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00D178), ANIMMODE_ONCE, 0.0f); Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); } -void func_808843B4(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_808843B4(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { SkelAnime_Update(&this->skin.skelAnime); if (this->curFrame > 42.0f) { if (((s32)this->curFrame % 11) == 0) { func_8087C1C0(this); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->cueChannel); } } -void func_80884444(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_80884444(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 20.0f); - func_80883B70(this, action); + func_80883B70(this, cue); this->cutsceneAction = 8; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00D4E8, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00D4E8), ANIMMODE_ONCE, 0.0f); func_8087C1C0(this); } -void func_808844E0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); +void func_808844E0(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->cueChannel); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00D4E8, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00D4E8), ANIMMODE_ONCE, 0.0f); @@ -3250,17 +3250,17 @@ void func_808844E0(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } } -void func_80884564(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_80884564(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 20.0f); - func_80883B70(this, action); + func_80883B70(this, cue); this->cutsceneAction = 8; Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00BDE0, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00BDE0), ANIMMODE_ONCE, -3.0f); func_8087C1C0(this); } -void func_80884604(EnHorse* this, PlayState* play, CsCmdActorAction* action) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, this->unk_530); +void func_80884604(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, this->cueChannel); if (SkelAnime_Update(&this->skin.skelAnime)) { Animation_Change(&this->skin.skelAnime, &object_horse_link_child_Anim_00BDE0, 1.0f, 0.0f, Animation_GetLastFrame(&object_horse_link_child_Anim_00BDE0), ANIMMODE_ONCE, 0.0f); @@ -3271,48 +3271,48 @@ void func_80884604(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } } -void func_808846B4(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_808846B4(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { Actor_Kill(&this->actor); } -void func_808846DC(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void func_808846DC(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { } void func_808846F0(EnHorse* this, PlayState* play) { this->playerControlled = false; this->action = ENHORSE_ACTION_21; - this->unk_3E0 = -1; + this->cueId = -1; this->actor.speed = 0.0f; } void func_80884718(EnHorse* this, PlayState* play) { - CsCmdActorAction* action; + CsCmdActorCue* cue; - if (Cutscene_CheckActorAction(play, 0x70)) { - this->unk_530 = Cutscene_GetActorActionIndex(play, 0x70); - action = play->csCtx.actorActions[this->unk_530]; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_112)) { + this->cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_112); + cue = play->csCtx.actorCues[this->cueChannel]; this->unk_1EC |= 0x20; - if (this->unk_3E0 != action->action) { - if (this->unk_3E0 == -1) { - this->actor.world.pos.x = action->startPos.x; - this->actor.world.pos.y = action->startPos.y; - this->actor.world.pos.z = action->startPos.z; + if (this->cueId != cue->id) { + if (this->cueId == -1) { + this->actor.world.pos.x = cue->startPos.x; + this->actor.world.pos.y = cue->startPos.y; + this->actor.world.pos.z = cue->startPos.z; - this->actor.world.rot.y = action->urot.y; + this->actor.world.rot.y = cue->rot.y; this->actor.shape.rot = this->actor.world.rot; this->actor.prevPos = this->actor.world.pos; } - this->unk_3E0 = action->action; - if (D_808890F0[this->unk_3E0] != NULL) { - D_808890F0[this->unk_3E0](this, play, action); + this->cueId = cue->id; + if (D_808890F0[this->cueId] != NULL) { + D_808890F0[this->cueId](this, play, cue); } } - if (D_8088911C[this->unk_3E0] != NULL) { - D_8088911C[this->unk_3E0](this, play, action); + if (D_8088911C[this->cueId] != NULL) { + D_8088911C[this->cueId](this, play, cue); } } } @@ -4227,7 +4227,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { EnHorse_RegenBoost(this, play); } - if (ActorCutscene_GetCurrentIndex() != -1) { + if (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) { thisx->speed = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 97ab2c898..b2c58bcad 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -11,7 +11,7 @@ struct EnIn; typedef void (*EnHorseActionFunc)(struct EnHorse*, PlayState*); typedef void (*EnHorsePostdrawFunc)(struct EnHorse*, PlayState*); -typedef void (*EnHorseCsFunc)(struct EnHorse*, PlayState*, CsCmdActorAction*); +typedef void (*EnHorseCsFunc)(struct EnHorse*, PlayState*, CsCmdActorCue*); #define ENHORSE_BOOST (1 << 0) /* 0x1 */ #define ENHORSE_BOOST_DECEL (1 << 1) /* 0x2 */ @@ -190,7 +190,7 @@ typedef struct EnHorse { /* 0x3BC */ Vec3f frontLeftHoof; /* 0x3C8 */ Vec3f backRightHoof; /* 0x3D4 */ Vec3f backLeftHoof; - /* 0x3E0 */ s32 unk_3E0; + /* 0x3E0 */ s32 cueId; /* 0x3E4 */ UNK_TYPE1 unk_3E4[0x4]; /* 0x3E8 */ f32 unk_3E8; /* 0x3EC */ s16 unk_3EC; @@ -198,7 +198,7 @@ typedef struct EnHorse { /* 0x48A */ Vec3s morphTable[OBJECT_HA_1_LIMB_MAX]; /* 0x528 */ f32 unk_528; /* 0x52C */ s32 unk_52C; - /* 0x530 */ s32 unk_530; + /* 0x530 */ s32 cueChannel; /* 0x534 */ s32 unk_534; /* 0x538 */ s32 unk_538; /* 0x53C */ s32 unk_53C; diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 8ecc26857..4d535292f 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -225,7 +225,7 @@ void EnHs_SceneTransitToBunnyHoodDialogue(EnHs* this, PlayState* play) { void func_80953354(EnHs* this, PlayState* play) { if (!Play_InCsMode(play)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); this->actionFunc = EnHs_SceneTransitToBunnyHoodDialogue; } } diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index fde467ddc..e053a8528 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -320,49 +320,49 @@ void func_80BF15EC(EnIg* this) { } } -s32 func_80BF16C8(EnIg* this, s16 arg1) { +s32 func_80BF16C8(EnIg* this, s16 csId) { s32 ret = false; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(arg1); - } else if (ActorCutscene_GetCanPlayNext(arg1)) { - ActorCutscene_StartAndSetUnkLinkFields(arg1, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(csId); + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); ret = true; } else { - ActorCutscene_SetIntentToPlay(arg1); + CutsceneManager_Queue(csId); } return ret; } -s16 func_80BF1744(EnIg* this, s32 arg1) { - s16 cs = -1; +s16 func_80BF1744(EnIg* this, s32 numCutscenes) { + s16 csId = CS_ID_NONE; s32 i; if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - cs = this->actor.child->cutscene; - for (i = 0; i < arg1; i++) { - cs = ActorCutscene_GetAdditionalCutscene(cs); + csId = this->actor.child->csId; + for (i = 0; i < numCutscenes; i++) { + csId = CutsceneManager_GetAdditionalCsId(csId); } } - return cs; + return csId; } s32 func_80BF17BC(EnIg* this, PlayState* play) { s32 pad; - s16 sp2A; + s16 csId; s32 ret; - sp2A = func_80BF1744(this, 0); + csId = func_80BF1744(this, 0); ret = false; switch (this->unk_3F6) { case 0: - if (func_80BF16C8(this, sp2A)) { + if (func_80BF16C8(this, csId)) { case 2: case 4: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), this->actor.child); } this->unk_3F6++; @@ -373,17 +373,17 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) { case 1: case 3: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_10) && (this->unk_3F6 == 3)) { - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); this->unk_3F6 = 5; } else { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), &this->actor); } this->unk_3F6++; ret = true; break; case 5: - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); this->unk_3F6++; ret = true; break; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 5c1244faa..fc7fafdcf 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -651,7 +651,7 @@ void EnIk_ReactToAttack(EnIk* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { if (this->subCamId != SUB_CAM_ID_DONE) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); this->subCamId = SUB_CAM_ID_DONE; EnIk_SetupIdle(this); } else { @@ -693,7 +693,7 @@ void EnIk_Die(EnIk* this, PlayState* play) { } if (this->timer == 0) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); Actor_Kill(&this->actor); } } @@ -723,7 +723,7 @@ void EnIk_Frozen(EnIk* this, PlayState* play) { } void EnIk_SetupCutscene(EnIk* this) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actor.speed = 0.0f; if (this->actor.colChkInfo.health != 0) { func_800BE504(&this->actor, &this->colliderCylinder); @@ -735,10 +735,10 @@ void EnIk_PlayCutscene(EnIk* this, PlayState* play) { Vec3f subCamEye; this->invincibilityFrames = 12; - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - if (this->actor.cutscene != -1) { - ActorCutscene_StartAndSetFlag(this->actor.cutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + if (CutsceneManager_IsNext(this->actor.csId)) { + if (this->actor.csId != CS_ID_NONE) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->actor.csId, &this->actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); subCamEye.x = (Math_SinS((this->actor.shape.rot.y - 0x2000)) * 120.0f) + this->actor.focus.pos.x; subCamEye.y = this->actor.focus.pos.y + 20.0f; subCamEye.z = (Math_CosS((this->actor.shape.rot.y - 0x2000)) * 120.0f) + this->actor.focus.pos.z; @@ -750,7 +750,7 @@ void EnIk_PlayCutscene(EnIk* this, PlayState* play) { EnIk_SetupDie(this); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index e90ddcafd..84ed7a605 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -354,7 +354,7 @@ void func_8095E204(EnIshi* this, PlayState* play) { for (i = 0; i < 3; i++) { if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.cutscene, this->actor.halfDaysBits, NULL) == NULL) { + this->actor.csId, this->actor.halfDaysBits, NULL) == NULL) { break; } } @@ -660,7 +660,7 @@ void func_8095EBDC(EnIshi* this, PlayState* play) { void func_8095F060(EnIshi* this) { this->actor.flags |= ACTOR_FLAG_10; - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_8095F0A4; } @@ -668,15 +668,15 @@ void func_8095F0A4(EnIshi* this, PlayState* play) { s32 pad; s32 sp28 = ENISHI_GET_1(&this->actor); - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, D_8095F6D4[sp28], D_8095F6D0[sp28]); D_8095F6D8[sp28](&this->actor, play); D_8095F6E0[sp28](this, play); this->actor.draw = NULL; func_8095F180(this); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -685,9 +685,9 @@ void func_8095F180(EnIshi* this) { } void func_8095F194(EnIshi* this, PlayState* play) { - if (this->actor.cutscene < 0) { + if (this->actor.csId < 0) { Actor_Kill(&this->actor); - } else if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { + } else if (CutsceneManager_GetCurrentCsId() != this->actor.csId) { Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 4ef7ee42a..451b9e553 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -251,32 +251,32 @@ s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) { return reached; } -s16 EnJg_GetCutsceneForTeachingLullabyIntro(EnJg* this) { +s16 EnJg_GetCsIdForTeachingLullabyIntro(EnJg* this) { s16 temp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (temp > 0) { - return this->actor.cutscene; + return this->actor.csId; } - return ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + return CutsceneManager_GetAdditionalCsId(this->actor.csId); } void EnJg_SetupGoronShrineCheer(EnJg* this) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); if (this->focusedShrineGoronParam == 10) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { this->actionFunc = EnJg_GoronShrineTalk; } else { - this->cutscene = 0x7C; + this->csId = CS_ID_GLOBAL_TALK; } } else { - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); this->actionFunc = EnJg_GoronShrineCheer; switch (this->textId) { @@ -374,7 +374,7 @@ void EnJg_GoronShrineTalk(EnJg* this, PlayState* play) { } void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { + if (CutsceneManager_IsNext(this->csId)) { switch (this->textId) { case 0xDD0: // The greatest Goron hero of all? case 0xDD2: // The immortal Goron? @@ -383,26 +383,26 @@ void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) { case 0xDD6: // Darmani, greatest in the world! // Focus on a specifc Goron for these lines this->shrineGoron = EnJg_GetShrineGoronToFocusOn(play, this->focusedShrineGoronParam); - ActorCutscene_Start(this->cutscene, this->shrineGoron); + CutsceneManager_Start(this->csId, this->shrineGoron); Camera_SetTargetActor(play->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); break; default: // Focus on the whole group for these lines - ActorCutscene_Start(this->cutscene, &this->actor); + CutsceneManager_Start(this->csId, &this->actor); Camera_SetTargetActor(play->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); break; } this->actionFunc = EnJg_GoronShrineTalk; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { if (this->focusedShrineGoronParam == 10) { this->actionFunc = EnJg_GoronShrineTalk; } else { - ActorCutscene_Stop(0x7C); + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } @@ -514,11 +514,11 @@ void EnJg_Talk(EnJg* this, PlayState* play) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->flags &= ~FLAG_LOOKING_AT_PLAYER; - this->cutscene = EnJg_GetCutsceneForTeachingLullabyIntro(this); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + this->csId = EnJg_GetCsIdForTeachingLullabyIntro(this); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); this->actionFunc = EnJg_TeachLullabyIntro; } } else { @@ -609,27 +609,27 @@ void EnJg_EndFrozenInteraction(EnJg* this, PlayState* play) { } void EnJg_TeachLullabyIntro(EnJg* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->actor); this->actionFunc = EnJg_LullabyIntroCutsceneAction; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { s32 pad; - if (Cutscene_CheckActorAction(play, 470)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 470); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_470)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_470); - if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { - this->csAction = play->csCtx.actorActions[actionIndex]->action; + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; - switch (play->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->cutsceneAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE; if (this->drum != NULL) { @@ -688,7 +688,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { this->drum = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_OBJ_JG_GAKKI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, - this->actor.params, this->actor.cutscene, this->actor.halfDaysBits, NULL); + this->actor.params, this->actor.csId, this->actor.halfDaysBits, NULL); } if (this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) { @@ -699,7 +699,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) { } } } else { - this->csAction = 99; + this->cueId = 99; this->freezeTimer = 1000; SET_WEEKEVENTREG(WEEKEVENTREG_24_40); this->actionFunc = EnJg_Idle; @@ -758,10 +758,10 @@ s32 EnJg_GetNextTextId(EnJg* this) { case 0xDCF: // Spring has come thanks to you this->focusedShrineGoronParam = 3; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); this->actionFunc = EnJg_GoronShrineCheer; return 0xDD0; // The greatest Goron hero of all? @@ -949,7 +949,7 @@ void EnJg_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (!EN_JG_IS_IN_GORON_SHRINE(thisx)) { - if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 7) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 7) && (play->csCtx.scriptIndex == 0)) { // This is the elder that appears in the cutscene for learning the full Goron Lullaby. this->animIndex = EN_JG_ANIM_IDLE; this->action = EN_JG_ACTION_LULLABY_INTRO_CS; @@ -968,7 +968,7 @@ void EnJg_Init(Actor* thisx, PlayState* play) { } else { // This is the elder that appears in Goron Shrine in spring. this->animIndex = EN_JG_ANIM_IDLE; - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnJg_GoronShrineIdle; } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.h b/src/overlays/actors/ovl_En_Jg/z_en_jg.h index 757a8bd86..ad8eee0a8 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.h +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.h @@ -32,9 +32,9 @@ typedef struct EnJg { /* 0x3A4 */ Vec3f breathPos; /* 0x3B0 */ Vec3f breathVelocity; /* 0x3BC */ Vec3f breathAccel; - /* 0x3C8 */ s16 cutscene; + /* 0x3C8 */ s16 csId; /* 0x3CA */ u8 cutsceneAnimIndex; - /* 0x3CB */ u8 csAction; + /* 0x3CB */ u8 cueId; /* 0x3CC */ u16 flags; /* 0x3CE */ u16 textId; /* 0x3D0 */ u8 focusedShrineGoronParam; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 263b4fab4..5efca1bcd 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -231,15 +231,15 @@ void func_80C13F88(EnJgameTsn* this) { } void func_80C13F9C(EnJgameTsn* this, PlayState* play) { - if (this->actor.cutscene != -1) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (this->actor.csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); func_80C14030(this); } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } else { func_80C14030(this); @@ -268,8 +268,8 @@ void func_80C14044(EnJgameTsn* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { + CutsceneManager_Stop(this->actor.csId); } func_80C13B74(this); } @@ -468,8 +468,8 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { break; case 0x109E: - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { + CutsceneManager_Stop(this->actor.csId); } Message_CloseTextbox(play); func_80C1476C(this, play); diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index f6056664f..8f48622c8 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -76,7 +76,7 @@ Vec3f D_8096AC30 = { 500.0f, -500.0f, 0.0f }; void EnJs_Init(Actor* thisx, PlayState* play) { s32 pad; - s16 cs; + s16 csId; s32 i; EnJs* this = THIS; @@ -92,17 +92,17 @@ void EnJs_Init(Actor* thisx, PlayState* play) { this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; - cs = this->actor.cutscene; + csId = this->actor.csId; - for (i = 0; i < ARRAY_COUNT(this->cutscenes); i++) { - this->cutscenes[i] = cs; - if (cs != -1) { - this->actor.cutscene = cs; - cs = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } - this->cutsceneIndex = -1; + this->csIdIndex = -1; switch (ENJS_GET_TYPE(&this->actor)) { case 0: @@ -511,17 +511,17 @@ s32 func_809695FC(EnJs* this, PlayState* play) { } void func_80969688(EnJs* this) { - if (this->cutsceneIndex != -1) { - if (ActorCutscene_GetCurrentIndex() == this->cutscenes[this->cutsceneIndex]) { - ActorCutscene_Stop(this->cutscenes[this->cutsceneIndex]); + if (this->csIdIndex != -1) { + if (CutsceneManager_GetCurrentCsId() == this->csIdList[this->csIdIndex]) { + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); } - this->cutsceneIndex = -1; + this->csIdIndex = -1; } } -void func_809696EC(EnJs* this, s16 arg1) { +void func_809696EC(EnJs* this, s16 csIdIndex) { func_80969688(this); - this->cutsceneIndex = arg1; + this->csIdIndex = csIdIndex; } void func_8096971C(EnJs* this, PlayState* play) { @@ -1019,14 +1019,14 @@ void EnJs_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if ((this->cutsceneIndex != -1) && (ActorCutscene_GetCurrentIndex() != this->cutscenes[this->cutsceneIndex])) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIndex]); - } else if (ActorCutscene_GetCanPlayNext(this->cutscenes[this->cutsceneIndex])) { - ActorCutscene_Start(this->cutscenes[this->cutsceneIndex], &this->actor); + if ((this->csIdIndex != -1) && (CutsceneManager_GetCurrentCsId() != this->csIdList[this->csIdIndex])) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); + } else if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + CutsceneManager_Start(this->csIdList[this->csIdIndex], &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIndex]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } } diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.h b/src/overlays/actors/ovl_En_Js/z_en_js.h index 4508e4944..c4dd3e3a2 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.h +++ b/src/overlays/actors/ovl_En_Js/z_en_js.h @@ -24,8 +24,8 @@ typedef struct EnJs { /* 0x2B8 */ u16 unk_2B8; /* 0x2BA */ s16 maskType; /* 0x2BC */ s16 unk_2BC; - /* 0x2BE */ s16 cutscenes[2]; - /* 0x2C2 */ s16 cutsceneIndex; + /* 0x2BE */ s16 csIdList[2]; + /* 0x2C2 */ s16 csIdIndex; /* 0x2C4 */ EnJsActionFunc actionFunc; } EnJs; // size = 0x2C8 diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index e4e01467f..7d8f46f91 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -298,7 +298,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->bodyCollider.dim.radius = 20; this->bodyCollider.dim.height = 65; this->bodyCollider.dim.yShift = 0; - this->unk_2D6 = this->picto.actor.cutscene; + this->csId = this->picto.actor.csId; this->picto.actor.world.pos.y = player->actor.world.pos.y + 160.0f; this->picto.validationFunc = EnKaizoku_ValidatePictograph; this->picto.actor.flags |= ACTOR_FLAG_400; @@ -474,14 +474,14 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { break; } - if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { - ActorCutscene_SetIntentToPlay(this->unk_2D6); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->picto.actor); + CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); func_800B7298(play, &this->picto.actor, 0x15); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; sp54 = (this->unk_2CA * 4) + this->unk_2C8; @@ -609,7 +609,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 7: if (this->unk_598 == 0) { func_800B7298(play, &this->picto.actor, 6); - ActorCutscene_Stop(this->unk_2D6); + CutsceneManager_Stop(this->csId); this->unk_59C = 0; this->subCamId = 0; this->picto.actor.flags &= ~ACTOR_FLAG_100000; @@ -666,15 +666,15 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { void func_80B86804(EnKaizoku* this, PlayState* play) { if (this->subCamId == 0) { - if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { - ActorCutscene_SetIntentToPlay(this->unk_2D6); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->picto.actor); + CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); } func_800B7298(play, &this->picto.actor, 0x60); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->unk_2B2 = 30; this->picto.actor.flags &= ~ACTOR_FLAG_1; this->unk_598 = 0; @@ -724,7 +724,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); func_800B7298(play, &this->picto.actor, 6); - ActorCutscene_Stop(this->unk_2D6); + CutsceneManager_Stop(this->csId); this->subCamId = 0; play->nextEntrance = play->setupExitList[this->exitIndex]; gSaveContext.nextCutsceneIndex = 0; @@ -863,7 +863,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { this->unk_59C = 0; this->subCamId = 0; func_800B7298(play, &this->picto.actor, 6); - ActorCutscene_Stop(this->unk_2D6); + CutsceneManager_Stop(this->csId); if (this->switchFlag >= 0) { Flags_SetSwitch(play, this->switchFlag); } @@ -1716,12 +1716,12 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { if (curFrame >= 25.0f) { player = GET_PLAYER(play); if (this->subCamId == 0) { - if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { - ActorCutscene_SetIntentToPlay(this->unk_2D6); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); } Math_Vec3f_Copy(&this->unk_3C4, &gZeroVec3f); @@ -1776,12 +1776,12 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->subCamId = 0; this->picto.actor.flags |= ACTOR_FLAG_100000; - if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { - ActorCutscene_SetIntentToPlay(this->unk_2D6); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); this->actionFunc = func_80B86804; } else { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->actionFunc = func_80B86804; } return; @@ -1794,12 +1794,12 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->subCamId = 0; this->picto.actor.flags |= ACTOR_FLAG_100000; - if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { - ActorCutscene_SetIntentToPlay(this->unk_2D6); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Queue(this->csId); this->actionFunc = func_80B86804; } else { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->actionFunc = func_80B86804; } return; diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index ad161088e..6366c4f7f 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -58,7 +58,7 @@ typedef struct EnKaizoku { /* 0x2D0 */ s16 unk_2D0; /* 0x2D2 */ s16 swordState; /* 0x2D4 */ s16 exitIndex; - /* 0x2D6 */ s16 unk_2D6; + /* 0x2D6 */ s16 csId; /* 0x2D8 */ u8 unk_2D8; /* 0x2D9 */ u8 unk_2D9; /* 0x2DC */ f32 frameCount; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 7af84b5e4..19fd2c19f 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -143,7 +143,7 @@ void EnKakasi_Destroy(Actor* thisx, PlayState* play) { void EnKakasi_Init(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; - s32 tempCutscene; + s32 csId; s32 i; Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &D_80971D80); @@ -169,10 +169,10 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->picto.actor, 0.01f); i = 0; - tempCutscene = this->picto.actor.cutscene; - while (tempCutscene != -1) { + csId = this->picto.actor.csId; + while (csId != CS_ID_NONE) { //! FAKE: - tempCutscene = ActorCutscene_GetAdditionalCutscene(this->actorCutscenes[i] = tempCutscene); + csId = CutsceneManager_GetAdditionalCsId(this->csIdList[i] = csId); i++; } @@ -418,7 +418,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { if (this->talkState == TEXT_STATE_5) { // bad song input if (this->unkState196 == 2 && this->picto.actor.textId == 0x1647) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); } // after timeskip @@ -446,17 +446,17 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } else if (this->picto.actor.textId == 0x165D || this->picto.actor.textId == 0x165F || this->picto.actor.textId == 0x1660 || this->picto.actor.textId == 0x1652) { func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_4); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[0]); this->actionFunc = EnKakasi_DancingRemark; } else { - if (!ActorCutscene_GetCanPlayNext(this->actorCutscenes[0])) { - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (!CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Queue(this->csIdList[0]); this->actionFunc = EnKakasi_DancingRemark; } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->actionFunc = EnKakasi_DancingRemark; } } @@ -561,19 +561,19 @@ void EnKakasi_OcarinaRemark(EnKakasi* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_80152434(play, 0x35); this->unkState1A8 = 0; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[0]); this->actionFunc = EnKakasi_TeachingSong; - } else if (ActorCutscene_GetCanPlayNext(this->actorCutscenes[0]) == 0) { - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + } else if (!CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Queue(this->csIdList[0]); this->actionFunc = EnKakasi_TeachingSong; } else { this->unkState1A8 = 1; - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->actionFunc = EnKakasi_TeachingSong; } @@ -586,17 +586,17 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { EnKakasi_CheckPlayerPosition(this, play); Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); if (this->unkState1A8 == 0) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[0]); return; } - if (ActorCutscene_GetCanPlayNext(this->actorCutscenes[0]) == 0) { - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (!CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Queue(this->csIdList[0]); return; } - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); this->unkState1A8 = 1; this->unkState1A8 = 1; @@ -619,7 +619,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { if (play->msgCtx.ocarinaMode == 4) { // song failed this->unk190 = 0; this->unkCounter1A4 = 0; - ActorCutscene_Stop(this->actorCutscenes[0]); + CutsceneManager_Stop(this->csIdList[0]); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_YASE_DEAD); if (this) {} this->unkState196 = 2; @@ -652,7 +652,7 @@ void EnKakasi_PostSongLearnTwirl(EnKakasi* this, PlayState* play) { } void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play) { - ActorCutscene_Stop(this->actorCutscenes[0]); + CutsceneManager_Stop(this->csIdList[0]); play->msgCtx.ocarinaMode = 4; this->unk190 = 0; this->unkCounter1A4 = 0; @@ -699,18 +699,18 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } if (this->unkState1A8 == 0) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[0]); return; } - if (ActorCutscene_GetCanPlayNext(this->actorCutscenes[0]) == 0) { - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (!CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Queue(this->csIdList[0]); return; } Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos); - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_86); this->unkState1A8 = 1; } @@ -744,7 +744,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } if (this->picto.actor.textId == 0x1648) { - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_WAIT); this->picto.actor.textId = 0x1649; if (this->animIndex != ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); @@ -789,14 +789,14 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { u32 currentDay = gSaveContext.save.day; this->unkState196 = 3; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); - } else if (ActorCutscene_GetCanPlayNext(this->actorCutscenes[0]) == 0) { - ActorCutscene_SetIntentToPlay(this->actorCutscenes[0]); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[0]); + } else if (!CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Queue(this->csIdList[0]); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[0], &this->picto.actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->picto.actor.cutscene); + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->picto.actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); if (currentDay == 3 && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { @@ -1014,8 +1014,8 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { Math_ApproachF(&this->picto.actor.shape.yOffset, -6000.0f, 0.5f, 200.0f); if (fabsf(this->picto.actor.shape.yOffset + 6000.0f) < 10.0f) { SET_WEEKEVENTREG(WEEKEVENTREG_79_08); - func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_6); - ActorCutscene_Stop(this->actorCutscenes[0]); + func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); + CutsceneManager_Stop(this->csIdList[0]); this->aboveGroundStatus = ENKAKASI_ABOVE_GROUND_TYPE; this->songSummonDist = 80.0f; EnKakasi_SetupIdleUnderground(this); @@ -1040,22 +1040,20 @@ void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { } void EnKakasi_SetupRiseOutOfGround(EnKakasi* this, PlayState* play) { - s32 cutsceneIndex; + s32 csIdIndex; - cutsceneIndex = 0; + csIdIndex = 0; if (this->aboveGroundStatus == ENKAKASI_ABOVE_GROUND_TYPE) { - cutsceneIndex = 1; + csIdIndex = 1; } - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actorCutscenes[cutsceneIndex]); - - } else if (ActorCutscene_GetCanPlayNext(this->actorCutscenes[cutsceneIndex]) == 0) { - ActorCutscene_SetIntentToPlay(this->actorCutscenes[cutsceneIndex]); - + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[csIdIndex]); + } else if (!CutsceneManager_IsNext(this->csIdList[csIdIndex])) { + CutsceneManager_Queue(this->csIdList[csIdIndex]); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actorCutscenes[cutsceneIndex], &this->picto.actor); + CutsceneManager_StartWithPlayerCs(this->csIdList[csIdIndex], &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_AKINDONUTS_HIDE); this->picto.actor.draw = EnKakasi_Draw; this->unkState196 = 6; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index c278ef050..cff35d183 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -21,7 +21,7 @@ typedef struct EnKakasi { /* 0x1A4 */ s32 unkCounter1A4; // counter, counts up to F while he digs away, reused elsewhere /* 0x1A8 */ s32 unkState1A8; /* 0x1AC */ s16 talkState; - /* 0x1AE */ s16 actorCutscenes[3]; + /* 0x1AE */ s16 csIdList[3]; /* 0x1B4 */ f32 animeFrameCount; /* 0x1B8 */ f32 unkHeight; /* 0x1BC */ Vec3f unk1BC; // set by post limbdraw func for one limb diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index eceaac242..c72aa9f5f 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -680,9 +680,9 @@ void func_80B27774(EnKendoJs* this, PlayState* play) { } void func_80B2783C(EnKendoJs* this, PlayState* play) { - if (this->actor.cutscene != -1) { + if (this->actor.csId != CS_ID_NONE) { Camera_ChangeDataIdx(play->cameraPtrs[CAM_ID_MAIN], - ActorCutscene_GetCutscene(this->actor.cutscene)->csCamSceneDataId); + CutsceneManager_GetCutsceneEntry(this->actor.csId)->csCamId); } } diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index d85924b14..f30f55a33 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -45,7 +45,7 @@ ActorInit En_Kgy_InitVars = { void EnKgy_Init(Actor* thisx, PlayState* play) { EnKgy* this = THIS; - s16 cs; + s16 csId; s32 i; Actor_SetScale(&this->actor, 0.01f); @@ -58,7 +58,8 @@ void EnKgy_Init(Actor* thisx, PlayState* play) { this->zubora = EnKgy_FindZubora(play); this->iceBlock = EnKgy_FindIceBlock(play); Flags_UnsetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); - if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (Flags_GetSwitch(play, ENKGY_GET_FE00(&this->actor)) || + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { Flags_SetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1); play->envCtx.lightSettingOverride = 1; SET_WEEKEVENTREG(WEEKEVENTREG_21_01); @@ -86,12 +87,12 @@ void EnKgy_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80B42D28; } - cs = this->actor.cutscene; - for (i = 0; i < ARRAY_COUNT(this->unk_2D4); i++) { - this->unk_2D4[i] = cs; - if (cs != -1) { - this->actor.cutscene = cs; - cs = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + csId = this->actor.csId; + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } @@ -227,14 +228,14 @@ void func_80B40EE8(EnKgy* this, PlayState* play) { } } - if ((this->unk_2E0 != -1) && (ActorCutscene_GetCurrentIndex() != this->unk_2D4[this->unk_2E0])) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D4[this->unk_2E0]); - } else if (ActorCutscene_GetCanPlayNext(this->unk_2D4[this->unk_2E0])) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[this->unk_2E0], &this->actor); + if ((this->csIdIndex != -1) && (CutsceneManager_GetCurrentCsId() != this->csIdList[this->csIdIndex])) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); + } else if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + CutsceneManager_StartWithPlayerCs(this->csIdList[this->csIdIndex], &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->unk_2D4[this->unk_2E0]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } @@ -304,7 +305,7 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) { case 0: this->unk_2B4 = this->unk_2A8; this->actor.focus.pos = this->unk_2A8; - this->unk_2E0 = 0; + this->csIdIndex = 0; break; case 1: @@ -312,7 +313,7 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) { this->unk_2B4 = this->zubora->actor.focus.pos; this->actor.focus.pos = this->zubora->actor.focus.pos; } - this->unk_2E0 = 1; + this->csIdIndex = 1; break; case 2: @@ -320,7 +321,7 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) { this->unk_2B4 = this->iceBlock->actor.world.pos; this->actor.focus.pos = this->iceBlock->actor.focus.pos; } - this->unk_2E0 = 2; + this->csIdIndex = 2; break; case 3: @@ -328,7 +329,7 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) { if (this->zubora != NULL) { this->actor.focus.pos = this->zubora->actor.focus.pos; } - this->unk_2E0 = 3; + this->csIdIndex = 3; break; case 4: @@ -336,13 +337,13 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) { this->unk_2B4 = this->zubora->actor.focus.pos; this->actor.focus.pos = this->zubora->actor.focus.pos; } - this->unk_2E0 = 4; + this->csIdIndex = 4; break; } } void func_80B41368(EnKgy* this, PlayState* play, s32 arg2) { - ActorCutscene_Stop(this->unk_2D4[this->unk_2E0]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); func_80B411DC(this, play, arg2); this->unk_2E6 = 20; this->unk_29C |= 2; @@ -353,8 +354,8 @@ void func_80B413C8(EnKgy* this) { this->unk_2B4 = sp1C; this->actor.focus.pos = sp1C; - ActorCutscene_Stop(this->unk_2D4[this->unk_2E0]); - this->unk_2E0 = -1; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = -1; this->unk_2E6 = 0; this->unk_29C &= ~2; } @@ -467,12 +468,12 @@ void func_80B417B8(EnKgy* this, PlayState* play) { void func_80B41858(EnKgy* this, PlayState* play) { func_80B4163C(this, play); - if (ActorCutscene_GetCanPlayNext(this->unk_2D4[5])) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[5], &this->actor); + if (CutsceneManager_IsNext(this->csIdList[5])) { + CutsceneManager_StartWithPlayerCs(this->csIdList[5], &this->actor); this->actionFunc = func_80B419B0; func_80B40E18(this, 7); } else { - ActorCutscene_SetIntentToPlay(this->unk_2D4[5]); + CutsceneManager_Queue(this->csIdList[5]); } } @@ -484,7 +485,7 @@ void func_80B418C4(EnKgy* this, PlayState* play) { Message_CloseTextbox(play); this->actor.textId = 0xC4F; func_80B413C8(this); - ActorCutscene_SetIntentToPlay(this->unk_2D4[5]); + CutsceneManager_Queue(this->csIdList[5]); this->actionFunc = func_80B41858; this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; } diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h index d9423783d..8207678fd 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h @@ -25,8 +25,8 @@ typedef struct EnKgy { /* 0x2C0 */ Vec3f unk_2C0; /* 0x2CC */ Vec3s unk_2CC; /* 0x2D2 */ s16 unk_2D2; - /* 0x2D4 */ s16 unk_2D4[6]; - /* 0x2E0 */ s16 unk_2E0; + /* 0x2D4 */ s16 csIdList[6]; + /* 0x2E0 */ s16 csIdIndex; /* 0x2E2 */ s16 unk_2E2; /* 0x2E4 */ s16 unk_2E4; /* 0x2E6 */ s16 unk_2E6; diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index 3e54fd0f9..f3005ca05 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -296,18 +296,18 @@ void EnKujiya_SetupTurnToOpen(EnKujiya* this) { } void EnKujiya_TurnToOpen(EnKujiya* this, PlayState* play) { - if (this->actor.cutscene != -1) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (this->actor.csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } if (!Math_SmoothStepToS(&this->actor.shape.rot.y, 0x7555, 0xA, 0x16C, 0x16C)) { if (this->timer > 20) { - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { + CutsceneManager_Stop(this->actor.csId); } EnKujiya_SetupWait(this); } else { @@ -324,18 +324,18 @@ void EnKujiya_SetupTurnToClosed(EnKujiya* this) { } void EnKujiya_TurnToClosed(EnKujiya* this, PlayState* play) { - if (this->actor.cutscene != -1) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (this->actor.csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } if (!Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 0xA, 0x16C, 0x16C)) { if (this->timer > 20) { - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { + CutsceneManager_Stop(this->actor.csId); } EnKujiya_SetupWait(this); } else { diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 4432fcf6d..b858fc502 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -329,7 +329,7 @@ void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { for (numBugs = 0; numBugs < 3; numBugs++) { Actor* bug = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, - this->actor.cutscene, this->actor.halfDaysBits, 0); + this->actor.csId, this->actor.halfDaysBits, 0); if (bug == NULL) { break; diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index e178e7a4e..8e2d194a6 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -100,10 +100,9 @@ void func_80A5B160(EnKusa2* this, PlayState* play) { if (this->unk_194[0] == NULL) { ptr = this->unk_194; - actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_KUSA2, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, - Rand_Next() >> 0x10, 0, 1, this->actor.cutscene, - this->actor.halfDaysBits, NULL); + actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene( + &play->actorCtx, play, ACTOR_EN_KUSA2, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, Rand_Next() >> 0x10, 0, 1, this->actor.csId, this->actor.halfDaysBits, NULL); *ptr = actor; if (*ptr != NULL) { @@ -119,7 +118,7 @@ void func_80A5B160(EnKusa2* this, PlayState* play) { actor = (EnKusa2*)Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_KUSA2, (Math_SinS(temp_s1) * 80.0f) + this->actor.world.pos.x, this->actor.world.pos.y, (Math_CosS(temp_s1) * 80.0f) + this->actor.world.pos.z, 0, Rand_Next() >> 0x10, - 0, 1, this->actor.cutscene, this->actor.halfDaysBits, NULL); + 0, 1, this->actor.csId, this->actor.halfDaysBits, NULL); *ptr = actor; if (*ptr != NULL) { (*ptr)->actor.room = this->actor.room; @@ -160,7 +159,7 @@ void func_80A5B3BC(EnKusa2* this) { void func_80A5B490(EnKusa2* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_KITAN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, - ENKUSA2_GET_7F00(&this->actor) << 9, this->actor.cutscene, this->actor.halfDaysBits, + ENKUSA2_GET_7F00(&this->actor) << 9, this->actor.csId, this->actor.halfDaysBits, NULL); } diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 0bbbce26a..1242de4ba 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -780,16 +780,16 @@ void EnMa4_SetupBeginEponasSongCs(EnMa4* this) { // Epona's Song cutscene is an ActorCutscene void EnMa4_BeginEponasSongCs(EnMa4* this, PlayState* play) { - s16 cutsceneIndex = this->actor.cutscene; + s16 csId = this->actor.csId; - if (ActorCutscene_GetCanPlayNext(cutsceneIndex) != 0) { - ActorCutscene_Start(cutsceneIndex, &this->actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_Start(csId, &this->actor); EnMa4_SetupEponasSongCs(this); } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(cutsceneIndex); + CutsceneManager_Queue(csId); } } @@ -798,17 +798,17 @@ void EnMa4_SetupEponasSongCs(EnMa4* this) { this->actionFunc = EnMa4_EponasSongCs; } -static u16 D_80AC0260 = 99; +static u16 sCueId = 99; void EnMa4_EponasSongCs(EnMa4* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 120)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 120); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_120)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_120); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - if (play->csCtx.actorActions[actionIndex]->action != D_80AC0260) { - D_80AC0260 = play->csCtx.actorActions[actionIndex]->action; + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + if (sCueId != play->csCtx.actorCues[cueChannel]->id) { + sCueId = play->csCtx.actorCues[cueChannel]->id; this->animTimer = 0; - switch (play->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->hasBow = true; EnMa4_ChangeAnim(this, 1); @@ -822,8 +822,8 @@ void EnMa4_EponasSongCs(EnMa4* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); - if (D_80AC0260 == 2 && this->animTimer == 0 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); + if (sCueId == 2 && this->animTimer == 0 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMa4_ChangeAnim(this, 7); } } else { @@ -831,7 +831,7 @@ void EnMa4_EponasSongCs(EnMa4* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; func_800B85E0(&this->actor, play, 200.0f, PLAYER_IA_MINUS1); - D_80AC0260 = 99; + sCueId = 99; this->hasBow = true; EnMa4_SetupEndEponasSongCs(this); } diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 89f1582ba..6d0b027eb 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -1005,14 +1005,14 @@ void EnMaYto_SetupBeginWarmFuzzyFeelingCs(EnMaYto* this) { } void EnMaYto_BeginWarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); EnMaYto_SetupWarmFuzzyFeelingCs(this); } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -1021,20 +1021,20 @@ void EnMaYto_SetupWarmFuzzyFeelingCs(EnMaYto* this) { this->actionFunc = EnMaYto_WarmFuzzyFeelingCs; } -static u16 D_80B915F0 = 99; +static u16 sCueId = 99; void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 556)) { - s32 csActionIndex = Cutscene_GetActorActionIndex(play, 556); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_556)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_556); - if (play->csCtx.frames == play->csCtx.actorActions[csActionIndex]->startFrame) { - u16 action = play->csCtx.actorActions[csActionIndex]->action; + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + u16 cueId = play->csCtx.actorCues[cueChannel]->id; if (1) {} - if (action != D_80B915F0) { - D_80B915F0 = action; - switch (action) { + if (cueId != sCueId) { + sCueId = cueId; + switch (cueId) { case 1: EnMaYto_ChangeAnim(this, 0); break; @@ -1051,13 +1051,13 @@ void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, csActionIndex); - if (D_80B915F0 == 2 && this->skelAnime.animation == &gCremiaHugStartAnim && + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); + if (sCueId == 2 && this->skelAnime.animation == &gCremiaHugStartAnim && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMaYto_ChangeAnim(this, 20); } } else { - D_80B915F0 = 99; + sCueId = 99; } } @@ -1068,7 +1068,7 @@ void EnMaYto_SetupPostMilkRunWaitDialogueEnd(EnMaYto* this) { void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE || Message_GetState(&play->msgCtx) == TEXT_STATE_5) { if (Message_ShouldAdvance(play) && Message_GetState(&play->msgCtx) == TEXT_STATE_5) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); Message_CloseTextbox(play); } } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index 1987fa72a..edf0e41f2 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -377,16 +377,16 @@ void EnMaYts_SetupEndCreditsHandler(EnMaYts* this) { this->actionFunc = EnMaYts_EndCreditsHandler; } -static u16 D_80B8E32C = 99; +static u16 sCueId = 99; void EnMaYts_EndCreditsHandler(EnMaYts* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 120)) { - s32 actionIndex = Cutscene_GetActorActionIndex(play, 120); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_120)) { + s32 cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_120); - if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) { - if (play->csCtx.actorActions[actionIndex]->action != D_80B8E32C) { - D_80B8E32C = play->csCtx.actorActions[actionIndex]->action; + if (play->csCtx.curFrame == play->csCtx.actorCues[cueChannel]->startFrame) { + if (sCueId != play->csCtx.actorCues[cueChannel]->id) { + sCueId = play->csCtx.actorCues[cueChannel]->id; this->endCreditsFlag = 0; - switch (play->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->hasBow = true; EnMaYts_ChangeAnim(this, 0); @@ -410,14 +410,14 @@ void EnMaYts_EndCreditsHandler(EnMaYts* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); - if ((D_80B8E32C == 2) && (this->endCreditsFlag == 0) && + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); + if ((sCueId == 2) && (this->endCreditsFlag == 0) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->endCreditsFlag++; EnMaYts_ChangeAnim(this, 5); } } else { - D_80B8E32C = 99; + sCueId = 99; this->hasBow = true; } } diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 513964338..15aa42bda 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -239,7 +239,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { - if (!EnvFlags_Get(play, 4)) { + if (!CutsceneFlags_Get(play, 4)) { play_sound(NA_SE_SY_PIECE_OF_HEART); this->state = MAG_STATE_CALLED; this->unk11F00 = 0; @@ -383,16 +383,16 @@ void EnMag_Update(Actor* thisx, PlayState* play) { CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { if (play->transitionTrigger != TRANS_TRIGGER_START) { Audio_SetCutsceneFlag(false); - D_801BB12C++; - if (D_801BB12C >= 2) { - D_801BB12C = 0; + gOpeningEntranceIndex++; + if (gOpeningEntranceIndex >= 2) { + gOpeningEntranceIndex = 0; } play_sound(NA_SE_SY_PIECE_OF_HEART); gSaveContext.gameMode = GAMEMODE_FILE_SELECT; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; play->nextEntrance = ENTRANCE(CUTSCENE, 0); - gSaveContext.save.cutscene = 0; + gSaveContext.save.cutsceneIndex = 0; gSaveContext.sceneLayer = 0; } this->unk11F54 = 15; @@ -438,12 +438,12 @@ void EnMag_Update(Actor* thisx, PlayState* play) { } if (this->state == MAG_STATE_INITIAL) { - if (EnvFlags_Get(play, 3)) { + if (CutsceneFlags_Get(play, 3)) { this->unk11F02 = 40; this->state = MAG_STATE_FADE_IN_MASK_EFFECTS; } } else if (this->state < MAG_STATE_FADE_OUT) { - if (EnvFlags_Get(play, 4)) { + if (CutsceneFlags_Get(play, 4)) { this->state = MAG_STATE_FADE_OUT; } } diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 2a81da583..7ac16e1b0 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -263,7 +263,7 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { break; case 0xD82: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { Message_ContinueTextbox(play, 0xD83); } else { Message_ContinueTextbox(play, 0xD86); @@ -277,9 +277,9 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { Message_CloseTextbox(play); EnMinifrog_SpawnDust(this, play); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_NPC_FADEAWAY); - if (this->actor.cutscene != -1) { - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); + if (this->actor.csId != CS_ID_NONE) { + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { + CutsceneManager_Stop(this->actor.csId); } } @@ -289,14 +289,14 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, PlayState* play) { } if (this->flags & 1) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); this->flags &= ~1; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } @@ -319,7 +319,7 @@ void EnMinifrog_Idle(EnMinifrog* this, PlayState* play) { EnMinifrog_JumpTimer(this); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = EnMinifrog_ReturnFrogCutscene; - if (this->actor.cutscene != -1) { + if (this->actor.csId != CS_ID_NONE) { this->flags |= 1; } } else if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && @@ -366,19 +366,19 @@ void EnMinifrog_CheckChoirSuccess(EnMinifrog* this, PlayState* play) { void EnMinifrog_ContinueChoirCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { EnMinifrog_CheckChoirSuccess(this, play); return; // necessary to match - } else if (ActorCutscene_GetCanPlayNext(0x7C)) { - ActorCutscene_Start(0x7C, NULL); + } else if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { + CutsceneManager_Start(CS_ID_GLOBAL_TALK, NULL); EnMinifrog_CheckChoirSuccess(this, play); return; // necessary to match - } else if (this->actor.cutscene != -1 && ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); - ActorCutscene_SetIntentToPlay(0x7C); + } else if ((this->actor.csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() == this->actor.csId)) { + CutsceneManager_Stop(this->actor.csId); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); return; // necessary to match } else { - ActorCutscene_SetIntentToPlay(0x7C); + CutsceneManager_Queue(CS_ID_GLOBAL_TALK); } } @@ -440,20 +440,20 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, PlayState* play) { void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, PlayState* play) { EnMinifrog_Jump(this); - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { this->actionFunc = EnMinifrog_SetupNextFrogChoir; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); this->actionFunc = EnMinifrog_SetupNextFrogChoir; this->timer = 5; func_801A1F00(3, NA_BGM_FROG_SONG); this->flags |= 0x100; play->setPlayerTalkAnim(play, &gPlayerAnim_pn_gakkiplay, ANIMMODE_LOOP); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 930fb13d5..616481d85 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -76,7 +76,7 @@ s32 func_809592E0(EnMk* this, s16 index) { void EnMk_Init(Actor* thisx, PlayState* play) { EnMk* this = THIS; - s16 cs; + s16 csId; s32 i; this->actor.terminalVelocity = -4.0f; @@ -101,16 +101,16 @@ void EnMk_Init(Actor* thisx, PlayState* play) { this->unk_27A |= 2; } - cs = this->actor.cutscene; - for (i = 0; i < ARRAY_COUNT(this->unk_276); i++) { - this->unk_276[i] = cs; - if (cs != -1) { - this->actor.cutscene = cs; - cs = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + csId = this->actor.csId; + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } - this->actor.cutscene = this->unk_276[0]; + this->actor.csId = this->csIdList[0]; } void EnMk_Destroy(Actor* thisx, PlayState* play) { @@ -124,16 +124,16 @@ s32 func_80959524(PlayState* play) { } void func_8095954C(EnMk* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 0x7F)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 0x7F)); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_127)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)); - switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x7F)]->action) { + switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)]->id) { case 1: case 2: case 3: case 4: case 5: - func_809592E0(this, play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x7F)]->action - 1); + func_809592E0(this, play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)]->id - 1); break; } } else { @@ -147,7 +147,7 @@ void func_80959624(EnMk* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (this->unk_27A & 4) { textId = 0xFB9; - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { textId = 0xFBC; } else { textId = 0xFBB; @@ -212,7 +212,7 @@ void func_80959844(EnMk* this, PlayState* play) { switch (gSaveContext.save.playerForm) { case PLAYER_FORM_DEKU: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_10)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { textId = 0xFAF; } else { textId = 0xFAE; @@ -224,7 +224,7 @@ void func_80959844(EnMk* this, PlayState* play) { case PLAYER_FORM_GORON: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_08)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { textId = 0xFAB; } else { textId = 0xFAA; @@ -239,7 +239,7 @@ void func_80959844(EnMk* this, PlayState* play) { if (func_80959524(play) > 0) { textId = 0xFA7; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_04)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { textId = 0xFBF; } else { textId = 0xFA6; @@ -283,7 +283,7 @@ void func_80959A24(EnMk* this, PlayState* play) { break; case 0xFA2: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Message_CloseTextbox(play); this->actionFunc = func_80959E18; } else { @@ -314,7 +314,7 @@ void func_80959A24(EnMk* this, PlayState* play) { case 0xFA8: SET_WEEKEVENTREG(WEEKEVENTREG_19_08); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Message_ContinueTextbox(play, 0xFBD); } else { Message_ContinueTextbox(play, 0xFA9); @@ -323,7 +323,7 @@ void func_80959A24(EnMk* this, PlayState* play) { case 0xFAC: SET_WEEKEVENTREG(WEEKEVENTREG_19_10); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Message_ContinueTextbox(play, 0xFBE); } else { Message_ContinueTextbox(play, 0xFAD); @@ -372,7 +372,7 @@ void func_80959C94(EnMk* this, PlayState* play) { void func_80959D28(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((play->csCtx.state == 0) && (this->actor.cutscene == -1)) { + if ((play->csCtx.state == 0) && (this->actor.csId == CS_ID_NONE)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_40)) { this->unk_27A &= ~1; this->actionFunc = func_80959774; @@ -381,14 +381,14 @@ void func_80959D28(EnMk* this, PlayState* play) { } else { this->actionFunc = func_80959E18; } - this->actor.cutscene = this->unk_276[0]; + this->actor.csId = this->csIdList[0]; } else { - if (this->actor.cutscene != -1) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - this->actor.cutscene = -1; + if (this->actor.csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); + this->actor.csId = CS_ID_NONE; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } func_8095954C(this, play); @@ -412,13 +412,13 @@ void func_80959E18(EnMk* this, PlayState* play) { play->msgCtx.ocarinaMode = 4; this->actionFunc = func_80959D28; if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { - this->actor.cutscene = this->unk_276[0]; + this->actor.csId = this->csIdList[0]; SET_WEEKEVENTREG(WEEKEVENTREG_20_40); Item_Give(play, ITEM_SONG_NOVA); } else { - this->actor.cutscene = this->unk_276[1]; + this->actor.csId = this->csIdList[1]; } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80959844(this, play); this->actionFunc = func_80959A24; @@ -449,7 +449,7 @@ void EnMk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if ((this->unk_27A & 1) && !Cutscene_CheckActorAction(play, 0x7F)) { + if ((this->unk_27A & 1) && !Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_127)) { Actor_TrackPlayer(play, &this->actor, &this->unk_270, &sp38, this->actor.focus.pos); } else { Math_SmoothStepToS(&this->unk_270.x, 0, 6, 0x1838, 0x64); diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.h b/src/overlays/actors/ovl_En_Mk/z_en_mk.h index bbf126f4e..518b0406d 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.h +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.h @@ -15,7 +15,7 @@ typedef struct EnMk { /* 0x1D4 */ Vec3s jointTable[OBJECT_MK_LIMB_MAX]; /* 0x222 */ Vec3s morphTable[OBJECT_MK_LIMB_MAX]; /* 0x270 */ Vec3s unk_270; - /* 0x276 */ s16 unk_276[2]; + /* 0x276 */ s16 csIdList[2]; /* 0x27A */ u16 unk_27A; /* 0x27C */ s16 unk_27C; /* 0x280 */ EnMkActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 3aef8341a..67a0a1e77 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -87,7 +87,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) { func_80965BBC(this); return; } - if (this->actor.cutscene >= 0) { + if (this->actor.csId >= 0) { action = func_80965D3C; } else { action = func_80965DB4; @@ -102,13 +102,13 @@ void EnMm_Destroy(Actor* thisx, PlayState* play) { } void func_80965D3C(EnMm* this, PlayState* play) { - s16 cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + s16 csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); - if (ActorCutscene_GetCanPlayNext(cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(cutscene, &this->actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); EnMm_SetupAction(this, func_80965DB4); } else { - ActorCutscene_SetIntentToPlay(cutscene); + CutsceneManager_Queue(csId); } } diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index e772e12fa..c94a94b12 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -235,7 +235,7 @@ s32 EnMttag_UpdateCheckpoints(EnMttag* this, PlayState* play) { s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType) { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; play->nextEntrance = ENTRANCE(GORON_RACETRACK, 2); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; } else { @@ -256,7 +256,7 @@ s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; Message_StartTextbox(play, 0xE95, NULL); // An entrant made a false start - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); this->actionFunc = EnMttag_PotentiallyRestartRace; } @@ -267,7 +267,7 @@ void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { */ void EnMttag_ShowCantWinMessage(EnMttag* this, PlayState* play) { Message_StartTextbox(play, 0xE97, NULL); // You can't win now... - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); this->actionFunc = EnMttag_HandleCantWinChoice; } @@ -275,11 +275,11 @@ void EnMttag_ShowCantWinMessage(EnMttag* this, PlayState* play) { * Shows the cutscene that pans over the race track and shows all five race entrants. */ void EnMttag_ShowIntroCutscene(EnMttag* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = EnMttag_WaitForIntroCutsceneToEnd; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -288,7 +288,7 @@ void EnMttag_ShowIntroCutscene(EnMttag* this, PlayState* play) { * from showing again and starts the race. */ void EnMttag_WaitForIntroCutsceneToEnd(EnMttag* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() != this->actor.csId) { SET_WEEKEVENTREG(WEEKEVENTREG_12_02); this->actionFunc = EnMttag_RaceStart; } @@ -421,7 +421,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { if (this->shouldRestartRace) { play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1); - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { // Spring gSaveContext.nextCutsceneIndex = 0xFFF0; } else { @@ -433,7 +433,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; Message_CloseTextbox(play); - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); Magic_Add(play, MAGIC_FILL_TO_CAPACITY); CLEAR_EVENTINF(EVENTINF_10); @@ -468,7 +468,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { // Keep racing func_8019F208(); Message_CloseTextbox(play); - func_800B7298(play, &this->actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->actor, PLAYER_CSMODE_END); CLEAR_EVENTINF(EVENTINF_13); this->timer = 100; this->actionFunc = EnMttag_Race; diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index 2d77519bd..4bf4db0e0 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -178,7 +178,7 @@ void func_80A68A78(EnMushi2* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_MUSHI2, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y + (D_80A6B998 + i)->unk_02, this->actor.shape.rot.z, - (D_80A6B998 + i)->unk_00, this->actor.cutscene, this->actor.halfDaysBits, NULL); + (D_80A6B998 + i)->unk_00, this->actor.csId, this->actor.halfDaysBits, NULL); } } diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index b5d558a71..c5a8b2498 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -227,31 +227,31 @@ Actor* func_80BBFF90(EnNb* this, PlayState* play) { return actor; } -s32 func_80BBFFD4(EnNb* this, s16 index) { +s32 func_80BBFFD4(EnNb* this, s16 csId) { s32 ret = false; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(index); - } else if (ActorCutscene_GetCanPlayNext(index)) { - ActorCutscene_StartAndSetUnkLinkFields(index, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(csId); + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); ret = true; } else { - ActorCutscene_SetIntentToPlay(index); + CutsceneManager_Queue(csId); } return ret; } -s16 func_80BC0050(EnNb* this, s32 arg1) { - s16 cutscene = this->actor.cutscene; +s16 func_80BC0050(EnNb* this, s32 numCutscenes) { + s16 csId = this->actor.csId; s32 i; - for (i = 0; i < arg1; i++) { - cutscene = ActorCutscene_GetAdditionalCutscene(cutscene); + for (i = 0; i < numCutscenes; i++) { + csId = CutsceneManager_GetAdditionalCsId(csId); } - return cutscene; + return csId; } typedef enum EnNbBehaviour { @@ -269,12 +269,12 @@ typedef enum EnNbBehaviour { s32 func_80BC00AC(Actor* thisx, PlayState* play) { EnNb* this = THIS; - s16 cutscene = func_80BC0050(this, 0); + s16 csId = func_80BC0050(this, 0); s32 ret = false; switch (this->behaviour) { case ENNB_BEHAVIOUR_0: - if (!func_80BBFFD4(this, cutscene)) { + if (!func_80BBFFD4(this, csId)) { break; } // fallthrough @@ -282,7 +282,7 @@ s32 func_80BC00AC(Actor* thisx, PlayState* play) { case ENNB_BEHAVIOUR_4: case ENNB_BEHAVIOUR_6: case ENNB_BEHAVIOUR_8: - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(cutscene)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), &this->actor); this->behaviour++; ret = true; break; @@ -292,7 +292,7 @@ s32 func_80BC00AC(Actor* thisx, PlayState* play) { case ENNB_BEHAVIOUR_5: case ENNB_BEHAVIOUR_7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(cutscene)), + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), this->actor.child); } this->behaviour++; @@ -300,7 +300,7 @@ s32 func_80BC00AC(Actor* thisx, PlayState* play) { break; case ENNB_BEHAVIOUR_9: - ActorCutscene_Stop(cutscene); + CutsceneManager_Stop(csId); this->behaviour++; ret = true; break; @@ -745,7 +745,7 @@ void EnNb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnNb* this = THIS; Vec3f focusTarget; - if ((ActorCutscene_GetCurrentIndex() == -1) && (limbIndex == NB_LIMB_HEAD)) { + if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == NB_LIMB_HEAD)) { Matrix_MultVec3f(&gZeroVec3f, &focusTarget); Math_ApproachF(&thisx->focus.pos.x, focusTarget.x, 0.6f, 10000.0f); Math_ApproachF(&thisx->focus.pos.y, focusTarget.y, 0.6f, 10000.0f); diff --git a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c index 929a3c90d..cd20f489c 100644 --- a/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c +++ b/src/overlays/actors/ovl_En_Onpuman/z_en_onpuman.c @@ -86,14 +86,14 @@ Actor* func_80B11F44(PlayState* play) { void func_80B11F78(EnOnpuman* this, PlayState* play) { if (play->msgCtx.ocarinaMode == 4) { this->actionFunc = func_80B121D8; - if (this->actor.cutscene != -1) { - ActorCutscene_Stop(this->actor.cutscene); + if (this->actor.csId != CS_ID_NONE) { + CutsceneManager_Stop(this->actor.csId); } } else if (play->msgCtx.ocarinaMode == 3) { play_sound(NA_SE_SY_CORRECT_CHIME); play->msgCtx.ocarinaMode = 4; - if (this->actor.cutscene != -1) { - ActorCutscene_Stop(this->actor.cutscene); + if (this->actor.csId != CS_ID_NONE) { + CutsceneManager_Stop(this->actor.csId); } this->actionFunc = func_80B121D8; } @@ -126,13 +126,13 @@ void func_80B1202C(EnOnpuman* this, PlayState* play2) { } } if (this->unk_2A4 & 1) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { this->unk_2A4 &= ~1; - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + } else if (CutsceneManager_IsNext(this->actor.csId)) { this->unk_2A4 &= ~1; - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } diff --git a/src/overlays/actors/ovl_En_Osk/z_en_osk.c b/src/overlays/actors/ovl_En_Osk/z_en_osk.c index 2b938a35f..3f10f6771 100644 --- a/src/overlays/actors/ovl_En_Osk/z_en_osk.c +++ b/src/overlays/actors/ovl_En_Osk/z_en_osk.c @@ -66,7 +66,7 @@ void EnOsk_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BF5F60; this->unk_254 = -1; - this->unk_256 = -1; + this->cueId = -1; this->actor.flags &= ~ACTOR_FLAG_1; switch (ENOSK_GET_F(&this->actor)) { @@ -75,7 +75,7 @@ void EnOsk_Init(Actor* thisx, PlayState* play) { this->jointTable, this->morphTable, 7); Animation_PlayLoop(&this->skelAnime, &object_ikn_demo_Anim_006808); this->actionFunc = func_80BF656C; - this->unk_258 = 0x210; + this->cueType = CS_CMD_ACTOR_CUE_528; break; case ENOSK_2: @@ -83,7 +83,7 @@ void EnOsk_Init(Actor* thisx, PlayState* play) { this->jointTable, this->morphTable, 7); Animation_PlayLoop(&this->skelAnime, &object_ikn_demo_Anim_006808); this->actionFunc = func_80BF6A20; - this->unk_258 = 0x211; + this->cueType = CS_CMD_ACTOR_CUE_529; break; default: @@ -92,7 +92,7 @@ void EnOsk_Init(Actor* thisx, PlayState* play) { this->jointTable, this->morphTable, 17); Animation_PlayLoop(&this->skelAnime, &object_ikn_demo_Anim_0000B8); this->actionFunc = func_80BF61EC; - this->unk_258 = 0x212; + this->cueType = CS_CMD_ACTOR_CUE_530; this->actor.home.rot.z = 0; this->unk_25C = 0.0f; break; @@ -129,12 +129,12 @@ void func_80BF5F60(EnOsk* this, PlayState* play) { } void func_80BF5F70(EnOsk* this) { - if ((this->unk_256 != 1) && (this->unk_256 != 6)) { + if ((this->cueId != 1) && (this->cueId != 6)) { this->actor.draw = EnOsk_Draw; Actor_SetScale(&this->actor, 0.017f); } - switch (this->unk_256) { + switch (this->cueId) { case 1: this->actor.draw = NULL; break; @@ -205,10 +205,10 @@ void func_80BF609C(EnOsk* this, PlayState* play) { void func_80BF61EC(EnOsk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(play, this->unk_258)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->unk_258)); - if (this->unk_256 != play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action) { - this->unk_256 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action; + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + if (this->cueId != play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id) { + this->cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; func_80BF5F70(this); } func_80BF609C(this, play); @@ -216,7 +216,7 @@ void func_80BF61EC(EnOsk* this, PlayState* play) { this->actor.draw = NULL; } - if (this->unk_256 == 6) { + if (this->cueId == 6) { if (this->actor.scale.x > 0.85f * 0.001f) { this->actor.scale.x -= 0.85f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); @@ -229,12 +229,12 @@ void func_80BF61EC(EnOsk* this, PlayState* play) { } void func_80BF6314(EnOsk* this) { - if ((this->unk_256 != 1) && (this->unk_256 != 9)) { + if ((this->cueId != 1) && (this->cueId != 9)) { this->actor.draw = EnOsk_Draw; Actor_SetScale(&this->actor, 0.013f); } - switch (this->unk_256) { + switch (this->cueId) { case 1: this->actor.draw = NULL; break; @@ -329,10 +329,10 @@ void func_80BF656C(EnOsk* this, PlayState* play) { } } - if (Cutscene_CheckActorAction(play, this->unk_258)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->unk_258)); - if (this->unk_256 != play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action) { - this->unk_256 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action; + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + if (this->cueId != play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id) { + this->cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; func_80BF6314(this); } func_80BF6478(this); @@ -340,12 +340,12 @@ void func_80BF656C(EnOsk* this, PlayState* play) { this->actor.draw = NULL; } - if ((this->unk_256 == 2) && (this->actor.scale.x < 13.0f * 0.001f)) { + if ((this->cueId == 2) && (this->actor.scale.x < 13.0f * 0.001f)) { this->actor.scale.x += 0.65f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); } - if (this->unk_256 == 9) { + if (this->cueId == 9) { if (this->actor.scale.x > 0.65f * 0.001f) { this->actor.scale.x -= 0.65f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); @@ -358,12 +358,12 @@ void func_80BF656C(EnOsk* this, PlayState* play) { } void func_80BF67A8(EnOsk* this) { - if ((this->unk_256 != 1) && (this->unk_256 != 8)) { + if ((this->cueId != 1) && (this->cueId != 8)) { this->actor.draw = EnOsk_Draw; Actor_SetScale(&this->actor, 0.013f); } - switch (this->unk_256) { + switch (this->cueId) { case 1: this->actor.draw = NULL; break; @@ -466,10 +466,10 @@ void func_80BF6A20(EnOsk* this, PlayState* play) { } } - if (Cutscene_CheckActorAction(play, this->unk_258)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->unk_258)); - if (this->unk_256 != play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action) { - this->unk_256 = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->unk_258)]->action; + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + if (this->cueId != play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id) { + this->cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; func_80BF67A8(this); } func_80BF68E0(this); @@ -477,7 +477,7 @@ void func_80BF6A20(EnOsk* this, PlayState* play) { this->actor.draw = NULL; } - if (this->unk_256 == 8) { + if (this->cueId == 8) { if (this->actor.scale.x > 0.65f * 0.001f) { this->actor.scale.x -= 0.65f * 0.001f; Actor_SetScale(&this->actor, this->actor.scale.x); diff --git a/src/overlays/actors/ovl_En_Osk/z_en_osk.h b/src/overlays/actors/ovl_En_Osk/z_en_osk.h index 0358911d3..c83cc5d91 100644 --- a/src/overlays/actors/ovl_En_Osk/z_en_osk.h +++ b/src/overlays/actors/ovl_En_Osk/z_en_osk.h @@ -18,8 +18,8 @@ typedef struct EnOsk { /* 0x188 */ Vec3s jointTable[17]; /* 0x1EE */ Vec3s morphTable[17]; /* 0x254 */ s16 unk_254; - /* 0x256 */ s16 unk_256; - /* 0x258 */ u16 unk_258; + /* 0x256 */ s16 cueId; + /* 0x258 */ u16 cueType; /* 0x25C */ f32 unk_25C; /* 0x260 */ EnOskActionFunc actionFunc; } EnOsk; // size = 0x264 diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index e5540a292..6cc29578a 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -692,14 +692,14 @@ void EnOsn_HandleConversation(EnOsn* this, PlayState* play) { } void EnOsn_InitCutscene(EnOsn* this) { - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) || (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] != ITEM_NONE) || (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); } } } @@ -707,7 +707,7 @@ void EnOsn_InitCutscene(EnOsn* this) { void EnOsn_ChooseAction(EnOsn* this, PlayState* play) { u32 isFlagSet = Flags_GetSwitch(play, 0); - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, OSN_ANIM_IDLE); if (!isFlagSet) { @@ -739,27 +739,27 @@ void EnOsn_Idle(EnOsn* this, PlayState* play) { } void EnOsn_StartCutscene(EnOsn* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->actor); this->actionFunc = EnOsn_HandleCsAction; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) { u8 pad; - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 130)) { - actionIndex = Cutscene_GetActorActionIndex(play, 130); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_130)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_130); this->shouldRotateHead = false; - if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { - this->csAction = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->animIndex = OSN_ANIM_BOWING; break; @@ -852,7 +852,7 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) { } if ((this->animIndex == OSN_ANIM_BELIEVE) && (play->sceneId == SCENE_SPOT00) && - (gSaveContext.sceneLayer == 0xB) && (play->csCtx.frames == 400)) { + (gSaveContext.sceneLayer == 0xB) && (play->csCtx.curFrame == 400)) { Actor_PlaySfx(&this->actor, NA_SE_VO_OMVO00); } @@ -874,10 +874,10 @@ void EnOsn_HandleCsAction(EnOsn* this, PlayState* play) { (Animation_OnFrame(&this->skelAnime, 57.0f)) || (Animation_OnFrame(&this->skelAnime, 67.0f)))) { Actor_PlaySfx(&this->actor, NA_SE_EV_OMENYA_WALK); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } else { this->shouldRotateHead = true; - this->csAction = 0x63; + this->cueId = 99; EnOsn_ChooseAction(this, play); } } diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.h b/src/overlays/actors/ovl_En_Osn/z_en_osn.h index 638f31e4e..906c0b6c9 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.h +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.h @@ -26,8 +26,8 @@ typedef struct EnOsn { /* 0x1E4 */ UNK_TYPE1 unk_1E4[0x6]; /* 0x1EA */ u16 stateFlags; /* 0x1EC */ u8 animIndex; - /* 0x1ED */ u8 csAction; - /* 0x1EE */ s16 cutscene; + /* 0x1ED */ u8 cueId; + /* 0x1EE */ s16 csId; /* 0x1F0 */ u8 shouldRotateHead; /* 0x1F1 */ UNK_TYPE1 unk_1F1[0x3]; /* 0x1F4 */ u16 textId; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index c26a1a2c7..2444acca5 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -310,7 +310,7 @@ void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { play->interfaceCtx.unk_222 = 0; play->interfaceCtx.unk_224 = 0; if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; } if (this->actor.params == ENOSSAN_CURIOSITY_SHOP_MAN) { @@ -369,11 +369,11 @@ void EnOssan_Idle(EnOssan* this, PlayState* play) { player->stateFlags2 |= PLAYER_STATE2_20000000; EnOssan_SetupAction(this, EnOssan_BeginInteraction); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } } else { @@ -397,11 +397,11 @@ void EnOssan_BeginInteraction(EnOssan* this, PlayState* play) { frameCount = 0; } if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } if (this->actor.params == ENOSSAN_CURIOSITY_SHOP_MAN) { @@ -622,11 +622,11 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) { u8 cursorIndex; if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } else { if (talkState == TEXT_STATE_CHOICE) { @@ -676,26 +676,26 @@ void EnOssan_TalkToShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_LookToLeftShelf(EnOssan* this, PlayState* play) { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; } if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToLeftShelfCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToLeftShelfCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } else { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; EnOssan_UpdateCursorPos(play, this); EnOssan_SetupAction(this, EnOssan_BrowseLeftShelf); Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } this->stickAccumX = 0; @@ -704,26 +704,26 @@ void EnOssan_LookToLeftShelf(EnOssan* this, PlayState* play) { void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play) { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; } if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToRightShelfCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToRightShelfCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } else { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; EnOssan_UpdateCursorPos(play, this); EnOssan_SetupAction(this, EnOssan_BrowseRightShelf); Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } this->stickAccumX = 0; @@ -956,24 +956,24 @@ void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) { void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, PlayState* play) { if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; } if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopKeeperFromShelfCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopKeeperFromShelfCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; EnOssan_UpdateCursorPos(play, this); EnOssan_StartShopping(play, this); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -1006,7 +1006,7 @@ void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) { switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; } func_8019F208(); @@ -1103,11 +1103,11 @@ void EnOssan_SetupItemPurchased(EnOssan* this, PlayState* play) { play->msgCtx.stateTimer = 4; EnOssan_SetupAction(this, EnOssan_ItemPurchased); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } @@ -1158,17 +1158,17 @@ void EnOssan_ItemPurchased(EnOssan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); player->stateFlags2 |= PLAYER_STATE2_20000000; EnOssan_SetupAction(this, EnOssan_ContinueShopping); this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -1474,7 +1474,7 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play) { this->cursorPos.y = this->cursorPos.x = 100.0f; this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED; - this->cutscene = this->lookToShopkeeperCutscene; + this->csId = this->lookToShopkeeperCsId; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.cylRadius = 50; this->stickAccumX = this->stickAccumY = 0; @@ -1538,10 +1538,10 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play) { } void EnOssan_GetCutscenes(EnOssan* this, PlayState* play) { - this->lookToShopkeeperCutscene = this->actor.cutscene; - this->lookToLeftShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShopkeeperCutscene); - this->lookToRightShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToLeftShelfCutscene); - this->lookToShopKeeperFromShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToRightShelfCutscene); + this->lookToShopkeeperCsId = this->actor.csId; + this->lookToLeftShelfCsId = CutsceneManager_GetAdditionalCsId(this->lookToShopkeeperCsId); + this->lookToRightShelfCsId = CutsceneManager_GetAdditionalCsId(this->lookToLeftShelfCsId); + this->lookToShopKeeperFromShelfCsId = CutsceneManager_GetAdditionalCsId(this->lookToRightShelfCsId); } void EnOssan_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index a4787cc14..c5de183d5 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -43,11 +43,11 @@ typedef struct EnOssan { /* 0x2B0 */ u8 arrowAnimState; /* 0x2B1 */ u8 stickAnimState; /* 0x2B4 */ f32 shopItemSelectedTween; - /* 0x2B8 */ s16 lookToShopkeeperCutscene; - /* 0x2BA */ s16 lookToLeftShelfCutscene; - /* 0x2BC */ s16 lookToRightShelfCutscene; - /* 0x2BE */ s16 lookToShopKeeperFromShelfCutscene; - /* 0x2C0 */ s16 cutscene; + /* 0x2B8 */ s16 lookToShopkeeperCsId; + /* 0x2BA */ s16 lookToLeftShelfCsId; + /* 0x2BC */ s16 lookToRightShelfCsId; + /* 0x2BE */ s16 lookToShopKeeperFromShelfCsId; + /* 0x2C0 */ s16 csId; /* 0x2C2 */ s16 cutsceneState; /* 0x2C4 */ u16 textId; /* 0x2C6 */ Vec3s headRot; diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index b98fb8971..a4d820364 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -161,7 +161,7 @@ void EnOt_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.z = 0; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.gravity = 0.0f; - SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIndex); this->skelAnime.curFrame = Rand_ZeroOne() * this->skelAnime.endFrame; this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); @@ -300,20 +300,20 @@ void func_80B5BB38(Color_RGB8* arg0, Color_RGB8* arg1, f32 arg2) { void func_80B5BDA8(EnOt* this, PlayState* play) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIndex); - SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); this->actionFunc = func_80B5BE04; } void func_80B5BE04(EnOt* this, PlayState* play) { switch (this->unk_388) { case 0: - if (SubS_StartActorCutscene(&this->actor, this->cutscenes[2], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->actor, this->csIdList[2], CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { func_80B5BF60(this, play); } break; case 1: - if (SubS_StartActorCutscene(&this->actor, this->cutscenes[3], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->actor, this->csIdList[3], CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { func_80B5BF60(this, play); } break; @@ -508,11 +508,11 @@ void func_80B5C6DC(EnOt* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_84_10); switch (this->unk_388) { case 0: - ActorCutscene_Stop(this->cutscenes[2]); + CutsceneManager_Stop(this->csIdList[2]); break; case 1: - ActorCutscene_Stop(this->cutscenes[3]); + CutsceneManager_Stop(this->csIdList[3]); break; } this->unk_73C = -1; @@ -591,7 +591,7 @@ void func_80B5CA30(EnOt* this, PlayState* play) { } void func_80B5CAD0(EnOt* this, PlayState* play) { - SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes) / 2); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList) / 2); this->actionFunc = func_80B5CB0C; } @@ -626,7 +626,7 @@ void func_80B5CC88(EnOt* this, PlayState* play) { } void func_80B5CCA0(EnOt* this, PlayState* play) { - if (SubS_StartActorCutscene(&this->actor, this->cutscenes[0], 0x7C, SUBS_CUTSCENE_NORMAL)) { + if (SubS_StartCutscene(&this->actor, this->csIdList[0], CS_ID_GLOBAL_TALK, SUBS_CUTSCENE_NORMAL)) { Player* player = GET_PLAYER(play); player->stateFlags2 |= PLAYER_STATE2_20000000; @@ -665,7 +665,7 @@ void func_80B5CD40(EnOt* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1069)) { this->unk_32C |= 4; - ActorCutscene_Stop(this->cutscenes[0]); + CutsceneManager_Stop(this->csIdList[0]); player->stateFlags2 &= ~PLAYER_STATE2_20000000; func_80B5CE6C(this, play); } @@ -993,7 +993,7 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { func_80B5B2E0(play, &this->actor.world.pos, ENOT_GET_7F(&this->actor), &sp50, &this->unk_340); if (Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_OT, sp50.x, sp50.y, sp50.z, 0, this->actor.shape.rot.y, 1, ENOT_GET_3FFF(&this->actor) | 0x8000, - this->actor.cutscene, this->actor.halfDaysBits, NULL) != NULL) { + this->actor.csId, this->actor.halfDaysBits, NULL) != NULL) { this->unk_32C |= 8; } } else if (D_80B5E888 != NULL) { @@ -1011,7 +1011,7 @@ void func_80B5DB6C(Actor* thisx, PlayState* play) { temp->unk_32C |= 8; temp->unk_346 = ENOT_GET_7F(&this->actor); temp->actor.params = this->actor.params; - temp->actor.cutscene = this->actor.cutscene; + temp->actor.csId = this->actor.csId; this->unk_32C |= 8; } } else if (SurfaceType_IsHorseBlocked(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId)) { diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.h b/src/overlays/actors/ovl_En_Ot/z_en_ot.h index 7e8d7f651..8b01c6654 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.h +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.h @@ -45,7 +45,7 @@ typedef struct EnOt { /* 0x346 */ s16 unk_346; /* 0x348 */ Vec3f unk_348; /* 0x354 */ s16 unk_354; - /* 0x356 */ s16 cutscenes[4]; + /* 0x356 */ s16 csIdList[4]; /* 0x360 */ struct EnOt* unk_360; /* 0x364 */ LightNode* lightNode; /* 0x368 */ LightInfo lightInfo; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index a5bb03a72..f71d227f6 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -102,19 +102,19 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { s32 pad; EnOwl* this = THIS; s32 i; - s16 cutscene = this->actor.cutscene; + s16 csId = this->actor.csId; s32 owlType; s32 switchFlag; - for (i = 0; i < ARRAY_COUNT(this->unk_400); i++) { - this->unk_400[i] = cutscene; - if (cutscene != -1) { - this->actor.cutscene = cutscene; - cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } - this->actor.cutscene = this->unk_400[0]; + this->actor.csId = this->csIdList[0]; Actor_ProcessInitChain(&this->actor, sInitChain); if (ENOWL_GET_TYPE(&this->actor) == ENOWL_GET_TYPE_30) { Actor_SetScale(&this->actor, 0.1f); @@ -144,7 +144,7 @@ void EnOwl_Init(Actor* thisx, PlayState* play) { this->unk_409 = 4; this->unk_40B = this->unk_408 = 0; this->unk_40C = 4; - this->unk_406 = -1; + this->csIdIndex = -1; owlType = ENOWL_GET_TYPE(&this->actor); switchFlag = ENOWL_GET_SWITCHFLAG(&this->actor); @@ -315,11 +315,11 @@ void func_8095AC50(EnOwl* this, PlayState* play) { void func_8095ACEC(EnOwl* this) { this->actionFlags &= ~0x40; - if (this->unk_406 >= 0) { - if (ActorCutscene_GetCurrentIndex() == this->unk_400[this->unk_406]) { - ActorCutscene_Stop(this->unk_400[this->unk_406]); + if (this->csIdIndex >= 0) { + if (CutsceneManager_GetCurrentCsId() == this->csIdList[this->csIdIndex]) { + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); } - this->unk_406 = -1; + this->csIdIndex = -1; } } @@ -387,7 +387,7 @@ void func_8095AFEC(EnOwl* this, PlayState* play) { if (func_8095A978(this, play, 0xBF6, 200.0f, 100.0f)) { Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_8095AF2C; - this->unk_406 = 0; + this->csIdIndex = 0; this->actionFlags |= 0x40; } } @@ -502,7 +502,7 @@ void func_8095B574(EnOwl* this, PlayState* play) { this->actionFunc = func_8095BA84; Audio_PlayFanfare(NA_BGM_OWL); this->actionFlags |= 0x40; - this->unk_406 = 2; + this->csIdIndex = 2; } else if (this->actor.xzDistToPlayer < 200.0f) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 200.0f, 400.0f, PLAYER_IA_NONE); @@ -674,7 +674,7 @@ void func_8095BA84(EnOwl* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.home.rot.x = 0; func_8095ACEC(this); - this->unk_406 = 0; + this->csIdIndex = 0; this->actionFlags |= 0x40; break; @@ -714,7 +714,7 @@ void func_8095BE0C(EnOwl* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_8095BA84; Audio_PlayFanfare(NA_BGM_OWL); - this->unk_406 = 1; + this->csIdIndex = 1; this->actionFlags |= 0x40; } else if (this->actor.textId == 0xBF0) { if (this->actor.isTargeted) { @@ -865,16 +865,16 @@ s32 func_8095C510(EnOwl* this) { void func_8095C568(EnOwl* this) { if (this->actionFlags & 0x40) { - if ((this->unk_406 < 0) || (this->unk_400[this->unk_406] < 0)) { + if ((this->csIdIndex < 0) || (this->csIdList[this->csIdIndex] < 0)) { this->actionFlags &= ~0x40; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_400[this->unk_406]); - } else if (ActorCutscene_GetCanPlayNext(this->unk_400[this->unk_406])) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_400[this->unk_406], &this->actor); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); + } else if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + CutsceneManager_StartWithPlayerCs(this->csIdList[this->csIdIndex], &this->actor); this->actionFlags &= ~0x40; } else { - ActorCutscene_SetIntentToPlay(this->unk_400[this->unk_406]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h index 033857886..5e02aba94 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -44,8 +44,8 @@ typedef struct EnOwl { /* 0x3F4 */ Path* path; /* 0x3F8 */ s32 unk_3F8; /* 0x3FC */ s32 unk_3FC; - /* 0x400 */ s16 unk_400[3]; - /* 0x406 */ s16 unk_406; + /* 0x400 */ s16 csIdList[3]; + /* 0x406 */ s16 csIdIndex; /* 0x408 */ u8 unk_408; /* 0x409 */ u8 unk_409; /* 0x40A */ u8 unk_40A; diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 966f21354..a4158e2c7 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -156,7 +156,7 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { if (1) {} - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) || + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_14_04) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) || CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || (gSaveContext.save.entrance == ENTRANCE(IKANA_CANYON, 9))) { Actor_Kill(&this->actor); } @@ -216,14 +216,14 @@ void func_80BD8588(EnPamera* this, PlayState* play) { void func_80BD8658(EnPamera* this) { s32 i; - s16 nextCutscene = this->actor.cutscene; + s16 csId = this->actor.csId; - for (i = 0; i < ARRAY_COUNT(this->cutscenes); i++) { - if (nextCutscene == -1) { + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + if (csId == CS_ID_NONE) { break; } - this->cutscenes[i] = nextCutscene; - nextCutscene = ActorCutscene_GetAdditionalCutscene(nextCutscene); + this->csIdList[i] = csId; + csId = CutsceneManager_GetAdditionalCsId(csId); } } @@ -242,9 +242,9 @@ void func_80BD8700(EnPamera* this) { void func_80BD8758(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 1800) { - if (ActorCutscene_GetCanPlayNext(this->cutscenes[0]) && (this->cutscenes[0] != -1)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); - Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->cutscenes[0])), + if (CutsceneManager_IsNext(this->csIdList[0]) && (this->csIdList[0] != -1)) { + CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->actor); + Camera_SetToTrackActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csIdList[0])), &this->actor); this->actor.speed = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); @@ -252,8 +252,8 @@ void func_80BD8758(EnPamera* this, PlayState* play) { this->actor.world.rot.y = this->actor.home.rot.y; func_80BD9338(this, play); func_80BD8908(this); - } else if ((this->cutscenes[0] != -1) && (this->actor.xzDistToPlayer < 1000.0f)) { - ActorCutscene_SetIntentToPlay(this->cutscenes[0]); + } else if ((this->csIdList[0] != -1) && (this->actor.xzDistToPlayer < 1000.0f)) { + CutsceneManager_Queue(this->csIdList[0]); } else { this->actor.speed = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); @@ -429,13 +429,13 @@ void func_80BD90AC(EnPamera* this, PlayState* play) { ((this->actor.xzDistToPlayer < 150.0f) || ((this->actionFunc == func_80BD909C) && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f)))) { - if ((ActorCutscene_GetCanPlayNext(this->cutscenes[1])) && ((this->cutscenes[1] != -1))) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor); - Camera_SetToTrackActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(this->cutscenes[1])), + if ((CutsceneManager_IsNext(this->csIdList[1])) && ((this->csIdList[1] != -1))) { + CutsceneManager_StartWithPlayerCs(this->csIdList[1], &this->actor); + Camera_SetToTrackActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csIdList[1])), &this->actor); EnPamera_LookDownWell(this); - } else if (this->cutscenes[1] != -1) { - ActorCutscene_SetIntentToPlay(this->cutscenes[1]); + } else if (this->csIdList[1] != -1) { + CutsceneManager_Queue(this->csIdList[1]); } else { EnPamera_LookDownWell(this); } @@ -569,7 +569,7 @@ void func_80BD9840(EnPamera* this, PlayState* play) { this->actor.update = func_80BDA344; this->actor.flags |= ACTOR_FLAG_2000000; this->actor.flags |= ACTOR_FLAG_100000; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { func_80BD9E60(this); func_80BD9938(this); } else { @@ -605,7 +605,8 @@ void func_80BD994C(EnPamera* this, PlayState* play) { this->unk_324 = 0x15A8; } else if ((gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) || - (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20))) { + (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) && + !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20))) { func_80BD93CC(this, 1, 0); Message_StartTextbox(play, 0x158E, &this->actor); this->unk_324 = 0x158E; @@ -695,14 +696,14 @@ void func_80BD9C70(EnPamera* this, PlayState* play) { } s32 func_80BD9CB8(EnPamera* this, PlayState* play) { - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 0x1E5)) { - actionIndex = Cutscene_GetActorActionIndex(play, 0x1E5); - if (this->unk_326 != play->csCtx.actorActions[actionIndex]->action) { - this->unk_326 = play->csCtx.actorActions[actionIndex]->action; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_485)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_485); + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; - switch (play->csCtx.actorActions[actionIndex]->action) { + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: func_80BD9E88(this); break; @@ -727,7 +728,7 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { break; } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); this->setupFunc(this, play); return 1; } @@ -738,7 +739,7 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { func_80BD9E60(this); } } - this->unk_326 = 0x63; + this->cueId = 99; return 0; } diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h index 34f18e815..59bf40e09 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h @@ -28,13 +28,13 @@ typedef struct EnPamera { /* 0x312 */ s16 unk_312; /* 0x314 */ s16 unk_314; /* 0x316 */ s16 unk_316; - /* 0x318 */ s16 cutscenes[2]; + /* 0x318 */ s16 csIdList[2]; /* 0x31C */ s16 hideInisdeTimer; /* 0x31E */ s16 unk_31E; /* 0x320 */ UNK_TYPE1 unk_320[0x2]; /* 0x322 */ s16 unk_322; /* 0x324 */ u16 unk_324; - /* 0x326 */ u16 unk_326; + /* 0x326 */ u16 cueId; } EnPamera; // size = 0x328 #endif // Z_EN_PAMERA_H diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 4172457f1..62dff4188 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -341,8 +341,8 @@ void EnPametfrog_StopCutscene(EnPametfrog* this, PlayState* play) { subCam = Play_GetCamera(play, this->subCamId); Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; - ActorCutscene_Stop(this->cutscene); - func_800B724C(play, &this->actor, PLAYER_CSMODE_6); + CutsceneManager_Stop(this->csId); + func_800B724C(play, &this->actor, PLAYER_CSMODE_END); } } @@ -991,22 +991,22 @@ void EnPametfrog_SpawnFrog(EnPametfrog* this, PlayState* play) { void EnPametfrog_SetupCutscene(EnPametfrog* this) { if (this->actor.colChkInfo.health == 0) { - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; } else { - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); this->actionFunc = EnPametfrog_PlayCutscene; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; } void EnPametfrog_PlayCutscene(EnPametfrog* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->cutscene); - func_800B724C(play, &this->actor, PLAYER_CSMODE_7); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->csId); + func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); if (this->actor.colChkInfo.health == 0) { if (this->actor.params == GEKKO_PRE_SNAPPER) { EnPametfrog_SetupCallSnapper(this, play); @@ -1017,7 +1017,7 @@ void EnPametfrog_PlayCutscene(EnPametfrog* this, PlayState* play) { EnPametfrog_SetupFallOffSnapper(this, play); } } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h index 9ae2f76df..90bc0cb1b 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h @@ -30,7 +30,7 @@ typedef struct EnPametfrog { /* 0x2AC */ u8 drawDmgEffType; /* 0x2AD */ u8 wallPauseTimer; // Gekko stops 10 times along wall/ceiling after being blown off of Snapper /* 0x2AE */ u8 unk_2AE; // True/False - /* 0x2B0 */ s16 cutscene; + /* 0x2B0 */ s16 csId; /* 0x2B2 */ s16 params; /* 0x2B4 */ s16 quakeIndex; /* 0x2B6 */ s16 timer; diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 81f6c8b09..d10f0884b 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -789,43 +789,43 @@ Actor* func_80AF8040(EnPm* this, PlayState* play) { return actor; } -s32 func_80AF80F4(EnPm* this, s16 arg1) { +s32 func_80AF80F4(EnPm* this, s16 csId) { s32 ret = false; - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(arg1); - } else if (ActorCutscene_GetCanPlayNext(arg1)) { - ActorCutscene_StartAndSetUnkLinkFields(arg1, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(csId); + } else if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->actor); ret = true; } else { - ActorCutscene_SetIntentToPlay(arg1); + CutsceneManager_Queue(csId); } return ret; } -s16 func_80AF8170(EnPm* this, s32 arg1) { +s16 func_80AF8170(EnPm* this, s32 numCutscenes) { s32 i; - s16 cs = -1; + s16 csId = CS_ID_NONE; if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - cs = this->actor.child->cutscene; + csId = this->actor.child->csId; - for (i = 0; i < arg1; i++) { - cs = ActorCutscene_GetAdditionalCutscene(cs); + for (i = 0; i < numCutscenes; i++) { + csId = CutsceneManager_GetAdditionalCsId(csId); } } - return cs; + return csId; } s32 func_80AF81E8(EnPm* this, PlayState* play) { s32 pad; - s16 sp2A = func_80AF8170(this, 0); + s16 csId = func_80AF8170(this, 0); s32 ret = false; switch (this->unk_378) { case 0: - if (!func_80AF80F4(this, sp2A)) { + if (!func_80AF80F4(this, csId)) { break; } @@ -833,7 +833,8 @@ s32 func_80AF81E8(EnPm* this, PlayState* play) { case 4: case 6: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), + this->actor.child); } this->unk_378++; ret = true; @@ -843,16 +844,16 @@ s32 func_80AF81E8(EnPm* this, PlayState* play) { case 3: case 5: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_08) && (this->unk_378 == 3)) { - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); } else { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), &this->actor); } this->unk_378++; ret = true; break; case 7: - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); this->unk_378++; ret = true; break; @@ -862,12 +863,12 @@ s32 func_80AF81E8(EnPm* this, PlayState* play) { s32 func_80AF8348(EnPm* this, PlayState* play) { s32 pad; - s16 sp2A = func_80AF8170(this, 0); + s16 csId = func_80AF8170(this, 0); s32 ret = false; switch (this->unk_378) { case 0: - if (!func_80AF80F4(this, sp2A)) { + if (!func_80AF80F4(this, csId)) { break; } @@ -875,7 +876,7 @@ s32 func_80AF8348(EnPm* this, PlayState* play) { case 4: case 6: case 8: - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), &this->actor); this->unk_378++; ret = true; break; @@ -885,14 +886,15 @@ s32 func_80AF8348(EnPm* this, PlayState* play) { case 5: case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)), + this->actor.child); } this->unk_378++; ret = true; break; case 9: - ActorCutscene_Stop(sp2A); + CutsceneManager_Stop(csId); this->unk_378++; ret = true; break; @@ -2112,7 +2114,7 @@ void EnPm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, switch (limbIndex) { case 15: - if (ActorCutscene_GetCurrentIndex() == -1) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { Matrix_MultVec3f(&gZeroVec3f, &this->actor.focus.pos); Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index 405ed1838..10d654cc7 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -296,7 +296,7 @@ void EnRailSkb_Init(Actor* thisx, PlayState* play) { this->unk_3F8 = 0; } - if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 2e85f081d..853dbfd61 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -44,7 +44,7 @@ s32 EnRailgibud_MoveToIdealGrabPositionAndRotation(EnRailgibud* this, PlayState* void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play); void EnRailgibud_MainGibdo_DeadUpdate(Actor* thisx, PlayState* play); void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, PlayState* play); -void EnRailgibud_InitActorActionCommand(EnRailgibud* this); +void EnRailgibud_InitCueType(EnRailgibud* this); void EnRailgibud_SetupDoNothing(EnRailgibud* this); void EnRailgibud_DoNothing(EnRailgibud* this, PlayState* play); void EnRailgibud_SinkIntoGround(EnRailgibud* this, PlayState* play); @@ -1106,8 +1106,8 @@ void EnRailgibud_Draw(Actor* thisx, PlayState* play) { void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, PlayState* play) { s32 pad[2]; - EnRailgibud_InitActorActionCommand(this); - this->csAction = 99; + EnRailgibud_InitCueType(this); + this->cueId = 99; this->actor.flags |= ACTOR_FLAG_100000; this->actor.flags |= ACTOR_FLAG_10; @@ -1126,30 +1126,30 @@ void EnRailgibud_InitCutsceneGibdo(EnRailgibud* this, PlayState* play) { this->actor.update = EnRailgibud_Cutscene_Update; } -void EnRailgibud_InitActorActionCommand(EnRailgibud* this) { +void EnRailgibud_InitCueType(EnRailgibud* this) { switch (ENRAILGIBUD_GET_CUTSCENE_TYPE(&this->actor)) { case 1: - this->actorActionCommand = 519; + this->cueType = CS_CMD_ACTOR_CUE_519; break; case 2: - this->actorActionCommand = 520; + this->cueType = CS_CMD_ACTOR_CUE_520; break; case 3: - this->actorActionCommand = 521; + this->cueType = CS_CMD_ACTOR_CUE_521; break; case 4: - this->actorActionCommand = 522; + this->cueType = CS_CMD_ACTOR_CUE_522; break; case 5: - this->actorActionCommand = 523; + this->cueType = CS_CMD_ACTOR_CUE_523; break; default: - this->actorActionCommand = 519; + this->cueType = CS_CMD_ACTOR_CUE_519; break; } } @@ -1177,13 +1177,13 @@ void EnRailgibud_SinkIntoGround(EnRailgibud* this, PlayState* play) { } s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, this->actorActionCommand)) { - actionIndex = Cutscene_GetActorActionIndex(play, this->actorActionCommand); - if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { - this->csAction = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + cueChannel = Cutscene_GetCueChannel(play, this->cueType); + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_IDLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_IDLE); @@ -1221,7 +1221,7 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { } } - switch (this->csAction) { + switch (this->cueId) { case 3: case 4: if (this->actionFunc == EnRailgibud_SinkIntoGround) { @@ -1233,7 +1233,7 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { case 5: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (play->csCtx.frames < 280) { + if (play->csCtx.curFrame < 280) { Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_CRY); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_WEAKENED1); @@ -1242,11 +1242,11 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { break; } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); return true; } - this->csAction = 99; + this->cueId = 99; return false; } diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h index cf06d1996..95a2bbd7b 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h @@ -47,8 +47,8 @@ typedef struct EnRailgibud { /* 0x3F6 */ s16 drawDmgEffTimer; /* 0x3F8 */ s16 type; /* 0x3FA */ s16 isInvincible; - /* 0x3FC */ u16 actorActionCommand; - /* 0x3FE */ u16 csAction; + /* 0x3FC */ u16 cueType; + /* 0x3FE */ u16 cueId; /* 0x400 */ u16 textId; /* 0x402 */ s16 timeInitialized; // unused other than setting it /* 0x404 */ u8 drawDmgEffType; diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index eaf54000f..e270f1515 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -504,7 +504,7 @@ void EnRuppecrow_HandleSong(EnRuppecrow* this, PlayState* play) { } } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = EnRuppecrow_HandleSongCutscene; } @@ -526,12 +526,12 @@ void EnRuppecrow_HandleSong(EnRuppecrow* this, PlayState* play) { void EnRuppecrow_HandleSongCutscene(EnRuppecrow* this, PlayState* play) { EnRuppecrow_UpdatePosition(this, play); - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); EnRuppecrow_UpdateSpeed(this, play); this->actionFunc = EnRuppecrow_FlyWhileDroppingRupees; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } Actor_MoveWithoutGravity(&this->actor); @@ -554,7 +554,7 @@ void EnRuppecrow_FlyWhileDroppingRupees(EnRuppecrow* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; Actor_MoveWithGravity(&this->actor); } else { - if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() != this->actor.csId) { EnRuppecrow_UpdateSpeed(this, play); Math_ApproachF(&this->actor.speed, this->speedModifier, 0.2f, 0.5f); } diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index 42e2dd013..c870027bb 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -87,14 +87,14 @@ static ColliderCylinderInit sCylinderInit = { void EnRz_Init(Actor* thisx, PlayState* play) { EnRz* this = THIS; - s16 tempCutscene = this->actor.cutscene; + s16 csId = this->actor.csId; s32 i; - for (i = 0; i < ARRAY_COUNT(this->cutscenes); i++) { - this->cutscenes[i] = tempCutscene; - if (tempCutscene != -1) { - this->actor.cutscene = tempCutscene; - tempCutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } @@ -156,12 +156,12 @@ void EnRz_Init(Actor* thisx, PlayState* play) { } if (EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) { - this->csAction = 0x226; + this->cueType = CS_CMD_ACTOR_CUE_550; } else { // EN_RZ_MARILLA - this->csAction = 0x227; + this->cueType = CS_CMD_ACTOR_CUE_551; } - this->actionIndex = 0; + this->cueId = 0; } /** @@ -359,18 +359,18 @@ void EnRz_Destroy(Actor* thisx, PlayState* play) { } s32 func_80BFBE70(EnRz* this, PlayState* play) { - u16 action; + u16 cueId; if ((EN_RZ_GET_SISTER(&this->actor) == EN_RZ_JUDO) && (this->animIndex == EN_RZ_ANIM_APPLAUDING)) { func_800B9010(&this->actor, NA_SE_EV_CLAPPING_2P - SFX_FLAG); } - if (Cutscene_CheckActorAction(play, this->csAction)) { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csAction)); - action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csAction)]->action; - if (this->actionIndex != action) { - this->actionIndex = action; - switch (this->actionIndex) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id; + if (this->cueId != cueId) { + this->cueId = cueId; + switch (this->cueId) { case 1: func_80BFBA1C(play, this, EN_RZ_ANIM_STANDING); break; @@ -395,18 +395,18 @@ s32 func_80BFBE70(EnRz* this, PlayState* play) { } s32 func_80BFBFAC(EnRz* this, PlayState* play) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { Message_StartTextbox(play, 0x2925, &this->actor); this->actionFunc = func_80BFC078; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); return false; - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); return true; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } return false; } @@ -498,7 +498,7 @@ void func_80BFC36C(EnRz* this, PlayState* play) { this->actionFunc = func_80BFC2F4; SET_WEEKEVENTREG(WEEKEVENTREG_75_80); } - this->actor.cutscene = this->cutscenes[1]; + this->actor.csId = this->csIdList[1]; } } @@ -518,7 +518,7 @@ void func_80BFC3F8(EnRz* this, PlayState* play) { if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_10000)) { this->actionFunc = func_80BFC36C; - this->actor.cutscene = this->cutscenes[0]; + this->actor.csId = this->csIdList[0]; this->actor.flags &= ~ACTOR_FLAG_10000; } else if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.h b/src/overlays/actors/ovl_En_Rz/z_en_rz.h index 38a7088e8..c6d8fe3c8 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.h +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.h @@ -40,9 +40,9 @@ typedef struct EnRz { /* 0x420 */ u16 stateFlags; /* 0x422 */ s16 animIndex; /* 0x424 */ s16 timer; - /* 0x426 */ u16 csAction; - /* 0x428 */ u16 actionIndex; - /* 0x42A */ s16 cutscenes[2]; + /* 0x426 */ u16 cueType; + /* 0x428 */ u16 cueId; + /* 0x42A */ s16 csIdList[2]; /* 0x430 */ EnRzActionFunc actionFunc; } EnRz; // size = 0x434 diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index b6bd75d83..321c790d1 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -166,7 +166,7 @@ void func_80BCD2BC(EnScopecrow* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_SC_RUPPE, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, this->actor.params, - this->actor.cutscene, this->actor.halfDaysBits, NULL); + this->actor.csId, this->actor.halfDaysBits, NULL); } s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) { diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 1c82887b4..07e2646a0 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -448,14 +448,14 @@ void func_80BCBA00(EnScopenuts* this, PlayState* play) { } if (this->unk_36C == 0) { - if (ActorCutscene_GetCanPlayNext(this->unk_338)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_338, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_36C = 1; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->unk_338); + CutsceneManager_Queue(this->csId); return; } } @@ -593,7 +593,7 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) { if (sp32 == 3) { if (this->unk_334 >= (this->path->count - 1)) { - ActorCutscene_Stop(this->unk_338); + CutsceneManager_Stop(this->csId); CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_40); this->actionFunc = func_80BCC288; } else { @@ -601,7 +601,7 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) { } } } else if (this->actor.playerHeightRel > 500.0f) { - ActorCutscene_Stop(this->unk_338); + CutsceneManager_Stop(this->csId); this->actionFunc = func_80BCC288; } @@ -609,17 +609,17 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) { func_80BCAD64(this, sp32); if (this->unk_36C == 2) { - if (ActorCutscene_GetCanPlayNext(this->unk_338)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_338, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_36C = 3; } else { - ActorCutscene_SetIntentToPlay(this->unk_338); + CutsceneManager_Queue(this->csId); return; } } else if ((this->unk_36C == 1) && (this->unk_36E == 20)) { - ActorCutscene_Stop(this->unk_338); - this->unk_338 = ActorCutscene_GetAdditionalCutscene(this->unk_338); - ActorCutscene_SetIntentToPlay(this->unk_338); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + CutsceneManager_Queue(this->csId); this->unk_36C = 2; } this->unk_36E++; @@ -723,7 +723,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { } else { this->actor.gravity = -1.0f; this->actor.draw = EnScopenuts_Draw; - this->unk_338 = this->actor.cutscene; + this->csId = this->actor.csId; this->unk_33C = 0; this->unk_358 = 150; this->unk_348 = 4; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h index 5ea0d15eb..ef2ea74d8 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h @@ -24,7 +24,7 @@ typedef struct EnScopenuts { /* 0x32C */ f32 unk_32C; /* 0x330 */ Path* path; /* 0x334 */ s32 unk_334; - /* 0x338 */ s16 unk_338; + /* 0x338 */ s16 csId; /* 0x33A */ UNK_TYPE1 unk33A[2]; /* 0x33C */ u16 unk_33C; /* 0x33E */ s16 unk_33E; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index c02120532..871bb85a8 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -532,14 +532,14 @@ void func_80ADBE80(EnSellnuts* this, PlayState* play) { func_80ADAE64(this); if (this->unk_366 == 0) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_366 = 1; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); return; } } @@ -659,31 +659,31 @@ void func_80ADC37C(EnSellnuts* this, PlayState* play) { this->actor.world.rot.x = -sp30.x; if (func_80ADCE4C(this, this->path, this->unk_334) && (sp2C < 500.0f)) { if (this->unk_334 >= (this->path->count - 1)) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->actionFunc = func_80ADC580; } else { this->unk_334++; } } } else if (this->actor.playerHeightRel > 500.0f) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->actionFunc = func_80ADC580; } Math_ApproachF(&this->actor.speed, 2.0f, 0.2f, 1.0f); Actor_MoveWithoutGravity(&this->actor); if (this->unk_366 == 2) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_366 = 3; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); return; } } else if ((this->unk_366 == 1) && (this->unk_368 == 20)) { - ActorCutscene_Stop(this->cutscene); - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + CutsceneManager_Queue(this->csId); this->unk_366 = 2; } @@ -741,22 +741,22 @@ void func_80ADC7B4(EnSellnuts* this, PlayState* play) { s32 talkState = Message_GetState(&play->msgCtx); if (this->unk_366 == 0) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_366 = 1; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } else if ((this->unk_366 == 1) && (talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->unk_366 = 0; - ActorCutscene_Stop(this->cutscene); - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + CutsceneManager_Queue(this->csId); this->unk_338 |= 8; this->actionFunc = func_80ADC8C4; } @@ -766,14 +766,14 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) { Vec3s sp30; if (this->unk_366 == 0) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_366 = 1; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); return; } } @@ -816,7 +816,7 @@ void func_80ADCA64(EnSellnuts* this, PlayState* play) { this->actor.shape.rot.y += 0x4000; this->unk_360 *= 0.93f; if (this->actor.world.pos.y < -50.0f) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->unk_338 &= ~8; this->unk_34E = 20; this->unk_350 = 4; @@ -835,7 +835,7 @@ void func_80ADCA64(EnSellnuts* this, PlayState* play) { this->collider.dim.height = 0; SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 17); } else if (this->unk_34C == 17) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); SET_WEEKEVENTREG(WEEKEVENTREG_73_04); Actor_Kill(&this->actor); } @@ -959,7 +959,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); this->path = SubS_GetPathByIndex(play, ENSELLNUTS_GET_FC00(&this->actor), 0x3F); - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.cylRadius = 0; this->actor.colChkInfo.mass = MASS_IMMOVABLE; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h index b9793a6d3..3acf7a3e0 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h @@ -23,7 +23,7 @@ typedef struct EnSellnuts { /* 0x334 */ s32 unk_334; /* 0x338 */ u16 unk_338; /* 0x33A */ u16 unk_33A; - /* 0x33C */ s16 cutscene; + /* 0x33C */ s16 csId; /* 0x33E */ UNK_TYPE1 unk33E[0x2]; /* 0x340 */ u16 unk_340; /* 0x342 */ u16 unk_342; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 0e1b182e6..bdd5b787f 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -259,7 +259,7 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) { case 6: CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 6); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index f6e311d61..735111a2b 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -230,7 +230,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->unk_3D6 = ENSKB_GET_F0(&this->actor); this->actor.floorHeight = this->actor.world.pos.y; - if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 55d6cd8e0..3aab4b3ce 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -843,7 +843,7 @@ void EnSlime_SpawnIceBlock(EnSlime* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_ICEBLOCK, this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, 0, 0, 0); if (this->actor.child != NULL) { - this->actor.child->cutscene = this->actor.cutscene; + this->actor.child->csId = this->actor.csId; EnSlime_SetupIceBlock(this); } else { this->actor.colorFilterTimer = 0; diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index a083d6ded..baf3ccdfa 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -208,7 +208,7 @@ void EnSnowman_Init(Actor* thisx, PlayState* play) { thisx->world.pos.z, 0, 0, 0, EN_SNOWMAN_TYPE_SPLIT); thisx->parent = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_SNOWMAN, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, 0, 0, - EN_SNOWMAN_TYPE_SPLIT, -1, thisx->halfDaysBits, NULL); + EN_SNOWMAN_TYPE_SPLIT, CS_ID_NONE, thisx->halfDaysBits, NULL); if ((thisx->child == NULL) || (thisx->parent == NULL)) { if (thisx->child != NULL) { Actor_Kill(thisx->child); diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index a716545bd..a23600fb9 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -406,7 +406,7 @@ void EnSob1_Init(Actor* thisx, PlayState* play) { this->shopType = ZORA_SHOP; break; case GORON_SHOP: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { this->shopType = GORON_SHOP_SPRING; } else { this->shopType = GORON_SHOP; @@ -456,7 +456,7 @@ void EnSob1_EndInteraction(PlayState* play, EnSob1* this) { Player* player = GET_PLAYER(play); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; } Actor_ProcessTalkRequest(&this->actor, &play->state); @@ -546,11 +546,11 @@ void EnSob1_Idle(EnSob1* this, PlayState* play) { this->headRotTarget = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookFowardCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookFowardCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } player->stateFlags2 |= PLAYER_STATE2_20000000; @@ -623,11 +623,11 @@ void EnSob1_Hello(EnSob1* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play) && @@ -664,19 +664,19 @@ void EnSob1_FaceShopkeeper(EnSob1* this, PlayState* play) { u8 cursorIndex; if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookFowardCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookFowardCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } else { if (talkState == TEXT_STATE_CHOICE) { @@ -707,23 +707,23 @@ void EnSob1_TalkingToShopkeeper(EnSob1* this, PlayState* play) { void EnSob1_LookToShopkeeperFromShelf(EnSob1* this, PlayState* play) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; } if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; EnSob1_StartShopping(play, this); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -765,11 +765,11 @@ void EnSob1_Walk(EnSob1* this, PlayState* play) { f32 distSq; if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } if (this->path != NULL) { @@ -794,20 +794,20 @@ void EnSob1_Walking(EnSob1* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookFowardCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookFowardCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } player->stateFlags2 |= PLAYER_STATE2_20000000; @@ -828,17 +828,17 @@ void EnSob1_ItemPurchased(EnSob1* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); player->stateFlags2 |= PLAYER_STATE2_20000000; EnSob1_SetupAction(this, EnSob1_ContinueShopping); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -850,25 +850,25 @@ void EnSob1_ItemPurchased(EnSob1* this, PlayState* play) { void EnSob1_LookToShelf(EnSob1* this, PlayState* play) { if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; } if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShelfCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShelfCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene) != 0) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENSOB1_CUTSCENESTATE_PLAYING; EnSob1_UpdateCursorPos(play, this); EnSob1_SetupAction(this, EnSob1_BrowseShelf); Message_ContinueTextbox(play, this->items[this->cursorIndex]->actor.textId); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -975,7 +975,7 @@ void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; } func_8019F208(); @@ -1094,11 +1094,11 @@ void EnSob1_SetupItemPurchased(EnSob1* this, PlayState* play) { play->msgCtx.stateTimer = 4; EnSob1_SetupAction(this, EnSob1_ItemPurchased); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } @@ -1290,9 +1290,9 @@ s16 EnSob1_GetDistSqAndOrient(Path* path, s32 pointIndex, Vec3f* pos, f32* distS } void EnSob1_GetCutscenes(EnSob1* this) { - this->lookFowardCutscene = this->actor.cutscene; - this->lookToShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookFowardCutscene); - this->lookToShopkeeperCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShelfCutscene); + this->lookFowardCsId = this->actor.csId; + this->lookToShelfCsId = CutsceneManager_GetAdditionalCsId(this->lookFowardCsId); + this->lookToShopkeeperCsId = CutsceneManager_GetAdditionalCsId(this->lookToShelfCsId); } void EnSob1_WaitForBlink(EnSob1* this) { @@ -1387,7 +1387,7 @@ void EnSob1_InitShop(EnSob1* this, PlayState* play) { this->cutsceneState = ENSOB1_CUTSCENESTATE_STOPPED; EnSob1_GetCutscenes(this); - this->cutscene = this->lookFowardCutscene; + this->csId = this->lookFowardCsId; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); sInitFuncs[this->shopType](this, play); this->actor.colChkInfo.mass = MASS_IMMOVABLE; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h index eee86c112..1509868ee 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h @@ -60,10 +60,10 @@ typedef struct EnSob1 { /* 0x39C */ u8 arrowAnimState; /* 0x39D */ u8 stickAnimState; /* 0x39E */ s16 cutsceneState; - /* 0x3A0 */ s16 cutscene; - /* 0x3A2 */ s16 lookFowardCutscene; - /* 0x3A4 */ s16 lookToShelfCutscene; - /* 0x3A6 */ s16 lookToShopkeeperCutscene; + /* 0x3A0 */ s16 csId; + /* 0x3A2 */ s16 lookFowardCsId; + /* 0x3A4 */ s16 lookToShelfCsId; + /* 0x3A6 */ s16 lookToShopkeeperCsId; /* 0x3A8 */ UNK_TYPE1 pad3A8[0x4]; /* 0x3AC */ f32 shopItemSelectedTween; /* 0x3B0 */ UNK_TYPE1 pad3B0[0x4]; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index ad40c241c..a7cd6617a 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -306,60 +306,60 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { switch (this->textId) { case 0: this->flags1 |= 0x20; - this->cutsceneIdx = 0; + this->csIdIndex = 0; this->textId = 0x29E5; break; case 0x29E5: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 1; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 1; this->textId = 0x29E6; break; case 0x29E6: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 0; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 0; this->textId = 0x29E7; break; case 0x29E7: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 1; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 1; this->textId = 0x29E8; break; case 0x29E8: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 0; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 0; this->textId = 0x29E9; break; case 0x29E9: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 1; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 1; this->textId = 0x29EA; break; case 0x29EA: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 0; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 0; this->textId = 0x29EB; break; case 0x29EB: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 1; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 1; this->textId = 0x29EC; break; case 0x29EC: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); - this->cutsceneIdx = 0; + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); + this->csIdIndex = 0; this->textId = 0x29ED; break; case 0x29ED: - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->flags1 |= 0x400; - this->cutsceneIdx = 1; + this->csIdIndex = 1; this->textId = 0x29EE; break; } - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIdx]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); this->actionFunc = func_80BADD0C; } else if (this->flags1 & 1) { switch (this->textId) { @@ -859,8 +859,8 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_83_04) && !(this->flags1 & 0x1000)) { - if (ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { - ActorCutscene_Start(this->cutscenes[0], &this->actor); + if (CutsceneManager_IsNext(this->csIdList[0])) { + CutsceneManager_Start(this->csIdList[0], &this->actor); if (!(player->stateFlags1 & PLAYER_STATE1_10000000)) { this->flags2 |= 0x10; player->stateFlags1 |= PLAYER_STATE1_10000000; @@ -868,7 +868,7 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { this->flags1 |= 0x1000; this->flags2 |= 2; } else { - ActorCutscene_SetIntentToPlay(this->cutscenes[0]); + CutsceneManager_Queue(this->csIdList[0]); } } func_80BABFD4(this, play); @@ -969,8 +969,8 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { if ((gSaveContext.save.entrance == ENTRANCE(NORTH_CLOCK_TOWN, 7)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_58_40)) { Actor_Kill(&this->actor); } - this->cutscenes[0] = this->actor.cutscene; - this->cutscenes[1] = ActorCutscene_GetAdditionalCutscene(this->cutscenes[0]); + this->csIdList[0] = this->actor.csId; + this->csIdList[1] = CutsceneManager_GetAdditionalCsId(this->csIdList[0]); this->flags1 |= 0x80; this->flags1 |= 8; this->animIndex = 1; @@ -994,8 +994,8 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { } this->animIndex = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); - this->cutscenes[0] = this->actor.cutscene; - this->cutscenes[1] = ActorCutscene_GetAdditionalCutscene(this->cutscenes[0]); + this->csIdList[0] = this->actor.csId; + this->csIdList[1] = CutsceneManager_GetAdditionalCsId(this->csIdList[0]); this->flags1 |= 4; this->actionFunc = func_80BAD7F8; return; @@ -1168,26 +1168,26 @@ void func_80BAD130(EnSuttari* this, PlayState* play) { } void func_80BAD230(EnSuttari* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscenes[1])) { - ActorCutscene_Start(this->cutscenes[1], &this->actor); + if (CutsceneManager_IsNext(this->csIdList[1])) { + CutsceneManager_Start(this->csIdList[1], &this->actor); this->textId = 0x2A31; Message_StartTextbox(play, this->textId, &this->actor); this->flags1 |= 0x4000; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_CHASE | SEQ_FLAG_ASYNC); this->actionFunc = func_80BAD380; } else { - ActorCutscene_SetIntentToPlay(this->cutscenes[1]); + CutsceneManager_Queue(this->csIdList[1]); } } void func_80BAD2B4(EnSuttari* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->textId == 0x2A30) { - ActorCutscene_Stop(this->cutscenes[0]); - ActorCutscene_SetIntentToPlay(this->cutscenes[1]); + CutsceneManager_Stop(this->csIdList[0]); + CutsceneManager_Queue(this->csIdList[1]); this->actionFunc = func_80BAD230; } else { - ActorCutscene_Stop(this->cutscenes[1]); + CutsceneManager_Stop(this->csIdList[1]); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->flags1 |= 0x40; @@ -1211,7 +1211,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { this->flags2 &= ~0x10; player->stateFlags1 &= ~PLAYER_STATE1_10000000; this->flags1 &= ~0x4000; - ActorCutscene_Stop(this->cutscenes[1]); + CutsceneManager_Stop(this->csIdList[1]); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; this->flags1 |= 0x40; @@ -1346,7 +1346,7 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { if (Message_ShouldAdvance(play)) { if (this->flags1 & 0x400) { if (this->textId == 0x29EE) { - ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); } this->flags1 &= ~0x400; if (this->flags2 & 1) { @@ -1385,16 +1385,16 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { } void func_80BADD0C(EnSuttari* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscenes[this->cutsceneIdx])) { - if (this->cutsceneIdx == 0) { - ActorCutscene_Start(this->cutscenes[this->cutsceneIdx], &this->enFsn->actor); + if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + if (this->csIdIndex == 0) { + CutsceneManager_Start(this->csIdList[this->csIdIndex], &this->enFsn->actor); } else { - ActorCutscene_Start(this->cutscenes[this->cutsceneIdx], &this->actor); + CutsceneManager_Start(this->csIdList[this->csIdIndex], &this->actor); } func_80BAAA94(this); this->actionFunc = func_80BADA9C; } else { - ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIdx]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h index 669cf549e..071000763 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h @@ -56,8 +56,8 @@ typedef struct EnSuttari { /* 0x444 */ Vec3f unk444; /* 0x450 */ s32 animIndex; /* 0x454 */ UNK_TYPE1 unk_454[0x2]; - /* 0x456 */ s16 cutscenes[2]; - /* 0x45A */ s16 cutsceneIdx; + /* 0x456 */ s16 csIdList[2]; + /* 0x45A */ s16 csIdIndex; } EnSuttari; // size = 0x45C #endif // Z_EN_SUTTARI_H diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index f37605707..1bb664416 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -1090,14 +1090,14 @@ void func_808DB100(EnSw* this, PlayState* play) { } void func_808DB25C(EnSw* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); func_808D9C18(this); this->actionFunc = func_808DB2E0; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 7941ea758..d5ea5f9df 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -339,11 +339,11 @@ s32 func_80A3E97C(EnTest3* this, PlayState* play) { } s32 func_80A3E9DC(EnTest3* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_D8D)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_D8D, &this->player.actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->player.actor); return true; } else { - ActorCutscene_SetIntentToPlay(this->unk_D8D); + CutsceneManager_Queue(this->csId); return false; } } @@ -357,8 +357,8 @@ s32 func_80A3EA30(EnTest3* this, PlayState* play) { } } if (this->unk_D78->unk_1 != 0) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_D8D); + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId); play->msgCtx.msgMode = 0x44; } return false; @@ -374,9 +374,9 @@ s32 func_80A3EAC4(EnTest3* this, PlayState* play) { s32 func_80A3EAF8(EnTest3* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { if (this->unk_D78->textId == 0x145F) { - ActorCutscene_Stop(this->unk_D8D); - this->unk_D8D = 0x7C; - ActorCutscene_SetIntentToPlay(this->unk_D8D); + CutsceneManager_Stop(this->csId); + this->csId = CS_ID_GLOBAL_TALK; + CutsceneManager_Queue(this->csId); this->player.targetedActor = &GET_PLAYER(play)->actor; } return 1; @@ -452,7 +452,7 @@ void EnTest3_Init(Actor* thisx, PlayState* play2) { D_80A41D24 = true; this->player.actor.room = -1; - this->player.unk_A86 = -1; + this->player.csId = CS_ID_NONE; this->player.transformation = PLAYER_FORM_HUMAN; this->player.ageProperties = &sAgeProperties; this->player.heldItemAction = PLAYER_IA_NONE; @@ -526,8 +526,8 @@ void func_80A3F0B0(EnTest3* this, PlayState* play) { } void func_80A3F114(EnTest3* this, PlayState* play) { - if (this->player.csMode != 0) { - play->startPlayerCutscene(play, &this->player, 6); + if (this->player.csMode != PLAYER_CSMODE_0) { + play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_END); } } @@ -596,7 +596,7 @@ s32 func_80A3F384(EnTest3* this, PlayState* play) { this->player.doorType = 1; this->player.doorDirection = (offset.z >= 0.0f) ? 1.0f : -1.0f; this->player.doorActor = &door->dyna.actor; - this->player.unk_A86 = -1; + this->player.csId = CS_ID_NONE; return true; } return false; @@ -616,7 +616,7 @@ void func_80A3F534(EnTest3* this, PlayState* play) { } else { this->unk_D78 = &D_80A41854[1]; } - this->unk_D8D = this->player.actor.cutscene; + this->csId = this->player.actor.csId; } void func_80A3F5A4(EnTest3* this, PlayState* play) { @@ -628,7 +628,7 @@ void func_80A3F5A4(EnTest3* this, PlayState* play) { } else { this->unk_D78 = &D_80A41854[12]; } - this->unk_D8D = this->player.actor.cutscene; + this->csId = this->player.actor.csId; } s32 func_80A3F62C(EnTest3* this, PlayState* play, struct_80A41828* arg2, ScheduleOutput* scheduleOutput) { @@ -666,8 +666,8 @@ s32 func_80A3F73C(EnTest3* this, PlayState* play) { this->unk_D90->stateFlags1 |= PLAYER_STATE1_20; func_800BC154(play, &play->actorCtx, &this->unk_D90->actor, 4); func_800BC154(play, &play->actorCtx, &this->player.actor, 2); - ActorCutscene_SetReturnCamera(this->subCamId); - play->startPlayerCutscene(play, &this->player, 7); + CutsceneManager_SetReturnCamera(this->subCamId); + play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_WAIT); } func_800B863C(&this->player.actor, play); if (this->unk_D88 == 3) { @@ -689,7 +689,7 @@ s32 func_80A3F8D4(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul ((postActor = func_80A3F2BC(play, this, ACTOR_EN_PM, ACTORCAT_NPC, 100.0f, 20.0f)) != NULL)) { this->player.actor.home.rot.y = Actor_WorldYawTowardActor(&this->player.actor, postActor); } - play->startPlayerCutscene(play, &this->player, 0x61); + play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_97); return true; } @@ -736,7 +736,7 @@ s32 func_80A3FA58(EnTest3* this, PlayState* play) { return false; } if (this->unk_D8A == 90) { - play->startPlayerCutscene(play, &this->player, 0x15); + play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_21); } } else { this->unk_D8A++; @@ -757,20 +757,20 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { if (!Play_InCsMode(play)) { D_80A41D20 = 1; this->unk_D78 = &D_80A41854[20]; - this->unk_D8D = this->player.actor.cutscene; + this->csId = this->player.actor.csId; this->player.actor.textId = this->unk_D78->textId; } } else if (D_80A41D20 == 1) { - if (this->unk_D8D >= 0) { + if (this->csId >= 0) { if (func_80A3E9DC(this, play)) { - this->unk_D8D = -1; + this->csId = CS_ID_NONE; Environment_StopTime(); } } else if ((play->actorCtx.flags & ACTORCTX_FLAG_6) || (play->actorCtx.flags & ACTORCTX_FLAG_5)) { - this->unk_D8D = ActorCutscene_GetAdditionalCutscene(this->player.actor.cutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->player.actor.csId); SET_WEEKEVENTREG(WEEKEVENTREG_90_02); if (play->actorCtx.flags & ACTORCTX_FLAG_5) { - this->unk_D8D = ActorCutscene_GetAdditionalCutscene(this->unk_D8D); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); } SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1); D_80A41D20 = 2; @@ -778,7 +778,7 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { func_80A3F73C(this, play); } } else if ((D_80A41D20 == 2) && func_80A3E9DC(this, play)) { - ActorCutscene_SetReturnCamera(CAM_ID_MAIN); + CutsceneManager_SetReturnCamera(CAM_ID_MAIN); Environment_StartTime(); if (((void)0, gSaveContext.save.time) > CLOCK_TIME(6, 0)) { func_800FE658(TIME_TO_MINUTES_ALT_F(fabsf((s16) - ((void)0, gSaveContext.save.time)))); @@ -793,7 +793,7 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { } s32 func_80A3FDE4(EnTest3* this, PlayState* play, struct_80A41828* arg2, ScheduleOutput* scheduleOutput) { - this->unk_D8D = ActorCutscene_GetAdditionalCutscene(this->player.actor.cutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->player.actor.csId); return true; } @@ -813,7 +813,7 @@ s32 func_80A3FE20(EnTest3* this, PlayState* play) { } else if (D_80A41D64 == 1) { func_80A40230(this, play); } else if (D_80A41D64 == 2) { - ActorCutscene_Stop(this->unk_D8D); + CutsceneManager_Stop(this->csId); SET_WEEKEVENTREG(WEEKEVENTREG_90_02); D_80A41D64 = 3; } @@ -835,9 +835,9 @@ s32 func_80A3FF10(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul return true; } else { func_80A3F15C(this, play, arg2); - this->unk_D8D = this->player.actor.cutscene; + this->csId = this->player.actor.csId; if (play->roomCtx.curRoom.num == 2) { - this->unk_D8D = ActorCutscene_GetAdditionalCutscene(this->unk_D8D); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); } return true; } @@ -856,7 +856,7 @@ s32 func_80A3FFD0(EnTest3* this, PlayState* play2) { } } else { SET_WEEKEVENTREG(WEEKEVENTREG_51_40); - play->startPlayerCutscene(play, &this->player, 0x6E); + play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_110); } return false; } @@ -1032,7 +1032,7 @@ void func_80A409D4(EnTest3* this, PlayState* play) { if ((play->actorCtx.flags & ACTORCTX_FLAG_5) || (play->actorCtx.flags & ACTORCTX_FLAG_4)) { play->actorCtx.flags &= ~ACTORCTX_FLAG_4; func_80A3F0B0(this, play); - ActorCutscene_SetReturnCamera(CAM_ID_MAIN); + CutsceneManager_SetReturnCamera(CAM_ID_MAIN); } else { sEnTest3_Input = *CONTROLLER1(&play->state); } @@ -1055,16 +1055,16 @@ void EnTest3_Update(Actor* thisx, PlayState* play2) { this->player.actor.draw = EnTest3_Draw; D_80A41D48 = false; this->player.actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); - if (Cutscene_CheckActorAction(play, 0x1FA) && + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_506) && !((this->player.actor.category == ACTORCAT_PLAYER) && ((play->actorCtx.flags & ACTORCTX_FLAG_5) || (play->actorCtx.flags & ACTORCTX_FLAG_4)))) { - if (this->player.csMode != 5) { - play->startPlayerCutscene(play, &this->player, 5); + if (this->player.csMode != PLAYER_CSMODE_5) { + play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_5); } play->actorCtx.flags &= ~ACTORCTX_FLAG_4; } else if (this->player.actor.category == ACTORCAT_PLAYER) { func_80A409D4(this, play); - } else if (play->startPlayerCutscene(play, &this->player, 0)) { + } else if (play->startPlayerCutscene(play, &this->player, PLAYER_CSMODE_0)) { if (this->unk_D88 >= 7) { Vec3f worldPos; diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.h b/src/overlays/actors/ovl_En_Test3/z_en_test3.h index a4f1ff659..36cd15c27 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.h +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.h @@ -26,7 +26,7 @@ typedef struct EnTest3 { /* 0xD89 */ u8 unk_D89; /* 0xD8A */ s16 unk_D8A; /* 0xD8C */ u8 unk_D8C; - /* 0xD8D */ s8 unk_D8D; + /* 0xD8D */ s8 csId; /* 0xD8E */ s16 subCamId; /* 0xD90 */ Player* unk_D90; /* 0xD94 */ EnTest3ActionFunc unk_D94; diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 59af8f7e8..24d8b4137 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -43,19 +43,19 @@ static s16 sNightMessages2[] = { 0x1BB4, 0x1BB5, 0x1BB6 }; static s16 sDayMessages2[] = { 0x1BB2, 0x1BB2, 0x1BB3 }; static u16 D_80A43364[] = { CLOCK_TIME(6, 0), CLOCK_TIME(18, 0) }; -static s16 sCutscenes[2]; -static s16 sCurrentCs; +static s16 sCsIdList[2]; +static s16 sCurCsId; void func_80A41D70(EnTest4* this, PlayState* play) { - if (this->unk_144 != 0) { + if (this->csIdIndex != 0) { func_80151A68(play, sNightMessages1[CURRENT_DAY - 1]); - } else if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { + } else if ((sCsIdList[this->csIdIndex] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { if (play->actorCtx.flags & ACTORCTX_FLAG_1) { Sram_IncrementDay(); gSaveContext.save.time = CLOCK_TIME(6, 0); func_80151A68(play, sDayMessages1[CURRENT_DAY - 1]); } else { - this->unk_144 = 0; + this->csIdIndex = 0; this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; } @@ -67,22 +67,22 @@ void func_80A41D70(EnTest4* this, PlayState* play) { } if (gSaveContext.cutsceneTrigger == 0) { - if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) { + if ((sCsIdList[this->csIdIndex] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) { this->actionFunc = func_80A42F20; - sCurrentCs = sCutscenes[this->unk_144]; + sCurCsId = sCsIdList[this->csIdIndex]; this->transitionCsTimer = 0; SET_EVENTINF(EVENTINF_17); - } else if (this->unk_144 == 0) { + } else if (this->csIdIndex == 0) { play_sound(NA_SE_EV_CHICKEN_CRY_M); } else { func_8019F128(NA_SE_EV_DOG_CRY_EVENING); } } else { this->actionFunc = func_80A42AB8; - if (this->unk_144 == 0) { - this->unk_144 = 1; + if (this->csIdIndex == 0) { + this->csIdIndex = 1; } else { - this->unk_144 = 0; + this->csIdIndex = 0; } this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; @@ -90,9 +90,9 @@ void func_80A41D70(EnTest4* this, PlayState* play) { } void func_80A41FA4(EnTest4* this, PlayState* play) { - if (this->unk_144 != 0) { + if (this->csIdIndex != 0) { func_80151A68(play, sNightMessages2[CURRENT_DAY - 1]); - } else if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { + } else if ((sCsIdList[this->csIdIndex] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { Sram_IncrementDay(); gSaveContext.save.time = CLOCK_TIME(6, 0); Interface_NewDay(play, CURRENT_DAY); @@ -104,22 +104,22 @@ void func_80A41FA4(EnTest4* this, PlayState* play) { } if (gSaveContext.cutsceneTrigger == 0) { - if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) { + if ((sCsIdList[this->csIdIndex] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) { this->actionFunc = func_80A42F20; - sCurrentCs = sCutscenes[this->unk_144]; + sCurCsId = sCsIdList[this->csIdIndex]; this->transitionCsTimer = 0; SET_EVENTINF(EVENTINF_17); - } else if (this->unk_144 == 0) { + } else if (this->csIdIndex == 0) { play_sound(NA_SE_EV_CHICKEN_CRY_M); } else { func_8019F128(NA_SE_EV_DOG_CRY_EVENING); } } else { this->actionFunc = func_80A42AB8; - if (this->unk_144 == 0) { - this->unk_144 = 1; + if (this->csIdIndex == 0) { + this->csIdIndex = 1; } else { - this->unk_144 = 0; + this->csIdIndex = 0; } this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; @@ -278,7 +278,7 @@ void func_80A425E4(EnTest4* this, PlayState* play) { this->nextBellTime = CLOCK_TIME(17, 30); } - if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1) || (CURRENT_DAY == 3) || + if ((sCsIdList[this->csIdIndex] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1) || (CURRENT_DAY == 3) || (gSaveContext.save.time >= CLOCK_TIME(17, 0))) { gSaveContext.screenScale = 1000.0f; } @@ -292,17 +292,17 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { s32 dayTemp; EnTest4* this = THIS; Player* player = GET_PLAYER(play); - s8 temp_v0 = this->actor.cutscene; + s8 csId = this->actor.csId; - sCutscenes[0] = temp_v0; - if (temp_v0 >= 0) { - ActorCutscene* temp_v0_2 = ActorCutscene_GetCutscene(sCutscenes[0]); + sCsIdList[0] = csId; + if (csId >= 0) { + ActorCutscene* actorCutscene = CutsceneManager_GetCutsceneEntry(sCsIdList[0]); SET_EVENTINF(EVENTINF_52); - sCutscenes[1] = temp_v0_2->additionalCutscene; + sCsIdList[1] = actorCutscene->additionalCsId; } else { CLEAR_EVENTINF(EVENTINF_52); - sCutscenes[1] = sCutscenes[0]; + sCsIdList[1] = sCsIdList[0]; } if (sIsLoaded || (CHECK_EVENTINF(EVENTINF_27))) { @@ -318,29 +318,29 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { gSaveContext.gameMode = GAMEMODE_NORMAL; STOP_GAMESTATE(&play->state); SET_NEXT_GAMESTATE(&play->state, DayTelop_Init, sizeof(DayTelopState)); - this->unk_144 = 1; + this->csIdIndex = 1; gSaveContext.save.time = CLOCK_TIME(6, 0); Actor_Kill(&this->actor); } else { gSaveContext.save.day = 1; dayTemp = gSaveContext.save.day; gSaveContext.save.daysElapsed = dayTemp; - this->unk_144 = 1; + this->csIdIndex = 1; this->unk_146 = gSaveContext.save.time; this->actionFunc = func_80A42AB8; } } else if (gSaveContext.save.time == CLOCK_TIME(6, 0)) { - this->unk_144 = 0; + this->csIdIndex = 0; func_80A41D70(this, play); - if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) && + if ((gSaveContext.cutsceneTrigger == 0) && (sCsIdList[this->csIdIndex] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) { player->stateFlags1 |= PLAYER_STATE1_200; } } else { if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { - this->unk_144 = 0; + this->csIdIndex = 0; } else { - this->unk_144 = 1; + this->csIdIndex = 1; } this->unk_146 = gSaveContext.save.time; this->actionFunc = func_80A42AB8; @@ -354,7 +354,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) { } this->lastBellTime = gSaveContext.save.time; - if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { + if ((sCsIdList[this->csIdIndex] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) { gSaveContext.screenScaleFlag = false; gSaveContext.screenScale = 1000.0f; } @@ -369,7 +369,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { if ((play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (play->numSetupActors <= 0) && (play->roomCtx.status == 0) && !Play_IsDebugCamEnabled()) { s16 temp_a2; - u16 temp_a0 = D_80A43364[this->unk_144]; + u16 temp_a0 = D_80A43364[this->csIdIndex]; s16 temp_a3; s16 bellDiff; s16 new_var; @@ -392,7 +392,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { Interface_StartMoonCrash(play); Actor_Kill(&this->actor); SET_EVENTINF(EVENTINF_17); - } else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) && + } else if (((sCsIdList[this->csIdIndex] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) && (CURRENT_DAY != 3)) { func_80A41FA4(this, play); } else { @@ -418,14 +418,14 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { } } - if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) { + if ((sCsIdList[this->csIdIndex] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) { player->stateFlags1 |= PLAYER_STATE1_200; this->unk_146 = gSaveContext.save.time; } else { - if (this->unk_144 == 0) { - this->unk_144 = 1; + if (this->csIdIndex == 0) { + this->csIdIndex = 1; } else { - this->unk_144 = 0; + this->csIdIndex = 0; } this->unk_146 = gSaveContext.save.time += CLOCK_TIME_MINUTE; @@ -470,11 +470,11 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { void func_80A42F20(EnTest4* this, PlayState* play) { if (!this->transitionCsTimer) { - if (sCurrentCs >= 0) { - if (ActorCutscene_GetCanPlayNext(sCurrentCs) == 0) { - ActorCutscene_SetIntentToPlay(sCurrentCs); + if (sCurCsId >= 0) { + if (!CutsceneManager_IsNext(sCurCsId)) { + CutsceneManager_Queue(sCurCsId); } else { - ActorCutscene_Start(sCurrentCs, &this->actor); + CutsceneManager_Start(sCurCsId, &this->actor); this->transitionCsTimer = 1; } } else { @@ -483,7 +483,7 @@ void func_80A42F20(EnTest4* this, PlayState* play) { } else if (this->transitionCsTimer < 60) { this->transitionCsTimer++; if (this->transitionCsTimer == 10) { - if (this->unk_144 == 0) { + if (this->csIdIndex == 0) { play_sound(NA_SE_EV_CHICKEN_CRY_M); } else { func_8019F128(NA_SE_EV_DOG_CRY_EVENING); @@ -499,14 +499,14 @@ void func_80A42F20(EnTest4* this, PlayState* play) { } } else { this->actionFunc = func_80A42AB8; - if (this->unk_144 == 0) { - this->unk_144 = 1; + if (this->csIdIndex == 0) { + this->csIdIndex = 1; } else { - this->unk_144 = 0; + this->csIdIndex = 0; } - if (sCurrentCs >= 0) { - ActorCutscene_Stop(sCurrentCs); + if (sCurCsId >= 0) { + CutsceneManager_Stop(sCurCsId); } gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.h b/src/overlays/actors/ovl_En_Test4/z_en_test4.h index 0a372f245..106a5a9aa 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.h +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.h @@ -9,7 +9,7 @@ typedef void (*EnTest4ActionFunc)(struct EnTest4*, PlayState*); typedef struct EnTest4 { /* 0x000 */ Actor actor; - /* 0x144 */ s8 unk_144; // 0 on night, 1 on day + /* 0x144 */ s8 csIdIndex; // 0 on night, 1 on day /* 0x145 */ u8 transitionCsTimer; /* 0x146 */ u16 unk_146; /* 0x148 */ u16 nextBellTime; // Next time the bell will sound diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 2b57ecf51..42ff16ccf 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -7,6 +7,7 @@ #include "z_en_test6.h" #include "z64quake.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "z64cutscene_commands.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200000 | ACTOR_FLAG_2000000) @@ -54,30 +55,57 @@ ActorInit En_Test6_InitVars = { (ActorFunc)EnTest6_Draw, }; -u8 D_80A93E80[] = { - 0x00, 0x0D, 0x01, 0xA8, 0x00, 0x00, 0x00, 0x64, 0x04, 0x64, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x15, 0xFF, 0xED, 0x00, - 0x00, 0x04, 0x64, 0x00, 0x12, 0x00, 0x00, 0x00, 0x15, 0xFF, 0xED, 0x00, 0x00, 0x04, 0x64, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x15, 0xFF, 0xED, 0x00, 0x00, 0x04, 0x64, 0x00, 0x11, 0xFF, 0xE6, 0xFF, 0xFB, 0xFF, 0xE0, 0x00, 0x00, 0x04, - 0x64, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x12, 0xFF, 0xE0, 0x00, 0x00, 0x04, 0x64, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x16, - 0xFF, 0xE5, 0x00, 0x00, 0x04, 0x64, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFB, 0x00, 0x00, 0x04, 0x64, 0x00, - 0x07, 0x00, 0x10, 0x00, 0x1D, 0xFF, 0xB3, 0x00, 0x00, 0x04, 0x64, 0x00, 0x03, 0x00, 0x01, 0x00, 0x13, 0x00, 0x6F, - 0x00, 0x00, 0x04, 0x64, 0x00, 0x03, 0xFF, 0xC5, 0x00, 0x15, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x64, 0x00, 0x03, 0xFF, - 0xED, 0x00, 0x3B, 0x00, 0x54, 0x00, 0x00, 0x04, 0x64, 0x00, 0x88, 0xFF, 0xED, 0x00, 0x3B, 0x00, 0x54, 0x00, 0x00, - 0x04, 0x64, 0x00, 0x6C, 0xFF, 0xEF, 0x00, 0x39, 0x00, 0x52, 0x00, 0x00, 0x04, 0x64, 0x00, 0x0D, 0x00, 0x00, 0x00, - 0x32, 0x02, 0xA9, 0x00, 0x00, 0x04, 0x64, 0x00, 0x12, 0x00, 0x00, 0x00, 0x32, 0x02, 0xA9, 0x00, 0x00, 0x04, 0x64, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x32, 0x02, 0xA9, 0x00, 0x00, 0x04, 0x64, 0x00, 0x11, 0xFF, 0x98, 0x01, 0x77, 0x01, - 0x59, 0x00, 0x00, 0x04, 0x64, 0x00, 0x0F, 0x00, 0x00, 0xFF, 0xC2, 0x01, 0x21, 0x00, 0x00, 0x04, 0x64, 0x00, 0x0E, - 0xFF, 0xD1, 0x00, 0x7D, 0x00, 0xCD, 0x00, 0x00, 0x04, 0x64, 0x00, 0x0C, 0xFF, 0xC6, 0xFF, 0xEF, 0x00, 0xC7, 0x00, - 0x00, 0x04, 0x64, 0x00, 0x07, 0x00, 0x10, 0x00, 0x35, 0x00, 0xD3, 0x00, 0x00, 0x04, 0x64, 0x00, 0x03, 0xFF, 0xE1, - 0x00, 0x3F, 0x02, 0x6F, 0x00, 0x00, 0x04, 0x64, 0x00, 0x03, 0xFE, 0xAB, 0x01, 0xD0, 0x02, 0x1E, 0x00, 0x00, 0x04, - 0x64, 0x00, 0x03, 0xFE, 0xAB, 0x01, 0xD0, 0x02, 0x1E, 0x00, 0x00, 0x04, 0x64, 0x00, 0x88, 0xFE, 0xAB, 0x01, 0xD0, - 0x02, 0x1E, 0x00, 0x00, 0x04, 0x64, 0x00, 0x6C, 0xFE, 0xAD, 0x01, 0xCE, 0x02, 0x1C, 0x00, 0x00, 0x00, 0x0F, 0x00, - 0x0A, 0x00, 0x46, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0A, 0x00, 0x46, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x0A, 0x00, 0x46, - 0x00, 0x00, 0x00, 0x0A, 0x00, 0x02, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x0A, 0xFF, 0xEC, 0x00, 0x37, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x06, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x05, 0xFF, 0xFB, - 0x00, 0x32, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xDC, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xD8, 0x00, 0x78, 0x00, - 0x00, 0x00, 0x02, 0xFF, 0xC4, 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xBA, 0x00, 0x82, 0x00, 0x00, 0x00, 0x02, - 0xFF, 0xB0, 0x00, 0x8C, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x04, +CutsceneData D_80A93E80[] = { + // Header + CS_CAM_SPLINE(13, 424, 0, 100), + + // Camera At Data + /* 0x0 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 13, 0, 21, -19, CS_CAM_REL_0), + /* 0x1 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 18, 0, 21, -19, CS_CAM_REL_0), + /* 0x2 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 16, 0, 21, -19, CS_CAM_REL_0), + /* 0x3 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 17, -26, -5, -32, CS_CAM_REL_0), + /* 0x4 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 15, 0, 18, -32, CS_CAM_REL_0), + /* 0x5 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 14, 1, 22, -27, CS_CAM_REL_0), + /* 0x6 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 12, 0, 1, -5, CS_CAM_REL_0), + /* 0x7 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 7, 16, 29, -77, CS_CAM_REL_0), + /* 0x8 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 3, 1, 19, 111, CS_CAM_REL_0), + /* 0x9 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 3, -59, 21, 91, CS_CAM_REL_0), + /* 0xA */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 3, -19, 59, 84, CS_CAM_REL_0), + /* 0xB */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 136, -19, 59, 84, CS_CAM_REL_0), + /* 0xC */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 108, -17, 57, 82, CS_CAM_REL_0), + + // Camera Eye Data + /* 0x0 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 13, 0, 50, 681, CS_CAM_REL_0), + /* 0x1 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 18, 0, 50, 681, CS_CAM_REL_0), + /* 0x2 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 16, 0, 50, 681, CS_CAM_REL_0), + /* 0x3 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 17, -104, 375, 345, CS_CAM_REL_0), + /* 0x4 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 15, 0, -62, 289, CS_CAM_REL_0), + /* 0x5 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 14, -47, 125, 205, CS_CAM_REL_0), + /* 0x6 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 12, -58, -17, 199, CS_CAM_REL_0), + /* 0x7 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 7, 16, 53, 211, CS_CAM_REL_0), + /* 0x8 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 3, -31, 63, 623, CS_CAM_REL_0), + /* 0x9 */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 3, -341, 464, 542, CS_CAM_REL_0), + /* 0xA */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 3, -341, 464, 542, CS_CAM_REL_0), + /* 0xB */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 136, -341, 464, 542, CS_CAM_REL_0), + /* 0xC */ CS_CAM_POINT(CS_CAM_INTERP_4, 100, 108, -339, 462, 540, CS_CAM_REL_0), + + // Camera Roll and Fov Data + /* 0x0 */ CS_CAM_MISC(15, 0xA, 70, 0), + /* 0x1 */ CS_CAM_MISC(15, 0xA, 70, 0), + /* 0x2 */ CS_CAM_MISC(15, 0xA, 70, 0), + /* 0x3 */ CS_CAM_MISC(10, 0x2, 60, 0), + /* 0x4 */ CS_CAM_MISC(10, -0x14, 55, 0), + /* 0x5 */ CS_CAM_MISC(16, 0x0, 43, 0), + /* 0x6 */ CS_CAM_MISC(12, 0x6, 47, 0), + /* 0x7 */ CS_CAM_MISC(5, -0x5, 50, 0), + /* 0x8 */ CS_CAM_MISC(2, -0x24, 108, 0), + /* 0x9 */ CS_CAM_MISC(2, -0x28, 120, 0), + /* 0xA */ CS_CAM_MISC(2, -0x3C, 120, 0), + /* 0xB */ CS_CAM_MISC(2, -0x46, 130, 0), + /* 0xC */ CS_CAM_MISC(2, -0x50, 140, 0), + + // Terminate + CS_CAM_END() }; TexturePtr D_80A9402C[] = { @@ -113,12 +141,12 @@ void func_80A90730(EnTest6* this, PlayState* play) { case ENTEST6_24: case ENTEST6_25: func_80A91690(this, play); - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); return; case ENTEST6_26: func_80A920C8(this, play); - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); return; } @@ -301,7 +329,7 @@ void EnTest6_Init(Actor* thisx, PlayState* play2) { if (((ENTEST6_GET(&this->actor) == ENTEST6_24) || (ENTEST6_GET(&this->actor) == ENTEST6_25) || (ENTEST6_GET(&this->actor) == ENTEST6_26)) && - (play->playerActorCsIds[8] == -1)) { + (play->playerCsIds[PLAYER_CS_ID_SONG_WARP] == CS_ID_NONE)) { Actor_Kill(&this->actor); return; } @@ -313,7 +341,7 @@ void EnTest6_Init(Actor* thisx, PlayState* play2) { } this->unk_286 = 0; - this->unk_274 = 0; + this->cueId = 0; this->unk_278 = 0; this->unk_276 = 99; func_80A90730(this, play); @@ -350,21 +378,21 @@ void func_80A9156C(EnTest6* this, PlayState* play) { switch (ENTEST6_GET(&this->actor)) { case ENTEST6_24: case ENTEST6_25: - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); } else { - ActorCutscene_Start(play->playerActorCsIds[8], NULL); - this->subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_SONG_WARP], NULL); + this->subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); EnTest6_SetupAction(this, func_80A91760); } break; case ENTEST6_26: - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); } else { - ActorCutscene_Start(play->playerActorCsIds[8], NULL); - this->subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_SONG_WARP], NULL); + this->subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); EnTest6_SetupAction(this, func_80A92188); } break; @@ -379,7 +407,7 @@ void func_80A9156C(EnTest6* this, PlayState* play) { } void func_80A91690(EnTest6* this, PlayState* play) { - this->unk_274 = 90; + this->cueId = 90; this->unk_27A = 100; this->unk_286 = 0; if (ENTEST6_GET(&this->actor) == ENTEST6_25) { @@ -394,8 +422,8 @@ void func_80A916F0(EnTest6* this, PlayState* play) { player->actor.freezeTimer = 0; play->unk_18844 = false; - ActorCutscene_Stop(play->playerActorCsIds[8]); - func_800B7298(play, NULL, PLAYER_CSMODE_6); + CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); + func_800B7298(play, NULL, PLAYER_CSMODE_END); EnTest6_DisableMotionBlur(); Distortion_ClearType(DISTORTION_TYPE_5); Actor_Kill(&this->actor); @@ -415,14 +443,14 @@ void func_80A91760(EnTest6* this, PlayState* play) { mainCam = Play_GetCamera(play, CAM_ID_MAIN); - switch (this->unk_274) { + switch (this->cueId) { case 90: this->unk_276 = 2; this->unk_15C = 0.0f; this->unk_14C = 0.1f; this->unk_282 = 0; this->unk_278 = 0; - this->unk_274 = 91; + this->cueId = 91; break; case 91: @@ -466,7 +494,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { Distortion_SetType(DISTORTION_TYPE_5); Distortion_SetCountdown(80); play->unk_18844 = true; - this->unk_274 = 95; + this->cueId = 95; } break; @@ -523,7 +551,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { if (this->unk_254 != NULL) { ZeldaArena_Free(this->unk_254); } - this->unk_274 = 99; + this->cueId = 99; } break; @@ -537,7 +565,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { } if (this->unk_286 != 0) { - func_800B7298(play, NULL, PLAYER_CSMODE_7); + func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); } else { if (this->unk_27A == 90) { func_800B7298(play, NULL, PLAYER_CSMODE_66); @@ -615,8 +643,8 @@ void func_80A92118(EnTest6* this, PlayState* play) { player->actor.freezeTimer = 0; play->unk_18844 = false; - ActorCutscene_Stop(play->playerActorCsIds[8]); - func_800B7298(play, NULL, PLAYER_CSMODE_6); + CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); + func_800B7298(play, NULL, PLAYER_CSMODE_END); EnTest6_DisableMotionBlur(); Distortion_ClearType(DISTORTION_TYPE_5); Actor_Kill(&this->actor); @@ -687,7 +715,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { EnTest6_EnableMotionBlur(20); Distortion_SetType(DISTORTION_TYPE_5); Distortion_SetCountdown(90); - this->unk_274 = 2; + this->cueId = 2; break; case 110: @@ -696,34 +724,34 @@ void func_80A92188(EnTest6* this, PlayState* play) { case 38: case 114: - this->unk_274 = 1; + this->cueId = 1; break; case 76: - this->unk_274 = 3; + this->cueId = 3; break; case 61: EnTest6_EnableMotionBlur(150); - this->unk_274 = 4; + this->cueId = 4; break; case 51: EnTest6_EnableMotionBlur(180); - this->unk_274 = 5; + this->cueId = 5; break; case 14: case 15: EnTest6_EnableMotionBlur(50); Distortion_ClearType(DISTORTION_TYPE_5); - this->unk_274 = 0; + this->cueId = 0; break; case 1: EnTest6_DisableMotionBlur(); if (CHECK_EVENTINF(EVENTINF_52)) { - this->unk_274 = 9; + this->cueId = 9; } break; } @@ -731,19 +759,19 @@ void func_80A92188(EnTest6* this, PlayState* play) { func_80A92950(this, play); if (this->unk_27A == 115) { - subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); + subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); subCam = Play_GetCamera(play, subCamId); this->subCamAt = subCam->at; this->subCamEye = subCam->eye; this->subCamFov = subCam->fov; - func_8016119C(subCam, &this->unk_18C); + CutsceneCamera_Init(subCam, &this->unk_18C); } if ((this->unk_27A <= 115) && (this->unk_27A >= 16)) { - func_80161998(D_80A93E80, &this->unk_18C); + CutsceneCamera_UpdateSplines((u8*)D_80A93E80, &this->unk_18C); } else if (this->unk_27A < 16) { - subCamId = ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8]); + subCamId = CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); Play_SetCameraAtEyeUp(play, subCamId, &this->subCamAt, &this->subCamEye, &sSubCamUp); Play_SetCameraFov(play, subCamId, this->subCamFov); @@ -780,7 +808,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { break; case 38: - func_800B7298(play, NULL, PLAYER_CSMODE_7); + func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); break; case 14: @@ -825,13 +853,13 @@ void func_80A92950(EnTest6* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 temp_f0; s32 i; - s32 temp_v0; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 0x1F9)) { - temp_v0 = Cutscene_GetActorActionIndex(play, 0x1F9); - this->unk_274 = play->csCtx.actorActions[temp_v0]->action; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_505)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_505); + this->cueId = play->csCtx.actorCues[cueChannel]->id; - switch (this->unk_274) { + switch (this->cueId) { case 1: break; @@ -841,39 +869,39 @@ void func_80A92950(EnTest6* this, PlayState* play) { this->unk_27C = 0; player->actor.shape.shadowDraw = NULL; - if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 = (u32)play->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { + this->unk_154 = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { this->unk_154 = 150.0f; } - if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 = play->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { + this->unk_280 = play->csCtx.actorCues[cueChannel]->startPos.y; } else { this->unk_280 = 38; } - if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_150 = (u32)play->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { + this->unk_150 = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { this->unk_150 = 480.0f; } break; case 3: - if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { + this->unk_154 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } - if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 += (s16)play->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { + this->unk_280 += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; } else { this->unk_280 += 6; } - if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_158 = (u32)play->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { + this->unk_158 = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { this->unk_158 = -32.0f; } @@ -881,30 +909,30 @@ void func_80A92950(EnTest6* this, PlayState* play) { break; case 4: - if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { + this->unk_154 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } - if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 += (s16)play->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { + this->unk_280 += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; } else { this->unk_280 -= 4; } break; case 5: - if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { + this->unk_154 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } - if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_280 += (s16)play->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { + this->unk_280 += (s16)play->csCtx.actorCues[cueChannel]->startPos.y; } else { this->unk_280 -= 8; } - if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_158 += (u32)play->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { + this->unk_158 += (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { this->unk_158 += 20.0f; } @@ -912,7 +940,7 @@ void func_80A92950(EnTest6* this, PlayState* play) { this->unk_150 += this->unk_158; if (this->unk_150 > 3500.0f) { this->unk_150 = 3500.0f; - this->unk_274 = 0; + this->cueId = 0; } break; @@ -922,20 +950,20 @@ void func_80A92950(EnTest6* this, PlayState* play) { this->unk_27C = 0; player->actor.shape.shadowDraw = NULL; - if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_154 = (u32)play->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { + this->unk_154 = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { this->unk_154 = 100.0f; } - if (play->csCtx.actorActions[temp_v0]->startPos.y != 0) { - this->unk_14C = (u32)play->csCtx.actorActions[temp_v0]->startPos.y; + if (play->csCtx.actorCues[cueChannel]->startPos.y != 0) { + this->unk_14C = (u32)play->csCtx.actorCues[cueChannel]->startPos.y; } else { this->unk_14C = 20.0f; } - if (play->csCtx.actorActions[temp_v0]->startPos.z != 0) { - this->unk_150 = (u32)play->csCtx.actorActions[temp_v0]->startPos.z; + if (play->csCtx.actorCues[cueChannel]->startPos.z != 0) { + this->unk_150 = (u32)play->csCtx.actorCues[cueChannel]->startPos.z; } else { this->unk_150 = 300.0f; } @@ -943,8 +971,8 @@ void func_80A92950(EnTest6* this, PlayState* play) { break; case 7: - if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_158 = (u32)play->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { + this->unk_158 = (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { this->unk_158 = -5.0f; } @@ -952,8 +980,8 @@ void func_80A92950(EnTest6* this, PlayState* play) { break; case 8: - if (play->csCtx.actorActions[temp_v0]->startPos.x != 0) { - this->unk_158 += (u32)play->csCtx.actorActions[temp_v0]->startPos.x; + if (play->csCtx.actorCues[cueChannel]->startPos.x != 0) { + this->unk_158 += (u32)play->csCtx.actorCues[cueChannel]->startPos.x; } else { this->unk_158 += 2.0f; } @@ -961,7 +989,7 @@ void func_80A92950(EnTest6* this, PlayState* play) { this->unk_154 += this->unk_158; if (this->unk_154 > 10000.0f) { this->unk_154 = 10000.0f; - this->unk_274 = 0; + this->cueId = 0; } break; @@ -987,7 +1015,7 @@ void func_80A92950(EnTest6* this, PlayState* play) { return; } } else { - switch (this->unk_274) { + switch (this->cueId) { case 2: this->unk_276 = 0; this->unk_278 = 0; @@ -1016,7 +1044,7 @@ void func_80A92950(EnTest6* this, PlayState* play) { this->unk_150 += this->unk_158; if (this->unk_150 > 3500.0f) { this->unk_150 = 3500.0f; - this->unk_274 = 0; + this->cueId = 0; } break; @@ -1041,7 +1069,7 @@ void func_80A92950(EnTest6* this, PlayState* play) { this->unk_154 += this->unk_158; if (this->unk_154 > 10000.0f) { this->unk_154 = 10000.0f; - this->unk_274 = 0; + this->cueId = 0; } break; @@ -1231,7 +1259,7 @@ void func_80A939E8(EnTest6* this, PlayState* play2) { OPEN_DISPS(play->state.gfxCtx); - switch (this->unk_274) { + switch (this->cueId) { case 91: case 93: Lights_PointSetPosition(&this->lights[0].info, player->actor.world.pos.x, player->actor.world.pos.y - 10.0f, @@ -1297,7 +1325,7 @@ void func_80A939E8(EnTest6* this, PlayState* play2) { void EnTest6_Draw(Actor* thisx, PlayState* play) { EnTest6* this = THIS; - if (this->unk_274 != 0) { + if (this->cueId != 0) { switch (this->unk_276) { case 1: func_80A93298(this, play); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.h b/src/overlays/actors/ovl_En_Test6/z_en_test6.h index ec06afb91..d7e40a983 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.h +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.h @@ -31,13 +31,13 @@ typedef struct EnTest6 { /* 0x15C */ f32 unk_15C; /* 0x160 */ f32 unk_160; /* 0x164 */ EnTest6Light lights[2]; - /* 0x18C */ DbCameraUnkStruct unk_18C; + /* 0x18C */ CutsceneCamera unk_18C; /* 0x20C */ Vec3f unk_20C[6]; /* 0x254 */ Vec3f (*unk_254)[64]; /* 0x258 */ Vec3f subCamAt; /* 0x264 */ Vec3f subCamEye; /* 0x270 */ f32 subCamFov; - /* 0x274 */ s16 unk_274; + /* 0x274 */ s16 cueId; /* 0x276 */ s16 unk_276; /* 0x278 */ s16 unk_278; /* 0x27A */ s16 unk_27A; diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index 56b6c6f81..9c672ed51 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -412,12 +412,12 @@ void EnTest7_Init(Actor* thisx, PlayState* play2) { Audio_PlayBgm_StorePrevBgm(NA_BGM_SONG_OF_SOARING); } - if (play->playerActorCsIds[8] == -1) { + if (play->playerCsIds[PLAYER_CS_ID_SONG_WARP] == CS_ID_NONE) { Actor_Kill(&this->actor); return; } - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); player2->stateFlags1 |= PLAYER_STATE1_20; Lights_PointNoGlowSetInfo(&this->lightInfo, (Math_SinS(this->unk_1E8E) * 90.0f) + player->actor.world.pos.x, player->actor.world.pos.y + 10.0f, @@ -428,15 +428,15 @@ void EnTest7_Init(Actor* thisx, PlayState* play2) { void EnTest7_Destroy(Actor* thisx, PlayState* play) { EnTest7* this = THIS; - ActorCutscene_Stop(play->playerActorCsIds[8]); + CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } void func_80AF19A8(EnTest7* this, PlayState* play) { - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); } else { - ActorCutscene_Start(play->playerActorCsIds[8], NULL); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_SONG_WARP], NULL); func_80AF082C(this, func_80AF1A2C); play->unk_18844 = true; } @@ -452,7 +452,8 @@ void func_80AF1A2C(EnTest7* this, PlayState* play) { func_800FD698(play, 2000, 4000, sp2C); if (this->unk_1E54 >= 10) { - Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + Camera* subCam = + Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); this->subCamEye = subCam->eye; this->subCamAt = subCam->at; @@ -514,7 +515,8 @@ void func_80AF1CA0(EnTest7* this, PlayState* play) { } if (Rand_ZeroOne() < 0.3f) { - Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + Camera* subCam = + Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); f32 rand = Rand_ZeroOne(); sp34.x = ((subCam->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; @@ -537,7 +539,7 @@ void func_80AF1E44(EnTest7* this, PlayState* play) { func_80AF1B68(this, play); if (Rand_ZeroOne() < 0.3f) { - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); rand = Rand_ZeroOne(); sp34.x = ((subCam->eye.x - this->actor.world.pos.x) * rand) + this->actor.world.pos.x; sp34.y = ((subCam->eye.y - this->actor.world.pos.y) * rand) + this->actor.world.pos.y; @@ -585,7 +587,7 @@ void func_80AF2030(EnTest7* this, PlayState* play) { this->unk_148.unk_10 -= 0x2EE0; this->actor.world.pos.y += 100.0f; - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); subCam->focalActor = NULL; subCam->eye.x = ((subCam->eye.x - this->subCamEye.x) * sp1C) + this->subCamEye.x; @@ -667,10 +669,11 @@ void func_80AF2350(EnTest7* this, PlayState* play) { gSaveContext.respawnFlag = -6; } else { play->nextEntrance = D_80AF343C[ENTEST7_GET(&this->actor) - ENTEST7_1C]; - if ((play->nextEntrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if ((play->nextEntrance == ENTRANCE(SOUTHERN_SWAMP_POISONED, 10)) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 10); } else if ((play->nextEntrance == ENTRANCE(MOUNTAIN_VILLAGE_WINTER, 8)) && - CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) { + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 8); } } @@ -685,7 +688,8 @@ void func_80AF24D8(EnTest7* this, PlayState* play, f32 arg2) { Vec3f sp3C; Vec3f* pos; Player* player = GET_PLAYER(play); - Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + Camera* subCam = + Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); pos = &player->actor.world.pos; subCam->focalActor = NULL; @@ -708,7 +712,7 @@ void func_80AF2654(EnTest7* this, PlayState* play, f32 arg2) { Camera* subCam; Vec3f sp30; - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); subCam->focalActor = NULL; pos = &player->actor.world.pos; @@ -777,7 +781,8 @@ void func_80AF29C0(EnTest7* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); Vec3f* pos = &player->actor.world.pos; - Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + Camera* subCam = + Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); subCam->at.x = ((D_80AF3454 * Math_SinS(D_80AF3450[0]) * Math_CosS(D_80AF3450[1]))) + pos->x; subCam->at.y = (Math_SinS(D_80AF3450[1]) * D_80AF3454) + pos->y; @@ -791,15 +796,15 @@ void func_80AF29C0(EnTest7* this, PlayState* play) { void func_80AF2AE8(EnTest7* this, PlayState* play) { Camera* subCam; - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); return; } - ActorCutscene_Start(play->playerActorCsIds[8], NULL); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_SONG_WARP], NULL); func_80AF082C(this, func_80AF2C48); - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); this->subCamEye = subCam->eye; this->subCamAt = subCam->at; @@ -810,7 +815,8 @@ void func_80AF2BAC(EnTest7* this, PlayState* play, Vec3f* arg2, f32 arg3) { f32 x; f32 y; f32 z; - Camera* subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + Camera* subCam = + Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); subCam->focalActor = NULL; x = ((subCam->at.x - arg2->x) * arg3) + arg2->x; @@ -836,7 +842,7 @@ void func_80AF2C48(EnTest7* this, PlayState* play) { this->actor.world.pos.y = ((this->actor.world.pos.y - this->actor.home.pos.y) * sp24) + this->actor.home.pos.y; this->actor.world.pos.z = ((this->actor.world.pos.z - this->actor.home.pos.z) * sp24) + this->actor.home.pos.z; - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); func_80AF2BAC(this, play, &this->actor.home.pos, sp24); subCam->at.x = this->actor.world.pos.x; @@ -855,7 +861,7 @@ void func_80AF2DB4(EnTest7* this, PlayState* play) { Player* player = GET_PLAYER(play); Vec3f* pos = &player->actor.world.pos; - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); subCam->eye.x = (Math_SinS(-player->actor.shape.rot.y) * 200.0f * -0.83907f) + pos->x; subCam->eye.y = pos->y + 108.8042f; @@ -869,13 +875,13 @@ void func_80AF2DB4(EnTest7* this, PlayState* play) { void func_80AF2EC8(EnTest7* this, PlayState* play) { Camera* subCam; - if (!ActorCutscene_GetCanPlayNext(play->playerActorCsIds[8])) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[8]); + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); } else { - ActorCutscene_Start(play->playerActorCsIds[8], NULL); + CutsceneManager_Start(play->playerCsIds[PLAYER_CS_ID_SONG_WARP], NULL); func_80AF082C(this, func_80AF2F98); - subCam = Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(play->playerActorCsIds[8])); + subCam = Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(play->playerCsIds[PLAYER_CS_ID_SONG_WARP])); this->subCamEye = subCam->eye; this->subCamAt = subCam->at; this->unk_1E54 = 40; diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index c0ae22fd5..10f3ea529 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -98,8 +98,8 @@ void EnTimeTag_RooftopOath_DoNothing(EnTimeTag* this, PlayState* play) { } void EnTimeTag_RooftopOath_Cutscene(EnTimeTag* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = EnTimeTag_RooftopOath_DoNothing; gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; @@ -109,7 +109,7 @@ void EnTimeTag_RooftopOath_Cutscene(EnTimeTag* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_25_02); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -117,9 +117,9 @@ void EnTimeTag_RooftopOath_Wait(EnTimeTag* this, PlayState* play) { EnTimeTag* this2 = this; if ((play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_OATH)) { - if (this->actor.cutscene != -1) { + if (this->actor.csId != CS_ID_NONE) { this->actionFunc = EnTimeTag_RooftopOath_Cutscene; - ActorCutscene_SetIntentToPlay(this2->actor.cutscene); + CutsceneManager_Queue(this2->actor.csId); gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; } play->msgCtx.ocarinaMode = 4; @@ -127,7 +127,7 @@ void EnTimeTag_RooftopOath_Wait(EnTimeTag* this, PlayState* play) { } void EnTimeTag_SoaringEngraving_GetSong(EnTimeTag* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() != this->actor.csId) { this->actionFunc = EnTimeTag_SoaringEngraving_Wait; this->actor.textId = 0xC02; Item_Give(play, ITEM_SONG_SOARING); @@ -135,14 +135,14 @@ void EnTimeTag_SoaringEngraving_GetSong(EnTimeTag* this, PlayState* play) { } void EnTimeTag_SoaringEngraving_StartCutscene(EnTimeTag* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); this->actionFunc = EnTimeTag_SoaringEngraving_GetSong; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -211,8 +211,8 @@ void EnTimeTag_Diary_Cutscene(EnTimeTag* this, PlayState* play) { case 0x1230: // Mikau diary part 4 Message_CloseTextbox(play); this->actionFunc = EnTimeTag_Diary_Wait; - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { - ActorCutscene_Stop(this->actor.cutscene); + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { + CutsceneManager_Stop(this->actor.csId); } break; @@ -240,16 +240,16 @@ void EnTimeTag_Diary_Cutscene(EnTimeTag* this, PlayState* play) { } if (TIMETAG_DIARY_TIMER(&this->actor) != 0) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { TIMETAG_DIARY_TIMER(&this->actor) = 0; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); TIMETAG_DIARY_TIMER(&this->actor) = 0; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } @@ -301,7 +301,7 @@ void EnTimeTag_KickOut_Transition(EnTimeTag* this, PlayState* play) { */ void EnTimeTag_KickOut_WaitForTrigger(EnTimeTag* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); Message_StartTextbox(play, 0x1883 + TIMETAG_KICKOUT_GET_TEXT(&this->actor), NULL); this->actionFunc = EnTimeTag_KickOut_Transition; } @@ -334,7 +334,7 @@ void EnTimeTag_KickOut_WaitForTime(EnTimeTag* this, PlayState* play) { } } else if ((hour == TIMETAG_KICKOUT_HOUR(&this->actor)) && (minute == TIMETAG_KICKOUT_MINUTE(&this->actor)) && !Play_InCsMode(play)) { - func_800B7298(play, &this->actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); Message_StartTextbox(play, 0x1883 + TIMETAG_KICKOUT_GET_TEXT(&this->actor), NULL); this->actionFunc = EnTimeTag_KickOut_Transition; } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 91fd66635..d434bacaa 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -247,7 +247,7 @@ void EnTk_Init(Actor* thisx, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.flags |= ACTOR_FLAG_10; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); - SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); switch (this->unk_2B0) { case 4: @@ -705,16 +705,16 @@ void func_80AED940(EnTk* this, PlayState* play) { void func_80AEDBEC(EnTk* this, PlayState* play) { this->actor.params = -1; - this->unk_2E8 = 0; + this->csLength = 0; this->actor.speed = 0.0f; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); this->actionFunc = func_80AEDC4C; } void func_80AEDC4C(EnTk* this, PlayState* play) { - if ((this->actor.params >= 0) && SubS_StartActorCutscene(&this->actor, this->cutscenes[1], this->actor.params, - SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { - this->unk_2E8 = ActorCutscene_GetLength(this->cutscenes[1]); + if ((this->actor.params >= 0) && + SubS_StartCutscene(&this->actor, this->csIdList[1], this->actor.params, SUBS_CUTSCENE_WITH_PLAYER)) { + this->csLength = CutsceneManager_GetLength(this->csIdList[1]); Message_ContinueTextbox(play, 0x1411); func_80AEDCBC(this, play); } @@ -731,9 +731,9 @@ void func_80AEDCBC(EnTk* this, PlayState* play) { } void func_80AEDD4C(EnTk* this, PlayState* play) { - this->unk_2E8--; - if (this->unk_2E8 <= 0) { - ActorCutscene_Stop(this->cutscenes[1]); + this->csLength--; + if (this->csLength <= 0) { + CutsceneManager_Stop(this->csIdList[1]); Message_CloseTextbox(play); Actor_Kill(&this->actor); } @@ -901,7 +901,7 @@ void func_80AEE2A8(EnTk* this, PlayState* play) { } void func_80AEE2C0(EnTk* this, PlayState* play) { - if (SubS_StartActorCutscene(&this->actor, this->cutscenes[0], 0x7C, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + if (SubS_StartCutscene(&this->actor, this->csIdList[0], CS_ID_GLOBAL_TALK, SUBS_CUTSCENE_WITH_PLAYER)) { func_80AEE374(this, play); } } @@ -995,15 +995,15 @@ void func_80AEE650(EnTk* this, PlayState* play) { void func_80AEE6B8(EnTk* this, PlayState* play) { if (this->unk_2CA & 0x20) { if (this->unk_2E4 >= 3) { - ActorCutscene_Stop(this->cutscenes[0]); + CutsceneManager_Stop(this->csIdList[0]); Message_CloseTextbox(play); func_80AEDBEC(this, play); - } else if (SubS_StartActorCutscene(&this->actor, 0x7C, this->cutscenes[0], SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + } else if (SubS_StartCutscene(&this->actor, CS_ID_GLOBAL_TALK, this->csIdList[0], SUBS_CUTSCENE_WITH_PLAYER)) { this->unk_310 = 3; func_80AEDE10(this, play); this->unk_2CA &= ~0x20; } - } else if (SubS_StartActorCutscene(&this->actor, 0x7C, this->cutscenes[0], SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + } else if (SubS_StartCutscene(&this->actor, CS_ID_GLOBAL_TALK, this->csIdList[0], SUBS_CUTSCENE_WITH_PLAYER)) { this->unk_310 = 4; func_80AEDE10(this, play); } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 42a8aa96a..9604133e7 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -36,13 +36,13 @@ typedef struct EnTk { /* 0x2E0 */ s32 unk_2E0; /* 0x2E4 */ s16 unk_2E4; /* 0x2E6 */ u16 unk_2E6; - /* 0x2E8 */ s16 unk_2E8; + /* 0x2E8 */ s16 csLength; /* 0x2EC */ Vec3f unk_2EC; /* 0x2F8 */ Vec3s unk_2F8; /* 0x300 */ Vec3f unk_300; /* 0x30C */ EnTkUnkFunc unk_30C; /* 0x310 */ s16 unk_310; - /* 0x312 */ s16 cutscenes[2]; + /* 0x312 */ s16 csIdList[2]; /* 0x316 */ s16 unk_316; /* 0x318 */ s16 unk_318; /* 0x31A */ s16 unk_31A; diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 54ed5babc..3a563ab60 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -312,7 +312,7 @@ void func_80BA3CC4(EnToto* this, PlayState* play) { } void func_80BA3D38(EnToto* this, PlayState* play) { - this->cutscene = this->actor.cutscene; + this->csId = this->actor.csId; this->text = ENTOTO_WEEK_EVENT_FLAGS ? D_80BA50BC : D_80BA5088; func_80BA4C0C(this, play); play->actorCtx.flags |= ACTORCTX_FLAG_5; @@ -343,7 +343,7 @@ void func_80BA3DBC(EnToto* this, PlayState* play) { } func_80BA36C0(this, play, 0); - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); play->actorCtx.flags &= ~ACTORCTX_FLAG_5; } @@ -357,7 +357,7 @@ s32 func_80BA3ED4(EnToto* this, PlayState* play) { s32 func_80BA3EE8(EnToto* this, PlayState* play) { if (this->text->unk1 == 2) { - func_800B7298(play, NULL, PLAYER_CSMODE_7); + func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); } return 0; } @@ -389,21 +389,21 @@ s32 func_80BA3FCC(EnToto* this, PlayState* play) { } s32 func_80BA402C(EnToto* this, PlayState* play) { - s16 prevCutscene = this->cutscene; + s16 prevCsId = this->csId; - this->cutscene = ActorCutscene_GetAdditionalCutscene(this->cutscene); - ActorCutscene_SetIntentToPlay(this->cutscene); - ActorCutscene_Stop(prevCutscene); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + CutsceneManager_Queue(this->csId); + CutsceneManager_Stop(prevCsId); return 0; } s32 func_80BA407C(EnToto* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &GET_PLAYER(play)->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &GET_PLAYER(play)->actor); return 1; } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); return 0; } @@ -452,7 +452,7 @@ s32 func_80BA42BC(EnToto* this, PlayState* play) { Vec3s* end = &D_80BA510C[3]; func_80BA3FB0(this, play); - func_800B7298(play, NULL, PLAYER_CSMODE_6); + func_800B7298(play, NULL, PLAYER_CSMODE_END); if (player->actor.world.pos.z > -310.0f) { if ((player->actor.world.pos.x > -150.0f) || (player->actor.world.pos.z > -172.0f)) { phi_s0 = 3; @@ -480,14 +480,14 @@ s32 func_80BA43F4(EnToto* this, PlayState* play) { s32 func_80BA445C(EnToto* this, PlayState* play) { if (func_80BA4128(this, play)) { - func_800B7298(play, NULL, PLAYER_CSMODE_6); + func_800B7298(play, NULL, PLAYER_CSMODE_END); return 1; } return 0; } s32 func_80BA44A0(EnToto* this, PlayState* play) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->unk2B1 = 0; return 0; } @@ -675,17 +675,17 @@ s32 func_80BA4C44(EnToto* this, PlayState* play) { } void func_80BA4CB4(EnToto* this, PlayState* play) { - CsCmdActorAction* action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 525)]; + CsCmdActorCue* cue = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_525)]; - if (this->unk2B5 != action->action) { - this->unk2B5 = action->action; - if (this->unk2B5 != 4) { - if (this->unk2B5 == 3) { + if (this->cueId != cue->id) { + this->cueId = cue->id; + if (this->cueId != 4) { + if (this->cueId == 3) { Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_001DF0, -4.0f); } else { Animation_PlayOnce(&this->skelAnime, - this->unk2B5 == 1 ? &object_zm_Anim_0016A4 : &object_zm_Anim_0022C8); - if (this->unk2B5 == 2 && this->unk2B3 != 0xF) { + (this->cueId == 1) ? &object_zm_Anim_0016A4 : &object_zm_Anim_0022C8); + if ((this->cueId == 2) && (this->unk2B3 != 0xF)) { func_80151BB4(play, 9); func_80151BB4(play, 10); } @@ -694,11 +694,11 @@ void func_80BA4CB4(EnToto* this, PlayState* play) { } Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x320); if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk2B5 != 3) { - Animation_PlayLoop(&this->skelAnime, this->unk2B5 == 1 ? &object_zm_Anim_00C880 : &object_zm_Anim_001324); + if (this->cueId != 3) { + Animation_PlayLoop(&this->skelAnime, (this->cueId == 1) ? &object_zm_Anim_00C880 : &object_zm_Anim_001324); } } - if (this->unk2B5 == 4 && !Actor_HasParent(&this->actor, play)) { + if ((this->cueId == 4) && !Actor_HasParent(&this->actor, play)) { Actor_OfferGetItem(&this->actor, play, GI_MASK_CIRCUS_LEADER, 9999.9f, 9999.9f); } } @@ -707,7 +707,7 @@ void EnToto_Update(Actor* thisx, PlayState* play) { EnToto* this = THIS; s32 pad; - if (Cutscene_CheckActorAction(play, 0x20D)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_525)) { func_80BA4CB4(this, play); } else { D_80BA51B8[this->actionFuncIndex](this, play); diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.h b/src/overlays/actors/ovl_En_Toto/z_en_toto.h index 3c95a7dbb..cf9f3c718 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.h +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.h @@ -30,10 +30,10 @@ typedef struct EnToto { /* 0x264 */ ColliderCylinder collider; /* 0x2B0 */ u8 actionFuncIndex; /* 0x2B1 */ u8 unk2B1; - /* 0x2B2 */ s8 cutscene; + /* 0x2B2 */ s8 csId; /* 0x2B3 */ u8 unk2B3; /* 0x2B4 */ u8 unk2B4; - /* 0x2B5 */ u8 unk2B5; + /* 0x2B5 */ u8 cueId; /* 0x2B6 */ u8 unk2B6; /* 0x2B7 */ u8 unk2B7; /* 0x2B8 */ EnTotoText* text; diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 6decc1150..e4a4a4ab8 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -170,22 +170,22 @@ void EnTrt_UpdateCursorPos(PlayState* play, EnTrt* this) { void EnTrt_SetupGetMushroomCutscene(EnTrt* this) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - if (this->cutscene != this->tmpGetMushroomCutscene) { - ActorCutscene_Stop(this->cutscene); - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (this->csId != this->tmpGetMushroomCsId) { + CutsceneManager_Stop(this->csId); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->tmpGetMushroomCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->tmpGetMushroomCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } } if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING_SPECIAL; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -213,7 +213,7 @@ void EnTrt_EndInteraction(PlayState* play, EnTrt* this) { Player* player = GET_PLAYER(play); if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } Actor_ProcessTalkRequest(&this->actor, &play->state); @@ -318,11 +318,11 @@ void EnTrt_Hello(EnTrt* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -337,7 +337,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); Player* player = GET_PLAYER(play); - this->tmpGetMushroomCutscene = this->getMushroomCutscene; + this->tmpGetMushroomCsId = this->getMushroomCsId; if (this->cutsceneState != ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { EnTrt_SetupGetMushroomCutscene(this); if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { @@ -357,7 +357,7 @@ void EnTrt_GetMushroom(EnTrt* this, PlayState* play) { break; case 0x889: if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } play->msgCtx.msgMode = 0x43; @@ -402,7 +402,7 @@ void EnTrt_StartRedPotionConversation(EnTrt* this, PlayState* play) { if (this->textId == 0x88F) { if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } play->msgCtx.msgMode = 0x43; @@ -465,18 +465,18 @@ void EnTrt_GivenRedPotionForKoume(EnTrt* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); player->stateFlags2 |= PLAYER_STATE2_20000000; //! @bug: EnTrt_ContinueShopping gets overwritten by EnTrt_ItemGiven this->actionFunc = EnTrt_ContinueShopping; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } } func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); @@ -517,19 +517,19 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) { u8 cursorIndex; if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookForwardCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookForwardCutscene; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } else if (talkState == TEXT_STATE_CHOICE) { func_8011552C(play, DO_ACTION_DECIDE); @@ -551,25 +551,25 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) { void EnTrt_LookToShelf(EnTrt* this, PlayState* play) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShelfCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShelfCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; EnTrt_UpdateCursorPos(play, this); this->actionFunc = EnTrt_BrowseShelf; Message_ContinueTextbox(play, EnTrt_GetItemTextId(this)); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -675,7 +675,7 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) { switch (item->canBuyFunc(play, item)) { case CANBUY_RESULT_SUCCESS_1: if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } func_8019F208(); @@ -746,7 +746,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { EnTrt_SetupCannotBuy(play, this, 0x846); } else { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } EnTrt_SetupBuyItemWithFanfare(play, this); @@ -790,11 +790,11 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) { this->flags |= ENTRT_MET; } if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookForwardCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookForwardCutscene; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } player->stateFlags2 |= PLAYER_STATE2_20000000; @@ -831,11 +831,11 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookForwardCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookForwardCutscene; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } player->stateFlags2 |= PLAYER_STATE2_20000000; @@ -866,11 +866,11 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { s16 animLastFrame = Animation_GetLastFrame(&gKotakeWakeUpAnim) / (s16)this->skelAnime.playSpeed; if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING_SPECIAL; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { if (this->animIndex != TRT_ANIM_HANDS_ON_COUNTER) { @@ -923,11 +923,11 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { void EnTrt_Surprised(EnTrt* this, PlayState* play) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING_SPECIAL; } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { if (DECR(this->timer) == 0) { @@ -954,7 +954,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (Inventory_HasEmptyBottle() || !CHECK_WEEKEVENTREG(WEEKEVENTREG_12_10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } this->actionFunc = EnTrt_GiveRedPotionForKoume; @@ -973,7 +973,7 @@ void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play) { if (this->textId == 0x83C) { if (Inventory_HasEmptyBottle()) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } play->msgCtx.msgMode = 0x43; @@ -997,17 +997,17 @@ void EnTrt_ItemGiven(EnTrt* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); player->stateFlags2 |= PLAYER_STATE2_20000000; this->actionFunc = EnTrt_ContinueShopping; this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -1054,7 +1054,7 @@ void EnTrt_ShopkeeperGone(EnTrt* this, PlayState* play) { } } if ((talkState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 5); } else { play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 5); @@ -1098,11 +1098,11 @@ void EnTrt_SetupItemGiven(EnTrt* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->actionFunc = EnTrt_ItemGiven; if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); } func_800B85E0(&this->actor, play, 400.0f, PLAYER_IA_MINUS1); } @@ -1440,23 +1440,23 @@ void EnTrt_SetupLookToShopkeeperFromShelf(PlayState* play, EnTrt* this) { void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, PlayState* play) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { - ActorCutscene_Stop(this->cutscene); + CutsceneManager_Stop(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; } if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - this->cutscene = this->lookToShopkeeperCutscene; - ActorCutscene_SetIntentToPlay(this->cutscene); + this->csId = this->lookToShopkeeperCsId; + CutsceneManager_Queue(this->csId); this->cutsceneState = ENTRT_CUTSCENESTATE_WAITING; } else if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetFlag(this->cutscene, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor); this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING; EnTrt_StartShopping(play, this); } else { - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } } @@ -1473,7 +1473,7 @@ void EnTrt_InitShopkeeper(EnTrt* this, PlayState* play) { void EnTrt_InitShop(EnTrt* this, PlayState* play) { EnTrt_GetCutscenes(this, play); - this->cutscene = this->lookForwardCutscene; + this->csId = this->lookForwardCutscene; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); EnTrt_InitShopkeeper(this, play); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -1553,10 +1553,10 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) { } void EnTrt_GetCutscenes(EnTrt* this, PlayState* play) { - this->lookForwardCutscene = this->actor.cutscene; - this->lookToShelfCutscene = ActorCutscene_GetAdditionalCutscene(this->lookForwardCutscene); - this->lookToShopkeeperCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShelfCutscene); - this->getMushroomCutscene = ActorCutscene_GetAdditionalCutscene(this->lookToShopkeeperCutscene); + this->lookForwardCutscene = this->actor.csId; + this->lookToShelfCsId = CutsceneManager_GetAdditionalCsId(this->lookForwardCutscene); + this->lookToShopkeeperCsId = CutsceneManager_GetAdditionalCsId(this->lookToShelfCsId); + this->getMushroomCsId = CutsceneManager_GetAdditionalCsId(this->lookToShopkeeperCsId); } void EnTrt_DrawCursor(PlayState* play, EnTrt* this, f32 x, f32 y, f32 z, u8 drawCursor) { diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.h b/src/overlays/actors/ovl_En_Trt/z_en_trt.h index c81032af5..dfa3ba5c4 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.h +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.h @@ -35,8 +35,8 @@ typedef struct EnTrt { /* 0x3D6 */ s16 blinkTimer; /* 0x3D8 */ s16 eyeTexIndex; /* 0x3DC */ EnTrtBlinkFunc blinkFunc; - /* 0x3E0 */ s16 cutscene; - /* 0x3E2 */ s16 tmpGetMushroomCutscene; + /* 0x3E0 */ s16 csId; + /* 0x3E2 */ s16 tmpGetMushroomCsId; /* 0x3E4 */ Vec3f cursorPos; /* 0x3F0 */ Color_RGBAu32 cursorColor; /* 0x400 */ u8 drawCursor; @@ -46,9 +46,9 @@ typedef struct EnTrt { /* 0x408 */ u16 prevTextId; /* 0x40A */ u16 talkOptionTextId; /* 0x40C */ s16 lookForwardCutscene; - /* 0x40E */ s16 lookToShelfCutscene; - /* 0x410 */ s16 lookToShopkeeperCutscene; - /* 0x412 */ s16 getMushroomCutscene; + /* 0x40E */ s16 lookToShelfCsId; + /* 0x410 */ s16 lookToShopkeeperCsId; + /* 0x412 */ s16 getMushroomCsId; /* 0x414 */ UNK_TYPE1 pad414[0x2]; /* 0x416 */ Vec3s headRot; /* 0x41C */ Vec3f headPos; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index cdf1c6483..67f52e064 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -189,15 +189,15 @@ void func_80AD3530(EnTrt2* this, PlayState* play) { } void func_80AD3664(EnTrt2* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->unk_3DA)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_3DA, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); if (this->unk_3D9 == 0) { this->unk_3B2 = 1; } else { this->unk_3B2 = 2; } } else { - ActorCutscene_SetIntentToPlay(this->unk_3DA); + CutsceneManager_Queue(this->csId); return; } func_800B9010(&this->actor, NA_SE_EN_KOTAKE_FLY - SFX_FLAG); @@ -217,9 +217,9 @@ void func_80AD36EC(EnTrt2* this, PlayState* play) { this->unk_3D9 = 1; this->actor.velocity.y = 0.0f; this->path = SubS_GetPathByIndex(play, this->path->unk1, -1); - ActorCutscene_Stop(this->unk_3DA); - this->unk_3DA = ActorCutscene_GetAdditionalCutscene(this->unk_3DA); - ActorCutscene_SetIntentToPlay(this->unk_3DA); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); + CutsceneManager_Queue(this->csId); this->unk_3B2 = 0; } else { this->unk_1E4++; @@ -262,7 +262,7 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) { this->actor.world.rot.x = -this->actor.shape.rot.x; if (func_80AD475C(this, this->path, this->unk_1E4)) { if (this->unk_1E4 >= (this->path->count - 1)) { - ActorCutscene_Stop(this->unk_3DA); + CutsceneManager_Stop(this->csId); this->unk_3D9 = 2; } else { this->unk_1E4++; @@ -271,7 +271,7 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->unk_1E4 >= (this->path->count - 1)) { - ActorCutscene_Stop(this->unk_3DA); + CutsceneManager_Stop(this->csId); this->unk_3D9 = 2; } else { sp30.y = this->actor.wallYaw; @@ -466,15 +466,15 @@ void func_80AD417C(EnTrt2* this, PlayState* play) { void func_80AD4298(EnTrt2* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (ActorCutscene_GetCanPlayNext(this->unk_3DA)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_3DA, &this->actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); player->stateFlags1 |= PLAYER_STATE1_20; this->unk_3B2 = 6; } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->unk_3DA); + CutsceneManager_Queue(this->csId); } } @@ -492,7 +492,7 @@ void func_80AD434C(EnTrt2* this, PlayState* play) { if (this->actor.world.pos.y > 200.0f) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_3B2 = 0x13; - ActorCutscene_Stop(this->unk_3DA); + CutsceneManager_Stop(this->csId); } else { s32 i; Vec3f sp68; @@ -738,7 +738,7 @@ void func_80AD4DB4(EnTrt2* this, PlayState* play) { this->unk_3C0 = 0; this->unk_3D8 = false; - this->unk_3DA = this->actor.cutscene; + this->csId = this->actor.csId; this->unk_3B6 = 20; this->unk_3B8 = 0; this->unk_3BC = func_80AD4608; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h index 44c2565f7..f30f41d80 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h @@ -38,7 +38,7 @@ typedef struct EnTrt2 { /* 0x3D6 */ s16 unk_3D6; /* 0x3D8 */ u8 unk_3D8; /* 0x3D9 */ u8 unk_3D9; - /* 0x3DA */ s16 unk_3DA; + /* 0x3DA */ s16 csId; } EnTrt2; // size = 0x3DC #endif // Z_EN_TRT2_H diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index a9335f850..bb146784d 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -771,7 +771,7 @@ s32 func_80A875AC(Actor* thisx, PlayState* play) { switch (this->unk_364) { case 0: if ((this->unk_34E & 0x40) || CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { - this->unk_374 = this->actor.cutscene; + this->csId = this->actor.csId; this->unk_364++; } else { this->unk_364++; @@ -780,14 +780,14 @@ s32 func_80A875AC(Actor* thisx, PlayState* play) { } case 1: - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_374); - } else if (ActorCutscene_GetCanPlayNext(this->unk_374)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_374, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId); + } else if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_364++; } else { - ActorCutscene_SetIntentToPlay(this->unk_374); + CutsceneManager_Queue(this->csId); } break; @@ -867,19 +867,19 @@ s32 func_80A87880(Actor* thisx, PlayState* play) { switch (this->unk_364) { case 0: - ActorCutscene_Stop(this->unk_374); - this->unk_374 = ActorCutscene_GetAdditionalCutscene(this->unk_374); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); this->unk_364++; case 1: - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_374); - } else if (ActorCutscene_GetCanPlayNext(this->unk_374)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_374, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId); + } else if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_364++; } else { - ActorCutscene_SetIntentToPlay(this->unk_374); + CutsceneManager_Queue(this->csId); } break; @@ -999,19 +999,19 @@ s32 func_80A87DC0(Actor* thisx, PlayState* play) { switch (this->unk_364) { case 0: - ActorCutscene_Stop(this->unk_374); - this->unk_374 = ActorCutscene_GetAdditionalCutscene(this->unk_374); + CutsceneManager_Stop(this->csId); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); this->unk_364++; case 1: - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_374); - } else if (ActorCutscene_GetCanPlayNext(this->unk_374)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_374, &this->actor); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csId); + } else if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); this->unk_364++; } else { - ActorCutscene_SetIntentToPlay(this->unk_374); + CutsceneManager_Queue(this->csId); } break; @@ -1102,8 +1102,8 @@ void func_80A881E0(EnTru* this, PlayState* play) { this->unk_34E |= 0x80; } - if (ActorCutscene_GetCurrentIndex() != -1) { - ActorCutscene_Stop(ActorCutscene_GetCurrentIndex()); + if (CutsceneManager_GetCurrentCsId() != CS_ID_NONE) { + CutsceneManager_Stop(CutsceneManager_GetCurrentCsId()); } if (!(this->unk_34E & 0x40) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_16_10)) { diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.h b/src/overlays/actors/ovl_En_Tru/z_en_tru.h index 48964b555..c6d2af00c 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.h +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.h @@ -49,7 +49,7 @@ typedef struct EnTru { /* 0x36E */ s16 eyeTexIndex; /* 0x370 */ s16 unk_370; /* 0x372 */ s16 unk_372; - /* 0x374 */ s16 unk_374; + /* 0x374 */ s16 csId; /* 0x378 */ EnTruUnkFunc unk_378; /* 0x37C */ s32 animIndex; /* 0x380 */ UNK_TYPE1 unk380[0x4]; diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index aaa022f7a..22ce0600c 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -103,7 +103,7 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) { break; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_0) { this->actionFunc = func_80AE0D78; } else { @@ -144,7 +144,7 @@ void EnTsn_Init(Actor* thisx, PlayState* play) { this->actor.terminalVelocity = -9.0f; this->actor.gravity = -1.0f; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } } @@ -369,7 +369,7 @@ void func_80AE0698(EnTsn* this, PlayState* play) { this->actionFunc = func_80AE0C88; this->unk_220 &= ~2; this->actor.focus.pos = this->actor.world.pos; - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); ENTSN_SET_Z(&this->unk_1D8->actor, false); } @@ -433,7 +433,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { func_80AE0460(this, play); this->unk_220 &= ~2; this->actor.focus.pos = this->actor.world.pos; - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); this->actor.flags &= ~ACTOR_FLAG_TALK_REQUESTED; REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); } else { @@ -515,16 +515,16 @@ void func_80AE0704(EnTsn* this, PlayState* play) { } if (this->unk_220 & 4) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { this->unk_220 &= ~4; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->unk_220 &= ~4; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } @@ -545,7 +545,7 @@ void func_80AE0D10(EnTsn* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->actionFunc = func_80AE0D78; - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index 3f15ff8c8..6d5522e8a 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -126,9 +126,9 @@ void EnWarpTag_Unused809C09A0(EnWarptag* this, PlayState* play) { */ void EnWarpTag_Unused809C0A20(EnWarptag* this, PlayState* play) { if (play->msgCtx.ocarinaMode == 9) { - func_800B7298(play, NULL, PLAYER_CSMODE_7); + func_800B7298(play, NULL, PLAYER_CSMODE_WAIT); this->actionFunc = EnWarpTag_RespawnPlayer; - ActorCutscene_Stop(ActorCutscene_GetCurrentIndex()); + CutsceneManager_Stop(CutsceneManager_GetCurrentCsId()); } else if (play->msgCtx.ocarinaMode >= 2) { play->msgCtx.ocarinaMode = 4; @@ -141,7 +141,7 @@ void EnWarpTag_Unused809C0A20(EnWarptag* this, PlayState* play) { */ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { ActorEntry* playerActorEntry; - Player* player; + Player* player = GET_PLAYER(play); s32 playerSpawnIndex; s32 new15E; s32 entrance; @@ -149,13 +149,13 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { u8 playerForm; s16 playerParams; - player = GET_PLAYER(play); - if (play->playerActorCsIds[4] >= 0 && ActorCutscene_GetCurrentIndex() != play->playerActorCsIds[4]) { - if (ActorCutscene_GetCanPlayNext(play->playerActorCsIds[4]) == 0) { - ActorCutscene_SetIntentToPlay(play->playerActorCsIds[4]); + if (play->playerCsIds[PLAYER_CS_ID_WARP_PAD_MOON] >= 0 && + CutsceneManager_GetCurrentCsId() != play->playerCsIds[PLAYER_CS_ID_WARP_PAD_MOON]) { + if (!CutsceneManager_IsNext(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_MOON])) { + CutsceneManager_Queue(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_MOON]); } else { - ActorCutscene_StartAndSetUnkLinkFields(play->playerActorCsIds[4], &this->dyna.actor); + CutsceneManager_StartWithPlayerCs(play->playerCsIds[PLAYER_CS_ID_WARP_PAD_MOON], &this->dyna.actor); Player_PlaySfx(player, NA_SE_PL_WARP_PLATE); Play_EnableMotionBlur(0); } @@ -231,11 +231,11 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { * ActionFunc: Deku Playground, return to North Clock Town. */ void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() != this->dyna.actor.cutscene) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_GetCurrentCsId() != this->dyna.actor.csId) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 530b75b0e..e81b5dabc 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -77,7 +77,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag_SetupAction(this, func_80966A08); break; case WEATHERTAG_TYPE_UNK1: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { Actor_Kill(&this->actor); } EnWeatherTag_SetupAction(this, func_80966B08); @@ -246,11 +246,11 @@ void func_80966B08(EnWeatherTag* this, PlayState* play) { // because it uses cutsecnes.. is this the clear ikana cutcsene? void func_80966BF4(EnWeatherTag* this, PlayState* play) { u8 newUnk20; - CsCmdActorAction* tmpAction; + CsCmdActorCue* cue; - if (Cutscene_CheckActorAction(play, 567)) { - tmpAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 567)]; - if ((play->csCtx.frames >= tmpAction->startFrame) && (tmpAction->action >= 2)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_567)) { + cue = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_567)]; + if ((play->csCtx.curFrame >= cue->startFrame) && (cue->id >= 2)) { switch (gSaveContext.save.day) { case 0: case 1: @@ -379,14 +379,13 @@ void func_80967060(EnWeatherTag* this, PlayState* play) { // type 4_3, start cutscene then die? void func_80967148(EnWeatherTag* this, PlayState* play) { - s16 tempCutscene; + s16 csId = this->actor.csId; - tempCutscene = this->actor.cutscene; - if (ActorCutscene_GetCanPlayNext(tempCutscene)) { - ActorCutscene_Start(tempCutscene, &this->actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_Start(csId, &this->actor); EnWeatherTag_SetupAction(this, EnWeatherTag_DoNothing); } else { - ActorCutscene_SetIntentToPlay(tempCutscene); + CutsceneManager_Queue(csId); } } @@ -485,7 +484,7 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) && - (play->transitionTrigger == TRANS_TRIGGER_OFF) && (ActorCutscene_GetCurrentIndex() == -1) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (play->csCtx.state == 0)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c index ac8375c24..125be5056 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -668,13 +668,13 @@ void EnWiz_MoveGhosts(EnWiz* this) { } void EnWiz_StartIntroCutscene(EnWiz* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetFlag(this->actor.cutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCsAndSetFlag(this->actor.csId, &this->actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); this->actor.flags |= ACTOR_FLAG_100000; EnWiz_SetupAppear(this, play); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -828,13 +828,13 @@ void EnWiz_Dance(EnWiz* this, PlayState* play) { } void EnWiz_SetupSecondPhaseCutscene(EnWiz* this, PlayState* play) { - s16 secondPhaseCutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + s16 secondPhaseCsId = CutsceneManager_GetAdditionalCsId(this->actor.csId); - if (!ActorCutscene_GetCanPlayNext(secondPhaseCutscene)) { - ActorCutscene_SetIntentToPlay(secondPhaseCutscene); + if (!CutsceneManager_IsNext(secondPhaseCsId)) { + CutsceneManager_Queue(secondPhaseCsId); } else { - ActorCutscene_StartAndSetFlag(secondPhaseCutscene, &this->actor); - this->subCamId = ActorCutscene_GetCurrentSubCamId(secondPhaseCutscene); + CutsceneManager_StartWithPlayerCsAndSetFlag(secondPhaseCsId, &this->actor); + this->subCamId = CutsceneManager_GetCurrentSubCamId(secondPhaseCsId); this->actor.flags |= ACTOR_FLAG_100000; EnWiz_ChangeAnim(this, EN_WIZ_ANIM_DANCE, false); this->action = EN_WIZ_ACTION_RUN_BETWEEN_PLATFORMS; @@ -885,7 +885,7 @@ void EnWiz_SecondPhaseCutscene(EnWiz* this, PlayState* play) { this->platformCount = 0; this->fightState = EN_WIZ_FIGHT_STATE_SECOND_PHASE_GHOSTS_COPY_WIZROBE; this->timer = 0; - ActorCutscene_Stop(ActorCutscene_GetAdditionalCutscene(this->actor.cutscene)); + CutsceneManager_Stop(CutsceneManager_GetAdditionalCsId(this->actor.csId)); this->actor.flags &= ~ACTOR_FLAG_100000; EnWiz_SetupDisappear(this); return; @@ -1037,7 +1037,7 @@ void EnWiz_Disappear(EnWiz* this, PlayState* play) { if ((this->introCutsceneState == EN_WIZ_INTRO_CS_DISAPPEAR) && (this->introCutsceneTimer == 0)) { this->introCutsceneState = EN_WIZ_INTRO_CS_END; - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); this->actor.flags &= ~ACTOR_FLAG_100000; } diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 9b74a97ac..3c0357999 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -202,7 +202,7 @@ void EnWood02_Init(Actor* thisx, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ANI, this->actor.world.pos.x, this->actor.world.pos.y + 120.0f, this->actor.world.pos.z - 15.0f, 0, 0, 0, 1); if (this->actor.child != NULL) { - this->actor.child->cutscene = this->actor.cutscene; + this->actor.child->csId = this->actor.csId; } this->unk_151 = 1; } else { diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index 35bd7113e..c5224f8e8 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -81,7 +81,7 @@ static Vec3f D_80BFB300 = { 500.0f, -500.0f, 0.0f }; void EnYb_Init(Actor* thisx, PlayState* play) { EnYb* this = THIS; - s16 tempCutscene; + s16 csId; s32 i; Actor_SetScale(&this->actor, 0.01f); @@ -102,17 +102,17 @@ void EnYb_Init(Actor* thisx, PlayState* play) { EnYb_ChangeAnim(play, this, 2, ANIMMODE_LOOP, 0.0f); - tempCutscene = this->actor.cutscene; - for (i = 0; i < ARRAY_COUNT(this->cutscenes); i++) { - this->cutscenes[i] = tempCutscene; - if (tempCutscene != -1) { - this->actor.cutscene = tempCutscene; - tempCutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + csId = this->actor.csId; + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } - this->cutsceneIndex = -1; - this->actor.cutscene = this->cutscenes[0]; + this->csIdIndex = -1; + this->actor.csId = this->csIdList[0]; // between midnight and morning start spawned if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { @@ -215,17 +215,17 @@ void EnYb_UpdateAnimation(EnYb* this, PlayState* play) { } void EnYb_FinishTeachingCutscene(EnYb* this) { - if (this->cutsceneIndex != -1) { - if (ActorCutscene_GetCurrentIndex() == this->cutscenes[this->cutsceneIndex]) { - ActorCutscene_Stop(this->cutscenes[this->cutsceneIndex]); + if (this->csIdIndex != -1) { + if (CutsceneManager_GetCurrentCsId() == this->csIdList[this->csIdIndex]) { + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); } - this->cutsceneIndex = -1; + this->csIdIndex = -1; } } -void EnYb_ChangeCutscene(EnYb* this, s16 cutsceneId) { +void EnYb_ChangeCutscene(EnYb* this, s16 csIdIndex) { EnYb_FinishTeachingCutscene(this); - this->cutsceneIndex = cutsceneId; + this->csIdIndex = csIdIndex; } /** @@ -414,16 +414,16 @@ void EnYb_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->cutsceneIndex != -1 && ActorCutscene_GetCurrentIndex() != this->cutscenes[this->cutsceneIndex]) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIndex]); - } else if (ActorCutscene_GetCanPlayNext(this->cutscenes[this->cutsceneIndex])) { - if (this->cutsceneIndex == 0) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[this->cutsceneIndex], &this->actor); + if ((this->csIdIndex != -1) && (CutsceneManager_GetCurrentCsId() != this->csIdList[this->csIdIndex])) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); + } else if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + if (this->csIdIndex == 0) { + CutsceneManager_StartWithPlayerCs(this->csIdList[this->csIdIndex], &this->actor); } } else { - ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIndex]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } } diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.h b/src/overlays/actors/ovl_En_Yb/z_en_yb.h index c7b977653..4728ef44e 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.h +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.h @@ -20,8 +20,8 @@ typedef struct EnYb { /* 0x410 */ u16 playerOcarinaOut; /* 0x412 */ s16 animIndex; /* 0x414 */ s16 alpha; - /* 0x416 */ s16 cutscenes[2]; - /* 0x41A */ s16 cutsceneIndex; + /* 0x416 */ s16 csIdList[2]; + /* 0x41A */ s16 csIdIndex; /* 0x41C */ s16 teachingCutsceneTimer; /* 0x420 */ EnYbActionFunc actionFunc; } EnYb; // size = 0x424 diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c index 263272464..5f1b16e35 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c @@ -80,7 +80,7 @@ Vec3f D_80BA1120 = { 300.0f, 900.0f, 0.0f }; void EnZob_Init(Actor* thisx, PlayState* play) { EnZob* this = THIS; s32 i; - s16 cs; + s16 csId; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -90,8 +90,8 @@ void EnZob_Init(Actor* thisx, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &object_zob_Anim_006998); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_2F4 = 0; - this->unk_30E = -1; - this->unk_310 = 0; + this->csIdIndex = -1; + this->cueId = 0; this->unk_302 = 9; this->unk_304 = 0; this->actor.terminalVelocity = -4.0f; @@ -100,16 +100,16 @@ void EnZob_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BA0728; this->actor.textId = 0; - cs = this->actor.cutscene; - for (i = 0; i < ARRAY_COUNT(this->unk_306); i++) { - this->unk_306[i] = cs; - if (cs != -1) { - this->actor.cutscene = cs; - cs = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + csId = this->actor.csId; + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } - this->actor.cutscene = this->unk_306[0]; + this->actor.csId = this->csIdList[0]; this->actor.flags |= ACTOR_FLAG_2000000; switch (ENZOB_GET_F(&this->actor)) { @@ -120,7 +120,7 @@ void EnZob_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BA0AD8; } - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); return; } @@ -135,7 +135,7 @@ void EnZob_Init(Actor* thisx, PlayState* play) { break; default: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -253,17 +253,17 @@ void func_80B9FA3C(EnZob* this, PlayState* play) { } void func_80B9FC0C(EnZob* this) { - if (this->unk_30E != -1) { - if (ActorCutscene_GetCurrentIndex() == this->unk_306[this->unk_30E]) { - ActorCutscene_Stop(this->unk_306[this->unk_30E]); + if (this->csIdIndex != -1) { + if (CutsceneManager_GetCurrentCsId() == this->csIdList[this->csIdIndex]) { + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); } - this->unk_30E = -1; + this->csIdIndex = -1; } } -void func_80B9FC70(EnZob* this, s16 arg1) { +void func_80B9FC70(EnZob* this, s16 csIdIndex) { func_80B9FC0C(this); - this->unk_30E = arg1; + this->csIdIndex = csIdIndex; } void func_80B9FCA0(EnZob* this, PlayState* play) { @@ -278,19 +278,19 @@ void func_80B9FCA0(EnZob* this, PlayState* play) { } void func_80B9FD24(EnZob* this, PlayState* play) { - s32 actionIndex; - s16 action; + s32 cueChannel; + s16 cueId; func_80B9F86C(this); - if (Cutscene_CheckActorAction(play, 500)) { - this->unk_30E = -1; - actionIndex = Cutscene_GetActorActionIndex(play, 500); - action = play->csCtx.actorActions[actionIndex]->action; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_500)) { + this->csIdIndex = -1; + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_500); + cueId = play->csCtx.actorCues[cueChannel]->id; - if (action != this->unk_310) { - this->unk_310 = action; - switch (action) { + if (this->cueId != cueId) { + this->cueId = cueId; + switch (cueId) { case 1: func_80B9F7E4(this, 8, ANIMMODE_LOOP); break; @@ -549,7 +549,7 @@ void func_80BA0610(EnZob* this, PlayState* play) { void func_80BA06BC(EnZob* this, PlayState* play) { func_80B9FD24(this, play); - if (!Cutscene_CheckActorAction(play, 500)) { + if (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_500)) { this->actionFunc = func_80BA0610; this->actor.flags |= ACTOR_FLAG_10000; func_80BA0610(this, play); @@ -572,12 +572,12 @@ void func_80BA0728(EnZob* this, PlayState* play) { this->actionFunc = func_80BA00BC; this->unk_304 = 1; func_80B9F7E4(this, 2, ANIMMODE_ONCE); - this->unk_30E = 0; + this->csIdIndex = 0; this->unk_2F4 |= 1; } else if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BA0374; func_80B9FA3C(this, play); - } else if (Cutscene_CheckActorAction(play, 500)) { + } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_500)) { this->actionFunc = func_80BA06BC; } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 60.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { @@ -684,8 +684,8 @@ void func_80BA0C14(EnZob* this, PlayState* play) { this->unk_312 = 999; } - if (Cutscene_CheckActorAction(play, 515)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_515)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_515)]->id == 1) { this->actionFunc = func_80BA0CF4; this->unk_312 = -1; } @@ -697,8 +697,8 @@ void func_80BA0C14(EnZob* this, PlayState* play) { void func_80BA0CF4(EnZob* this, PlayState* play) { func_80B9F86C(this); - if (Cutscene_CheckActorAction(play, 515) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 2)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_515) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_515)]->id == 2)) { this->actionFunc = func_80BA0C14; } } @@ -715,14 +715,14 @@ void EnZob_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if ((this->unk_30E != -1) && (ActorCutscene_GetCurrentIndex() != this->unk_306[this->unk_30E])) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_306[this->unk_30E]); - } else if (ActorCutscene_GetCanPlayNext(this->unk_306[this->unk_30E])) { - ActorCutscene_Start(this->unk_306[this->unk_30E], &this->actor); + if ((this->csIdIndex != -1) && (CutsceneManager_GetCurrentCsId() != this->csIdList[this->csIdIndex])) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); + } else if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + CutsceneManager_Start(this->csIdList[this->csIdIndex], &this->actor); } else { - ActorCutscene_SetIntentToPlay(this->unk_306[this->unk_30E]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.h b/src/overlays/actors/ovl_En_Zob/z_en_zob.h index 25ce14fdc..e0bd7bf79 100644 --- a/src/overlays/actors/ovl_En_Zob/z_en_zob.h +++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.h @@ -25,9 +25,9 @@ typedef struct EnZob { /* 0x2FC */ Vec3s unk_2FC; /* 0x302 */ s16 unk_302; /* 0x304 */ u16 unk_304; - /* 0x306 */ s16 unk_306[4]; - /* 0x30E */ s16 unk_30E; - /* 0x310 */ s16 unk_310; + /* 0x306 */ s16 csIdList[4]; + /* 0x30E */ s16 csIdIndex; + /* 0x310 */ s16 cueId; /* 0x312 */ s16 unk_312; /* 0x314 */ EnZobActionFunc actionFunc; } EnZob; // size = 0x318 diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c index 7808e8089..aaf3b85f0 100644 --- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c +++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c @@ -119,12 +119,12 @@ void EnZod_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BAFDB4; EnZod_ChangeAnim(this, ENZOD_ANIM_PLAYING_VIVACE, ANIMMODE_ONCE); this->actor.flags |= ACTOR_FLAG_10; - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); break; } this->actionFunc = func_80BAFB84; - if (!(CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80))) { + if (!(CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE))) { Actor_Kill(&this->actor); break; } @@ -137,7 +137,7 @@ void EnZod_Init(Actor* thisx, PlayState* play) { break; default: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -445,20 +445,20 @@ void EnZod_DoNothing(EnZod* this, PlayState* play) { void EnZod_Rehearse(EnZod* this, PlayState* play) { EnZod_UpdateAnimation(this); - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); - this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - if (this->actor.cutscene == -1) { + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); + this->actor.csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); + if (this->actor.csId == CS_ID_NONE) { this->actionFunc = EnZod_DoNothing; play->nextEntrance = play->setupExitList[ENZOD_GET_ENTRANCE_INDEX(&this->actor)]; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; play->transitionTrigger = TRANS_TRIGGER_START; CLEAR_WEEKEVENTREG(WEEKEVENTREG_78_01); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -468,9 +468,9 @@ void EnZod_SetupRehearse(EnZod* this, PlayState* play) { Message_CloseTextbox(play); EnZod_ChangeAnim(this, ENZOD_ANIM_PLAYING_LENTO, ANIMMODE_ONCE); this->actionFunc = EnZod_Rehearse; - ActorCutscene_Stop(this->actor.cutscene); - this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); + this->actor.csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); + CutsceneManager_Queue(this->actor.csId); SET_WEEKEVENTREG(WEEKEVENTREG_79_01); SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_INDIGO_GO_SESSION | SEQ_FLAG_ASYNC); } @@ -478,13 +478,13 @@ void EnZod_SetupRehearse(EnZod* this, PlayState* play) { void func_80BAFDB4(EnZod* this, PlayState* play) { EnZod_UpdateAnimation(this); - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); func_800B7298(play, NULL, 0x44); Message_StartTextbox(play, 0x103A, &this->actor); this->actionFunc = EnZod_SetupRehearse; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -500,8 +500,8 @@ void func_80BAFE34(EnZod* this, PlayState* play) { this->fogNear = 999; } - if (Cutscene_CheckActorAction(play, 0x203)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x203)]->action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_515)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_515)]->id == 1) { this->actionFunc = func_80BAFF14; this->fogNear = -1; } @@ -513,8 +513,8 @@ void func_80BAFE34(EnZod* this, PlayState* play) { void func_80BAFF14(EnZod* this, PlayState* play) { EnZod_UpdateAnimation(this); - if (Cutscene_CheckActorAction(play, 0x203) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x203)]->action == 4)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_515) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_515)]->id == 4)) { this->actionFunc = func_80BAFE34; } } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index fe5c1cd62..ccbb1f752 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -181,7 +181,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { s32 pad; EnZog* this = THIS; s32 i; - s16 cs; + s16 csId; if (!D_80B95E10) { for (i = 0; i < ARRAY_COUNT(D_80B958AC); i++) { @@ -206,7 +206,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) && - ((play->csCtx.currentCsIndex != 2) || (gSaveContext.sceneLayer != 0) || (play->sceneId != SCENE_30GYOSON))) { + ((play->csCtx.scriptIndex != 2) || (gSaveContext.sceneLayer != 0) || (play->sceneId != SCENE_30GYOSON))) { Actor_Kill(&this->actor); return; } @@ -219,7 +219,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { this->unk_30A = 0; this->unk_31C = 2; this->unk_31E = 0; - this->unk_31A = -1; + this->csIdIndex = -1; this->unk_322 = 100; Math_Vec3f_Copy(&this->unk_2F0, &this->actor.world.pos); @@ -245,13 +245,13 @@ void EnZog_Init(Actor* thisx, PlayState* play) { this->unk_304 = 0; this->unk_2FE = this->unk_2FC; this->unk_300 = this->unk_302; - cs = this->actor.cutscene; + csId = this->actor.csId; - for (i = 0; i < ARRAY_COUNT(this->unk_30C); i++) { - this->unk_30C[i] = cs; - if (cs != -1) { - this->actor.cutscene = cs; - cs = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); + for (i = 0; i < ARRAY_COUNT(this->csIdList); i++) { + this->csIdList[i] = csId; + if (csId != CS_ID_NONE) { + this->actor.csId = csId; + csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); } } @@ -331,17 +331,17 @@ void func_80B93A48(EnZog* this, PlayState* play) { void func_80B93B44(EnZog* this) { if (!(this->unk_30A & 4)) { - if (this->unk_31A != -1) { - ActorCutscene_Stop(this->unk_30C[this->unk_31A]); + if (this->csIdIndex != -1) { + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); } } - this->unk_31A = -1; + this->csIdIndex = -1; this->unk_30A &= ~4; } -void func_80B93BA8(EnZog* this, s16 arg1) { +void func_80B93BA8(EnZog* this, s16 csIdIndex) { func_80B93B44(this); - this->unk_31A = arg1; + this->csIdIndex = csIdIndex; this->unk_30A |= 4; } @@ -401,10 +401,10 @@ void func_80B93DE8(Vec3f* arg0, PlayState* play, s32 arg2) { } s32 func_80B93EA0(EnZog* this, PlayState* play) { - s16 sp3E; + s16 cueId; if (SkelAnime_Update(&this->skelAnime)) { - switch (this->unk_306) { + switch (this->cueId) { case 2: case 3: Animation_PlayLoop(&this->skelAnime, *D_80B958F0); @@ -458,13 +458,13 @@ s32 func_80B93EA0(EnZog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } - if (Cutscene_CheckActorAction(play, 471)) { - sp3E = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 471)]->action; - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, 471)); + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_471)) { + cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_471)]->id; + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_471)); - switch (this->unk_306) { + switch (this->cueId) { case 2: - if (play->csCtx.frames == 60) { + if (play->csCtx.curFrame == 60) { Actor_PlaySfx(&this->actor, NA_SE_EV_JUMP_SAND); } break; @@ -497,10 +497,10 @@ s32 func_80B93EA0(EnZog* this, PlayState* play) { break; } - if (this->unk_306 != sp3E) { - this->unk_306 = sp3E; + if (this->cueId != cueId) { + this->cueId = cueId; - switch (this->unk_306) { + switch (this->cueId) { case 1: func_80B939C0(this, 7, ANIMMODE_LOOP); this->unk_31C = 2; @@ -593,7 +593,7 @@ void func_80B943A0(EnZog* this, PlayState* play) { void func_80B943C0(EnZog* this, PlayState* play) { if (!(this->unk_30A & 4)) { this->actionFunc = func_80B943A0; - this->unk_306 = -1; + this->cueId = -1; } } @@ -657,7 +657,7 @@ void func_80B946B4(EnZog* this, PlayState* play) { func_80B93A48(this, play); if (!(this->unk_30A & 4)) { this->actionFunc = func_80B9461C; - this->unk_306 = -1; + this->cueId = -1; } } @@ -957,7 +957,7 @@ void EnZog_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); - if (Cutscene_CheckActorAction(play, 0x1D7) && (ENZOG_GET_F(&this->actor) != ENZOG_F_2)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_471) && (ENZOG_GET_F(&this->actor) != ENZOG_F_2)) { this->actionFunc = func_80B9461C; this->actor.shape.yOffset = 0.0f; } @@ -982,18 +982,18 @@ void EnZog_Update(Actor* thisx, PlayState* play) { this->actor.focus.pos.y += 30.0f; if (this->unk_30A & 4) { - if (this->unk_31A == -1) { + if (this->csIdIndex == -1) { this->unk_30A &= ~4; - } else if (this->unk_30C[this->unk_31A] == -1) { + } else if (this->csIdList[this->csIdIndex] == CS_ID_NONE) { this->unk_30A &= ~4; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_30C[this->unk_31A]); - } else if (ActorCutscene_GetCanPlayNext(this->unk_30C[this->unk_31A])) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_30C[this->unk_31A], &this->actor); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); + } else if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + CutsceneManager_StartWithPlayerCs(this->csIdList[this->csIdIndex], &this->actor); this->unk_30A &= ~4; } else { - ActorCutscene_SetIntentToPlay(this->unk_30C[this->unk_31A]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.h b/src/overlays/actors/ovl_En_Zog/z_en_zog.h index 9971d77fa..737168250 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.h +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.h @@ -27,11 +27,11 @@ typedef struct EnZog { /* 0x300 */ s16 unk_300; /* 0x302 */ s16 unk_302; /* 0x304 */ s16 unk_304; - /* 0x306 */ s16 unk_306; + /* 0x306 */ s16 cueId; /* 0x308 */ s16 unk_308; /* 0x30A */ u16 unk_30A; - /* 0x30C */ s16 unk_30C[7]; - /* 0x31A */ s16 unk_31A; + /* 0x30C */ s16 csIdList[7]; + /* 0x31A */ s16 csIdIndex; /* 0x31C */ s16 unk_31C; /* 0x31E */ s16 unk_31E; /* 0x320 */ s16 unk_320; diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index 17abb250d..21201346a 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -75,7 +75,10 @@ void func_80B31590(EnZoraegg* this) { void EnZoraegg_Init(Actor* thisx, PlayState* play) { s32 pad; EnZoraegg* this = THIS; - u16 sp40[] = { 457, 458, 459, 460, 461, 462, 464 }; + u16 cueTypes[] = { + CS_CMD_ACTOR_CUE_457, CS_CMD_ACTOR_CUE_458, CS_CMD_ACTOR_CUE_459, CS_CMD_ACTOR_CUE_460, + CS_CMD_ACTOR_CUE_461, CS_CMD_ACTOR_CUE_462, CS_CMD_ACTOR_CUE_464, + }; Actor_SetScale(&this->actor, 0.006f); SkelAnime_InitFlex(play, &this->skelAnime, &object_zoraegg_Skel_004C90, &object_zoraegg_Anim_005098, @@ -162,7 +165,7 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { case ENZORAEGG_1F_07: case ENZORAEGG_1F_08: case ENZORAEGG_1F_09: - this->actorActionCmd = sp40[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_03]; + this->cueType = cueTypes[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_03]; Animation_PlayOnce(&this->skelAnime, &object_zoraegg_Anim_001E08); this->unk_1EC = 1; this->unk_1EE = 0; @@ -181,7 +184,7 @@ void EnZoraegg_Init(Actor* thisx, PlayState* play) { case ENZORAEGG_1F_0E: case ENZORAEGG_1F_0F: case ENZORAEGG_1F_10: - this->actorActionCmd = sp40[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_0A]; + this->cueType = cueTypes[(ENZORAEGG_GET_1F(&this->actor)) - ENZORAEGG_1F_0A]; this->unk_1EC = 2; this->actionFunc = func_80B324B0; Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004FE4); @@ -352,7 +355,7 @@ void func_80B320E0(EnZoraegg* this, PlayState* play) { } void func_80B321D0(EnZoraegg* this, PlayState* play) { - if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { + if (CutsceneManager_GetCurrentCsId() != this->actor.csId) { this->actionFunc = func_80B322BC; func_80B319D0(play, func_80B319A8(play) + 1); } @@ -362,26 +365,26 @@ void func_80B32228(EnZoraegg* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, this->unk_1DC); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, this->unk_1DC); this->actionFunc = func_80B321D0; } else { if (this->unk_1E8 > 0) { this->unk_1E8--; } else if (this->unk_1E8 == 0) { - ActorCutscene_Stop(player->unk_A86); - player->unk_A86 = -1; + CutsceneManager_Stop(player->csId); + player->csId = CS_ID_NONE; this->unk_1E8 = -1; } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } void func_80B322BC(EnZoraegg* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->actor.cutscene != -1) { + if (this->actor.csId != CS_ID_NONE) { this->unk_1DC = func_80B31CB4(play); if (this->unk_1DC != NULL) { this->unk_1E8 = 3; @@ -400,11 +403,11 @@ void func_80B32390(EnZoraegg* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_IsNext(this->actor.csId)) { Actor* temp_v0 = func_80B31D14(play); if (temp_v0 != NULL) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, temp_v0); + CutsceneManager_StartWithPlayerCs(this->actor.csId, temp_v0); SET_EVENTINF(EVENTINF_33); Actor_Kill(&this->actor); } @@ -412,29 +415,29 @@ void func_80B32390(EnZoraegg* this, PlayState* play) { (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 30.0f)) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } void func_80B324B0(EnZoraegg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(play, this->actorActionCmd)) { + if (Cutscene_IsCueInChannel(play, this->cueType)) { if (this->unk_1EA & 4) { - if (Cutscene_CheckActorAction(play, this->actorActionCmd) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 3)) { + if (Cutscene_IsCueInChannel(play, this->cueType) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id == 3)) { Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004FE4); this->unk_1EA &= ~4; } } else { - if (Cutscene_CheckActorAction(play, this->actorActionCmd) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 4)) { + if (Cutscene_IsCueInChannel(play, this->cueType) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id == 4)) { Animation_PlayLoop(&this->skelAnime, &object_zoraegg_Anim_004E04); this->unk_1EA |= 4; } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); if ((this->unk_1EA & 4) && Animation_OnFrame(&this->skelAnime, this->unk_1E4)) { Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); @@ -453,10 +456,10 @@ void func_80B32644(EnZoraegg* this, PlayState* play) { this->unk_1EA |= 2; } - if (!Cutscene_CheckActorAction(play, this->actorActionCmd)) { + if (!Cutscene_IsCueInChannel(play, this->cueType)) { this->actionFunc = func_80B324B0; } else { - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); if (this->unk_1EE > 25) { this->unk_1EE -= 25; @@ -469,8 +472,8 @@ void func_80B32644(EnZoraegg* this, PlayState* play) { void func_80B326F4(EnZoraegg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(play, this->actorActionCmd) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 3)) { + if (Cutscene_IsCueInChannel(play, this->cueType) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id == 3)) { Animation_Change(&this->skelAnime, &object_zoraegg_Anim_004D20, 1.0f, 0.0f, Animation_GetLastFrame(&object_zoraegg_Anim_004D20), ANIMMODE_ONCE, 5.0f); this->unk_1E8 = 0; @@ -481,7 +484,7 @@ void func_80B326F4(EnZoraegg* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_2); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); if (Animation_OnFrame(&this->skelAnime, 4.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_1); @@ -504,7 +507,7 @@ void func_80B32820(EnZoraegg* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); if (Animation_OnFrame(&this->skelAnime, 16.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_ZORA_KIDS_SWIM_0); @@ -538,7 +541,7 @@ void func_80B32928(EnZoraegg* this, PlayState* play) { } } - Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->actorActionCmd)); + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetCueChannel(play, this->cueType)); if (Animation_OnFrame(&this->skelAnime, 97.0f) || Animation_OnFrame(&this->skelAnime, 101.0f) || Animation_OnFrame(&this->skelAnime, 105.0f)) { @@ -547,8 +550,8 @@ void func_80B32928(EnZoraegg* this, PlayState* play) { } void func_80B32A88(EnZoraegg* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, this->actorActionCmd) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->actorActionCmd)]->action == 2)) { + if (Cutscene_IsCueInChannel(play, this->cueType) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->id == 2)) { this->unk_1E8 = 0; this->actionFunc = func_80B32928; } @@ -570,7 +573,7 @@ void func_80B32B3C(EnZoraegg* this, PlayState* play) { void func_80B32B70(EnZoraegg* this, PlayState* play) { func_80B31C40(this, play); - if (Cutscene_CheckActorAction(play, 0x1C9)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_457)) { Actor_Kill(&this->actor); } } @@ -583,7 +586,7 @@ void func_80B32BB8(EnZoraegg* this, PlayState* play) { this->actionFunc = func_80B32B70; } - if (Cutscene_CheckActorAction(play, 0x1C9)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_457)) { Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h index f36f77c2b..18a421272 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h @@ -53,7 +53,7 @@ typedef struct EnZoraegg { /* 0x1ED */ u8 unk_1ED; /* 0x1EE */ u8 unk_1EE; /* 0x1EF */ u8 unk_1EF; - /* 0x1F0 */ u16 actorActionCmd; + /* 0x1F0 */ u16 cueType; /* 0x1F2 */ s16 unk_1F2; /* 0x1F4 */ s16 unk_1F4; /* 0x1F8 */ EnZoraeggActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 3898e754c..3c11d1bce 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -100,7 +100,7 @@ void EnZos_Init(Actor* thisx, PlayState* play) { switch (ENZOS_GET_F(&this->actor)) { case ENZOS_F_1: - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } @@ -120,7 +120,7 @@ void EnZos_Init(Actor* thisx, PlayState* play) { break; default: - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } this->actor.flags |= ACTOR_FLAG_10; @@ -280,13 +280,13 @@ void func_80BBB354(EnZos* this, PlayState* play) { void func_80BBB414(EnZos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Cutscene_CheckActorAction(play, 501)) { - s16 action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 501)]->action; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_501)) { + s16 cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_501)]->id; - if (action != this->unk_2BA) { - this->unk_2BA = action; + if (this->cueId != cueId) { + this->cueId = cueId; - switch (action) { + switch (cueId) { case 1: EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD_AND_SIGH, ANIMMODE_LOOP); break; @@ -302,15 +302,15 @@ void func_80BBB414(EnZos* this, PlayState* play) { void func_80BBB4CC(EnZos* this, PlayState* play) { func_80BBB414(this, play); - if ((this->actor.cutscene != -1) && (ActorCutscene_GetCurrentIndex() != this->actor.cutscene)) { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); - this->actor.cutscene = -1; + if ((this->actor.csId != CS_ID_NONE) && (CutsceneManager_GetCurrentCsId() != this->actor.csId)) { + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); + this->actor.csId = CS_ID_NONE; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } @@ -534,7 +534,7 @@ void func_80BBBCBC(EnZos* this, PlayState* play) { void func_80BBBD5C(EnZos* this, PlayState* play) { func_80BBB414(this, play); - if (!Cutscene_CheckActorAction(play, 0x1F5)) { + if (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_501)) { this->actionFunc = func_80BBBCBC; this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); @@ -567,7 +567,7 @@ void func_80BBBDE0(EnZos* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_80BBB8AC; func_80BBB15C(this, play); - } else if (Cutscene_CheckActorAction(play, 0x1F5)) { + } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_501)) { this->actionFunc = func_80BBBD5C; } else if (func_80BBAF5C(this, play)) { func_800B8614(&this->actor, play, 120.0f); @@ -675,8 +675,8 @@ void func_80BBC298(EnZos* this, PlayState* play) { this->unk_2BC = 999; } - if (Cutscene_CheckActorAction(play, 515)) { - if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_515)) { + if (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_515)]->id == 1) { this->actionFunc = func_80BBC37C; this->unk_2BC = -1; } @@ -688,8 +688,8 @@ void func_80BBC298(EnZos* this, PlayState* play) { void func_80BBC37C(EnZos* this, PlayState* play) { func_80BBAFFC(this, play); - if (Cutscene_CheckActorAction(play, 515) && - (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 515)]->action == 3)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_515) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_515)]->id == 3)) { this->actionFunc = func_80BBC298; } } diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.h b/src/overlays/actors/ovl_En_Zos/z_en_zos.h index e3ede7b28..669430a0c 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.h +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.h @@ -26,7 +26,7 @@ typedef struct EnZos { /* 0x2B0 */ UNK_TYPE1 unk2B0[6]; /* 0x2B6 */ u16 unk_2B6; /* 0x2B8 */ s16 animIndex; - /* 0x2BA */ s16 unk_2BA; + /* 0x2BA */ s16 cueId; /* 0x2BC */ s16 unk_2BC; /* 0x2C0 */ EnZosActionFunc actionFunc; } EnZos; // size = 0x2C4 diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index a24791080..f382cdf80 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -185,14 +185,14 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { func_80B96BEC(this, 2, ANIMMODE_LOOP); this->actor.colChkInfo.cylRadius = 0; this->actor.shape.yOffset = -1400.0f; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } break; case 18: this->actionFunc = func_80B99384; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } break; @@ -220,7 +220,8 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { break; } - if ((ENZOT_GET_1F(thisx) >= 2) && (ENZOT_GET_1F(thisx) < 11) && CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if ((ENZOT_GET_1F(thisx) >= 2) && (ENZOT_GET_1F(thisx) < 11) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->actor); } } @@ -488,8 +489,8 @@ void func_80B973BC(EnZot* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; this->actor.textId = 0; this->actionFunc = func_80B97708; - if ((this->actor.cutscene != -1) && !(this->unk_2F2 & 1)) { - ActorCutscene_Stop(this->actor.cutscene); + if ((this->actor.csId != CS_ID_NONE) && !(this->unk_2F2 & 1)) { + CutsceneManager_Stop(this->actor.csId); } this->unk_2F2 &= ~1; break; @@ -497,16 +498,16 @@ void func_80B973BC(EnZot* this, PlayState* play) { } if (this->unk_2F2 & 1) { - if (this->actor.cutscene == -1) { + if (this->actor.csId == CS_ID_NONE) { this->unk_2F2 &= ~1; - } else if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); - } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->actor.csId); + } else if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->unk_2F2 &= ~1; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c index 5a93d91cc..c6dca4bd7 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c @@ -91,10 +91,10 @@ void EnZov_Init(Actor* thisx, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &object_zov_Anim_00D3EC); this->unk_320 = 0; - this->unk_32C = -1; - this->unk_326 = -1; - this->unk_328[0] = this->picto.actor.cutscene; - this->unk_328[1] = 0x7C; + this->csIdIndex = -1; + this->cueId = -1; + this->csIdList[0] = this->picto.actor.csId; + this->csIdList[1] = CS_ID_GLOBAL_TALK; this->unk_322 = 0; this->actionFunc = func_80BD1C84; this->picto.validationFunc = EnZov_ValidatePictograph; @@ -107,7 +107,7 @@ void EnZov_Init(Actor* thisx, PlayState* play) { case ENZOV_F_1: this->actionFunc = func_80BD1F1C; func_80BD1570(this, 9, ANIMMODE_LOOP); - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { Actor_Kill(&this->picto.actor); return; } @@ -120,7 +120,7 @@ void EnZov_Init(Actor* thisx, PlayState* play) { default: this->unk_320 |= 2; - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80) || CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE) || CHECK_WEEKEVENTREG(WEEKEVENTREG_53_20)) { Actor_Kill(&this->picto.actor); } break; @@ -134,17 +134,17 @@ void EnZov_Destroy(Actor* thisx, PlayState* play) { } void func_80BD13DC(EnZov* this) { - if (this->unk_32C != -1) { - if (ActorCutscene_GetCurrentIndex() == this->unk_328[this->unk_32C]) { - ActorCutscene_Stop(this->unk_328[this->unk_32C]); + if (this->csIdIndex != -1) { + if (CutsceneManager_GetCurrentCsId() == this->csIdList[this->csIdIndex]) { + CutsceneManager_Stop(this->csIdList[this->csIdIndex]); } - this->unk_32C = -1; + this->csIdIndex = -1; } } void func_80BD1440(EnZov* this, s16 arg1) { func_80BD13DC(this); - this->unk_32C = arg1; + this->csIdIndex = arg1; } void func_80BD1470(EnZov* this, s16 index, u8 mode, f32 transitionRate) { @@ -328,12 +328,12 @@ void func_80BD19FC(EnZov* this, PlayState* play) { s32 func_80BD1AE0(EnZov* this, PlayState* play) { func_80BD1764(this); - if (Cutscene_CheckActorAction(play, 504)) { - s16 action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 504)]->action; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_504)) { + s16 cueId = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_504)]->id; - if (action != this->unk_326) { - this->unk_326 = action; - switch (this->unk_326) { + if (this->cueId != cueId) { + this->cueId = cueId; + switch (this->cueId) { case 1: func_80BD1570(this, 0, ANIMMODE_LOOP); break; @@ -367,7 +367,7 @@ void func_80BD1BF0(EnZov* this, PlayState* play) { void func_80BD1C38(EnZov* this, PlayState* play) { if (func_80BD1AE0(this, play)) { - Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetActorActionIndex(play, 504)); + Cutscene_ActorTranslateAndYaw(&this->picto.actor, play, Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_504)); } } @@ -381,7 +381,7 @@ void func_80BD1C84(EnZov* this, PlayState* play) { func_800B8614(&this->picto.actor, play, 120.0f); } - if (Cutscene_CheckActorAction(play, 0x1F8)) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_504)) { this->actionFunc = func_80BD1BF0; func_80BD1BF0(this, play); } @@ -480,7 +480,7 @@ void EnZov_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (!Cutscene_CheckActorAction(play, 0x1F8)) { + if (!Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_504)) { this->unk_320 &= ~0x10; } @@ -506,14 +506,14 @@ void EnZov_Update(Actor* thisx, PlayState* play) { this->unk_2EC = 0; } - if ((this->unk_32C != -1) && (ActorCutscene_GetCurrentIndex() != this->unk_328[this->unk_32C])) { - if ((this->unk_32C == 0) && (ActorCutscene_GetCurrentIndex() == 0x7C)) { - ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_328[this->unk_32C]); - } else if (ActorCutscene_GetCanPlayNext(this->unk_328[this->unk_32C])) { - ActorCutscene_Start(this->unk_328[this->unk_32C], &this->picto.actor); + if ((this->csIdIndex != -1) && (CutsceneManager_GetCurrentCsId() != this->csIdList[this->csIdIndex])) { + if ((this->csIdIndex == 0) && (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK)) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); + } else if (CutsceneManager_IsNext(this->csIdList[this->csIdIndex])) { + CutsceneManager_Start(this->csIdList[this->csIdIndex], &this->picto.actor); } else { - ActorCutscene_SetIntentToPlay(this->unk_328[this->unk_32C]); + CutsceneManager_Queue(this->csIdList[this->csIdIndex]); } } } diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.h b/src/overlays/actors/ovl_En_Zov/z_en_zov.h index a5e217ca3..7e1204100 100644 --- a/src/overlays/actors/ovl_En_Zov/z_en_zov.h +++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.h @@ -30,9 +30,9 @@ typedef struct EnZov { /* 0x320 */ u16 unk_320; /* 0x322 */ s16 unk_322; /* 0x324 */ s16 unk_324; - /* 0x326 */ s16 unk_326; - /* 0x328 */ s16 unk_328[2]; - /* 0x32C */ s16 unk_32C; + /* 0x326 */ s16 cueId; + /* 0x328 */ s16 csIdList[2]; + /* 0x32C */ s16 csIdIndex; /* 0x330 */ EnZovActionFunc actionFunc; } EnZov; // size = 0x334 diff --git a/src/overlays/actors/ovl_En_Zow/z_en_zow.c b/src/overlays/actors/ovl_En_Zow/z_en_zow.c index 638fa0263..446470dbe 100644 --- a/src/overlays/actors/ovl_En_Zow/z_en_zow.c +++ b/src/overlays/actors/ovl_En_Zow/z_en_zow.c @@ -357,7 +357,7 @@ void func_80BDD1E0(EnZow* this, PlayState* play) { u16 phi_a1; if (ENZOW_GET_F(&this->actor) == ENZOW_F_1) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_78_04)) { phi_a1 = 0x12FD; @@ -384,7 +384,7 @@ void func_80BDD1E0(EnZow* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_78_10); phi_a1 = 0x12FF; } - } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) { + } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { phi_a1 = 0x12EC; } else { diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index b6c5be123..7cc5dfb17 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -588,20 +588,20 @@ void func_809381B0(ObjBean* this) { void func_809381C4(ObjBean* this, PlayState* play) { this->unk_1E8(this); - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - if (this->dyna.actor.cutscene >= 0) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); + if (this->dyna.actor.csId >= 0) { func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_1); } this->unk_1E4 = 2; func_80938284(this); } else if (this->unk_1E4 == 4) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); play_sound(NA_SE_SY_ERROR); this->unk_1E4 = 0; func_80937FB0(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -618,7 +618,7 @@ void func_80938298(ObjBean* this, PlayState* play) { this->unk_1E4 = 5; func_8093833C(this); } else if (this->unk_1E4 == 4) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); play_sound(NA_SE_SY_ERROR); this->unk_1E4 = 0; func_80937FB0(this); @@ -634,7 +634,7 @@ void func_80938358(ObjBean* this, PlayState* play) { this->unk_1E8(this); if (this->unk_1B2 <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); func_80937FB0(this); } } @@ -735,7 +735,7 @@ void func_80938704(ObjBean* this) { void func_80938728(ObjBean* this, PlayState* play) { if (this->unk_200 != 0) { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); func_8093876C(this); } } @@ -745,16 +745,16 @@ void func_8093876C(ObjBean* this) { } void func_80938780(ObjBean* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - if (this->dyna.actor.cutscene >= 0) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); + if (this->dyna.actor.csId >= 0) { func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_1); } this->unk_1B4 = 36; func_80937130(this); func_80938AA4(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -909,7 +909,7 @@ void ObjBean_Update(Actor* thisx, PlayState* play) { if (this->unk_1B4 > 0) { this->unk_1B4--; if (this->unk_1B4 == 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c index 1146175fd..85468c59c 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -182,7 +182,7 @@ void func_80AE8FD4(ObjBigicicle* this, PlayState* play) { if ((this->collider1.base.acFlags & AC_HIT) || ((this->collider2.base.acFlags & AC_HIT) && (this->collider2.info.acHitInfo->toucher.dmgFlags & 0x3820))) { if ((this->unk_148 == 0) || (this->unk_149 == 1)) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_80AE9090; return; } @@ -195,8 +195,8 @@ void func_80AE8FD4(ObjBigicicle* this, PlayState* play) { } void func_80AE9090(ObjBigicicle* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->unk_149++; func_80AE8DE4(this, play); if (this->unk_149 == 2) { @@ -213,7 +213,7 @@ void func_80AE9090(ObjBigicicle* this, PlayState* play) { this->actionFunc = func_80AE9180; } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -227,7 +227,7 @@ void func_80AE9180(ObjBigicicle* this, PlayState* play) { } else { this->actor.shape.rot.x = 0x4000; this->actor.shape.rot.z = 0; - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); this->actionFunc = func_80AE8FD4; } } @@ -284,7 +284,7 @@ void func_80AE939C(ObjBigicicle* this, PlayState* play) { } SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_GLASSBROKEN_IMPACT); - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c index 437f0c234..a4f44973f 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -48,7 +48,7 @@ void ObjBlockstop_CheckForBlock(ObjBlockstop* this, PlayState* play) { s32 params = OBJOSHIHIKI_GET_F(prop); if (params < 3) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = ObjBlockstop_TryPlayCutscene; } } @@ -57,15 +57,15 @@ void ObjBlockstop_CheckForBlock(ObjBlockstop* this, PlayState* play) { } void ObjBlockstop_TryPlayCutscene(ObjBlockstop* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_IsNext(this->actor.csId)) { Flags_SetSwitch(play, this->actor.params); - if (ActorCutscene_GetLength(this->actor.cutscene) != -1) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetLength(this->actor.csId) != -1) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } Actor_Kill(&this->actor); return; } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } void ObjBlockstop_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index 6f426bfdd..43f137326 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -151,29 +151,29 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjBoat* this = THIS; - if (Cutscene_CheckActorAction(play, 511)) { - CsCmdActorAction* actionIndex = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 511)]; - if (this->csAction != actionIndex->action) { - this->dyna.actor.shape.rot.x = actionIndex->urot.x; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_511)) { + CsCmdActorCue* cue = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_511)]; - if (actionIndex->action != 1) { + if (this->cueId != cue->id) { + this->dyna.actor.shape.rot.x = cue->rot.x; + if (cue->id != 1) { Path* path = &play->setupPathList[OBJBOAT_GET_PATH(&this->dyna.actor)]; - if (actionIndex->action == 3) { + if (cue->id == 3) { path = &play->setupPathList[path->unk1]; } this->maxPointIndex = path->count; this->points = Lib_SegmentedToVirtual(path->points); Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->points); - this->dyna.actor.speed = actionIndex->urot.z * (45.0f / 0x2000); + this->dyna.actor.speed = cue->rot.z * (45.0f / 0x2000); this->points++; this->curPointIndex = 1; } - this->csAction = actionIndex->action; + this->cueId = cue->id; } else { - if (actionIndex->action != 1) { + if (cue->id != 1) { Vec3f posTarget; f32 distRemaining; @@ -185,9 +185,9 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) { } } - if (actionIndex->action != 3) { + if (cue->id != 3) { ObjBoat_SetRotations(this); - if (actionIndex->action == 2) { + if (cue->id == 2) { func_800B9010(&this->dyna.actor, NA_SE_EV_PIRATE_SHIP - SFX_FLAG); } } else { diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h index 879e2e50c..bfc7c7c2b 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h @@ -15,7 +15,7 @@ typedef struct ObjBoat { /* 0x15E */ u8 lastPointIndex; // max point if direction is negative, first point if forwards /* 0x15F */ union { u8 timer; - u8 csAction; + u8 cueId; }; /* 0x160 */ s16 angle; // Angle used to set rotations /* 0x162 */ UNK_TYPE1 pad_162; diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index d05c68571..66c927f1d 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -92,7 +92,7 @@ void ObjChan_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sObjChanCylinderInit); - SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); switch (OBJCHAN_SUBTYPE(&this->actor)) { case OBJCHAN_SUBTYPE_CHANDELIER: this->rotation = this->actor.shape.rot.y; @@ -178,12 +178,12 @@ void ObjChan_InitChandelier(ObjChan* this2, PlayState* play) { (s32)DEG_TO_BINANG_ALT3(i * 360.0f / 5.0f) + this->rotation); temp_v0 = (ObjChan*)Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_OBJ_CHAN, childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, childRot.z, - (this->actor.params & 0xFFF) | 0x1000, this->actor.cutscene, + (this->actor.params & 0xFFF) | 0x1000, this->actor.csId, this->actor.halfDaysBits, &this->actor); if (temp_v0 != NULL) { this->pots[i] = temp_v0; temp_v0->myPotIndex = i; - temp_v0->actor.cutscene = this->actor.cutscene; + temp_v0->actor.csId = this->actor.csId; } else { Actor_Kill(&this->actor); } @@ -232,13 +232,13 @@ void ObjChan_ChandelierAction(ObjChan* this2, PlayState* play) { } this->actor.shape.rot.z = (Math_SinS(this->unk1D4) * this->unk1D0); if ((this->stateFlags & OBJCHAN_STATE_START_CUTSCENE) && - SubS_StartActorCutscene(&this->actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + SubS_StartCutscene(&this->actor, this->csIdList[0], CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { this->stateFlags |= OBJCHAN_STATE_CUTSCENE; this->stateFlags &= ~OBJCHAN_STATE_START_CUTSCENE; } if ((this->stateFlags & OBJCHAN_STATE_CUTSCENE) && this->rotationSpeed == OBJCHAN_ROTATION_SPEED) { this->stateFlags &= ~OBJCHAN_STATE_CUTSCENE; - ActorCutscene_Stop(this->cutscenes[0]); + CutsceneManager_Stop(this->csIdList[0]); } Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); @@ -315,7 +315,7 @@ void ObjChan_PotAction(ObjChan* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_37_10); Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_EN_MM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x8000, - this->actor.cutscene, this->actor.halfDaysBits, NULL); + this->actor.csId, this->actor.halfDaysBits, NULL); } } Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h index f08f18adf..0e6fbca86 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.h @@ -54,7 +54,7 @@ typedef struct ObjChan { /* 0x1D8 */ f32 flameSize; /* 0x1DC */ s16 rotationSpeed; // Main object only. Slowly ramps up under some circumstances. In other circumstances it's immediately set to maximum speed. /* 0x1DE */ s16 rotation; // Increases as the chandelier spins. Don't know why they didn't use the actor's rotation variable. - /* 0x1E0 */ s16 cutscenes[2]; + /* 0x1E0 */ s16 csIdList[2]; } ObjChan; // size = 0x1E4 #endif // Z_OBJ_CHAN_H diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 957ac1433..412bade05 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -493,8 +493,8 @@ void func_8098E0B8(ObjComb* this, PlayState* play) { return; } - if ((this->unk_1B4 == 10) && (this->unk_1B6 != 0) && (this->unk_1B5 == 2) && (this->actor.cutscene >= 0)) { - if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { + if ((this->unk_1B4 == 10) && (this->unk_1B6 != 0) && (this->unk_1B5 == 2) && (this->actor.csId >= 0)) { + if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { func_800B7298(play, &this->actor, PLAYER_CSMODE_4); } } @@ -518,17 +518,17 @@ void ObjComb_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->actor.update == NULL) { - if ((this->unk_1B5 == 2) && (func_800F2138(this->actor.cutscene) == -1)) { - ActorCutscene_Stop(this->actor.cutscene); + if ((this->unk_1B5 == 2) && (CutsceneManager_GetCutsceneScriptIndex(this->actor.csId) == -1)) { + CutsceneManager_Stop(this->actor.csId); this->unk_1B5 = 0; } } else { if (this->unk_1B5 != 0) { Actor_SetFocus(&this->actor, 0.0f); if (this->unk_1B5 == 1) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); - if (this->actor.cutscene >= 0) { + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); + if (this->actor.csId >= 0) { func_800B7298(play, &this->actor, PLAYER_CSMODE_1); } @@ -539,7 +539,7 @@ void ObjComb_Update(Actor* thisx, PlayState* play) { this->unk_1B5 = 2; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } } diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index 43edd11e0..a33bf2a43 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -167,7 +167,7 @@ void ObjDanpeilift_Update(Actor* thisx, PlayState* play) { if (this->cutsceneTimer > 0) { this->cutsceneTimer--; if (this->cutsceneTimer == 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } } if (OBJDANPEILIFT_REACT_TO_PLAYER_ON_TOP(thisx)) { diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index 8af30b3fd..ee76dd9d4 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -69,37 +69,37 @@ void func_80983678(ObjDemo* this, PlayState* play) { func_80983634(play); if ((this->actor.xzDistToPlayer < this->xzRange) && (fabsf(this->actor.playerHeightRel) < this->yRange)) { if (this->unk_148 == 1) { - ActorCutscene_Stop(0x7D); + CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_80983704; } } void func_80983704(ObjDemo* this, PlayState* play) { - if ((this->unk_148 == 1) && (ActorCutscene_GetCurrentIndex() == 0x7D)) { - ActorCutscene_Stop(0x7D); - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + if ((this->unk_148 == 1) && (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_DOOR)) { + CutsceneManager_Stop(CS_ID_GLOBAL_DOOR); + CutsceneManager_Queue(this->actor.csId); } else { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_IsNext(this->actor.csId)) { if (this->unk_148 == 1) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + CutsceneManager_Start(this->actor.csId, &this->actor); func_800E0348(play->cameraPtrs[CAM_ID_MAIN]); } else { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } if (play->sceneId == SCENE_CASTLE) { SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_IKANA_CASTLE | SEQ_FLAG_ASYNC); } - this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - if (this->actor.cutscene == -1) { + this->actor.csId = CutsceneManager_GetAdditionalCsId(this->actor.csId); + if (this->actor.csId == CS_ID_NONE) { if (this->actor.params != 0xFF) { Flags_SetSwitch(play, this->actor.params); } Actor_Kill(&this->actor); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); func_80983634(play); } } diff --git a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c index a4c4e21d2..f9f86501d 100644 --- a/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c +++ b/src/overlays/actors/ovl_Obj_Fireshield/z_obj_fireshield.c @@ -77,7 +77,7 @@ static InitChainEntry sInitChain[] = { }; void func_80A4CA90(ObjFireshield* this) { - if (this->actor.cutscene >= 0) { + if (this->actor.csId >= 0) { this->actionFunc = func_80A4CABC; } else { this->actionFunc = func_80A4CC54; @@ -87,17 +87,17 @@ void func_80A4CA90(ObjFireshield* this) { void func_80A4CABC(ObjFireshield* this) { s32 pad; - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_IsNext(this->actor.csId)) { s32 sp18 = OBJFIRESHIELD_GET_7F(&this->actor); s32 temp_a0 = (sp18 & ~0x1F) >> 5; - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); this->actionFunc = func_80A4CB7C; this->unk_194 = 20; D_80A4D884[temp_a0] |= 1 << (sp18 & 0x1F); D_80A4D894[temp_a0] |= 1 << (sp18 & 0x1F); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -113,7 +113,7 @@ void func_80A4CB7C(ObjFireshield* this) { return; } - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); this->actionFunc = func_80A4CD28; D_80A4D894[(sp18 & ~0x1F) >> 5] &= ~(1 << (sp18 & 0x1F)); } diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 2a2e23c13..73aa848a2 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -61,10 +61,10 @@ void func_80B3C2B0(ObjGhaka* this) { void func_80B3C2C4(ObjGhaka* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20)) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 0, - this->dyna.actor.cutscene, this->dyna.actor.halfDaysBits, 0); + this->dyna.actor.csId, this->dyna.actor.halfDaysBits, 0); } else { - Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 1, -1, - this->dyna.actor.halfDaysBits, 0); + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_BG_GORON_OYU, 0.0f, 25.0f, 261.0f, 0, 0, 0, 1, + CS_ID_NONE, this->dyna.actor.halfDaysBits, 0); } } diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index d35c9f11e..8b851285a 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -113,7 +113,7 @@ void ObjHakaisi_Init(Actor* thisx, PlayState* play) { this->unk_19A = 0; this->unk_198 = 0; this->switchFlag = OBJHAKAISI_GET_SWITCHFLAG(thisx); - this->unk_196 = this->dyna.actor.cutscene; + this->csId = this->dyna.actor.csId; if (this->switchFlag == 0xFF) { this->switchFlag = -1; @@ -192,11 +192,11 @@ void func_80B14558(ObjHakaisi* this) { } void func_80B1456C(ObjHakaisi* this, PlayState* play) { - if (this->unk_196 != -1) { - if (ActorCutscene_GetCanPlayNext(this->unk_196)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_196, &this->dyna.actor); + if (this->csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->dyna.actor); } else { - ActorCutscene_SetIntentToPlay(this->unk_196); + CutsceneManager_Queue(this->csId); } } if (this->dyna.actor.colChkInfo.health < 30) { @@ -258,8 +258,8 @@ void func_80B149A8(ObjHakaisi* this) { void func_80B149C0(ObjHakaisi* this, PlayState* play) { if (this->unk_19A < 60) { this->unk_19A++; - } else if ((this->unk_196 != -1) && !ActorCutscene_GetCanPlayNext(this->unk_196)) { - ActorCutscene_Stop(this->unk_196); + } else if ((this->csId != CS_ID_NONE) && !CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Stop(this->csId); } } diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h index ed5341a82..1454181dd 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h @@ -17,7 +17,7 @@ typedef struct ObjHakaisi { /* 0x184 */ Vec3f unk_184; /* 0x190 */ s32 switchFlag; /* 0x194 */ s16 unk_194; - /* 0x196 */ s16 unk_196; + /* 0x196 */ s16 csId; /* 0x198 */ s16 unk_198; /* 0x19A */ s16 unk_19A; /* 0x19C */ s16 unk_19C; diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index 5be919068..7b0351e78 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -79,7 +79,7 @@ void ObjHgdoor_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, header); this->rotation = 0; this->timer = 0; - this->cutscene = this->dyna.actor.cutscene; + this->csId = this->dyna.actor.csId; ObjHgdoor_SetupIdle(this); } @@ -94,7 +94,7 @@ void ObjHgdoor_SetupIdle(ObjHgdoor* this) { } void ObjHgdoor_Idle(ObjHgdoor* this, PlayState* play) { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE) && (this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.playerHeightRel < 40.0f) && OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) { ObjHgdoor_SetChild(this, play); @@ -108,31 +108,31 @@ void ObjHgdoor_SetupCutscene(ObjHgdoor* this) { } void ObjHgdoor_PlayCutscene(ObjHgdoor* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Start(this->cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Start(this->csId, &this->dyna.actor); ObjHgdoor_SetupCsAction(this); ObjHgdoor_SetupCsAction((ObjHgdoor*)this->dyna.actor.child); } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->cutscene); + CutsceneManager_Queue(this->csId); } } void ObjHgdoor_SetupCsAction(ObjHgdoor* this) { - this->csAction = 0x63; + this->cueId = 99; this->actionFunc = ObjHgdoor_HandleCsAction; } void ObjHgdoor_HandleCsAction(ObjHgdoor* this, PlayState* play) { - s32 actionIndex; + s32 cueChannel; - if (Cutscene_CheckActorAction(play, 483)) { - actionIndex = Cutscene_GetActorActionIndex(play, 483); - if (this->csAction != play->csCtx.actorActions[actionIndex]->action) { - this->csAction = play->csCtx.actorActions[actionIndex]->action; - switch (play->csCtx.actorActions[actionIndex]->action) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_483)) { + cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_483); + if (this->cueId != play->csCtx.actorCues[cueChannel]->id) { + this->cueId = play->csCtx.actorCues[cueChannel]->id; + switch (play->csCtx.actorCues[cueChannel]->id) { case 1: Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_WOOD_DOOR_OPEN_SPEEDY); if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.parent->id == ACTOR_EN_HG)) { @@ -149,7 +149,7 @@ void ObjHgdoor_HandleCsAction(ObjHgdoor* this, PlayState* play) { ObjHgdoor_SetupStopCs(this); } } else { - this->csAction = 0x63; + this->cueId = 99; } } @@ -160,8 +160,8 @@ void ObjHgdoor_SetupStopCs(ObjHgdoor* this) { void ObjHgdoor_StopCs(ObjHgdoor* this, PlayState* play) { if (this->timer++ > 80) { - if (!ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_Stop(this->cutscene); + if (!CutsceneManager_IsNext(this->csId)) { + CutsceneManager_Stop(this->csId); } } } diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h index 7172952bb..1411a5e66 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.h @@ -13,10 +13,10 @@ typedef void (*ObjHgdoorActionFunc)(struct ObjHgdoor*, PlayState*); typedef struct ObjHgdoor { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjHgdoorActionFunc actionFunc; - /* 0x160 */ s16 cutscene; + /* 0x160 */ s16 csId; /* 0x162 */ s16 rotation; /* 0x164 */ s16 timer; - /* 0x166 */ u16 csAction; + /* 0x166 */ u16 cueId; } ObjHgdoor; // size = 0x168 #endif // Z_OBJ_HGDOOR_H diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index cade13522..e69729b92 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -380,7 +380,7 @@ void func_80A54C04(ObjHugebombiwa* this, PlayState* play) { } if (func_80A54A0C(this)) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); func_80A54CD8(this); return; } @@ -407,8 +407,8 @@ void func_80A54CD8(ObjHugebombiwa* this) { void func_80A54CEC(ObjHugebombiwa* this, PlayState* play) { s32 pad; - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); Flags_SetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor)); if (!(ENHUGEBOMBIWA_GET_100(&this->actor)) && ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_17SETUGEN2))) { @@ -429,7 +429,7 @@ void func_80A54CEC(ObjHugebombiwa* this, PlayState* play) { func_80A55310(this); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -523,7 +523,7 @@ void func_80A55064(ObjHugebombiwa* this, PlayState* play) { this->unk_4B2--; if ((this->unk_4B0 >= 20) || (this->unk_4B2 <= 0)) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); Actor_Kill(&this->actor); } } @@ -619,7 +619,7 @@ void func_80A55564(ObjHugebombiwa* this, PlayState* play) { this->unk_4B2--; if ((this->unk_4B0 >= 20) || (this->unk_4B2 <= 0)) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); Actor_Kill(&this->actor); } } diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 089cddf02..41cdd8369 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -213,7 +213,7 @@ void ObjHunsui_Init(Actor* thisx, PlayState* play) { D_80B9DED0 = Lib_SegmentedToVirtual(object_hunsui_Matanimheader_000BF0); D_80B9DED4 = Lib_SegmentedToVirtual(object_hunsui_Matanimheader_001888); - SubS_FillCutscenesList(&this->dyna.actor, this->unk_170, ARRAY_COUNT(this->unk_170)); + SubS_FillCutscenesList(&this->dyna.actor, this->csIdList, ARRAY_COUNT(this->csIdList)); this->unk_18C = 0; switch (this->unk_160) { @@ -327,7 +327,7 @@ void ObjHunsui_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((this->unk_172 & 0x40) && - SubS_StartActorCutscene(&this->dyna.actor, this->unk_17C, -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { + SubS_StartCutscene(&this->dyna.actor, this->csId, CS_ID_NONE, SUBS_CUTSCENE_WITH_PLAYER)) { this->unk_172 &= ~0x40; } @@ -355,7 +355,7 @@ void func_80B9CE64(ObjHunsui* this, PlayState* play) { if (!(this->unk_172 & 1)) { if (sp2C != this->unk_180) { - this->unk_17C = this->unk_170[0]; + this->csId = this->csIdList[0]; this->unk_172 |= 0x40; } } @@ -447,7 +447,7 @@ void func_80B9D120(ObjHunsui* this, PlayState* play) { } if (func_80B9C450(play, this->unk_168, this->unk_164)) { - this->unk_17C = this->unk_170[0]; + this->csId = this->csIdList[0]; this->unk_172 |= 0x40; func_80B9D4D0(this, play); } @@ -560,7 +560,7 @@ void func_80B9D508(ObjHunsui* this, PlayState* play) { } if (!(this->unk_172 & 1) && !func_80B9C450(play, this->unk_168, this->unk_164)) { - this->unk_17C = this->unk_170[0]; + this->csId = this->csIdList[0]; this->unk_172 |= 0x40; func_80B9D0FC(this, play); } @@ -569,7 +569,7 @@ void func_80B9D508(ObjHunsui* this, PlayState* play) { void func_80B9D714(ObjHunsui* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - s16 cs; + s16 csId; f32 sp28; if ((this->unk_16C != play->roomCtx.curRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && @@ -579,19 +579,19 @@ void func_80B9D714(ObjHunsui* this, PlayState* play) { if (Flags_GetSwitch(play, this->unk_168)) { this->unk_172 &= ~2; this->unk_172 |= 0x10; - cs = this->dyna.actor.cutscene; + csId = this->dyna.actor.csId; if (this->unk_16E == 0) { - if ((cs >= 0) && !ActorCutscene_GetCanPlayNext(cs)) { - ActorCutscene_SetIntentToPlay(cs); - } else if (cs >= 0) { - ActorCutscene_StartAndSetUnkLinkFields(cs, &this->dyna.actor); + if ((csId >= 0) && !CutsceneManager_IsNext(csId)) { + CutsceneManager_Queue(csId); + } else if (csId >= 0) { + CutsceneManager_StartWithPlayerCs(csId, &this->dyna.actor); this->unk_16E = -1; } else { this->unk_16E = 40; } } else if (this->unk_16E < 0) { - if (func_800F22C4(cs, &this->dyna.actor)) { + if (func_800F22C4(csId, &this->dyna.actor) != 0) { this->unk_16E = 40; } } else { diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h index 14a2eea62..c06abbe7d 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h @@ -31,11 +31,11 @@ typedef struct ObjHunsui { /* 0x16C */ s8 unk_16C; /* 0x16D */ s8 unk_16D; /* 0x16E */ s8 unk_16E; - /* 0x170 */ s16 unk_170[1]; + /* 0x170 */ s16 csIdList[1]; /* 0x172 */ u16 unk_172; /* 0x174 */ f32 unk_174; /* 0x178 */ f32 unk_178; - /* 0x17C */ s16 unk_17C; + /* 0x17C */ s16 csId; /* 0x180 */ s32 unk_180; /* 0x184 */ s16 unk_184; /* 0x186 */ s16 unk_186; diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index dc95eec27..0ef50dc98 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -116,7 +116,7 @@ void ObjIcePoly_Init(Actor* thisx, PlayState* play) { thisx->shape.rot.z = -0x500; if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) || - ((play->sceneId == SCENE_KAJIYA) && CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80))) { + ((play->sceneId == SCENE_KAJIYA) && CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE))) { Actor_Kill(thisx); return; } @@ -200,7 +200,7 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { (this->colliders2[1].info.acHitInfo->toucher.dmgFlags == 0x800)) || ((this->colliders2[1].base.ac->id == ACTOR_OBJ_AQUA) && (this->colliders2[1].base.ac->params == OBJAQUA_1))))) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->unk_14A = 0; this->actionFunc = func_80931E58; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; @@ -220,7 +220,7 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { } while (actor != NULL); } } else if ((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->unk_14A = 1; this->actionFunc = func_80931E58; } else { @@ -265,8 +265,8 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { } void func_80931E58(ObjIcePoly* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); if (this->unk_14A == 1) { func_80931828(this, play); Actor_Kill(&this->actor); @@ -277,7 +277,7 @@ void func_80931E58(ObjIcePoly* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_MELT); this->actionFunc = func_80931EEC; } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -327,7 +327,7 @@ void func_80931EEC(ObjIcePoly* this, PlayState* play) { this->unk_148 -= 6; if (this->unk_14A == 0) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); if (this->unk_149 != OBJICEPOLY_FF_FF) { Flags_SetSwitch(play, this->unk_149); } diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 886762306..a1e0d64bc 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -971,13 +971,13 @@ void ObjIceBlock_SetupAttemptSpawnCutscene(ObjIceblock* this) { } void ObjIceBlock_AttemptSpawnCutscene(ObjIceblock* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->extendedDrawFunc = func_80A26BF8; this->spawnCutsceneTimer = 80; func_80A25824(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -1209,7 +1209,7 @@ void func_80A25FD4(ObjIceblock* this, PlayState* play) { func_80A23370(this, sp2C); func_80A260E8(this); sp30 = false; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); this->unk_1B0 |= 1; } @@ -1255,7 +1255,7 @@ void func_80A26144(ObjIceblock* this, PlayState* play) { if ((this->unk_1B0 & 1) && (isBool || sp28 || (this->dyna.actor.xzDistToPlayer > 400.0f))) { this->unk_1B0 &= ~1; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); } if (isBool) { @@ -1454,7 +1454,7 @@ void ObjIceblock_Update(Actor* thisx, PlayState* play) { this->unk_1B0 &= ~0x100; if (this->unk_1B0 & 1) { this->unk_1B0 &= ~1; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); } func_80A266C4(this); } @@ -1463,7 +1463,7 @@ void ObjIceblock_Update(Actor* thisx, PlayState* play) { if (this->spawnCutsceneTimer > 0) { this->spawnCutsceneTimer--; if (this->spawnCutsceneTimer == 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c index 0f4f83503..276c4a28e 100644 --- a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c +++ b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c @@ -36,7 +36,7 @@ void ObjJgGakki_Init(Actor* thisx, PlayState* play2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_Init(play, &this->skelAnime, &gGoronElderDrumSkel, NULL, NULL, NULL, 0); - if (((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 7)) && (play->csCtx.currentCsIndex == 0)) { + if (((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 7)) && (play->csCtx.scriptIndex == 0)) { Animation_Change(&this->skelAnime, &gGoronElderDrumTakeOutAnim, 1.0f, frameCount, frameCount, ANIMMODE_ONCE, 0.0f); } else if ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_10YUKIYAMANOMURA)) { diff --git a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c index 65ebe75b6..31e6905ec 100644 --- a/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c +++ b/src/overlays/actors/ovl_Obj_Kzsaku/z_obj_kzsaku.c @@ -78,11 +78,11 @@ void func_80C08BBC(ObjKzsaku* this) { } void ObjKzsaku_Rise(ObjKzsaku* this, PlayState* play) { - if (this->dyna.actor.cutscene != -1) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (this->dyna.actor.csId != CS_ID_NONE) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } if (this->raisedAmount < 450.0f) { @@ -103,8 +103,8 @@ void func_80C08C84(ObjKzsaku* this) { void func_80C08CB0(ObjKzsaku* this, PlayState* play) { if (this->timer <= 20) { if (this->timer == 20) { - if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + if (CutsceneManager_GetCurrentCsId() == this->dyna.actor.csId) { + CutsceneManager_Stop(this->dyna.actor.csId); } this->timer = 21; } else { diff --git a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c index 8225c6c49..c54378a74 100644 --- a/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c +++ b/src/overlays/actors/ovl_Obj_Lightblock/z_obj_lightblock.c @@ -134,7 +134,7 @@ void func_80AF3ADC(ObjLightblock* this, PlayState* play) { } if (this->collisionCounter >= 8) { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); func_80AF3B8C(this); } else { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); @@ -146,13 +146,13 @@ void func_80AF3B8C(ObjLightblock* this) { } void func_80AF3BA0(ObjLightblock* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); Flags_SetSwitch(play, LIGHTBLOCK_DESTROYED(&this->dyna.actor)); func_80AF3910(this, play); func_80AF3C18(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -162,12 +162,12 @@ void func_80AF3C18(ObjLightblock* this) { } void func_80AF3C34(ObjLightblock* this, PlayState* play) { - s8 temp_a0; + s8 csId; this->timer--; if (this->timer <= 0) { - temp_a0 = this->dyna.actor.cutscene; - ActorCutscene_Stop(temp_a0); + csId = this->dyna.actor.csId; + CutsceneManager_Stop(csId); Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index 4518e4e29..34479a72a 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -189,13 +189,13 @@ void ObjLightswitch_SetAction(ObjLightswitch* this, ObjLightswitchSetupFunc setu } void ObjLightswitch_PlayCinema(ObjLightswitch* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); ObjLightswitch_UpdateSwitchFlags(this, play, this->switchFlagSetType); this->cutsceneTimer = 50; this->setupFunc(this); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -351,7 +351,7 @@ void ObjLightswitch_Update(Actor* thisx, PlayState* play) { if ((this->cutsceneTimer > 0) && ((s32)this->actionFunc != (s32)ObjLightswitch_PlayCinema)) { this->cutsceneTimer--; if (this->cutsceneTimer == 0) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index d544fcbfc..da16d938f 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -109,7 +109,7 @@ void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { if (Flags_GetSwitch(play, OBJMAKEKINSUTA_GET_SWITCH_FLAGS(thisx))) { this->actor.update = func_8099FD7C; - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } else { if (this->unk144 >= 0) { if (this->unk144 == 0) { @@ -127,15 +127,15 @@ void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { } void func_8099FD7C(Actor* thisx, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(thisx->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(thisx->cutscene, thisx); - if (thisx->cutscene >= 0) { + if (CutsceneManager_IsNext(thisx->csId)) { + CutsceneManager_StartWithPlayerCs(thisx->csId, thisx); + if (thisx->csId >= 0) { func_800B7298(play, thisx, PLAYER_CSMODE_4); } func_8099FB64(thisx, play); thisx->update = Actor_Noop; thisx->flags &= ~ACTOR_FLAG_10; } else { - ActorCutscene_SetIntentToPlay(thisx->cutscene); + CutsceneManager_Queue(thisx->csId); } } diff --git a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c index e2750e639..b0ac87b4e 100644 --- a/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c +++ b/src/overlays/actors/ovl_Obj_Mu_Pict/z_obj_mu_pict.c @@ -40,7 +40,7 @@ ActorInit Obj_Mu_Pict_InitVars = { void ObjMuPict_Init(Actor* thisx, PlayState* play) { ObjMuPict* this = THIS; - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20)) { + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE)) { Actor_Kill(&this->actor); } @@ -64,14 +64,14 @@ void func_80C06B70(ObjMuPict* this, PlayState* play) { s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { - if (this->actor.cutscene < 0) { + if (this->actor.csId < 0) { func_80C06DC8(this, play); func_80C06CC4(this); } else { - if (ActorCutscene_GetCurrentIndex() == 0x7C) { - ActorCutscene_Stop(0x7C); + if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { + CutsceneManager_Stop(CS_ID_GLOBAL_TALK); } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); func_80C06DC8(this, play); func_80C06C54(this); } @@ -85,11 +85,11 @@ void func_80C06C54(ObjMuPict* this) { } void func_80C06C68(ObjMuPict* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_Start(this->actor.csId, &this->actor); func_80C06CC4(this); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -113,8 +113,8 @@ void func_80C06CD8(ObjMuPict* this, PlayState* play) { case TEXT_STATE_DONE: if (Message_ShouldAdvance(play)) { func_80C06B5C(this); - if (this->actor.cutscene >= 0) { - ActorCutscene_Stop(this->actor.cutscene); + if (this->actor.csId >= 0) { + CutsceneManager_Stop(this->actor.csId); } } break; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 678f76ed0..95c43a4bf 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -139,7 +139,7 @@ void ObjMure_SpawnActors0(Actor* thisx, PlayState* play) { ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type], this->actor.cutscene, + this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type], this->actor.csId, this->actor.halfDaysBits, NULL); if (this->children[i] != NULL) { if (this->type == 0x90) { @@ -152,7 +152,7 @@ void ObjMure_SpawnActors0(Actor* thisx, PlayState* play) { ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type], this->actor.cutscene, + this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type], this->actor.csId, this->actor.halfDaysBits, NULL); if (this->children[i] != NULL) { this->children[i]->room = this->actor.room; @@ -174,7 +174,7 @@ void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { this->children[i] = Actor_SpawnAsChildAndCutscene( &play2->actorCtx, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, - (this->type == OBJMURE_TYPE_BUTTERFLY && i == 0) ? 1 : sSpawnParams[this->type], this->actor.cutscene, + (this->type == OBJMURE_TYPE_BUTTERFLY && i == 0) ? 1 : sSpawnParams[this->type], this->actor.csId, this->actor.halfDaysBits, NULL); if (this->children[i] != NULL) { this->childrenStates[i] = OBJMURE_CHILD_STATE_0; diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index bf20758ca..7f7f9550a 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -69,7 +69,7 @@ void ObjNozoki_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->dyna.actor.shape.rot.x = 0; this->dyna.actor.shape.rot.z = 0; - this->unk_15F = this->dyna.actor.cutscene; + this->csId = this->dyna.actor.csId; if (play->sceneId == SCENE_AYASHIISHOP) { this->unk_15C = 4; @@ -107,7 +107,7 @@ void func_80BA2514(ObjNozoki* this, PlayState* play) { if (this->unk_15C == 0) { Actor_SetObjectDependency(play, &this->dyna.actor); DynaPolyActor_LoadMesh(play, &this->dyna, &object_secom_obj_Colheader_0001C0); - if (ActorCutscene_GetAdditionalCutscene(this->unk_15F) >= 0) { + if (CutsceneManager_GetAdditionalCsId(this->csId) >= 0) { this->dyna.actor.params |= OBJNOZOKI_400; } ObjNozoki_SetupAction(this, func_80BA27C4); @@ -129,16 +129,16 @@ void func_80BA2514(ObjNozoki* this, PlayState* play) { } s32 func_80BA26A8(ObjNozoki* this) { - if (this->unk_15F < 0) { + if (this->csId < 0) { return true; } - if (ActorCutscene_GetCanPlayNext(this->unk_15F)) { - ActorCutscene_StartAndSetUnkLinkFields(this->unk_15F, &this->dyna.actor); + if (CutsceneManager_IsNext(this->csId)) { + CutsceneManager_StartWithPlayerCs(this->csId, &this->dyna.actor); return true; } - ActorCutscene_SetIntentToPlay(this->unk_15F); + CutsceneManager_Queue(this->csId); return false; } @@ -185,7 +185,7 @@ void func_80BA27C4(ObjNozoki* this, PlayState* play) { this->unk_15E = 25; play_sound(NA_SE_SY_SECOM_WARNING); } else { - this->unk_15E = ActorCutscene_GetLength(this->unk_15F); + this->unk_15E = CutsceneManager_GetLength(this->csId); if (this->unk_15E < 0) { this->unk_15E = 50; } @@ -213,23 +213,23 @@ void func_80BA28DC(ObjNozoki* this, PlayState* play) { return; } } else if (Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) { - s32 cs = this->dyna.actor.cutscene; + s32 csId = this->dyna.actor.csId; - if (cs == this->unk_15F) { + if (csId == this->csId) { if (OBJNOZOKI_GET_400(&this->dyna.actor)) { Vec3f sp28; Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &sp28, &GET_PLAYER(play)->actor.world.pos); if (sp28.z < -20.0f) { - this->unk_15F = ActorCutscene_GetAdditionalCutscene(this->unk_15F); + this->csId = CutsceneManager_GetAdditionalCsId(this->csId); } } } else if (D_80BA36B4 == 0) { if (func_80BA26A8(this)) { D_80BA36B4 = 1; } - } else if (ActorCutscene_GetCurrentIndex() != this->unk_15F) { - this->unk_15F = cs; + } else if (CutsceneManager_GetCurrentCsId() != this->csId) { + this->csId = csId; this->dyna.actor.params &= ~OBJNOZOKI_400; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ENEMY | 0x800 | SEQ_FLAG_ASYNC); } @@ -275,13 +275,13 @@ void func_80BA2BA4(ObjNozoki* this, PlayState* play) { s32 func_80BA2C28(ObjNozoki* this) { s32 i; - s16 cs = this->unk_15F; + s16 csId = this->csId; for (i = 0; i < 3; i++) { - if (ActorCutscene_GetCurrentIndex() == cs) { + if (CutsceneManager_GetCurrentCsId() == csId) { return i; } - cs = ActorCutscene_GetAdditionalCutscene(cs); + csId = CutsceneManager_GetAdditionalCsId(csId); } return -1; diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h index 4c4b74916..8bfc9818e 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.h @@ -20,7 +20,7 @@ typedef struct ObjNozoki { /* 0x15C */ u8 unk_15C; /* 0x15D */ u8 unk_15D; /* 0x15E */ s8 unk_15E; - /* 0x15F */ s8 unk_15F; + /* 0x15F */ s8 csId; /* 0x160 */ ObjNozokiActionFunc actionFunc; } ObjNozoki; // size = 0x164 diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c index 0b4e4e14b..eab144cbd 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c @@ -221,7 +221,7 @@ void func_80AC9B5C(ObjOcarinalift* this, PlayState* play) { if (OBJOCARINALIFT_GET_C(&this->dyna.actor) != OBJOCARINALIFT_PARAMSC_1) { Flags_SetSwitch(play, OBJOCARINALIFT_GET_SWITCH_FLAG(&this->dyna.actor)); } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); func_80AC9C20(this); } } else { @@ -239,12 +239,12 @@ void func_80AC9C20(ObjOcarinalift* this) { } void func_80AC9C48(ObjOcarinalift* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->cutsceneTimer = 50; func_80AC96B4(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -256,7 +256,7 @@ void ObjOcarinalift_Update(Actor* thisx, PlayState* play) { if (this->cutsceneTimer > 0) { this->cutsceneTimer--; if (this->cutsceneTimer == 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } } } diff --git a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c index ee26937da..dbd0dfe31 100644 --- a/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c +++ b/src/overlays/actors/ovl_Obj_Purify/z_obj_purify.c @@ -113,7 +113,7 @@ s32 ObjPurify_IsPurified(ObjPurify* this) { return true; } } else { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { return true; } } diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 5788f1585..3c8a7ecc0 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -198,18 +198,18 @@ void ObjRaillift_Wait(ObjRaillift* this, PlayState* play) { void ObjRaillift_Idle(ObjRaillift* this, PlayState* play) { if (Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { this->dyna.actor.speed = 0.0f; - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); this->actionFunc = ObjRaillift_StartCutscene; } } void ObjRaillift_StartCutscene(ObjRaillift* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->cutsceneTimer = 50; this->actionFunc = ObjRaillift_Move; } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -223,7 +223,7 @@ void ObjRaillift_Update(Actor* thisx, PlayState* play) { if (this->cutsceneTimer > 0) { this->cutsceneTimer--; if (this->cutsceneTimer == 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); } } if (OBJRAILLIFT_REACT_TO_PLAYER_ON_TOP(thisx)) { diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index 154f662f8..3871508ba 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -64,7 +64,7 @@ void func_80973D3C(ObjRoomtimer* this, PlayState* play) { if (this->actor.params != 0x1FF) { gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_80973DE0; } else if ((this->actor.params != 0x1FF) && (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_OFF)) { play_sound(NA_SE_OC_ABYSS); @@ -74,17 +74,17 @@ void func_80973D3C(ObjRoomtimer* this, PlayState* play) { } void func_80973DE0(ObjRoomtimer* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_IsNext(this->actor.csId)) { Flags_SetClear(play, this->actor.room); Flags_SetSwitch(play, this->switchFlag); - if (ActorCutscene_GetLength(this->actor.cutscene) != -1) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_GetLength(this->actor.csId) != -1) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); } Actor_Kill(&this->actor); return; } - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } void ObjRoomtimer_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c index 385bb65fb..fa04972ef 100644 --- a/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c +++ b/src/overlays/actors/ovl_Obj_Skateblock/z_obj_skateblock.c @@ -535,7 +535,7 @@ void func_80A22334(ObjSkateblock* this, PlayState* play) { func_80A21C88(this, sp2C); func_80A2244C(this); sp30 = false; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); this->unk_1C1 |= 1; } @@ -591,7 +591,7 @@ void func_80A224A4(ObjSkateblock* this, PlayState* play) { if ((this->unk_1C1 & 1) && (sp24 || sp28 || (this->dyna.actor.xzDistToPlayer > 400.0f))) { this->unk_1C1 &= ~1; - func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_6); + func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); } func_80A21F74(this, play); diff --git a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c index b0416cc58..c94d67860 100644 --- a/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c +++ b/src/overlays/actors/ovl_Obj_Snowball/z_obj_snowball.c @@ -106,7 +106,7 @@ void func_80B02CD0(ObjSnowball* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, - ptr->unk_02, -1, this->actor.halfDaysBits, NULL); + ptr->unk_02, CS_ID_NONE, this->actor.halfDaysBits, NULL); } void func_80B02D58(ObjSnowball* this, PlayState* play) { @@ -121,10 +121,10 @@ void func_80B02DB0(ObjSnowball* this, PlayState* play) { s32 pad; ObjSnowballStruct2* ptr = &D_80B04F84[this->actor.home.rot.y]; - Actor_SpawnAsChildAndCutscene( - &play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, - this->actor.home.rot.x, 0, this->actor.home.rot.z, this->actor.params | ptr->unk_02, - ActorCutscene_GetAdditionalCutscene(this->actor.cutscene), this->actor.halfDaysBits, NULL); + Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, + this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, + this->actor.params | ptr->unk_02, CutsceneManager_GetAdditionalCsId(this->actor.csId), + this->actor.halfDaysBits, NULL); } void func_80B02E54(ObjSnowball* this, PlayState* play) { @@ -132,7 +132,7 @@ void func_80B02E54(ObjSnowball* this, PlayState* play) { Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ptr->unk_00, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, this->actor.home.rot.x, 0, this->actor.home.rot.z, - this->actor.params | ptr->unk_02, -1, this->actor.halfDaysBits, NULL); + this->actor.params | ptr->unk_02, CS_ID_NONE, this->actor.halfDaysBits, NULL); } void func_80B02EE4(ObjSnowball* this, PlayState* play) { @@ -549,7 +549,7 @@ void func_80B04350(ObjSnowball* this, PlayState* play) { this->unk_20A = 0; } - if (this->actor.cutscene < 0) { + if (this->actor.csId < 0) { func_80B03FF8(this, play); if (this->unk_20A == 0) { func_80B04608(this, play); @@ -584,13 +584,13 @@ void func_80B04350(ObjSnowball* this, PlayState* play) { } void func_80B04540(ObjSnowball* this, PlayState* play) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_80B0457C; } void func_80B0457C(ObjSnowball* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); func_80B03FF8(this, play); this->unk_20B = 1; if (this->unk_20A == 0) { @@ -599,7 +599,7 @@ void func_80B0457C(ObjSnowball* this, PlayState* play) { func_80B046E4(this, play); } } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -615,7 +615,7 @@ void func_80B04648(ObjSnowball* this, PlayState* play) { this->unk_208--; if (this->unk_208 <= 0) { if (this->unk_20B != 0) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); } if (this->actor.home.rot.y == 1) { @@ -719,7 +719,7 @@ void func_80B047C0(ObjSnowball* this, PlayState* play) { if ((this->unk_208 <= 0) || ((this->unk_1A8[0].unk_2D & 1) && (this->unk_1A8[1].unk_2D & 1))) { if (this->unk_20B != 0) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); } if (this->actor.home.rot.y == 1) { diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 6e959a8dc..907df33fc 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -676,15 +676,15 @@ void func_80B30A2C(ObjSpidertent* this) { } void func_80B30A4C(ObjSpidertent* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); - if (this->dyna.actor.cutscene >= 0) { + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); + if (this->dyna.actor.csId >= 0) { func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_1); } Flags_SetSwitch(play, OBJSPIDERTENT_GET_7F00(&this->dyna.actor)); func_80B30AD4(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -791,7 +791,7 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { } } } else if (this->unk_3C1 <= 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); } } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 9a1ab7095..2c03f8689 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -266,7 +266,7 @@ void ObjSwitch_CrystalUpdateTimer(ObjSwitch* this) { void ObjSwitch_StopCutscene(ObjSwitch* this) { if (this->isPlayingCutscene) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); this->isPlayingCutscene = false; } } @@ -486,8 +486,8 @@ void ObjSwitch_TryPlayCutsceneInit(ObjSwitch* this, PlayState* play, ObjSwitchSe } void ObjSwitch_TryPlayCutscene(ObjSwitch* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); ObjSwitch_SetSwitchFlagState(this, play, this->nextSwitchFlagState); if (this->floorSwitchPlayerSnapState == 1) { this->floorSwitchPlayerSnapState = 2; @@ -495,7 +495,7 @@ void ObjSwitch_TryPlayCutscene(ObjSwitch* this, PlayState* play) { this->isPlayingCutscene = true; this->setupFunc(this); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c index 5e6f399a8..f1b7bfa6f 100644 --- a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c +++ b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c @@ -109,12 +109,12 @@ void func_80C25698(ObjSwprize* this) { } void func_80C256AC(ObjSwprize* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + if (CutsceneManager_IsNext(this->actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); func_80C253D0(this, play); func_80C25710(this); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -127,7 +127,7 @@ void func_80C2572C(ObjSwprize* this, PlayState* play) { if (this->timer > 0) { this->timer--; if (this->timer == 0) { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); ObjSwprize_SetupDoNothing(this); } } diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 96716d107..902caa42b 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -143,16 +143,16 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { s32 pad1; if (this->pendingAction != OBJ_SYOKUDAI_PENDING_ACTION_NONE) { - if (ActorCutscene_GetCurrentIndex() != thisx->cutscene) { - if (ActorCutscene_GetCanPlayNext(thisx->cutscene) != 0) { - ActorCutscene_StartAndSetUnkLinkFields(thisx->cutscene, thisx); + if (CutsceneManager_GetCurrentCsId() != thisx->csId) { + if (CutsceneManager_IsNext(thisx->csId)) { + CutsceneManager_StartWithPlayerCs(thisx->csId, thisx); if (this->pendingAction >= OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH) { Flags_SetSwitch(play, switchFlag); } } else { - ActorCutscene_SetIntentToPlay(thisx->cutscene); + CutsceneManager_Queue(thisx->csId); } - } else if (func_800F22C4(thisx->cutscene, thisx) != 0) { + } else if (func_800F22C4(thisx->csId, thisx) != 0) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_NONE; } @@ -171,6 +171,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { } else { s32 interaction = OBJ_SYOKUDAI_INTERACTION_NONE; u32 flameColliderHurtboxDmgFlags = 0; + player = GET_PLAYER(play); if (OBJ_SYOKUDAI_GET_START_LIT(thisx)) { @@ -240,7 +241,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { if (groupSize == 0) { if ((type == OBJ_SYOKUDAI_TYPE_NO_SWITCH) && (switchFlag == 0x7F)) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; - } else if (thisx->cutscene >= 0) { + } else if (thisx->csId >= 0) { this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH; } else { Flags_SetSwitch(play, switchFlag); diff --git a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c index 9a01a8da3..aeaddd2ee 100644 --- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c +++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c @@ -296,14 +296,14 @@ void func_80B9C174(ObjTaru* this, PlayState* play) { } void func_80B9C1A0(ObjTaru* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); Flags_SetSwitch(play, OBJ_TARU_GET_7F(&this->dyna.actor)); Actor_Kill(&this->dyna.actor); return; } - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } void ObjTaru_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index ec47acd86..6cdada70b 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -195,7 +195,7 @@ void ObjTokeiStep_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) { DynaPolyActor_LoadMesh(play, &this->dyna, &gClocktowerPanelCol); ObjTokeiStep_InitSteps(this); ObjTokeiStep_SetupBeginOpen(this); @@ -221,12 +221,12 @@ void ObjTokeiStep_SetupBeginOpen(ObjTokeiStep* this) { } void ObjTokeiStep_BeginOpen(ObjTokeiStep* this, PlayState* play) { - CsCmdActorAction* action; + CsCmdActorCue* cue; - if (Cutscene_CheckActorAction(play, 134)) { - action = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 134)]; + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_134)) { + cue = play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_134)]; - if ((action->startFrame == play->csCtx.frames) && (action->action != 0)) { + if ((cue->startFrame == play->csCtx.curFrame) && (cue->id != 0)) { this->dyna.actor.draw = ObjTokeiStep_DrawOpen; ObjTokeiStep_SetupOpen(this); } diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 00dd90b94..7dd00abc3 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -121,8 +121,8 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { this->opaDList = gClockTowerExteriorGearDL; ObjTokeidai_SetupClockOrExteriorGear(this); - if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0))) { + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; @@ -138,8 +138,8 @@ void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, PlayState* play) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_Clock_Init(this); - if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0))) { + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actor.world.pos.y += (this->actor.scale.y * 5191.0f) - 50.0f; @@ -171,8 +171,8 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, PlayState* play) { this->spotlightIntensity = 0; } - if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0))) { + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { this->spotlightIntensity = 0; ObjTokeidai_SetupTowerOpening(this); @@ -329,8 +329,8 @@ void ObjTokeidai_ExteriorGear_Collapse(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_ExteriorGear_OpenedIdle(ObjTokeidai* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 132) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 2) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && + play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 2) { this->actionFunc = ObjTokeidai_ExteriorGear_Collapse; this->actor.speed = this->actor.scale.y * 5.0f; this->actor.velocity.y = 0.0f; @@ -397,8 +397,8 @@ void ObjTokeidai_TowerClock_SlideOff(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_TowerClock_OpenedIdle(ObjTokeidai* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 132) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 1)) { this->actionFunc = ObjTokeidai_TowerClock_SlideOff; this->slidingClockFaceAngle = 0; this->aerialClockFaceSpeed = -0xD; @@ -415,8 +415,8 @@ void ObjTokeidai_Counterweight_Collapse(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_Counterweight_OpenedIdle(ObjTokeidai* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 132) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 3) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 3)) { this->actionFunc = ObjTokeidai_Counterweight_Collapse; this->xRotation = 0; this->actor.velocity.y = 0.0f; @@ -432,22 +432,20 @@ void ObjTokeidai_TerminaFieldWalls_Collapse(ObjTokeidai* this, PlayState* play) } void ObjTokeidai_TerminaFieldWalls_Idle(ObjTokeidai* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 132) != 0 && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 1) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 1)) { this->actionFunc = ObjTokeidai_TerminaFieldWalls_Collapse; } } void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { - if (Cutscene_CheckActorAction(play, 132) != 0 && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 5) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 5)) { SET_WEEKEVENTREG(WEEKEVENTREG_08_40); - if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && - (play->csCtx.currentCsIndex == 0)) || - ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && - (play->csCtx.currentCsIndex == 0))) { + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { Audio_SetCutsceneFlag(false); - gSaveContext.save.cutscene = 0; + gSaveContext.save.cutsceneIndex = 0; gSaveContext.nextCutsceneIndex = 0; gSaveContext.respawnFlag = 2; play->transitionTrigger = TRANS_TRIGGER_START; @@ -587,8 +585,8 @@ void ObjTokeidai_TowerOpening_RaiseTower(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_TowerOpening_Start(ObjTokeidai* this, PlayState* play) { - if ((Cutscene_CheckActorAction(play, 132) && - play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 4) || + if ((Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_132) && + (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_132)]->id == 4)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { this->actionFunc = ObjTokeidai_TowerOpening_RaiseTower; } @@ -698,7 +696,7 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { } else { if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) && OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD && - ActorCutscene_GetCurrentIndex() == -1) { + CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { this->actor.draw = NULL; } this->clockTime = gSaveContext.save.time; @@ -731,7 +729,7 @@ void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, PlayState* play) { } else { if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) && (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_TERMINA_FIELD) && - (ActorCutscene_GetCurrentIndex() == -1)) { + (CutsceneManager_GetCurrentCsId() == CS_ID_NONE)) { this->actor.draw = NULL; } this->clockTime = gSaveContext.save.time; diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 46fbe067c..f80c44751 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -1139,7 +1139,7 @@ void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play) { case OBJUM_PATH_STATE_1: case OBJUM_PATH_STATE_FINISH: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_31_80)) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); play->nextEntrance = ENTRANCE(MILK_ROAD, 5); play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; @@ -1158,12 +1158,12 @@ void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play) { void ObjUm_RanchStartCs(ObjUm* this, PlayState* play) { ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->lastTime = gSaveContext.save.time; ObjUm_SetupAction(this, func_80B7A0E0); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -1276,12 +1276,12 @@ void ObjUm_PreMilkRunStartCs(ObjUm* this, PlayState* play) { ObjUm_SetPlayerPosition(this, play); this->flags |= OBJ_UM_FLAG_0004; player->stateFlags1 |= PLAYER_STATE1_20; - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->lastTime = gSaveContext.save.time; ObjUm_SetupAction(this, func_80B7A394); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -1357,17 +1357,17 @@ void func_80B7A614(ObjUm* this, PlayState* play) { } if (this->flags & OBJ_UM_FLAG_MINIGAME_FINISHED) { - s32 sp20 = ActorCutscene_GetAdditionalCutscene(this->dyna.actor.cutscene); + s32 csId = CutsceneManager_GetAdditionalCsId(this->dyna.actor.csId); if (this->areAllPotsBroken) { - sp20 = ActorCutscene_GetAdditionalCutscene(sp20); + csId = CutsceneManager_GetAdditionalCsId(csId); } - if (ActorCutscene_GetCanPlayNext(sp20)) { - ActorCutscene_StartAndSetUnkLinkFields(sp20, &this->dyna.actor); + if (CutsceneManager_IsNext(csId)) { + CutsceneManager_StartWithPlayerCs(csId, &this->dyna.actor); ObjUm_SetupAction(this, ObjUm_RunMinigame); this->flags &= ~OBJ_UM_FLAG_PLAYING_MINIGAME; } else { - ActorCutscene_SetIntentToPlay(sp20); + CutsceneManager_Queue(csId); } } @@ -1396,14 +1396,14 @@ void func_80B7A860(ObjUm* this, PlayState* play) { ObjUm_RotatePlayer(this, play, 0); this->flags |= OBJ_UM_FLAG_0004; - if (play->csCtx.frames == 449) { + if (play->csCtx.curFrame == 449) { ObjUm_InitBandits(this, play); - } else if (play->csCtx.frames >= 450) { + } else if (play->csCtx.curFrame >= 450) { func_80B78DF0(this, play); } if (play->csCtx.state == 0) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); ObjUm_SetupAction(this, func_80B7A7AC); } @@ -1526,12 +1526,12 @@ void ObjUm_StartCs(ObjUm* this, PlayState* play) { ObjUm_RotatePlayer(this, play, 0); this->flags |= OBJ_UM_FLAG_0004; - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); this->lastTime = gSaveContext.save.time; ObjUm_SetupAction(this, func_80B7ABE4); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } @@ -1546,7 +1546,7 @@ void ObjUm_PostMilkRunWaitPathFinished(ObjUm* this, PlayState* play) { ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_TROT); if ((ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_4) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_59_02)) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Audio_SetCutsceneFlag(false); SET_WEEKEVENTREG(WEEKEVENTREG_59_02); gSaveContext.nextCutsceneIndex = 0xFFF3; @@ -1568,11 +1568,11 @@ void ObjUm_PostMilkRunStartCs(ObjUm* this, PlayState* play) { this->flags |= OBJ_UM_FLAG_0004; ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); - if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if (CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); ObjUm_SetupAction(this, ObjUm_PostMilkRunWaitPathFinished); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } } diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c index 81efe0fc5..46a6b994d 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c @@ -172,18 +172,18 @@ void func_80C081C8(ObjUsiyane* this, PlayState* play) { } void func_80C082CC(ObjUsiyane* this, PlayState* play) { - this->unk_164 = -1; + this->cueId = -1; } void func_80C082E0(ObjUsiyane* this, PlayState* play) { - CsCmdActorAction* csAction; + CsCmdActorCue* cue; - if (Cutscene_CheckActorAction(play, 0x228)) { - this->unk_160 = Cutscene_GetActorActionIndex(play, 0x228); - csAction = play->csCtx.actorActions[this->unk_160]; - if (this->unk_164 != csAction->action) { - this->unk_164 = csAction->action; - if (this->unk_164 == 2) { + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_552)) { + this->cueChannel = Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_552); + cue = play->csCtx.actorCues[this->cueChannel]; + if (this->cueId != cue->id) { + this->cueId = cue->id; + if (this->cueId == 2) { func_80C07F30(this, play); this->actionFunc = func_80C081C8; } diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h index 2abc2a38b..92bd96549 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.h @@ -24,8 +24,8 @@ typedef struct { typedef struct ObjUsiyane { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ObjUsiyaneActionFunc actionFunc; - /* 0x160 */ s32 unk_160; - /* 0x164 */ s32 unk_164; + /* 0x160 */ s32 cueChannel; + /* 0x164 */ s32 cueId; /* 0x168 */ ObjUsiyaneStruct unk_168[10][4]; /* 0x708 */ f32 unk_708; /* 0x70C */ f32 unk_70C; diff --git a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c index b7eef869d..075ad18db 100644 --- a/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c +++ b/src/overlays/actors/ovl_Obj_Warpstone/z_obj_warpstone.c @@ -97,19 +97,19 @@ s32 ObjWarpstone_ClosedIdle(ObjWarpstone* this, PlayState* play) { } s32 ObjWarpstone_BeginOpeningCutscene(ObjWarpstone* this, PlayState* play) { - if (this->dyna.actor.cutscene < 0 || ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor); + if ((this->dyna.actor.csId < 0) || CutsceneManager_IsNext(this->dyna.actor.csId)) { + CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); ObjWarpstone_SetupAction(this, ObjWarpstone_PlayOpeningCutscene); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_OWL_WARP_SWITCH_ON); } else { - ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); + CutsceneManager_Queue(this->dyna.actor.csId); } return true; } s32 ObjWarpstone_PlayOpeningCutscene(ObjWarpstone* this, PlayState* play) { if (this->openingCSTimer++ >= OBJ_WARPSTONE_TIMER_ACTIVATE_THRESHOLD) { - ActorCutscene_Stop(this->dyna.actor.cutscene); + CutsceneManager_Stop(this->dyna.actor.csId); Sram_ActivateOwl(OBJ_WARPSTONE_GET_ID(&this->dyna.actor)); ObjWarpstone_SetupAction(this, ObjWarpstone_OpenedIdle); } else if (this->openingCSTimer < OBJ_WARPSTONE_TIMER_OPEN_THRESHOLD) { diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index 4558a6a75..54ebe8cc7 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -52,15 +52,15 @@ void func_808A7968(ObjWturn* this, PlayState* play) { } void func_808A7A24(ObjWturn* this) { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); this->actionFunc = func_808A7A5C; } void func_808A7A5C(ObjWturn* this, PlayState* play) { - if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (CutsceneManager_IsNext(this->actor.csId)) { func_808A7AAC(this, play); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } @@ -69,9 +69,9 @@ void func_808A7AAC(ObjWturn* this, PlayState* play) { Vec3f subCamEye; Vec3f subCamAt; - ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); Play_EnableMotionBlur(140); - this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene); + this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); func_800B7298(play, &this->actor, PLAYER_CSMODE_21); subCamAt.x = player->actor.focus.pos.x; subCamAt.z = player->actor.focus.pos.z; diff --git a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c index 1196cb0be..cea1a4e71 100644 --- a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c +++ b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c @@ -105,19 +105,19 @@ void ObjY2shutter_Update(Actor* thisx, PlayState* play) { if (this->settleTimer == 0) { if (Flags_GetSwitch(play, OBJY2SHUTTER_GET_SWITCHFLAG(&this->dyna.actor))) { - s16 cutscene = this->dyna.actor.cutscene; + s16 csId = this->dyna.actor.csId; if (this->openTimer == 0) { - if ((cutscene >= 0) && !ActorCutscene_GetCanPlayNext(cutscene)) { - ActorCutscene_SetIntentToPlay(cutscene); - } else if (cutscene >= 0) { - ActorCutscene_StartAndSetUnkLinkFields(cutscene, &this->dyna.actor); + if ((csId >= 0) && !CutsceneManager_IsNext(csId)) { + CutsceneManager_Queue(csId); + } else if (csId >= 0) { + CutsceneManager_StartWithPlayerCs(csId, &this->dyna.actor); this->openTimer = -1; } else { ObjY2shutter_SetupOpen(this, info, shutterType); } } else if (this->openTimer < 0) { - if (func_800F22C4(cutscene, &this->dyna.actor)) { + if (func_800F22C4(csId, &this->dyna.actor) != 0) { ObjY2shutter_SetupOpen(this, info, shutterType); } } else { diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index 0d0db6385..7915551c2 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -79,7 +79,7 @@ void OceffWipe5_Draw(Actor* thisx, PlayState* play) { f32 phi_fv1 = 1220.0f; if ((((OCEFF_WIPE5_GET_SONG_TYPE(thisx) == 2) && (play->sceneId == SCENE_LABO)) && - ((play->csCtx.currentCsIndex == 0) || (play->csCtx.currentCsIndex == 1))) && + ((play->csCtx.scriptIndex == 0) || (play->csCtx.scriptIndex == 1))) && (play->csCtx.state != 0)) { phi_fv1 = 1150.0f; } diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 23713aa71..f237bed47 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -87,7 +87,7 @@ void ShotSun_SpawnFairy(ShotSun* this, PlayState* play2) { if (this->timer > 0) { this->timer--; } else { - ActorCutscene_Stop(this->actor.cutscene); + CutsceneManager_Stop(this->actor.csId); switch (params) { case SHOTSUN_FAIRY_SPAWNER_SUNS: fairyType = ENELF_TYPE_7; @@ -103,9 +103,9 @@ void ShotSun_SpawnFairy(ShotSun* this, PlayState* play2) { } void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) { - if ((this->actor.cutscene == -1) || ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { - if (this->actor.cutscene != -1) { - ActorCutscene_Start(this->actor.cutscene, &this->actor); + if ((this->actor.csId == CS_ID_NONE) || CutsceneManager_IsNext(this->actor.csId)) { + if (this->actor.csId != CS_ID_NONE) { + CutsceneManager_Start(this->actor.csId, &this->actor); } this->actionFunc = ShotSun_SpawnFairy; this->timer = 50; @@ -113,7 +113,7 @@ void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) { this->actor.home.pos.z, 0, 0, 0, 0x11); Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_TRE_BOX_APPEAR); } else { - ActorCutscene_SetIntentToPlay(this->actor.cutscene); + CutsceneManager_Queue(this->actor.csId); } } diff --git a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c index 5e42daffb..5523ded78 100644 --- a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c +++ b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c @@ -91,7 +91,7 @@ void TGSw_ActionExecuteOneShot(TGSw* this, PlayState* play) { void TGSw_Init(Actor* thisx, PlayState* play) { TGSw* this = THIS; - this->actor.cutscene = this->actor.world.rot.z; + this->actor.csId = this->actor.world.rot.z; this->actionFunc = TGSw_ActionDecider; } diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 7edfb8e78..9697b111f 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -17,8 +17,8 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { Sram_InitNewSave(); - gSaveContext.save.entrance = sOpeningEntrances[D_801BB12C]; - gSaveContext.nextCutsceneIndex = gSaveContext.save.cutscene = sOpeningCutscenes[D_801BB12C]; + gSaveContext.save.entrance = sOpeningEntrances[gOpeningEntranceIndex]; + gSaveContext.nextCutsceneIndex = gSaveContext.save.cutsceneIndex = sOpeningCutscenes[gOpeningEntranceIndex]; gSaveContext.sceneLayer = 0; gSaveContext.save.time = CLOCK_TIME(8, 0); diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index ab34ebffe..08bf65262 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -533,69 +533,69 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } if (CHECK_BTN_ALL(controller1->press.button, BTN_Z)) { - if (gSaveContext.save.cutscene == 0x8000) { - gSaveContext.save.cutscene = 0; - } else if (gSaveContext.save.cutscene == 0) { - gSaveContext.save.cutscene = 0x8800; - } else if (gSaveContext.save.cutscene == 0x8800) { - gSaveContext.save.cutscene = 0xFFF0; - } else if (gSaveContext.save.cutscene == 0xFFF0) { - gSaveContext.save.cutscene = 0xFFF1; - } else if (gSaveContext.save.cutscene == 0xFFF1) { - gSaveContext.save.cutscene = 0xFFF2; - } else if (gSaveContext.save.cutscene == 0xFFF2) { - gSaveContext.save.cutscene = 0xFFF3; - } else if (gSaveContext.save.cutscene == 0xFFF3) { - gSaveContext.save.cutscene = 0xFFF4; - } else if (gSaveContext.save.cutscene == 0xFFF4) { - gSaveContext.save.cutscene = 0xFFF5; - } else if (gSaveContext.save.cutscene == 0xFFF5) { - gSaveContext.save.cutscene = 0xFFF6; - } else if (gSaveContext.save.cutscene == 0xFFF6) { - gSaveContext.save.cutscene = 0xFFF7; - } else if (gSaveContext.save.cutscene == 0xFFF7) { - gSaveContext.save.cutscene = 0xFFF8; - } else if (gSaveContext.save.cutscene == 0xFFF8) { - gSaveContext.save.cutscene = 0xFFF9; - } else if (gSaveContext.save.cutscene == 0xFFF9) { - gSaveContext.save.cutscene = 0xFFFA; - } else if (gSaveContext.save.cutscene == 0xFFFA) { - gSaveContext.save.cutscene = 0x8000; + if (gSaveContext.save.cutsceneIndex == 0x8000) { + gSaveContext.save.cutsceneIndex = 0; + } else if (gSaveContext.save.cutsceneIndex == 0) { + gSaveContext.save.cutsceneIndex = 0x8800; + } else if (gSaveContext.save.cutsceneIndex == 0x8800) { + gSaveContext.save.cutsceneIndex = 0xFFF0; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF0) { + gSaveContext.save.cutsceneIndex = 0xFFF1; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF1) { + gSaveContext.save.cutsceneIndex = 0xFFF2; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF2) { + gSaveContext.save.cutsceneIndex = 0xFFF3; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF3) { + gSaveContext.save.cutsceneIndex = 0xFFF4; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF4) { + gSaveContext.save.cutsceneIndex = 0xFFF5; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF5) { + gSaveContext.save.cutsceneIndex = 0xFFF6; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF6) { + gSaveContext.save.cutsceneIndex = 0xFFF7; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF7) { + gSaveContext.save.cutsceneIndex = 0xFFF8; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF8) { + gSaveContext.save.cutsceneIndex = 0xFFF9; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF9) { + gSaveContext.save.cutsceneIndex = 0xFFFA; + } else if (gSaveContext.save.cutsceneIndex == 0xFFFA) { + gSaveContext.save.cutsceneIndex = 0x8000; } } else if (CHECK_BTN_ALL(controller1->press.button, BTN_R)) { - if (gSaveContext.save.cutscene == 0x8000) { - gSaveContext.save.cutscene = 0xFFFA; - } else if (gSaveContext.save.cutscene == 0) { - gSaveContext.save.cutscene = 0x8000; - } else if (gSaveContext.save.cutscene == 0x8800) { - gSaveContext.save.cutscene = 0; - } else if (gSaveContext.save.cutscene == 0xFFF0) { - gSaveContext.save.cutscene = 0x8800; - } else if (gSaveContext.save.cutscene == 0xFFF1) { - gSaveContext.save.cutscene = 0xFFF0; - } else if (gSaveContext.save.cutscene == 0xFFF2) { - gSaveContext.save.cutscene = 0xFFF1; - } else if (gSaveContext.save.cutscene == 0xFFF3) { - gSaveContext.save.cutscene = 0xFFF2; - } else if (gSaveContext.save.cutscene == 0xFFF4) { - gSaveContext.save.cutscene = 0xFFF3; - } else if (gSaveContext.save.cutscene == 0xFFF5) { - gSaveContext.save.cutscene = 0xFFF4; - } else if (gSaveContext.save.cutscene == 0xFFF6) { - gSaveContext.save.cutscene = 0xFFF5; - } else if (gSaveContext.save.cutscene == 0xFFF7) { - gSaveContext.save.cutscene = 0xFFF6; - } else if (gSaveContext.save.cutscene == 0xFFF8) { - gSaveContext.save.cutscene = 0xFFF7; - } else if (gSaveContext.save.cutscene == 0xFFF9) { - gSaveContext.save.cutscene = 0xFFF8; - } else if (gSaveContext.save.cutscene == 0xFFFA) { - gSaveContext.save.cutscene = 0xFFF9; + if (gSaveContext.save.cutsceneIndex == 0x8000) { + gSaveContext.save.cutsceneIndex = 0xFFFA; + } else if (gSaveContext.save.cutsceneIndex == 0) { + gSaveContext.save.cutsceneIndex = 0x8000; + } else if (gSaveContext.save.cutsceneIndex == 0x8800) { + gSaveContext.save.cutsceneIndex = 0; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF0) { + gSaveContext.save.cutsceneIndex = 0x8800; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF1) { + gSaveContext.save.cutsceneIndex = 0xFFF0; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF2) { + gSaveContext.save.cutsceneIndex = 0xFFF1; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF3) { + gSaveContext.save.cutsceneIndex = 0xFFF2; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF4) { + gSaveContext.save.cutsceneIndex = 0xFFF3; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF5) { + gSaveContext.save.cutsceneIndex = 0xFFF4; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF6) { + gSaveContext.save.cutsceneIndex = 0xFFF5; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF7) { + gSaveContext.save.cutsceneIndex = 0xFFF6; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF8) { + gSaveContext.save.cutsceneIndex = 0xFFF7; + } else if (gSaveContext.save.cutsceneIndex == 0xFFF9) { + gSaveContext.save.cutsceneIndex = 0xFFF8; + } else if (gSaveContext.save.cutsceneIndex == 0xFFFA) { + gSaveContext.save.cutsceneIndex = 0xFFF9; } } gSaveContext.save.isNight = false; - if (gSaveContext.save.cutscene == 0x8800) { + if (gSaveContext.save.cutsceneIndex == 0x8800) { gSaveContext.save.isNight = true; } @@ -995,7 +995,7 @@ void MapSelect_DrawMenu(MapSelectState* this) { MapSelect_PrintMenu(this, printer); MapSelect_PrintAgeSetting(this, printer, GET_PLAYER_FORM); - MapSelect_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.save.cutscene)); + MapSelect_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.save.cutsceneIndex)); POLY_OPA_DISP = GfxPrint_Close(printer); GfxPrint_Destroy(printer); @@ -1085,7 +1085,7 @@ void MapSelect_Init(GameState* thisx) { } Game_SetFramerateDivisor(&this->state, 1); - gSaveContext.save.cutscene = 0; + gSaveContext.save.cutsceneIndex = 0; gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; gSaveContext.save.linkAge = 0; } diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 372557384..88fab2cab 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -440,7 +440,7 @@ 0x8015E750 : "z_message_staff", 0x80160A90 : "z_player_call", 0x80160C00 : "z_shrink_window", - 0x80161180 : "db_camera", + 0x80161180 : "cutscene_camera", 0x80163700 : "z_kaleido_manager", 0x801639A0 : "z_kaleido_scope_call", 0x80163C90 : "z_fbdemo_dlftbls", @@ -652,7 +652,7 @@ 0x801DF150 : "z_message", 0x801DF730 : "z_message_nes", 0x801DF860 : "z_message_staff", - 0x801DF900 : "db_camera", + 0x801DF900 : "cutscene_camera", 0x801DF9C0 : "z_kaleido_manager", 0x801DF9E0 : "z_fbdemo_circle", 0x801DFA00 : "z_play", @@ -723,7 +723,7 @@ 0x801F6B00 : "z_message", 0x801F6B30 : "z_player_call", 0x801F6B40 : "z_shrink_window", - 0x801F6B50 : "db_camera", + 0x801F6B50 : "cutscene_camera", 0x801F6BF0 : "z_kaleido_manager", 0x801F6C00 : "z_kaleido_scope_call", 0x801F6C10 : "z_play", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 126407393..8cbc8f13f 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1533,54 +1533,54 @@ 0x800E9DBC:("DebugCamera_ScreenText",), 0x800E9E94:("DebugCamera_DrawScreenText",), 0x800E9F78:("Debug_DrawText",), - 0x800EA060:("Cutscene_Init",), - 0x800EA0D4:("Cutscene_Start",), - 0x800EA0EC:("Cutscene_End",), - 0x800EA110:("Cutscene_Update1",), - 0x800EA15C:("Cutscene_Update2",), - 0x800EA210:("Cutscene_DoNothing",), - 0x800EA220:("func_800EA220",), - 0x800EA258:("func_800EA258",), - 0x800EA2B8:("func_800EA2B8",), - 0x800EA324:("Cutscene_Command_Misc",), - 0x800EABAC:("Cutscene_Command_SetLighting",), - 0x800EAC08:("Cutscene_Command_PlaySequence",), - 0x800EAC44:("Cutscene_Command_StopSequence",), - 0x800EAC94:("Cutscene_Command_FadeSequence",), - 0x800EAD14:("Cutscene_Command_PlayAmbienceSequence",), - 0x800EAD48:("func_800EAD48",), - 0x800EAD7C:("func_800EAD7C",), - 0x800EADB0:("func_800EADB0",), - 0x800EAECC:("Cutscene_Command_FadeAmbienceSequence",), - 0x800EAF20:("Cutscene_Command_Rumble",), - 0x800EAFE0:("Cutscene_Command_FadeColorScreen",), - 0x800EB1DC:("Cutscene_Command_SetTime",), - 0x800EB364:("Cutscene_TerminatorImpl",), - 0x800EB4B4:("Cutscene_Command_Terminator",), - 0x800EB6F8:("Cutscene_Command_ChooseCreditsScenes",), - 0x800EBB68:("Cutscene_Command_MotionBlur",), - 0x800EBCD0:("Cutscene_Command_GiveTatlToPlayer",), - 0x800EBD60:("Cutscene_Command_TransitionFX",), - 0x800EC678:("Cutscene_Command_Camera",), + 0x800EA060:("Cutscene_InitContext",), + 0x800EA0D4:("Cutscene_StartManual",), + 0x800EA0EC:("Cutscene_StopManual",), + 0x800EA110:("Cutscene_UpdateManual",), + 0x800EA15C:("Cutscene_UpdateScripted",), + 0x800EA210:("CutsceneHandler_DoNothing",), + 0x800EA220:("Cutscene_StepTimer",), + 0x800EA258:("CutsceneHandler_StartManual",), + 0x800EA2B8:("CutsceneHandler_StartScript",), + 0x800EA324:("CutsceneCmd_Misc",), + 0x800EABAC:("CutsceneCmd_SetLightSetting",), + 0x800EAC08:("CutsceneCmd_StartSequence",), + 0x800EAC44:("CutsceneCmd_StopSequence",), + 0x800EAC94:("CutsceneCmd_FadeOutSequence",), + 0x800EAD14:("CutsceneCmd_StartAmbience",), + 0x800EAD48:("Cutscene_SetSfxReverbIndexTo2",), + 0x800EAD7C:("Cutscene_SetSfxReverbIndexTo1",), + 0x800EADB0:("CutsceneCmd_ModifySequence",), + 0x800EAECC:("CutsceneCmd_FadeOutAmbience",), + 0x800EAF20:("CutsceneCmd_RumbleController",), + 0x800EAFE0:("CutsceneCmd_TransitionGeneral",), + 0x800EB1DC:("CutsceneCmd_SetTime",), + 0x800EB364:("CutsceneCmd_DestinationDefault",), + 0x800EB4B4:("CutsceneCmd_Destination",), + 0x800EB6F8:("CutsceneCmd_ChooseCreditsScenes",), + 0x800EBB68:("CutsceneCmd_MotionBlur",), + 0x800EBCD0:("CutsceneCmd_GiveTatlToPlayer",), + 0x800EBD60:("CutsceneCmd_Transition",), + 0x800EC678:("CutsceneCmd_UpdateCamSpline",), 0x800EC6D4:("Cutscene_CountNormalMasks",), - 0x800EC924:("Cutscene_Command_Textbox",), - 0x800ECD7C:("func_800ECD7C",), - 0x800ECE40:("Cutscene_ProcessCommands",), - 0x800ED980:("func_800ED980",), - 0x800ED9C4:("func_800ED9C4",), - 0x800EDA04:("func_800EDA04",), - 0x800EDA84:("func_800EDA84",), - 0x800EDBE0:("func_800EDBE0",), + 0x800EC924:("CutsceneCmd_Text",), + 0x800ECD7C:("Cutscene_SetActorCue",), + 0x800ECE40:("Cutscene_ProcessScript",), + 0x800ED980:("CutsceneHandler_RunScript",), + 0x800ED9C4:("CutsceneHandler_StopManual",), + 0x800EDA04:("CutsceneHandler_StopScript",), + 0x800EDA84:("Cutscene_SetupScripted",), + 0x800EDBE0:("Cutscene_HandleEntranceTriggers",), 0x800EDDB0:("func_800EDDB0",), 0x800EDDBC:("func_800EDDBC",), - 0x800EDDCC:("Cutscene_LoadCutsceneData",), + 0x800EDDCC:("Cutscene_StartScripted",), 0x800EDE34:("Cutscene_ActorTranslate",), 0x800EDF24:("Cutscene_ActorTranslateAndYaw",), 0x800EDF78:("Cutscene_ActorTranslateAndYawSmooth",), 0x800EE0CC:("Cutscene_ActorTranslateXZAndYawSmooth",), 0x800EE1D8:("Cutscene_GetSceneLayer",), - 0x800EE200:("Cutscene_GetActorActionIndex",), - 0x800EE29C:("Cutscene_CheckActorAction",), + 0x800EE200:("Cutscene_GetCueChannel",), + 0x800EE29C:("Cutscene_IsCueInChannel",), 0x800EE2F4:("Cutscene_IsPlaying",), 0x800EE320:("GetItem_Draw",), 0x800EE364:("GetItem_DrawBombchu",), @@ -1632,35 +1632,35 @@ 0x800F10AC:("EnHy_UpdateCollider",), 0x800F112C:("EnHy_PlayWalkingSound",), 0x800F1250:("Text_GetFaceReaction",), - 0x800F12D0:("EnvFlags_UnsetAll",), - 0x800F1304:("EnvFlags_Set",), - 0x800F1374:("EnvFlags_Unset",), - 0x800F13E8:("EnvFlags_Get",), - 0x800F1460:("func_800F1460",), - 0x800F14F8:("ActorCutscene_GetCutsceneImpl",), - 0x800F1544:("ActorCutscene_Init",), - 0x800F15D8:("func_800F15D8",), - 0x800F1648:("ActorCutscene_ClearWaiting",), - 0x800F1678:("ActorCutscene_ClearNextCutscenes",), - 0x800F16A8:("ActorCutscene_MarkNextCutscenes",), - 0x800F17FC:("ActorCutscene_End",), - 0x800F1A7C:("ActorCutscene_Update",), - 0x800F1BA4:("ActorCutscene_SetIntentToPlay",), - 0x800F1BE4:("ActorCutscene_GetCanPlayNext",), - 0x800F1C68:("ActorCutscene_StartAndSetUnkLinkFields",), - 0x800F1CE0:("ActorCutscene_StartAndSetFlag",), - 0x800F1D84:("ActorCutscene_Start",), - 0x800F1FBC:("ActorCutscene_Stop",), - 0x800F207C:("ActorCutscene_GetCurrentIndex",), - 0x800F208C:("ActorCutscene_GetCutscene",), - 0x800F20B8:("ActorCutscene_GetAdditionalCutscene",), - 0x800F20F8:("ActorCutscene_GetLength",), - 0x800F2138:("func_800F2138",), - 0x800F2178:("func_800F2178",), - 0x800F21B8:("ActorCutscene_GetCurrentSubCamId",), - 0x800F21CC:("func_800F21CC",), + 0x800F12D0:("CutsceneFlags_UnsetAll",), + 0x800F1304:("CutsceneFlags_Set",), + 0x800F1374:("CutsceneFlags_Unset",), + 0x800F13E8:("CutsceneFlags_Get",), + 0x800F1460:("CutsceneManager_SetHudVisibility",), + 0x800F14F8:("CutsceneManager_GetCutsceneEntryImpl",), + 0x800F1544:("CutsceneManager_Init",), + 0x800F15D8:("CutsceneManager_StoreCamera",), + 0x800F1648:("CutsceneManager_ClearWaiting",), + 0x800F1678:("CutsceneManager_ClearNextCutscenes",), + 0x800F16A8:("CutsceneManager_MarkNextCutscenes",), + 0x800F17FC:("CutsceneManager_End",), + 0x800F1A7C:("CutsceneManager_Update",), + 0x800F1BA4:("CutsceneManager_Queue",), + 0x800F1BE4:("CutsceneManager_IsNext",), + 0x800F1C68:("CutsceneManager_StartWithPlayerCs",), + 0x800F1CE0:("CutsceneManager_StartWithPlayerCsAndSetFlag",), + 0x800F1D84:("CutsceneManager_Start",), + 0x800F1FBC:("CutsceneManager_Stop",), + 0x800F207C:("CutsceneManager_GetCurrentCsId",), + 0x800F208C:("CutsceneManager_GetCutsceneEntry",), + 0x800F20B8:("CutsceneManager_GetAdditionalCsId",), + 0x800F20F8:("CutsceneManager_GetLength",), + 0x800F2138:("CutsceneManager_GetCutsceneScriptIndex",), + 0x800F2178:("CutsceneManager_GetCutsceneCustomValue",), + 0x800F21B8:("CutsceneManager_GetCurrentSubCamId",), + 0x800F21CC:("CutsceneManager_FindEntranceCsId",), 0x800F22C4:("func_800F22C4",), - 0x800F23C4:("ActorCutscene_SetReturnCamera",), + 0x800F23C4:("CutsceneManager_SetReturnCamera",), 0x800F23E0:("Curve_CubicHermiteSpline",), 0x800F2478:("Curve_Interpolate",), 0x800F2620:("SkelCurve_Clear",), @@ -2447,8 +2447,8 @@ 0x801303E0:("Scene_CommandSoundSettings",), 0x8013043C:("Scene_CommandEchoSetting",), 0x80130454:("Scene_CommandAltHeaderList",), - 0x801304CC:("Scene_CommandCutsceneList",), - 0x80130500:("Scene_CommandActorCutsceneList",), + 0x801304CC:("Scene_CommandCutsceneScriptList",), + 0x80130500:("Scene_CommandCutsceneList",), 0x80130540:("Scene_CommandMiniMap",), 0x80130578:("Scene_Command1D",), 0x80130588:("Scene_CommandMiniMapCompassInfo",), @@ -2701,7 +2701,7 @@ 0x8013E07C:("SubS_ActorPathing_MoveWithoutGravityReverse",), 0x8013E0A4:("SubS_ActorPathing_SetNextPoint",), 0x8013E1C8:("SubS_ChangeAnimationBySpeedInfo",), - 0x8013E2D4:("SubS_StartActorCutscene",), + 0x8013E2D4:("SubS_StartCutscene",), 0x8013E3B8:("SubS_FillCutscenesList",), 0x8013E4B0:("SubS_ConstructPlane",), 0x8013E5CC:("SubS_LineSegVsPlane",), @@ -2797,7 +2797,7 @@ 0x80144684:("Sram_GenerateRandomSaveFields",), 0x80144890:("Sram_InitNewSave",), 0x80144968:("Sram_InitDebugSave",), - 0x80144A94:("func_80144A94",), + 0x80144A94:("Sram_ResetSaveFromMoonCrash",), 0x80144E78:("Sram_OpenSave",), 0x8014546C:("func_8014546C",), 0x80145698:("func_80145698",), @@ -2905,13 +2905,13 @@ 0x80160CE4:("ShrinkWindow_Update",), 0x80160D98:("ShrinkWindow_Draw",), 0x80161180:("func_80161180",), - 0x8016119C:("func_8016119C",), - 0x8016122C:("func_8016122C",), - 0x801612B8:("func_801612B8",), - 0x80161998:("func_80161998",), + 0x8016119C:("CutsceneCamera_Init",), + 0x8016122C:("CutsceneCamera_Interpolate",), + 0x801612B8:("CutsceneCamera_ProcessSpline",), + 0x80161998:("CutsceneCamera_UpdateSplines",), 0x80161BAC:("func_80161BAC",), - 0x80161BE0:("func_80161BE0",), - 0x80161C0C:("func_80161C0C",), + 0x80161BE0:("CutsceneCamera_SetState",), + 0x80161C0C:("CutsceneCamera_Reset",), 0x80161C20:("func_80161C20",), 0x80161E4C:("func_80161E4C",), 0x801620CC:("func_801620CC",), @@ -3037,7 +3037,7 @@ 0x8016A02C:("func_8016A02C",), 0x8016A0AC:("Play_IsUnderwater",), 0x8016A168:("Play_IsDebugCamEnabled",), - 0x8016A178:("Play_AssignPlayerActorCsIdsFromScene",), + 0x8016A178:("Play_AssignPlayerCsIdsFromScene",), 0x8016A268:("Play_FillScreen",), 0x8016A2C8:("Play_Init",), 0x8016AC10:("func_8016AC10",), @@ -3845,7 +3845,7 @@ 0x8019D488:("AudioOcarina_MemoryGameInit",), 0x8019D4F8:("AudioOcarina_MemoryGameNextNote",), 0x8019D600:("AudioOcarina_Update",), - 0x8019D758:("AudioOcarina_PlayLongScarecrowAfterCredits",), + 0x8019D758:("AudioOcarina_PlayLongScarecrowSong",), 0x8019D864:("AudioOcarina_SetCustomSequence",), 0x8019D8B4:("AudioOcarina_PlayCustomSequence",), 0x8019D8E4:("AudioOcarina_CreateCustomSequence",), @@ -7124,7 +7124,7 @@ 0x8092C86C:("func_8092C86C",), 0x8092C934:("func_8092C934",), 0x8092C9BC:("func_8092C9BC",), - 0x8092CA74:("func_8092CA74",), + 0x8092CA74:("EnDns_GetCueType",), 0x8092CAD0:("func_8092CAD0",), 0x8092CB98:("func_8092CB98",), 0x8092CC68:("func_8092CC68",), @@ -12870,7 +12870,7 @@ 0x80B01B30:("EnGiant_Init",), 0x80B01E74:("EnGiant_Destroy",), 0x80B01E84:("EnGiant_ChangeToStartOrLoopAnimation",), - 0x80B01EE8:("EnGiant_ChangeAnimBasedOnCsAction",), + 0x80B01EE8:("EnGiant_ChangeAnimBasedOnCueId",), 0x80B020A0:("EnGiant_UpdateAlpha",), 0x80B0211C:("EnGiant_PlayAndUpdateAnimation",), 0x80B02234:("EnGiant_PlaySound",), @@ -14411,7 +14411,7 @@ 0x80B73AE4:("EnJg_UpdateCollision",), 0x80B73B98:("EnJg_GetWalkingYRotation",), 0x80B73C58:("EnJg_ReachedPoint",), - 0x80B73DF4:("EnJg_GetCutsceneForTeachingLullabyIntro",), + 0x80B73DF4:("EnJg_GetCsIdForTeachingLullabyIntro",), 0x80B73E3C:("EnJg_SetupGoronShrineCheer",), 0x80B73F1C:("EnJg_SetupTalk",), 0x80B7406C:("EnJg_Idle",), @@ -15161,7 +15161,7 @@ 0x80BA78F8:("EnRailgibud_PostLimbDraw",), 0x80BA79D4:("EnRailgibud_Draw",), 0x80BA7B6C:("EnRailgibud_InitCutsceneGibdo",), - 0x80BA7C78:("EnRailgibud_InitActorActionCommand",), + 0x80BA7C78:("EnRailgibud_InitCueType",), 0x80BA7CF0:("EnRailgibud_SetupDoNothing",), 0x80BA7D04:("EnRailgibud_DoNothing",), 0x80BA7D14:("EnRailgibud_SetupSinkIntoGround",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 6ed78a348..855900bb2 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -923,14 +923,14 @@ 0x801BB0DC:("D_801BB0DC","UNK_TYPE1","",0x1), 0x801BB0FC:("D_801BB0FC","UNK_TYPE2","",0x2), 0x801BB100:("D_801BB100","UNK_TYPE1","",0x1), - 0x801BB124:("D_801BB124","UNK_TYPE2","",0x2), - 0x801BB128:("D_801BB128","UNK_TYPE2","",0x2), - 0x801BB12C:("D_801BB12C","UNK_TYPE1","",0x1), + 0x801BB124:("sCurTextId","UNK_TYPE2","",0x2), + 0x801BB128:("sCurOcarinaAction","UNK_TYPE2","",0x2), + 0x801BB12C:("gOpeningEntranceIndex","UNK_TYPE1","",0x1), 0x801BB130:("sCutsceneStoredPlayerForm","UNK_TYPE1","",0x1), - 0x801BB134:("sCsStateHandlers1","cutscene_update_func","[5]",0x14), - 0x801BB148:("sCsStateHandlers2","cutscene_update_func","[5]",0x14), + 0x801BB134:("sManualCutsceneHandlers","cutscene_update_func","[5]",0x14), + 0x801BB148:("sScriptedCutsceneHandlers","cutscene_update_func","[5]",0x14), 0x801BB15C:("D_801BB15C","UNK_TYPE2","",0x2), - 0x801BB160:("D_801BB160","UNK_TYPE4","",0x4), + 0x801BB160:("sCutsceneTextboxType","UNK_TYPE4","",0x4), 0x801BB170:("sDrawItemTable","DrawItemTableEntry","[118]",0x1098), 0x801BC210:("gEffFootprintVtx","UNK_TYPE1","",0x1), 0x801BC240:("gEffFootprintMaterialDL","Gfx","[9]",0x48), @@ -940,16 +940,8 @@ 0x801BC400:("gEnHyParentBodyParts","UNK_TYPE1","",0x1), 0x801BC410:("gEnHyShadowSizes","s32",[],0x10), 0x801BC420:("sReactionTextIds","u16","[]",0x140A), - 0x801BD830:("actorCutscenesGlobalCutscenes","ActorCutscene","[8]",0x80), - 0x801BD8B0:("actorCutsceneCurrent","s16","",0x2), - 0x801BD8B2:("actorCutsceneCurrentLength","s16","",0x2), - 0x801BD8B4:("actorCutsceneEnding","s16","",0x2), - 0x801BD8B6:("actorCutsceneCurrentCamera","s16","",0x2), - 0x801BD8B8:("actorCutsceneCurrentCutsceneActor","Actor*","",0x4), - 0x801BD8BC:("actorCutsceneStartMethod","UNK_TYPE4","",0x4), - 0x801BD8C0:("actorCutscenesPlayState","PlayState*","",0x4), - 0x801BD8C4:("actorCutsceneReturnCamera","s16","",0x2), - 0x801BD8C6:("D_801BD8C6","s16","",0x2), + 0x801BD830:("sGlobalCutsceneList","ActorCutscene","[8]",0x80), + 0x801BD8B0:("sCutsceneMgr","ActorCutsceneManager","",0x18), 0x801BD8D0:("sFireObjCollisionInit","ColliderCylinderInit","",0x2c), 0x801BD8FC:("sFireObjColors","FireObjColors","[1]",0x08), 0x801BD904:("sFireObjLightParams","FireObjLightParams","[1]",0x08), @@ -2145,7 +2137,7 @@ 0x801D0D58:("sQuakeIndex","UNK_TYPE2","",0x2), 0x801D0D5C:("sIsCameraUnderwater","UNK_TYPE2","",0x2), 0x801D0D60:("D_801D0D60","Input*","",0x4), - 0x801D0D64:("D_801D0D64","s16","[10]",0x14), + 0x801D0D64:("sPlayerCsIdToCsCamId","s16","[10]",0x14), 0x801D0D78:("D_801D0D78","u16","[4]",0x4), 0x801D0D80:("D_801D0D80","UNK_TYPE1","",0x1), 0x801D11F4:("D_801D11F4","UNK_TYPE1","",0x1), @@ -3931,18 +3923,18 @@ 0x801F3F60:("gRegEditor","RegEditor*","",0x4), 0x801F3F70:("sDebugObjectListHead","UNK_TYPE1","",0x1), 0x801F3F80:("D_801F3F80","UNK_TYPE1","",0xDC0), - 0x801F4D40:("seqId","u16","",0x2), + 0x801F4D40:("sSeqId","u16","",0x2), 0x801F4D42:("sCutsceneQuakeIndex","UNK_TYPE2","",0x2), 0x801F4D48:("sCutsceneCameraInfo","UNK_TYPE","",0x80), - 0x801F4DC8:("D_801F4DC8","u16","[10]",0x14), + 0x801F4DC8:("sCueTypeList","u16","[10]",0x14), 0x801F4DDC:("D_801F4DDC","UNK_TYPE1","",0x1), - 0x801F4DE0:("D_801F4DE0","UNK_TYPE1","",0x1), - 0x801F4DE2:("D_801F4DE2","UNK_TYPE2","",0x2), - 0x801F4DF0:("actorCutscenes","ActorCutscene*","",0x4), - 0x801F4DF4:("actorCutsceneCount","s16","",0x2), - 0x801F4DF8:("actorCutsceneWaiting","u8","[16]",0x10), + 0x801F4DE0:("gDisablePlayerCsModeStartPos","UNK_TYPE1","",0x1), + 0x801F4DE2:("gDungeonBossWarpSceneId","UNK_TYPE2","",0x2), + 0x801F4DF0:("sSceneCutsceneList","ActorCutscene*","",0x4), + 0x801F4DF4:("sSceneCutsceneCount","s16","",0x2), + 0x801F4DF8:("sWaitingCutsceneList","u8","[16]",0x10), 0x801F4E08:("D_801F4E08","UNK_TYPE1","",0x1), - 0x801F4E10:("actorCutsceneNextCutscenes","u8","[16]",0x10), + 0x801F4E10:("sNextCutsceneList","u8","[16]",0x10), 0x801F4E20:("D_801F4E20","UNK_TYPE1","",0x1), 0x801F4E30:("D_801F4E30","UNK_TYPE1","",0x1), 0x801F4E31:("D_801F4E31","UNK_TYPE1","",0x1), @@ -4049,7 +4041,7 @@ 0x801F6B3C:("sPlayerCallDrawFunc","UNK_TYPE1","",0x1), 0x801F6B40:("sShrinkWindow","ShrinkWindow","",0x4), 0x801F6B44:("sShrinkWindowPtr","ShrinkWindow*","",0x4), - 0x801F6B50:("D_801F6B50","UNK_TYPE4","",0x4), + 0x801F6B50:("sCurCsCamera","UNK_TYPE4","",0x4), 0x801F6B58:("D_801F6B58","UNK_TYPE1","",0x1), 0x801F6BF0:("sKaleidoMgrFaultAddrConvClient","FaultAddrConvClient","",0xC), 0x801F6C00:("sKaleidoScopeUpdateFunc","void*","",0x4), @@ -6194,7 +6186,7 @@ 0x8089E314:("D_8089E314","UNK_TYPE1","",0x1), 0x8089E334:("D_8089E334","UNK_TYPE1","",0x1), 0x8089E33C:("D_8089E33C","UNK_TYPE4","",0x4), - 0x8089E34C:("D_8089E34C","UNK_TYPE2","",0x2), + 0x8089E34C:("sCsId","UNK_TYPE2","",0x2), 0x8089E350:("D_8089E350","UNK_TYPE4","",0x4), 0x8089E354:("D_8089E354","UNK_TYPE1","",0x1), 0x8089E364:("D_8089E364","UNK_TYPE4","",0x4), @@ -11094,7 +11086,7 @@ 0x80A2B90C:("sColHeaders","UNK_TYPE1","",0x1), 0x80A2B93C:("sTexAnims","UNK_TYPE1","",0x1), 0x80A2B96C:("D_80A2B96C","UNK_TYPE1","",0x1), - 0x80A2B974:("D_80A2B974","UNK_TYPE2","",0x2), + 0x80A2B974:("sCsIdList","UNK_TYPE2","",0x2), 0x80A2B978:("D_80A2B978","UNK_TYPE1","",0x1), 0x80A2B988:("D_80A2B988","UNK_TYPE1","",0x1), 0x80A2B9A0:("jtbl_80A2B9A0","UNK_PTR","",0x4), @@ -11483,8 +11475,8 @@ 0x80A43352:("sNightMessages2","s16","[3]",0x6), 0x80A4335A:("sDayMessages2","s16","[3]",0x6), 0x80A43364:("D_80A43364","u16","[2]",0x4), - 0x80A434D0:("sCutscenes","s16","[2]",0x4), - 0x80A434D4:("sCurrentCs","s16","",0x2), + 0x80A434D0:("sCsIdList","s16","[2]",0x4), + 0x80A434D4:("sCurCsId","s16","",0x2), 0x80A449E0:("En_Bat_InitVars","ActorInit","",0x1), 0x80A44A00:("sSphereInit","ColliderSphereInit","",0x1), 0x80A44A2C:("sDamageTable","DamageTable","4",0x1), @@ -12831,7 +12823,7 @@ 0x80AC0254:("D_80AC0254","UNK_TYPE2","",0x2), 0x80AC0258:("D_80AC0258","UNK_TYPE2","",0x2), 0x80AC025C:("D_80AC025C","UNK_TYPE4","",0x4), - 0x80AC0260:("D_80AC0260","UNK_TYPE2","",0x2), + 0x80AC0260:("sCueId","UNK_TYPE2","",0x2), 0x80AC0264:("D_80AC0264","UNK_TYPE4","",0x4), 0x80AC0270:("D_80AC0270","f32","",0x4), 0x80AC0274:("D_80AC0274","f32","",0x4), @@ -15211,14 +15203,14 @@ 0x80B8E19C:("D_80B8E19C","CollisionCheckInfoInit2","",0xC), 0x80B8E308:("D_80B8E308","void*","",0x4), 0x80B8E318:("D_80B8E318","UNK_TYPE1","",0x1), - 0x80B8E32C:("D_80B8E32C","UNK_TYPE2","",0x2), + 0x80B8E32C:("sCueId","UNK_TYPE2","",0x2), 0x80B8E330:("jtbl_80B8E330","UNK_PTR","",0x4), 0x80B8E34C:("jtbl_80B8E34C","UNK_PTR","",0x4), 0x80B913F0:("En_Ma_Yto_InitVars","UNK_TYPE1","",0x1), 0x80B91410:("D_80B91410","UNK_TYPE1","",0x1), 0x80B9143C:("D_80B9143C","UNK_TYPE1","",0x1), 0x80B91448:("D_80B91448","UNK_TYPE1","",0x1), - 0x80B915F0:("D_80B915F0","UNK_TYPE2","",0x2), + 0x80B915F0:("sCueId","UNK_TYPE2","",0x2), 0x80B91600:("jtbl_80B91600","UNK_PTR","",0x4), 0x80B91614:("jtbl_80B91614","UNK_PTR","",0x4), 0x80B91628:("jtbl_80B91628","UNK_PTR","",0x4), @@ -16606,7 +16598,7 @@ 0x80C1E984:("D_80C1E984","UNK_TYPE1","",0x1), 0x80C1F150:("Dm_Bal_InitVars","UNK_TYPE1","",0x1), 0x80C1F170:("sAnimationInfo","UNK_PTR","",0x4), - 0x80C1F2C0:("D_80C1F2C0","UNK_TYPE2","",0x2), + 0x80C1F2C0:("sCueId","UNK_TYPE2","",0x2), 0x80C1F2C4:("D_80C1F2C4","UNK_TYPE4","",0x4), 0x80C1F2D0:("D_80C1F2D0","UNK_TYPE1","",0x1), 0x80C1F2E0:("D_80C1F2E0","f32","",0x4), diff --git a/tools/namefixer.py b/tools/namefixer.py index b037f9415..d5493bbfc 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -590,18 +590,43 @@ wordReplace = { "func_800FE498": "Environment_StartTime", "func_800FE4A8": "Environment_IsTimeStopped", "func_800F5A8C": "Environment_LerpWeight", + "func_801A3F54": "Audio_SetCutsceneFlag", - "func_800EA0D4": "Cutscene_Start", - "func_800EA0EC": "Cutscene_End", + "func_800EA0D4": "Cutscene_StartManual", + "Cutscene_Start": "Cutscene_StartManual", + "func_800EA0EC": "Cutscene_StopManual", + "Cutscene_End": "Cutscene_StopManual", "func_800EDE34": "Cutscene_ActorTranslate", "func_800EDF24": "Cutscene_ActorTranslateAndYaw", "func_800EDF78": "Cutscene_ActorTranslateAndYawSmooth", "func_800EE0CC": "Cutscene_ActorTranslateXZAndYawSmooth", "func_800EE1D8": "Cutscene_GetSceneLayer", - "func_800EE200": "Cutscene_GetActorActionIndex", - "func_800EE29C": "Cutscene_CheckActorAction", + "func_800EE200": "Cutscene_GetCueChannel", + "Cutscene_GetActorActionIndex": "Cutscene_GetCueChannel", + "func_800EE29C": "Cutscene_IsCueInChannel", + "Cutscene_CheckActorAction": "Cutscene_IsCueInChannel", "func_800EE2F4": "Cutscene_IsPlaying", "Cutscene_GetSceneSetupIndex": "Cutscene_GetSceneLayer", + + "func_800F15D8": "CutsceneManager_StoreCamera", + "ActorCutscene_SetIntentToPlay": "CutsceneManager_Queue", + "ActorCutscene_GetCanPlayNext": "CutsceneManager_IsNext", + "ActorCutscene_StartAndSetUnkLinkFields": "CutsceneManager_StartWithPlayerCs", + "ActorCutscene_StartAndSetFlag": "CutsceneManager_StartWithPlayerCsAndSetFlag", + "ActorCutscene_Start": "CutsceneManager_Start", + "ActorCutscene_Stop": "CutsceneManager_Stop", + "ActorCutscene_GetCurrentIndex": "CutsceneManager_GetCurrentCsId", + "ActorCutscene_GetCutscene": "CutsceneManager_GetCutsceneEntry", + "ActorCutscene_GetAdditionalCutscene": "CutsceneManager_GetAdditionalCsId", + "ActorCutscene_GetLength": "CutsceneManager_GetLength", + "ActorCutscene_GetCurrentSubCamId": "CutsceneManager_GetCurrentSubCamId", + "ActorCutscene_GetCurrentCamera": "CutsceneManager_GetCurrentSubCamId", + + "EnvFlags_UnsetAll": "CutsceneFlags_UnsetAll", + "EnvFlags_Set": "CutsceneFlags_Set", + "EnvFlags_Unset": "CutsceneFlags_Unset", + "EnvFlags_Get": "CutsceneFlags_Get", + "func_801343C0": "SkelAnime_DrawTransformFlexOpa", "func_80114E90": "Inventory_HasEmptyBottle", "func_80114F2C": "Inventory_HasItemInBottle", @@ -622,7 +647,8 @@ wordReplace = { "func_8013E640": "SubS_FindActorCustom", "func_ActorCategoryIterateById": "SubS_FindActor", "func_8013BB7C": "SubS_FindNearestActor", - "func_8013E2D4": "SubS_StartActorCutscene", + "func_8013E2D4": "SubS_StartCutscene", + "SubS_StartActorCutscene": "SubS_StartCutscene", "func_8013E3B8": "SubS_FillCutscenesList", "func_8013AED4": "SubS_UpdateFlags", "func_8013D8DC": "SubS_IsObjectLoaded", @@ -693,8 +719,6 @@ wordReplace = { "func_8010A54C": "Minimap_Draw", "func_8010A580": "Map_Update", - "ActorCutscene_GetCurrentCamera": "ActorCutscene_GetCurrentSubCamId", - "Entrance_CreateIndex": "Entrance_Create", "Entrance_CreateIndexFromSpawn": "Entrance_CreateFromSpawn", @@ -731,6 +755,7 @@ wordReplace = { "actor.minVelocityY": "actor.terminalVelocity", "actor.yDistToWater": "actor.depthInWater", "actor.yDistToPlayer": "actor.playerHeightRel", + "actor.cutscene": "actor.csId", "actor.speedXZ": "actor.speed", "thisx->speedXZ": "thisx->speed", @@ -765,7 +790,9 @@ wordReplace = { "gSaveContext.permanentSceneFlags": "gSaveContext.save.saveInfo.permanentSceneFlags", "gSaveContext.bomberCode": "gSaveContext.save.saveInfo.bomberCode", "gSaveContext.skullTokenCount": "gSaveContext.save.saveInfo.skullTokenCount", - "gSaveContext.cutscene": "gSaveContext.save.cutscene", + "gSaveContext.cutscene": "gSaveContext.save.saveInfo.cutsceneIndex", + "gSaveContext.save.cutscene": "gSaveContext.save.saveInfo.cutsceneIndex", + "gSaveContext.save.saveInfo.cutscene": "gSaveContext.save.saveInfo.cutsceneIndex", "gSaveContext.health": "gSaveContext.save.saveInfo.playerData.health", "gSaveContext.equips": "gSaveContext.save.saveInfo.equips", "gSaveContext.unk_1016": "gSaveContext.jinxTimer", @@ -852,10 +879,20 @@ wordReplace = { "ageProperties->unk_04": "ageProperties->shadowScale", "ageProperties->unk_92": "ageProperties->voiceSfxOffset", "ageProperties->unk_94": "ageProperties->surfaceSfxOffset", + "player->unk_A86": "player->csId", + + "csCtx.npcActions": "csCtx.actorCues", + "csCtx->npcActions": "csCtx->actorCues", + "csCtx.actorActions": "csCtx.actorCues", + "csCtx->actorActions": "csCtx->actorCues", + "csCtx.playerAction": "csCtx.playerCue", + "csCtx->playerAction": "csCtx->playerCue", + "csCtx.unk_12": "csCtx.scriptIndex", + "csCtx.currentCsIndex": "csCtx.scriptIndex", + "csCtx->currentCsIndex": "csCtx->scriptIndex", + "csCtx.frames": "csCtx.curFrame", + "csCtx->frames": "csCtx->curFrame", - "csCtx.npcActions": "csCtx.actorActions", - "csCtx->npcActions": "csCtx->actorActions", - "csCtx.unk_12": "csCtx.currentCsIndex", "globalCtx->mf_187FC": "play->billboardMtxF", "globalCtx->projectionMatrix": "play->viewProjectionMtxF", "globalCtx->actorCtx.actorList[": "play->actorCtx.actorLists[", @@ -887,6 +924,8 @@ wordReplace = { "play->nextEntranceIndex": "play->nextEntrance", "play->sceneNum": "play->sceneId", "play->pauseCtx.unk_1F0": "play->pauseCtx.bombersNotebookOpen", + "play->playerActorCsIds": "play->playerCsIds", + "play->envFlags": "play->cutsceneFlags", "play->roomCtx.curRoom.unk3": "play->roomCtx.curRoom.behaviorType1", "play->roomCtx.curRoom.unk2": "play->roomCtx.curRoom.behaviorType2", "play->roomCtx.unk31": "play->roomCtx.status", @@ -951,6 +990,11 @@ wordReplace = { "PLAYER_AP_FISHING_POLE": "PLAYER_IA_FISHING_ROD", "PLAYER_IA_BOTTLE": "PLAYER_IA_BOTTLE_EMPTY", + "WEEKEVENTREG_20_02": "WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE", + "WEEKEVENTREG_33_80": "WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE", + "WEEKEVENTREG_52_20": "WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE", + "WEEKEVENTREG_55_80": "WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE", + # Enums "TRANS_TYPE_00": "TRANS_TYPE_WIPE", "TRANS_TYPE_01": "TRANS_TYPE_TRIFORCE", @@ -975,6 +1019,10 @@ wordReplace = { "TRANS_TYPE_20": "TRANS_TYPE_FADE_DYNAMIC", "TRANS_TYPE_21": "TRANS_TYPE_CIRCLE", "TRANS_TYPE_22": "TRANS_TYPE_WIPE5", + "PLAYER_CSMODE_6": "PLAYER_CSMODE_END", + "PLAYER_CSMODE_7": "PLAYER_CSMODE_WAIT", + "SUBS_CUTSCENE_SET_UNK_LINK_FIELDS": "SUBS_CUTSCENE_WITH_PLAYER", + "SUBS_CUTSCENE_SET_FLAG": "SUBS_CUTSCENE_WITH_PLAYER_SET_FLAG", "COLPOLY_SURFACE_GROUND": "SURFACE_MATERIAL_DIRT", "COLPOLY_SURFACE_SAND": "SURFACE_MATERIAL_SAND", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 92cd63a29..a643f147f 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1047,54 +1047,54 @@ asm/non_matchings/code/z_debug_mode/Debug_DrawScreenText.s,Debug_DrawScreenText, asm/non_matchings/code/z_debug_mode/DebugCamera_ScreenText.s,DebugCamera_ScreenText,0x800E9DBC,0x36 asm/non_matchings/code/z_debug_mode/DebugCamera_DrawScreenText.s,DebugCamera_DrawScreenText,0x800E9E94,0x39 asm/non_matchings/code/z_debug_mode/Debug_DrawText.s,Debug_DrawText,0x800E9F78,0x3A -asm/non_matchings/code/z_demo/Cutscene_Init.s,Cutscene_Init,0x800EA060,0x1D -asm/non_matchings/code/z_demo/Cutscene_Start.s,Cutscene_Start,0x800EA0D4,0x6 -asm/non_matchings/code/z_demo/Cutscene_End.s,Cutscene_End,0x800EA0EC,0x9 -asm/non_matchings/code/z_demo/Cutscene_Update1.s,Cutscene_Update1,0x800EA110,0x13 -asm/non_matchings/code/z_demo/Cutscene_Update2.s,Cutscene_Update2,0x800EA15C,0x2D -asm/non_matchings/code/z_demo/Cutscene_DoNothing.s,Cutscene_DoNothing,0x800EA210,0x4 -asm/non_matchings/code/z_demo/func_800EA220.s,func_800EA220,0x800EA220,0xE -asm/non_matchings/code/z_demo/func_800EA258.s,func_800EA258,0x800EA258,0x18 -asm/non_matchings/code/z_demo/func_800EA2B8.s,func_800EA2B8,0x800EA2B8,0x1B -asm/non_matchings/code/z_demo/Cutscene_Command_Misc.s,Cutscene_Command_Misc,0x800EA324,0x222 -asm/non_matchings/code/z_demo/Cutscene_Command_SetLighting.s,Cutscene_Command_SetLighting,0x800EABAC,0x17 -asm/non_matchings/code/z_demo/Cutscene_Command_PlaySequence.s,Cutscene_Command_PlaySequence,0x800EAC08,0xF -asm/non_matchings/code/z_demo/Cutscene_Command_StopSequence.s,Cutscene_Command_StopSequence,0x800EAC44,0x14 -asm/non_matchings/code/z_demo/Cutscene_Command_FadeSequence.s,Cutscene_Command_FadeSequence,0x800EAC94,0x20 -asm/non_matchings/code/z_demo/Cutscene_Command_PlayAmbienceSequence.s,Cutscene_Command_PlayAmbienceSequence,0x800EAD14,0xD -asm/non_matchings/code/z_demo/func_800EAD48.s,func_800EAD48,0x800EAD48,0xD -asm/non_matchings/code/z_demo/func_800EAD7C.s,func_800EAD7C,0x800EAD7C,0xD -asm/non_matchings/code/z_demo/func_800EADB0.s,func_800EADB0,0x800EADB0,0x47 -asm/non_matchings/code/z_demo/Cutscene_Command_FadeAmbienceSequence.s,Cutscene_Command_FadeAmbienceSequence,0x800EAECC,0x15 -asm/non_matchings/code/z_demo/Cutscene_Command_Rumble.s,Cutscene_Command_Rumble,0x800EAF20,0x30 -asm/non_matchings/code/z_demo/Cutscene_Command_FadeColorScreen.s,Cutscene_Command_FadeColorScreen,0x800EAFE0,0x7F -asm/non_matchings/code/z_demo/Cutscene_Command_SetTime.s,Cutscene_Command_SetTime,0x800EB1DC,0x62 -asm/non_matchings/code/z_demo/Cutscene_TerminatorImpl.s,Cutscene_TerminatorImpl,0x800EB364,0x54 -asm/non_matchings/code/z_demo/Cutscene_Command_Terminator.s,Cutscene_Command_Terminator,0x800EB4B4,0x91 -asm/non_matchings/code/z_demo/Cutscene_Command_ChooseCreditsScenes.s,Cutscene_Command_ChooseCreditsScenes,0x800EB6F8,0x11C -asm/non_matchings/code/z_demo/Cutscene_Command_MotionBlur.s,Cutscene_Command_MotionBlur,0x800EBB68,0x5A -asm/non_matchings/code/z_demo/Cutscene_Command_GiveTatlToPlayer.s,Cutscene_Command_GiveTatlToPlayer,0x800EBCD0,0x24 -asm/non_matchings/code/z_demo/Cutscene_Command_TransitionFX.s,Cutscene_Command_TransitionFX,0x800EBD60,0x246 -asm/non_matchings/code/z_demo/Cutscene_Command_Camera.s,Cutscene_Command_Camera,0x800EC678,0x17 +asm/non_matchings/code/z_demo/Cutscene_InitContext.s,Cutscene_InitContext,0x800EA060,0x1D +asm/non_matchings/code/z_demo/Cutscene_StartManual.s,Cutscene_StartManual,0x800EA0D4,0x6 +asm/non_matchings/code/z_demo/Cutscene_StopManual.s,Cutscene_StopManual,0x800EA0EC,0x9 +asm/non_matchings/code/z_demo/Cutscene_UpdateManual.s,Cutscene_UpdateManual,0x800EA110,0x13 +asm/non_matchings/code/z_demo/Cutscene_UpdateScripted.s,Cutscene_UpdateScripted,0x800EA15C,0x2D +asm/non_matchings/code/z_demo/CutsceneHandler_DoNothing.s,CutsceneHandler_DoNothing,0x800EA210,0x4 +asm/non_matchings/code/z_demo/Cutscene_StepTimer.s,Cutscene_StepTimer,0x800EA220,0xE +asm/non_matchings/code/z_demo/CutsceneHandler_StartManual.s,CutsceneHandler_StartManual,0x800EA258,0x18 +asm/non_matchings/code/z_demo/CutsceneHandler_StartScript.s,CutsceneHandler_StartScript,0x800EA2B8,0x1B +asm/non_matchings/code/z_demo/CutsceneCmd_Misc.s,CutsceneCmd_Misc,0x800EA324,0x222 +asm/non_matchings/code/z_demo/CutsceneCmd_SetLightSetting.s,CutsceneCmd_SetLightSetting,0x800EABAC,0x17 +asm/non_matchings/code/z_demo/CutsceneCmd_StartSequence.s,CutsceneCmd_StartSequence,0x800EAC08,0xF +asm/non_matchings/code/z_demo/CutsceneCmd_StopSequence.s,CutsceneCmd_StopSequence,0x800EAC44,0x14 +asm/non_matchings/code/z_demo/CutsceneCmd_FadeOutSequence.s,CutsceneCmd_FadeOutSequence,0x800EAC94,0x20 +asm/non_matchings/code/z_demo/CutsceneCmd_StartAmbience.s,CutsceneCmd_StartAmbience,0x800EAD14,0xD +asm/non_matchings/code/z_demo/Cutscene_SetSfxReverbIndexTo2.s,Cutscene_SetSfxReverbIndexTo2,0x800EAD48,0xD +asm/non_matchings/code/z_demo/Cutscene_SetSfxReverbIndexTo1.s,Cutscene_SetSfxReverbIndexTo1,0x800EAD7C,0xD +asm/non_matchings/code/z_demo/CutsceneCmd_ModifySequence.s,CutsceneCmd_ModifySequence,0x800EADB0,0x47 +asm/non_matchings/code/z_demo/CutsceneCmd_FadeOutAmbience.s,CutsceneCmd_FadeOutAmbience,0x800EAECC,0x15 +asm/non_matchings/code/z_demo/CutsceneCmd_RumbleController.s,CutsceneCmd_RumbleController,0x800EAF20,0x30 +asm/non_matchings/code/z_demo/CutsceneCmd_TransitionGeneral.s,CutsceneCmd_TransitionGeneral,0x800EAFE0,0x7F +asm/non_matchings/code/z_demo/CutsceneCmd_SetTime.s,CutsceneCmd_SetTime,0x800EB1DC,0x62 +asm/non_matchings/code/z_demo/CutsceneCmd_DestinationDefault.s,CutsceneCmd_DestinationDefault,0x800EB364,0x54 +asm/non_matchings/code/z_demo/CutsceneCmd_Destination.s,CutsceneCmd_Destination,0x800EB4B4,0x91 +asm/non_matchings/code/z_demo/CutsceneCmd_ChooseCreditsScenes.s,CutsceneCmd_ChooseCreditsScenes,0x800EB6F8,0x11C +asm/non_matchings/code/z_demo/CutsceneCmd_MotionBlur.s,CutsceneCmd_MotionBlur,0x800EBB68,0x5A +asm/non_matchings/code/z_demo/CutsceneCmd_GiveTatlToPlayer.s,CutsceneCmd_GiveTatlToPlayer,0x800EBCD0,0x24 +asm/non_matchings/code/z_demo/CutsceneCmd_Transition.s,CutsceneCmd_Transition,0x800EBD60,0x246 +asm/non_matchings/code/z_demo/CutsceneCmd_UpdateCamSpline.s,CutsceneCmd_UpdateCamSpline,0x800EC678,0x17 asm/non_matchings/code/z_demo/Cutscene_CountNormalMasks.s,Cutscene_CountNormalMasks,0x800EC6D4,0x94 -asm/non_matchings/code/z_demo/Cutscene_Command_Textbox.s,Cutscene_Command_Textbox,0x800EC924,0x116 -asm/non_matchings/code/z_demo/func_800ECD7C.s,func_800ECD7C,0x800ECD7C,0x31 -asm/non_matchings/code/z_demo/Cutscene_ProcessCommands.s,Cutscene_ProcessCommands,0x800ECE40,0x2D0 -asm/non_matchings/code/z_demo/func_800ED980.s,func_800ED980,0x800ED980,0x11 -asm/non_matchings/code/z_demo/func_800ED9C4.s,func_800ED9C4,0x800ED9C4,0x10 -asm/non_matchings/code/z_demo/func_800EDA04.s,func_800EDA04,0x800EDA04,0x20 -asm/non_matchings/code/z_demo/func_800EDA84.s,func_800EDA84,0x800EDA84,0x57 -asm/non_matchings/code/z_demo/func_800EDBE0.s,func_800EDBE0,0x800EDBE0,0x74 +asm/non_matchings/code/z_demo/CutsceneCmd_Text.s,CutsceneCmd_Text,0x800EC924,0x116 +asm/non_matchings/code/z_demo/Cutscene_SetActorCue.s,Cutscene_SetActorCue,0x800ECD7C,0x31 +asm/non_matchings/code/z_demo/Cutscene_ProcessScript.s,Cutscene_ProcessScript,0x800ECE40,0x2D0 +asm/non_matchings/code/z_demo/CutsceneHandler_RunScript.s,CutsceneHandler_RunScript,0x800ED980,0x11 +asm/non_matchings/code/z_demo/CutsceneHandler_StopManual.s,CutsceneHandler_StopManual,0x800ED9C4,0x10 +asm/non_matchings/code/z_demo/CutsceneHandler_StopScript.s,CutsceneHandler_StopScript,0x800EDA04,0x20 +asm/non_matchings/code/z_demo/Cutscene_SetupScripted.s,Cutscene_SetupScripted,0x800EDA84,0x57 +asm/non_matchings/code/z_demo/Cutscene_HandleEntranceTriggers.s,Cutscene_HandleEntranceTriggers,0x800EDBE0,0x74 asm/non_matchings/code/z_demo/func_800EDDB0.s,func_800EDDB0,0x800EDDB0,0x3 asm/non_matchings/code/z_demo/func_800EDDBC.s,func_800EDDBC,0x800EDDBC,0x4 -asm/non_matchings/code/z_demo/Cutscene_LoadCutsceneData.s,Cutscene_LoadCutsceneData,0x800EDDCC,0x1A +asm/non_matchings/code/z_demo/Cutscene_StartScripted.s,Cutscene_StartScripted,0x800EDDCC,0x1A asm/non_matchings/code/z_demo/Cutscene_ActorTranslate.s,Cutscene_ActorTranslate,0x800EDE34,0x3C asm/non_matchings/code/z_demo/Cutscene_ActorTranslateAndYaw.s,Cutscene_ActorTranslateAndYaw,0x800EDF24,0x15 asm/non_matchings/code/z_demo/Cutscene_ActorTranslateAndYawSmooth.s,Cutscene_ActorTranslateAndYawSmooth,0x800EDF78,0x55 asm/non_matchings/code/z_demo/Cutscene_ActorTranslateXZAndYawSmooth.s,Cutscene_ActorTranslateXZAndYawSmooth,0x800EE0CC,0x43 asm/non_matchings/code/z_demo/Cutscene_GetSceneLayer.s,Cutscene_GetSceneLayer,0x800EE1D8,0xA -asm/non_matchings/code/z_demo/Cutscene_GetActorActionIndex.s,Cutscene_GetActorActionIndex,0x800EE200,0x27 -asm/non_matchings/code/z_demo/Cutscene_CheckActorAction.s,Cutscene_CheckActorAction,0x800EE29C,0x16 +asm/non_matchings/code/z_demo/Cutscene_GetCueChannel.s,Cutscene_GetCueChannel,0x800EE200,0x27 +asm/non_matchings/code/z_demo/Cutscene_IsCueInChannel.s,Cutscene_IsCueInChannel,0x800EE29C,0x16 asm/non_matchings/code/z_demo/Cutscene_IsPlaying.s,Cutscene_IsPlaying,0x800EE2F4,0xB asm/non_matchings/code/z_draw/GetItem_Draw.s,GetItem_Draw,0x800EE320,0x11 asm/non_matchings/code/z_draw/GetItem_DrawBombchu.s,GetItem_DrawBombchu,0x800EE364,0x27 @@ -1150,31 +1150,31 @@ asm/non_matchings/code/code_800F12D0/func_800F12D0.s,func_800F12D0,0x800F12D0,0x asm/non_matchings/code/code_800F12D0/func_800F1304.s,func_800F1304,0x800F1304,0x1C asm/non_matchings/code/code_800F12D0/func_800F1374.s,func_800F1374,0x800F1374,0x1D asm/non_matchings/code/code_800F12D0/func_800F13E8.s,func_800F13E8,0x800F13E8,0x1E -asm/non_matchings/code/z_eventmgr/func_800F1460.s,func_800F1460,0x800F1460,0x26 -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCutsceneImpl.s,ActorCutscene_GetCutsceneImpl,0x800F14F8,0x13 -asm/non_matchings/code/z_eventmgr/ActorCutscene_Init.s,ActorCutscene_Init,0x800F1544,0x25 -asm/non_matchings/code/z_eventmgr/func_800F15D8.s,func_800F15D8,0x800F15D8,0x1C -asm/non_matchings/code/z_eventmgr/ActorCutscene_ClearWaiting.s,ActorCutscene_ClearWaiting,0x800F1648,0xC -asm/non_matchings/code/z_eventmgr/ActorCutscene_ClearNextCutscenes.s,ActorCutscene_ClearNextCutscenes,0x800F1678,0xC -asm/non_matchings/code/z_eventmgr/ActorCutscene_MarkNextCutscenes.s,ActorCutscene_MarkNextCutscenes,0x800F16A8,0x55 -asm/non_matchings/code/z_eventmgr/ActorCutscene_End.s,ActorCutscene_End,0x800F17FC,0xA0 -asm/non_matchings/code/z_eventmgr/ActorCutscene_Update.s,ActorCutscene_Update,0x800F1A7C,0x4A -asm/non_matchings/code/z_eventmgr/ActorCutscene_SetIntentToPlay.s,ActorCutscene_SetIntentToPlay,0x800F1BA4,0x10 -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCanPlayNext.s,ActorCutscene_GetCanPlayNext,0x800F1BE4,0x21 -asm/non_matchings/code/z_eventmgr/ActorCutscene_StartAndSetUnkLinkFields.s,ActorCutscene_StartAndSetUnkLinkFields,0x800F1C68,0x1E -asm/non_matchings/code/z_eventmgr/ActorCutscene_StartAndSetFlag.s,ActorCutscene_StartAndSetFlag,0x800F1CE0,0x29 -asm/non_matchings/code/z_eventmgr/ActorCutscene_Start.s,ActorCutscene_Start,0x800F1D84,0x8E -asm/non_matchings/code/z_eventmgr/ActorCutscene_Stop.s,ActorCutscene_Stop,0x800F1FBC,0x30 -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentIndex.s,ActorCutscene_GetCurrentIndex,0x800F207C,0x4 -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCutscene.s,ActorCutscene_GetCutscene,0x800F208C,0xB -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetAdditionalCutscene.s,ActorCutscene_GetAdditionalCutscene,0x800F20B8,0x10 -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetLength.s,ActorCutscene_GetLength,0x800F20F8,0x10 -asm/non_matchings/code/z_eventmgr/func_800F2138.s,func_800F2138,0x800F2138,0x10 -asm/non_matchings/code/z_eventmgr/func_800F2178.s,func_800F2178,0x800F2178,0x10 -asm/non_matchings/code/z_eventmgr/ActorCutscene_GetCurrentSubCamId.s,ActorCutscene_GetCurrentSubCamId,0x800F21B8,0x5 -asm/non_matchings/code/z_eventmgr/func_800F21CC.s,func_800F21CC,0x800F21CC,0x3E +asm/non_matchings/code/z_eventmgr/CutsceneManager_SetHudVisibility.s,CutsceneManager_SetHudVisibility,0x800F1460,0x26 +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetCutsceneEntryImpl.s,CutsceneManager_GetCutsceneEntryImpl,0x800F14F8,0x13 +asm/non_matchings/code/z_eventmgr/CutsceneManager_Init.s,CutsceneManager_Init,0x800F1544,0x25 +asm/non_matchings/code/z_eventmgr/CutsceneManager_StoreCamera.s,CutsceneManager_StoreCamera,0x800F15D8,0x1C +asm/non_matchings/code/z_eventmgr/CutsceneManager_ClearWaiting.s,CutsceneManager_ClearWaiting,0x800F1648,0xC +asm/non_matchings/code/z_eventmgr/CutsceneManager_ClearNextCutscenes.s,CutsceneManager_ClearNextCutscenes,0x800F1678,0xC +asm/non_matchings/code/z_eventmgr/CutsceneManager_MarkNextCutscenes.s,CutsceneManager_MarkNextCutscenes,0x800F16A8,0x55 +asm/non_matchings/code/z_eventmgr/CutsceneManager_End.s,CutsceneManager_End,0x800F17FC,0xA0 +asm/non_matchings/code/z_eventmgr/CutsceneManager_Update.s,CutsceneManager_Update,0x800F1A7C,0x4A +asm/non_matchings/code/z_eventmgr/CutsceneManager_Queue.s,CutsceneManager_Queue,0x800F1BA4,0x10 +asm/non_matchings/code/z_eventmgr/CutsceneManager_IsNext.s,CutsceneManager_IsNext,0x800F1BE4,0x21 +asm/non_matchings/code/z_eventmgr/CutsceneManager_StartWithPlayerCs.s,CutsceneManager_StartWithPlayerCs,0x800F1C68,0x1E +asm/non_matchings/code/z_eventmgr/CutsceneManager_StartWithPlayerCsAndSetFlag.s,CutsceneManager_StartWithPlayerCsAndSetFlag,0x800F1CE0,0x29 +asm/non_matchings/code/z_eventmgr/CutsceneManager_Start.s,CutsceneManager_Start,0x800F1D84,0x8E +asm/non_matchings/code/z_eventmgr/CutsceneManager_Stop.s,CutsceneManager_Stop,0x800F1FBC,0x30 +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetCurrentCsId.s,CutsceneManager_GetCurrentCsId,0x800F207C,0x4 +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetCutsceneEntry.s,CutsceneManager_GetCutsceneEntry,0x800F208C,0xB +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetAdditionalCsId.s,CutsceneManager_GetAdditionalCsId,0x800F20B8,0x10 +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetLength.s,CutsceneManager_GetLength,0x800F20F8,0x10 +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetCutsceneScriptIndex.s,CutsceneManager_GetCutsceneScriptIndex,0x800F2138,0x10 +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetCutsceneCustomValue.s,CutsceneManager_GetCutsceneCustomValue,0x800F2178,0x10 +asm/non_matchings/code/z_eventmgr/CutsceneManager_GetCurrentSubCamId.s,CutsceneManager_GetCurrentSubCamId,0x800F21B8,0x5 +asm/non_matchings/code/z_eventmgr/CutsceneManager_FindEntranceCsId.s,CutsceneManager_FindEntranceCsId,0x800F21CC,0x3E asm/non_matchings/code/z_eventmgr/func_800F22C4.s,func_800F22C4,0x800F22C4,0x40 -asm/non_matchings/code/z_eventmgr/ActorCutscene_SetReturnCamera.s,ActorCutscene_SetReturnCamera,0x800F23C4,0x7 +asm/non_matchings/code/z_eventmgr/CutsceneManager_SetReturnCamera.s,CutsceneManager_SetReturnCamera,0x800F23C4,0x7 asm/non_matchings/code/z_fcurve_data/func_800F23E0.s,func_800F23E0,0x800F23E0,0x26 asm/non_matchings/code/z_fcurve_data/func_800F2478.s,func_800F2478,0x800F2478,0x6A asm/non_matchings/code/z_fcurve_data_skelanime/func_800F2620.s,func_800F2620,0x800F2620,0xC @@ -1961,8 +1961,8 @@ asm/non_matchings/code/z_scene/Scene_Command09.s,Scene_Command09,0x801303D0,0x4 asm/non_matchings/code/z_scene/Scene_CommandSoundSettings.s,Scene_CommandSoundSettings,0x801303E0,0x17 asm/non_matchings/code/z_scene/Scene_CommandEchoSetting.s,Scene_CommandEchoSetting,0x8013043C,0x6 asm/non_matchings/code/z_scene/Scene_CommandAltHeaderList.s,Scene_CommandAltHeaderList,0x80130454,0x1E -asm/non_matchings/code/z_scene/Scene_CommandCutsceneList.s,Scene_CommandCutsceneList,0x801304CC,0xD -asm/non_matchings/code/z_scene/Scene_CommandActorCutsceneList.s,Scene_CommandActorCutsceneList,0x80130500,0x10 +asm/non_matchings/code/z_scene/Scene_CommandCutsceneScriptList.s,Scene_CommandCutsceneScriptList,0x801304CC,0xD +asm/non_matchings/code/z_scene/Scene_CommandCutsceneList.s,Scene_CommandCutsceneList,0x80130500,0x10 asm/non_matchings/code/z_scene/Scene_CommandMiniMap.s,Scene_CommandMiniMap,0x80130540,0xE asm/non_matchings/code/z_scene/Scene_Command1D.s,Scene_Command1D,0x80130578,0x4 asm/non_matchings/code/z_scene/Scene_CommandMiniMapCompassInfo.s,Scene_CommandMiniMapCompassInfo,0x80130588,0xA @@ -2215,7 +2215,7 @@ asm/non_matchings/code/z_sub_s/SubS_ActorPathing_MoveWithGravity.s,SubS_ActorPat asm/non_matchings/code/z_sub_s/SubS_ActorPathing_MoveWithoutGravityReverse.s,SubS_ActorPathing_MoveWithoutGravityReverse,0x8013E07C,0xA asm/non_matchings/code/z_sub_s/SubS_ActorPathing_SetNextPoint.s,SubS_ActorPathing_SetNextPoint,0x8013E0A4,0x49 asm/non_matchings/code/z_sub_s/SubS_ChangeAnimationBySpeedInfo.s,SubS_ChangeAnimationBySpeedInfo,0x8013E1C8,0x43 -asm/non_matchings/code/z_sub_s/SubS_StartActorCutscene.s,SubS_StartActorCutscene,0x8013E2D4,0x39 +asm/non_matchings/code/z_sub_s/SubS_StartCutscene.s,SubS_StartCutscene,0x8013E2D4,0x39 asm/non_matchings/code/z_sub_s/SubS_FillCutscenesList.s,SubS_FillCutscenesList,0x8013E3B8,0x3E asm/non_matchings/code/z_sub_s/SubS_ConstructPlane.s,SubS_ConstructPlane,0x8013E4B0,0x47 asm/non_matchings/code/z_sub_s/SubS_LineSegVsPlane.s,SubS_LineSegVsPlane,0x8013E5CC,0x1D @@ -2311,7 +2311,7 @@ asm/non_matchings/code/z_sram_NES/Sram_ResetSave.s,Sram_ResetSave,0x80144628,0x1 asm/non_matchings/code/z_sram_NES/Sram_GenerateRandomSaveFields.s,Sram_GenerateRandomSaveFields,0x80144684,0x83 asm/non_matchings/code/z_sram_NES/func_80144890.s,func_80144890,0x80144890,0x36 asm/non_matchings/code/z_sram_NES/Sram_InitDebugSave.s,Sram_InitDebugSave,0x80144968,0x4B -asm/non_matchings/code/z_sram_NES/func_80144A94.s,func_80144A94,0x80144A94,0xF9 +asm/non_matchings/code/z_sram_NES/Sram_ResetSaveFromMoonCrash.s,Sram_ResetSaveFromMoonCrash,0x80144A94,0xF9 asm/non_matchings/code/z_sram_NES/Sram_OpenSave.s,Sram_OpenSave,0x80144E78,0x17D asm/non_matchings/code/z_sram_NES/func_8014546C.s,func_8014546C,0x8014546C,0x8B asm/non_matchings/code/z_sram_NES/func_80145698.s,func_80145698,0x80145698,0x4D @@ -2418,27 +2418,27 @@ asm/non_matchings/code/z_shrink_window/ShrinkWindow_Init.s,ShrinkWindow_Init,0x8 asm/non_matchings/code/z_shrink_window/ShrinkWindow_Destroy.s,ShrinkWindow_Destroy,0x80160CD4,0x4 asm/non_matchings/code/z_shrink_window/ShrinkWindow_Update.s,ShrinkWindow_Update,0x80160CE4,0x2D asm/non_matchings/code/z_shrink_window/ShrinkWindow_Draw.s,ShrinkWindow_Draw,0x80160D98,0xFA -asm/non_matchings/code/db_camera/func_80161180.s,func_80161180,0x80161180,0x7 -asm/non_matchings/code/db_camera/func_8016119C.s,func_8016119C,0x8016119C,0x24 -asm/non_matchings/code/db_camera/func_8016122C.s,func_8016122C,0x8016122C,0x23 -asm/non_matchings/code/db_camera/func_801612B8.s,func_801612B8,0x801612B8,0x1B8 -asm/non_matchings/code/db_camera/func_80161998.s,func_80161998,0x80161998,0x85 -asm/non_matchings/code/db_camera/func_80161BAC.s,func_80161BAC,0x80161BAC,0xD -asm/non_matchings/code/db_camera/func_80161BE0.s,func_80161BE0,0x80161BE0,0xB -asm/non_matchings/code/db_camera/func_80161C0C.s,func_80161C0C,0x80161C0C,0x5 -asm/non_matchings/code/db_camera/func_80161C20.s,func_80161C20,0x80161C20,0x8B -asm/non_matchings/code/db_camera/func_80161E4C.s,func_80161E4C,0x80161E4C,0xA0 -asm/non_matchings/code/db_camera/func_801620CC.s,func_801620CC,0x801620CC,0xAC -asm/non_matchings/code/db_camera/func_8016237C.s,func_8016237C,0x8016237C,0x1A -asm/non_matchings/code/db_camera/func_801623E4.s,func_801623E4,0x801623E4,0x42 -asm/non_matchings/code/db_camera/func_801624EC.s,func_801624EC,0x801624EC,0x14 -asm/non_matchings/code/db_camera/func_8016253C.s,func_8016253C,0x8016253C,0x120 -asm/non_matchings/code/db_camera/func_801629BC.s,func_801629BC,0x801629BC,0x25 -asm/non_matchings/code/db_camera/func_80162A50.s,func_80162A50,0x80162A50,0x16A -asm/non_matchings/code/db_camera/func_80162FF8.s,func_80162FF8,0x80162FF8,0x79 -asm/non_matchings/code/db_camera/func_801631DC.s,func_801631DC,0x801631DC,0x56 -asm/non_matchings/code/db_camera/func_80163334.s,func_80163334,0x80163334,0xCB -asm/non_matchings/code/db_camera/func_80163660.s,func_80163660,0x80163660,0x28 +asm/non_matchings/code/cutscene_camera/func_80161180.s,func_80161180,0x80161180,0x7 +asm/non_matchings/code/cutscene_camera/CutsceneCamera_Init.s,CutsceneCamera_Init,0x8016119C,0x24 +asm/non_matchings/code/cutscene_camera/CutsceneCamera_Interpolate.s,CutsceneCamera_Interpolate,0x8016122C,0x23 +asm/non_matchings/code/cutscene_camera/CutsceneCamera_ProcessSpline.s,CutsceneCamera_ProcessSpline,0x801612B8,0x1B8 +asm/non_matchings/code/cutscene_camera/CutsceneCamera_UpdateSplines.s,CutsceneCamera_UpdateSplines,0x80161998,0x85 +asm/non_matchings/code/cutscene_camera/func_80161BAC.s,func_80161BAC,0x80161BAC,0xD +asm/non_matchings/code/cutscene_camera/CutsceneCamera_SetState.s,CutsceneCamera_SetState,0x80161BE0,0xB +asm/non_matchings/code/cutscene_camera/CutsceneCamera_Reset.s,CutsceneCamera_Reset,0x80161C0C,0x5 +asm/non_matchings/code/cutscene_camera/func_80161C20.s,func_80161C20,0x80161C20,0x8B +asm/non_matchings/code/cutscene_camera/func_80161E4C.s,func_80161E4C,0x80161E4C,0xA0 +asm/non_matchings/code/cutscene_camera/func_801620CC.s,func_801620CC,0x801620CC,0xAC +asm/non_matchings/code/cutscene_camera/func_8016237C.s,func_8016237C,0x8016237C,0x1A +asm/non_matchings/code/cutscene_camera/func_801623E4.s,func_801623E4,0x801623E4,0x42 +asm/non_matchings/code/cutscene_camera/func_801624EC.s,func_801624EC,0x801624EC,0x14 +asm/non_matchings/code/cutscene_camera/func_8016253C.s,func_8016253C,0x8016253C,0x120 +asm/non_matchings/code/cutscene_camera/func_801629BC.s,func_801629BC,0x801629BC,0x25 +asm/non_matchings/code/cutscene_camera/func_80162A50.s,func_80162A50,0x80162A50,0x16A +asm/non_matchings/code/cutscene_camera/func_80162FF8.s,func_80162FF8,0x80162FF8,0x79 +asm/non_matchings/code/cutscene_camera/func_801631DC.s,func_801631DC,0x801631DC,0x56 +asm/non_matchings/code/cutscene_camera/func_80163334.s,func_80163334,0x80163334,0xCB +asm/non_matchings/code/cutscene_camera/func_80163660.s,func_80163660,0x80163660,0x28 asm/non_matchings/code/z_kaleido_manager/func_80163700.s,func_80163700,0x80163700,0x16 asm/non_matchings/code/z_kaleido_manager/func_80163758.s,func_80163758,0x80163758,0x17 asm/non_matchings/code/z_kaleido_manager/func_801637B4.s,func_801637B4,0x801637B4,0x14 @@ -3361,7 +3361,7 @@ asm/non_matchings/code/code_8019AF00/AudioOcarina_TerminaWallGenerateNotes.s,Aud asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameInit.s,AudioOcarina_MemoryGameInit,0x8019D488,0x1C asm/non_matchings/code/code_8019AF00/AudioOcarina_MemoryGameNextNote.s,AudioOcarina_MemoryGameNextNote,0x8019D4F8,0x42 asm/non_matchings/code/code_8019AF00/AudioOcarina_Update.s,AudioOcarina_Update,0x8019D600,0x56 -asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayLongScarecrowAfterCredits.s,AudioOcarina_PlayLongScarecrowAfterCredits,0x8019D758,0x43 +asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayLongScarecrowSong.s,AudioOcarina_PlayLongScarecrowSong,0x8019D758,0x43 asm/non_matchings/code/code_8019AF00/AudioOcarina_SetCustomSequence.s,AudioOcarina_SetCustomSequence,0x8019D864,0x14 asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayCustomSequence.s,AudioOcarina_PlayCustomSequence,0x8019D8B4,0xC asm/non_matchings/code/code_8019AF00/AudioOcarina_CreateCustomSequence.s,AudioOcarina_CreateCustomSequence,0x8019D8E4,0x191 diff --git a/tools/weekeventregconvert.py b/tools/weekeventregconvert.py index 071907058..34b3ddc46 100755 --- a/tools/weekeventregconvert.py +++ b/tools/weekeventregconvert.py @@ -165,7 +165,7 @@ weekEventReg = { (19 << 8) | 0x40: "WEEKEVENTREG_19_40", (19 << 8) | 0x80: "WEEKEVENTREG_19_80", (20 << 8) | 0x01: "WEEKEVENTREG_20_01", - (20 << 8) | 0x02: "WEEKEVENTREG_20_02", + (20 << 8) | 0x02: "WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE", (20 << 8) | 0x04: "WEEKEVENTREG_20_04", (20 << 8) | 0x08: "WEEKEVENTREG_20_08", (20 << 8) | 0x10: "WEEKEVENTREG_20_10", @@ -275,7 +275,7 @@ weekEventReg = { (33 << 8) | 0x10: "WEEKEVENTREG_33_10", (33 << 8) | 0x20: "WEEKEVENTREG_33_20", (33 << 8) | 0x40: "WEEKEVENTREG_33_40", - (33 << 8) | 0x80: "WEEKEVENTREG_33_80", + (33 << 8) | 0x80: "WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE", (34 << 8) | 0x01: "WEEKEVENTREG_34_01", (34 << 8) | 0x02: "WEEKEVENTREG_34_02", (34 << 8) | 0x04: "WEEKEVENTREG_34_04", @@ -425,7 +425,7 @@ weekEventReg = { (52 << 8) | 0x04: "WEEKEVENTREG_52_04", (52 << 8) | 0x08: "WEEKEVENTREG_52_08", (52 << 8) | 0x10: "WEEKEVENTREG_52_10", - (52 << 8) | 0x20: "WEEKEVENTREG_52_20", + (52 << 8) | 0x20: "WEEKEVENTREG_CLEARED_STONE_TOWER_TEMPLE", (52 << 8) | 0x40: "WEEKEVENTREG_52_40", (52 << 8) | 0x80: "WEEKEVENTREG_52_80", (53 << 8) | 0x01: "WEEKEVENTREG_53_01", @@ -451,7 +451,7 @@ weekEventReg = { (55 << 8) | 0x10: "WEEKEVENTREG_55_10", (55 << 8) | 0x20: "WEEKEVENTREG_55_20", (55 << 8) | 0x40: "WEEKEVENTREG_55_40", - (55 << 8) | 0x80: "WEEKEVENTREG_55_80", + (55 << 8) | 0x80: "WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE", (56 << 8) | 0x01: "WEEKEVENTREG_56_01", (56 << 8) | 0x02: "WEEKEVENTREG_56_02", (56 << 8) | 0x04: "WEEKEVENTREG_56_04", From 40846f3d3ac0f4f7cbc1b828b4f70a935f6aeacd Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Thu, 20 Apr 2023 14:39:08 -0700 Subject: [PATCH 28/29] Ensure all boss title cards are extracted as IA8 (#1230) --- assets/xml/objects/object_boss03.xml | 2 +- assets/xml/objects/object_boss07.xml | 6 +++--- assets/xml/objects/object_boss_hakugin.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/xml/objects/object_boss03.xml b/assets/xml/objects/object_boss03.xml index da17bf406..f4def4991 100644 --- a/assets/xml/objects/object_boss03.xml +++ b/assets/xml/objects/object_boss03.xml @@ -46,7 +46,7 @@ - + diff --git a/assets/xml/objects/object_boss07.xml b/assets/xml/objects/object_boss07.xml index b1f6cb417..ac2f9afc1 100644 --- a/assets/xml/objects/object_boss07.xml +++ b/assets/xml/objects/object_boss07.xml @@ -200,9 +200,9 @@ - - - + + + diff --git a/assets/xml/objects/object_boss_hakugin.xml b/assets/xml/objects/object_boss_hakugin.xml index ba04a3071..7c7232ecf 100644 --- a/assets/xml/objects/object_boss_hakugin.xml +++ b/assets/xml/objects/object_boss_hakugin.xml @@ -101,6 +101,6 @@ - + From 24454b2277713ece47510936ed84ffad715795c5 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sat, 22 Apr 2023 05:54:47 +1000 Subject: [PATCH 29/29] cs state cleanup (#1229) --- src/code/code_800E8EA0.c | 8 ++++---- src/code/z_parameter.c | 2 +- .../actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c | 2 +- src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c | 2 +- src/overlays/actors/ovl_Dm_Al/z_dm_al.c | 2 +- src/overlays/actors/ovl_Dm_An/z_dm_an.c | 2 +- src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c | 6 +++--- src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c | 4 ++-- src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c | 8 ++++---- src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c | 4 ++-- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c | 2 +- src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c | 2 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 16 ++++++++-------- src/overlays/actors/ovl_En_Dnk/z_en_dnk.c | 2 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 2 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 4 ++-- src/overlays/actors/ovl_En_Fall/z_en_fall.c | 4 ++-- src/overlays/actors/ovl_En_Gg/z_en_gg.c | 8 ++++---- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 5 +++-- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 ++-- src/overlays/actors/ovl_En_Hg/z_en_hg.c | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 2 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 2 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 2 +- src/overlays/actors/ovl_En_Pamera/z_en_pamera.c | 2 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 2 +- src/overlays/actors/ovl_En_Rg/z_en_rg.c | 2 +- .../actors/ovl_En_Weather_Tag/z_en_weather_tag.c | 2 +- .../actors/ovl_Obj_Hamishi/z_obj_hamishi.c | 2 +- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c | 4 ++-- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 2 +- .../actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c | 2 +- tools/namefixer.py | 1 + 37 files changed, 63 insertions(+), 61 deletions(-) diff --git a/src/code/code_800E8EA0.c b/src/code/code_800E8EA0.c index 93970cc6a..4ab38fcba 100644 --- a/src/code/code_800E8EA0.c +++ b/src/code/code_800E8EA0.c @@ -85,7 +85,7 @@ s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRo actor->focus.pos = actor->world.pos; actor->focus.pos.y += focusHeight; - if (!((play->csCtx.state != 0) || gDbgCamEnabled)) { + if (!((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled)) { yaw = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); if (yaw >= 0x4300) { Actor_TrackNone(headRot, torsoRot); @@ -93,7 +93,7 @@ s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRo } } - if ((play->csCtx.state != 0) || gDbgCamEnabled) { + if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { target = play->view.eye; } else { target = player->actor.focus.pos; @@ -127,7 +127,7 @@ s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* tors actor->focus.pos = focusPos; - if (!((play->csCtx.state != 0) || gDbgCamEnabled)) { + if (!((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled)) { yaw = ABS_ALT(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y)); if (yaw >= 0x4300) { Actor_TrackNone(headRot, torsoRot); @@ -135,7 +135,7 @@ s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* tors } } - if ((play->csCtx.state != 0) || gDbgCamEnabled) { + if ((play->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) { target = play->view.eye; } else { target = player->actor.focus.pos; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 88b8f14cc..41441f3a2 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4003,7 +4003,7 @@ void Interface_DrawItemButtons(PlayState* play) { } if (interfaceCtx->tatlCalling && (play->pauseCtx.state == PAUSE_STATE_OFF) && - (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->csCtx.state == 0) && + (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->csCtx.state == CS_STATE_IDLE) && (sPictoState == PICTO_BOX_STATE_OFF)) { if (sCUpInvisible == 0) { // C-Up Button Texture, Color & Label (Tatl Text) diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 1419c3466..cca6b17ee 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -131,7 +131,7 @@ void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, PlayState* play) { func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG); } - if ((play->csCtx.state != 0) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 4) && + if ((play->csCtx.state != CS_STATE_IDLE) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 4) && (play->csCtx.curFrame == 1495)) { func_8019F128(NA_SE_EV_DOOR_UNLOCK); } diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index b640b9ba4..12815a044 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -127,7 +127,7 @@ void func_80C1D7FC(DmAh* this, PlayState* play) { u16 cueId; s32 cueChannel; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (!this->unk_29C) { this->cueId = 255; this->unk_29C = true; diff --git a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c index d624f85ca..43ca006f2 100644 --- a/src/overlays/actors/ovl_Dm_Al/z_dm_al.c +++ b/src/overlays/actors/ovl_Dm_Al/z_dm_al.c @@ -51,7 +51,7 @@ void func_80C1BDD8(DmAl* this, PlayState* play) { u16 cueId; s32 cueChannel; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (!this->unk_45C) { this->cueId = 255; this->unk_45C = true; diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index a9276d13b..2d474d111 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -198,7 +198,7 @@ void func_80C1CAB0(DmAn* this, PlayState* play) { u16 cueId; s32 cueChannel; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (this->unk_2D0 == 0) { this->cueId = 255; this->unk_2D0 = 1; diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 210f2ad37..8657a9dc9 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -448,7 +448,7 @@ void func_80AA5E2C(DmChar00* this, PlayState* play) { } void func_80AA5EBC(DmChar00* this, PlayState* play) { - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { switch (play->sceneId) { case SCENE_LOST_WOODS: if (gSaveContext.sceneLayer == 1) { @@ -853,7 +853,7 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { void func_80AA67F8(DmChar00* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((play->csCtx.state == 0) && (gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 1)) { + if ((play->csCtx.state == CS_STATE_IDLE) && (gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 1)) { if (this->unk_261 != 42) { this->unk_261 = 42; func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); @@ -914,7 +914,7 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) { s32 pad; Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, 4 * sizeof(Gfx)); - if ((play->csCtx.state == 0) && + if ((play->csCtx.state == CS_STATE_IDLE) && ((play->sceneId != SCENE_OPENINGDAN) || (gSaveContext.sceneLayer != 0) || (play->roomCtx.curRoom.num != 0) || (play->csCtx.scriptIndex != 1) || (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { return; diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index 7841d22f5..ec1e12a8f 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -75,7 +75,7 @@ void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) } void DmChar02_PlaySfxForCutscenes(DmChar02* this, PlayState* play) { - if ((play->csCtx.state != 0) && (play->sceneId == SCENE_OKUJOU) && (play->csCtx.scriptIndex == 1)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->sceneId == SCENE_OKUJOU) && (play->csCtx.scriptIndex == 1)) { DmChar02_PlaySfxForDroppingOcarinaCutscene(this, play); } } @@ -172,7 +172,7 @@ void DmChar02_Draw(Actor* thisx, PlayState* play) { DmChar02* this = THIS; s32 shouldDraw = false; - if ((play->csCtx.state == 0) && (this->actor.world.pos.y < 100.0f)) { + if ((play->csCtx.state == CS_STATE_IDLE) && (this->actor.world.pos.y < 100.0f)) { shouldDraw = true; } else if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_107)) { switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_107)]->id) { diff --git a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c index 1b6d667c2..35611375b 100644 --- a/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c +++ b/src/overlays/actors/ovl_Dm_Char08/z_dm_char08.c @@ -341,13 +341,13 @@ void func_80AAFA18(DmChar08* this, PlayState* play) { } void func_80AAFAC4(DmChar08* this, PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = func_80AAF8F4; } } void func_80AAFAE4(DmChar08* this, PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actionFunc = func_80AAFB04; } } @@ -893,7 +893,7 @@ void func_80AB032C(DmChar08* this, PlayState* play) { } void func_80AB096C(DmChar08* this, PlayState* play) { - if ((play->csCtx.state != 0) && (play->sceneId == SCENE_31MISAKI) && (gSaveContext.sceneLayer == 0) && + if ((play->csCtx.state != CS_STATE_IDLE) && (play->sceneId == SCENE_31MISAKI) && (gSaveContext.sceneLayer == 0) && (play->csCtx.scriptIndex == 0)) { if ((play->csCtx.curFrame >= 890) && (play->csCtx.curFrame < 922)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); @@ -1002,7 +1002,7 @@ void DmChar08_Update(Actor* thisx, PlayState* play) { } s32 DmChar08_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { - if ((play->csCtx.state == 0) && (play->sceneId == SCENE_31MISAKI) && + if ((play->csCtx.state == CS_STATE_IDLE) && (play->sceneId == SCENE_31MISAKI) && (limbIndex == TURTLE_LIMB_FRONT_RIGHT_UPPER_FLIPPER)) { rot->z = -0x5E24; } diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c index 567b33685..93fa0e94c 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c @@ -202,7 +202,7 @@ void DmChar09_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); func_80AB2268(this, play); func_80AB24BC(this, play); - if ((play->csCtx.state != 0) && this->unk_22E && DMCHAR09_GET_100(thisx)) { + if ((play->csCtx.state != CS_STATE_IDLE) && this->unk_22E && DMCHAR09_GET_100(thisx)) { Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMAN_WALK + SFX_FLAG); } } @@ -217,7 +217,7 @@ s32 DmChar09_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f void DmChar09_Draw(Actor* thisx, PlayState* play) { DmChar09* this = THIS; - if ((play->csCtx.state != 0) && this->unk_22E) { + if ((play->csCtx.state != CS_STATE_IDLE) && this->unk_22E) { func_8012C28C(play->state.gfxCtx); func_8012C2DC(play->state.gfxCtx); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, DmChar09_OverrideLimbDraw, NULL, diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index f20c87cb4..2cdddbf19 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -198,7 +198,7 @@ void func_80C24A00(DmGm* this, PlayState* play) { u16 cueId; s32 cueChannel; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (this->unk_2D0 == 0) { this->cueId = 255; this->unk_2D0 = 1; diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index da2bd225a..c42ad3c2b 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -46,7 +46,7 @@ void func_80C1DF18(DmNb* this, PlayState* play) { u16 cueId; s32 cueChannel; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (this->unk1F8 == 0) { this->cueId = 255; this->unk1F8 = 1; diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 164d6ea53..9a9e14dbc 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -916,7 +916,7 @@ void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, PlayState* play) { * Handles sound effects for all cutscenes. */ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { switch (play->sceneId) { case SCENE_LOST_WOODS: if (gSaveContext.sceneLayer == 1) { @@ -1198,7 +1198,7 @@ void DmStk_ClockTower_StartIntroCutsceneVersion1(DmStk* this, PlayState* play) { } void DmStk_ClockTower_WaitForIntroCutsceneVersion1ToEnd(DmStk* this, PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { this->animIndex = SK_ANIM_CALL_DOWN_MOON_LOOP; this->handType = SK_HAND_TYPE_HOLDING_OCARINA; DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); @@ -1216,7 +1216,7 @@ void DmStk_ClockTower_StartIntroCutsceneVersion2(DmStk* this, PlayState* play) { } void DmStk_ClockTower_WaitForIntroCutsceneVersion2ToEnd(DmStk* this, PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; DmStk_ChangeAnim(this, play, &this->skelAnime, &sAnimationInfo[this->animIndex], 0); this->actionFunc = DmStk_ClockTower_Idle; @@ -1238,7 +1238,7 @@ void DmStk_ClockTower_StartDropOcarinaCutscene(DmStk* this, PlayState* play) { } void DmStk_ClockTower_WaitForDropOcarinaCutsceneToEnd(DmStk* this, PlayState* play) { - if ((play->csCtx.state != 0) && (play->csCtx.curFrame > 20)) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.curFrame > 20)) { this->actionFunc = DmStk_ClockTower_Idle; } } @@ -1714,7 +1714,7 @@ void DmStk_UpdateCollision(DmStk* this, PlayState* play) { void DmStk_ClockTower_IdleWithOcarina(DmStk* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { DmStk_ClockTower_AdjustHeightAndRotation(this, play); this->actor.flags |= ACTOR_FLAG_1; this->tatlMessageTimer++; @@ -1739,7 +1739,7 @@ void DmStk_ClockTower_IdleWithOcarina(DmStk* this, PlayState* play) { * If he is hit in this state, he will just deflect the attack. */ void DmStk_ClockTower_Idle(DmStk* this, PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { DmStk_ClockTower_AdjustHeightAndRotation(this, play); this->actor.flags |= ACTOR_FLAG_1; @@ -1804,7 +1804,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { break; case SK_DEKU_PIPES_CS_STATE_START: - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { this->dekuPipesCutsceneState = SK_DEKU_PIPES_CS_STATE_END; } break; @@ -1815,7 +1815,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && - (play->csCtx.state == 0)) { + (play->csCtx.state == CS_STATE_IDLE)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; if (R_TIME_SPEED != 0) { gSaveContext.save.time = diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index 427e206aa..7d59ebeec 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -447,7 +447,7 @@ void func_80A52074(EnDnk* this, PlayState* play) { } void func_80A52134(EnDnk* this, PlayState* play) { - if ((play->csCtx.state != 0) && (ENDNK_GET_3C(&this->actor) == 4) && (play->sceneId == SCENE_SPOT00) && + if ((play->csCtx.state != CS_STATE_IDLE) && (ENDNK_GET_3C(&this->actor) == 4) && (play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 2)) { func_80A52074(this, play); } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index dedbe30b4..fd1557e3f 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -265,7 +265,7 @@ s32 func_80B3CF60(EnDnp* this, PlayState* play) { s32 func_80B3D044(EnDnp* this, PlayState* play) { s32 ret = false; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (!(this->unk_322 & 0x200)) { this->unk_322 |= (0x200 | 0x10); this->actor.flags &= ~ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index ea5bd4e94..c328b02d6 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -121,7 +121,7 @@ void func_80A52604(EnDnq* this, PlayState* play) { s32 func_80A52648(EnDnq* this, PlayState* play) { s32 ret = false; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (!(this->unk_37C & 0x20)) { this->picto.actor.flags &= ~ACTOR_FLAG_1; this->cueId = 255; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 6837e5367..1f754f1d5 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -249,7 +249,7 @@ s32 func_8092CAD0(EnDns* this, PlayState* play) { s32 func_8092CB98(EnDns* this, PlayState* play) { s32 phi_v1 = 0; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (!(this->unk_2C6 & 0x80)) { this->cueType = EnDns_GetCueType(this); this->actor.flags &= ~ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index f70b60b57..615d59196 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1105,7 +1105,7 @@ void func_8088F214(EnElf* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_201)) { switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_201)]->id) { case 4: @@ -1526,7 +1526,7 @@ void func_8089010C(Actor* thisx, PlayState* play) { this->unk_269--; } - if (!this->unk_269 && (play->csCtx.state != 0)) { + if (!this->unk_269 && (play->csCtx.state != CS_STATE_IDLE)) { this->unk_269 = 1; } } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index 94087bfb1..a43d39c7c 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -318,7 +318,7 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 0)) { switch (sGiantsCutsceneState) { case 0: - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { sGiantsCutsceneState += 2; } break; @@ -452,7 +452,7 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat } void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { - if (play->csCtx.state != 0 && play->sceneId == SCENE_OKUJOU) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->sceneId == SCENE_OKUJOU)) { func_800B9010(&this->actor, NA_SE_EV_MOON_FALL - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_En_Gg/z_en_gg.c b/src/overlays/actors/ovl_En_Gg/z_en_gg.c index ed10fd51a..81d1c6bb6 100644 --- a/src/overlays/actors/ovl_En_Gg/z_en_gg.c +++ b/src/overlays/actors/ovl_En_Gg/z_en_gg.c @@ -226,7 +226,7 @@ void func_80B352A4(EnGg* this, PlayState* play) { } void func_80B35450(EnGg* this, PlayState* play) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_91_10) && (play->csCtx.state == 0)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_91_10) && (play->csCtx.state == CS_STATE_IDLE)) { func_80B359DC(this, play); } @@ -692,14 +692,14 @@ void EnGg_Update(Actor* thisx, PlayState* play) { } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_19_80)) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { this->actor.flags |= ACTOR_FLAG_1; } else { this->actor.flags &= ~ACTOR_FLAG_1; } } - if ((play->csCtx.state == 0) && + if ((play->csCtx.state == CS_STATE_IDLE) && ((this->unk_2DA != 14) && (this->unk_2DA != 11) && (this->unk_2DA != 12) && (this->unk_2DA != 13))) { func_80B364D4(&this->unk_344, play); } @@ -723,7 +723,7 @@ void EnGg_Update(Actor* thisx, PlayState* play) { Actor_MoveWithoutGravity(&this->actor); SkelAnime_Update(&this->skelAnime); - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { func_80B3584C(this); } else { this->unk_2E8 = 0; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 38e6ad976..40cf72a98 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -842,7 +842,7 @@ void func_80B51FD0(EnGk* this, PlayState* play) { void func_80B5202C(EnGk* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { func_80B51410(this, play); } @@ -860,7 +860,8 @@ void func_80B5202C(EnGk* this, PlayState* play) { } if (this->unk_1E4 & 2) { - if ((play->msgCtx.ocarinaMode != 1) && (play->msgCtx.ocarinaMode != 3) && (play->csCtx.state == 0)) { + if ((play->msgCtx.ocarinaMode != 1) && (play->msgCtx.ocarinaMode != 3) && + (play->csCtx.state == CS_STATE_IDLE)) { func_801A4748(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG); } } else { diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index b76ed7066..f31dd7cd2 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -761,7 +761,7 @@ s32 func_8094EE84(EnGm* this, PlayState* play) { s32 func_8094EFC4(EnGm* this, PlayState* play) { s32 ret = false; - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { if (this->unk_3F8 == 0) { if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.sceneLayer == 2)) { func_8094E054(this, play, 0); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 12a98228f..a0c7e3180 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -710,7 +710,7 @@ s32 func_80A12868(EnGo* this, PlayState* play) { } s32 func_80A12954(EnGo* this, PlayState* play) { - if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (play->csCtx.state != 0) && (this->actor.draw != NULL) && + if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (play->csCtx.state != CS_STATE_IDLE) && (this->actor.draw != NULL) && (play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneLayer == 1) && (play->csCtx.scriptIndex == 0)) { if (this->unk_3F0 == 0) { @@ -756,7 +756,7 @@ s32 func_80A12A64(EnGo* this, PlayState* play) { } s32 func_80A12B78(EnGo* this, PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { if (this->unk_3DC == 4) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE); diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index b5ad5fa40..34e1d1e15 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -365,7 +365,7 @@ void EnHg_HandleCsAction(EnHg* this, PlayState* play) { Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); return; - } else if (play->csCtx.state == 0) { + } else if (play->csCtx.state == CS_STATE_IDLE) { EnHg_SetupWait(this); } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index e2d4792ca..096b92fdd 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -220,7 +220,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { void EnHoll_TransparentIdle(EnHoll* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 useViewEye = gDbgCamEnabled || play->csCtx.state != 0; + s32 useViewEye = gDbgCamEnabled || (play->csCtx.state != CS_STATE_IDLE); Vec3f transformedPlayerPos; f32 enHollTop; f32 playerDistFromCentralPlane; diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 84ed7a605..254c9ad67 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -386,7 +386,7 @@ void EnIshi_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain[sp34]); - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index b858fc502..2af87ea90 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -366,7 +366,7 @@ void EnKusa_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } EnKusa_InitCollider(&this->actor, play); diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 616481d85..20f32028e 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -372,7 +372,7 @@ void func_80959C94(EnMk* this, PlayState* play) { void func_80959D28(EnMk* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((play->csCtx.state == 0) && (this->actor.csId == CS_ID_NONE)) { + if ((play->csCtx.state == CS_STATE_IDLE) && (this->actor.csId == CS_ID_NONE)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_40)) { this->unk_27A &= ~1; this->actionFunc = func_80959774; diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index a4158e2c7..dab8f591e 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -732,7 +732,7 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { this->setupFunc(this, play); return 1; } - if ((play->csCtx.state == 0) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20)) { + if ((play->csCtx.state == CS_STATE_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20)) { if ((this->actionFunc != func_80BD994C) && (this->actionFunc != EnPamera_HandleDialogue)) { this->actor.shape.rot.y = this->actor.world.rot.y; func_80BD9904(this); diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index d10f0884b..088d5c8a4 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -1019,7 +1019,7 @@ s32 func_80AF86F0(EnPm* this, PlayState* play) { s32 func_80AF87C4(EnPm* this, PlayState* play) { s32 ret = false; - if ((play->csCtx.state != 0) && (play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 9) && + if ((play->csCtx.state != CS_STATE_IDLE) && (play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 9) && (play->curSpawn == 1)) { if (!this->unk_380) { func_80AF7E98(this, 0); diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 79b861477..d552c5605 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -283,7 +283,7 @@ void func_80BF3FF8(EnRg* this) { } s32 func_80BF4024(EnRg* this, PlayState* play) { - if ((play->csCtx.state == 0) && (this->unk_334 == 1)) { + if ((play->csCtx.state == CS_STATE_IDLE) && (this->unk_334 == 1)) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE); } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index e81b5dabc..fb00fdae3 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -485,7 +485,7 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && - (play->csCtx.state == 0)) { + (play->csCtx.state == CS_STATE_IDLE)) { gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; if (R_TIME_SPEED != 0) { diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index 752b669cf..aef42693b 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -165,7 +165,7 @@ void ObjHamishi_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.uncullZoneForward += 1000.0f; } diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 7dd00abc3..3b933157b 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -689,7 +689,7 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { return; } - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.home.rot.x = 1; this->clockTime += 3; this->actor.draw = ObjTokeidai_Clock_Draw; @@ -722,7 +722,7 @@ void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, PlayState* play) { if (ObjTokeidai_IsPostFirstCycleFinalHours(this, play)) { this->actor.draw = ObjTokeidai_ExteriorGear_Draw; } else { - if (play->csCtx.state != 0) { + if (play->csCtx.state != CS_STATE_IDLE) { this->actor.home.rot.x = 1; this->clockTime += 3; this->actor.draw = ObjTokeidai_ExteriorGear_Draw; diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index f80c44751..a924c9e06 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -1402,7 +1402,7 @@ void func_80B7A860(ObjUm* this, PlayState* play) { func_80B78DF0(this, play); } - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { CutsceneManager_Stop(this->dyna.actor.csId); ObjUm_SetupAction(this, func_80B7A7AC); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index 7915551c2..93caeb33d 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -80,7 +80,7 @@ void OceffWipe5_Draw(Actor* thisx, PlayState* play) { if ((((OCEFF_WIPE5_GET_SONG_TYPE(thisx) == 2) && (play->sceneId == SCENE_LABO)) && ((play->csCtx.scriptIndex == 0) || (play->csCtx.scriptIndex == 1))) && - (play->csCtx.state != 0)) { + (play->csCtx.state != CS_STATE_IDLE)) { phi_fv1 = 1150.0f; } diff --git a/tools/namefixer.py b/tools/namefixer.py index d5493bbfc..3d77dba9c 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -1027,6 +1027,7 @@ wordReplace = { "COLPOLY_SURFACE_GROUND": "SURFACE_MATERIAL_DIRT", "COLPOLY_SURFACE_SAND": "SURFACE_MATERIAL_SAND", "COLPOLY_SURFACE_SNOW": "SURFACE_MATERIAL_SNOW", + "CS_STATE_0": "CS_STATE_IDLE", # Example of custom behaviour: # "PLAYER": ("GET_PLAYER(play)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames