diff --git a/assets/xml/misc/link_animetion.xml b/assets/xml/misc/link_animetion.xml
new file mode 100644
index 000000000..788e0a49d
--- /dev/null
+++ b/assets/xml/misc/link_animetion.xml
@@ -0,0 +1,699 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/gameplay_dangeon_keep.xml b/assets/xml/objects/gameplay_dangeon_keep.xml
index 7e4d2d201..e9acb308b 100644
--- a/assets/xml/objects/gameplay_dangeon_keep.xml
+++ b/assets/xml/objects/gameplay_dangeon_keep.xml
@@ -1,10 +1,10 @@

-
-
-
-
-
+
+
+
+
+
diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml
index 4f1ad1841..03ed9eef5 100644
--- a/assets/xml/objects/gameplay_keep.xml
+++ b/assets/xml/objects/gameplay_keep.xml
@@ -1,4 +1,5 @@

+
@@ -845,17 +846,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -905,7 +906,7 @@
-
+
@@ -1075,17 +1076,17 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1182,7 +1183,7 @@
-
+
@@ -1217,37 +1218,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1256,10 +1264,12 @@
-
-
-
-
+
+
+
+
+
+
@@ -1347,10 +1357,13 @@
-
-
-
-
+
+
+
+
+
+
+
@@ -1427,14 +1440,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_az.xml b/assets/xml/objects/object_az.xml
index 81207b06b..ea6fd5e7d 100644
--- a/assets/xml/objects/object_az.xml
+++ b/assets/xml/objects/object_az.xml
@@ -1,145 +1,169 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_bdoor.xml b/assets/xml/objects/object_bdoor.xml
index a57339f3b..2e64110f5 100644
--- a/assets/xml/objects/object_bdoor.xml
+++ b/assets/xml/objects/object_bdoor.xml
@@ -1,18 +1,31 @@

+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_cne.xml b/assets/xml/objects/object_cne.xml
index a4c8b28e2..135aae7a2 100644
--- a/assets/xml/objects/object_cne.xml
+++ b/assets/xml/objects/object_cne.xml
@@ -38,12 +38,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_dblue_object.xml b/assets/xml/objects/object_dblue_object.xml
index d49b368e1..8611c539b 100644
--- a/assets/xml/objects/object_dblue_object.xml
+++ b/assets/xml/objects/object_dblue_object.xml
@@ -1,78 +1,148 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_dodongo.xml b/assets/xml/objects/object_dodongo.xml
index df70802d0..8de3f4653 100644
--- a/assets/xml/objects/object_dodongo.xml
+++ b/assets/xml/objects/object_dodongo.xml
@@ -62,7 +62,13 @@
-
-
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_fbdemo_triforce.xml b/assets/xml/objects/object_fbdemo_triforce.xml
new file mode 100644
index 000000000..a00c9bf13
--- /dev/null
+++ b/assets/xml/objects/object_fbdemo_triforce.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_gs.xml b/assets/xml/objects/object_gs.xml
index 1e9b159df..eebe60035 100644
--- a/assets/xml/objects/object_gs.xml
+++ b/assets/xml/objects/object_gs.xml
@@ -1,8 +1,9 @@

+
-
-
-
-
+
+
+
+
diff --git a/assets/xml/objects/object_inibs_object.xml b/assets/xml/objects/object_inibs_object.xml
index e1d454ae7..db78735fb 100644
--- a/assets/xml/objects/object_inibs_object.xml
+++ b/assets/xml/objects/object_inibs_object.xml
@@ -1,35 +1,43 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_lotus.xml b/assets/xml/objects/object_lotus.xml
index a9835b81b..b9f40033c 100644
--- a/assets/xml/objects/object_lotus.xml
+++ b/assets/xml/objects/object_lotus.xml
@@ -1,8 +1,9 @@

+
-
-
-
-
+
+
+
+
diff --git a/assets/xml/objects/object_market_obj.xml b/assets/xml/objects/object_market_obj.xml
index 81ab838f1..8ad9436cc 100644
--- a/assets/xml/objects/object_market_obj.xml
+++ b/assets/xml/objects/object_market_obj.xml
@@ -1,65 +1,69 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_mtoride.xml b/assets/xml/objects/object_mtoride.xml
index a79547730..145fcd33f 100644
--- a/assets/xml/objects/object_mtoride.xml
+++ b/assets/xml/objects/object_mtoride.xml
@@ -1,49 +1,71 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_trt.xml b/assets/xml/objects/object_trt.xml
index c7fb81321..826aa1ef0 100644
--- a/assets/xml/objects/object_trt.xml
+++ b/assets/xml/objects/object_trt.xml
@@ -1,94 +1,106 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_warp1.xml b/assets/xml/objects/object_warp1.xml
index 6ac25e827..0f6fe168b 100644
--- a/assets/xml/objects/object_warp1.xml
+++ b/assets/xml/objects/object_warp1.xml
@@ -1,59 +1,79 @@

+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/overlays/ovl_Dm_Char01.xml b/assets/xml/overlays/ovl_Dm_Char01.xml
index 3f855c376..2aa05fcb6 100644
--- a/assets/xml/overlays/ovl_Dm_Char01.xml
+++ b/assets/xml/overlays/ovl_Dm_Char01.xml
@@ -1,6 +1,7 @@
+
-
+
diff --git a/include/functions.h b/include/functions.h
index 19c0f6ece..83056ff1a 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -200,7 +200,7 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags);
OSIntMask osSetIntMask(OSIntMask im);
// OSIntMask osGetIntMask(void);
// void osVoiceSetWord(void);
-// void guScale(void);
+void guScale(Mtx* mtx, f32 x, f32 y, f32 z);
f32 sinf(f32 __x);
s16 sins(u16 x);
OSTask* _VirtualToPhysicalTask(OSTask* intp);
@@ -383,7 +383,7 @@ u32 osAiGetLength(void);
s32 osEPiWriteIo(OSPiHandle* pihandle, u32 devAddr, u32 data);
void osMapTLBRdb(void);
void osYieldThread(void);
-// void guTranslate(void);
+void guTranslate(Mtx* mtx, f32 x, f32 y, f32 z);
u32 __osGetCause(void);
s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force);
s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data);
@@ -539,7 +539,7 @@ void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* arg1, Vec3f* arg2
void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel);
// void EffectSsGSpk_SpawnRandColor(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7);
// void EffectSsGSpk_SpawnSmall(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 EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s16 life, s32 arg9);
+void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 alphaStep, s16 fadeDelay, s32 life);
void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale);
void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life);
void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 scale);
@@ -1935,12 +1935,6 @@ 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 PreNMI_Stop(PreNMIContext* prenmiCtx);
-void PreNMI_Update(PreNMIContext* prenmiCtx);
-void PreNMI_Draw(PreNMIContext* prenmiCtx);
-void PreNMI_Main(PreNMIContext* prenmiCtx);
-void PreNMI_Destroy(PreNMIContext* prenmiCtx);
-void PreNMI_Init(PreNMIContext* prenmiCtx);
f32 Quake_Random(void);
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPertubation, f32 horizontalPertubation);
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake);
@@ -2519,7 +2513,7 @@ void func_80168DAC(PlayState* play);
void Play_Main(PlayState* play);
s32 Play_InCsMode(PlayState* play);
f32 func_80169100(PlayState* play, MtxF* mtx, CollisionPoly** arg2, s32* arg3, Vec3f* feetPosPtr);
-// void func_801691F0(void);
+void func_801691F0(PlayState* play, MtxF* mtx, Vec3f* arg2);
void* Play_LoadScene(PlayState* play, RomFile* entry);
void func_8016927C(PlayState* play, s16 sParm2);
// void func_801692C4(PlayState* play, UNK_TYPE1 uParm2);
@@ -2631,10 +2625,7 @@ void AudioMgr_HandlePRENMI(AudioMgr* audioMgr);
void AudioMgr_ThreadEntry(void* arg);
void AudioMgr_Unlock(AudioMgr* audioMgr);
void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr);
-void TitleSetup_GameStateResetContext(void);
-void TitleSetup_InitImpl(GameState* gameState);
-void TitleSetup_Destroy(GameState* gameState);
-void TitleSetup_Init(GameState* gameState);
+
void Game_UpdateFramerateVariables(s32 divisor);
void Game_SetFramerateDivisor(GameState* gameState, s32 divisor);
void GameState_SetFBFilter(Gfx** gfx, u32 arg1);
@@ -2649,8 +2640,8 @@ void GameState_InitArena(GameState* gameState, size_t size);
void GameState_Realloc(GameState* gameState, size_t size);
void GameState_Init(GameState* gameState, GameStateFunc gameStateInit, GraphicsContext* gfxCtx);
void GameState_Destroy(GameState* gameState);
-GameStateFunc GameState_GetNextStateInit(GameState* gameState);
-size_t GameState_GetNextStateSize(GameState* gameState);
+GameStateFunc GameState_GetInit(GameState* gameState);
+size_t GameState_GetSize(GameState* gameState);
u32 GameState_IsRunning(GameState* gameState);
s32 GameState_GetArenaSize(GameState* gameState);
s32 func_80173B48(GameState* gameState);
@@ -3004,8 +2995,8 @@ void* AudioHeap_AllocAttemptExternal(AudioAllocPool* pool, size_t size);
void* AudioHeap_AllocDmaMemory(AudioAllocPool* pool, size_t size);
void* AudioHeap_AllocZeroed(AudioAllocPool* pool, size_t size);
void* AudioHeap_Alloc(AudioAllocPool* pool, size_t size);
-void AudioHeap_AllocPoolInit(AudioAllocPool* pool, void* addr, size_t size);
-void AudioHeap_PopCache(s32 tableType);
+void AudioHeap_InitPool(AudioAllocPool* pool, void* addr, size_t size);
+void AudioHeap_PopPersistentCache(s32 tableType);
void AudioHeap_InitMainPool(size_t initPoolSize);
void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id);
void* AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id);
@@ -3090,10 +3081,10 @@ s32 osAiSetNextBuffer(void* buf, u32 size);
void AudioPlayback_NoteDisable(Note* note);
void AudioPlayback_ProcessNotes(void);
-SoundFontSound* AudioPlayback_InstrumentGetSound(Instrument* instrument, s32 semitone);
+TunedSample* AudioPlayback_GetInstrumentTunedSample(Instrument* instrument, s32 semitone);
Instrument* AudioPlayback_GetInstrumentInner(s32 fontId, s32 instId);
Drum* AudioPlayback_GetDrum(s32 fontId, s32 drumId);
-SoundFontSound* AudioPlayback_GetSfx(s32 fontId, s32 sfxId);
+SoundEffect* AudioPlayback_GetSoundEffect(s32 fontId, s32 sfxId);
s32 AudioPlayback_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* value);
void AudioPlayback_SeqLayerNoteDecay(SequenceLayer* layer);
void AudioPlayback_SeqLayerNoteRelease(SequenceLayer* layer);
diff --git a/include/macros.h b/include/macros.h
index 996be52ca..ad963153f 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -24,9 +24,20 @@
#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId])
-#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
- (curState)->nextGameStateInit = (GameStateFunc)newInit; \
- (curState)->nextGameStateSize = sizeof(newStruct)
+#define STOP_GAMESTATE(curState) \
+ do { \
+ GameState* state = curState; \
+ \
+ state->running = false; \
+ } while(0)
+
+#define SET_NEXT_GAMESTATE(curState, nextInit, nextSize) \
+ do { \
+ GameState* state = curState; \
+ \
+ (state)->init = nextInit; \
+ (state)->size = nextSize; \
+ } while (0)
#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].first)
diff --git a/include/variables.h b/include/variables.h
index 8ac490b9c..09bbcfba4 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -362,8 +362,6 @@ extern ActorInit En_A_Obj_InitVars;
extern ColliderCylinderInit enAObjCylinderInit;
extern InitChainEntry enAObjInitVar;
extern Gfx* enAObjDisplayLists[2];
-extern UNK_PTR D_801ADF30[5];
-extern UNK_PTR D_801ADF44[12];
extern u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
extern u8 sDropTableAmounts[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];
extern s32 D_801AE194[32];
@@ -2968,7 +2966,7 @@ extern f64 D_801E0EB0;
// extern UNK_TYPE4 D_801E1068;
extern UNK_PTR D_801E10B0;
extern const s16 gAudioTatumInit[];
-extern const AudioContextInitSizes gAudioContextInitSizes;
+extern const AudioHeapInitSizes gAudioHeapInitSizes;
// extern UNK_TYPE4 D_801E1108;
// extern UNK_TYPE4 D_801E110C;
extern u8 gSoundFontTable[];
@@ -3489,7 +3487,7 @@ extern ActiveSfx gActiveSfx[7][3];
extern AudioContext gAudioContext; // at 0x80200C70
extern void (*D_80208E68)(void);
extern u32 (*D_80208E6C)(s8 value, SequenceChannel* channel);
-extern s32 (*D_80208E70)(SoundFontSample*, s32, s8, s32);
+extern s32 (*D_80208E70)(Sample*, s32, s8, s32);
extern Acmd* (*D_80208E74)(Acmd*, s32, s32);
// post-code buffers
diff --git a/include/z64.h b/include/z64.h
index 3a79b368b..ff4c41152 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -469,8 +469,8 @@ typedef struct {
/* 0x290 */ f32 unk_290;
/* 0x294 */ f32 unk_294;
/* 0x298 */ f32 unk_298;
- /* 0x29C */ s16 unk_29C;
- /* 0x29E */ s16 unk_29E;
+ /* 0x29C */ s16 promptChoice; // save/continue choice: 0 = yes; 4 = no
+ /* 0x29E */ s16 promptAlpha;
/* 0x2A0 */ s16 unk_2A0;
/* 0x2A2 */ u8 worldMapPoints[20];
/* 0x2B6 */ u8 unk_2B6;
@@ -928,8 +928,8 @@ typedef struct GameState {
/* 0x00 */ GraphicsContext* gfxCtx;
/* 0x04 */ GameStateFunc main;
/* 0x08 */ GameStateFunc destroy;
- /* 0x0C */ GameStateFunc nextGameStateInit;
- /* 0x10 */ size_t nextGameStateSize;
+ /* 0x0C */ GameStateFunc init; // Usually the current game state's init, though after stopping, the graph thread will look here to determine the next game state to load.
+ /* 0x10 */ size_t size;
/* 0x14 */ Input input[4];
/* 0x74 */ TwoHeadArena heap;
/* 0x84 */ GameAlloc alloc;
@@ -941,12 +941,6 @@ typedef struct GameState {
/* 0xA3 */ u8 unk_A3;
} GameState; // size = 0xA4
-typedef struct PreNMIContext {
- /* 0x00 */ GameState state;
- /* 0xA4 */ u32 timer;
- /* 0xA8 */ UNK_TYPE4 unkA8;
-} PreNMIContext; // size = 0xAC
-
typedef struct {
/* 0x00 */ u32 resetting;
/* 0x04 */ u32 resetCount;
diff --git a/include/z64actor.h b/include/z64actor.h
index 925a9975f..b11078316 100644
--- a/include/z64actor.h
+++ b/include/z64actor.h
@@ -307,6 +307,16 @@ typedef enum {
/* 0x0C */ ACTORCAT_MAX
} ActorType;
+#define ACTORCTX_FLAG_0 (1 << 0)
+#define ACTORCTX_FLAG_1 (1 << 1)
+#define ACTORCTX_FLAG_2 (1 << 2)
+#define ACTORCTX_FLAG_3 (1 << 3)
+#define ACTORCTX_FLAG_4 (1 << 4)
+#define ACTORCTX_FLAG_5 (1 << 5)
+#define ACTORCTX_FLAG_6 (1 << 6)
+#define ACTORCTX_FLAG_7 (1 << 7)
+
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ f32 unkC;
@@ -351,13 +361,13 @@ typedef struct ActorContext_unk_20C {
/* 0x4 */ void* ptr;
} ActorContext_unk_20C; // size = 0x8
-typedef struct ActorContextFlags {
+typedef struct ActorContextSceneFlags {
/* 0x00 */ u32 switches[4]; // First 0x40 are permanent, second 0x40 are temporary
/* 0x10 */ u32 chest;
/* 0x14 */ u32 clearedRoom;
/* 0x18 */ u32 clearedRoomTemp;
/* 0x1C */ u32 collectible[4]; // bitfield of 128 bits
-} ActorContextFlags; // size = 0x2C
+} ActorContextSceneFlags; // size = 0x2C
typedef struct ActorListEntry {
/* 0x0 */ s32 length; // number of actors loaded of this type
@@ -374,7 +384,7 @@ typedef struct ActorContext {
/* 0x002 */ u8 unk2;
/* 0x003 */ u8 lensActive;
/* 0x004 */ s8 lensMaskSize; // The size of the circle when drawn the lens mask. Larger value leads to a smaller circle
- /* 0x005 */ u8 unk5;
+ /* 0x005 */ u8 flags;
/* 0x006 */ UNK_TYPE1 pad6[0x5];
/* 0x00B */ s8 lensActorsDrawn;
/* 0x00C */ s16 unkC;
@@ -383,7 +393,7 @@ typedef struct ActorContext {
/* 0x010 */ ActorListEntry actorLists[ACTORCAT_MAX];
/* 0x0A0 */ Actor* undrawnActors[32]; // Records the first 32 actors drawn each frame
/* 0x120 */ TargetContext targetContext;
- /* 0x1B8 */ ActorContextFlags flags;
+ /* 0x1B8 */ ActorContextSceneFlags sceneFlags;
/* 0x1E4 */ TitleCardContext titleCtxt;
/* 0x1F4 */ u8 unk1F4;
/* 0x1F5 */ u8 unk1F5;
diff --git a/include/z64audio.h b/include/z64audio.h
index 4095251ca..fc9bf9f4c 100644
--- a/include/z64audio.h
+++ b/include/z64audio.h
@@ -10,6 +10,12 @@
#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((uintptr_t)(ptr) != (uintptr_t)&gAudioContext.sequenceChannelNone)
#define SEQ_NUM_CHANNELS 16
+typedef enum {
+ /* 0 */ SEQPLAYER_STATE_0,
+ /* 1 */ SEQPLAYER_STATE_1, // Fading in
+ /* 2 */ SEQPLAYER_STATE_2 // Fading out
+} SeqPlayerState;
+
#define MAX_CHANNELS_PER_BANK 3
#define MUTE_FLAGS_3 (1 << 3) // prevent further noteSubEus from playing
@@ -27,6 +33,21 @@
#define AIBUF_LEN 0x580
+// Must be the same amount of samples as copied by aDuplicate() (audio microcode)
+#define WAVE_SAMPLE_COUNT 64
+
+#define AUDIO_RELOCATED_ADDRESS_START K0BASE
+
+typedef enum {
+ /* 0x1 */ AUDIO_ERROR_NO_INST = 1,
+ /* 0x3 */ AUDIO_ERROR_INVALID_INST_ID = 3,
+ /* 0x4 */ AUDIO_ERROR_INVALID_DRUM_SFX_ID,
+ /* 0x5 */ AUDIO_ERROR_NO_DRUM_SFX,
+ /* 0x10 */ AUDIO_ERROR_FONT_NOT_LOADED = 0x10
+} AudioError;
+
+#define AUDIO_ERROR(fontId, id, err) (((fontId << 8) + id) + (err << 24))
+
typedef enum {
/* 0 */ SOUNDMODE_STEREO,
/* 1 */ SOUNDMODE_HEADSET,
@@ -157,20 +178,20 @@ typedef struct {
typedef struct {
/* 0x00 */ u32 unk_0 : 1;
- /* 0x00 */ u32 codec : 3;
- /* 0x00 */ u32 medium : 2;
- /* 0x00 */ u32 unk_bit26 : 1;
- /* 0x00 */ u32 unk_bit25 : 1;
- /* 0x01 */ u32 size : 24;
- /* 0x04 */ u8* sampleAddr;
- /* 0x08 */ AdpcmLoop* loop;
- /* 0x0C */ AdpcmBook* book;
-} SoundFontSample; // size = 0x10
+ /* 0x00 */ u32 codec : 3; // The state of compression or decompression
+ /* 0x00 */ u32 medium : 2; // Medium where sample is currently stored
+ /* 0x00 */ u32 unk_bit26 : 1; // Has the sample header been relocated (offsets to pointers)
+ /* 0x00 */ u32 isRelocated : 1; // Size of the sample
+ /* 0x01 */ u32 size : 24; // Size of the sample
+ /* 0x04 */ u8* sampleAddr; // Raw sample data. Offset from the start of the sample bank or absolute address to either rom or ram
+ /* 0x08 */ AdpcmLoop* loop; // Adpcm loop parameters used by the sample. Offset from the start of the sound font / pointer to ram
+ /* 0x0C */ AdpcmBook* book; // Adpcm book parameters used by the sample. Offset from the start of the sound font / pointer to ram
+} Sample; // size = 0x10
typedef struct {
- /* 0x00 */ SoundFontSample* sample;
+ /* 0x00 */ Sample* sample;
/* 0x04 */ f32 tuning; // frequency scale factor
-} SoundFontSound; // size = 0x8
+} TunedSample; // size = 0x8
typedef struct {
/* 0x00 */ s16 numSamplesAfterDownsampling; // never read
@@ -222,29 +243,33 @@ typedef struct {
/* 0x27C */ s16* unk_27C;
/* 0x280 */ s16* filterLeftState;
/* 0x284 */ s16* filterRightState;
- /* 0x288 */ SoundFontSound sound;
- /* 0x290 */ SoundFontSample sample;
+ /* 0x288 */ TunedSample tunedSample;
+ /* 0x290 */ Sample sample;
/* 0x2A0 */ AdpcmLoop loop;
} SynthesisReverb; // size = 0x2D0
typedef struct {
- /* 0x00 */ u8 loaded;
+ /* 0x00 */ u8 isRelocated; // have the envelope and all samples been relocated (offsets to pointers)
/* 0x01 */ u8 normalRangeLo;
/* 0x02 */ u8 normalRangeHi;
/* 0x03 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
/* 0x04 */ EnvelopePoint* envelope;
- /* 0x08 */ SoundFontSound lowNotesSound;
- /* 0x10 */ SoundFontSound normalNotesSound;
- /* 0x18 */ SoundFontSound highNotesSound;
+ /* 0x08 */ TunedSample lowPitchTunedSample;
+ /* 0x10 */ TunedSample normalPitchTunedSample;
+ /* 0x18 */ TunedSample highPitchTunedSample;
} Instrument; // size = 0x20
typedef struct {
/* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
/* 0x01 */ u8 pan;
- /* 0x02 */ u8 loaded;
- /* 0x04 */ SoundFontSound sound;
- /* 0x14 */ EnvelopePoint* envelope;
-} Drum; // size = 0x18
+ /* 0x02 */ u8 isRelocated; // have tunedSample.sample and envelope been relocated (offsets to pointers)
+ /* 0x04 */ TunedSample tunedSample;
+ /* 0x0C */ EnvelopePoint* envelope;
+} Drum; // size = 0x10
+
+typedef struct {
+ /* 0x00 */ TunedSample tunedSample;
+} SoundEffect; // size = 0x08
typedef struct {
/* 0x00 */ u8 numInstruments;
@@ -254,7 +279,7 @@ typedef struct {
/* 0x04 */ u16 numSfx;
/* 0x08 */ Instrument** instruments;
/* 0x0C */ Drum** drums;
- /* 0x10 */ SoundFontSound* soundEffects;
+ /* 0x10 */ SoundEffect* soundEffects;
} SoundFont; // size = 0x14
typedef struct {
@@ -290,10 +315,7 @@ typedef struct {
/* 0x012 */ u16 fadeTimer;
/* 0x014 */ u16 fadeTimerUnkEu;
/* 0x016 */ u16 unk_16;
- union {
- /* 0x018 */ u8* seqData;
- /* 0x018 */ u16* seqData16;
- };
+ /* 0x018 */ u8* seqData;
/* 0x01C */ f32 fadeVolume;
/* 0x020 */ f32 fadeVelocity;
/* 0x024 */ f32 volume;
@@ -437,7 +459,7 @@ typedef struct SequenceChannel {
/* 0xD0 */ u8* sfxState; // SfxChannelState
/* 0xD4 */ s16* filter;
/* 0xD8 */ Stereo stereo;
- /* 0xDC */ s32 unk_DC;
+ /* 0xDC */ s32 startSamplePos;
/* 0xE0 */ s32 unk_E0;
} SequenceChannel; // size = 0xE4
@@ -501,7 +523,7 @@ typedef struct SequenceLayer {
/* 0x50 */ f32 noteVelocity;
/* 0x54 */ f32 noteFreqScale;
/* 0x58 */ Instrument* instrument;
- /* 0x5C */ SoundFontSound* sound;
+ /* 0x5C */ TunedSample* tunedSample;
/* 0x60 */ SequenceChannel* channel; // Not SequenceChannel?
/* 0x64 */ SeqScriptState scriptState;
/* 0x80 */ AudioListItem listItem;
@@ -557,12 +579,18 @@ typedef struct {
/* 0x1A */ u16 delay;
} VibratoState; // size = 0x1C
+typedef enum {
+ /* 0 */ PLAYBACK_STATUS_0,
+ /* 1 */ PLAYBACK_STATUS_1,
+ /* 2 */ PLAYBACK_STATUS_2
+} NotePlaybackStatus;
+
typedef struct {
/* 0x00 */ u8 priority;
/* 0x01 */ u8 waveId;
- /* 0x02 */ u8 sampleCountIndex;
+ /* 0x02 */ u8 harmonicIndex; // the harmonic index for the synthetic wave contained in gWaveSamples (also matches the base 2 logarithm of the harmonic order)
/* 0x03 */ u8 fontId;
- /* 0x04 */ u8 unk_04;
+ /* 0x04 */ u8 status;
/* 0x05 */ u8 stereoHeadsetEffects;
/* 0x06 */ s16 adsrVolScaleUnused;
/* 0x08 */ f32 portamentoFreqScale;
@@ -575,7 +603,7 @@ typedef struct {
/* 0x54 */ Portamento portamento;
/* 0x60 */ VibratoState vibratoState;
/* 0x7C */ char unk_7C[0x8];
- /* 0x84 */ u32 unk_84;
+ /* 0x84 */ u32 startSamplePos;
} NotePlaybackState; // size = 0x88
typedef struct {
@@ -600,16 +628,16 @@ typedef struct {
/* 0x03 */ u8 headsetPanRight;
/* 0x04 */ u8 headsetPanLeft;
/* 0x05 */ u8 reverbVol;
- /* 0x06 */ u8 unk_06;
+ /* 0x06 */ u8 harmonicIndexCurAndPrev; // bits 3..2 store curHarmonicIndex, bits 1..0 store prevHarmonicIndex
/* 0x07 */ u8 unk_07;
/* 0x08 */ u16 targetVolLeft;
/* 0x0A */ u16 targetVolRight;
/* 0x0C */ u16 resamplingRateFixedPoint;
/* 0x0E */ u16 unk_0E;
- union {
- /* 0x10 */ SoundFontSound* soundFontSound;
- /* 0x10 */ s16* samples; // used for synthetic waves
- } sound;
+ union {
+ /* 0x10 */ TunedSample* tunedSample;
+ /* 0x10 */ s16* waveSampleAddr; // used for synthetic waves
+ };
/* 0x14 */ s16* filter;
/* 0x18 */ u8 unk_18;
/* 0x19 */ u8 unk_19;
@@ -640,7 +668,7 @@ typedef struct {
} ReverbSettings; // size = 0x18
/**
- * The high-level audio specifications requested when initializing or resetting the audio heap.
+ * The high-level audio specifications requested when initializing or resetting the audio pool.
* Most often resets during scene transitions, but will highly depend on game play.
*/
typedef struct {
@@ -648,7 +676,8 @@ typedef struct {
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 numNotes;
/* 0x06 */ u8 numSequencePlayers;
- /* 0x07 */ u8 unk_07[0x2]; // unused, set to zero
+ /* 0x07 */ u8 unk_07; // unused, set to zero
+ /* 0x08 */ u8 unk_08; // unused, set to zero
/* 0x09 */ u8 numReverbs;
/* 0x0C */ ReverbSettings* reverbSettings;
/* 0x10 */ u16 sampleDmaBufSize1;
@@ -675,17 +704,17 @@ typedef struct {
/* 0x02 */ u16 samplingFreq; // Target sampling rate in Hz
/* 0x04 */ u16 aiSamplingFreq; // True sampling rate set to the audio interface (AI) for the audio digital-analog converter (DAC)
/* 0x06 */ s16 samplesPerFrameTarget;
- /* 0x08 */ s16 maxAiBufferLength;
- /* 0x0A */ s16 minAiBufferLength;
- /* 0x0C */ s16 updatesPerFrame;
+ /* 0x08 */ s16 maxAiBufNumSamples;
+ /* 0x0A */ s16 minAiBufNumSamples;
+ /* 0x0C */ s16 updatesPerFrame; // for each frame of the audio thread (default 60 fps), number of updates to process audio
/* 0x0E */ s16 samplesPerUpdate;
/* 0x10 */ s16 samplesPerUpdateMax;
/* 0x12 */ s16 samplesPerUpdateMin;
/* 0x14 */ s16 numSequencePlayers;
/* 0x18 */ f32 resampleRate;
- /* 0x1C */ f32 updatesPerFrameInv;
- /* 0x20 */ f32 unkUpdatesPerFrameScaled;
- /* 0x24 */ f32 unk_24;
+ /* 0x1C */ f32 updatesPerFrameInv; // inverse (reciprocal) of updatesPerFrame
+ /* 0x20 */ f32 updatesPerFrameInvScaled; // updatesPerFrameInv scaled down by a factor of 256
+ /* 0x24 */ f32 updatesPerFrameScaled; // updatesPerFrame scaled down by a factor of 4
} AudioBufferParameters; // size = 0x28
/**
@@ -767,7 +796,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u32 endAndMediumKey;
- /* 0x04 */ SoundFontSample* sample;
+ /* 0x04 */ Sample* sample;
/* 0x08 */ u8* ramAddr;
/* 0x0C */ u32 encodedInfo;
/* 0x10 */ s32 isFree;
@@ -822,7 +851,7 @@ typedef struct {
/* 0x14 */ s32 status;
/* 0x18 */ size_t bytesRemaining;
/* 0x1C */ s8* isDone; // TODO: rename in OoT and sync up here. This is an external status while (s32 status) is an internal status
- /* 0x20 */ SoundFontSample sample;
+ /* 0x20 */ Sample sample;
/* 0x30 */ OSMesgQueue msgqueue;
/* 0x48 */ OSMesg msg;
/* 0x4C */ OSIoMesg ioMesg;
@@ -873,7 +902,7 @@ typedef struct {
/* 0x0014 */ NoteSubEu* noteSubsEu;
/* 0x0018 */ SynthesisReverb synthesisReverbs[4];
/* 0x0B58 */ char unk_0B58[0x30];
- /* 0x0B88 */ SoundFontSample* usedSamples[128];
+ /* 0x0B88 */ Sample* usedSamples[128];
/* 0x0D88 */ AudioPreloadReq preloadSampleStack[128];
/* 0x1788 */ s32 numUsedSamples;
/* 0x178C */ s32 preloadSampleStackTop;
@@ -889,7 +918,7 @@ typedef struct {
/* 0x1E58 */ OSMesg externalLoadMesgBuf[0x10];
/* 0x1E98 */ OSMesgQueue preloadSampleQueue;
/* 0x1EB0 */ OSMesg preloadSampleMesgBuf[0x10];
- /* 0x1EF0 */ OSMesgQueue currAudioFrameDmaQueue;
+ /* 0x1EF0 */ OSMesgQueue curAudioFrameDmaQueue;
/* 0x1F08 */ OSMesg currAudioFrameDmaMesgBuf[0x40];
/* 0x2008 */ OSIoMesg currAudioFrameDmaIoMesgBuf[0x40];
/* 0x2608 */ OSMesgQueue syncDmaQueue;
@@ -911,7 +940,7 @@ typedef struct {
/* 0x285C */ char unk_285C[0x4];
/* 0x2860 */ u8* sequenceFontTable;
/* 0x2864 */ u16 numSequences;
- /* 0x2868 */ SoundFont* soundFonts;
+ /* 0x2868 */ SoundFont* soundFontList;
/* 0x286C */ AudioBufferParameters audioBufferParameters;
/* 0x2994 */ f32 unk_2870;
/* 0x2898 */ s32 sampleDmaBufSize1;
@@ -925,7 +954,7 @@ typedef struct {
/* 0x28C0 */ s32 totalTaskCount; // The total number of times the top-level function on the audio thread is run since the last audio reset
/* 0x28C4 */ s32 curAudioFrameDmaCount;
/* 0x28C8 */ s32 rspTaskIndex;
- /* 0x28CC */ s32 curAiBuffferIndex;
+ /* 0x28CC */ s32 curAiBufferIndex;
/* 0x28AC */ Acmd* abiCmdBufs[2]; // Pointer to audio heap where the audio binary interface command lists are stored. Two lists that alternative every frame
/* 0x28B4 */ Acmd* curAbiCmdBuf;
/* 0x28DC */ AudioTask* curTask;
@@ -933,16 +962,16 @@ typedef struct {
/* 0x2980 */ f32 unk_2960;
/* 0x2984*/ s32 refreshRate;
/* 0x2988 */ s16* aiBuffers[3]; // Pointers to the audio buffer allocated on the initPool contained in the audio heap. Stores fully processed digital audio before transferring to the audio interface (AI)
- /* 0x2994 */ s16 aiBufLengths[3]; // Number of bytes to transfer to the audio interface buffer
+ /* 0x2994 */ s16 aiBufNumSamples[3]; // Number of samples to transfer to the audio interface buffer
/* 0x299C */ u32 audioRandom;
/* 0x29A0 */ s32 audioErrorFlags;
/* 0x29A4 */ volatile u32 resetTimer;
/* 0x29A8 */ u32 (*unk_29A8[4])(s8 value, SequenceChannel* channel);
/* 0x29B8 */ s8 unk_29B8;
/* 0x29BC */ s32 unk_29BC; // sMaxAbiCmdCnt
- /* 0x29C0 */ AudioAllocPool audioSessionPool; // A sub-pool to main pool, contains all sub-pools and data that changes every audio reset
+ /* 0x29C0 */ AudioAllocPool sessionPool; // A sub-pool to main pool, contains all sub-pools and data that changes every audio reset
/* 0x29D0 */ AudioAllocPool externalPool; // pool allocated on an external device. Never used in game
- /* 0x29E0 */ AudioAllocPool audioInitPool; // A sub-pool to the main pool, contains all sub-pools and data that persists every audio reset
+ /* 0x29E0 */ AudioAllocPool initPool; // A sub-pool to the main pool, contains all sub-pools and data that persists every audio reset
/* 0x29F0 */ AudioAllocPool miscPool; // A sub-pool to the session pool,
/* 0x2A00 */ char unk_29D0[0x20]; // probably two unused pools
/* 0x2A20 */ AudioAllocPool cachePool; // The common pool for all cache entries
@@ -978,7 +1007,7 @@ typedef struct {
/* 0x7978 */ u8 cmdWritePos;
/* 0x7979 */ u8 cmdReadPos;
/* 0x797A */ u8 cmdQueueFinished;
- /* 0x797C */ u16 activeChannelsFlags[5]; // bitwise flag for 16 channels. Only channels with bit turned on will be processed
+ /* 0x797C */ u16 activeChannelsFlags[5]; // bit-packed for 16 channels. Only channels with bit turned on will be processed
/* 0x7988 */ OSMesgQueue* audioResetQueueP;
/* 0x798C */ OSMesgQueue* taskStartQueueP;
/* 0x7990 */ OSMesgQueue* cmdProcQueueP;
@@ -1008,9 +1037,9 @@ typedef struct {
typedef struct {
/* 0x0 */ size_t heapSize; // total number of bytes allocated to the audio heap. Must be <= the size of `gAudioHeap` (ideally about the same size)
- /* 0x4 */ size_t mainPoolSplitSize; // The entire audio heap is split into two pools.
+ /* 0x4 */ size_t initPoolSize; // The entire audio heap is split into two pools.
/* 0x8 */ size_t permanentPoolSize;
-} AudioContextInitSizes; // size = 0xC
+} AudioHeapInitSizes; // size = 0xC
typedef struct {
/* 0x00 */ f32 unk_00;
diff --git a/include/z64save.h b/include/z64save.h
index a8ccbdaa4..50a3bfda8 100644
--- a/include/z64save.h
+++ b/include/z64save.h
@@ -8,7 +8,7 @@
struct GameState;
struct PlayState;
-struct FileChooseContext;
+struct FileSelectState;
// TODO: properly name DOWN, RETURN and TOP
typedef enum RespawnMode {
@@ -477,15 +477,15 @@ u16 Sram_CalcChecksum(void* data, size_t count);
void Sram_InitNewSave(void);
void Sram_InitDebugSave(void);
void func_80144A94(SramContext* sramCtx);
-void Sram_OpenSave(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx);
+void Sram_OpenSave(struct FileSelectState* fileSelect, SramContext* sramCtx);
void func_8014546C(SramContext* sramCtx);
-void func_801457CC(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx);
-void func_80146580(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx, s32 fileNum);
-void func_80146628(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx);
-void Sram_InitSave(struct FileChooseContext* fileChooseCtx, SramContext* sramCtx);
+void func_801457CC(struct FileSelectState* fileSelect, SramContext* sramCtx);
+void func_80146580(struct FileSelectState* fileSelect, SramContext* sramCtx, s32 fileNum);
+void func_80146628(struct FileSelectState* fileSelect, SramContext* sramCtx);
+void Sram_InitSave(struct FileSelectState* fileSelect, SramContext* sramCtx);
void func_80146DF8(SramContext* sramCtx);
void Sram_InitSram(struct GameState* gameState, SramContext* sramCtx);
-void Sram_Alloc(struct GameState* gamestate, SramContext* sramCtx);
+void Sram_Alloc(struct GameState* gameState, SramContext* sramCtx);
void Sram_SaveSpecialEnterClockTown(struct PlayState* play);
void Sram_SaveSpecialNewDay(struct PlayState* play);
void func_80147008(SramContext* sramCtx, u32 curPage, u32 numPages);
diff --git a/include/z_prenmi.h b/include/z_prenmi.h
new file mode 100644
index 000000000..1aa1e6f99
--- /dev/null
+++ b/include/z_prenmi.h
@@ -0,0 +1,15 @@
+#ifndef Z64_PRENMI_H
+#define Z64_PRENMI_H
+
+#include "global.h"
+
+void PreNMI_Destroy(GameState* thisx);
+void PreNMI_Init(GameState* thisx);
+
+typedef struct {
+ /* 0x00 */ GameState state;
+ /* 0xA4 */ u32 timer;
+ /* 0xA8 */ UNK_TYPE4 unkA8;
+} PreNMIState; // size = 0xAC
+
+#endif
diff --git a/include/z_title_setup.h b/include/z_title_setup.h
new file mode 100644
index 000000000..685b87c79
--- /dev/null
+++ b/include/z_title_setup.h
@@ -0,0 +1,13 @@
+#ifndef Z64_TITLE_SETUP_H
+#define Z64_TITLE_SETUP_H
+
+#include "global.h"
+
+void Setup_Destroy(GameState* gameState);
+void Setup_Init(GameState* gameState);
+
+typedef struct {
+ /* 0x00 */ GameState state;
+} SetupState; // size = 0xA4
+
+#endif
diff --git a/spec b/spec
index cc7babd85..147e5a77b 100644
--- a/spec
+++ b/spec
@@ -273,7 +273,8 @@ endseg
beginseg
name "link_animetion"
romalign 0x1000
- include "build/baserom/link_animetion.o"
+ include "build/assets/misc/link_animetion/link_animetion.o"
+ number 7
endseg
beginseg
@@ -703,6 +704,7 @@ beginseg
include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.o"
include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.o"
include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.o"
+ include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.o"
include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.o"
include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.bss.o"
include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.reloc.o"
@@ -1737,8 +1739,7 @@ beginseg
name "ovl_Effect_Ss_Dust"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.o"
- include "build/data/ovl_Effect_Ss_Dust/ovl_Effect_Ss_Dust.data.o"
- include "build/data/ovl_Effect_Ss_Dust/ovl_Effect_Ss_Dust.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_Dust/ovl_Effect_Ss_Dust_reloc.o"
endseg
beginseg
@@ -1752,16 +1753,14 @@ beginseg
name "ovl_Effect_Ss_Bomb2"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.o"
- include "build/data/ovl_Effect_Ss_Bomb2/ovl_Effect_Ss_Bomb2.data.o"
- include "build/data/ovl_Effect_Ss_Bomb2/ovl_Effect_Ss_Bomb2.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_Bomb2/ovl_Effect_Ss_Bomb2_reloc.o"
endseg
beginseg
name "ovl_Effect_Ss_Blast"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.o"
- include "build/data/ovl_Effect_Ss_Blast/ovl_Effect_Ss_Blast.data.o"
- include "build/data/ovl_Effect_Ss_Blast/ovl_Effect_Ss_Blast.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_Blast/ovl_Effect_Ss_Blast_reloc.o"
endseg
beginseg
@@ -1775,8 +1774,7 @@ beginseg
name "ovl_Effect_Ss_D_Fire"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.o"
- include "build/data/ovl_Effect_Ss_D_Fire/ovl_Effect_Ss_D_Fire.data.o"
- include "build/data/ovl_Effect_Ss_D_Fire/ovl_Effect_Ss_D_Fire.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_D_Fire/ovl_Effect_Ss_D_Fire_reloc.o"
endseg
beginseg
@@ -1818,8 +1816,7 @@ beginseg
name "ovl_Effect_Ss_Dt_Bubble"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.o"
- include "build/data/ovl_Effect_Ss_Dt_Bubble/ovl_Effect_Ss_Dt_Bubble.data.o"
- include "build/data/ovl_Effect_Ss_Dt_Bubble/ovl_Effect_Ss_Dt_Bubble.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/ovl_Effect_Ss_Dt_Bubble_reloc.o"
endseg
beginseg
@@ -1925,8 +1922,7 @@ beginseg
name "ovl_Effect_Ss_Dead_Db"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.o"
- include "build/data/ovl_Effect_Ss_Dead_Db/ovl_Effect_Ss_Dead_Db.data.o"
- include "build/data/ovl_Effect_Ss_Dead_Db/ovl_Effect_Ss_Dead_Db.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Db/ovl_Effect_Ss_Dead_Db_reloc.o"
endseg
beginseg
@@ -1940,8 +1936,7 @@ beginseg
name "ovl_Effect_Ss_Dead_Ds"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.o"
- include "build/data/ovl_Effect_Ss_Dead_Ds/ovl_Effect_Ss_Dead_Ds.data.o"
- include "build/data/ovl_Effect_Ss_Dead_Ds/ovl_Effect_Ss_Dead_Ds.reloc.o"
+ include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/ovl_Effect_Ss_Dead_Ds_reloc.o"
endseg
beginseg
@@ -3234,8 +3229,7 @@ beginseg
name "ovl_fbdemo_triforce"
compress
include "build/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.o"
- include "build/data/ovl_fbdemo_triforce/ovl_fbdemo_triforce.data.o"
- include "build/data/ovl_fbdemo_triforce/ovl_fbdemo_triforce.reloc.o"
+ include "build/src/overlays/fbdemos/ovl_fbdemo_triforce/ovl_fbdemo_triforce_reloc.o"
endseg
beginseg
@@ -3881,8 +3875,7 @@ beginseg
name "ovl_En_Bee"
compress
include "build/src/overlays/actors/ovl_En_Bee/z_en_bee.o"
- include "build/data/ovl_En_Bee/ovl_En_Bee.data.o"
- include "build/data/ovl_En_Bee/ovl_En_Bee.reloc.o"
+ include "build/src/overlays/actors/ovl_En_Bee/ovl_En_Bee_reloc.o"
endseg
beginseg
@@ -3917,11 +3910,7 @@ beginseg
name "ovl_Obj_Kendo_Kanban"
compress
include "build/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.o"
-#ifdef NON_MATCHING
include "build/src/overlays/actors/ovl_Obj_Kendo_Kanban/ovl_Obj_Kendo_Kanban_reloc.o"
-#else
- include "build/data/ovl_Obj_Kendo_Kanban/ovl_Obj_Kendo_Kanban.reloc.o"
-#endif
endseg
beginseg
diff --git a/src/code/audio/audio_effects.c b/src/code/audio/audio_effects.c
index ab9228bbf..bc27a6e22 100644
--- a/src/code/audio/audio_effects.c
+++ b/src/code/audio/audio_effects.c
@@ -63,7 +63,7 @@ void AudioEffects_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
}
seqPlayer->fadeTimer--;
- if (seqPlayer->fadeTimer == 0 && seqPlayer->state == 2) {
+ if ((seqPlayer->fadeTimer == 0) && (seqPlayer->state == SEQPLAYER_STATE_2)) {
AudioSeq_SequencePlayerDisable(seqPlayer);
return;
}
@@ -243,12 +243,10 @@ f32 AudioEffects_AdsrUpdate(AdsrState* adsr) {
break;
}
// fallthrough
-
case ADSR_STATE_START_LOOP:
adsr->envIndex = 0;
adsr->action.s.state = ADSR_STATE_LOOP;
// fallthrough
-
retry:
case ADSR_STATE_LOOP:
adsr->delay = adsr->envelope[adsr->envIndex].delay;
@@ -256,18 +254,21 @@ f32 AudioEffects_AdsrUpdate(AdsrState* adsr) {
case ADSR_DISABLE:
adsr->action.s.state = ADSR_STATE_DISABLED;
break;
+
case ADSR_HANG:
adsr->action.s.state = ADSR_STATE_HANG;
break;
+
case ADSR_GOTO:
adsr->envIndex = adsr->envelope[adsr->envIndex].arg;
goto retry;
+
case ADSR_RESTART:
adsr->action.s.state = ADSR_STATE_INITIAL;
break;
default:
- adsr->delay *= gAudioContext.audioBufferParameters.unk_24;
+ adsr->delay *= gAudioContext.audioBufferParameters.updatesPerFrameScaled;
if (adsr->delay == 0) {
adsr->delay = 1;
}
@@ -282,14 +283,13 @@ f32 AudioEffects_AdsrUpdate(AdsrState* adsr) {
break;
}
// fallthrough
-
case ADSR_STATE_FADE:
adsr->current += adsr->velocity;
- if (--adsr->delay <= 0) {
+ adsr->delay--;
+ if (adsr->delay <= 0) {
adsr->action.s.state = ADSR_STATE_LOOP;
}
// fallthrough
-
case ADSR_STATE_HANG:
break;
diff --git a/src/code/audio/audio_heap.c b/src/code/audio/audio_heap.c
index 7d3ea8ba6..667cd1c40 100644
--- a/src/code/audio/audio_heap.c
+++ b/src/code/audio/audio_heap.c
@@ -4,7 +4,7 @@ void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id);
void AudioHeap_InitSampleCaches(size_t persistentSampleCacheSize, size_t temporarySampleCacheSize);
SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(size_t size);
void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry);
-void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, SoundFontSample* sample);
+void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, Sample* sample);
SampleCacheEntry* AudioHeap_AllocPersistentSampleCacheEntry(size_t size);
void AudioHeap_DiscardSampleCaches(void);
void AudioHeap_DiscardSampleBank(s32 sampleBankId);
@@ -14,29 +14,37 @@ void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 flags);
#define gTatumsPerBeat (gAudioTatumInit[1])
-f32 func_8018B0F0(f32 arg0) {
- return 256.0f * gAudioContext.audioBufferParameters.unkUpdatesPerFrameScaled / arg0;
+/**
+ * Effectively scales `updatesPerFrameInv` by the reciprocal of `scaleInv`
+ * `updatesPerFrameInvScaled` is just `updatesPerFrameInv` scaled down by a factor of 256.0f
+ * i.e. (256.0f * `updatesPerFrameInvScaled`) is just `updatesPerFrameInv`
+ */
+f32 AudioHeap_CalculateAdsrDecay(f32 scaleInv) {
+ return 256.0f * gAudioContext.audioBufferParameters.updatesPerFrameInvScaled / scaleInv;
}
-void func_8018B10C(void) {
+/**
+ * Initialize the decay rate table used for decaying notes as part of adsr
+ */
+void AudioHeap_InitAdsrDecayTable(void) {
s32 i;
- gAudioContext.adsrDecayTable[255] = func_8018B0F0(0.25f);
- gAudioContext.adsrDecayTable[254] = func_8018B0F0(0.33f);
- gAudioContext.adsrDecayTable[253] = func_8018B0F0(0.5f);
- gAudioContext.adsrDecayTable[252] = func_8018B0F0(0.66f);
- gAudioContext.adsrDecayTable[251] = func_8018B0F0(0.75f);
+ gAudioContext.adsrDecayTable[255] = AudioHeap_CalculateAdsrDecay(0.25f);
+ gAudioContext.adsrDecayTable[254] = AudioHeap_CalculateAdsrDecay(0.33f);
+ gAudioContext.adsrDecayTable[253] = AudioHeap_CalculateAdsrDecay(0.5f);
+ gAudioContext.adsrDecayTable[252] = AudioHeap_CalculateAdsrDecay(0.66f);
+ gAudioContext.adsrDecayTable[251] = AudioHeap_CalculateAdsrDecay(0.75f);
for (i = 128; i < 251; i++) {
- gAudioContext.adsrDecayTable[i] = func_8018B0F0(251 - i);
+ gAudioContext.adsrDecayTable[i] = AudioHeap_CalculateAdsrDecay(251 - i);
}
for (i = 16; i < 128; i++) {
- gAudioContext.adsrDecayTable[i] = func_8018B0F0(4 * (143 - i));
+ gAudioContext.adsrDecayTable[i] = AudioHeap_CalculateAdsrDecay(4 * (143 - i));
}
for (i = 1; i < 16; i++) {
- gAudioContext.adsrDecayTable[i] = func_8018B0F0(60 * (23 - i));
+ gAudioContext.adsrDecayTable[i] = AudioHeap_CalculateAdsrDecay(60 * (23 - i));
}
gAudioContext.adsrDecayTable[0] = 0.0f;
@@ -71,7 +79,7 @@ void AudioHeap_DiscardFont(s32 fontId) {
Note* note = &gAudioContext.notes[i];
if (note->playbackState.fontId == fontId) {
- if ((note->playbackState.unk_04 == 0) && (note->playbackState.priority != 0)) {
+ if ((note->playbackState.status == PLAYBACK_STATUS_0) && (note->playbackState.priority != 0)) {
note->playbackState.parentLayer->enabled = false;
note->playbackState.parentLayer->finished = true;
}
@@ -233,19 +241,19 @@ void* AudioHeap_Alloc(AudioAllocPool* pool, size_t size) {
* Initialize a pool at the requested address with the requested size.
* Store the metadata of this pool in AudioAllocPool* pool
*/
-void AudioHeap_AllocPoolInit(AudioAllocPool* pool, void* addr, size_t size) {
+void AudioHeap_InitPool(AudioAllocPool* pool, void* addr, size_t size) {
pool->curAddr = pool->startAddr = (u8*)ALIGN16((uintptr_t)addr);
pool->size = size - ((uintptr_t)addr & 0xF);
pool->count = 0;
}
-void AudioHeap_ClearPersistentCache(AudioPersistentCache* persistent) {
+void AudioHeap_InitPersistentCache(AudioPersistentCache* persistent) {
persistent->pool.count = 0;
persistent->numEntries = 0;
persistent->pool.curAddr = persistent->pool.startAddr;
}
-void AudioHeap_ClearTemporaryCache(AudioTemporaryCache* temporary) {
+void AudioHeap_InitTemporaryCache(AudioTemporaryCache* temporary) {
temporary->pool.count = 0;
temporary->pool.curAddr = temporary->pool.startAddr;
temporary->nextSide = 0;
@@ -260,7 +268,7 @@ void AudioHeap_ResetPool(AudioAllocPool* pool) {
pool->curAddr = pool->startAddr;
}
-void AudioHeap_PopCache(s32 tableType) {
+void AudioHeap_PopPersistentCache(s32 tableType) {
AudioCache* loadedCache;
AudioAllocPool* persistentHeap;
AudioPersistentCache* persistent;
@@ -306,69 +314,65 @@ void AudioHeap_PopCache(s32 tableType) {
persistent->numEntries--;
}
-void AudioHeap_InitMainPool(size_t mainPoolSplitSize) {
- AudioHeap_AllocPoolInit(&gAudioContext.audioInitPool, gAudioContext.audioHeap, mainPoolSplitSize);
- AudioHeap_AllocPoolInit(&gAudioContext.audioSessionPool, gAudioContext.audioHeap + mainPoolSplitSize,
- gAudioContext.audioHeapSize - mainPoolSplitSize);
+void AudioHeap_InitMainPool(size_t initPoolSize) {
+ AudioHeap_InitPool(&gAudioContext.initPool, gAudioContext.audioHeap, initPoolSize);
+ AudioHeap_InitPool(&gAudioContext.sessionPool, gAudioContext.audioHeap + initPoolSize,
+ gAudioContext.audioHeapSize - initPoolSize);
gAudioContext.externalPool.startAddr = NULL;
}
void AudioHeap_InitSessionPool(AudioSessionPoolSplit* split) {
- gAudioContext.audioSessionPool.curAddr = gAudioContext.audioSessionPool.startAddr;
+ gAudioContext.sessionPool.curAddr = gAudioContext.sessionPool.startAddr;
- AudioHeap_AllocPoolInit(&gAudioContext.miscPool,
- AudioHeap_Alloc(&gAudioContext.audioSessionPool, split->miscPoolSize), split->miscPoolSize);
- AudioHeap_AllocPoolInit(&gAudioContext.cachePool,
- AudioHeap_Alloc(&gAudioContext.audioSessionPool, split->cachePoolSize),
- split->cachePoolSize);
+ AudioHeap_InitPool(&gAudioContext.miscPool, AudioHeap_Alloc(&gAudioContext.sessionPool, split->miscPoolSize),
+ split->miscPoolSize);
+ AudioHeap_InitPool(&gAudioContext.cachePool, AudioHeap_Alloc(&gAudioContext.sessionPool, split->cachePoolSize),
+ split->cachePoolSize);
}
void AudioHeap_InitCachePool(AudioCachePoolSplit* split) {
gAudioContext.cachePool.curAddr = gAudioContext.cachePool.startAddr;
- AudioHeap_AllocPoolInit(&gAudioContext.persistentCommonPool,
- AudioHeap_Alloc(&gAudioContext.cachePool, split->persistentCommonPoolSize),
- split->persistentCommonPoolSize);
- AudioHeap_AllocPoolInit(&gAudioContext.temporaryCommonPool,
- AudioHeap_Alloc(&gAudioContext.cachePool, split->temporaryCommonPoolSize),
- split->temporaryCommonPoolSize);
+ AudioHeap_InitPool(&gAudioContext.persistentCommonPool,
+ AudioHeap_Alloc(&gAudioContext.cachePool, split->persistentCommonPoolSize),
+ split->persistentCommonPoolSize);
+ AudioHeap_InitPool(&gAudioContext.temporaryCommonPool,
+ AudioHeap_Alloc(&gAudioContext.cachePool, split->temporaryCommonPoolSize),
+ split->temporaryCommonPoolSize);
}
-void AudioHeap_InitPersistentCache(AudioCommonPoolSplit* split) {
+void AudioHeap_InitPersistentPoolsAndCaches(AudioCommonPoolSplit* split) {
gAudioContext.persistentCommonPool.curAddr = gAudioContext.persistentCommonPool.startAddr;
- AudioHeap_AllocPoolInit(&gAudioContext.seqCache.persistent.pool,
- AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->seqCacheSize),
- split->seqCacheSize);
- AudioHeap_AllocPoolInit(&gAudioContext.fontCache.persistent.pool,
- AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->fontCacheSize),
- split->fontCacheSize);
- AudioHeap_AllocPoolInit(&gAudioContext.sampleBankCache.persistent.pool,
- AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->sampleBankCacheSize),
- split->sampleBankCacheSize);
+ AudioHeap_InitPool(&gAudioContext.seqCache.persistent.pool,
+ AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->seqCacheSize), split->seqCacheSize);
+ AudioHeap_InitPool(&gAudioContext.fontCache.persistent.pool,
+ AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->fontCacheSize),
+ split->fontCacheSize);
+ AudioHeap_InitPool(&gAudioContext.sampleBankCache.persistent.pool,
+ AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->sampleBankCacheSize),
+ split->sampleBankCacheSize);
- AudioHeap_ClearPersistentCache(&gAudioContext.seqCache.persistent);
- AudioHeap_ClearPersistentCache(&gAudioContext.fontCache.persistent);
- AudioHeap_ClearPersistentCache(&gAudioContext.sampleBankCache.persistent);
+ AudioHeap_InitPersistentCache(&gAudioContext.seqCache.persistent);
+ AudioHeap_InitPersistentCache(&gAudioContext.fontCache.persistent);
+ AudioHeap_InitPersistentCache(&gAudioContext.sampleBankCache.persistent);
}
-void AudioHeap_InitTemporaryCache(AudioCommonPoolSplit* split) {
+void AudioHeap_InitTemporaryPoolsAndCaches(AudioCommonPoolSplit* split) {
gAudioContext.temporaryCommonPool.curAddr = gAudioContext.temporaryCommonPool.startAddr;
- AudioHeap_AllocPoolInit(&gAudioContext.seqCache.temporary.pool,
- AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->seqCacheSize),
- split->seqCacheSize);
- AudioHeap_AllocPoolInit(&gAudioContext.fontCache.temporary.pool,
- AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->fontCacheSize),
- split->fontCacheSize);
- AudioHeap_AllocPoolInit(&gAudioContext.sampleBankCache.temporary.pool,
- AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->sampleBankCacheSize),
- split->sampleBankCacheSize);
+ AudioHeap_InitPool(&gAudioContext.seqCache.temporary.pool,
+ AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->seqCacheSize), split->seqCacheSize);
+ AudioHeap_InitPool(&gAudioContext.fontCache.temporary.pool,
+ AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->fontCacheSize), split->fontCacheSize);
+ AudioHeap_InitPool(&gAudioContext.sampleBankCache.temporary.pool,
+ AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->sampleBankCacheSize),
+ split->sampleBankCacheSize);
- AudioHeap_ClearTemporaryCache(&gAudioContext.seqCache.temporary);
- AudioHeap_ClearTemporaryCache(&gAudioContext.fontCache.temporary);
- AudioHeap_ClearTemporaryCache(&gAudioContext.sampleBankCache.temporary);
+ AudioHeap_InitTemporaryCache(&gAudioContext.seqCache.temporary);
+ AudioHeap_InitTemporaryCache(&gAudioContext.fontCache.temporary);
+ AudioHeap_InitTemporaryCache(&gAudioContext.sampleBankCache.temporary);
}
void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) {
@@ -764,7 +768,7 @@ void AudioHeap_LoadFilter(s16* filter, s32 lowPassCutoff, s32 highPassCutoff) {
s32 cutOff;
//! @bug filter is never set if (lowPassCutoff == highPassCutoff) and does not equal 0
- if (lowPassCutoff == 0 && highPassCutoff == 0) {
+ if ((lowPassCutoff == 0) && (highPassCutoff == 0)) {
// Identity filter
AudioHeap_LoadLowPassFilter(filter, 0);
} else if (highPassCutoff == 0) {
@@ -830,13 +834,13 @@ void AudioHeap_UpdateReverbs(void) {
* Clear the Audio Interface Buffers
*/
void AudioHeap_ClearAiBuffers(void) {
- s32 curAiBuffferIndex = gAudioContext.curAiBuffferIndex;
+ s32 curAiBufferIndex = gAudioContext.curAiBufferIndex;
s32 i;
- gAudioContext.aiBufLengths[curAiBuffferIndex] = gAudioContext.audioBufferParameters.minAiBufferLength;
+ gAudioContext.aiBufNumSamples[curAiBufferIndex] = gAudioContext.audioBufferParameters.minAiBufNumSamples;
for (i = 0; i < AIBUF_LEN; i++) {
- gAudioContext.aiBuffers[curAiBuffferIndex][i] = 0;
+ gAudioContext.aiBuffers[curAiBufferIndex][i] = 0;
}
}
@@ -902,8 +906,8 @@ s32 AudioHeap_ResetStep(void) {
case 1:
AudioHeap_Init();
gAudioContext.resetStatus = 0;
- for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufLengths); i++) {
- gAudioContext.aiBufLengths[i] = gAudioContext.audioBufferParameters.maxAiBufferLength;
+ for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufNumSamples); i++) {
+ gAudioContext.aiBufNumSamples[i] = gAudioContext.audioBufferParameters.maxAiBufNumSamples;
for (j = 0; j < AIBUF_LEN; j++) {
gAudioContext.aiBuffers[i][j] = 0;
}
@@ -940,9 +944,9 @@ void AudioHeap_Init(void) {
gAudioContext.audioBufferParameters.samplesPerFrameTarget =
ALIGN16(gAudioContext.audioBufferParameters.samplingFreq / gAudioContext.refreshRate);
- gAudioContext.audioBufferParameters.minAiBufferLength =
+ gAudioContext.audioBufferParameters.minAiBufNumSamples =
gAudioContext.audioBufferParameters.samplesPerFrameTarget - 0x10;
- gAudioContext.audioBufferParameters.maxAiBufferLength =
+ gAudioContext.audioBufferParameters.maxAiBufNumSamples =
gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10;
gAudioContext.audioBufferParameters.updatesPerFrame =
((gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10) / 0xD0) + 1;
@@ -952,9 +956,10 @@ void AudioHeap_Init(void) {
gAudioContext.audioBufferParameters.samplesPerUpdateMax = gAudioContext.audioBufferParameters.samplesPerUpdate + 8;
gAudioContext.audioBufferParameters.samplesPerUpdateMin = gAudioContext.audioBufferParameters.samplesPerUpdate - 8;
gAudioContext.audioBufferParameters.resampleRate = 32000.0f / (s32)gAudioContext.audioBufferParameters.samplingFreq;
- gAudioContext.audioBufferParameters.unkUpdatesPerFrameScaled =
+ gAudioContext.audioBufferParameters.updatesPerFrameInvScaled =
(1.0f / 256.0f) / gAudioContext.audioBufferParameters.updatesPerFrame;
- gAudioContext.audioBufferParameters.unk_24 = gAudioContext.audioBufferParameters.updatesPerFrame * 0.25f;
+ gAudioContext.audioBufferParameters.updatesPerFrameScaled =
+ gAudioContext.audioBufferParameters.updatesPerFrame / 4.0f;
gAudioContext.audioBufferParameters.updatesPerFrameInv = 1.0f / gAudioContext.audioBufferParameters.updatesPerFrame;
// sample dma size
@@ -980,12 +985,12 @@ void AudioHeap_Init(void) {
gAudioContext.audioBufferParameters.specUnk4 = spec->unk_04;
gAudioContext.audioBufferParameters.samplesPerFrameTarget *= gAudioContext.audioBufferParameters.specUnk4;
- gAudioContext.audioBufferParameters.maxAiBufferLength *= gAudioContext.audioBufferParameters.specUnk4;
- gAudioContext.audioBufferParameters.minAiBufferLength *= gAudioContext.audioBufferParameters.specUnk4;
+ gAudioContext.audioBufferParameters.maxAiBufNumSamples *= gAudioContext.audioBufferParameters.specUnk4;
+ gAudioContext.audioBufferParameters.minAiBufNumSamples *= gAudioContext.audioBufferParameters.specUnk4;
gAudioContext.audioBufferParameters.updatesPerFrame *= gAudioContext.audioBufferParameters.specUnk4;
if (gAudioContext.audioBufferParameters.specUnk4 >= 2) {
- gAudioContext.audioBufferParameters.maxAiBufferLength -= 0x10;
+ gAudioContext.audioBufferParameters.maxAiBufNumSamples -= 0x10;
}
// Determine the maximum allowable number of audio command list entries for the rsp microcode
@@ -998,7 +1003,7 @@ void AudioHeap_Init(void) {
temporarySize =
spec->temporarySeqCacheSize + spec->temporaryFontCacheSize + spec->temporarySampleBankCacheSize + 0x10;
cachePoolSize = persistentSize + temporarySize;
- miscPoolSize = gAudioContext.audioSessionPool.size - cachePoolSize - 0x100;
+ miscPoolSize = gAudioContext.sessionPool.size - cachePoolSize - 0x100;
if (gAudioContext.externalPool.startAddr != NULL) {
gAudioContext.externalPool.curAddr = gAudioContext.externalPool.startAddr;
@@ -1018,13 +1023,13 @@ void AudioHeap_Init(void) {
gAudioContext.persistentCommonPoolSplit.seqCacheSize = spec->persistentSeqCacheSize;
gAudioContext.persistentCommonPoolSplit.fontCacheSize = spec->persistentFontCacheSize;
gAudioContext.persistentCommonPoolSplit.sampleBankCacheSize = spec->persistentSampleBankCacheSize;
- AudioHeap_InitPersistentCache(&gAudioContext.persistentCommonPoolSplit);
+ AudioHeap_InitPersistentPoolsAndCaches(&gAudioContext.persistentCommonPoolSplit);
// Temporary Pool Split (Split into Sequences, SoundFonts, Samples)
gAudioContext.temporaryCommonPoolSplit.seqCacheSize = spec->temporarySeqCacheSize;
gAudioContext.temporaryCommonPoolSplit.fontCacheSize = spec->temporaryFontCacheSize;
gAudioContext.temporaryCommonPoolSplit.sampleBankCacheSize = spec->temporarySampleBankCacheSize;
- AudioHeap_InitTemporaryCache(&gAudioContext.temporaryCommonPoolSplit);
+ AudioHeap_InitTemporaryPoolsAndCaches(&gAudioContext.temporaryCommonPoolSplit);
AudioHeap_ResetLoadStatus();
@@ -1039,12 +1044,12 @@ void AudioHeap_Init(void) {
// Initialize audio binary interface command list buffer
for (j = 0; j < ARRAY_COUNT(gAudioContext.abiCmdBufs); j++) {
gAudioContext.abiCmdBufs[j] =
- AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, gAudioContext.maxAudioCmds * sizeof(u64));
+ AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, gAudioContext.maxAudioCmds * sizeof(Acmd));
}
- // Initialize adsrDecayTable (fadeOutVelocities for ADSR)
+ // Initialize the decay rate table for ADSR
gAudioContext.adsrDecayTable = AudioHeap_Alloc(&gAudioContext.miscPool, 0x100 * sizeof(f32));
- func_8018B10C();
+ AudioHeap_InitAdsrDecayTable();
// Initialize reverbs
for (i = 0; i < ARRAY_COUNT(gAudioContext.synthesisReverbs); i++) {
@@ -1139,14 +1144,14 @@ void AudioHeap_InitSampleCaches(size_t persistentSampleCacheSize, size_t tempora
if (addr == NULL) {
gAudioContext.persistentSampleCache.pool.size = 0;
} else {
- AudioHeap_AllocPoolInit(&gAudioContext.persistentSampleCache.pool, addr, persistentSampleCacheSize);
+ AudioHeap_InitPool(&gAudioContext.persistentSampleCache.pool, addr, persistentSampleCacheSize);
}
addr = AudioHeap_AllocAttemptExternal(&gAudioContext.miscPool, temporarySampleCacheSize);
if (addr == NULL) {
gAudioContext.temporarySampleCache.pool.size = 0;
} else {
- AudioHeap_AllocPoolInit(&gAudioContext.temporarySampleCache.pool, addr, temporarySampleCacheSize);
+ AudioHeap_InitPool(&gAudioContext.temporarySampleCache.pool, addr, temporarySampleCacheSize);
}
gAudioContext.persistentSampleCache.numEntries = 0;
@@ -1257,35 +1262,35 @@ SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(size_t size) {
void AudioHeap_UnapplySampleCacheForFont(SampleCacheEntry* entry, s32 fontId) {
Drum* drum;
Instrument* inst;
- SoundFontSound* sfx;
+ SoundEffect* soundEffect;
s32 instId;
s32 drumId;
s32 sfxId;
- for (instId = 0; instId < gAudioContext.soundFonts[fontId].numInstruments; instId++) {
+ for (instId = 0; instId < gAudioContext.soundFontList[fontId].numInstruments; instId++) {
inst = AudioPlayback_GetInstrumentInner(fontId, instId);
if (inst != NULL) {
if (inst->normalRangeLo != 0) {
- AudioHeap_UnapplySampleCache(entry, inst->lowNotesSound.sample);
+ AudioHeap_UnapplySampleCache(entry, inst->lowPitchTunedSample.sample);
}
if (inst->normalRangeHi != 0x7F) {
- AudioHeap_UnapplySampleCache(entry, inst->highNotesSound.sample);
+ AudioHeap_UnapplySampleCache(entry, inst->highPitchTunedSample.sample);
}
- AudioHeap_UnapplySampleCache(entry, inst->normalNotesSound.sample);
+ AudioHeap_UnapplySampleCache(entry, inst->normalPitchTunedSample.sample);
}
}
- for (drumId = 0; drumId < gAudioContext.soundFonts[fontId].numDrums; drumId++) {
+ for (drumId = 0; drumId < gAudioContext.soundFontList[fontId].numDrums; drumId++) {
drum = AudioPlayback_GetDrum(fontId, drumId);
if (drum != NULL) {
- AudioHeap_UnapplySampleCache(entry, drum->sound.sample);
+ AudioHeap_UnapplySampleCache(entry, drum->tunedSample.sample);
}
}
- for (sfxId = 0; sfxId < gAudioContext.soundFonts[fontId].numSfx; sfxId++) {
- sfx = AudioPlayback_GetSfx(fontId, sfxId);
- if (sfx != NULL) {
- AudioHeap_UnapplySampleCache(entry, sfx->sample);
+ for (sfxId = 0; sfxId < gAudioContext.soundFontList[fontId].numSfx; sfxId++) {
+ soundEffect = AudioPlayback_GetSoundEffect(fontId, sfxId);
+ if (soundEffect != NULL) {
+ AudioHeap_UnapplySampleCache(entry, soundEffect->tunedSample.sample);
}
}
}
@@ -1298,8 +1303,8 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) {
numFonts = gAudioContext.soundFontTable->numEntries;
for (fontId = 0; fontId < numFonts; fontId++) {
- sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
- sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
+ sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
+ sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
if (((sampleBankId1 != 0xFF) && (entry->sampleBankId == sampleBankId1)) ||
((sampleBankId2 != 0xFF) && (entry->sampleBankId == sampleBankId2)) || entry->sampleBankId == 0 ||
entry->sampleBankId == 0xFE) {
@@ -1313,7 +1318,7 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) {
}
}
-void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, SoundFontSample* sample) {
+void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, Sample* sample) {
if (sample != NULL) {
if (sample->sampleAddr == entry->allocatedAddr) {
sample->sampleAddr = entry->sampleAddr;
@@ -1362,8 +1367,8 @@ void AudioHeap_DiscardSampleCaches(void) {
numFonts = gAudioContext.soundFontTable->numEntries;
for (fontId = 0; fontId < numFonts; fontId++) {
- sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
- sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
+ sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
+ sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
if ((sampleBankId1 == 0xFF) && (sampleBankId2 == 0xFF)) {
continue;
}
@@ -1390,7 +1395,7 @@ typedef struct {
u8 newMedium;
} StorageChange;
-void AudioHeap_ChangeStorage(StorageChange* change, SoundFontSample* sample) {
+void AudioHeap_ChangeStorage(StorageChange* change, Sample* sample) {
if (sample != NULL && ((sample->medium == change->newMedium) || (D_801FD120 != 1)) &&
((sample->medium == MEDIUM_RAM) || (D_801FD120 != 0))) {
uintptr_t startAddr = change->oldAddr;
@@ -1430,7 +1435,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
s32 fontId;
Drum* drum;
Instrument* inst;
- SoundFontSound* sfx;
+ SoundEffect* soundEffect;
uintptr_t* newAddr;
s32 pad[4];
@@ -1457,8 +1462,8 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
}
for (fontId = 0; fontId < numFonts; fontId++) {
- sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
- sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
+ sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
+ sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
if ((sampleBankId1 != 0xFF) || (sampleBankId2 != 0xFF)) {
if (!AudioLoad_IsFontLoadComplete(fontId) ||
AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, fontId) == NULL) {
@@ -1471,30 +1476,30 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
continue;
}
- for (instId = 0; instId < gAudioContext.soundFonts[fontId].numInstruments; instId++) {
+ for (instId = 0; instId < gAudioContext.soundFontList[fontId].numInstruments; instId++) {
inst = AudioPlayback_GetInstrumentInner(fontId, instId);
if (inst != NULL) {
if (inst->normalRangeLo != 0) {
- AudioHeap_ChangeStorage(&change, inst->lowNotesSound.sample);
+ AudioHeap_ChangeStorage(&change, inst->lowPitchTunedSample.sample);
}
if (inst->normalRangeHi != 0x7F) {
- AudioHeap_ChangeStorage(&change, inst->highNotesSound.sample);
+ AudioHeap_ChangeStorage(&change, inst->highPitchTunedSample.sample);
}
- AudioHeap_ChangeStorage(&change, inst->normalNotesSound.sample);
+ AudioHeap_ChangeStorage(&change, inst->normalPitchTunedSample.sample);
}
}
- for (drumId = 0; drumId < gAudioContext.soundFonts[fontId].numDrums; drumId++) {
+ for (drumId = 0; drumId < gAudioContext.soundFontList[fontId].numDrums; drumId++) {
drum = AudioPlayback_GetDrum(fontId, drumId);
if (drum != NULL) {
- AudioHeap_ChangeStorage(&change, drum->sound.sample);
+ AudioHeap_ChangeStorage(&change, drum->tunedSample.sample);
}
}
- for (sfxId = 0; sfxId < gAudioContext.soundFonts[fontId].numSfx; sfxId++) {
- sfx = AudioPlayback_GetSfx(fontId, sfxId);
- if (sfx != NULL) {
- AudioHeap_ChangeStorage(&change, sfx->sample);
+ for (sfxId = 0; sfxId < gAudioContext.soundFontList[fontId].numSfx; sfxId++) {
+ soundEffect = AudioPlayback_GetSoundEffect(fontId, sfxId);
+ if (soundEffect != NULL) {
+ AudioHeap_ChangeStorage(&change, soundEffect->tunedSample.sample);
}
}
}
@@ -1671,9 +1676,9 @@ void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 flags)
reverb->framesToIgnore = 2;
}
- reverb->sound.sample = &reverb->sample;
+ reverb->tunedSample.sample = &reverb->sample;
reverb->sample.loop = &reverb->loop;
- reverb->sound.tuning = 1.0f;
+ reverb->tunedSample.tuning = 1.0f;
reverb->sample.codec = CODEC_REVERB;
reverb->sample.medium = MEDIUM_RAM;
reverb->sample.size = reverb->windowSize * 2;
diff --git a/src/code/audio/audio_init_params.c b/src/code/audio/audio_init_params.c
index b407ef7c9..81c49b30c 100644
--- a/src/code/audio/audio_init_params.c
+++ b/src/code/audio/audio_init_params.c
@@ -5,8 +5,8 @@ const s16 gAudioTatumInit[] = {
0x30, // gTatumsPerBeat
};
-const AudioContextInitSizes gAudioContextInitSizes = {
+const AudioHeapInitSizes gAudioHeapInitSizes = {
0x137F00, // heapSize
- 0x1C480, // mainPoolSplitSize
+ 0x1C480, // initPoolSize
0x1A000, // permanentPoolSize
};
diff --git a/src/code/audio/audio_load.c b/src/code/audio/audio_load.c
index 9ebdd1d85..c8e5ac5d1 100644
--- a/src/code/audio/audio_load.c
+++ b/src/code/audio/audio_load.c
@@ -16,7 +16,7 @@
* SoundFont Notes:
*
*/
-// opaque type for unpatched sound font data (should maybe get rid of this?)
+// opaque type for soundfont data loaded into ram (should maybe get rid of this?)
typedef void SoundFontData;
typedef struct {
@@ -26,7 +26,7 @@ typedef struct {
/* 0x0C */ uintptr_t baseAddr2;
/* 0x10 */ u32 medium1;
/* 0x14 */ u32 medium2;
-} AudioRelocInfo; // size = 0x18
+} SampleBankRelocInfo; // size = 0x18
void AudioLoad_DiscardFont(s32 fontId);
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2);
@@ -42,7 +42,7 @@ void AudioLoad_SyncDmaUnkMedium(uintptr_t devAddr, u8* addr, size_t size, s32 un
s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr, void* ramAddr, size_t size,
OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType);
void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue);
-SoundFontSample* AudioLoad_GetFontSample(s32 fontId, s32 instId);
+Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId);
void AudioLoad_ProcessSlowLoads(s32 resetStatus);
void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, size_t size);
void AudioLoad_DmaSlowCopyUnkMedium(intptr_t devAddr, intptr_t ramAddr, size_t size, s32 arg3);
@@ -56,8 +56,9 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus);
void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size);
void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size);
void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, void* ramAddr, size_t size, s16 arg3);
-void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* fontData, AudioRelocInfo* relocInfo);
-void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData, AudioRelocInfo* relocInfo, s32 async);
+void AudioLoad_RelocateSample(TunedSample* tunedSample, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc);
+void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc,
+ s32 isAsync);
s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus);
#define MK_ASYNC_MSG(retData, tableType, id, loadStatus) \
@@ -217,7 +218,7 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaI
dma->devAddr = dmaDevAddr;
dma->sizeUnused = transfer;
AudioLoad_Dma(&gAudioContext.currAudioFrameDmaIoMesgBuf[gAudioContext.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
- OS_READ, dmaDevAddr, dma->ramAddr, transfer, &gAudioContext.currAudioFrameDmaQueue, medium,
+ OS_READ, dmaDevAddr, dma->ramAddr, transfer, &gAudioContext.curAudioFrameDmaQueue, medium,
"SUPERDMA");
*dmaIndexRef = dmaIndex;
return (devAddr - dmaDevAddr) + dma->ramAddr;
@@ -423,10 +424,10 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue* arg3
}
}
-s32 AudioLoad_SyncLoadSample(SoundFontSample* sample, s32 fontId) {
+s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) {
void* sampleAddr;
- if (sample->unk_bit25 == true) {
+ if (sample->isRelocated == true) {
if (sample->medium != MEDIUM_RAM) {
sampleAddr = AudioHeap_AllocSampleCache(sample->size, fontId, (void*)sample->sampleAddr, sample->medium,
CACHE_PERSISTENT);
@@ -454,11 +455,11 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
return -1;
}
if (instrument->normalRangeLo != 0) {
- AudioLoad_SyncLoadSample(instrument->lowNotesSound.sample, fontId);
+ AudioLoad_SyncLoadSample(instrument->lowPitchTunedSample.sample, fontId);
}
- AudioLoad_SyncLoadSample(instrument->normalNotesSound.sample, fontId);
+ AudioLoad_SyncLoadSample(instrument->normalPitchTunedSample.sample, fontId);
if (instrument->normalRangeHi != 0x7F) {
- return AudioLoad_SyncLoadSample(instrument->highNotesSound.sample, fontId);
+ return AudioLoad_SyncLoadSample(instrument->highPitchTunedSample.sample, fontId);
}
// TODO: is this missing return UB?
} else if (instId == 0x7F) {
@@ -467,7 +468,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
if (drum == NULL) {
return -1;
}
- AudioLoad_SyncLoadSample(drum->sound.sample, fontId);
+ AudioLoad_SyncLoadSample(drum->tunedSample.sample, fontId);
return 0;
}
// TODO: is this missing return UB?
@@ -680,28 +681,29 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) {
s32 sampleBankId1;
s32 sampleBankId2;
s32 didAllocate;
- AudioRelocInfo relocInfo;
+ SampleBankRelocInfo sampleBankReloc;
s32 realFontId = AudioLoad_GetRealTableIndex(FONT_TABLE, fontId);
if (gAudioContext.fontLoadStatus[realFontId] == LOAD_STATUS_IN_PROGRESS) {
return NULL;
}
- sampleBankId1 = gAudioContext.soundFonts[realFontId].sampleBankId1;
- sampleBankId2 = gAudioContext.soundFonts[realFontId].sampleBankId2;
+ sampleBankId1 = gAudioContext.soundFontList[realFontId].sampleBankId1;
+ sampleBankId2 = gAudioContext.soundFontList[realFontId].sampleBankId2;
- relocInfo.sampleBankId1 = sampleBankId1;
- relocInfo.sampleBankId2 = sampleBankId2;
- if (relocInfo.sampleBankId1 != 0xFF) {
- relocInfo.baseAddr1 = AudioLoad_TrySyncLoadSampleBank(relocInfo.sampleBankId1, &relocInfo.medium1, false);
+ sampleBankReloc.sampleBankId1 = sampleBankId1;
+ sampleBankReloc.sampleBankId2 = sampleBankId2;
+ if (sampleBankReloc.sampleBankId1 != 0xFF) {
+ sampleBankReloc.baseAddr1 =
+ AudioLoad_TrySyncLoadSampleBank(sampleBankReloc.sampleBankId1, &sampleBankReloc.medium1, false);
} else {
- relocInfo.baseAddr1 = 0;
+ sampleBankReloc.baseAddr1 = 0;
}
if (sampleBankId2 != 0xFF) {
- relocInfo.baseAddr2 = AudioLoad_TrySyncLoadSampleBank(sampleBankId2, &relocInfo.medium2, false);
+ sampleBankReloc.baseAddr2 = AudioLoad_TrySyncLoadSampleBank(sampleBankId2, &sampleBankReloc.medium2, false);
} else {
- relocInfo.baseAddr2 = 0;
+ sampleBankReloc.baseAddr2 = 0;
}
fontData = AudioLoad_SyncLoad(FONT_TABLE, fontId, &didAllocate);
@@ -709,7 +711,7 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) {
return NULL;
}
if (didAllocate == true) {
- AudioLoad_RelocateFontAndPreloadSamples(realFontId, fontData, &relocInfo, false);
+ AudioLoad_RelocateFontAndPreloadSamples(realFontId, fontData, &sampleBankReloc, false);
}
return fontData;
@@ -778,7 +780,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) {
}
if (tableType == FONT_TABLE) {
- SoundFont* soundFont = &gAudioContext.soundFonts[realId];
+ SoundFont* soundFont = &gAudioContext.soundFontList[realId];
soundFont->numInstruments = ((UnloadedFonts*)romAddr)->numInstruments;
soundFont->numDrums = ((UnloadedFonts*)romAddr)->numDrums;
@@ -861,89 +863,131 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) {
}
/**
+ * Read and extract information from soundFont binary loaded into ram.
+ * Also relocate offsets into pointers within this loaded soundFont
*
- * SoundFontData* mem -> the address of the soundFont as stored in memory
+ * @param fontId index of font being processed
+ * @param fontDataStartAddr ram address of raw soundfont binary loaded into cache
+ * @param sampleBankReloc information on the sampleBank containing raw audio samples
*/
-void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontData, AudioRelocInfo* relocInfo) {
- uintptr_t reloc;
- uintptr_t reloc2;
+void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) {
+ uintptr_t soundOffset;
+ uintptr_t soundListOffset;
Instrument* inst;
Drum* drum;
- SoundFontSound* sfx;
+ SoundEffect* soundEffect;
s32 i;
- s32 numDrums = gAudioContext.soundFonts[fontId].numDrums;
- s32 numInstruments = gAudioContext.soundFonts[fontId].numInstruments;
- s32 numSfx = gAudioContext.soundFonts[fontId].numSfx;
- void** ptrs = (void**)fontData;
+ s32 numDrums = gAudioContext.soundFontList[fontId].numDrums;
+ s32 numInstruments = gAudioContext.soundFontList[fontId].numInstruments;
+ s32 numSfx = gAudioContext.soundFontList[fontId].numSfx;
+ u32* fontData = (u32*)fontDataStartAddr;
-#define BASE_OFFSET(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontData))
+ // Relocate an offset (relative to the start of the font data) to a pointer (a ram address)
+#define RELOC_TO_RAM(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontDataStartAddr))
- // relocate drums
- reloc2 = ptrs[0];
+ // Drums relocation
+
+ // The first u32 in fontData is an offset to a list of offsets to the drums
+ soundListOffset = fontData[0];
if (1) {}
- if ((reloc2 != 0) && (numDrums != 0)) {
- ptrs[0] = BASE_OFFSET(reloc2);
+
+ // If the soundFont has drums
+ if ((soundListOffset != 0) && (numDrums != 0)) {
+
+ fontData[0] = RELOC_TO_RAM(soundListOffset);
+
+ // Loop through the drum offsets
for (i = 0; i < numDrums; i++) {
- reloc = ((Drum**)ptrs[0])[i];
- if (reloc != 0) {
- reloc = BASE_OFFSET(reloc);
- ((Drum**)ptrs[0])[i] = drum = reloc;
- if (!drum->loaded) {
- AudioLoad_RelocateSample(&drum->sound, fontData, relocInfo);
- reloc = drum->envelope;
- drum->envelope = BASE_OFFSET(reloc);
- drum->loaded = true;
+ // Get the i'th drum offset
+ soundOffset = ((Drum**)fontData[0])[i];
+
+ // Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
+ if (soundOffset != 0) {
+ soundOffset = RELOC_TO_RAM(soundOffset);
+ ((Drum**)fontData[0])[i] = drum = soundOffset;
+
+ // The drum may be in the list multiple times and already relocated
+ if (!drum->isRelocated) {
+ AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc);
+
+ soundOffset = drum->envelope;
+ drum->envelope = RELOC_TO_RAM(soundOffset);
+
+ drum->isRelocated = true;
}
}
}
}
- // relocate sfxs
- reloc2 = ptrs[1];
+ // Sound effects relocation
+
+ // The second u32 in fontData is an offset to the first sound effect entry
+ soundListOffset = fontData[1];
if (1) {}
- if ((reloc2 != 0) && (numSfx != 0)) {
- ptrs[1] = BASE_OFFSET(reloc2);
+
+ // If the soundFont has sound effects
+ if ((soundListOffset != 0) && (numSfx != 0)) {
+
+ fontData[1] = RELOC_TO_RAM(soundListOffset);
+
+ // Loop through the sound effects
for (i = 0; i < numSfx; i++) {
- reloc = (SoundFontSound*)ptrs[1] + i;
- if (reloc != 0) {
- sfx = reloc;
- if (sfx->sample != NULL) {
- AudioLoad_RelocateSample(sfx, fontData, relocInfo);
- }
+ // Get a pointer to the i'th sound effect
+ soundOffset = (TunedSample*)fontData[1] + i;
+ soundEffect = (SoundEffect*)soundOffset;
+
+ // Check for NULL (note: the pointer is guaranteed to be in fontData and can never be NULL)
+ if ((soundEffect != NULL) && (soundEffect->tunedSample.sample != NULL)) {
+ AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc);
}
}
}
- if (numInstruments > 0x7E) {
- numInstruments = 0x7E;
+ // Instruments relocation
+
+ // Instrument Id 126 and above is reserved.
+ // There can only be 126 instruments, indexed from 0 to 125
+ if (numInstruments > 126) {
+ numInstruments = 126;
}
- // relocate instruments
+ // Starting from the 3rd u32 in fontData is the list of offsets to the instruments
+ // Loop through the instruments
for (i = 2; i <= 2 + numInstruments - 1; i++) {
- if (ptrs[i] != NULL) {
- ptrs[i] = BASE_OFFSET(ptrs[i]);
- inst = ptrs[i];
- if (!inst->loaded) {
+ // Some instrument data entries are empty, represented by an offset of 0 in the list of instrument offsets
+ if (fontData[i] != 0) {
+ fontData[i] = RELOC_TO_RAM(fontData[i]);
+ inst = (Instrument*)fontData[i];
+
+ // The instrument may be in the list multiple times and already relocated
+ if (!inst->isRelocated) {
+ // Some instruments have a different sample for low pitches
if (inst->normalRangeLo != 0) {
- AudioLoad_RelocateSample(&inst->lowNotesSound, fontData, relocInfo);
- }
- AudioLoad_RelocateSample(&inst->normalNotesSound, fontData, relocInfo);
- if (inst->normalRangeHi != 0x7F) {
- AudioLoad_RelocateSample(&inst->highNotesSound, fontData, relocInfo);
+ AudioLoad_RelocateSample(&inst->lowPitchTunedSample, fontDataStartAddr, sampleBankReloc);
}
- reloc = inst->envelope;
- inst->envelope = BASE_OFFSET(reloc);
- inst->loaded = true;
+ // Every instrument has a sample for the default range
+ AudioLoad_RelocateSample(&inst->normalPitchTunedSample, fontDataStartAddr, sampleBankReloc);
+
+ // Some instruments have a different sample for high pitches
+ if (inst->normalRangeHi != 0x7F) {
+ AudioLoad_RelocateSample(&inst->highPitchTunedSample, fontDataStartAddr, sampleBankReloc);
+ }
+
+ soundOffset = inst->envelope;
+ inst->envelope = (EnvelopePoint*)RELOC_TO_RAM(soundOffset);
+
+ inst->isRelocated = true;
}
}
}
-#undef BASE_OFFSET
+#undef RELOC_TO_RAM
- gAudioContext.soundFonts[fontId].drums = ptrs[0];
- gAudioContext.soundFonts[fontId].soundEffects = ptrs[1];
- gAudioContext.soundFonts[fontId].instruments = (Instrument**)(&ptrs[2]);
+ // Store the relocated pointers
+ gAudioContext.soundFontList[fontId].drums = (Drum**)fontData[0];
+ gAudioContext.soundFontList[fontId].soundEffects = (SoundEffect*)fontData[1];
+ gAudioContext.soundFontList[fontId].instruments = (Instrument**)(&fontData[2]);
}
void AudioLoad_SyncDma(uintptr_t devAddr, u8* ramAddr, size_t size, s32 medium) {
@@ -1102,7 +1146,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
}
if (tableType == FONT_TABLE) {
- soundFont = &gAudioContext.soundFonts[realId];
+ soundFont = &gAudioContext.soundFontList[realId];
soundFont->numInstruments = ((UnloadedFonts*)romAddr)->numInstruments;
soundFont->numDrums = ((UnloadedFonts*)romAddr)->numDrums;
@@ -1154,8 +1198,8 @@ void AudioLoad_SetUnusedHandler(void* callback) {
sUnusedHandler = callback;
}
-void AudioLoad_InitSoundFontMeta(s32 fontId) {
- SoundFont* font = &gAudioContext.soundFonts[fontId];
+void AudioLoad_InitSoundFont(s32 fontId) {
+ SoundFont* font = &gAudioContext.soundFontList[fontId];
AudioTableEntry* entry = &gAudioContext.soundFontTable->entries[fontId];
font->sampleBankId1 = (entry->shortData1 >> 8) & 0xFF;
@@ -1210,20 +1254,20 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
AudioThread_InitMesgQueues();
- for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufLengths); i++) {
- gAudioContext.aiBufLengths[i] = 0xA0;
+ for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufNumSamples); i++) {
+ gAudioContext.aiBufNumSamples[i] = 0xA0;
}
gAudioContext.totalTaskCount = 0;
gAudioContext.rspTaskIndex = 0;
- gAudioContext.curAiBuffferIndex = 0;
+ gAudioContext.curAiBufferIndex = 0;
gAudioContext.soundMode = SOUNDMODE_STEREO;
gAudioContext.curTask = NULL;
gAudioContext.rspTask[0].task.t.dataSize = 0;
gAudioContext.rspTask[1].task.t.dataSize = 0;
osCreateMesgQueue(&gAudioContext.syncDmaQueue, &gAudioContext.syncDmaMesg, 1);
- osCreateMesgQueue(&gAudioContext.currAudioFrameDmaQueue, gAudioContext.currAudioFrameDmaMesgBuf,
+ osCreateMesgQueue(&gAudioContext.curAudioFrameDmaQueue, gAudioContext.currAudioFrameDmaMesgBuf,
ARRAY_COUNT(gAudioContext.currAudioFrameDmaMesgBuf));
osCreateMesgQueue(&gAudioContext.externalLoadQueue, gAudioContext.externalLoadMesgBuf,
ARRAY_COUNT(gAudioContext.externalLoadMesgBuf));
@@ -1235,23 +1279,24 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
if (heap == NULL) {
gAudioContext.audioHeap = gAudioHeap;
- gAudioContext.audioHeapSize = gAudioContextInitSizes.heapSize;
+ gAudioContext.audioHeapSize = gAudioHeapInitSizes.heapSize;
} else {
void** hp = &heap;
+
gAudioContext.audioHeap = *hp;
gAudioContext.audioHeapSize = heapSize;
}
- for (i = 0; i < (s32)gAudioContext.audioHeapSize / 8; i++) {
+ for (i = 0; i < ((s32)gAudioContext.audioHeapSize / (s32)sizeof(u64)); i++) {
((u64*)gAudioContext.audioHeap)[i] = 0;
}
// Main Pool Split (split entirety of audio heap into initPool and sessionPool)
- AudioHeap_InitMainPool(gAudioContextInitSizes.mainPoolSplitSize);
+ AudioHeap_InitMainPool(gAudioHeapInitSizes.initPoolSize);
- // Initialize the audio interface buffer
+ // Initialize the audio interface buffers
for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBuffers); i++) {
- gAudioContext.aiBuffers[i] = AudioHeap_AllocZeroed(&gAudioContext.audioInitPool, AIBUF_LEN * sizeof(s16));
+ gAudioContext.aiBuffers[i] = AudioHeap_AllocZeroed(&gAudioContext.initPool, AIBUF_LEN * sizeof(s16));
}
// Connect audio tables to their tables in memory
@@ -1272,18 +1317,18 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
AudioLoad_InitTable(gAudioContext.sampleBankTable, SEGMENT_ROM_START(Audiotable), 0);
numFonts = gAudioContext.soundFontTable->numEntries;
- gAudioContext.soundFonts = AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
+ gAudioContext.soundFontList = AudioHeap_Alloc(&gAudioContext.initPool, numFonts * sizeof(SoundFont));
for (i = 0; i < numFonts; i++) {
- AudioLoad_InitSoundFontMeta(i);
+ AudioLoad_InitSoundFont(i);
}
- if (addr = AudioHeap_Alloc(&gAudioContext.audioInitPool, gAudioContextInitSizes.permanentPoolSize), addr == NULL) {
- // cast away const from D_8014A6C4
- *((u32*)&gAudioContextInitSizes.permanentPoolSize) = 0;
+ if (addr = AudioHeap_Alloc(&gAudioContext.initPool, gAudioHeapInitSizes.permanentPoolSize), addr == NULL) {
+ // cast away const from gAudioHeapInitSizes
+ *((u32*)&gAudioHeapInitSizes.permanentPoolSize) = 0;
}
- AudioHeap_AllocPoolInit(&gAudioContext.permanentPool, addr, gAudioContextInitSizes.permanentPoolSize);
+ AudioHeap_InitPool(&gAudioContext.permanentPool, addr, gAudioHeapInitSizes.permanentPoolSize);
gAudioContextInitalized = true;
osSendMesg(gAudioContext.taskStartQueueP, (void*)gAudioContext.totalTaskCount, OS_MESG_NOBLOCK);
}
@@ -1294,7 +1339,7 @@ void AudioLoad_InitSlowLoads(void) {
}
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
- SoundFontSample* sample;
+ Sample* sample;
AudioSlowLoad* slowLoad;
sample = AudioLoad_GetFontSample(fontId, instId);
@@ -1344,8 +1389,8 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
return 0;
}
-SoundFontSample* AudioLoad_GetFontSample(s32 fontId, s32 instId) {
- SoundFontSample* sample;
+Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId) {
+ Sample* sample;
if (instId < 0x80) {
Instrument* instrument = AudioPlayback_GetInstrumentInner(fontId, instId);
@@ -1353,21 +1398,21 @@ SoundFontSample* AudioLoad_GetFontSample(s32 fontId, s32 instId) {
if (instrument == NULL) {
return NULL;
}
- sample = instrument->normalNotesSound.sample;
+ sample = instrument->normalPitchTunedSample.sample;
} else if (instId < 0x100) {
Drum* drum = AudioPlayback_GetDrum(fontId, instId - 0x80);
if (drum == NULL) {
return NULL;
}
- sample = drum->sound.sample;
+ sample = drum->tunedSample.sample;
} else {
- SoundFontSound* sound = AudioPlayback_GetSfx(fontId, instId - 0x100);
+ SoundEffect* soundEffect = AudioPlayback_GetSoundEffect(fontId, instId - 0x100);
- if (sound == NULL) {
+ if (soundEffect == NULL) {
return NULL;
}
- sample = sound->sample;
+ sample = soundEffect->tunedSample.sample;
}
return sample;
@@ -1377,7 +1422,7 @@ void AudioLoad_Unused2(void) {
}
void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad) {
- SoundFontSample* sample;
+ Sample* sample;
if (slowLoad->sample.sampleAddr == NULL) {
return;
@@ -1596,7 +1641,7 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
OSMesg doneMsg;
u32 sampleBankId1;
u32 sampleBankId2;
- AudioRelocInfo relocInfo;
+ SampleBankRelocInfo sampleBankReloc;
if (1) {}
switch (ASYNC_TBLTYPE(retMsg)) {
@@ -1608,16 +1653,16 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
break;
case FONT_TABLE:
fontId = ASYNC_ID(retMsg);
- sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
- sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
- relocInfo.sampleBankId1 = sampleBankId1;
- relocInfo.sampleBankId2 = sampleBankId2;
- relocInfo.baseAddr1 =
- sampleBankId1 != 0xFF ? AudioLoad_GetSampleBank(sampleBankId1, &relocInfo.medium1) : 0;
- relocInfo.baseAddr2 =
- sampleBankId2 != 0xFF ? AudioLoad_GetSampleBank(sampleBankId2, &relocInfo.medium2) : 0;
+ sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
+ sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
+ sampleBankReloc.sampleBankId1 = sampleBankId1;
+ sampleBankReloc.sampleBankId2 = sampleBankId2;
+ sampleBankReloc.baseAddr1 =
+ (sampleBankId1 != 0xFF) ? AudioLoad_GetSampleBank(sampleBankId1, &sampleBankReloc.medium1) : 0;
+ sampleBankReloc.baseAddr2 =
+ (sampleBankId2 != 0xFF) ? AudioLoad_GetSampleBank(sampleBankId2, &sampleBankReloc.medium2) : 0;
AudioLoad_SetFontLoadStatus(fontId, ASYNC_STATUS(retMsg));
- AudioLoad_RelocateFontAndPreloadSamples(fontId, asyncLoad->ramAddr, &relocInfo, true);
+ AudioLoad_RelocateFontAndPreloadSamples(fontId, asyncLoad->ramAddr, &sampleBankReloc, true);
break;
}
@@ -1700,28 +1745,48 @@ void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size) {
void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, void* ramAddr, size_t size, s16 arg3) {
}
-#define RELOC(v, base) (reloc = (void*)((uintptr_t)(v) + (uintptr_t)(base)))
-
-void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, AudioRelocInfo* relocInfo) {
- SoundFontSample* sample;
+/**
+ * Read and extract information from TunedSample and its Sample
+ * contained in the soundFont binary loaded into ram
+ * TunedSample contains metadata on a sample used by a particular instrument/drum/sfx
+ * Also relocate offsets into pointers within this loaded TunedSample
+ *
+ * @param fontId index of font being processed
+ * @param fontData ram address of raw soundfont binary loaded into cache
+ * @param sampleBankReloc information on the sampleBank containing raw audio samples
+ */
+void AudioLoad_RelocateSample(TunedSample* tunedSample, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc) {
+ Sample* sample;
void* reloc;
- if ((uintptr_t)sound->sample <= 0x80000000) {
- sample = sound->sample = RELOC(sound->sample, mem);
- if (sample->size != 0 && sample->unk_bit25 != true) {
- sample->loop = RELOC(sample->loop, mem);
- sample->book = RELOC(sample->book, mem);
+ // Relocate an offset (relative to data loaded in ram at `base`) to a pointer (a ram address)
+#define AUDIO_RELOC(v, base) (reloc = (void*)((uintptr_t)(v) + (uintptr_t)(base)))
- // Resolve the sample medium 2-bit bitfield into a real value based on relocInfo.
+ if ((uintptr_t)tunedSample->sample <= AUDIO_RELOCATED_ADDRESS_START) {
+
+ sample = tunedSample->sample = AUDIO_RELOC(tunedSample->sample, fontData);
+
+ // If the sample exists and has not already been relocated
+ // Note: this is important, as the same sample can be used by different drums, sound effects, instruments
+ if ((sample->size != 0) && (sample->isRelocated != true)) {
+ sample->loop = AUDIO_RELOC(sample->loop, fontData);
+ sample->book = AUDIO_RELOC(sample->book, fontData);
+
+ // Resolve the sample medium 2-bit bitfield into a real value based on sampleBankReloc.
+ // Then relocate the offset sample within the sampleBank (not the fontData) into absolute address.
+ // sampleAddr can be either rom or ram depending on sampleBank cache policy
+ // in practice, this is always in rom
switch (sample->medium) {
case 0:
- sample->sampleAddr = RELOC(sample->sampleAddr, relocInfo->baseAddr1);
- sample->medium = relocInfo->medium1;
+ sample->sampleAddr = AUDIO_RELOC(sample->sampleAddr, sampleBankReloc->baseAddr1);
+ sample->medium = sampleBankReloc->medium1;
break;
+
case 1:
- sample->sampleAddr = RELOC(sample->sampleAddr, relocInfo->baseAddr2);
- sample->medium = relocInfo->medium2;
+ sample->sampleAddr = AUDIO_RELOC(sample->sampleAddr, sampleBankReloc->baseAddr2);
+ sample->medium = sampleBankReloc->medium2;
break;
+
case 2:
case 3:
// Invalid? This leaves sample->medium as MEDIUM_CART and MEDIUM_DISK_DRIVE
@@ -1729,7 +1794,8 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, AudioRe
break;
}
- sample->unk_bit25 = true;
+ sample->isRelocated = true;
+
if (sample->unk_bit26 && (sample->medium != MEDIUM_RAM)) {
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
}
@@ -1737,12 +1803,19 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, AudioRe
}
}
-#undef RELOC
+#undef AUDIO_RELOC
-void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, AudioRelocInfo* relocInfo, s32 async) {
+/**
+ * @param fontId index of font being processed
+ * @param fontData ram address of raw soundfont binary loaded into cache
+ * @param sampleBankReloc information on the sampleBank containing raw audio samples
+ * @param isAsync bool for whether this is an asynchronous load or not
+ */
+void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc,
+ s32 isAsync) {
AudioPreloadReq* preload;
AudioPreloadReq* topPreload;
- SoundFontSample* sample;
+ Sample* sample;
size_t size;
s32 nChunks;
u8* sampleRamAddr;
@@ -1757,7 +1830,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
}
gAudioContext.numUsedSamples = 0;
- AudioLoad_RelocateFont(fontId, mem, relocInfo);
+ AudioLoad_RelocateFont(fontId, fontData, sampleBankReloc);
size = 0;
for (i = 0; i < gAudioContext.numUsedSamples; i++) {
@@ -1772,13 +1845,13 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
sample = gAudioContext.usedSamples[i];
sampleRamAddr = NULL;
- switch (async) {
+ switch (isAsync) {
case false:
- if (sample->medium == relocInfo->medium1) {
- sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1,
+ if (sample->medium == sampleBankReloc->medium1) {
+ sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1,
sample->sampleAddr, sample->medium, CACHE_PERSISTENT);
- } else if (sample->medium == relocInfo->medium2) {
- sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2,
+ } else if (sample->medium == sampleBankReloc->medium2) {
+ sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2,
sample->sampleAddr, sample->medium, CACHE_PERSISTENT);
} else if (sample->medium == MEDIUM_DISK_DRIVE) {
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, 0xFE, sample->sampleAddr, sample->medium,
@@ -1787,23 +1860,26 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
break;
case true:
- if (sample->medium == relocInfo->medium1) {
- sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1,
+ if (sample->medium == sampleBankReloc->medium1) {
+ sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1,
sample->sampleAddr, sample->medium, CACHE_TEMPORARY);
- } else if (sample->medium == relocInfo->medium2) {
- sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2,
+ } else if (sample->medium == sampleBankReloc->medium2) {
+ sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2,
sample->sampleAddr, sample->medium, CACHE_TEMPORARY);
} else if (sample->medium == MEDIUM_DISK_DRIVE) {
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, 0xFE, sample->sampleAddr, sample->medium,
CACHE_TEMPORARY);
}
break;
+
+ default:
+ break;
}
if (sampleRamAddr == NULL) {
continue;
}
- switch (async) {
+ switch (isAsync) {
case false:
if (sample->medium == MEDIUM_UNK) {
AudioLoad_SyncDmaUnkMedium((uintptr_t)sample->sampleAddr, sampleRamAddr, sample->size,
@@ -1827,6 +1903,9 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
preload->endAndMediumKey = (uintptr_t)sample->sampleAddr + sample->size + sample->medium;
gAudioContext.preloadSampleStackTop++;
break;
+
+ default:
+ break;
}
}
gAudioContext.numUsedSamples = 0;
@@ -1841,7 +1920,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
}
s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
- SoundFontSample* sample;
+ Sample* sample;
AudioPreloadReq* preload;
u32 preloadIndex;
u32 key;
@@ -1902,7 +1981,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
return true;
}
-s32 AudioLoad_AddToSampleSet(SoundFontSample* sample, s32 numSamples, SoundFontSample** sampleSet) {
+s32 AudioLoad_AddToSampleSet(Sample* sample, s32 numSamples, Sample** sampleSet) {
s32 i;
for (i = 0; i < numSamples; i++) {
@@ -1919,18 +1998,18 @@ s32 AudioLoad_AddToSampleSet(SoundFontSample* sample, s32 numSamples, SoundFontS
return numSamples;
}
-s32 AudioLoad_GetSamplesForFont(s32 fontId, SoundFontSample** sampleSet) {
+s32 AudioLoad_GetSamplesForFont(s32 fontId, Sample** sampleSet) {
s32 i;
s32 numSamples = 0;
- s32 numDrums = gAudioContext.soundFonts[fontId].numDrums;
- s32 numInstruments = gAudioContext.soundFonts[fontId].numInstruments;
+ s32 numDrums = gAudioContext.soundFontList[fontId].numDrums;
+ s32 numInstruments = gAudioContext.soundFontList[fontId].numInstruments;
for (i = 0; i < numDrums; i++) {
Drum* drum = AudioPlayback_GetDrum(fontId, i);
if (1) {}
if (drum != NULL) {
- numSamples = AudioLoad_AddToSampleSet(drum->sound.sample, numSamples, sampleSet);
+ numSamples = AudioLoad_AddToSampleSet(drum->tunedSample.sample, numSamples, sampleSet);
}
}
@@ -1939,12 +2018,12 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, SoundFontSample** sampleSet) {
if (instrument != NULL) {
if (instrument->normalRangeLo != 0) {
- numSamples = AudioLoad_AddToSampleSet(instrument->lowNotesSound.sample, numSamples, sampleSet);
+ numSamples = AudioLoad_AddToSampleSet(instrument->lowPitchTunedSample.sample, numSamples, sampleSet);
}
if (instrument->normalRangeHi != 0x7F) {
- numSamples = AudioLoad_AddToSampleSet(instrument->highNotesSound.sample, numSamples, sampleSet);
+ numSamples = AudioLoad_AddToSampleSet(instrument->highPitchTunedSample.sample, numSamples, sampleSet);
}
- numSamples = AudioLoad_AddToSampleSet(instrument->normalNotesSound.sample, numSamples, sampleSet);
+ numSamples = AudioLoad_AddToSampleSet(instrument->normalPitchTunedSample.sample, numSamples, sampleSet);
}
}
@@ -1952,27 +2031,27 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, SoundFontSample** sampleSet) {
return numSamples;
}
-void AudioLoad_AddUsedSample(SoundFontSound* sound) {
- SoundFontSample* sample = sound->sample;
+void AudioLoad_AddUsedSample(TunedSample* tunedSample) {
+ Sample* sample = tunedSample->sample;
if ((sample->size != 0) && (sample->unk_bit26) && (sample->medium != MEDIUM_RAM)) {
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
}
}
-void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, AudioRelocInfo* relocInfo) {
+void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* sampleBankReloc) {
s32 numDrums;
s32 numInstruments;
s32 numSfx;
Drum* drum;
Instrument* instrument;
- SoundFontSound* sound;
+ SoundEffect* soundEffect;
AudioPreloadReq* preload;
AudioPreloadReq* topPreload;
u8* addr;
size_t size;
s32 i;
- SoundFontSample* sample;
+ Sample* sample;
s32 preloadInProgress;
s32 nChunks;
@@ -1983,34 +2062,34 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, AudioRelocInfo* relo
gAudioContext.numUsedSamples = 0;
- numDrums = gAudioContext.soundFonts[fontId].numDrums;
- numInstruments = gAudioContext.soundFonts[fontId].numInstruments;
- numSfx = gAudioContext.soundFonts[fontId].numSfx;
+ numDrums = gAudioContext.soundFontList[fontId].numDrums;
+ numInstruments = gAudioContext.soundFontList[fontId].numInstruments;
+ numSfx = gAudioContext.soundFontList[fontId].numSfx;
for (i = 0; i < numInstruments; i++) {
instrument = AudioPlayback_GetInstrumentInner(fontId, i);
if (instrument != NULL) {
if (instrument->normalRangeLo != 0) {
- AudioLoad_AddUsedSample(&instrument->lowNotesSound);
+ AudioLoad_AddUsedSample(&instrument->lowPitchTunedSample);
}
if (instrument->normalRangeHi != 0x7F) {
- AudioLoad_AddUsedSample(&instrument->highNotesSound);
+ AudioLoad_AddUsedSample(&instrument->highPitchTunedSample);
}
- AudioLoad_AddUsedSample(&instrument->normalNotesSound);
+ AudioLoad_AddUsedSample(&instrument->normalPitchTunedSample);
}
}
for (i = 0; i < numDrums; i++) {
drum = AudioPlayback_GetDrum(fontId, i);
if (drum != NULL) {
- AudioLoad_AddUsedSample(&drum->sound);
+ AudioLoad_AddUsedSample(&drum->tunedSample);
}
}
for (i = 0; i < numSfx; i++) {
- sound = AudioPlayback_GetSfx(fontId, i);
- if (sound != NULL) {
- AudioLoad_AddUsedSample(sound);
+ soundEffect = AudioPlayback_GetSoundEffect(fontId, i);
+ if (soundEffect != NULL) {
+ AudioLoad_AddUsedSample(&soundEffect->tunedSample);
}
}
@@ -2036,21 +2115,21 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, AudioRelocInfo* relo
switch (async) {
case false:
- if (sample->medium == relocInfo->medium1) {
- addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1, sample->sampleAddr,
+ if (sample->medium == sampleBankReloc->medium1) {
+ addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1, sample->sampleAddr,
sample->medium, CACHE_PERSISTENT);
- } else if (sample->medium == relocInfo->medium2) {
- addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2, sample->sampleAddr,
+ } else if (sample->medium == sampleBankReloc->medium2) {
+ addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2, sample->sampleAddr,
sample->medium, CACHE_PERSISTENT);
}
break;
case true:
- if (sample->medium == relocInfo->medium1) {
- addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1, sample->sampleAddr,
+ if (sample->medium == sampleBankReloc->medium1) {
+ addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1, sample->sampleAddr,
sample->medium, CACHE_TEMPORARY);
- } else if (sample->medium == relocInfo->medium2) {
- addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2, sample->sampleAddr,
+ } else if (sample->medium == sampleBankReloc->medium2) {
+ addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2, sample->sampleAddr,
sample->medium, CACHE_TEMPORARY);
}
break;
@@ -2104,23 +2183,25 @@ void AudioLoad_LoadPermanentSamples(void) {
sampleBankTable = AudioLoad_GetLoadTable(SAMPLE_TABLE);
for (i = 0; i < gAudioContext.permanentPool.count; i++) {
- AudioRelocInfo relocInfo;
+ SampleBankRelocInfo sampleBankReloc;
if (gAudioContext.permanentEntries[i].tableType == FONT_TABLE) {
fontId = AudioLoad_GetRealTableIndex(FONT_TABLE, gAudioContext.permanentEntries[i].id);
- relocInfo.sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
- relocInfo.sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
+ sampleBankReloc.sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
+ sampleBankReloc.sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
- if (relocInfo.sampleBankId1 != 0xFF) {
- relocInfo.sampleBankId1 = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, relocInfo.sampleBankId1);
- relocInfo.medium1 = sampleBankTable->entries[relocInfo.sampleBankId1].medium;
+ if (sampleBankReloc.sampleBankId1 != 0xFF) {
+ sampleBankReloc.sampleBankId1 =
+ AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankReloc.sampleBankId1);
+ sampleBankReloc.medium1 = sampleBankTable->entries[sampleBankReloc.sampleBankId1].medium;
}
- if (relocInfo.sampleBankId2 != 0xFF) {
- relocInfo.sampleBankId2 = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, relocInfo.sampleBankId2);
- relocInfo.medium2 = sampleBankTable->entries[relocInfo.sampleBankId2].medium;
+ if (sampleBankReloc.sampleBankId2 != 0xFF) {
+ sampleBankReloc.sampleBankId2 =
+ AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankReloc.sampleBankId2);
+ sampleBankReloc.medium2 = sampleBankTable->entries[sampleBankReloc.sampleBankId2].medium;
}
- AudioLoad_PreloadSamplesForFont(fontId, false, &relocInfo);
+ AudioLoad_PreloadSamplesForFont(fontId, false, &sampleBankReloc);
}
}
}
diff --git a/src/code/audio/audio_playback.c b/src/code/audio/audio_playback.c
index e7f5153ac..e1a42b1ed 100644
--- a/src/code/audio/audio_playback.c
+++ b/src/code/audio/audio_playback.c
@@ -4,9 +4,10 @@ void AudioPlayback_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRat
void AudioPlayback_AudioListPushFront(AudioListItem* list, AudioListItem* item);
void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer);
-void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
- f32 volRight, volLeft;
- s32 smallPanIndex;
+void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* noteSubEu, NoteSubAttributes* subAttrs) {
+ f32 volLeft;
+ f32 volRight;
+ s32 halfPanIndex;
u64 pad;
u8 strongLeft;
u8 strongRight;
@@ -16,41 +17,41 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at
StereoData stereoData;
s32 stereoHeadsetEffects = note->playbackState.stereoHeadsetEffects;
- vel = attrs->velocity;
- pan = attrs->pan;
- reverbVol = attrs->reverbVol;
- stereoData = attrs->stereo.s;
+ vel = subAttrs->velocity;
+ pan = subAttrs->pan;
+ reverbVol = subAttrs->reverbVol;
+ stereoData = subAttrs->stereo.s;
- sub->bitField0 = note->noteSubEu.bitField0;
- sub->bitField1 = note->noteSubEu.bitField1;
- sub->sound.samples = note->noteSubEu.sound.samples;
- sub->unk_06 = note->noteSubEu.unk_06;
+ noteSubEu->bitField0 = note->noteSubEu.bitField0;
+ noteSubEu->bitField1 = note->noteSubEu.bitField1;
+ noteSubEu->waveSampleAddr = note->noteSubEu.waveSampleAddr;
+ noteSubEu->harmonicIndexCurAndPrev = note->noteSubEu.harmonicIndexCurAndPrev;
- AudioPlayback_NoteSetResamplingRate(sub, attrs->frequency);
+ AudioPlayback_NoteSetResamplingRate(noteSubEu, subAttrs->frequency);
pan &= 0x7F;
- sub->bitField0.stereoStrongRight = false;
- sub->bitField0.stereoStrongLeft = false;
- sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
- sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
- if (stereoHeadsetEffects && gAudioContext.soundMode == SOUNDMODE_HEADSET) {
- smallPanIndex = pan >> 1;
- if (smallPanIndex > 0x3F) {
- smallPanIndex = 0x3F;
+ noteSubEu->bitField0.stereoStrongRight = false;
+ noteSubEu->bitField0.stereoStrongLeft = false;
+ noteSubEu->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
+ noteSubEu->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
+ if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_HEADSET)) {
+ halfPanIndex = pan >> 1;
+ if (halfPanIndex > 0x3F) {
+ halfPanIndex = 0x3F;
}
- sub->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex];
- sub->headsetPanRight = gHeadsetPanQuantization[0x3F - smallPanIndex];
- sub->bitField1.usesHeadsetPanEffects2 = true;
+ noteSubEu->headsetPanLeft = gHeadsetPanQuantization[halfPanIndex];
+ noteSubEu->headsetPanRight = gHeadsetPanQuantization[0x3F - halfPanIndex];
+ noteSubEu->bitField1.usesHeadsetPanEffects2 = true;
volLeft = gHeadsetPanVolume[pan];
volRight = gHeadsetPanVolume[0x7F - pan];
- } else if (stereoHeadsetEffects && gAudioContext.soundMode == SOUNDMODE_STEREO) {
+ } else if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_STEREO)) {
strongLeft = strongRight = false;
- sub->headsetPanRight = 0;
- sub->headsetPanLeft = 0;
- sub->bitField1.usesHeadsetPanEffects2 = false;
+ noteSubEu->headsetPanRight = 0;
+ noteSubEu->headsetPanLeft = 0;
+ noteSubEu->bitField1.usesHeadsetPanEffects2 = false;
volLeft = gStereoPanVolume[pan];
volRight = gStereoPanVolume[0x7F - pan];
@@ -60,34 +61,38 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at
strongRight = true;
}
- sub->bitField0.stereoStrongRight = strongRight;
- sub->bitField0.stereoStrongLeft = strongLeft;
+ // case 0:
+ noteSubEu->bitField0.stereoStrongRight = strongRight;
+ noteSubEu->bitField0.stereoStrongLeft = strongLeft;
switch (stereoData.bit2) {
case 0:
break;
+
case 1:
- sub->bitField0.stereoStrongRight = stereoData.strongRight;
- sub->bitField0.stereoStrongLeft = stereoData.strongLeft;
+ noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight;
+ noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft;
break;
+
case 2:
- sub->bitField0.stereoStrongRight = stereoData.strongRight | strongRight;
- sub->bitField0.stereoStrongLeft = stereoData.strongLeft | strongLeft;
+ noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight | strongRight;
+ noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft | strongLeft;
break;
+
case 3:
- sub->bitField0.stereoStrongRight = stereoData.strongRight ^ strongRight;
- sub->bitField0.stereoStrongLeft = stereoData.strongLeft ^ strongLeft;
+ noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight ^ strongRight;
+ noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft ^ strongLeft;
break;
}
} else if (gAudioContext.soundMode == SOUNDMODE_MONO) {
- sub->bitField0.stereoHeadsetEffects = false;
- sub->bitField0.usesHeadsetPanEffects = false;
+ noteSubEu->bitField0.stereoHeadsetEffects = false;
+ noteSubEu->bitField0.usesHeadsetPanEffects = false;
volLeft = 0.707f; // approx 1/sqrt(2)
volRight = 0.707f;
} else {
- sub->bitField0.stereoStrongRight = stereoData.strongRight;
- sub->bitField0.stereoStrongLeft = stereoData.strongLeft;
+ noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight;
+ noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft;
volLeft = gDefaultPanVolume[pan];
volRight = gDefaultPanVolume[0x7F - pan];
}
@@ -95,15 +100,15 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at
vel = 0.0f > vel ? 0.0f : vel;
vel = 1.0f < vel ? 1.0f : vel;
- sub->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
- sub->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
+ noteSubEu->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
+ noteSubEu->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
- sub->gain = attrs->gain;
- sub->filter = attrs->filter;
- sub->unk_07 = attrs->unk_14;
- sub->unk_0E = attrs->unk_16;
- sub->reverbVol = reverbVol;
- sub->unk_19 = attrs->unk_3;
+ noteSubEu->gain = subAttrs->gain;
+ noteSubEu->filter = subAttrs->filter;
+ noteSubEu->unk_07 = subAttrs->unk_14;
+ noteSubEu->unk_0E = subAttrs->unk_16;
+ noteSubEu->reverbVol = reverbVol;
+ noteSubEu->unk_19 = subAttrs->unk_3;
}
void AudioPlayback_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput) {
@@ -133,7 +138,7 @@ void AudioPlayback_NoteInit(Note* note) {
¬e->playbackState.adsrVolScaleUnused);
}
- note->playbackState.unk_04 = 0;
+ note->playbackState.status = PLAYBACK_STATUS_0;
note->playbackState.adsr.action.s.state = ADSR_STATE_INITIAL;
note->noteSubEu = gDefaultNoteSub;
}
@@ -144,7 +149,7 @@ void AudioPlayback_NoteDisable(Note* note) {
}
note->playbackState.priority = 0;
note->noteSubEu.bitField0.enabled = false;
- note->playbackState.unk_04 = 0;
+ note->playbackState.status = PLAYBACK_STATUS_0;
note->noteSubEu.bitField0.finished = false;
note->playbackState.parentLayer = NO_LAYER;
note->playbackState.prevParentLayer = NO_LAYER;
@@ -154,7 +159,7 @@ void AudioPlayback_NoteDisable(Note* note) {
void AudioPlayback_ProcessNotes(void) {
s32 pad;
- s32 unk_04;
+ s32 playbackStatus;
NoteAttributes* attrs;
NoteSubEu* noteSubEu2;
NoteSubEu* noteSubEu;
@@ -174,19 +179,19 @@ void AudioPlayback_ProcessNotes(void) {
continue;
}
- if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) {
+ if ((note != playbackState->parentLayer->note) && (playbackState->status == PLAYBACK_STATUS_0)) {
playbackState->adsr.action.s.release = true;
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
playbackState->priority = 1;
- playbackState->unk_04 = 2;
+ playbackState->status = PLAYBACK_STATUS_2;
goto out;
- } else if (!playbackState->parentLayer->enabled && playbackState->unk_04 == 0 &&
- playbackState->priority >= 1) {
+ } else if (!playbackState->parentLayer->enabled && (playbackState->status == PLAYBACK_STATUS_0) &&
+ (playbackState->priority >= 1)) {
// do nothing
} else if (playbackState->parentLayer->channel->seqPlayer == NULL) {
AudioSeq_SequenceChannelDisable(playbackState->parentLayer->channel);
playbackState->priority = 1;
- playbackState->unk_04 = 1;
+ playbackState->status = PLAYBACK_STATUS_1;
continue;
} else if (playbackState->parentLayer->channel->seqPlayer->muted &&
(playbackState->parentLayer->channel->muteFlags & MUTE_FLAGS_STOP_NOTES)) {
@@ -199,8 +204,8 @@ void AudioPlayback_ProcessNotes(void) {
AudioPlayback_AudioListRemove(¬e->listItem);
AudioPlayback_AudioListPushFront(¬e->listItem.pool->decaying, ¬e->listItem);
playbackState->priority = 1;
- playbackState->unk_04 = 2;
- } else if (playbackState->unk_04 == 0 && playbackState->priority >= 1) {
+ playbackState->status = PLAYBACK_STATUS_2;
+ } else if ((playbackState->status == PLAYBACK_STATUS_0) && (playbackState->priority >= 1)) {
continue;
}
@@ -208,8 +213,8 @@ void AudioPlayback_ProcessNotes(void) {
if (playbackState->priority != 0) {
if (1) {}
noteSubEu = ¬e->noteSubEu;
- if (playbackState->unk_04 >= 1 || noteSubEu->bitField0.finished) {
- if (playbackState->adsr.action.s.state == ADSR_STATE_DISABLED || noteSubEu->bitField0.finished) {
+ if ((playbackState->status >= 1) || noteSubEu->bitField0.finished) {
+ if ((playbackState->adsr.action.s.state == ADSR_STATE_DISABLED) || noteSubEu->bitField0.finished) {
if (playbackState->wantedParentLayer != NO_LAYER) {
AudioPlayback_NoteDisable(note);
if (playbackState->wantedParentLayer->channel != NULL) {
@@ -249,9 +254,9 @@ void AudioPlayback_ProcessNotes(void) {
scale = AudioEffects_AdsrUpdate(&playbackState->adsr);
AudioEffects_NoteVibratoUpdate(note);
- unk_04 = playbackState->unk_04;
+ playbackStatus = playbackState->status;
attrs = &playbackState->attributes;
- if (unk_04 == 1 || unk_04 == 2) {
+ if ((playbackStatus == PLAYBACK_STATUS_1) || (playbackStatus == PLAYBACK_STATUS_2)) {
subAttrs.frequency = attrs->freqScale;
subAttrs.velocity = attrs->velocity;
subAttrs.pan = attrs->pan;
@@ -317,17 +322,18 @@ void AudioPlayback_ProcessNotes(void) {
}
}
-SoundFontSound* AudioPlayback_InstrumentGetSound(Instrument* instrument, s32 semitone) {
- SoundFontSound* sound;
+TunedSample* AudioPlayback_GetInstrumentTunedSample(Instrument* instrument, s32 semitone) {
+ TunedSample* tunedSample;
if (semitone < instrument->normalRangeLo) {
- sound = &instrument->lowNotesSound;
+ tunedSample = &instrument->lowPitchTunedSample;
} else if (semitone <= instrument->normalRangeHi) {
- sound = &instrument->normalNotesSound;
+ tunedSample = &instrument->normalPitchTunedSample;
} else {
- sound = &instrument->highNotesSound;
+ tunedSample = &instrument->highPitchTunedSample;
}
- return sound;
+
+ return tunedSample;
}
Instrument* AudioPlayback_GetInstrumentInner(s32 fontId, s32 instId) {
@@ -338,18 +344,18 @@ Instrument* AudioPlayback_GetInstrumentInner(s32 fontId, s32 instId) {
}
if (!AudioLoad_IsFontLoadComplete(fontId)) {
- gAudioContext.audioErrorFlags = fontId + 0x10000000;
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(0, fontId, AUDIO_ERROR_FONT_NOT_LOADED);
return NULL;
}
- if (instId >= gAudioContext.soundFonts[fontId].numInstruments) {
- gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
+ if (instId >= gAudioContext.soundFontList[fontId].numInstruments) {
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, instId, AUDIO_ERROR_INVALID_INST_ID);
return NULL;
}
- inst = gAudioContext.soundFonts[fontId].instruments[instId];
+ inst = gAudioContext.soundFontList[fontId].instruments[instId];
if (inst == NULL) {
- gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, instId, AUDIO_ERROR_NO_INST);
return inst;
}
@@ -364,58 +370,58 @@ Drum* AudioPlayback_GetDrum(s32 fontId, s32 drumId) {
}
if (!AudioLoad_IsFontLoadComplete(fontId)) {
- gAudioContext.audioErrorFlags = fontId + 0x10000000;
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(0, fontId, AUDIO_ERROR_FONT_NOT_LOADED);
return NULL;
}
- if (drumId >= gAudioContext.soundFonts[fontId].numDrums) {
- gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
+ if (drumId >= gAudioContext.soundFontList[fontId].numDrums) {
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, drumId, AUDIO_ERROR_INVALID_DRUM_SFX_ID);
return NULL;
}
- if ((u32)gAudioContext.soundFonts[fontId].drums < 0x80000000) {
+ if ((u32)gAudioContext.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) {
return NULL;
}
- drum = gAudioContext.soundFonts[fontId].drums[drumId];
+ drum = gAudioContext.soundFontList[fontId].drums[drumId];
if (drum == NULL) {
- gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, drumId, AUDIO_ERROR_NO_DRUM_SFX);
}
return drum;
}
-SoundFontSound* AudioPlayback_GetSfx(s32 fontId, s32 sfxId) {
- SoundFontSound* sfx;
+SoundEffect* AudioPlayback_GetSoundEffect(s32 fontId, s32 sfxId) {
+ SoundEffect* soundEffect;
if (fontId == 0xFF) {
return NULL;
}
if (!AudioLoad_IsFontLoadComplete(fontId)) {
- gAudioContext.audioErrorFlags = fontId + 0x10000000;
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(0, fontId, AUDIO_ERROR_FONT_NOT_LOADED);
return NULL;
}
- if (sfxId >= gAudioContext.soundFonts[fontId].numSfx) {
- gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
+ if (sfxId >= gAudioContext.soundFontList[fontId].numSfx) {
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, sfxId, AUDIO_ERROR_INVALID_DRUM_SFX_ID);
return NULL;
}
- if ((u32)gAudioContext.soundFonts[fontId].soundEffects < 0x80000000) {
+ if ((u32)gAudioContext.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) {
return NULL;
}
- sfx = &gAudioContext.soundFonts[fontId].soundEffects[sfxId];
+ soundEffect = &gAudioContext.soundFontList[fontId].soundEffects[sfxId];
- if (sfx == NULL) {
- gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
+ if (soundEffect == NULL) {
+ gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, sfxId, AUDIO_ERROR_NO_DRUM_SFX);
}
- if (sfx->sample == NULL) {
+ if (soundEffect->tunedSample.sample == NULL) {
return NULL;
}
- return sfx;
+ return soundEffect;
}
s32 AudioPlayback_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* value) {
@@ -429,24 +435,24 @@ s32 AudioPlayback_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, v
switch (instrumentType) {
case 0:
- if (index >= gAudioContext.soundFonts[fontId].numDrums) {
+ if (index >= gAudioContext.soundFontList[fontId].numDrums) {
return -3;
}
- gAudioContext.soundFonts[fontId].drums[index] = value;
+ gAudioContext.soundFontList[fontId].drums[index] = value;
break;
case 1:
- if (index >= gAudioContext.soundFonts[fontId].numSfx) {
+ if (index >= gAudioContext.soundFontList[fontId].numSfx) {
return -3;
}
- gAudioContext.soundFonts[fontId].soundEffects[index] = *(SoundFontSound*)value;
+ gAudioContext.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value;
break;
default:
- if (index >= gAudioContext.soundFonts[fontId].numInstruments) {
+ if (index >= gAudioContext.soundFontList[fontId].numInstruments) {
return -3;
}
- gAudioContext.soundFonts[fontId].instruments[index] = value;
+ gAudioContext.soundFontList[fontId].instruments[index] = value;
break;
}
@@ -456,7 +462,7 @@ s32 AudioPlayback_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, v
void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
Note* note;
NoteAttributes* attrs;
- SequenceChannel* chan;
+ SequenceChannel* channel;
s32 i;
if (layer == NO_LAYER) {
@@ -491,27 +497,27 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
attrs->pan = layer->notePan;
if (layer->channel != NULL) {
- chan = layer->channel;
+ channel = layer->channel;
if (layer->unk_0A.s.bit_2 == 1) {
- attrs->reverb = chan->reverb;
+ attrs->reverb = channel->reverb;
} else {
attrs->reverb = layer->unk_09;
}
if (layer->unk_08 == 0x80) {
- attrs->unk_3 = chan->unk_10;
+ attrs->unk_3 = channel->unk_10;
} else {
attrs->unk_3 = layer->unk_08;
}
if (layer->unk_0A.s.bit_9 == 1) {
- attrs->gain = chan->gain;
+ attrs->gain = channel->gain;
} else {
attrs->gain = 0;
}
- attrs->filter = chan->filter;
+ attrs->filter = channel->filter;
if (attrs->filter != NULL) {
for (i = 0; i < 8; i++) {
@@ -520,18 +526,18 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
attrs->filter = attrs->filterBuf;
}
- attrs->unk_6 = chan->unk_20;
- attrs->unk_4 = chan->unk_0F;
- if (chan->seqPlayer->muted && (chan->muteFlags & MUTE_FLAGS_3)) {
+ attrs->unk_6 = channel->unk_20;
+ attrs->unk_4 = channel->unk_0F;
+ if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_3)) {
note->noteSubEu.bitField0.finished = true;
}
if (layer->stereo.asByte == 0) {
- attrs->stereo = chan->stereo;
+ attrs->stereo = channel->stereo;
} else {
attrs->stereo = layer->stereo;
}
- note->playbackState.priority = chan->someOtherPriority;
+ note->playbackState.priority = channel->someOtherPriority;
} else {
attrs->stereo = layer->stereo;
note->playbackState.priority = 1;
@@ -542,9 +548,9 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
if (target == ADSR_STATE_RELEASE) {
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.action.s.release = true;
- note->playbackState.unk_04 = 2;
+ note->playbackState.status = PLAYBACK_STATUS_2;
} else {
- note->playbackState.unk_04 = 1;
+ note->playbackState.status = PLAYBACK_STATUS_1;
note->playbackState.adsr.action.s.decay = true;
if (layer->adsr.decayIndex == 0) {
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->channel->adsr.decayIndex];
@@ -570,10 +576,18 @@ void AudioPlayback_SeqLayerNoteRelease(SequenceLayer* layer) {
AudioPlayback_SeqLayerDecayRelease(layer, ADSR_STATE_RELEASE);
}
+/**
+ * Extract the synthetic wave to use from gWaveSamples and update corresponding frequencies
+ *
+ * @param note
+ * @param layer
+ * @param waveId the index of the type of synthetic wave to use, offset by 128
+ * @return harmonicIndex, the index of the harmonic for the synthetic wave contained in gWaveSamples
+ */
s32 AudioPlayback_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveId) {
f32 freqScale;
- f32 ratio;
- u8 sampleCountIndex;
+ f32 freqRatio;
+ u8 harmonicIndex;
if (waveId < 128) {
waveId = 128;
@@ -583,42 +597,48 @@ s32 AudioPlayback_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveI
if (layer->portamento.mode != 0 && 0.0f < layer->portamento.extent) {
freqScale *= (layer->portamento.extent + 1.0f);
}
+
+ // Map frequency to the harmonic to use from gWaveSamples
if (freqScale < 0.99999f) {
- sampleCountIndex = 0;
- ratio = 1.0465f;
+ harmonicIndex = 0;
+ freqRatio = 1.0465f;
} else if (freqScale < 1.99999f) {
- sampleCountIndex = 1;
- ratio = 0.52325f;
+ harmonicIndex = 1;
+ freqRatio = 1.0465f / 2;
} else if (freqScale < 3.99999f) {
- sampleCountIndex = 2;
- ratio = 0.26263f;
+ harmonicIndex = 2;
+ freqRatio = 1.0465f / 4 + 1.005E-3;
} else {
- sampleCountIndex = 3;
- ratio = 0.13081f;
+ harmonicIndex = 3;
+ freqRatio = 1.0465f / 8 - 2.5E-6;
}
- layer->freqScale *= ratio;
+
+ // Update results
+ layer->freqScale *= freqRatio;
note->playbackState.waveId = waveId;
- note->playbackState.sampleCountIndex = sampleCountIndex;
+ note->playbackState.harmonicIndex = harmonicIndex;
- note->noteSubEu.sound.samples = &gWaveSamples[waveId - 128][sampleCountIndex * 64];
+ // Save the pointer to the synthethic wave
+ // waveId index starts at 128, there are WAVE_SAMPLE_COUNT samples to read from
+ note->noteSubEu.waveSampleAddr = &gWaveSamples[waveId - 128][harmonicIndex * WAVE_SAMPLE_COUNT];
- return sampleCountIndex;
+ return harmonicIndex;
}
void AudioPlayback_InitSyntheticWave(Note* note, SequenceLayer* layer) {
- s32 sampleCountIndex;
- s32 waveSampleCountIndex;
+ s32 prevHarmonicIndex;
+ s32 curHarmonicIndex;
s32 waveId = layer->instOrWave;
if (waveId == 0xFF) {
waveId = layer->channel->instOrWave;
}
- sampleCountIndex = note->playbackState.sampleCountIndex;
- waveSampleCountIndex = AudioPlayback_BuildSyntheticWave(note, layer, waveId);
+ prevHarmonicIndex = note->playbackState.harmonicIndex;
+ curHarmonicIndex = AudioPlayback_BuildSyntheticWave(note, layer, waveId);
- if (waveSampleCountIndex != sampleCountIndex) {
- note->noteSubEu.unk_06 = waveSampleCountIndex * 4 + sampleCountIndex;
+ if (curHarmonicIndex != prevHarmonicIndex) {
+ note->noteSubEu.harmonicIndexCurAndPrev = (curHarmonicIndex << 2) + prevHarmonicIndex;
}
}
@@ -805,7 +825,7 @@ void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer) {
if (instId == 0xFF) {
instId = channel->instOrWave;
}
- noteSubEu->sound.soundFontSound = layer->sound;
+ noteSubEu->tunedSample = layer->tunedSample;
if (instId >= 0x80 && instId < 0xC0) {
noteSubEu->bitField1.isSyntheticWave = true;
@@ -815,12 +835,12 @@ void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer) {
if (noteSubEu->bitField1.isSyntheticWave) {
AudioPlayback_BuildSyntheticWave(note, layer, instId);
- } else if (channel->unk_DC == 1) {
- playbackState->unk_84 = noteSubEu->sound.soundFontSound->sample->loop->start;
+ } else if (channel->startSamplePos == 1) {
+ playbackState->startSamplePos = noteSubEu->tunedSample->sample->loop->start;
} else {
- playbackState->unk_84 = channel->unk_DC;
- if (playbackState->unk_84 >= noteSubEu->sound.soundFontSound->sample->loop->end) {
- playbackState->unk_84 = 0;
+ playbackState->startSamplePos = channel->startSamplePos;
+ if (playbackState->startSamplePos >= noteSubEu->tunedSample->sample->loop->end) {
+ playbackState->startSamplePos = 0;
}
}
@@ -969,7 +989,7 @@ void AudioPlayback_NoteInitAll(void) {
note = &gAudioContext.notes[i];
note->noteSubEu = gZeroNoteSub;
note->playbackState.priority = 0;
- note->playbackState.unk_04 = 0;
+ note->playbackState.status = PLAYBACK_STATUS_0;
note->playbackState.parentLayer = NO_LAYER;
note->playbackState.wantedParentLayer = NO_LAYER;
note->playbackState.prevParentLayer = NO_LAYER;
@@ -981,7 +1001,7 @@ void AudioPlayback_NoteInitAll(void) {
note->playbackState.portamento.cur = 0;
note->playbackState.portamento.speed = 0;
note->playbackState.stereoHeadsetEffects = false;
- note->playbackState.unk_84 = 0;
+ note->playbackState.startSamplePos = 0;
note->synthesisState.synthesisBuffers = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x2E0);
note->playbackState.attributes.filterBuf = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x10);
}
diff --git a/src/code/audio/audio_seqplayer.c b/src/code/audio/audio_seqplayer.c
index ebcc9a8d1..ea5c5ed5e 100644
--- a/src/code/audio/audio_seqplayer.c
+++ b/src/code/audio/audio_seqplayer.c
@@ -33,7 +33,7 @@ u8 AudioSeq_ScriptReadU8(SeqScriptState* state);
s16 AudioSeq_ScriptReadS16(SeqScriptState* state);
u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state);
void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer);
-s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameSound);
+s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample);
s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer);
s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd);
s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd);
@@ -320,7 +320,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
channel->unused = false;
AudioPlayback_InitNoteLists(&channel->notePool);
- channel->unk_DC = 0;
+ channel->startSamplePos = 0;
channel->unk_E0 = 0;
channel->sfxState = NULL;
}
@@ -582,7 +582,7 @@ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) {
} while ((cmd == -1) && (layer->delay == 0));
if (cmd != PROCESS_SCRIPT_END) {
- // returns `sameSound` instead of a command
+ // returns `sameTunedSample` instead of a command
cmd = AudioSeq_SeqLayerProcessScriptStep4(layer, cmd);
}
@@ -611,20 +611,20 @@ void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) {
layer->notePropertiesNeedInit = true;
}
-s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameSound) {
+s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample) {
Note* note;
if ((layer->continuousNotes == true) && (layer->bit1 == true)) {
return 0;
}
- if ((layer->continuousNotes == true) && (layer->note != NULL) && layer->bit3 && (sameSound == true) &&
+ if ((layer->continuousNotes == true) && (layer->note != NULL) && layer->bit3 && (sameTunedSample == true) &&
(layer->note->playbackState.parentLayer == layer)) {
- if (layer->sound == NULL) {
+ if (layer->tunedSample == NULL) {
AudioPlayback_InitSyntheticWave(layer->note, layer);
}
} else {
- if (!sameSound) {
+ if (!sameTunedSample) {
AudioPlayback_SeqLayerNoteDecay(layer);
}
@@ -815,7 +815,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
}
s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
- s32 sameSound = true;
+ s32 sameTunedSample = true;
s32 instOrWave;
s32 speed;
f32 temp_f14;
@@ -823,10 +823,10 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
Portamento* portamento;
f32 freqScale;
f32 freqScale2;
- SoundFontSound* sound;
+ TunedSample* tunedSample;
Instrument* instrument;
Drum* drum;
- s32 pad;
+ SoundEffect* soundEffect;
SequenceChannel* channel;
SequencePlayer* seqPlayer;
u8 semitone = cmd;
@@ -861,15 +861,15 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
return PROCESS_SCRIPT_END;
}
- sound = &drum->sound;
+ tunedSample = &drum->tunedSample;
layer->adsr.envelope = drum->envelope;
layer->adsr.decayIndex = drum->adsrDecayIndex;
if (!layer->ignoreDrumPan) {
layer->pan = drum->pan;
}
- layer->sound = sound;
- layer->freqScale = sound->tuning;
+ layer->tunedSample = tunedSample;
+ layer->freqScale = tunedSample->tuning;
break;
case 1:
@@ -877,15 +877,16 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
layer->semitone = semitone;
sfxId = (layer->transposition << 6) + semitone;
- sound = AudioPlayback_GetSfx(channel->fontId, sfxId);
- if (sound == NULL) {
+ soundEffect = AudioPlayback_GetSoundEffect(channel->fontId, sfxId);
+ if (soundEffect == NULL) {
layer->stopSomething = true;
layer->delay2 = layer->delay + 1;
return PROCESS_SCRIPT_END;
}
- layer->sound = sound;
- layer->freqScale = sound->tuning;
+ tunedSample = &soundEffect->tunedSample;
+ layer->tunedSample = tunedSample;
+ layer->freqScale = tunedSample->tuning;
break;
default:
@@ -909,15 +910,15 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
vel = (semitone > layer->portamentoTargetNote) ? semitone : layer->portamentoTargetNote;
if (instrument != NULL) {
- sound = AudioPlayback_InstrumentGetSound(instrument, vel);
- sameSound = (layer->sound == sound);
- layer->sound = sound;
- tuning = sound->tuning;
+ tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, vel);
+ sameTunedSample = (layer->tunedSample == tunedSample);
+ layer->tunedSample = tunedSample;
+ tuning = tunedSample->tuning;
} else {
- layer->sound = NULL;
+ layer->tunedSample = NULL;
tuning = 1.0f;
if (instOrWave >= 0xC0) {
- layer->sound = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].sound;
+ layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
}
}
@@ -971,15 +972,15 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
}
if (instrument != NULL) {
- sound = AudioPlayback_InstrumentGetSound(instrument, semitone);
- sameSound = (sound == layer->sound);
- layer->sound = sound;
- layer->freqScale = gPitchFrequencies[semitone2] * sound->tuning;
+ tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, semitone);
+ sameTunedSample = (tunedSample == layer->tunedSample);
+ layer->tunedSample = tunedSample;
+ layer->freqScale = gPitchFrequencies[semitone2] * tunedSample->tuning;
} else {
- layer->sound = NULL;
+ layer->tunedSample = NULL;
layer->freqScale = gPitchFrequencies[semitone2];
if (instOrWave >= 0xC0) {
- layer->sound = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].sound;
+ layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
}
}
break;
@@ -989,8 +990,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
layer->freqScale *= layer->bend;
if (layer->delay == 0) {
- if (layer->sound != NULL) {
- time = layer->sound->sample->loop->end;
+ if (layer->tunedSample != NULL) {
+ time = layer->tunedSample->sample->loop->end;
} else {
time = 0.0f;
}
@@ -1020,7 +1021,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
}
}
}
- return sameSound;
+ return sameTunedSample;
}
s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
@@ -1571,7 +1572,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->unk_0F = 0;
channel->unk_20 = 0;
channel->bookOffset = 0;
- channel->unk_DC = 0;
+ channel->startSamplePos = 0;
channel->unk_E0 = 0;
channel->freqScale = 1.0f;
break;
@@ -1659,7 +1660,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
break;
case 0xBD: // channel:
- channel->unk_DC = cmdArgs[0];
+ channel->startSamplePos = cmdArgs[0];
break;
case 0xBE: // channel:
@@ -1672,10 +1673,10 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0xA0: // channel:
- case 0xA1: // channel:
- case 0xA2: // channel:
- case 0xA3: // channel:
+ case 0xA0: // channel: read from SfxChannelState using arg
+ case 0xA1: // channel: read from SfxChannelState using unk_22
+ case 0xA2: // channel: write to SfxChannelState using arg
+ case 0xA3: // channel: write to SfxChannelState using unk_22
if ((cmd == 0xA0) || (cmd == 0xA2)) {
cmdArgU16 = (u16)cmdArgs[0];
} else {
@@ -1958,15 +1959,15 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
cmd = AudioSeq_ScriptReadU8(seqScript);
temp = AudioSeq_ScriptReadS16(seqScript);
switch (cmd) {
- case 0:
- case 1:
- if (seqPlayer->state != 2) {
+ case SEQPLAYER_STATE_0:
+ case SEQPLAYER_STATE_1:
+ if (seqPlayer->state != SEQPLAYER_STATE_2) {
seqPlayer->fadeTimerUnkEu = temp;
seqPlayer->state = cmd;
}
break;
- case 2:
+ case SEQPLAYER_STATE_2:
seqPlayer->fadeTimer = temp;
seqPlayer->state = cmd;
seqPlayer->fadeVelocity = (0.0f - seqPlayer->fadeVolume) / (s32)seqPlayer->fadeTimer;
@@ -1977,11 +1978,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0xDB: // seqPlayer: set volume
value = AudioSeq_ScriptReadU8(seqScript);
switch (seqPlayer->state) {
- case 1:
- seqPlayer->state = 0;
+ case SEQPLAYER_STATE_1:
+ seqPlayer->state = SEQPLAYER_STATE_0;
seqPlayer->fadeVolume = 0.0f;
// fallthrough
- case 0:
+ case SEQPLAYER_STATE_0:
seqPlayer->fadeTimer = seqPlayer->fadeTimerUnkEu;
if (seqPlayer->fadeTimerUnkEu != 0) {
seqPlayer->fadeVelocity =
@@ -1991,7 +1992,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
}
break;
- case 2:
+ case SEQPLAYER_STATE_2:
break;
}
break;
@@ -2102,7 +2103,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
cmd = AudioSeq_ScriptReadU8(seqScript);
if (cmd == 0xFF) {
cmd = seqPlayer->playerIndex;
- if (seqPlayer->state == 2) {
+ if (seqPlayer->state == SEQPLAYER_STATE_2) {
break;
}
}
@@ -2224,7 +2225,7 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) {
AudioSeq_SequencePlayerDisable(seqPlayer);
seqPlayer->stopScript = false;
seqPlayer->delay = 0;
- seqPlayer->state = 1;
+ seqPlayer->state = SEQPLAYER_STATE_1;
seqPlayer->fadeTimer = 0;
seqPlayer->fadeTimerUnkEu = 0;
seqPlayer->tempoAcc = 0;
diff --git a/src/code/game.c b/src/code/game.c
index 84743b8c5..da21de17f 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -200,8 +200,8 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
gfxCtx->viConfigFeatures = gViConfigFeatures;
gfxCtx->xScale = gViConfigXScale;
gfxCtx->yScale = gViConfigYScale;
- gameState->nextGameStateInit = NULL;
- gameState->nextGameStateSize = 0;
+ gameState->init = NULL;
+ gameState->size = 0;
{
s32 requiredScopeTemp;
@@ -242,12 +242,12 @@ void GameState_Destroy(GameState* gameState) {
GameAlloc_Cleanup(&gameState->alloc);
}
-GameStateFunc GameState_GetNextStateInit(GameState* gameState) {
- return gameState->nextGameStateInit;
+GameStateFunc GameState_GetInit(GameState* gameState) {
+ return gameState->init;
}
-size_t GameState_GetNextStateSize(GameState* gameState) {
- return gameState->nextGameStateSize;
+size_t GameState_GetSize(GameState* gameState) {
+ return gameState->size;
}
u32 GameState_IsRunning(GameState* gameState) {
diff --git a/src/code/graph.c b/src/code/graph.c
index 99703293d..c67bffd7e 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -6,6 +6,7 @@
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "overlays/gamestates/ovl_select/z_select.h"
#include "overlays/gamestates/ovl_title/z_title.h"
+#include "z_title_setup.h"
FaultAddrConvClient sGraphFaultAddrConvClient;
FaultClient sGraphFaultClient;
@@ -63,44 +64,45 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
}
GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
- GameStateFunc gameStateInit = GameState_GetNextStateInit(gameState);
+ GameStateFunc gameStateInit = GameState_GetInit(gameState);
- if (gameStateInit == (GameStateFunc)TitleSetup_Init) {
+ if (gameStateInit == Setup_Init) {
return &gGameStateOverlayTable[0];
}
- if (gameStateInit == (GameStateFunc)MapSelect_Init) {
+ if (gameStateInit == MapSelect_Init) {
return &gGameStateOverlayTable[1];
}
- if (gameStateInit == (GameStateFunc)Title_Init) {
+ if (gameStateInit == ConsoleLogo_Init) {
return &gGameStateOverlayTable[2];
}
- if (gameStateInit == (GameStateFunc)Play_Init) {
+ if (gameStateInit == Play_Init) {
return &gGameStateOverlayTable[3];
}
- if (gameStateInit == (GameStateFunc)Opening_Init) {
+ if (gameStateInit == TitleSetup_Init) {
return &gGameStateOverlayTable[4];
}
- if (gameStateInit == (GameStateFunc)FileChoose_Init) {
+ if (gameStateInit == FileSelect_Init) {
return &gGameStateOverlayTable[5];
}
- if (gameStateInit == (GameStateFunc)Daytelop_Init) {
+ if (gameStateInit == DayTelop_Init) {
return &gGameStateOverlayTable[6];
}
+
return NULL;
}
void* Graph_FaultAddrConvFunc(void* address, void* param) {
uintptr_t addr = address;
- GameStateOverlay* gamestateOvl = &gGameStateOverlayTable[0];
+ GameStateOverlay* gameStateOvl = &gGameStateOverlayTable[0];
uintptr_t ramConv;
void* ramStart;
uintptr_t diff;
s32 i;
- for (i = 0; i < graphNumGameStates; i++, gamestateOvl++) {
- diff = VRAM_PTR_SIZE(gamestateOvl);
- ramStart = gamestateOvl->loadedRamAddr;
- ramConv = (uintptr_t)gamestateOvl->vramStart - (uintptr_t)ramStart;
+ for (i = 0; i < graphNumGameStates; i++, gameStateOvl++) {
+ diff = VRAM_PTR_SIZE(gameStateOvl);
+ ramStart = gameStateOvl->loadedRamAddr;
+ ramConv = (uintptr_t)gameStateOvl->vramStart - (uintptr_t)ramStart;
if (ramStart != NULL) {
if (addr >= (uintptr_t)ramStart && addr < (uintptr_t)ramStart + diff) {
@@ -235,7 +237,7 @@ void Graph_UpdateGame(GameState* gameState) {
}
/**
- * Run the gamestate logic, then finalize the gfx buffer
+ * Run the game state logic, then finalize the gfx buffer
* and run the graphics task for this frame.
*/
void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
diff --git a/src/code/title_setup.c b/src/code/title_setup.c
index 9397aaed3..46e239787 100644
--- a/src/code/title_setup.c
+++ b/src/code/title_setup.c
@@ -1,7 +1,7 @@
-#include "global.h"
+#include "z_title_setup.h"
#include "overlays/gamestates/ovl_title/z_title.h"
-void TitleSetup_GameStateResetContext(void) {
+void Setup_SetRegs(void) {
XREG(2) = 0;
XREG(10) = 26;
XREG(11) = 20;
@@ -45,23 +45,21 @@ void TitleSetup_GameStateResetContext(void) {
YREG(43) = 0xB1;
}
-void TitleSetup_InitImpl(GameState* gameState) {
+void Setup_InitImpl(SetupState* this) {
func_80185908();
SaveContext_Init();
- TitleSetup_GameStateResetContext();
+ Setup_SetRegs();
- gameState->running = 0;
-
-setNextGamestate
- :; // This label is probably a leftover of a debug ifdef, it's essential to not have gameState->running reordered!
- SET_NEXT_GAMESTATE(gameState, Title_Init, TitleContext);
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, ConsoleLogo_Init, sizeof(ConsoleLogoState));
}
-void TitleSetup_Destroy(GameState* gameState) {
- ;
+void Setup_Destroy(GameState* thisx) {
}
-void TitleSetup_Init(GameState* gameState) {
- gameState->destroy = TitleSetup_Destroy;
- TitleSetup_InitImpl(gameState);
+void Setup_Init(GameState* thisx) {
+ SetupState* this = (SetupState*)thisx;
+
+ this->state.destroy = Setup_Destroy;
+ Setup_InitImpl(this);
}
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 3669dd136..61e4dc807 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -692,7 +692,7 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS
*/
s32 Flags_GetSwitch(PlayState* play, s32 flag) {
if (flag >= 0 && flag < 0x80) {
- return play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
+ return play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
}
return 0;
}
@@ -702,7 +702,7 @@ s32 Flags_GetSwitch(PlayState* play, s32 flag) {
*/
void Flags_SetSwitch(PlayState* play, s32 flag) {
if (flag >= 0 && flag < 0x80) {
- play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
+ play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
}
}
@@ -711,7 +711,7 @@ void Flags_SetSwitch(PlayState* play, s32 flag) {
*/
void Flags_UnsetSwitch(PlayState* play, s32 flag) {
if (flag >= 0 && flag < 0x80) {
- play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F));
+ play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F));
}
}
@@ -719,70 +719,70 @@ void Flags_UnsetSwitch(PlayState* play, s32 flag) {
* Tests if current scene chest flag is set.
*/
s32 Flags_GetTreasure(PlayState* play, s32 flag) {
- return play->actorCtx.flags.chest & (1 << flag);
+ return play->actorCtx.sceneFlags.chest & (1 << flag);
}
/**
* Sets current scene chest flag.
*/
void Flags_SetTreasure(PlayState* play, s32 flag) {
- play->actorCtx.flags.chest |= (1 << flag);
+ play->actorCtx.sceneFlags.chest |= (1 << flag);
}
/**
* Overrides the all the chest flags.
*/
void Flags_SetAllTreasure(PlayState* play, s32 flag) {
- play->actorCtx.flags.chest = flag;
+ play->actorCtx.sceneFlags.chest = flag;
}
/**
* Returns all the chest flags.
*/
s32 Flags_GetAllTreasure(PlayState* play) {
- return play->actorCtx.flags.chest;
+ return play->actorCtx.sceneFlags.chest;
}
/**
* Tests if current scene clear flag is set.
*/
s32 Flags_GetClear(PlayState* play, s32 roomNumber) {
- return play->actorCtx.flags.clearedRoom & (1 << roomNumber);
+ return play->actorCtx.sceneFlags.clearedRoom & (1 << roomNumber);
}
/**
* Sets current scene clear flag.
*/
void Flags_SetClear(PlayState* play, s32 roomNumber) {
- play->actorCtx.flags.clearedRoom |= (1 << roomNumber);
+ play->actorCtx.sceneFlags.clearedRoom |= (1 << roomNumber);
}
/**
* Unsets current scene clear flag.
*/
void Flags_UnsetClear(PlayState* play, s32 roomNumber) {
- play->actorCtx.flags.clearedRoom &= ~(1 << roomNumber);
+ play->actorCtx.sceneFlags.clearedRoom &= ~(1 << roomNumber);
}
/**
* Tests if current scene temp clear flag is set.
*/
s32 Flags_GetClearTemp(PlayState* play, s32 roomNumber) {
- return play->actorCtx.flags.clearedRoomTemp & (1 << roomNumber);
+ return play->actorCtx.sceneFlags.clearedRoomTemp & (1 << roomNumber);
}
/**
* Sets current scene temp clear flag.
*/
void Flags_SetClearTemp(PlayState* play, s32 roomNumber) {
- play->actorCtx.flags.clearedRoomTemp |= (1 << roomNumber);
+ play->actorCtx.sceneFlags.clearedRoomTemp |= (1 << roomNumber);
}
/**
* Unsets current scene temp clear flag.
*/
void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber) {
- play->actorCtx.flags.clearedRoomTemp &= ~(1 << roomNumber);
+ play->actorCtx.sceneFlags.clearedRoomTemp &= ~(1 << roomNumber);
}
/**
@@ -790,7 +790,7 @@ void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber) {
*/
s32 Flags_GetCollectible(PlayState* play, s32 flag) {
if (flag > 0 && flag < 0x80) {
- return play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
+ return play->actorCtx.sceneFlags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
}
return 0;
}
@@ -800,7 +800,7 @@ s32 Flags_GetCollectible(PlayState* play, s32 flag) {
*/
void Flags_SetCollectible(PlayState* play, s32 flag) {
if (flag > 0 && flag < 0x80) {
- play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
+ play->actorCtx.sceneFlags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
}
}
@@ -2249,14 +2249,14 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto
overlayEntry++;
}
- actorCtx->flags.chest = cycleFlags->chest;
- actorCtx->flags.switches[0] = cycleFlags->switch0;
- actorCtx->flags.switches[1] = cycleFlags->switch1;
+ actorCtx->sceneFlags.chest = cycleFlags->chest;
+ actorCtx->sceneFlags.switches[0] = cycleFlags->switch0;
+ actorCtx->sceneFlags.switches[1] = cycleFlags->switch1;
if (play->sceneNum == SCENE_INISIE_R) {
cycleFlags = &gSaveContext.cycleSceneFlags[play->sceneNum];
}
- actorCtx->flags.collectible[0] = cycleFlags->collectible;
- actorCtx->flags.clearedRoom = cycleFlags->clearedRoom;
+ actorCtx->sceneFlags.collectible[0] = cycleFlags->collectible;
+ actorCtx->sceneFlags.clearedRoom = cycleFlags->clearedRoom;
TitleCard_ContextInit(&play->state, &actorCtx->titleCtxt);
func_800B6468(play);
@@ -2976,9 +2976,9 @@ void func_800BA798(PlayState* play, ActorContext* actorCtx) {
}
CollisionCheck_ClearContext(play, &play->colChkCtx);
- actorCtx->flags.clearedRoomTemp = 0;
- actorCtx->flags.switches[3] = 0;
- actorCtx->flags.collectible[3] = 0;
+ actorCtx->sceneFlags.clearedRoomTemp = 0;
+ actorCtx->sceneFlags.switches[3] = 0;
+ actorCtx->sceneFlags.collectible[3] = 0;
play->msgCtx.unk_12030 = 0;
}
@@ -3814,9 +3814,9 @@ typedef struct {
} DoorLockInfo; // size = 0x1C
DoorLockInfo sDoorLocksInfo[DOORLOCK_MAX] = {
- /* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0, 1.0f, 0.0f, gDoorChainsDL, gDoorLockDL },
- /* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, object_bdoor_DL_000530, object_bdoor_DL_000400 },
- /* DOORLOCK_2 */ { 0.6400000453f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainsDL, gDoorLockDL },
+ /* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0, 1.0f, 0.0f, gDoorChainDL, gDoorLockDL },
+ /* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, gBossDoorChainDL, gBossDoorLockDL },
+ /* DOORLOCK_2 */ { 0.6400000453f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainDL, gDoorLockDL },
};
/**
diff --git a/src/code/z_demo.c b/src/code/z_demo.c
index 5c49d1536..a21e0c01e 100644
--- a/src/code/z_demo.c
+++ b/src/code/z_demo.c
@@ -126,12 +126,11 @@ void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) {
/* Start of command handling section */
// Command 0x96: Miscellaneous commands.
-void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase* cmd) {
+void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
static u16 D_801BB15C = 0xFFFF;
- Player* player = GET_PLAYER(play2);
- PlayState* play = play2;
- u8 isStartFrame = false;
+ Player* player = GET_PLAYER(play);
f32 progress;
+ u8 isStartFrame = false;
SceneTableEntry* loadedScene;
if ((csCtx->frames < cmd->startFrame) || ((csCtx->frames >= cmd->endFrame) && (cmd->endFrame != cmd->startFrame))) {
@@ -346,11 +345,8 @@ void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase*
gSaveContext.save.day = 9;
- {
- GameState* gameState = &play->state;
- gameState->running = false;
- }
- SET_NEXT_GAMESTATE(&play->state, Daytelop_Init, DaytelopContext);
+ STOP_GAMESTATE(&play->state);
+ SET_NEXT_GAMESTATE(&play->state, DayTelop_Init, sizeof(DayTelopState));
Sram_SaveSpecialNewDay(play);
break;
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index 5258c2ecf..5fc51b0c3 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -91,63 +91,76 @@ void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* veloc
void func_800B0DE0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
- EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
+ DUST_UPDATE_NORMAL);
}
void func_800B0E48(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
- EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
+ DUST_UPDATE_NORMAL);
}
void func_800B0EB0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
- EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life,
+ DUST_UPDATE_NORMAL);
}
void func_800B0F18(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
- EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life,
+ DUST_UPDATE_NORMAL);
}
void func_800B0F80(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
- EffectSsDust_Spawn(play, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life,
+ DUST_UPDATE_NORMAL);
}
void func_800B0FE8(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
- EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
+ DUST_UPDATE_FIRE);
}
void func_800B1054(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
- EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
+ DUST_UPDATE_FIRE);
}
static Color_RGBA8 sDustBrownPrim = { 170, 130, 90, 255 };
static Color_RGBA8 sDustBrownEnv = { 100, 60, 20, 255 };
void func_800B10C0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
- EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim,
+ &sDustBrownEnv, 100, 5, 10, DUST_UPDATE_NORMAL);
}
void func_800B1130(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
- EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim,
+ &sDustBrownEnv, 100, 5, 10, DUST_UPDATE_NORMAL);
}
void func_800B11A0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
- EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim,
+ &sDustBrownEnv, scale, scaleStep, 10, DUST_UPDATE_NORMAL);
}
void func_800B1210(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
- EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim,
+ &sDustBrownEnv, scale, scaleStep, 10, DUST_UPDATE_NORMAL);
}
void func_800B1280(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) {
- EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim,
+ &sDustBrownEnv, scale, scaleStep, life, DUST_UPDATE_NORMAL);
}
void func_800B12F0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) {
- EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
+ EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim,
+ &sDustBrownEnv, scale, scaleStep, life, DUST_UPDATE_NORMAL);
}
void func_800B1360(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
@@ -285,7 +298,7 @@ void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Ve
// EffectSsBlast Spawn Functions
void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
- Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life) {
+ Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 scaleStepDecay, s16 life) {
EffectSsBlastInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -295,7 +308,7 @@ void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
Color_RGBA8_Copy(&initParams.envColor, envColor);
initParams.scale = scale;
initParams.scaleStep = scaleStep;
- initParams.sclaeStepDecay = sclaeStepDecay;
+ initParams.scaleStepDecay = scaleStepDecay;
initParams.life = life;
EffectSs_Spawn(play, EFFECT_SS_BLAST, 128, &initParams);
@@ -391,7 +404,7 @@ void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* v
// EffectSsDFire Spawn Functions
void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
- s16 alpha, s16 fadeDelay, s16 arg8, s32 life) {
+ s16 alpha, s16 alphaStep, s16 fadeDelay, s32 life) {
EffectSsDFireInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -400,8 +413,8 @@ void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
initParams.scale = scale;
initParams.scaleStep = scaleStep;
initParams.alpha = alpha;
+ initParams.alphaStep = alphaStep;
initParams.fadeDelay = fadeDelay;
- initParams.unk_2C = arg8;
initParams.life = life;
EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams);
@@ -492,7 +505,7 @@ void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velo
Math_Vec3f_Copy(&initParams.pos, pos);
Math_Vec3f_Copy(&initParams.velocity, velocity);
Math_Vec3f_Copy(&initParams.accel, accel);
- initParams.customColor = 0;
+ initParams.customColor = false;
initParams.colorProfile = colorProfile;
initParams.scale = scale;
initParams.life = life;
@@ -513,7 +526,7 @@ void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* veloc
initParams.scale = scale;
initParams.life = life;
initParams.randXZ = randXZ;
- initParams.customColor = 1;
+ initParams.customColor = true;
EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams);
}
@@ -927,7 +940,7 @@ void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
// EffectSsDeadDb Spawn Functions
void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
- Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk) {
+ Color_RGBA8* env, s16 scale, s16 scaleStep, s32 life) {
EffectSsDeadDbInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
@@ -942,7 +955,7 @@ void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* a
initParams.envColor.r = env->r;
initParams.envColor.g = env->g;
initParams.envColor.b = env->b;
- initParams.unk_30 = unk;
+ initParams.life = life;
EffectSs_Spawn(play, EFFECT_SS_DEAD_DB, 120, &initParams);
}
diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c
index 953648f49..437728f0e 100644
--- a/src/code/z_en_item00.c
+++ b/src/code/z_en_item00.c
@@ -18,6 +18,11 @@ void func_800A6650(EnItem00* this, PlayState* play);
void func_800A6780(EnItem00* this, PlayState* play);
void func_800A6A40(EnItem00* this, PlayState* play);
+void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
+void EnItem00_DrawSprite(EnItem00* this, PlayState* play);
+void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
+void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
+
const ActorInit En_Item00_InitVars = {
ACTOR_EN_ITEM00,
ACTORCAT_MISC,
@@ -102,12 +107,14 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->unk154 = 0.015f;
shadowOffset = 750.0f;
break;
+
case ITEM00_SMALL_KEY:
this->unk150 = 0;
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 350.0f;
break;
+
case ITEM00_HEART_PIECE:
case ITEM00_HEART_CONTAINER:
this->unk150 = 0;
@@ -118,12 +125,14 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
sp30 = -1;
}
break;
+
case ITEM00_RECOVERY_HEART:
- this->actor.home.rot.z = randPlusMinusPoint5Scaled(65535.0f);
+ this->actor.home.rot.z = randPlusMinusPoint5Scaled(0xFFFF);
shadowOffset = 430.0f;
Actor_SetScale(&this->actor, 0.02f);
this->unk154 = 0.02f;
break;
+
case ITEM00_ARROWS_10:
case ITEM00_ARROWS_30:
case ITEM00_ARROWS_40:
@@ -132,6 +141,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->unk154 = 0.035f;
shadowOffset = 250.0f;
break;
+
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
case ITEM00_NUTS_1:
@@ -143,39 +153,47 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->unk154 = 0.03f;
shadowOffset = 320.0f;
break;
+
case ITEM00_MAGIC_LARGE:
- Actor_SetScale(&this->actor, 0.044999998f);
- this->unk154 = 0.044999998f;
+ Actor_SetScale(&this->actor, 4.5f * 0.01f);
+ this->unk154 = 4.5f * 0.01f;
shadowOffset = 320.0f;
break;
+
case ITEM00_RUPEE_HUGE:
- Actor_SetScale(&this->actor, 0.044999998f);
- this->unk154 = 0.044999998f;
+ Actor_SetScale(&this->actor, 4.5f * 0.01f);
+ this->unk154 = 4.5f * 0.01f;
shadowOffset = 750.0f;
break;
+
case ITEM00_RUPEE_PURPLE:
Actor_SetScale(&this->actor, 0.03f);
this->unk154 = 0.03f;
shadowOffset = 750.0f;
break;
+
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
shadowOffset = 500.0f;
Actor_SetScale(&this->actor, 0.01f);
this->unk154 = 0.01f;
break;
+
case ITEM00_SHIELD_HERO:
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2);
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
break;
+
case ITEM00_MAP:
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_MAP);
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
break;
+
case ITEM00_COMPASS:
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_COMPASS);
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
break;
+
default:
break;
}
@@ -191,6 +209,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->unk152 = -1;
return;
}
+
if (sp30 == 0) {
this->actionFunc = func_800A640C;
this->unk152 = -1;
@@ -208,61 +227,78 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
case ITEM00_RUPEE_GREEN:
Item_Give(play, ITEM_RUPEE_GREEN);
break;
+
case ITEM00_RUPEE_BLUE:
Item_Give(play, ITEM_RUPEE_BLUE);
break;
+
case ITEM00_RUPEE_RED:
Item_Give(play, ITEM_RUPEE_RED);
break;
+
case ITEM00_RUPEE_PURPLE:
Item_Give(play, ITEM_RUPEE_PURPLE);
break;
+
case ITEM00_RUPEE_HUGE:
Item_Give(play, ITEM_RUPEE_HUGE);
break;
+
case ITEM00_RECOVERY_HEART:
Item_Give(play, ITEM_RECOVERY_HEART);
break;
+
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
Health_ChangeBy(play, 0x70);
break;
+
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(play, ITEM_BOMBS_5);
break;
+
case ITEM00_ARROWS_10:
Item_Give(play, ITEM_ARROWS_10);
break;
+
case ITEM00_ARROWS_30:
Item_Give(play, ITEM_ARROWS_30);
break;
+
case ITEM00_ARROWS_40:
Item_Give(play, ITEM_ARROWS_40);
break;
+
case ITEM00_ARROWS_50:
Item_Give(play, ITEM_ARROWS_50);
break;
+
case ITEM00_MAGIC_LARGE:
Item_Give(play, ITEM_MAGIC_LARGE);
break;
+
case ITEM00_MAGIC_SMALL:
Item_Give(play, ITEM_MAGIC_SMALL);
break;
+
case ITEM00_SMALL_KEY:
Item_Give(play, ITEM_KEY_SMALL);
break;
+
case ITEM00_NUTS_1:
getItemId = GI_NUTS_1;
break;
+
case ITEM00_NUTS_10:
getItemId = GI_NUTS_10;
break;
+
default:
break;
}
- if ((getItemId != GI_NONE) && (Actor_HasParent(&this->actor, play) == 0)) {
+ if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) {
Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f);
}
@@ -277,11 +313,10 @@ void EnItem00_Destroy(Actor* thisx, PlayState* play) {
}
void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play) {
- s32 sp1C;
+ s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS);
- sp1C = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS);
- if (Object_IsLoaded(&play->objectCtx, sp1C)) {
- this->actor.objBankIndex = sp1C;
+ if (Object_IsLoaded(&play->objectCtx, objBankIndex)) {
+ this->actor.objBankIndex = objBankIndex;
this->actionFunc = func_800A640C;
}
}
@@ -327,15 +362,15 @@ void func_800A640C(EnItem00* this, PlayState* play) {
}
}
- if ((this->actor.gravity != 0.0f) && ((this->actor.bgCheckFlags & 1) == 0)) {
+ if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 1)) {
this->actionFunc = func_800A6650;
}
}
-static Color_RGBA8 D_801ADF10 = { 255, 255, 127, 0 };
-static Color_RGBA8 D_801ADF14 = { 255, 255, 255, 0 };
-static Vec3f D_801ADF18 = { 0.0f, 0.1f, 0.0f };
-static Vec3f D_801ADF24 = { 0.0f, 0.01f, 0.0f };
+static Color_RGBA8 sEffectPrimColor = { 255, 255, 127, 0 };
+static Color_RGBA8 sEffectEnvColor = { 255, 255, 255, 0 };
+static Vec3f sEffectVelocity = { 0.0f, 0.1f, 0.0f };
+static Vec3f sEffectAccel = { 0.0f, 0.01f, 0.0f };
void func_800A6650(EnItem00* this, PlayState* play) {
u32 pad;
@@ -344,20 +379,21 @@ void func_800A6650(EnItem00* this, PlayState* play) {
if (this->actor.params <= ITEM00_RUPEE_RED) {
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
}
+
if ((play->gameplayFrames & 1) != 0) {
pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(10.0f);
pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(10.0f);
pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(10.0f);
- EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
+ EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
}
- if ((this->actor.bgCheckFlags & 3) != 0) {
+
+ if (this->actor.bgCheckFlags & 3) {
if (this->actor.velocity.y > -2.0f) {
this->actionFunc = func_800A640C;
- return;
+ } else {
+ this->actor.velocity.y = this->actor.velocity.y * -0.8f;
+ this->actor.bgCheckFlags &= ~1;
}
-
- this->actor.velocity.y = this->actor.velocity.y * -0.8f;
- this->actor.bgCheckFlags = this->actor.bgCheckFlags & 0xFFFE;
}
}
@@ -384,18 +420,18 @@ void func_800A6780(EnItem00* this, PlayState* play) {
}
if (this->actor.params <= ITEM00_RUPEE_RED) {
- this->actor.shape.rot.y += 960;
+ this->actor.shape.rot.y += 0x3C0;
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) &&
(this->actor.params != ITEM00_BOMBS_0)) {
- this->actor.world.rot.x -= 700;
- this->actor.shape.rot.y += 400;
+ this->actor.world.rot.x -= 0x2BC;
+ this->actor.shape.rot.y += 0x190;
this->actor.shape.rot.x = this->actor.world.rot.x - 0x4000;
}
if (this->actor.velocity.y <= 2.0f) {
- var1 = (u16)this->actor.shape.rot.z + 10000;
- if (var1 < 65535) {
- this->actor.shape.rot.z += 10000;
+ var1 = (u16)this->actor.shape.rot.z + 0x2710;
+ if (var1 < 0xFFFF) {
+ this->actor.shape.rot.z += 0x2710;
} else {
this->actor.shape.rot.z = -1;
}
@@ -405,10 +441,10 @@ void func_800A6780(EnItem00* this, PlayState* play) {
pos.x = this->actor.world.pos.x + ((Rand_ZeroOne() - 0.5f) * 10.0f);
pos.y = this->actor.world.pos.y + ((Rand_ZeroOne() - 0.5f) * 10.0f);
pos.z = this->actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 10.0f);
- EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
+ EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
}
- if (this->actor.bgCheckFlags & 0x0003) {
+ if (this->actor.bgCheckFlags & 3) {
this->actionFunc = func_800A640C;
this->actor.shape.rot.z = 0;
this->actor.speedXZ = 0.0f;
@@ -419,7 +455,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->getItemId != GI_NONE) {
- if (Actor_HasParent(&this->actor, play) == 0) {
+ if (!Actor_HasParent(&this->actor, play)) {
Actor_PickUp(&this->actor, play, this->getItemId, 50.0f, 80.0f);
this->unk152++;
} else {
@@ -435,7 +471,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
this->actor.world.pos = player->actor.world.pos;
if (this->actor.params <= ITEM00_RUPEE_RED) {
- this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
+ this->actor.shape.rot.y += 0x3C0;
} else if (this->actor.params == ITEM00_RECOVERY_HEART) {
this->actor.shape.rot.y = 0;
}
@@ -443,7 +479,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
this->actor.world.pos.y += (40.0f + (Math_SinS(this->unk152 * 15000) * (this->unk152 * 0.3f)));
if (LINK_IS_ADULT) {
- this->actor.world.pos.y = this->actor.world.pos.y + 20.0f;
+ this->actor.world.pos.y += 20.0f;
}
}
@@ -509,78 +545,101 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
this->unk1A4 = 1;
Item_Give(play, ITEM_RUPEE_GREEN);
break;
+
case ITEM00_RUPEE_BLUE:
this->unk1A4 = 1;
Item_Give(play, ITEM_RUPEE_BLUE);
break;
+
case ITEM00_RUPEE_RED:
this->unk1A4 = 1;
Item_Give(play, ITEM_RUPEE_RED);
break;
+
case ITEM00_RUPEE_PURPLE:
this->unk1A4 = 1;
Item_Give(play, ITEM_RUPEE_PURPLE);
break;
+
case ITEM00_RUPEE_HUGE:
this->unk1A4 = 1;
Item_Give(play, ITEM_RUPEE_HUGE);
break;
+
case ITEM00_STICK:
getItemId = GI_STICKS_1;
break;
+
case ITEM00_NUTS_1:
getItemId = GI_NUTS_1;
break;
+
case ITEM00_NUTS_10:
getItemId = GI_NUTS_10;
break;
+
case ITEM00_RECOVERY_HEART:
Item_Give(play, ITEM_RECOVERY_HEART);
break;
+
case ITEM00_FLEXIBLE:
case ITEM00_BIG_FAIRY:
Health_ChangeBy(play, 0x70);
break;
+
case ITEM00_BOMBS_A:
case ITEM00_BOMBS_B:
Item_Give(play, ITEM_BOMBS_5);
break;
+
case ITEM00_ARROWS_10:
Item_Give(play, ITEM_ARROWS_10);
break;
+
case ITEM00_ARROWS_30:
Item_Give(play, ITEM_ARROWS_30);
break;
+
case ITEM00_ARROWS_40:
Item_Give(play, ITEM_ARROWS_40);
break;
+
case ITEM00_ARROWS_50:
Item_Give(play, ITEM_ARROWS_50);
break;
+
case ITEM00_SMALL_KEY:
getItemId = GI_KEY_SMALL;
break;
+
case ITEM00_HEART_PIECE:
getItemId = GI_HEART_PIECE;
break;
+
case ITEM00_HEART_CONTAINER:
getItemId = GI_HEART_CONTAINER;
break;
+
case ITEM00_MAGIC_LARGE:
Item_Give(play, ITEM_MAGIC_LARGE);
break;
+
case ITEM00_MAGIC_SMALL:
Item_Give(play, ITEM_MAGIC_SMALL);
break;
+
case ITEM00_SHIELD_HERO:
getItemId = GI_SHIELD_HERO;
break;
+
case ITEM00_MAP:
getItemId = GI_MAP;
break;
+
case ITEM00_COMPASS:
getItemId = GI_COMPASS;
break;
+
default:
break;
}
@@ -603,6 +662,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
Actor_MarkForDeath(&this->actor);
}
return;
+
default:
break;
}
@@ -634,11 +694,6 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
this->actionFunc = func_800A6A40;
}
-void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
-void EnItem00_DrawSprite(EnItem00* this, PlayState* play);
-void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
-void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
-
void EnItem00_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnItem00* this = THIS;
@@ -652,16 +707,20 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
case ITEM00_RUPEE_PURPLE:
EnItem00_DrawRupee(this, play);
break;
+
case ITEM00_HEART_PIECE:
EnItem00_DrawHeartPiece(this, play);
break;
+
case ITEM00_HEART_CONTAINER:
EnItem00_DrawHeartContainer(this, play);
break;
+
case ITEM00_RECOVERY_HEART:
if (this->unk152 < 0) {
if (this->unk152 == -1) {
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
+
if (Object_IsLoaded(&play->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
Actor_SetObjectDependency(play, &this->actor);
@@ -673,6 +732,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
}
break;
}
+ // fallthrough
case ITEM00_BOMBS_A:
case ITEM00_ARROWS_10:
case ITEM00_ARROWS_30:
@@ -688,14 +748,19 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
case ITEM00_BOMBS_0:
EnItem00_DrawSprite(this, play);
break;
+
case ITEM00_SHIELD_HERO:
GetItem_Draw(play, GID_SHIELD_HERO);
break;
+
case ITEM00_MAP:
GetItem_Draw(play, GID_DUNGEON_MAP);
break;
+
case ITEM00_COMPASS:
GetItem_Draw(play, GID_COMPASS);
+ break;
+
case ITEM00_MASK:
case ITEM00_FLEXIBLE:
case ITEM00_3_HEARTS:
@@ -706,17 +771,13 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
}
}
-TexturePtr D_801ADF30[] = {
- gameplay_keep_Tex_061FC0, // Green rupee
- gameplay_keep_Tex_061FE0, // Blue rupee
- gameplay_keep_Tex_062000, // Red rupee
- gameplay_keep_Tex_062040, // Orange rupee
- gameplay_keep_Tex_062020 // Purple rupee
+static TexturePtr sRupeeTextures[] = {
+ gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeeOrangeTex, gRupeePurpleTex,
};
void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
s32 pad;
- s32 iconNb;
+ s32 texIndex;
OPEN_DISPS(play->state.gfxCtx);
@@ -724,67 +785,66 @@ void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
func_800B8050(&this->actor, play, 0);
if (this->actor.params <= ITEM00_RUPEE_RED) {
- iconNb = this->actor.params;
+ texIndex = this->actor.params;
} else {
- iconNb = this->actor.params - 0x10;
+ texIndex = this->actor.params - 0x10;
}
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF30[iconNb]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTextures[texIndex]));
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); // TODO symbol
+ gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
CLOSE_DISPS(play->state.gfxCtx);
}
-TexturePtr D_801ADF44[12] = {
- gameplay_keep_Tex_05E6F0, // Heart (Not used)
- gameplay_keep_Tex_05CEF0, // Bombs (A), Bombs (0)
- gameplay_keep_Tex_05BEF0, // Arrows (10)
- gameplay_keep_Tex_05B6F0, // Arrows (30)
- gameplay_keep_Tex_05C6F0, // Arrows (40), Arrows (50)
- gameplay_keep_Tex_05CEF0, // Bombs (B)
- gameplay_keep_Tex_0607C0, // Nuts (1), Nuts (10)
- gameplay_keep_Tex_060FC0, // Sticks (1)
- gameplay_keep_Tex_0617C0, // Magic (Large)
- gameplay_keep_Tex_05FFC0, // Magic (Small)
+TexturePtr sItemDropTextures[] = {
+ gDropRecoveryHeartTex, // Heart (Not used)
+ gDropBombTex, // Bombs (A), Bombs (0)
+ gDropArrows1Tex, // Arrows (10)
+ gDropArrows2Tex, // Arrows (30)
+ gDropArrows3Tex, // Arrows (40), Arrows (50)
+ gDropBombTex, // Bombs (B)
+ gDropDekuNutTex, // Nuts (1), Nuts (10)
+ gDropDekuStickTex, // Sticks (1)
+ gDropMagicLargeTex, // Magic (Large)
+ gDropMagicSmallTex, // Magic (Small)
NULL,
- gameplay_keep_Tex_05F7C0 // Small Key
+ gDropKeySmallTex // Small Key
};
void EnItem00_DrawSprite(EnItem00* this, PlayState* play) {
- s32 iconNb = this->actor.params - 3;
+ s32 texIndex = this->actor.params - 3;
OPEN_DISPS(play->state.gfxCtx);
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
if (this->actor.params == ITEM00_NUTS_10) {
- iconNb = 6;
+ texIndex = 6;
} else if (this->actor.params == ITEM00_BOMBS_0) {
- iconNb = 1;
+ texIndex = 1;
} else if (this->actor.params >= ITEM00_ARROWS_30) {
- iconNb -= 3;
+ texIndex -= 3;
if (this->actor.params < ITEM00_ARROWS_50) {
- iconNb++;
+ texIndex++;
}
}
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF44[iconNb]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sItemDropTextures[texIndex]));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
+ gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
CLOSE_DISPS(play->state.gfxCtx);
}
void EnItem00_DrawHeartContainer(EnItem00* actor, PlayState* play) {
- s32 pad;
- s32 pad2;
+ s32 pad[2];
if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) {
OPEN_DISPS(play->state.gfxCtx);
@@ -811,7 +871,7 @@ void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
- gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_05AAB0);
+ gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -893,7 +953,7 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) {
}
spawnedActor->speedXZ = 2.0f;
spawnedActor->gravity = -0.9f;
- spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(65536.0f);
+ spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000);
Actor_SetScale(spawnedActor, 0.0f);
((EnItem00*)spawnedActor)->actionFunc = func_800A6780;
((EnItem00*)spawnedActor)->unk152 = 0xDC;
@@ -948,7 +1008,7 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) {
} else {
spawnedActor->gravity = -0.9f;
}
- spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(65536.0f);
+ spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000);
spawnedActor->flags |= 0x10;
}
}
diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c
index a79c732d8..11d390a28 100644
--- a/src/code/z_game_dlftbls.c
+++ b/src/code/z_game_dlftbls.c
@@ -4,6 +4,7 @@
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "overlays/gamestates/ovl_select/z_select.h"
#include "overlays/gamestates/ovl_title/z_title.h"
+#include "z_title_setup.h"
#define GAMESTATE_OVERLAY(name, init, destroy, size) \
{ \
@@ -14,13 +15,13 @@
{ NULL, 0, 0, NULL, NULL, 0, init, destroy, 0, 0, 0, size }
GameStateOverlay gGameStateOverlayTable[] = {
- GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
+ GAMESTATE_OVERLAY_INTERNAL(Setup_Init, Setup_Destroy, sizeof(SetupState)),
GAMESTATE_OVERLAY(select, MapSelect_Init, MapSelect_Destroy, sizeof(MapSelectState)),
- GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
+ GAMESTATE_OVERLAY(title, ConsoleLogo_Init, ConsoleLogo_Destroy, sizeof(ConsoleLogoState)),
GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)),
- GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
- GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)),
- GAMESTATE_OVERLAY(daytelop, Daytelop_Init, Daytelop_Destroy, sizeof(DaytelopContext)),
+ GAMESTATE_OVERLAY(opening, TitleSetup_Init, TitleSetup_Destroy, sizeof(TitleSetupState)),
+ GAMESTATE_OVERLAY(file_choose, FileSelect_Init, FileSelect_Destroy, sizeof(FileSelectState)),
+ GAMESTATE_OVERLAY(daytelop, DayTelop_Init, DayTelop_Destroy, sizeof(DayTelopState)),
};
s32 graphNumGameStates = ARRAY_COUNT(gGameStateOverlayTable);
diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c
index 44c6c9ba1..d189abaf4 100644
--- a/src/code/z_kaleido_setup.c
+++ b/src/code/z_kaleido_setup.c
@@ -78,7 +78,8 @@ void KaleidoSetup_Update(PlayState* play) {
if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) &&
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & 0x20)) {
- if (!(play->actorCtx.unk5 & 2) && !(play->actorCtx.unk5 & 4)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
+ !(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
gSaveContext.prevHudVisibility = gSaveContext.hudVisibility;
pauseCtx->unk_2B9 = 0;
@@ -138,7 +139,7 @@ void KaleidoSetup_Init(PlayState* play) {
pauseCtx->unk_2A0 = -1;
pauseCtx->unk_2BA = 320;
pauseCtx->unk_2BC = 40;
- pauseCtx->unk_29E = 100;
+ pauseCtx->promptAlpha = 100;
View_Init(&pauseCtx->view, play->state.gfxCtx);
}
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index 83df398b6..6ff0d45e5 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -2102,7 +2102,7 @@ void func_80111CB4(PlayState* play) {
}
} else if (D_801BF884 != 0) {
if (D_801BF884 == 1) {
- if (!(play->actorCtx.unk5 & 4)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
func_801663C4((play->unk_18E5C != NULL) ? play->unk_18E5C : D_801FBB90,
(u8*)((void)0, gSaveContext.pictoPhoto), 0x4600);
interfaceCtx->unk_224 = 0;
@@ -2110,7 +2110,7 @@ void func_80111CB4(PlayState* play) {
sp28 = true;
D_801BF884 = 0;
} else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) {
- play->actorCtx.unk5 &= ~4;
+ play->actorCtx.flags &= ~ACTORCTX_FLAG_2;
interfaceCtx->unk_224 = 0;
interfaceCtx->unk_222 = interfaceCtx->unk_224;
sp28 = true;
@@ -2146,7 +2146,7 @@ void func_80111CB4(PlayState* play) {
(u8*)((void)0, gSaveContext.pictoPhoto), 0x4600);
Snap_RecordPictographedActors(play);
}
- play->actorCtx.unk5 &= ~4;
+ play->actorCtx.flags &= ~ACTORCTX_FLAG_2;
SET_QUEST_ITEM(QUEST_PICTOGRAPH);
D_801BF888 = false;
}
@@ -2163,7 +2163,7 @@ void func_80111CB4(PlayState* play) {
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.unk5 & 4) {
+ } else if (play->actorCtx.flags & ACTORCTX_FLAG_2) {
if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) {
func_80115844(play, 0x12);
Interface_SetHudVisibility(HUD_VISIBILITY_A_B);
@@ -4240,8 +4240,9 @@ void Interface_DrawClock(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
if (REG(15) != 0) {
- if ((msgCtx->msgMode == 0) || ((play->actorCtx.unk5 & 2) && !Play_InCsMode(play)) || (msgCtx->msgMode == 0) ||
- ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) || (gSaveContext.gameMode == 3)) {
+ 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)) {
if (!FrameAdvance_IsEnabled(&play->state)) {
if (func_800FE4A8() == 0) {
if (((void)0, gSaveContext.save.day) < 4) {
@@ -4264,7 +4265,7 @@ void Interface_DrawClock(PlayState* play) {
D_801BFB30 = 0;
}
} else {
- if (play->actorCtx.unk5 & 2) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
D_801BFB2C = 255;
} else {
D_801BFB2C = interfaceCtx->bAlpha;
@@ -4273,7 +4274,7 @@ void Interface_DrawClock(PlayState* play) {
D_801BFB30 = 0;
}
} else {
- if (play->actorCtx.unk5 & 2) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
D_801BFB2C = 255;
} else {
D_801BFB2C = interfaceCtx->bAlpha;
@@ -5193,7 +5194,7 @@ void Interface_DrawMinigamePerfect(PlayState* play) {
}
void Interface_StartMoonCrash(PlayState* play) {
- if (play->actorCtx.unk5 & 2) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
Audio_QueueSeqCmd(0xE0000100);
}
@@ -6234,7 +6235,7 @@ void Interface_Draw(PlayState* play) {
}
if (D_801BF884 >= 2) {
- if (!(play->actorCtx.unk5 & 4)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
func_801663C4((play->unk_18E5C != NULL) ? play->unk_18E5C : D_801FBB90, (u8*)gSaveContext.pictoPhoto,
0x4600);
diff --git a/src/code/z_play.c b/src/code/z_play.c
index c24a45b51..346f34692 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -345,16 +345,16 @@ void Play_SaveCycleSceneFlags(GameState* thisx) {
CycleSceneFlags* cycleSceneFlags;
cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(this->sceneNum)];
- cycleSceneFlags->chest = this->actorCtx.flags.chest;
- cycleSceneFlags->switch0 = this->actorCtx.flags.switches[0];
- cycleSceneFlags->switch1 = this->actorCtx.flags.switches[1];
+ cycleSceneFlags->chest = this->actorCtx.sceneFlags.chest;
+ cycleSceneFlags->switch0 = this->actorCtx.sceneFlags.switches[0];
+ cycleSceneFlags->switch1 = this->actorCtx.sceneFlags.switches[1];
if (this->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple
cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneNum];
}
- cycleSceneFlags->collectible = this->actorCtx.flags.collectible[0];
- cycleSceneFlags->clearedRoom = this->actorCtx.flags.clearedRoom;
+ cycleSceneFlags->collectible = this->actorCtx.sceneFlags.collectible[0];
+ cycleSceneFlags->clearedRoom = this->actorCtx.sceneFlags.clearedRoom;
}
void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 roomIndex, s32 playerParams, Vec3f* pos,
@@ -366,9 +366,9 @@ void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 ro
gSaveContext.respawn[respawnMode].pos = *pos;
gSaveContext.respawn[respawnMode].yaw = yaw;
gSaveContext.respawn[respawnMode].playerParams = playerParams;
- gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.flags.switches[2];
- gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.flags.collectible[1];
- gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.flags.collectible[2];
+ gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.sceneFlags.switches[2];
+ gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.sceneFlags.collectible[1];
+ gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.sceneFlags.collectible[2];
}
void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) {
@@ -395,9 +395,9 @@ void func_80169ECC(PlayState* this) {
void func_80169EFC(GameState* thisx) {
PlayState* this = (PlayState*)thisx;
- gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2];
- gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1];
- gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2];
+ gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.sceneFlags.switches[2];
+ gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.sceneFlags.collectible[1];
+ gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.sceneFlags.collectible[2];
this->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance;
gSaveContext.respawnFlag = 1;
func_80169ECC(this);
diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c
index 0e9c435c6..e0381153a 100644
--- a/src/code/z_prenmi.c
+++ b/src/code/z_prenmi.c
@@ -1,23 +1,22 @@
-#include "global.h"
+#include "z_prenmi.h"
-void PreNMI_Stop(PreNMIContext* prenmiCtx) {
- prenmiCtx->state.running = 0;
- prenmiCtx->state.nextGameStateInit = NULL;
- prenmiCtx->state.nextGameStateSize = 0;
+void PreNMI_Stop(PreNMIState* this) {
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, NULL, 0);
}
-void PreNMI_Update(PreNMIContext* prenmiCtx) {
- if (prenmiCtx->timer == 0) {
+void PreNMI_Update(PreNMIState* this) {
+ if (this->timer == 0) {
ViConfig_UpdateVi(1);
- PreNMI_Stop(prenmiCtx);
+ PreNMI_Stop(this);
return;
}
- prenmiCtx->timer--;
+ this->timer--;
}
-void PreNMI_Draw(PreNMIContext* prenmiCtx) {
- GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx;
+void PreNMI_Draw(PreNMIState* this) {
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
func_8012CF0C(gfxCtx, true, true, 0, 0, 0);
@@ -26,26 +25,30 @@ void PreNMI_Draw(PreNMIContext* prenmiCtx) {
func_8012C470(gfxCtx);
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1));
- gDPFillRectangle(POLY_OPA_DISP++, 0, prenmiCtx->timer + 100, SCREEN_WIDTH - 1, prenmiCtx->timer + 100);
+ gDPFillRectangle(POLY_OPA_DISP++, 0, this->timer + 100, SCREEN_WIDTH - 1, this->timer + 100);
CLOSE_DISPS(gfxCtx);
}
-void PreNMI_Main(PreNMIContext* prenmiCtx) {
- PreNMI_Update(prenmiCtx);
- PreNMI_Draw(prenmiCtx);
+void PreNMI_Main(GameState* thisx) {
+ PreNMIState* this = (PreNMIState*)thisx;
- prenmiCtx->state.unk_A3 = 1;
+ PreNMI_Update(this);
+ PreNMI_Draw(this);
+
+ this->state.unk_A3 = 1;
}
-void PreNMI_Destroy(PreNMIContext* prenmiCtx) {
+void PreNMI_Destroy(GameState* thisx) {
}
-void PreNMI_Init(PreNMIContext* prenmiCtx) {
- prenmiCtx->state.main = (GameStateFunc)PreNMI_Main;
- prenmiCtx->state.destroy = (GameStateFunc)PreNMI_Destroy;
- prenmiCtx->timer = 30;
- prenmiCtx->unkA8 = 10;
+void PreNMI_Init(GameState* thisx) {
+ PreNMIState* this = (PreNMIState*)thisx;
- Game_SetFramerateDivisor(&prenmiCtx->state, 1);
+ this->state.main = PreNMI_Main;
+ this->state.destroy = PreNMI_Destroy;
+ this->timer = 30;
+ this->unkA8 = 10;
+
+ Game_SetFramerateDivisor(&this->state, 1);
}
diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c
index 018cf12d7..8c1617ccf 100644
--- a/src/code/z_sram_NES.c
+++ b/src/code/z_sram_NES.c
@@ -267,11 +267,11 @@ void Sram_SaveEndOfCycle(PlayState* play) {
sceneNum = Play_GetOriginalSceneNumber(play->sceneNum);
Play_SaveCycleSceneFlags(&play->state);
- play->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2];
- play->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0];
- play->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1];
- play->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3];
- play->actorCtx.flags.clearedRoom = 0;
+ play->actorCtx.sceneFlags.chest &= D_801C5FC0[sceneNum][2];
+ play->actorCtx.sceneFlags.switches[0] &= D_801C5FC0[sceneNum][0];
+ play->actorCtx.sceneFlags.switches[1] &= D_801C5FC0[sceneNum][1];
+ play->actorCtx.sceneFlags.collectible[0] &= D_801C5FC0[sceneNum][3];
+ play->actorCtx.sceneFlags.clearedRoom = 0;
for (i = 0; i < SCENE_MAX; i++) {
gSaveContext.cycleSceneFlags[i].switch0 = ((void)0, gSaveContext.cycleSceneFlags[i].switch0) & D_801C5FC0[i][0];
@@ -918,7 +918,7 @@ u16 D_801C6A58[] = {
ENTRANCE(IKANA_CANYON, 4), ENTRANCE(STONE_TOWER, 3),
};
-void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
+void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) {
s32 i;
s32 pad;
s32 phi_t1;
@@ -930,7 +930,7 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
if (gSaveContext.fileNum == 0xFF) {
func_80185968(sramCtx->saveBuf, D_801C67C8[0], D_801C67F0[0]);
- } else if (fileChooseCtx->unk_2446A[gSaveContext.fileNum] != 0) {
+ } else if (fileSelect->unk_2446A[gSaveContext.fileNum] != 0) {
phi_t1 = gSaveContext.fileNum + 2;
phi_t1 *= 2;
@@ -1079,8 +1079,8 @@ void func_80145698(SramContext* sramCtx) {
// Verifies save and use backup if corrupted?
#ifdef NON_EQUIVALENT
-void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
- FileChooseContext* fileChooseCtx = fileChooseCtx2;
+void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) {
+ FileSelectState* fileSelect = fileSelect2;
u16 sp7A;
// u16 sp78;
u16 sp76;
@@ -1119,7 +1119,7 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
}
if (sp76 < 2) {
- fileChooseCtx->unk_24468[sp76] = 0;
+ fileSelect->unk_24468[sp76] = 0;
if (phi_s2) {
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]);
@@ -1157,34 +1157,33 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed?
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) {
- fileChooseCtx->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
+ fileSelect->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
}
- if (!CHECK_NEWF(fileChooseCtx->newf[sp76])) {
- fileChooseCtx->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
+ if (!CHECK_NEWF(fileSelect->newf[sp76])) {
+ fileSelect->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) {
- fileChooseCtx->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
+ fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
}
- fileChooseCtx->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity;
- fileChooseCtx->health[sp76] = gSaveContext.save.playerData.health;
- fileChooseCtx->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts;
- fileChooseCtx->unk_24444[sp76] = gSaveContext.save.inventory.questItems;
- fileChooseCtx->unk_24458[sp76] = gSaveContext.save.time;
- fileChooseCtx->unk_24460[sp76] = gSaveContext.save.day;
- fileChooseCtx->unk_24468[sp76] = gSaveContext.save.isOwlSave;
- fileChooseCtx->rupees[sp76] = gSaveContext.save.playerData.rupees;
- fileChooseCtx->unk_24474[sp76] = CUR_UPG_VALUE(4);
+ 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->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->unk_24474[sp76] = CUR_UPG_VALUE(4);
for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) {
if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) {
phi_a0++;
}
}
- fileChooseCtx->maskCount[sp76] = phi_a0;
- fileChooseCtx->heartPieceCount[sp76] =
- ((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C);
+ fileSelect->maskCount[sp76] = phi_a0;
+ fileSelect->heartPieceCount[sp76] = ((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C);
}
if (sp6E == 1) {
@@ -1209,9 +1208,9 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
}
}
} else if (sp76 < 4) {
- fileChooseCtx->unk_24468[sp76] = 0;
+ fileSelect->unk_24468[sp76] = 0;
- if (!CHECK_NEWF(fileChooseCtx->newf2[(s32)sp76])) { // TODO: Needed?
+ if (!CHECK_NEWF(fileSelect->newf2[(s32)sp76])) { // TODO: Needed?
if (phi_s2) {
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf,
@@ -1251,34 +1250,34 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed?
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) {
- fileChooseCtx->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
+ fileSelect->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
}
- if (!CHECK_NEWF(fileChooseCtx->newf[sp76])) {
- fileChooseCtx->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
+ if (!CHECK_NEWF(fileSelect->newf[sp76])) {
+ fileSelect->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) {
phi_s2 += 0; // TODO: Needed?
- fileChooseCtx->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
+ fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
}
- fileChooseCtx->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity;
- fileChooseCtx->health[sp76] = gSaveContext.save.playerData.health;
- fileChooseCtx->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts;
- fileChooseCtx->unk_24444[sp76] = gSaveContext.save.inventory.questItems;
- fileChooseCtx->unk_24458[sp76] = gSaveContext.save.time;
- fileChooseCtx->unk_24460[sp76] = gSaveContext.save.day;
- fileChooseCtx->unk_24468[sp76] = gSaveContext.save.isOwlSave;
- fileChooseCtx->rupees[sp76] = gSaveContext.save.playerData.rupees;
- fileChooseCtx->unk_24474[sp76] = CUR_UPG_VALUE(4);
+ 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->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->unk_24474[sp76] = CUR_UPG_VALUE(4);
for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) {
if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) {
phi_a0++;
}
}
- fileChooseCtx->maskCount[sp76] = phi_a0;
- fileChooseCtx->heartPieceCount[sp76] =
+ fileSelect->maskCount[sp76] = phi_a0;
+ fileSelect->heartPieceCount[sp76] =
((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C);
}
@@ -1342,14 +1341,14 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_801457CC.s")
#endif
-void func_80146580(FileChooseContext* fileChooseCtx2, SramContext* sramCtx, s32 fileNum) {
- FileChooseContext* fileChooseCtx = fileChooseCtx2;
+void func_80146580(FileSelectState* fileSelect2, SramContext* sramCtx, s32 fileNum) {
+ FileSelectState* fileSelect = fileSelect2;
s32 pad;
if (gSaveContext.unk_3F3F) {
- if (fileChooseCtx->unk_2446A[fileNum]) {
+ if (fileSelect->unk_2446A[fileNum]) {
func_80147314(sramCtx, fileNum);
- fileChooseCtx->unk_2446A[fileNum] = 0;
+ fileSelect->unk_2446A[fileNum] = 0;
}
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save));
@@ -1361,30 +1360,30 @@ void func_80146580(FileChooseContext* fileChooseCtx2, SramContext* sramCtx, s32
#ifdef NON_MATCHING
// v0/v1
-void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
- FileChooseContext* fileChooseCtx = fileChooseCtx2;
+void func_80146628(FileSelectState* fileSelect2, SramContext* sramCtx) {
+ FileSelectState* fileSelect = fileSelect2;
u16 i;
s16 maskCount;
if (gSaveContext.unk_3F3F) {
- if (fileChooseCtx->unk_2446A[fileChooseCtx->unk_2448E]) {
- func_80147414(sramCtx, fileChooseCtx->unk_2448E, fileChooseCtx->fileNum);
- fileChooseCtx->unk_24410[fileChooseCtx->fileNum] = gSaveContext.save.playerData.deaths;
+ if (fileSelect->unk_2446A[fileSelect->unk_2448E]) {
+ func_80147414(sramCtx, fileSelect->unk_2448E, fileSelect->fileNum);
+ fileSelect->unk_24410[fileSelect->fileNum] = gSaveContext.save.playerData.deaths;
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) {
- fileChooseCtx->unk_24424[fileChooseCtx->fileNum][i] = gSaveContext.save.playerData.playerName[i];
+ fileSelect->unk_24424[fileSelect->fileNum][i] = gSaveContext.save.playerData.playerName[i];
}
- fileChooseCtx->unk_24438[fileChooseCtx->fileNum] = gSaveContext.save.playerData.healthCapacity;
- fileChooseCtx->unk_24440[fileChooseCtx->fileNum] = gSaveContext.save.playerData.health;
- fileChooseCtx->unk_24456[fileChooseCtx->fileNum] = gSaveContext.save.inventory.defenseHearts;
- fileChooseCtx->unk_2444C[fileChooseCtx->fileNum] = gSaveContext.save.inventory.questItems;
- fileChooseCtx->unk_2445C[fileChooseCtx->fileNum] = gSaveContext.save.time;
- fileChooseCtx->unk_24464[fileChooseCtx->fileNum] = gSaveContext.save.day;
- fileChooseCtx->unk_2446A[fileChooseCtx->fileNum] = gSaveContext.save.isOwlSave;
- fileChooseCtx->unk_24470[fileChooseCtx->fileNum] = gSaveContext.save.playerData.rupees;
+ 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_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;
// = CUR_UPG_VALUE(UPG_WALLET);
- fileChooseCtx->unk_24476[fileChooseCtx->fileNum] =
+ fileSelect->unk_24476[fileSelect->fileNum] =
(gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4];
for (i = 0, maskCount = 0; i < 24; i++) {
@@ -1393,41 +1392,39 @@ void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
}
}
- fileChooseCtx->unk_2447A[fileChooseCtx->fileNum] = maskCount;
- fileChooseCtx->unk_2447E[fileChooseCtx->fileNum] =
- (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
+ fileSelect->unk_2447A[fileSelect->fileNum] = maskCount;
+ fileSelect->unk_2447E[fileSelect->fileNum] = (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
}
// clear buffer
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
// read to buffer
- func_80185968(sramCtx->saveBuf, D_801C67C8[fileChooseCtx->unk_2448E * 2],
- D_801C67F0[fileChooseCtx->unk_2448E * 2]);
+ func_80185968(sramCtx->saveBuf, D_801C67C8[fileSelect->unk_2448E * 2], D_801C67F0[fileSelect->unk_2448E * 2]);
if (1) {}
- func_80185968(&sramCtx->saveBuf[0x2000], D_801C67C8[fileChooseCtx->unk_2448E * 2 + 1],
- D_801C67F0[fileChooseCtx->unk_2448E * 2 + 1]);
+ func_80185968(&sramCtx->saveBuf[0x2000], D_801C67C8[fileSelect->unk_2448E * 2 + 1],
+ D_801C67F0[fileSelect->unk_2448E * 2 + 1]);
if (1) {}
// copy buffer to save context
Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save));
- fileChooseCtx->unk_2440C[fileChooseCtx->fileNum] = gSaveContext.save.playerData.deaths;
+ fileSelect->unk_2440C[fileSelect->fileNum] = gSaveContext.save.playerData.deaths;
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) {
- fileChooseCtx->unk_24414[fileChooseCtx->fileNum][i] = gSaveContext.save.playerData.playerName[i];
+ fileSelect->unk_24414[fileSelect->fileNum][i] = gSaveContext.save.playerData.playerName[i];
}
- fileChooseCtx->healthCapacity[fileChooseCtx->fileNum] = gSaveContext.save.playerData.healthCapacity;
- fileChooseCtx->health[fileChooseCtx->fileNum] = gSaveContext.save.playerData.health;
- fileChooseCtx->unk_24454[fileChooseCtx->fileNum] = gSaveContext.save.inventory.defenseHearts;
- fileChooseCtx->unk_24444[fileChooseCtx->fileNum] = gSaveContext.save.inventory.questItems;
- fileChooseCtx->unk_24458[fileChooseCtx->fileNum] = gSaveContext.save.time;
- fileChooseCtx->unk_24460[fileChooseCtx->fileNum] = gSaveContext.save.day;
- fileChooseCtx->unk_24468[fileChooseCtx->fileNum] = gSaveContext.save.isOwlSave;
- fileChooseCtx->rupees[fileChooseCtx->fileNum] = gSaveContext.save.playerData.rupees;
+ 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->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;
// = CUR_UPG_VALUE(UPG_WALLET);
- fileChooseCtx->unk_24474[fileChooseCtx->fileNum] =
+ fileSelect->unk_24474[fileSelect->fileNum] =
(gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4];
for (i = 0, maskCount = 0; i < 24; i++) {
@@ -1436,8 +1433,8 @@ void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
}
}
- fileChooseCtx->maskCount[fileChooseCtx->fileNum] = maskCount;
- fileChooseCtx->heartPieceCount[fileChooseCtx->fileNum] =
+ fileSelect->maskCount[fileSelect->fileNum] = maskCount;
+ fileSelect->heartPieceCount[fileSelect->fileNum] =
(gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
}
@@ -1448,21 +1445,20 @@ void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146628.s")
#endif
-void Sram_InitSave(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
+void Sram_InitSave(FileSelectState* fileSelect2, SramContext* sramCtx) {
s32 phi_v0;
u16 i;
- FileChooseContext* fileChooseCtx = fileChooseCtx2;
+ FileSelectState* fileSelect = fileSelect2;
s16 maskCount;
if (gSaveContext.unk_3F3F) {
Sram_InitNewSave();
- if (fileChooseCtx->unk_24480 == 0) {
+ if (fileSelect->unk_24480 == 0) {
gSaveContext.save.cutscene = 0xFFF0;
}
for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(gSaveContext.save.playerData.playerName); phi_v0++) {
- gSaveContext.save.playerData.playerName[phi_v0] =
- fileChooseCtx->unk_24414[fileChooseCtx->unk_24480][phi_v0];
+ gSaveContext.save.playerData.playerName[phi_v0] = fileSelect->unk_24414[fileSelect->unk_24480][phi_v0];
}
gSaveContext.save.playerData.newf[0] = 'Z';
@@ -1478,24 +1474,24 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save));
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.newf); i++) {
- fileChooseCtx->newf[fileChooseCtx->unk_24480][i] = gSaveContext.save.playerData.newf[i];
+ fileSelect->newf[fileSelect->unk_24480][i] = gSaveContext.save.playerData.newf[i];
}
- fileChooseCtx->unk_2440C[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.deaths;
+ fileSelect->unk_2440C[fileSelect->unk_24480] = gSaveContext.save.playerData.deaths;
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) {
- fileChooseCtx->unk_24414[fileChooseCtx->unk_24480][i] = gSaveContext.save.playerData.playerName[i];
+ fileSelect->unk_24414[fileSelect->unk_24480][i] = gSaveContext.save.playerData.playerName[i];
}
- fileChooseCtx->healthCapacity[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.healthCapacity;
- fileChooseCtx->health[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.health;
- fileChooseCtx->unk_24454[fileChooseCtx->unk_24480] = gSaveContext.save.inventory.defenseHearts;
- fileChooseCtx->unk_24444[fileChooseCtx->unk_24480] = gSaveContext.save.inventory.questItems;
- fileChooseCtx->unk_24458[fileChooseCtx->unk_24480] = gSaveContext.save.time;
- fileChooseCtx->unk_24460[fileChooseCtx->unk_24480] = gSaveContext.save.day;
- fileChooseCtx->unk_24468[fileChooseCtx->unk_24480] = gSaveContext.save.isOwlSave;
- fileChooseCtx->rupees[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.rupees;
- fileChooseCtx->unk_24474[fileChooseCtx->unk_24480] = CUR_UPG_VALUE(UPG_WALLET);
+ 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->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->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) {
@@ -1503,8 +1499,8 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
}
}
- fileChooseCtx->maskCount[fileChooseCtx->unk_24480] = maskCount;
- fileChooseCtx->heartPieceCount[fileChooseCtx->unk_24480] =
+ fileSelect->maskCount[fileSelect->unk_24480] = maskCount;
+ fileSelect->heartPieceCount[fileSelect->unk_24480] =
(gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
}
@@ -1526,9 +1522,9 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
func_801A3D98(gSaveContext.options.audioSetting);
}
-void Sram_Alloc(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_AllocEndAlign16(&gameState->heap, SAVE_BUFFER_SIZE);
sramCtx->status = 0;
}
}
diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
index 5f32870a7..3be9ff149 100644
--- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
+++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
@@ -69,7 +69,7 @@ void ArmsHook_Destroy(Actor* thisx, PlayState* play) {
ArmsHook* this = THIS;
if (this->grabbed != NULL) {
- this->grabbed->flags &= ~0x2000;
+ this->grabbed->flags &= ~ACTOR_FLAG_2000;
}
Collider_DestroyQuad(play, &this->collider);
}
@@ -100,7 +100,7 @@ s32 ArmsHook_AttachToPlayer(ArmsHook* this, Player* player) {
void ArmsHook_DetachHookFromActor(ArmsHook* this) {
if (this->grabbed != NULL) {
- this->grabbed->flags &= ~0x2000;
+ this->grabbed->flags &= ~ACTOR_FLAG_2000;
this->grabbed = NULL;
}
}
@@ -120,7 +120,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
}
void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
- actor->flags |= 0x2000;
+ actor->flags |= ACTOR_FLAG_2000;
this->grabbed = actor;
Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->unk1FC);
}
@@ -140,10 +140,10 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
if (this->timer != 0 && (this->collider.base.atFlags & AT_HIT) &&
(this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
Actor* touchedActor = this->collider.base.at;
- if ((touchedActor->update != NULL) && (touchedActor->flags & 0x600)) {
+ if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_200 | ACTOR_FLAG_400))) {
if (this->collider.info.atHitInfo->bumperFlags & BUMP_HOOKABLE) {
ArmsHook_AttachHookToActor(this, touchedActor);
- if ((touchedActor->flags & 0x400) == 0x400) {
+ if ((touchedActor->flags & ACTOR_FLAG_400) == ACTOR_FLAG_400) {
func_808C1154(this);
}
}
@@ -164,7 +164,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
grabbed = this->grabbed;
if (grabbed != NULL) {
- if ((grabbed->update == NULL) || (grabbed->flags & 0x2000) != 0x2000) {
+ if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_2000)) {
grabbed = NULL;
this->grabbed = NULL;
} else {
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 d849ab5ed..d7e1bef1f 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
@@ -1,7 +1,7 @@
/*
* File: z_bg_dblue_balance.c
* Overlay: ovl_Bg_Dblue_Balance
- * Description: Great Bay Temple - See-Saw
+ * Description: Great Bay Temple - Seesaw and Waterwheel w/ Platforms
*/
#include "prevent_bss_reordering.h"
@@ -43,19 +43,19 @@ const ActorInit Bg_Dblue_Balance_InitVars = {
};
typedef struct {
- /* 0x00 */ Gfx* unk_00;
- /* 0x04 */ CollisionHeader* unk_04;
+ /* 0x00 */ Gfx* opaDList;
+ /* 0x04 */ CollisionHeader* colHeader;
/* 0x08 */ u32 unk_08;
/* 0x0C */ f32 unk_0C;
/* 0x10 */ f32 unk_10;
- /* 0x14 */ ActorFunc unk_14;
- /* 0x18 */ ActorFunc unk_18;
-} BgDblueBalanceStruct2;
+ /* 0x14 */ ActorFunc update;
+ /* 0x18 */ ActorFunc draw;
+} BgDblueBalanceTypeInfo; // size = 0x1C
-BgDblueBalanceStruct2 D_80B83A20[] = {
+BgDblueBalanceTypeInfo sTypeInfo[] = {
{
- object_dblue_object_DL_00B8F8,
- &object_dblue_object_Colheader_00BC08,
+ gGreatBayTempleObjectSeesawShaftDL,
+ &gGreatBayTempleObjectSeesawShaftCol,
0x10,
360.0f,
300.0f,
@@ -63,8 +63,8 @@ BgDblueBalanceStruct2 D_80B83A20[] = {
BgDblueBalance_Draw,
},
{
- object_dblue_object_DL_00BF48,
- &object_dblue_object_Colheader_00C180,
+ gGreatBayTempleObjectLargeSeesawPlatformDL,
+ &gGreatBayTempleObjectLargeSeesawPlatformCol,
0x10,
210.0f,
190.0f,
@@ -72,8 +72,8 @@ BgDblueBalanceStruct2 D_80B83A20[] = {
BgDblueBalance_Draw,
},
{
- object_dblue_object_DL_00C4B8,
- &object_dblue_object_Colheader_00C700,
+ gGreatBayTempleObjectSmallSeesawPlatformDL,
+ &gGreatBayTempleObjectSmallSeesawPlatformCol,
0x10,
180.0f,
180.0f,
@@ -81,8 +81,8 @@ BgDblueBalanceStruct2 D_80B83A20[] = {
BgDblueBalance_Draw,
},
{
- object_dblue_object_DL_001E68,
- &object_dblue_object_Colheader_002E78,
+ gGreatBayTempleObjectWaterwheelWithPlatformsDL,
+ &gGreatBayTempleObjectWaterwheelWithPlatformsCol,
0x30,
1500.0f,
1500.0f,
@@ -311,19 +311,19 @@ void BgDblueBalance_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
- this->dyna.actor.flags = D_80B83A20[sp2C].unk_08;
- this->dyna.actor.uncullZoneScale = D_80B83A20[sp2C].unk_0C;
- this->dyna.actor.uncullZoneDownward = D_80B83A20[sp2C].unk_10;
- this->dyna.actor.update = D_80B83A20[sp2C].unk_14;
- this->dyna.actor.draw = D_80B83A20[sp2C].unk_18;
+ this->dyna.actor.flags = sTypeInfo[sp2C].unk_08;
+ this->dyna.actor.uncullZoneScale = sTypeInfo[sp2C].unk_0C;
+ this->dyna.actor.uncullZoneDownward = sTypeInfo[sp2C].unk_10;
+ this->dyna.actor.update = sTypeInfo[sp2C].update;
+ this->dyna.actor.draw = sTypeInfo[sp2C].draw;
DynaPolyActor_Init(&this->dyna, 1);
- DynaPolyActor_LoadMesh(play, &this->dyna, D_80B83A20[sp2C].unk_04);
+ DynaPolyActor_LoadMesh(play, &this->dyna, sTypeInfo[sp2C].colHeader);
if (sp2C == 3) {
- D_80B83C70 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00CE00);
+ D_80B83C70 = Lib_SegmentedToVirtual(gGreatBayTempleObjectWaterwheelSplashTexAnim);
} else if (sp2C == 0) {
- D_80B83C74 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00D250);
+ D_80B83C74 = Lib_SegmentedToVirtual(gGreatBayTempleObjectSeesawSplashTexAnim);
}
if (sp2C == 0) {
@@ -645,11 +645,11 @@ void func_80B83518(Actor* thisx, PlayState* play) {
void BgDblueBalance_Draw(Actor* thisx, PlayState* play) {
s32 pad;
BgDblueBalance* this = THIS;
- BgDblueBalanceStruct2* ptr2 = &D_80B83A20[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
+ BgDblueBalanceTypeInfo* ptr2 = &sTypeInfo[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
BgDblueBalance* sp38;
Gfx* gfx;
- Gfx_DrawDListOpa(play, ptr2->unk_00);
+ Gfx_DrawDListOpa(play, ptr2->opaDList);
if (!(BGDBLUEBALANCE_GET_300(&this->dyna.actor)) && (this->unk_160 != NULL)) {
AnimatedMat_Draw(play, D_80B83C74);
@@ -666,7 +666,7 @@ void BgDblueBalance_Draw(Actor* thisx, PlayState* play) {
gSPDisplayList(gfx++, &sSetupDL[6 * 25]);
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetEnvColor(gfx++, 0, 0, 0, this->unk_183);
- gSPDisplayList(gfx++, object_dblue_object_DL_00D110);
+ gSPDisplayList(gfx++, gGreatBayTempleObjectSeesawSplashDL);
POLY_XLU_DISP = gfx;
@@ -681,7 +681,7 @@ void func_80B83758(Actor* thisx, PlayState* play) {
Gfx* gfx;
s32 i;
BgDblueBalanceStruct* ptr;
- BgDblueBalanceStruct2* ptr2;
+ BgDblueBalanceTypeInfo* ptr2;
s32 temp;
if (this->unk_178 != 0) {
@@ -695,8 +695,8 @@ void func_80B83758(Actor* thisx, PlayState* play) {
}
if (this->dyna.actor.flags & ACTOR_FLAG_40) {
- ptr2 = &D_80B83A20[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
- Gfx_DrawDListOpa(play, ptr2->unk_00);
+ ptr2 = &sTypeInfo[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
+ Gfx_DrawDListOpa(play, ptr2->opaDList);
if (this->unk_183 != 0) {
AnimatedMat_Draw(play, D_80B83C70);
@@ -717,7 +717,7 @@ void func_80B83758(Actor* thisx, PlayState* play) {
temp = ptr->unk_0E * (f32)this->unk_183 * 0.003921569f;
gDPSetEnvColor(gfx++, 0, 0, 0, temp);
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(gfx++, object_dblue_object_DL_00CD10);
+ gSPDisplayList(gfx++, gGreatBayTempleObjectWaterwheelSplashDL);
}
}
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 c42d96c0f..53a3300d4 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
@@ -1,7 +1,7 @@
/*
* File: z_bg_dblue_movebg.c
* Overlay: ovl_Bg_Dblue_Movebg
- * Description: Great Bay Temple - Waterwheels and push switches
+ * Description: Great Bay Temple - Waterwheels, push switches, gear shafts, and whirlpools
*/
#include "prevent_bss_reordering.h"
@@ -57,42 +57,42 @@ const ActorInit Bg_Dblue_Movebg_InitVars = {
(ActorFunc)BgDblueMovebg_Draw,
};
-Gfx* D_80A2B8AC[] = {
+static Gfx* sOpaDLists[] = {
NULL,
- object_dblue_object_DL_0069D8,
+ gGreatBayTempleObjectTwoWaySwitchDL,
NULL,
NULL,
NULL,
NULL,
- object_dblue_object_DL_004848,
- object_dblue_object_DL_0061B8,
+ gGreatBayTempleObjectGearShaftWithPlatformsDL,
+ gGreatBayTempleObjectOneWaySwitchDL,
NULL,
NULL,
NULL,
NULL,
};
-Gfx* D_80A2B8DC[] = {
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, object_dblue_object_DL_00CAA0, NULL,
+static Gfx* sXluDLists[] = {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, gGreatBayTempleObjectWhirlpoolDL, NULL,
};
-CollisionHeader* D_80A2B90C[] = {
+static CollisionHeader* sColHeaders[] = {
NULL,
- &object_dblue_object_Colheader_006EA8,
+ &gGreatBayTempleObjectTwoWaySwitchCol,
NULL,
NULL,
NULL,
- &object_dblue_object_Colheader_00D3DC,
- &object_dblue_object_Colheader_005D28,
- &object_dblue_object_Colheader_00714C,
- &object_dblue_object_Colheader_00AED0,
- &object_dblue_object_Colheader_00AED0,
+ &gGreatBayTempleObjectUnusedCol,
+ &gGreatBayTempleObjectGearShaftWithPlatformsCol,
+ &gGreatBayTempleObjectOneWaySwitchCol,
+ &gGreatBayTempleObjectWaterwheelCol,
+ &gGreatBayTempleObjectWaterwheelCol,
NULL,
NULL,
};
-AnimatedMaterial* D_80A2B93C[] = {
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, object_dblue_object_Matanimheader_00CC18, NULL,
+static AnimatedMaterial* sTexAnims[] = {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, gGreatBayTempleObjectWhirlpoolTexAnim, NULL,
};
s16 D_80A2B96C[] = { 0, 0x16C, -0x16C, 0 };
@@ -189,13 +189,13 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) {
D_80A2BBF4.unk_01 = 1;
}
- if (D_80A2B90C[this->unk_160] != NULL) {
- DynaPolyActor_LoadMesh(play, &this->dyna, D_80A2B90C[this->unk_160]);
+ if (sColHeaders[this->unk_160] != NULL) {
+ DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[this->unk_160]);
}
- this->unk_164 = D_80A2B8AC[this->unk_160];
- this->unk_168 = D_80A2B8DC[this->unk_160];
- this->unk_16C = D_80A2B93C[this->unk_160];
+ this->opaDList = sOpaDLists[this->unk_160];
+ 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));
@@ -341,9 +341,9 @@ void func_80A2A1E0(BgDblueMovebg* this, PlayState* play) {
this->dyna.actor.shape.rot.y += this->unk_1CC;
if (play->roomCtx.currRoom.num == 0) {
- this->unk_164 = object_dblue_object_DL_004848;
+ this->opaDList = gGreatBayTempleObjectGearShaftWithPlatformsDL;
} else if (play->roomCtx.currRoom.num == 8) {
- this->unk_164 = NULL;
+ this->opaDList = NULL;
}
if (play->roomCtx.currRoom.num != this->unk_170) {
@@ -678,9 +678,9 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) {
}
if (play->roomCtx.currRoom.num == 0) {
- this->unk_164 = object_dblue_object_DL_008778;
+ this->opaDList = gGreatBayTempleObjectWaterwheelDL;
} else if (play->roomCtx.currRoom.num == 8) {
- this->unk_164 = object_dblue_object_DL_00A528;
+ this->opaDList = gGreatBayTempleObjectWaterwheelWithFakeGearDL;
}
if (this == D_80A2BBF0) {
@@ -756,7 +756,7 @@ void func_80A2B308(Actor* thisx, PlayState* play) {
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++, this->unk_164);
+ gSPDisplayList(POLY_OPA_DISP++, this->opaDList);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -774,34 +774,34 @@ void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2) {
OPEN_DISPS(play->state.gfxCtx);
if ((this->unk_160 == 9) || (this->unk_160 == 8) || (this->dyna.actor.flags & ACTOR_FLAG_40)) {
- if (this->unk_16C != NULL) {
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->unk_16C));
+ if (this->texAnim != NULL) {
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->texAnim));
}
- if ((this->unk_164 != 0) || (this->unk_160 == 6)) {
+ if ((this->opaDList != NULL) || (this->unk_160 == 6)) {
gfx2 = Gfx_CallSetupDL(POLY_OPA_DISP, 0x19);
gSPMatrix(&gfx2[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->unk_160 == 6) {
- gSPDisplayList(&gfx2[1], object_dblue_object_DL_0052B8);
- if (this->unk_164 != 0) {
- gSPDisplayList(&gfx2[2], this->unk_164);
+ gSPDisplayList(&gfx2[1], gGreatBayTempleObjectGearShaftDL);
+ if (this->opaDList != NULL) {
+ gSPDisplayList(&gfx2[2], this->opaDList);
POLY_OPA_DISP = &gfx2[3];
} else {
POLY_OPA_DISP = &gfx2[2];
}
} else {
- gSPDisplayList(&gfx2[1], this->unk_164);
+ gSPDisplayList(&gfx2[1], this->opaDList);
POLY_OPA_DISP = &gfx2[2];
}
}
- if (this->unk_168 != NULL) {
+ if (this->xluDList != NULL) {
gfx = func_8012C2B4(POLY_XLU_DISP);
gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(&gfx[1], this->unk_168);
+ gSPDisplayList(&gfx[1], this->xluDList);
POLY_XLU_DISP = &gfx[2];
}
@@ -812,7 +812,7 @@ void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2) {
CLOSE_DISPS(play->state.gfxCtx);
if ((this->unk_160 == 8) && (this->unk_172 & 0x20)) {
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_dblue_object_Matanimheader_00CE00));
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gGreatBayTempleObjectWaterwheelSplashTexAnim));
OPEN_DISPS(play->state.gfxCtx);
@@ -844,7 +844,7 @@ void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2) {
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetEnvColor(gfx++, 255, 255, 255, this->unk_1D8[j][i]);
- gSPDisplayList(gfx++, object_dblue_object_DL_00CD10);
+ gSPDisplayList(gfx++, gGreatBayTempleObjectWaterwheelSplashDL);
Matrix_Pop();
}
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 83fb1df62..6b5351c2c 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
@@ -17,9 +17,9 @@ typedef struct BgDblueMovebg {
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ BgDblueMovebgActionFunc actionFunc;
/* 0x160 */ s32 unk_160;
- /* 0x164 */ Gfx* unk_164;
- /* 0x168 */ Gfx* unk_168;
- /* 0x16C */ TexturePtr unk_16C;
+ /* 0x164 */ Gfx* opaDList;
+ /* 0x168 */ Gfx* xluDList;
+ /* 0x16C */ AnimatedMaterial* texAnim;
/* 0x170 */ s8 unk_170;
/* 0x171 */ s8 unk_171;
/* 0x172 */ u16 unk_172;
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 6f914a475..a2fa18103 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
@@ -1,7 +1,7 @@
/*
* File: z_bg_dblue_waterfall.c
* Overlay: ovl_Bg_Dblue_Waterfall
- * Description: Great Bay Temple - Freezable Geyser
+ * Description: Great Bay Temple - Freezable Waterfall
*/
#include "z_bg_dblue_waterfall.h"
@@ -344,7 +344,7 @@ void BgDblueWaterfall_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
Collider_UpdateCylinder(&this->actor, &this->collider);
- this->unk_190 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00B448);
+ this->unk_190 = Lib_SegmentedToVirtual(gGreatBayTempleObjectWaterfallTexAnim);
Actor_SetFocus(&this->actor, -100.0f);
func_80B84568(this, play);
@@ -600,30 +600,30 @@ void BgDblueWaterfall_Draw(Actor* thisx, PlayState* play) {
AnimatedMat_Draw(play, this->unk_190);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x8A, 255, 255, 255, sp38);
- gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_00B280);
+ gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectWaterfallDL);
}
if (this->unk_19F > 0) {
if (this->unk_19F < 255) {
gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x9B, 255, 255, 255, this->unk_19F);
- gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003358);
+ gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectIceStalactiteDL);
} else {
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x9B, 255, 255, 255, 255);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, object_dblue_object_DL_003358);
+ gSPDisplayList(POLY_OPA_DISP++, gGreatBayTempleObjectIceStalactiteDL);
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 255, 255, 255, this->unk_19F);
- gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003250);
+ gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectIceStalactiteRimDL);
}
if (this->unk_1A0 > 0) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 255, 255, 255, this->unk_1A0);
- gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003770);
+ gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectFrozenWaterfallDL);
}
CLOSE_DISPS(play->state.gfxCtx);
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 94eec2c1d..77bf92531 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
@@ -7,6 +7,7 @@
#include "z_bg_ikana_rotaryroom.h"
#include "overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h"
#include "overlays/actors/ovl_En_Torch2/z_en_torch2.h"
+#include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h"
#include "objects/object_ikana_obj/object_ikana_obj.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -679,7 +680,8 @@ void func_80B81570(BgIkanaRotaryroom* this, PlayState* play) {
sp70.y += this->dyna.actor.world.pos.y;
sp70.z += this->dyna.actor.world.pos.z;
- Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, sp70.x, sp70.y, sp70.z, 0, 0, 0, 1);
+ Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, sp70.x, sp70.y, sp70.z, 0, 0, 0,
+ ENWATEREFFECT_TYPE_FALLING_ROCK_SPAWNER);
}
Matrix_Pop();
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 8e684cc74..386996325 100644
--- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
+++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
@@ -216,7 +216,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) {
if (ActorCutscene_GetCurrentIndex() != -1) {
Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0);
player->stateFlags1 |= 0x20;
- play->actorCtx.unk5 &= ~0x4;
+ play->actorCtx.flags &= ~ACTORCTX_FLAG_2;
} else {
Camera_ChangeSetting(mainCam, CAM_SET_BOAT_CRUISE);
player->stateFlags1 &= ~0x20;
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 bd641bf4c..68c432c5f 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
@@ -27,9 +27,9 @@ const ActorInit Bg_Inibs_Movebg_InitVars = {
(ActorFunc)BgInibsMovebg_Draw,
};
-Gfx* D_80B96560[] = { object_inibs_object_DL_0062D8, object_inibs_object_DL_001DC0 };
-Gfx* D_80B96568[] = { object_inibs_object_DL_006140, object_inibs_object_DL_001C10 };
-AnimatedMaterial* D_80B96570[] = { object_inibs_object_Matanimheader_006858, object_inibs_object_Matanimheader_002598 };
+Gfx* sOpaDLists[] = { gTwinmoldArenaNormalModeSandDL, gTwinmoldArenaGiantModeSandDL };
+Gfx* sXluDLists[] = { gTwinmoldArenaNormalModeCenterPlatformDL, gTwinmoldArenaGiantModeCenterPlatformDL };
+AnimatedMaterial* sSandTexAnims[] = { gTwinmoldArenaNormalModeSandTexAnim, gTwinmoldArenaGiantModeSandTexAnim };
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
@@ -41,9 +41,9 @@ void BgInibsMovebg_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 1);
- this->unk_15C = D_80B96560[BGINIBSMOVEBG_GET_F(thisx)];
- this->unk_160 = D_80B96568[BGINIBSMOVEBG_GET_F(thisx)];
- this->unk_164 = D_80B96570[BGINIBSMOVEBG_GET_F(thisx)];
+ this->opaDList = sOpaDLists[BG_INIBS_MOVEBG_GET_MODE(thisx)];
+ this->xluDList = sXluDLists[BG_INIBS_MOVEBG_GET_MODE(thisx)];
+ this->sandTexAnim = sSandTexAnims[BG_INIBS_MOVEBG_GET_MODE(thisx)];
}
void BgInibsMovebg_Destroy(Actor* thisx, PlayState* play) {
@@ -54,23 +54,22 @@ void BgInibsMovebg_Destroy(Actor* thisx, PlayState* play) {
void BgInibsMovebg_Draw(Actor* thisx, PlayState* play) {
BgInibsMovebg* this = THIS;
+ AnimatedMaterial* sandTexAnim;
+ Gfx* opaDList;
+ Gfx* xluDList;
- AnimatedMaterial* animMat;
- Gfx* dl1;
- Gfx* dl2;
-
- animMat = this->unk_164;
- if (animMat != NULL) {
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->unk_164));
+ sandTexAnim = this->sandTexAnim;
+ if (sandTexAnim != NULL) {
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->sandTexAnim));
}
- dl1 = this->unk_15C;
- if (dl1 != NULL) {
- Gfx_DrawDListOpa(play, this->unk_15C);
+ opaDList = this->opaDList;
+ if (opaDList != NULL) {
+ Gfx_DrawDListOpa(play, this->opaDList);
}
- dl2 = this->unk_160;
- if (dl2 != NULL) {
- Gfx_DrawDListXlu(play, this->unk_160);
+ xluDList = this->xluDList;
+ if (xluDList != NULL) {
+ Gfx_DrawDListXlu(play, this->xluDList);
}
}
diff --git a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h
index 92494a35f..629a5cd03 100644
--- a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h
+++ b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h
@@ -5,13 +5,13 @@
struct BgInibsMovebg;
-#define BGINIBSMOVEBG_GET_F(thisx) ((u16)((thisx)->params) & 0xF)
+#define BG_INIBS_MOVEBG_GET_MODE(thisx) ((u16)((thisx)->params) & 0xF)
typedef struct BgInibsMovebg {
/* 0x000 */ DynaPolyActor dyna;
- /* 0x15C */ Gfx* unk_15C;
- /* 0x160 */ Gfx* unk_160;
- /* 0x164 */ AnimatedMaterial* unk_164;
+ /* 0x15C */ Gfx* opaDList;
+ /* 0x160 */ Gfx* xluDList;
+ /* 0x164 */ AnimatedMaterial* sandTexAnim;
} BgInibsMovebg; // size = 0x168
extern const ActorInit Bg_Inibs_Movebg_InitVars;
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 6ac4ac866..72a38b21b 100644
--- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c
+++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c
@@ -43,7 +43,7 @@ void BgLotus_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 1);
- DynaPolyActor_LoadMesh(play, &this->dyna, &object_lotus_Colheader_000A20);
+ 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;
@@ -171,5 +171,5 @@ void BgLotus_Update(Actor* thisx, PlayState* play) {
}
void BgLotus_Draw(Actor* thisx, PlayState* play) {
- Gfx_DrawDListOpa(play, object_lotus_DL_000040);
+ Gfx_DrawDListOpa(play, gLilyPadDL);
}
diff --git a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c
index 8ac6c61c3..f2f5ef870 100644
--- a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c
+++ b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c
@@ -27,17 +27,25 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
};
-Gfx* D_80AF0120[] = { object_market_obj_DL_01F050, object_market_obj_DL_018DA0 };
-Gfx* D_80AF0128[] = { object_market_obj_DL_01EF10, object_market_obj_DL_018C60 };
+Gfx* sMarketDLs[] = {
+ gWestClockTownMarketDayDL,
+ gWestClockTownMarketNightDL,
+};
+
+Gfx* sBankAdvertisementsAndDoorDLs[] = {
+ gWestClockTownMarketBankAdvertisementsAndDoorDayDL,
+ gWestClockTownMarketBankAdvertisementsAndDoorNightDL,
+};
void BgMarketStep_Init(Actor* thisx, PlayState* play) {
BgMarketStep* this = THIS;
Actor_ProcessInitChain(&this->actor, sInitChain);
}
-void BgMarketStep_Draw(Actor* thisx, PlayState* play) {
- s32 index = thisx->params & 1;
- Gfx_DrawDListOpa(play, D_80AF0120[index]);
- Gfx_DrawDListOpa(play, D_80AF0128[index]);
+void BgMarketStep_Draw(Actor* thisx, PlayState* play) {
+ s32 timeOfDay = BG_MARKET_STEP_GET_TIME_OF_DAY(thisx);
+
+ Gfx_DrawDListOpa(play, sMarketDLs[timeOfDay]);
+ Gfx_DrawDListOpa(play, sBankAdvertisementsAndDoorDLs[timeOfDay]);
}
diff --git a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.h b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.h
index aa98c0aa1..c779b227a 100644
--- a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.h
+++ b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.h
@@ -3,6 +3,8 @@
#include "global.h"
+#define BG_MARKET_STEP_GET_TIME_OF_DAY(thisx) ((thisx)->params & 1)
+
struct BgMarketStep;
typedef struct BgMarketStep {
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 e1e8a3a64..1c14d63bb 100644
--- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c
+++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c
@@ -725,7 +725,7 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) {
if (sp43 != 0) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, player->actor.world.pos.x, this->waterHeight,
- player->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_309);
+ player->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_TYPE_GYORG_RIPPLES);
Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_SINK_OLD);
}
@@ -1056,7 +1056,7 @@ void Boss03_Charge(Boss03* this, PlayState* play) {
play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION);
func_800BC848(&this->actor, play, 20, 15);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, 0.0f, this->waterHeight, 0.0f, 0, 0, 0x96,
- ENWATEREFFECT_30C);
+ ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE);
// Player is above water && Player is standing on ground
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
@@ -1529,7 +1529,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
if ((this->workTimer[WORK_TIMER_UNK0_C] == 0) && ((this->waterHeight - 100.0f) < this->actor.world.pos.y)) {
this->workTimer[WORK_TIMER_UNK0_C] = Rand_ZeroFloat(15.0f) + 15.0f;
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->waterHeight,
- this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_309);
+ this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_TYPE_GYORG_RIPPLES);
if (this->actionFunc == Boss03_DeathCutscene) {
if ((D_809E9840 % 2) != 0) {
@@ -2013,7 +2013,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
}
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->waterHeight,
- this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_309);
+ this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_TYPE_GYORG_RIPPLES);
this->unk_280 = 27;
this->unk_284 = this->actor.world.pos.x;
@@ -2429,7 +2429,7 @@ void Boss03_DrawEffects(PlayState* play) {
if (!flag) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex));
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
@@ -2463,7 +2463,7 @@ void Boss03_DrawEffects(PlayState* play) {
if (!flag) {
func_8012C448(gfxCtx);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex));
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260);
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 64b6a7a98..4cd28f454 100644
--- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c
+++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c
@@ -160,7 +160,7 @@ Actor* func_80C1C8E8(PlayState* play) {
}
tempActor = foundActor->next;
- if (tempActor == NULL || NULL) {
+ if (tempActor == NULL || false) {
foundActor = NULL;
break;
}
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 3af1cddcf..90517fbaf 100644
--- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c
+++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c
@@ -81,11 +81,11 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
this->unk_348 = 255.0f;
for (i = 0; i < ARRAY_COUNT(this->unk_1AC); i++) {
- this->unk_1AC[i] = ovl_dm_char01_Vtx_1BE0[i].v.ob[1] * 409.6f;
+ this->unk_1AC[i] = gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[1] * 409.6f;
}
DynaPolyActor_Init(&this->dyna, 0);
- DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_009E4C);
+ DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryPoisonWaterDamageCol);
this->unk_34D = true;
if (gSaveContext.sceneSetupIndex == 1) {
@@ -115,7 +115,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.world.rot.y += 0x8000;
this->dyna.actor.shape.rot.y += 0x8000;
DynaPolyActor_Init(&this->dyna, 0);
- DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_010C3C);
+ DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryTempleCol);
this->unk_34D = true;
this->unk_348 = 200.0f;
this->actionFunc = func_80AA8F2C;
@@ -132,7 +132,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ETCETERA, 5.0f, 202.0f, 294.0f, 0, 0, 0,
DEKU_FLOWER_PARAMS(DEKU_FLOWER_TYPE_PINK_WITH_INITIAL_BOUNCE));
DynaPolyActor_Init(&this->dyna, 0);
- DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_00FE5C);
+ DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryTempleRampAndPlatformCol);
this->unk_34D = true;
if (!(gSaveContext.save.weekEventReg[20] & 2)) {
@@ -253,8 +253,9 @@ void func_80AA892C(DmChar01* this, PlayState* play) {
this->unk_34C = 0;
}
- for (i = 0; i < ARRAY_COUNT(ovl_dm_char01_Vtx_1BE0); i++) {
- s32 temp_s2 = sqrtf(SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[2]) + SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[0]));
+ for (i = 0; i < ARRAY_COUNT(gWoodfallSceneryDynamicPoisonWaterVtx); i++) {
+ s32 temp_s2 = sqrtf(SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[2]) +
+ SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[0]));
f32 cos = Math_CosS((temp_s2 / 1892.0f) * 0x4000);
f32 temp_f20 = (1.0f - (ABS_ALT(temp_s2 - D_80AAAE22) / 1892.0f)) * D_80AAAE20 * cos;
@@ -266,7 +267,7 @@ void func_80AA892C(DmChar01* this, PlayState* play) {
temp_f20 += temp_f18;
this->unk_1AC[i] += 1600;
- ovl_dm_char01_Vtx_1BE0[i].v.ob[1] = temp_f20;
+ gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[1] = temp_f20;
}
}
@@ -298,8 +299,9 @@ void func_80AA8C28(DmChar01* this, PlayState* play) {
break;
}
- for (i = 0; i < ARRAY_COUNT(ovl_dm_char01_Vtx_1BE0); i++) {
- s32 temp_s2 = sqrtf(SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[2]) + SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[0]));
+ for (i = 0; i < ARRAY_COUNT(gWoodfallSceneryDynamicPoisonWaterVtx); i++) {
+ s32 temp_s2 = sqrtf(SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[2]) +
+ SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[0]));
f32 cos = Math_CosS((temp_s2 / 1892.0f) * 0x4000);
f32 temp_f20 = (1.0f - (ABS_ALT(temp_s2 - D_80AAAE22) / 1892.0f)) * D_80AAAE20 * cos;
@@ -311,7 +313,7 @@ void func_80AA8C28(DmChar01* this, PlayState* play) {
temp_f20 += temp_f18;
this->unk_1AC[i] += 1600;
- ovl_dm_char01_Vtx_1BE0[i].v.ob[1] = temp_f20;
+ gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[1] = temp_f20;
}
Math_SmoothStepToF(&this->unk_348, 0.0f, 0.02f, 0.6f, 0.4f);
@@ -405,18 +407,18 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
case DMCHAR01_0:
switch (this->unk_34C) {
case 0:
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00AA50));
- Gfx_DrawDListOpa(play, object_mtoride_DL_00A8F8);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPoisonWaterTexAnim));
+ Gfx_DrawDListOpa(play, gWoodfallSceneryPoisonWaterDL);
break;
case 1:
if (gSaveContext.sceneSetupIndex == 1) {
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8));
- Gfx_DrawDListOpa(play, object_mtoride_DL_010FD8);
- Gfx_DrawDListXlu(play, object_mtoride_DL_010EF0);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWaterTexAnim));
+ Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL);
+ Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL);
Matrix_Translate(0.0f, 10.0f, 0.0f, MTXMODE_APPLY);
}
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_009D70));
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryDynamicPoisonWaterTexAnim));
OPEN_DISPS(play->state.gfxCtx);
@@ -427,10 +429,11 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x96, 255, 255, 255, 255);
- gSPSegment(POLY_OPA_DISP++, 0x0B, Lib_SegmentedToVirtual(ovl_dm_char01_Vtx_1BE0));
+ gSPSegment(POLY_OPA_DISP++, 0x0B,
+ Lib_SegmentedToVirtual(gWoodfallSceneryDynamicPoisonWaterVtx));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, object_mtoride_DL_009928);
+ gSPDisplayList(POLY_OPA_DISP++, gWoodfallSceneryDynamicPoisonWaterDL);
} else {
func_8012C2DC(play->state.gfxCtx);
@@ -438,19 +441,20 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)this->unk_348);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x96, 255, 255, 255, (u8)this->unk_348);
- gSPSegment(POLY_XLU_DISP++, 0x0B, Lib_SegmentedToVirtual(ovl_dm_char01_Vtx_1BE0));
+ gSPSegment(POLY_XLU_DISP++, 0x0B,
+ Lib_SegmentedToVirtual(gWoodfallSceneryDynamicPoisonWaterVtx));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, object_mtoride_DL_009928);
+ gSPDisplayList(POLY_XLU_DISP++, gWoodfallSceneryDynamicPoisonWaterDL);
}
CLOSE_DISPS(play->state.gfxCtx);
break;
case 2:
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8));
- Gfx_DrawDListOpa(play, object_mtoride_DL_010FD8);
- Gfx_DrawDListXlu(play, object_mtoride_DL_010EF0);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWaterTexAnim));
+ Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL);
+ Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL);
break;
}
break;
@@ -458,23 +462,23 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
case DMCHAR01_1:
switch (this->unk_34C) {
case 0:
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00A5C0));
- Gfx_DrawDListOpa(play, object_mtoride_DL_00A398);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPoisonWallsTexAnim));
+ Gfx_DrawDListOpa(play, gWoodfallSceneryPoisonWallsDL);
break;
case 1:
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00B1A0));
- Gfx_DrawDListOpa(play, object_mtoride_DL_00AF98);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWallsTexAnim));
+ Gfx_DrawDListOpa(play, gWoodfallSceneryPurifiedWallsDL);
break;
}
break;
case DMCHAR01_2:
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00FE90));
- Gfx_DrawDListOpa(play, object_mtoride_DL_00DF18);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryTempleTexAnim));
+ Gfx_DrawDListOpa(play, gWoodfallSceneryTempleDL);
if ((this->unk_34C != 0) && ((u8)this->unk_348 != 0)) {
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00F768));
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryWaterFlowingOverTempleTexAnim));
OPEN_DISPS(play->state.gfxCtx);
@@ -485,7 +489,7 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, (u8)this->unk_348);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, object_mtoride_DL_00F3C0);
+ gSPDisplayList(POLY_XLU_DISP++, gWoodfallSceneryWaterFlowingOverTempleDL);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -537,12 +541,12 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
}
}
- Gfx_DrawDListXlu(play, object_mtoride_DL_00DE50);
+ Gfx_DrawDListXlu(play, gWoodfallSceneryTempleEntrancesDL);
break;
case DMCHAR01_3:
if (thisx->world.pos.y > -120.0f) {
- Gfx_DrawDListOpa(play, object_mtoride_DL_00FAE8);
+ Gfx_DrawDListOpa(play, gWoodfallSceneryTempleRampAndPlatformDL);
}
break;
}
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 2b9c62e19..b51f4df8d 100644
--- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c
+++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c
@@ -1,7 +1,7 @@
/*
* File: z_dm_gm.c
* Overlay: ovl_Dm_Gm
- * Description: Anju (cutscene) (duplicate of Dm_An?)
+ * Description: Complete duplicate of Dm_An
*/
#include "z_dm_gm.h"
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 5d0a74e08..f149a97d6 100644
--- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c
+++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c
@@ -1089,7 +1089,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
} else if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) {
- if (!(play->actorCtx.unk5 & 2)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Actor_MarkForDeath(&this->actor);
}
@@ -1632,7 +1632,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) {
this->alpha = 0;
this->fadeOutState = SK_FADE_OUT_STATE_NONE;
gSaveContext.save.weekEventReg[12] |= 4;
- if (!(play->actorCtx.unk5 & 2)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Actor_MarkForDeath(&this->actor);
} else {
this->shouldDraw = false;
@@ -1813,9 +1813,10 @@ void DmStk_Update(Actor* thisx, PlayState* play) {
// This code is responsible for making in-game time pass while using the telescope in the Astral Observatory.
// Skull Kid is always loaded in the scene, even if he isn't visible, hence why time always passes.
- if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) &&
- !FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
- (ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) {
+ 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->csCtx.state == 0)) {
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
if (REG(15) != 0) {
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed);
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 d8cdf3cc1..e24110793 100644
--- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
+++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
@@ -74,11 +74,11 @@ typedef struct {
} ShutterInfo; // size = 0xC
ShutterInfo D_808A21B0[] = {
- { object_bdoor_DL_0000C0, NULL, 130, 12, 50, 15 },
+ { gBossDoorDL, NULL, 130, 12, 50, 15 },
{ gameplay_keep_DL_077990, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
{ object_numa_obj_DL_007150, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
{ object_hakugin_obj_DL_000128, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
- { object_dblue_object_DL_017D00, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
+ { gGreatBayTempleObjectDoorDL, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
{ object_ikana_obj_DL_014A40, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
{ object_redead_obj_DL_0001A0, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
{ object_ikninside_obj_DL_004440, object_ikninside_obj_DL_005260, 130, 0, 20, 15 },
@@ -129,8 +129,7 @@ Vec3f D_808A22C4 = { 120.0f, 0.0f, 0.0f };
Vec3f D_808A22D0 = { -90.0f, 0.0f, 0.0f };
TexturePtr D_808A22DC[] = {
- object_bdoor_Tex_006BA0, object_bdoor_Tex_005BA0, object_bdoor_Tex_0005C0,
- object_bdoor_Tex_004BA0, object_bdoor_Tex_003BA0,
+ gBossDoorDefaultTex, gBossDoorWoodfallTex, gBossDoorSnowheadTex, gBossDoorGreatBayTex, gBossDoorStoneTowerTex,
};
void DoorShutter_SetupAction(DoorShutter* this, DoorShutterActionFunc actionFunc) {
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 4204d444b..1944ae34e 100644
--- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
+++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
@@ -1,7 +1,7 @@
/*
* File: z_door_warp1.c
* Overlay: ovl_Door_Warp1
- * Description: Blue Warp
+ * Description: Blue warp portal and crystal, and the Majora's Mask-shaped boss warp platform
*/
#include "z_door_warp1.h"
@@ -152,7 +152,7 @@ void DoorWarp1_Init(Actor* thisx, PlayState* play) {
case ENDOORWARP1_FF_5:
this->unk_1D3 = 1;
DynaPolyActor_Init(&this->dyna, 0);
- DynaPolyActor_LoadMesh(play, &this->dyna, &object_warp1_Colheader_008BD4);
+ DynaPolyActor_LoadMesh(play, &this->dyna, &gWarpBossWarpPlatformCol);
func_808B8C48(this, play);
break;
@@ -210,8 +210,8 @@ void func_808B8924(DoorWarp1* this, PlayState* play) {
}
void func_808B8A7C(DoorWarp1* this, PlayState* play) {
- SkelAnime_Init(play, &this->skelAnime, &object_warp1_Skel_002CA8, &object_warp1_Anim_001374, NULL, NULL, 0);
- Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f, 1.0f, 1.0f, 2, 40.0f, 1);
+ SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0);
+ Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 1.0f, 1.0f, 1.0f, 2, 40.0f, 1);
this->unk_1C4 = 0;
this->unk_1C6 = -140;
this->unk_1C8 = -80;
@@ -622,9 +622,8 @@ void func_808B9FD0(DoorWarp1* this, PlayState* play) {
ActorCutscene_Start(play->playerActorCsIds[9], NULL);
AudioSfx_PlaySfx(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
- Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f,
- Animation_GetLastFrame(&object_warp1_Anim_001374.common),
- Animation_GetLastFrame(&object_warp1_Anim_001374.common), 2, 40.0f, 1);
+ Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 1.0f, Animation_GetLastFrame(&gWarpCrystalAnim),
+ Animation_GetLastFrame(&gWarpCrystalAnim), 2, 40.0f, 1);
this->unk_1CA = 50;
D_808BC004 = player2->actor.world.pos.y;
DoorWarp1_SetupAction(this, func_808BA550);
@@ -992,7 +991,7 @@ void func_808BAE9C(DoorWarp1* this, PlayState* play) {
MTXMODE_APPLY);
gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx));
- gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0001A0);
+ gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL);
Matrix_Pop();
@@ -1010,14 +1009,14 @@ void func_808BAE9C(DoorWarp1* this, PlayState* play) {
MTXMODE_APPLY);
gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx));
- gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0001A0);
+ gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL);
}
CLOSE_DISPS(play->state.gfxCtx);
}
void func_808BB4C4(DoorWarp1* this, PlayState* play) {
- Gfx_DrawDListOpa(play, object_warp1_DL_0076C0);
+ Gfx_DrawDListOpa(play, gWarpBossWarpPlatformDL);
}
void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
@@ -1035,8 +1034,8 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + this->unk_1A4,
this->dyna.actor.world.pos.z, MTXMODE_NEW);
Matrix_Scale(4.0f, this->unk_1AC, 4.0f, MTXMODE_APPLY);
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0044D8));
- Gfx_DrawDListXlu(play, object_warp1_DL_003230);
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWarpBossWarpActivationBeamTexAnim));
+ Gfx_DrawDListXlu(play, gWarpBossWarpActivationBeamDL);
return;
}
@@ -1054,7 +1053,7 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
MTXMODE_NEW);
Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_APPLY);
Matrix_Scale(1.0f, this->unk_1A8, 1.0f, MTXMODE_APPLY);
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0057D8));
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWarpBossWarpLightShaftsTexAnim));
OPEN_DISPS(play->state.gfxCtx);
@@ -1063,13 +1062,13 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
gDPSetEnvColor(POLY_XLU_DISP++, sp64[sp60].r, sp64[sp60].g, sp64[sp60].b, 255);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_004690);
+ gSPDisplayList(POLY_XLU_DISP++, gWarpBossWarpLightShaftsDL);
CLOSE_DISPS(play->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
- AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_007238));
+ AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWarpBossWarpGlowTexAnim));
Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
MTXMODE_NEW);
Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_APPLY);
@@ -1080,7 +1079,7 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
gDPSetEnvColor(POLY_XLU_DISP++, sp64[sp60].r, sp64[sp60].g, sp64[sp60].b, 255);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, this->unk_203);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0058C8);
+ gSPDisplayList(POLY_XLU_DISP++, gWarpBossWarpGlowDL);
CLOSE_DISPS(play->state.gfxCtx);
}
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 4ca78d239..8fd78fb51 100644
--- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c
+++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c
@@ -389,11 +389,12 @@ void func_8088ACE0(EnArrow* this, PlayState* play) {
if (sp50 && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
sp7C = this->collider.base.at;
- if ((sp7C->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) && (sp7C->flags & 0x4000)) {
+ if ((sp7C->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) &&
+ (sp7C->flags & ACTOR_FLAG_4000)) {
this->unk_264 = sp7C;
func_8088A894(this, play);
Math_Vec3f_Diff(&sp7C->world.pos, &this->actor.world.pos, &this->unk_268);
- sp7C->flags |= 0x8000;
+ sp7C->flags |= ACTOR_FLAG_8000;
this->collider.base.atFlags &= ~AT_HIT;
this->actor.speedXZ *= 0.5f;
this->actor.velocity.y *= 0.5f;
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 48bd4bc9b..c96f0532f 100644
--- a/src/overlays/actors/ovl_En_Az/z_en_az.c
+++ b/src/overlays/actors/ovl_En_Az/z_en_az.c
@@ -58,14 +58,38 @@ void func_80A97E48(EnAz* this, PlayState* play);
void func_80A97EAC(EnAz* this, PlayState* play);
void func_80A97F9C(EnAz* this, PlayState* play);
-static AnimationSpeedInfo sAnimationInfo[14] = {
- { &object_az_Anim_00BCFC, 1.0f, ANIMMODE_LOOP, -10.0f }, { &object_az_Anim_00C94C, 1.0f, ANIMMODE_LOOP, -5.0f },
- { &object_az_Anim_008960, 1.0f, ANIMMODE_LOOP, -5.0f }, { &object_az_Anim_008BB4, 1.0f, ANIMMODE_LOOP, -5.0f },
- { &object_az_Anim_00925C, 1.0f, ANIMMODE_LOOP, -5.0f }, { &object_az_Anim_009B4C, 1.0f, ANIMMODE_LOOP, -5.0f },
- { &object_az_Anim_0086AC, 1.0f, ANIMMODE_LOOP, -5.0f }, { &object_az_Anim_007D3C, 1.0f, ANIMMODE_LOOP, -5.0f },
- { &object_az_Anim_008EAC, 2.0f, ANIMMODE_LOOP, -5.0f }, { &object_az_Anim_00A25C, 1.0f, ANIMMODE_LOOP, -5.0f },
- { &object_az_Anim_00AAEC, 1.0f, ANIMMODE_LOOP, -5.0f }, { &object_az_Anim_00B94C, 1.0f, ANIMMODE_ONCE, -5.0f },
- { &object_az_Anim_00C0A0, 1.0f, ANIMMODE_LOOP, -5.0f }, { &object_az_Anim_00C47C, 1.0f, ANIMMODE_LOOP, -5.0f },
+typedef enum {
+ /* 0 */ BEAVER_ANIM_IDLE,
+ /* 1 */ BEAVER_ANIM_WALK,
+ /* 2 */ BEAVER_ANIM_SWIM_WITH_SPINNING_TAIL,
+ /* 3 */ BEAVER_ANIM_SWIM_WITH_RAISED_TAIL, // Unused
+ /* 4 */ BEAVER_ANIM_TALK,
+ /* 5 */ BEAVER_ANIM_TALK_WAVE_ARMS,
+ /* 6 */ BEAVER_ANIM_LAUGH_RIGHT,
+ /* 7 */ BEAVER_ANIM_LAUGH_LEFT,
+ /* 8 */ BEAVER_ANIM_SWIM,
+ /* 9 */ BEAVER_ANIM_TALK_TO_LEFT,
+ /* 10 */ BEAVER_ANIM_TALK_TO_RIGHT,
+ /* 11 */ BEAVER_ANIM_BOW,
+ /* 12 */ BEAVER_ANIM_IDLE_FACE_LEFT,
+ /* 13 */ BEAVER_ANIM_IDLE_FACE_RIGHT,
+} BeaverAnimation;
+
+static AnimationSpeedInfo sAnimationInfo[] = {
+ { &gBeaverIdleAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
+ { &gBeaverWalkAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverSwimWithSpinningTail, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverSwimWithRaisedTail, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverTalkAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverTalkWaveArmsAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverLaughRightAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverLaughLeftAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverSwimAnim, 2.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverTalkToLeftAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverTalkToRightAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverBowAnim, 1.0f, ANIMMODE_ONCE, -5.0f },
+ { &gBeaverIdleFaceLeftAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
+ { &gBeaverIdleFaceRightAnim, 1.0f, ANIMMODE_LOOP, -5.0f },
};
const ActorInit En_Az_InitVars = {
@@ -170,8 +194,8 @@ static InitChainEntry sInitChain[3] = {
};
void EnAz_Init(Actor* thisx, PlayState* play2) {
- static s16 D_80A9914C[7] = { 1, 0, 3, 2, 5, 4, -1 };
- static s16 D_80A9915C[7] = { 0, 1, 0, 1, 0, 1, 1 };
+ static s16 D_80A9914C[] = { 1, 0, 3, 2, 5, 4, -1 };
+ static s16 D_80A9915C[] = { 0, 1, 0, 1, 0, 1, 1 };
EnAz* this = THIS;
PlayState* play = play2;
s16 sp4E;
@@ -236,12 +260,12 @@ void EnAz_Init(Actor* thisx, PlayState* play2) {
}
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
if (this->unk_374 & 2) {
- SkelAnime_InitFlex(play, &this->skelAnime, &object_az_Skel_007438, &object_az_Anim_00C94C, this->jointTable,
- this->morphTable, OBJECT_AZ_1_LIMB_MAX);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gBeaverOlderBrotherSkel, &gBeaverWalkAnim, this->jointTable,
+ this->morphTable, BEAVER_OLDER_BROTHER_LIMB_MAX);
Actor_SetScale(&this->actor, 0.012f);
} else {
- SkelAnime_InitFlex(play, &this->skelAnime, &object_az_Skel_017990, &object_az_Anim_00C94C, this->jointTable,
- this->morphTable, OBJECT_AZ_2_LIMB_MAX);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gBeaverYoungerBrotherSkel, &gBeaverWalkAnim, this->jointTable,
+ this->morphTable, BEAVER_YOUNGER_BROTHER_LIMB_MAX);
}
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
if (this->unk_374 & 2) {
@@ -254,16 +278,16 @@ void EnAz_Init(Actor* thisx, PlayState* play2) {
this->unk_374 |= 0x100;
this->unk_376 |= 0x100;
}
- Animation_Change(&this->skelAnime, sAnimationInfo[0].animation, 1.0f,
- Animation_GetLastFrame(sAnimationInfo[0].animation) * Rand_ZeroOne(),
- Animation_GetLastFrame(sAnimationInfo[0].animation), sAnimationInfo[0].mode,
- sAnimationInfo[0].morphFrames);
+ Animation_Change(&this->skelAnime, sAnimationInfo[BEAVER_ANIM_IDLE].animation, 1.0f,
+ Animation_GetLastFrame(sAnimationInfo[BEAVER_ANIM_IDLE].animation) * Rand_ZeroOne(),
+ Animation_GetLastFrame(sAnimationInfo[BEAVER_ANIM_IDLE].animation),
+ sAnimationInfo[BEAVER_ANIM_IDLE].mode, sAnimationInfo[BEAVER_ANIM_IDLE].morphFrames);
this->unk_37E = 0;
this->unk_380 = 0;
this->unk_384 = 0;
this->actor.gravity = -1.0f;
this->unk_376 = this->unk_374;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex);
this->skelAnime.curFrame = Rand_ZeroOne() * this->skelAnime.endFrame;
switch (gSaveContext.save.entrance) {
@@ -524,9 +548,10 @@ s32 func_80A95B34(PlayState* play, ActorPathing* actorPathing) {
if (this->unk_374 & 0x100) {
if (!(this->unk_374 & 8)) {
if (this->unk_374 & 2) {
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 8, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_SWIM, &this->animIndex);
} else {
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_SWIM_WITH_SPINNING_TAIL,
+ &this->animIndex);
}
this->unk_374 |= 8;
}
@@ -537,7 +562,7 @@ s32 func_80A95B34(PlayState* play, ActorPathing* actorPathing) {
}
} else if (this->actor.bgCheckFlags & 1) {
if (this->unk_374 & 8) {
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 1, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_WALK, &this->animIndex);
this->unk_374 &= ~8;
}
ret = func_80A95534(play, actorPathing);
@@ -551,7 +576,7 @@ void func_80A95C5C(EnAz* this, PlayState* play) {
this->actor.draw = NULL;
this->actor.world.pos.y = this->actor.home.pos.y + 120.0f;
this->actor.gravity = -1.0f;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex);
this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8);
this->actor.bgCheckFlags &= ~0x21;
this->unk_3C0 = 0;
@@ -585,7 +610,8 @@ void func_80A95DA0(EnAz* this, PlayState* play) {
this->unk_36C = 4.0f;
this->actor.speedXZ = 4.0f;
this->actor.gravity = 0.0f;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_SWIM_WITH_SPINNING_TAIL,
+ &this->animIndex);
this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8);
this->actor.bgCheckFlags &= ~0x21;
this->unk_374 |= 0x1000;
@@ -636,7 +662,7 @@ void func_80A95FE8(EnAz* this, PlayState* play) {
this->actor.shape.rot.z = 0;
Actor_MoveWithoutGravityReverse(&this->actor);
} else {
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex);
this->unk_374 &= ~0x1000;
this->actor.gravity = -1.0f;
this->actor.speedXZ = 0.0f;
@@ -674,8 +700,10 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
case 0xCD:
gSaveContext.save.weekEventReg[24] &= (u8)~1;
this->actor.textId = 0x10F2;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 11, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 11, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW,
+ &brother->animIndex);
break;
case 0x10CE:
this->actor.textId = 0x10CF;
@@ -687,34 +715,41 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
case 0x10D0:
this->actor.textId = 0x10D1;
ret = 3;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 5, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK_WAVE_ARMS,
+ &this->animIndex);
break;
case 0x10D1:
this->actor.textId = 0x10D2;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
break;
case 0x10D2:
if (play->msgCtx.choiceIndex == 0) {
func_8019F208();
this->actor.textId = 0x10D6;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 5, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo,
+ BEAVER_ANIM_TALK_WAVE_ARMS, &this->animIndex);
} else {
func_8019F230();
this->actor.textId = 0x10D3;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 11, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW,
+ &this->animIndex);
}
break;
case 0x10D3:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
this->unk_374 |= 0x20;
ret = 0;
break;
case 0x10D4:
this->actor.textId = 0x10D2;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
break;
case 0x10D6:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
func_80A979DC(this, play);
this->unk_2FA = 1;
ret = 0;
@@ -755,7 +790,8 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
break;
case 0x10DA:
this->actor.textId = 0x10DB;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
break;
case 0x10DB:
if (play->msgCtx.choiceIndex == 0) {
@@ -766,7 +802,8 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
} else {
func_8019F230();
this->actor.textId = 0x10DC;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 11, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW,
+ &this->animIndex);
}
break;
case 0x10DC:
@@ -776,37 +813,38 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
ret = 0;
break;
case 0x10DD:
- func_80A98EFC(this, play, 0x10DE, 13, 9);
+ func_80A98EFC(this, play, 0x10DE, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK_TO_LEFT);
this->unk_374 |= 0x8000;
ret = 2;
break;
case 0x10DE:
- func_80A98EFC(this, play, 0x10DF, 12, 10);
+ func_80A98EFC(this, play, 0x10DF, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10DF:
- func_80A98EFC(this, play, 0x10E0, 13, 9);
+ func_80A98EFC(this, play, 0x10E0, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK_TO_LEFT);
ret = 0;
break;
case 0x10E0:
- func_80A98EFC(this, play, 0x10E1, 12, 10);
+ func_80A98EFC(this, play, 0x10E1, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10E1:
- func_80A98EFC(this, play, 0x10E2, 13, 9);
+ func_80A98EFC(this, play, 0x10E2, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK_TO_LEFT);
ret = 0;
break;
case 0x10E2:
this->actor.textId = 0x10E3;
ret = 3;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
break;
case 0x10E3:
- func_80A98EFC(this, play, 0x10E4, 0, 4);
+ func_80A98EFC(this, play, 0x10E4, BEAVER_ANIM_IDLE, BEAVER_ANIM_TALK);
ret = 0;
break;
case 0x10E4:
- func_80A98EFC(this, play, 0x10E5, 0, 4);
+ func_80A98EFC(this, play, 0x10E5, BEAVER_ANIM_IDLE, BEAVER_ANIM_TALK);
ret = 0;
break;
case 0x10E5:
@@ -816,36 +854,41 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
} else {
func_8019F230();
this->actor.textId = 0x10E6;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 9, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 13,
- &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK_TO_LEFT,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo,
+ BEAVER_ANIM_IDLE_FACE_RIGHT, &brother->animIndex);
}
break;
case 0x10E6:
this->actor.textId = 0x10E7;
- func_80A98EFC(this, play, 0x10E7, 0, 10);
+ func_80A98EFC(this, play, 0x10E7, BEAVER_ANIM_IDLE, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10E7:
gSaveContext.save.weekEventReg[24] &= (u8)~4;
func_80A94AB8(this, play, 0);
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
func_80A979DC(this, play);
ret = 0;
break;
case 0x10E8:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
this->unk_2FA = 3;
ret = 0;
break;
case 0x10E9:
- func_80A98EFC(this, play, 0x10EA, 12, 4);
+ func_80A98EFC(this, play, 0x10EA, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK);
ret = 0;
break;
case 0x10EA:
- func_80A98EFC(this, play, 0x10EB, 0, 4);
+ func_80A98EFC(this, play, 0x10EB, BEAVER_ANIM_IDLE, BEAVER_ANIM_TALK);
ret = 0;
break;
case 0x10EB:
@@ -869,13 +912,14 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
} else {
func_8019F230();
this->actor.textId = 0x10EC;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 7, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 13,
- &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_LAUGH_LEFT,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo,
+ BEAVER_ANIM_IDLE_FACE_RIGHT, &brother->animIndex);
}
break;
case 0x10EC:
- func_80A98EFC(this, play, 0x10ED, -1, 6);
+ func_80A98EFC(this, play, 0x10ED, -1, BEAVER_ANIM_LAUGH_RIGHT);
ret = 0;
break;
case 0x10ED:
@@ -887,15 +931,15 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
ret = 0;
break;
case 0x10EE:
- func_80A98EFC(this, play, 0x10EF, 12, 10);
+ func_80A98EFC(this, play, 0x10EF, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10EF:
- func_80A98EFC(this, play, 0x10F0, 13, 9);
+ func_80A98EFC(this, play, 0x10F0, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK_TO_LEFT);
ret = 0;
break;
case 0x10F0:
- func_80A98EFC(this, play, 0x10F1, 12, 10);
+ func_80A98EFC(this, play, 0x10F1, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10F1:
@@ -906,39 +950,44 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
this->getItemId = GI_BOTTLE;
gSaveContext.save.weekEventReg[23] |= 0x80;
}
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
ret = 7;
break;
case 0x10F2:
case 0x1109:
gSaveContext.save.weekEventReg[24] &= (u8)~4;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
func_80A94AB8(this, play, 0);
func_80A979DC(this, play);
ret = 0;
break;
case 0x10F3:
- func_80A98EFC(this, play, 0x10F4, 12, 10);
+ func_80A98EFC(this, play, 0x10F4, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10F4:
- func_80A98EFC(this, play, 0x10F5, 13, 9);
+ func_80A98EFC(this, play, 0x10F5, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK_TO_LEFT);
ret = 0;
break;
case 0x10F5:
- func_80A98EFC(this, play, 0x10F6, 12, 10);
+ func_80A98EFC(this, play, 0x10F6, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10F6:
- func_80A98EFC(this, play, 0x10F7, 13, 5);
+ func_80A98EFC(this, play, 0x10F7, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK_WAVE_ARMS);
ret = 0;
break;
case 0x10F7:
this->actor.textId = 0x10F8;
ret = 3;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
break;
case 0x10F8:
if (play->msgCtx.choiceIndex == 0) {
@@ -948,41 +997,49 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
} else {
this->actor.textId = 0x10FA;
}
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 5, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo,
+ BEAVER_ANIM_TALK_WAVE_ARMS, &this->animIndex);
} else {
func_8019F230();
this->actor.textId = 0x10F9;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 11, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 11,
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW,
&brother->animIndex);
}
break;
case 0x10F9:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
this->unk_374 |= 0x20;
ret = 0;
break;
case 0x10FA:
case 0x1107:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
this->unk_2FA = 6;
ret = 0;
break;
case 0x10FB:
- func_80A98EFC(this, play, 0x10FC, 12, 10);
+ func_80A98EFC(this, play, 0x10FC, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x10FC:
- func_80A98EFC(this, play, 0x10FD, 13, 4);
+ func_80A98EFC(this, play, 0x10FD, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK);
ret = 0;
break;
case 0x10FD:
this->actor.textId = 0x10FE;
ret = 3;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
break;
case 0x10FE:
if (play->msgCtx.choiceIndex == 0) {
@@ -992,44 +1049,50 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
} else {
this->actor.textId = 0x1101;
}
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
} else {
func_8019F230();
this->actor.textId = 0x10FF;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 9, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 13,
- &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK_TO_LEFT,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo,
+ BEAVER_ANIM_IDLE_FACE_RIGHT, &brother->animIndex);
}
break;
case 0x10FF:
- func_80A98EFC(this, play, 0x1100, 12, 10);
+ func_80A98EFC(this, play, 0x1100, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x1100:
gSaveContext.save.weekEventReg[24] &= (u8)~4;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
func_80A94AB8(this, play, 0);
func_80A979DC(this, play);
ret = 0;
break;
case 0x1101:
case 0x1108:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
this->unk_2FA = 8;
ret = 0;
break;
case 0x1102:
- func_80A98EFC(this, play, 0x1103, 12, 10);
+ func_80A98EFC(this, play, 0x1103, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x1103:
- func_80A98EFC(this, play, 0x1104, 13, 9);
+ func_80A98EFC(this, play, 0x1104, BEAVER_ANIM_IDLE_FACE_RIGHT, BEAVER_ANIM_TALK_TO_LEFT);
ret = 0;
break;
case 0x1104:
- func_80A98EFC(this, play, 0x1105, 12, 10);
+ func_80A98EFC(this, play, 0x1105, BEAVER_ANIM_IDLE_FACE_LEFT, BEAVER_ANIM_TALK_TO_RIGHT);
ret = 0;
break;
case 0x1105:
@@ -1039,21 +1102,26 @@ s32 func_80A9617C(EnAz* this, PlayState* play) {
this->getItemId = GI_HEART_PIECE;
gSaveContext.save.weekEventReg[25] |= 1;
}
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
ret = 7;
break;
case 0x1106:
gSaveContext.save.weekEventReg[24] &= (u8)~4;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 0, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &brother->animIndex);
func_80A94AB8(this, play, 0);
func_80A979DC(this, play);
ret = 0;
break;
case 0x10D5:
default:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE,
+ &this->animIndex);
this->unk_374 |= 0x20;
ret = 0;
break;
@@ -1078,29 +1146,33 @@ void func_80A97114(EnAz* this, PlayState* play) {
case 0x10DA:
case 0x10DD:
case 0x10E9:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK, &this->animIndex);
break;
case 0x10EE:
case 0x10F3:
case 0x10FB:
case 0x1102:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 9, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK_TO_LEFT,
+ &this->animIndex);
sp20 = true;
break;
case 0x10F2:
case 0x1106:
case 0x1109:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 11, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW, &this->animIndex);
if (brother != NULL) {
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 11, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_BOW,
+ &brother->animIndex);
}
break;
}
if ((brother != NULL) && sp20) {
if (this->unk_374 & 2) {
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 13, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE_FACE_RIGHT,
+ &brother->animIndex);
} else {
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, 12, &brother->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE_FACE_LEFT,
+ &brother->animIndex);
}
}
this->unk_374 &= ~0x20;
@@ -1247,10 +1319,12 @@ void func_80A97410(EnAz* this, PlayState* play) {
if (temp_a0 == 0) {
switch (this->unk_3D2) {
case 0x10CE:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 4, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK,
+ &this->animIndex);
break;
case 0x10D4:
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 5, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_TALK_WAVE_ARMS,
+ &this->animIndex);
break;
}
Message_StartTextbox(play, this->unk_3D2, &this->actor);
@@ -1386,8 +1460,8 @@ void func_80A97C24(EnAz* this, PlayState* play) {
}
void func_80A97C4C(EnAz* this, PlayState* play) {
- if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == 0xB)) {
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex);
+ if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == BEAVER_ANIM_BOW)) {
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex);
}
func_80A97410(this, play);
if ((this->unk_2FA == 1) || (this->unk_2FA == 3) || (this->unk_2FA == 6) || (this->unk_2FA == 8)) {
@@ -1439,7 +1513,8 @@ void func_80A97EAC(EnAz* this, PlayState* play) {
this->actor.speedXZ = 8.0f;
this->actor.gravity = 0.0f;
this->actor.velocity.y = 6.0f;
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex);
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_SWIM_WITH_SPINNING_TAIL,
+ &this->animIndex);
this->actor.flags |= ACTOR_FLAG_8000000;
this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8);
this->actor.bgCheckFlags &= ~0x21;
@@ -1603,17 +1678,18 @@ void EnAz_Update(Actor* thisx, PlayState* play2) {
}
}
-static Gfx* D_80A9916C[5] = {
- object_az_DL_01A600, object_az_DL_01A730, object_az_DL_01A860, object_az_DL_01A990, object_az_DL_01AAC0,
+static Gfx* D_80A9916C[] = {
+ gBeaverOlderBrotherTailVortex1DL, gBeaverOlderBrotherTailVortex2DL, gBeaverOlderBrotherTailVortex3DL,
+ gBeaverOlderBrotherTailVortex4DL, gBeaverOlderBrotherTailVortex5DL,
};
-static AnimatedMaterial* D_80A99180[5] = {
- object_az_Matanimheader_01A6E8, object_az_Matanimheader_01A818, object_az_Matanimheader_01A948,
- object_az_Matanimheader_01AA78, object_az_Matanimheader_01ABA8,
+static AnimatedMaterial* D_80A99180[] = {
+ gBeaverOlderBrotherTailVortex1TexAnim, gBeaverOlderBrotherTailVortex2TexAnim, gBeaverOlderBrotherTailVortex3TexAnim,
+ gBeaverOlderBrotherTailVortex4TexAnim, gBeaverOlderBrotherTailVortex5TexAnim,
};
-static u8 D_80A99194[5] = {
+static u8 D_80A99194[] = {
95, 135, 175, 215, 255,
};
-static u8 D_80A9919C[5] = {
+static u8 D_80A9919C[] = {
31, 45, 58, 73, 85,
};
static struct_80124618 D_80A991A4[5][9] = {
@@ -1680,26 +1756,26 @@ static struct_80A98F94 D_80A9930C[5][4] = {
{ { 0, 1900.0f }, { 4, 1600.0f }, { 10, 2200.0f }, { 16, 1900.0f } },
{ { 0, 1900.0f }, { 7, 1400.0f }, { 16, 1900.0f }, { 0, 0.0f } },
};
-static Vec3f D_80A993AC[3] = {
+static Vec3f D_80A993AC[] = {
{ 1.0f, 1.0f, 0.0f },
{ 0.9f, 0.9f, 120.0f },
{ 0.95f, 0.95f, 240.0f },
};
-static Vec3f D_80A993D0[3] = {
+static Vec3f D_80A993D0[] = {
{ 1.5f, 1.5f, 0.0f },
{ 1.2f, 1.2f, 120.0f },
{ 1.35f, 1.35f, 240.0f },
};
-static TexturePtr D_80A993F4[4] = {
- object_az_Tex_00F918,
- object_az_Tex_010118,
- object_az_Tex_010918,
- object_az_Tex_011118,
+static TexturePtr sYoungerBrotherEyeTextures[] = {
+ gBeaverYoungerBrotherEye1Tex,
+ gBeaverYoungerBrotherEye2Tex,
+ gBeaverYoungerBrotherEye3Tex,
+ gBeaverYoungerBrotherEye4Tex,
};
-static TexturePtr D_80A99404[3] = {
- object_az_Tex_016018,
- object_az_Tex_016818,
- object_az_Tex_017018,
+static TexturePtr sYoungerBrotherBeltTextures[] = {
+ gBeaverYoungerBrotherBeltRedTex,
+ gBeaverYoungerBrotherBeltGreenTex,
+ gBeaverYoungerBrotherBeltBlueTex,
};
void EnAz_Draw(Actor* thisx, PlayState* play2) {
@@ -1715,8 +1791,8 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) {
func_80A98DA4, func_80A98E48, &this->actor);
} else {
OPEN_DISPS(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A993F4[this->unk_37E]));
- gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80A99404[this->unk_380]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sYoungerBrotherEyeTextures[this->unk_37E]));
+ gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sYoungerBrotherBeltTextures[this->unk_380]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_80A98DA4, func_80A98E48, &this->actor);
CLOSE_DISPS(play->state.gfxCtx);
@@ -1767,13 +1843,13 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) {
gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_PrimColor(play->state.gfxCtx, 0x80, 255, 255, 255, 85));
}
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, object_az_DL_01ABF0);
+ 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_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++, object_az_DL_01AD00);
+ gSPDisplayList(POLY_XLU_DISP++, gBeaverYoungerBrotherTailSplashDL);
}
}
CLOSE_DISPS(play->state.gfxCtx);
@@ -1782,20 +1858,20 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) {
s32 func_80A98DA4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnAz* this = THIS;
- if ((limbIndex == OBJECT_AZ_1_LIMB_NONE) && ((play->gameplayFrames % 2) != 0)) {
+ if ((limbIndex == BEAVER_OLDER_BROTHER_LIMB_NONE) && ((play->gameplayFrames % 2) != 0)) {
*dList = NULL;
}
- if (limbIndex == OBJECT_AZ_1_LIMB_NONE) {
+ if (limbIndex == BEAVER_OLDER_BROTHER_LIMB_NONE) {
rot->x = rot->x;
rot->y = rot->y;
rot->z = rot->z;
}
- if (limbIndex == OBJECT_AZ_1_LIMB_03) {
+ if (limbIndex == BEAVER_OLDER_BROTHER_LIMB_PELVIS) {
rot->y -= this->unk_39E;
} else {
// this space intentionally left blank
}
- if (limbIndex == OBJECT_AZ_1_LIMB_05) {
+ if (limbIndex == BEAVER_OLDER_BROTHER_LIMB_HEAD_ROOT) {
rot->x += this->unk_3D4;
rot->y -= this->unk_3D6;
}
@@ -1808,7 +1884,7 @@ void func_80A98E48(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto
static Vec3f D_80A99428 = { -1200.0f, 0.0f, 1000.0f };
EnAz* this = THIS;
- if (limbIndex == OBJECT_AZ_1_LIMB_03) {
+ if (limbIndex == BEAVER_OLDER_BROTHER_LIMB_PELVIS) {
Matrix_MultVec3f(&D_80A99410, &this->unk_3A8);
Math_SmoothStepToF(&this->unk_3A4, this->unk_3A8.y - this->actor.world.pos.y, 0.8f, 10.0f, 0.01f);
if (this->unk_374 & 2) {
@@ -1819,18 +1895,18 @@ void func_80A98E48(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto
}
}
-void func_80A98EFC(EnAz* this, PlayState* play, u16 textId, s32 arg3, s32 arg4) {
+void func_80A98EFC(EnAz* this, PlayState* play, u16 textId, s32 animIndex, s32 brotherAnimIndex) {
EnAz* brother = this->brother;
Actor_ChangeFocus(&this->actor, play, &brother->actor);
- if (arg3 >= 0) {
- SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, arg3, &this->animIndex);
+ if (animIndex >= 0) {
+ SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, animIndex, &this->animIndex);
}
this->actor.textId = 0;
brother->actor.textId = textId;
brother->unk_378 = 5;
- if ((arg4 >= 0) && (arg4 != brother->animIndex)) {
- SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, arg4, &brother->animIndex);
+ if ((brotherAnimIndex >= 0) && (brotherAnimIndex != brother->animIndex)) {
+ SubS_ChangeAnimationBySpeedInfo(&brother->skelAnime, sAnimationInfo, brotherAnimIndex, &brother->animIndex);
}
this->unk_378 = 0;
}
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 f53b58bf6..0a0c6dd3f 100644
--- a/src/overlays/actors/ovl_En_Bee/z_en_bee.c
+++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.c
@@ -17,8 +17,11 @@ void EnBee_Draw(Actor* thisx, PlayState* play);
void func_80B5A9E8(EnBee* this, PlayState* play);
void func_80B5AC3C(EnBee* this, PlayState* play);
+void func_80B5A854(EnBee* this);
+void func_80B5ABC4(EnBee* this);
+
+s32 D_80B5B1F0 = 0;
-#if 0
const ActorInit En_Bee_InitVars = {
ACTOR_EN_BEE,
ACTORCAT_ENEMY,
@@ -31,8 +34,7 @@ const ActorInit En_Bee_InitVars = {
(ActorFunc)EnBee_Draw,
};
-// static DamageTable sDamageTable = {
-static DamageTable D_80B5B214 = {
+static DamageTable sDamageTable = {
/* Deku Nut */ DMG_ENTRY(1, 0xF),
/* Deku Stick */ DMG_ENTRY(1, 0xF),
/* Horse trample */ DMG_ENTRY(1, 0xF),
@@ -67,34 +69,219 @@ static DamageTable D_80B5B214 = {
/* Powder Keg */ DMG_ENTRY(1, 0xF),
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_80B5B234 = {
- { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x08, 0x02 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_NONE,
+ AT_ON | AT_TYPE_ENEMY,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0xF7CFFFFF, 0x08, 0x02 },
+ { 0xF7CFFFFF, 0x00, 0x00 },
+ TOUCH_ON | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 6, 13, -4, { 0, 0, 0 } },
};
-#endif
+void EnBee_Init(Actor* thisx, PlayState* play) {
+ EnBee* this = THIS;
-extern DamageTable D_80B5B214;
-extern ColliderCylinderInit D_80B5B234;
+ this->actor.colChkInfo.mass = 10;
+ ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f);
+ SkelAnime_Init(play, &this->skelAnime, &object_bee_Skel_001398, &object_bee_Anim_00005C, this->morphTable,
+ this->jointTable, OBJECT_BEE_LIMB_MAX);
+ this->actor.colChkInfo.health = 1;
+ this->actor.colChkInfo.damageTable = &sDamageTable;
+ this->actor.targetMode = 6;
+ Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
+ this->unk_218 = D_80B5B1F0;
+ D_80B5B1F0++;
+ this->actor.shape.shadowScale = 12.0f;
-extern UNK_TYPE D_0600005C;
+ if (ActorCutscene_GetCurrentIndex() != -1) {
+ func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Init.s")
+ this->actor.hintId = TATL_HINT_ID_GIANT_BEE;
+ func_80B5A854(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Destroy.s")
+void EnBee_Destroy(Actor* thisx, PlayState* play) {
+ EnBee* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5A854.s")
+ Collider_DestroyCylinder(play, &this->collider);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5A9E8.s")
+void func_80B5A854(EnBee* this) {
+ s32 pad;
+ Vec3f sp48;
+ s16 sp46;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5ABC4.s")
+ Animation_Change(&this->skelAnime, &object_bee_Anim_00005C, 1.0f, 0.0f,
+ Animation_GetLastFrame(&object_bee_Anim_00005C), 0, -10.0f);
+ Math_Vec3f_Copy(&sp48, &this->actor.home.pos);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5AC3C.s")
+ sp46 = (this->unk_218 * 0x700) + 0x2000;
+ sp48.x += Math_SinS(sp46) * 50.0f;
+ sp48.y = Rand_ZeroFloat(50.0f) + (this->actor.floorHeight + 30.0f);
+ sp48.z += Math_CosS(sp46) * 50.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5AF80.s")
+ Math_Vec3f_Copy(&this->unk_21C[0], &sp48);
+ Math_Vec3f_Copy(&sp48, &this->actor.home.pos);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Update.s")
+ sp48.x += Math_SinS(sp46 - 0x4000) * 50.0f;
+ sp48.y = Rand_ZeroFloat(50.0f) + (this->actor.floorHeight + 30.0f);
+ sp48.z += Math_CosS(sp46 - 0x4000) * 50.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Draw.s")
+ Math_Vec3f_Copy(&this->unk_21C[1], &sp48);
+
+ this->unk_204 = Rand_S16Offset(0x14, 0x1E);
+ this->unk_208 = 0;
+ this->actionFunc = func_80B5A9E8;
+}
+
+void func_80B5A9E8(EnBee* this, PlayState* play) {
+ Vec3f sp3C;
+ s32 pad[2];
+
+ if ((this->actor.category != ACTORCAT_ENEMY) && (ActorCutscene_GetCurrentIndex() == -1)) {
+ func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY);
+ }
+
+ Math_Vec3f_Copy(&sp3C, &this->unk_21C[this->unk_214]);
+ sp3C.x += Math_SinS(this->unk_20C) * 30.0f;
+ sp3C.z += Math_CosS(this->unk_20C) * 30.0f;
+
+ if (!(this->unk_218 & 1)) {
+ this->unk_20C += (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000);
+ } else {
+ this->unk_20C -= (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000);
+ }
+
+ this->unk_210 += 1000;
+ this->actor.velocity.y = Math_SinS(this->unk_210);
+
+ if (this->unk_20C > 0x10000) {
+ this->unk_20C = 0;
+ this->unk_214++;
+ this->unk_214 &= 1;
+ }
+
+ Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp3C), 1, 0x7D0, 0);
+ Math_ApproachF(&this->actor.speedXZ, 3.0f, 0.3f, 1.0f);
+
+ if ((this->unk_204 == 0) && (this->actor.params != 0)) {
+ func_80B5ABC4(this);
+ }
+}
+
+void func_80B5ABC4(EnBee* this) {
+ Animation_Change(&this->skelAnime, &object_bee_Anim_00005C, 1.0f, 0.0f,
+ Animation_GetLastFrame(&object_bee_Anim_00005C), 0, -10.0f);
+ this->unk_208 = 1;
+ this->actionFunc = func_80B5AC3C;
+}
+
+void func_80B5AC3C(EnBee* this, PlayState* play) {
+ Player* player = GET_PLAYER(play);
+ Vec3f sp88;
+ f32 rnd;
+ f32 phi_fs1;
+ s32 i;
+
+ Math_Vec3f_Copy(&sp88, &player->actor.world.pos);
+ phi_fs1 = (this->unk_218 * 0x700) + 0x2000;
+
+ for (i = 0; i < 2; i++) {
+ rnd = randPlusMinusPoint5Scaled(20.0f);
+ sp88.x += Math_SinS((this->actor.yawTowardsPlayer + ((f32)this->unk_20C)) + phi_fs1) * (rnd + 30.0f);
+ sp88.y = (Math_SinS(this->unk_210) * 10.0f) + (player->actor.floorHeight + 40.0f);
+ rnd = randPlusMinusPoint5Scaled(20.0f);
+ sp88.z += Math_CosS((f32)this->actor.yawTowardsPlayer + this->unk_20C + phi_fs1) * (rnd + 30.0f);
+ Math_Vec3f_Copy(&this->unk_21C[i], &sp88);
+ phi_fs1 -= 16384.0f;
+ }
+
+ Math_Vec3f_Copy(&sp88, &this->unk_21C[this->unk_214]);
+
+ if (!(this->unk_218 & 1)) {
+ this->unk_20C += (this->unk_218 * 0x700) + (s32)randPlusMinusPoint5Scaled((this->unk_218 * 0x700) * 0.5f);
+ } else {
+ this->unk_20C -= (this->unk_218 * 0x700) + (s32)randPlusMinusPoint5Scaled((this->unk_218 * 0x700) * 0.5f);
+ }
+
+ this->unk_210 += (s32)randPlusMinusPoint5Scaled(500.0f) + 1000;
+
+ if (this->unk_20C > 0x10000) {
+ this->unk_20C = 0;
+ this->unk_214++;
+ this->unk_214 &= 1;
+ }
+
+ Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp88), 1, 0x1388, 0);
+ Math_ApproachF(&this->actor.world.pos.y, sp88.y, 0.3f, 3.0f);
+ Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.3f, 1.0f);
+}
+
+void func_80B5AF80(EnBee* this, PlayState* play) {
+ if ((this->unk_206 == 0) && (this->collider.base.atFlags & AC_HIT)) {
+ AudioSfx_StopByPosAndId(&this->actor.projectedPos, NA_SE_EN_BEE_FLY - SFX_FLAG);
+ this->unk_206 = 5;
+ }
+
+ if (this->collider.base.acFlags & AC_HIT) {
+ Enemy_StartFinishingBlow(play, &this->actor);
+ this->actor.speedXZ = 0.0f;
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 10, NA_SE_EN_CUTBODY);
+ this->actor.colChkInfo.health = 0;
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_EXTINCT);
+ func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 100, 0, 2);
+ Actor_MarkForDeath(&this->actor);
+ }
+}
+
+void EnBee_Update(Actor* thisx, PlayState* play) {
+ s32 pad;
+ EnBee* this = THIS;
+
+ SkelAnime_Update(&this->skelAnime);
+
+ if (this->actor.category == ACTORCAT_ENEMY) {
+ if (this->unk_204 != 0) {
+ this->unk_204--;
+ }
+ if (this->unk_206 != 0) {
+ this->unk_206--;
+ }
+ }
+
+ Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BEE_FLY - SFX_FLAG);
+ func_80B5AF80(this, play);
+ Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot);
+ Actor_SetFocus(&this->actor, 0.0f);
+ Actor_SetScale(&this->actor, 0.01f);
+
+ this->actionFunc(this, play);
+
+ Actor_MoveWithGravity(&this->actor);
+ Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, 0x1D);
+
+ Collider_UpdateCylinder(&this->actor, &this->collider);
+ CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
+ CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
+}
+
+void EnBee_Draw(Actor* thisx, PlayState* play) {
+ EnBee* this = THIS;
+
+ func_8012C28C(play->state.gfxCtx);
+ func_8012C2DC(play->state.gfxCtx);
+ SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor);
+}
diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.h b/src/overlays/actors/ovl_En_Bee/z_en_bee.h
index 1676a5507..1638407ee 100644
--- a/src/overlays/actors/ovl_En_Bee/z_en_bee.h
+++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.h
@@ -2,6 +2,7 @@
#define Z_EN_BEE_H
#include "global.h"
+#include "assets/objects/object_bee/object_bee.h"
struct EnBee;
@@ -9,9 +10,20 @@ typedef void (*EnBeeActionFunc)(struct EnBee*, PlayState*);
typedef struct EnBee {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0xBC];
+ /* 0x144 */ SkelAnime skelAnime;
+ /* 0x188 */ Vec3s morphTable[OBJECT_BEE_LIMB_MAX];
+ /* 0x1C4 */ Vec3s jointTable[OBJECT_BEE_LIMB_MAX];
/* 0x200 */ EnBeeActionFunc actionFunc;
- /* 0x204 */ char unk_204[0x84];
+ /* 0x204 */ s16 unk_204;
+ /* 0x206 */ s16 unk_206;
+ /* 0x208 */ s16 unk_208;
+ /* 0x20C */ s32 unk_20C;
+ /* 0x210 */ s32 unk_210;
+ /* 0x214 */ s32 unk_214;
+ /* 0x218 */ s32 unk_218;
+ /* 0x21C */ Vec3f unk_21C[2];
+ /* 0x234 */ UNK_TYPE1 pad234[8];
+ /* 0x23C */ ColliderCylinder collider;
} EnBee; // size = 0x288
extern const ActorInit En_Bee_InitVars;
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 047567b98..4f8f28f3c 100644
--- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
+++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
@@ -443,7 +443,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) {
bubblePos.z = this->picto.actor.world.pos.z + (2.0f * bubbleVel.z);
EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVel, &D_80AC45A4, &D_80AC45B0,
- &D_80AC45B8, Rand_S16Offset(150, 50), 25, 0);
+ &D_80AC45B8, Rand_S16Offset(150, 50), 25, false);
}
if (this->picto.actor.params != 0xFF) {
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 0be5ad0b4..20a868bc6 100644
--- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
+++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c
@@ -219,7 +219,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) {
}
if (thisx->params == ENBIGPO_REGULAR) { // the well poe, starts immediately
- thisx->flags &= ~0x10; // always update OFF
+ thisx->flags &= ~ACTOR_FLAG_10; // always update OFF
this->unkBool204 = true;
EnBigpo_InitWellBigpo(this);
} else if (thisx->params == ENBIGPO_SUMMONED) { // dampe type
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 6b79d6021..5d5b01ee8 100644
--- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c
+++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c
@@ -139,7 +139,7 @@ void EnBom_Init(Actor* thisx, PlayState* play) {
this->flashSpeedScale = 7;
this->isPowderKeg = ENBOM_GETX_1(&this->actor);
if (this->isPowderKeg) {
- play->actorCtx.unk5 |= 1;
+ play->actorCtx.flags |= ACTORCTX_FLAG_0;
this->timer = gSaveContext.powderKegTimer;
} else {
this->timer = 70;
@@ -188,7 +188,7 @@ void EnBom_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyJntSph(play, &this->collider2);
Collider_DestroyCylinder(play, &this->collider1);
if (this->isPowderKeg) {
- play->actorCtx.unk5 &= ~1;
+ play->actorCtx.flags &= ~ACTORCTX_FLAG_0;
}
}
@@ -541,7 +541,7 @@ void EnBom_Update(Actor* thisx, PlayState* play) {
Camera_AddQuake(&play->mainCamera, 2, 11, 8);
thisx->params = ENBOM_1;
this->timer = 10;
- thisx->flags |= (0x100000 | 0x20);
+ thisx->flags |= (ACTOR_FLAG_20 | ACTOR_FLAG_100000);
this->actionFunc = func_808715B8;
if (this->isPowderKeg) {
gSaveContext.powderKegTimer = 0;
diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c
index df4adfc20..2c68e20f8 100644
--- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c
+++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c
@@ -219,7 +219,7 @@ void func_808A2918(EnBoom* this, PlayState* play) {
(this->collider.base.at->id == ACTOR_EN_SI))) {
this->unk_1C8 = this->collider.base.at;
if (this->collider.base.at->id == ACTOR_EN_SI) {
- this->collider.base.at->flags |= 0x2000;
+ this->collider.base.at->flags |= ACTOR_FLAG_2000;
}
}
@@ -264,7 +264,7 @@ void func_808A2918(EnBoom* this, PlayState* play) {
sp7C->gravity = -0.9f;
sp7C->bgCheckFlags &= ~3;
} else {
- sp7C->flags &= -0x2001;
+ sp7C->flags &= ~ACTOR_FLAG_2000;
}
}
Actor_MarkForDeath(&this->actor);
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 bfc242060..10c28b6eb 100644
--- a/src/overlays/actors/ovl_En_Box/z_en_box.c
+++ b/src/overlays/actors/ovl_En_Box/z_en_box.c
@@ -604,7 +604,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) {
EnBox_ClipToGround(this, play);
}
if ((this->getItemId == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) {
- play->actorCtx.unk5 |= 8;
+ play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
this->actionFunc(this, play);
if (this->movementFlags & ENBOX_MOVE_0x80) {
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 54a78442c..0b909d61f 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
@@ -234,7 +234,7 @@ void func_80AFE414(Actor* thisx, PlayState* play) {
func_8012C2DC(play->state.gfxCtx);
func_800B8118(&this->actor, play, 0);
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_05AAB0);
+ gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -246,9 +246,9 @@ void func_80AFE4AC(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
+ gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -268,8 +268,8 @@ void func_80AFE650(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05CEF0));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropBombTex));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
+ gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
CLOSE_DISPS(play->state.gfxCtx);
}
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 3b4ab74ae..d663bcf74 100644
--- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c
+++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c
@@ -252,8 +252,8 @@ s32 func_80A5086C(EnDnbUnkStruct* arg0) {
}
s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) {
- static TexturePtr D_80A50CBC[] = {
- gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
+ static TexturePtr sDustTextures[] = {
+ gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex,
};
PlayState* play = play2;
s32 isGfxSetup = false;
@@ -286,7 +286,7 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
idx = (arg0->unk_01 / (f32)arg0->unk_02) * 8.0f;
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A50CBC[idx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[idx]));
gSPDisplayList(POLY_XLU_DISP++, object_hanareyama_obj_DL_000020);
Matrix_Pop();
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 5bc260ccc..c8b1c9823 100644
--- a/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c
+++ b/src/overlays/actors/ovl_En_Dragon/z_en_dragon.c
@@ -317,7 +317,8 @@ void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) {
sBubbleAccel.y = Rand_ZeroFloat(1.0f) * 20.0f * 3.0f;
scale = Rand_S16Offset(380, 240);
EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &sBubbleVelocity, &sBubbleAccel,
- &sBubblePrimColors[colorIndex], &sBubbleEnvColors[colorIndex], scale, 30, 0);
+ &sBubblePrimColors[colorIndex], &sBubbleEnvColors[colorIndex], scale, 30,
+ false);
}
}
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 798311c77..c7ea4f5b0 100644
--- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c
+++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c
@@ -1463,7 +1463,7 @@ void func_8089010C(Actor* thisx, PlayState* play) {
}
if (player->tatlTextId < 0) {
- thisx->flags |= 0x10000;
+ thisx->flags |= ACTOR_FLAG_10000;
}
if (Actor_ProcessTalkRequest(thisx, &play->state)) {
@@ -1480,7 +1480,7 @@ void func_8089010C(Actor* thisx, PlayState* play) {
thisx->update = func_8088FE64;
func_8088C51C(this, 3);
if (this->elfMsg != NULL) {
- this->elfMsg->flags |= 0x100;
+ this->elfMsg->flags |= ACTOR_FLAG_100;
thisx->cutscene = this->elfMsg->cutscene;
if (thisx->cutscene != -1) {
func_8088FD04(this);
@@ -1492,7 +1492,7 @@ void func_8089010C(Actor* thisx, PlayState* play) {
} else {
thisx->cutscene = -1;
}
- thisx->flags &= ~0x10000;
+ thisx->flags &= ~ACTOR_FLAG_10000;
} else if (this->unk_264 & 4) {
thisx->focus.pos = thisx->world.pos;
this->fairyFlags |= 0x10;
diff --git a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c
index 4b091efc3..e50fc13cd 100644
--- a/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c
+++ b/src/overlays/actors/ovl_En_Elfbub/z_en_elfbub.c
@@ -113,7 +113,7 @@ void EnElfbub_Pop(EnElfbub* this, PlayState* play) {
velocity.y = Rand_ZeroOne() * 7.0f;
velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
EffectSsDtBubble_SpawnCustomColor(play, &pos, &velocity, &sAccel, &sPrimColor, &sEnvColor,
- Rand_S16Offset(100, 50), 25, 0);
+ Rand_S16Offset(100, 50), 25, false);
}
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK);
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 04ad98f8f..fa465afbe 100644
--- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c
+++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c
@@ -263,7 +263,7 @@ void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) {
}
void func_80ACCBB8(EnElforg* this, PlayState* play) {
- play->actorCtx.unk5 |= 8;
+ play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) {
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 7e3a93fa8..fc1bdce22 100644
--- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c
+++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c
@@ -279,7 +279,7 @@ void EnFall_Setup(EnFall* this, PlayState* play) {
this->actor.draw = NULL;
this->actionFunc = EnFall_MoonsTear_Fall;
Actor_SetScale(&this->actor, 0.02f);
- if (!(play->actorCtx.unk5 & 2)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Actor_MarkForDeath(&this->actor);
}
moon = EnFall_MoonsTear_GetTerminaFieldMoon(play);
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 8ad22ff53..cacc2e728 100644
--- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c
+++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c
@@ -444,8 +444,8 @@ void EnFg_UpdateDust(EnFgEffectDust* dustEffect) {
}
}
-TexturePtr sDustTex[] = {
- gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
+static TexturePtr sDustTextures[] = {
+ gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex,
};
void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) {
@@ -475,7 +475,7 @@ void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) {
Matrix_Scale(dustEffect->xyScale, dustEffect->xyScale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
index = 0.5f * dustEffect->timer;
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTex[index]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[index]));
gSPDisplayList(POLY_XLU_DISP++, object_fr_DL_00B338);
}
}
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 40c75c954..8bd1b7e0e 100644
--- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
+++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
@@ -830,7 +830,7 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) {
thisx->focus.pos = thisx->world.pos;
thisx->focus.pos.y += 75.0f;
- thisx->flags |= 9;
+ thisx->flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8);
if (sLinkAge != 1) {
// HIGH_SCORE(HS_FISHING) from OoT
@@ -960,7 +960,7 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) {
this->unk_150 = 100;
func_800BC154(play, &play->actorCtx, thisx, ACTORCAT_PROP);
thisx->targetMode = 0;
- thisx->flags |= 9;
+ thisx->flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8);
this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
} else {
this->unk_150 = 10;
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 69f81e56a..0b52558f5 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
@@ -261,26 +261,26 @@ u8 EnFsn_SetCursorIndexFromNeutral(EnFsn* this) {
}
void EnFsn_CursorLeftRight(EnFsn* this) {
- u8 cursorScan = this->cursorIdx;
+ u8 cursorScan = this->cursorIndex;
if (this->stickAccumX > 0) {
if (cursorScan != this->totalSellingItems - 1) {
while (cursorScan != this->totalSellingItems - 1) {
cursorScan++;
if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
break;
}
}
} else if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
}
} else if (this->stickAccumX < 0) {
if (cursorScan != 0) {
while (cursorScan != 0) {
cursorScan--;
if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
break;
} else if (cursorScan == 0) {
play_sound(NA_SE_SY_CURSOR);
@@ -294,7 +294,7 @@ void EnFsn_CursorLeftRight(EnFsn* this) {
this->drawCursor = 0;
this->actionFunc = EnFsn_LookToShopkeeperFromShelf;
if (this->itemIds[cursorScan] != -1) {
- this->cursorIdx = cursorScan;
+ this->cursorIndex = cursorScan;
}
}
}
@@ -417,7 +417,7 @@ s32 EnFsn_TestEndInteraction(EnFsn* this, PlayState* play, Input* input) {
s32 EnFsn_TestCancelOption(EnFsn* this, PlayState* play, Input* input) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
return true;
}
return false;
@@ -429,7 +429,7 @@ void EnFsn_UpdateCursorPos(EnFsn* this, PlayState* play) {
f32 xOffset = 0.0f;
f32 yOffset = 17.0f;
- Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y);
+ Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y);
this->cursorPos.x = x + xOffset;
this->cursorPos.y = y + yOffset;
this->cursorPos.z = 1.2f;
@@ -466,9 +466,9 @@ s32 EnFsn_HasPlayerSelectedItem(EnFsn* this, PlayState* play, Input* input) {
return true;
}
if (EnFsn_TestItemSelected(play)) {
- if (!this->items[this->cursorIdx]->isOutOfStock) {
+ if (!this->items[this->cursorIndex]->isOutOfStock) {
this->prevActionFunc = this->actionFunc;
- func_80151938(play, this->items[this->cursorIdx]->choiceTextId);
+ func_80151938(play, this->items[this->cursorIndex]->choiceTextId);
play_sound(NA_SE_SY_DECIDE);
this->stickLeftPrompt.isEnabled = false;
this->stickRightPrompt.isEnabled = false;
@@ -522,7 +522,7 @@ void EnFsn_UpdateJoystickInputState(EnFsn* this, PlayState* play) {
void EnFsn_PositionSelectedItem(EnFsn* this) {
Vec3f selectedItemPosition = { 13.0f, 38.0f, -71.0f };
- u8 i = this->cursorIdx;
+ u8 i = this->cursorIndex;
EnGirlA* item = this->items[i];
Vec3f worldPos;
@@ -572,7 +572,7 @@ void EnFsn_UpdateItemSelectedProperty(EnFsn* this) {
this->drawCursor == 0) {
(*items)->isSelected = false;
} else {
- (*items)->isSelected = (i == this->cursorIdx) ? true : false;
+ (*items)->isSelected = (i == this->cursorIndex) ? true : false;
}
}
}
@@ -712,7 +712,7 @@ void EnFsn_InitShop(EnFsn* this, PlayState* play) {
}
this->blinkTimer = 20;
this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_START;
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
this->actionFunc = EnFsn_Idle;
}
@@ -995,7 +995,7 @@ void EnFsn_MakeOffer(EnFsn* this, PlayState* play) {
void EnFsn_GiveItem(EnFsn* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
- if ((this->isSelling == true) && (this->items[this->cursorIdx]->getItemId == GI_MASK_ALL_NIGHT)) {
+ if ((this->isSelling == true) && (this->items[this->cursorIndex]->getItemId == GI_MASK_ALL_NIGHT)) {
func_80151BB4(play, 45);
func_80151BB4(play, 3);
}
@@ -1005,7 +1005,7 @@ void EnFsn_GiveItem(EnFsn* this, PlayState* play) {
}
this->actionFunc = EnFsn_SetupResumeInteraction;
} else if (this->isSelling == true) {
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
} else {
Actor_PickUp(&this->actor, play, this->getItemId, 300.0f, 300.0f);
}
@@ -1086,7 +1086,7 @@ void EnFsn_LookToShelf(EnFsn* this, PlayState* play) {
this->cutsceneState = ENFSN_CUTSCENESTATE_PLAYING;
EnFsn_UpdateCursorPos(this, play);
this->actionFunc = EnFsn_BrowseShelf;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
} else {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
@@ -1096,7 +1096,7 @@ void EnFsn_LookToShelf(EnFsn* this, PlayState* play) {
void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) {
u8 talkstate = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIdx = this->cursorIdx;
+ u8 prevCursorIdx = this->cursorIndex;
if (!EnFsn_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -1110,9 +1110,9 @@ void EnFsn_BrowseShelf(EnFsn* this, PlayState* play) {
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
if (!EnFsn_HasPlayerSelectedItem(this, play, CONTROLLER1(&play->state))) {
EnFsn_CursorLeftRight(this);
- if (this->cursorIdx != prevCursorIdx) {
+ if (this->cursorIndex != prevCursorIdx) {
play_sound(NA_SE_SY_CURSOR);
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
}
@@ -1144,7 +1144,7 @@ void EnFsn_LookToShopkeeperFromShelf(EnFsn* this, PlayState* play) {
}
void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
switch (item->canBuyFunc(play, item)) {
case CANBUY_RESULT_SUCCESS_2:
@@ -1156,23 +1156,23 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) {
this->cutsceneState = ENFSN_CUTSCENESTATE_STOPPED;
}
func_8019F208();
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->buyFanfareFunc(play, item);
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
Interface_SetHudVisibility(HUD_VISIBILITY_ALL);
this->drawCursor = 0;
this->shopItemSelectedTween = 0.0f;
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->boughtFunc(play, item);
- if (this->stolenItem1 == this->cursorIdx) {
+ if (this->stolenItem1 == this->cursorIndex) {
SET_STOLEN_ITEM_1(STOLEN_ITEM_NONE);
- } else if (this->stolenItem2 == this->cursorIdx) {
+ } else if (this->stolenItem2 == this->cursorIndex) {
SET_STOLEN_ITEM_2(STOLEN_ITEM_NONE);
}
this->numSellingItems--;
- this->itemIds[this->cursorIdx] = -1;
+ this->itemIds[this->cursorIndex] = -1;
this->actionFunc = EnFsn_GiveItem;
break;
case CANBUY_RESULT_NEED_RUPEES:
@@ -1218,7 +1218,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) {
case 1:
func_8019F230();
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
}
@@ -1227,7 +1227,7 @@ void EnFsn_SelectItem(EnFsn* this, PlayState* play) {
void EnFsn_PlayerCannotBuy(EnFsn* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
@@ -1326,16 +1326,16 @@ void EnFsn_AskCanBuyAterRunningOutOfItems(EnFsn* this, PlayState* play) {
void EnFsn_FaceShopkeeperSelling(EnFsn* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
- u8 cursorIdx;
+ u8 cursorIndex;
if (talkState == TEXT_STATE_CHOICE) {
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
if (!EnFsn_TestEndInteraction(this, play, CONTROLLER1(&play->state)) &&
(!Message_ShouldAdvance(play) || !EnFsn_FacingShopkeeperDialogResult(this, play)) &&
this->stickAccumX > 0) {
- cursorIdx = EnFsn_SetCursorIndexFromNeutral(this);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnFsn_SetCursorIndexFromNeutral(this);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
this->actionFunc = EnFsn_LookToShelf;
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
this->stickRightPrompt.isEnabled = false;
@@ -1394,13 +1394,13 @@ void EnFsn_Blink(EnFsn* this) {
s16 decr = this->blinkTimer - 1;
if (decr >= 3) {
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
this->blinkTimer = decr;
} else if (decr == 0) {
- this->eyeTextureIdx = 2;
+ this->eyeTexIndex = 2;
this->blinkTimer = (s32)(Rand_ZeroOne() * 60.0f) + 20;
} else {
- this->eyeTextureIdx = 1;
+ this->eyeTexIndex = 1;
this->blinkTimer = decr;
}
}
@@ -1427,7 +1427,7 @@ void EnFsn_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->blinkTimer = 20;
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
this->actor.flags |= ACTOR_FLAG_1;
this->actor.targetMode = 0;
this->animIndex = FSN_ANIM_IDLE;
@@ -1472,6 +1472,7 @@ void EnFsn_DrawCursor(EnFsn* this, PlayState* play, f32 x, f32 y, f32 z, u8 draw
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1486,6 +1487,7 @@ void EnFsn_DrawCursor(EnFsn* this, PlayState* play, f32 x, f32 y, f32 z, u8 draw
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1501,6 +1503,7 @@ void EnFsn_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
s32 dtdy;
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1517,6 +1520,7 @@ void EnFsn_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1525,6 +1529,7 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, PlayState* play) {
s32 drawStickLeftPrompt = this->stickRightPrompt.isEnabled;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1559,6 +1564,7 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, PlayState* play) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1604,8 +1610,10 @@ void EnFsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
this->actor.focus.pos.z = this->actor.world.pos.z;
OPEN_DISPS(play->state.gfxCtx);
+
gSPDisplayList(POLY_OPA_DISP++, gFsnGlassesFrameDL);
gSPDisplayList(POLY_OPA_DISP++, gFsnGlassesLensesDL);
+
CLOSE_DISPS(play->state.gfxCtx);
}
}
@@ -1617,9 +1625,10 @@ void EnFsn_Draw(Actor* thisx, PlayState* play) {
s16 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C5B0(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
- gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
+ gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnFsn_OverrideLimbDraw, EnFsn_PostLimbDraw, &this->actor);
@@ -1631,5 +1640,6 @@ void EnFsn_Draw(Actor* thisx, PlayState* play) {
EnFsn_DrawCursor(this, play, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnFsn_DrawStickDirectionPrompts(this, play);
+
CLOSE_DISPS(play->state.gfxCtx);
}
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 9479e982e..6bf337be7 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.h
@@ -30,7 +30,7 @@ typedef struct EnFsn {
/* 0x27A */ Vec3s unk27A; // Set but never used
/* 0x280 */ Vec3s jointTable[FSN_LIMB_MAX + 1]; // Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml
/* 0x2F2 */ Vec3s morphTable[FSN_LIMB_MAX + 1];
- /* 0x364 */ s16 eyeTextureIdx;
+ /* 0x364 */ s16 eyeTexIndex;
/* 0x366 */ s16 blinkTimer;
/* 0x368 */ s16 cutsceneState;
/* 0x36A */ s16 cutscene;
@@ -41,7 +41,7 @@ typedef struct EnFsn {
/* 0x374 */ s16 price;
/* 0x376 */ u16 textId;
/* 0x378 */ u8 isSelling;
- /* 0x379 */ u8 cursorIdx;
+ /* 0x379 */ u8 cursorIndex;
/* 0x37C */ s32 getItemId;
/* 0x380 */ s16 stolenItem1;
/* 0x382 */ s16 stolenItem2;
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 f6120c99e..83c2db438 100644
--- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c
+++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c
@@ -1461,7 +1461,7 @@ void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len) {
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(ptr->unk_00, ptr->unk_00, ptr->unk_00, MTXMODE_APPLY);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, object_mu_DL_00B0E0);
}
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 c2c42fa59..e01193378 100644
--- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c
+++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c
@@ -55,9 +55,8 @@ static ColliderCylinderInit sCylinderInit = {
{ 10, 30, 0, { 0, 0, 0 } },
};
-static TexturePtr sRupeeTex[] = {
- gameplay_keep_Tex_061FC0, gameplay_keep_Tex_061FE0, gameplay_keep_Tex_062000,
- gameplay_keep_Tex_062040, gameplay_keep_Tex_062020,
+static TexturePtr sRupeeTextures[] = {
+ gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeeOrangeTex, gRupeePurpleTex,
};
static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 };
@@ -185,8 +184,8 @@ void EnGamelupy_Draw(Actor* thisx, PlayState* play) {
func_8012C28C(play->state.gfxCtx);
func_800B8050(&this->actor, play, 0);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTex[this->rupeeIndex]));
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0);
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTextures[this->rupeeIndex]));
+ gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
CLOSE_DISPS(play->state.gfxCtx);
}
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 dafbdc5fd..9f3f424d5 100644
--- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c
+++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c
@@ -297,9 +297,9 @@ void func_80B509A8(EnGk* this, PlayState* play) {
}
EffectSsDtBubble_SpawnCustomColor(play, &this->unk_2E8, &this->unk_300, &sp4C, &D_80B533A0, &D_80B533A4,
- Rand_S16Offset(15, 15), phi_s1, 0);
+ Rand_S16Offset(15, 15), phi_s1, false);
EffectSsDtBubble_SpawnCustomColor(play, &this->unk_2F4, &this->unk_30C, &sp4C, &D_80B533A0, &D_80B533A4,
- Rand_S16Offset(15, 15), phi_s1, 0);
+ Rand_S16Offset(15, 15), phi_s1, false);
}
void func_80B50B38(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 3ad077fec..3faf24a1c 100644
--- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c
+++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
@@ -963,7 +963,8 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
this->unk_18C(this, play);
}
- if ((this->unk_3E8 == 6) && !(play->actorCtx.unk5 & 0x20) && Animation_OnFrame(&this->skelAnime, 20.0f)) {
+ if ((this->unk_3E8 == 6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
+ Animation_OnFrame(&this->skelAnime, 20.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO);
}
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 491e1c95e..e5775d129 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.c
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.c
@@ -299,8 +299,8 @@ void func_80A1143C(EnGoStruct* ptr, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 arg4
}
void func_80A115B4(EnGoStruct* ptr, PlayState* play) {
- static TexturePtr D_80A16644[] = {
- gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
+ static TexturePtr sDustTextures[] = {
+ gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex,
};
static Color_RGBA8 D_80A16664[] = {
{ 255, 255, 255, 0 },
@@ -341,7 +341,7 @@ void func_80A115B4(EnGoStruct* ptr, PlayState* play) {
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A16644[(s32)(temp * 7.0f)]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[(s32)(temp * 7.0f)]));
gSPDisplayList(POLY_XLU_DISP++, gGoronDustModelDL);
Matrix_Pop();
@@ -987,7 +987,7 @@ Actor* func_80A13400(EnGo* this, PlayState* play) {
}
void func_80A134B0(EnGo* this, PlayState* play, s32 arg2) {
- if ((gSaveContext.save.weekEventReg[18] & 0x80) || (play->actorCtx.unk5 & 1) || arg2) {
+ if ((gSaveContext.save.weekEventReg[18] & 0x80) || (play->actorCtx.flags & ACTORCTX_FLAG_0) || arg2) {
this->colliderSphere.dim.modelSphere.radius = 300;
} else {
this->colliderSphere.dim.modelSphere.radius = 380;
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 e831328f6..3927305ad 100644
--- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c
+++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c
@@ -1082,10 +1082,10 @@ void EnGs_Draw(Actor* thisx, PlayState* play) {
}
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, object_gs_DL_000950);
+ gSPDisplayList(POLY_OPA_DISP++, gGossipStoneMaterialDL);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->unk_1FA.r, this->unk_1FA.g, this->unk_1FA.b, 255);
- gSPDisplayList(POLY_OPA_DISP++, object_gs_DL_0009D0);
- gSPDisplayList(POLY_OPA_DISP++, object_gs_DL_000A60);
+ gSPDisplayList(POLY_OPA_DISP++, gGossipStoneDL);
+ gSPDisplayList(POLY_OPA_DISP++, gGossipStoneBottomModelDL);
Matrix_Pop();
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 50f0c1e1e..81cb9850c 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
@@ -176,7 +176,8 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) {
sp74.x += randPlusMinusPoint5Scaled(15.0f);
sp74.z += randPlusMinusPoint5Scaled(15.0f);
- EffectSsDtBubble_SpawnCustomColor(play, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30, 1);
+ EffectSsDtBubble_SpawnCustomColor(play, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30,
+ true);
}
this->unk_218 = 30;
}
@@ -218,7 +219,8 @@ void func_80BDB59C(EnHiddenNuts* this, PlayState* play) {
sp78.x += randPlusMinusPoint5Scaled(15.0f);
sp78.z += randPlusMinusPoint5Scaled(15.0f);
- EffectSsDtBubble_SpawnCustomColor(play, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30, 1);
+ EffectSsDtBubble_SpawnCustomColor(play, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30,
+ true);
}
this->unk_218 = 30;
}
diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c
index 3e6ab858f..a251dd113 100644
--- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c
+++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c
@@ -1,7 +1,7 @@
/*
* File: z_en_hs2.c
* Overlay: ovl_En_Hs2
- * Description: Blue Target Spot (?)
+ * Description: Near-empty actor. Does nothing, but can be targeted.
*/
#include "z_en_hs2.h"
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 b78b65a19..6d7cc29ea 100644
--- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
+++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
@@ -346,7 +346,7 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) {
EnKakasi_SetupDialogue(this);
return;
}
- if (play->actorCtx.unk5 & 0x4) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_2) {
Actor_GetScreenPos(play, &this->picto.actor, &x, &y);
if (this->picto.actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT &&
this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) {
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 4499ed44a..5113c1291 100644
--- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c
+++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c
@@ -963,7 +963,7 @@ void EnKanban_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->partFlags == 0xFFFF) {
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05AED0);
+ gSPDisplayList(POLY_OPA_DISP++, gSignRectangularDL);
} else {
for (i = 0; i < ARRAY_COUNT(sPartFlags); i++) {
if (sPartFlags[i] & this->partFlags) {
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 e21555163..1c98a11bc 100644
--- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
+++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c
@@ -291,7 +291,7 @@ void EnOssan_UpdateCursorPos(PlayState* play, EnOssan* this) {
s16 x;
s16 y;
- Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y);
+ Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y);
this->cursorPos.x = x;
this->cursorPos.y = y;
}
@@ -332,7 +332,7 @@ s32 EnOssan_TestEndInteraction(EnOssan* this, PlayState* play, Input* input) {
s32 EnOssan_TestCancelOption(EnOssan* this, PlayState* play, Input* input) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
return true;
}
return false;
@@ -500,7 +500,7 @@ u8 EnOssan_SetCursorIndexFromNeutral(EnOssan* this, u8 shelfOffset) {
u8 i;
// if cursor is on the top shelf
- if (this->cursorIdx & 1) {
+ if (this->cursorIndex & 1) {
// scan top shelf
for (i = shelfOffset + 1; i < shelfOffset + 4; i += 2) {
if (this->items[i] != NULL) {
@@ -530,26 +530,26 @@ u8 EnOssan_SetCursorIndexFromNeutral(EnOssan* this, u8 shelfOffset) {
return CURSOR_INVALID;
}
-u8 EnOssan_CursorRight(EnOssan* this, u8 cursorIdx, u8 shelfSlotMin) {
+u8 EnOssan_CursorRight(EnOssan* this, u8 cursorIndex, u8 shelfSlotMin) {
u8 end = shelfSlotMin + 4;
- while (cursorIdx >= shelfSlotMin && cursorIdx < end) {
- cursorIdx -= 2;
- if (cursorIdx >= shelfSlotMin && cursorIdx < end) {
- if (this->items[cursorIdx] != NULL) {
- return cursorIdx;
+ while (cursorIndex >= shelfSlotMin && cursorIndex < end) {
+ cursorIndex -= 2;
+ if (cursorIndex >= shelfSlotMin && cursorIndex < end) {
+ if (this->items[cursorIndex] != NULL) {
+ return cursorIndex;
}
}
}
return CURSOR_INVALID;
}
-u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIdx, u8 shelfSlotMax) {
- while (cursorIdx < shelfSlotMax) {
- cursorIdx += 2;
- if (cursorIdx < shelfSlotMax) {
- if (this->items[cursorIdx] != NULL) {
- return cursorIdx;
+u8 EnOssan_CursorLeft(EnOssan* this, u8 cursorIndex, u8 shelfSlotMax) {
+ while (cursorIndex < shelfSlotMax) {
+ cursorIndex += 2;
+ if (cursorIndex < shelfSlotMax) {
+ if (this->items[cursorIndex] != NULL) {
+ return cursorIndex;
}
}
}
@@ -619,7 +619,7 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
Player* player = GET_PLAYER(play);
- u8 cursorIdx;
+ u8 cursorIndex;
if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) {
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
@@ -634,18 +634,18 @@ void EnOssan_FaceShopkeeper(EnOssan* this, PlayState* play) {
if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state)) &&
(!Message_ShouldAdvance(play) || !EnOssan_FacingShopkeeperDialogResult(this, play))) {
if (this->stickAccumX < 0) {
- cursorIdx = EnOssan_SetCursorIndexFromNeutral(this, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_SetCursorIndexFromNeutral(this, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
EnOssan_SetupAction(this, EnOssan_LookToLeftShelf);
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
this->stickLeftPrompt.isEnabled = false;
play_sound(NA_SE_SY_CURSOR);
}
} else if (this->stickAccumX > 0) {
- cursorIdx = EnOssan_SetCursorIndexFromNeutral(this, 0);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_SetCursorIndexFromNeutral(this, 0);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
EnOssan_SetupAction(this, EnOssan_LookToRightShelf);
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
this->stickRightPrompt.isEnabled = false;
@@ -693,7 +693,7 @@ void EnOssan_LookToLeftShelf(EnOssan* this, PlayState* play) {
this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING;
EnOssan_UpdateCursorPos(play, this);
EnOssan_SetupAction(this, EnOssan_BrowseLeftShelf);
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
} else {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
@@ -721,7 +721,7 @@ void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play) {
this->cutsceneState = ENOSSAN_CUTSCENESTATE_PLAYING;
EnOssan_UpdateCursorPos(play, this);
EnOssan_SetupAction(this, EnOssan_BrowseRightShelf);
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
} else {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
@@ -731,16 +731,16 @@ void EnOssan_LookToRightShelf(EnOssan* this, PlayState* play) {
}
void EnOssan_CursorUpDown(EnOssan* this) {
- u8 curTemp = this->cursorIdx;
+ u8 curTemp = this->cursorIndex;
u8 curScanTemp;
if (this->stickAccumY < 0) {
curTemp &= (u8)~1;
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
return;
}
- // cursorIdx on right shelf
+ // cursorIndex on right shelf
if (curTemp < 4) {
curScanTemp = curTemp + 2;
if (curScanTemp >= 4) {
@@ -748,7 +748,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -757,14 +757,14 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
}
} else {
- // cursorIdx on left shelf
+ // cursorIndex on left shelf
curScanTemp = curTemp + 2;
if (curScanTemp >= 8) {
curScanTemp = 4;
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -776,10 +776,10 @@ void EnOssan_CursorUpDown(EnOssan* this) {
} else if (this->stickAccumY > 0) {
curTemp |= 1;
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
return;
}
- // cursorIdx on right shelf
+ // cursorIndex on right shelf
if (curTemp < 4) {
curScanTemp = curTemp + 2;
if (curScanTemp >= 4) {
@@ -787,7 +787,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -796,14 +796,14 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
}
} else {
- // cursorIdx on left shelf
+ // cursorIndex on left shelf
curScanTemp = curTemp + 2;
if (curScanTemp >= 8) {
curScanTemp = 5;
}
while (curScanTemp != curTemp) {
if (this->items[curScanTemp] != NULL) {
- this->cursorIdx = curScanTemp;
+ this->cursorIndex = curScanTemp;
return;
}
curScanTemp += 2;
@@ -816,7 +816,7 @@ void EnOssan_CursorUpDown(EnOssan* this) {
}
s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
if (EnOssan_TestEndInteraction(this, play, input)) {
return true;
@@ -824,7 +824,7 @@ s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input)
if (EnOssan_TestItemSelected(play)) {
if (!item->isOutOfStock) {
this->prevActionFunc = this->actionFunc;
- func_80151938(play, this->items[this->cursorIdx]->choiceTextId);
+ func_80151938(play, this->items[this->cursorIndex]->choiceTextId);
this->stickLeftPrompt.isEnabled = false;
this->stickRightPrompt.isEnabled = false;
play_sound(NA_SE_SY_DECIDE);
@@ -841,8 +841,8 @@ s32 EnOssan_HasPlayerSelectedItem(PlayState* play, EnOssan* this, Input* input)
void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIndex = this->cursorIdx;
- u8 cursorIdx;
+ u8 prevCursorIndex = this->cursorIndex;
+ u8 cursorIndex;
if (!EnOssan_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -857,38 +857,38 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) {
if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) {
if (this->moveHorizontal) {
if (this->stickAccumX > 0) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX < 0) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 8);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 8);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
} else {
if (this->stickAccumX > 0 && this->stickAccumX > 500) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX < 0 && this->stickAccumX < -500) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 8);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 8);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
}
EnOssan_CursorUpDown(this);
- if (this->cursorIdx != prevCursorIndex) {
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ if (this->cursorIndex != prevCursorIndex) {
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
play_sound(NA_SE_SY_CURSOR);
}
}
@@ -899,8 +899,8 @@ void EnOssan_BrowseLeftShelf(EnOssan* this, PlayState* play) {
void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIndex = this->cursorIdx;
- u8 cursorIdx;
+ u8 prevCursorIndex = this->cursorIndex;
+ u8 cursorIndex;
if (!EnOssan_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -915,38 +915,38 @@ void EnOssan_BrowseRightShelf(EnOssan* this, PlayState* play) {
if (!EnOssan_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) {
if (this->moveHorizontal != 0) {
if (this->stickAccumX < 0) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 0);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX > 0) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
} else {
if (this->stickAccumX < 0 && this->stickAccumX < -500) {
- cursorIdx = EnOssan_CursorRight(this, this->cursorIdx, 0);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorRight(this, this->cursorIndex, 0);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
} else {
EnOssan_SetupLookToShopkeeperFromShelf(play, this);
return;
}
} else if (this->stickAccumX > 0 && this->stickAccumX > 500) {
- cursorIdx = EnOssan_CursorLeft(this, this->cursorIdx, 4);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnOssan_CursorLeft(this, this->cursorIndex, 4);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
}
}
}
EnOssan_CursorUpDown(this);
- if (this->cursorIdx != prevCursorIndex) {
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ if (this->cursorIndex != prevCursorIndex) {
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
play_sound(NA_SE_SY_CURSOR);
}
}
@@ -981,7 +981,7 @@ void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, PlayState* play) {
void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) {
Player* player = GET_PLAYER(play);
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
player->stateFlags2 &= ~0x20000000;
@@ -1001,7 +1001,7 @@ void EnOssan_SetupBuy(PlayState* play, EnOssan* this, u16 textId) {
}
void EnOssan_HandleCanBuyItem(PlayState* play, EnOssan* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
switch (item->canBuyFunc(play, item)) {
case CANBUY_RESULT_SUCCESS_1:
@@ -1061,7 +1061,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) {
case 1:
func_8019F230();
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
break;
}
}
@@ -1071,7 +1071,7 @@ void EnOssan_SelectItem(EnOssan* this, PlayState* play) {
void EnOssan_CannotBuy(EnOssan* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
@@ -1081,10 +1081,10 @@ void EnOssan_CanBuy(EnOssan* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->shopItemSelectedTween = 0.0f;
EnOssan_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
this->actionFunc = this->prevActionFunc;
- func_80151938(play, this->items[this->cursorIdx]->actor.textId);
+ func_80151938(play, this->items[this->cursorIndex]->actor.textId);
}
}
@@ -1093,7 +1093,7 @@ void EnOssan_BuyItemWithFanfare(EnOssan* this, PlayState* play) {
this->actor.parent = NULL;
EnOssan_SetupAction(this, EnOssan_SetupItemPurchased);
} else {
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
}
}
@@ -1122,7 +1122,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) {
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
if (Message_ShouldAdvance(play)) {
EnOssan_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
if (!EnOssan_TestEndInteraction(this, play, CONTROLLER1(&play->state))) {
switch (play->msgCtx.choiceIndex) {
@@ -1144,7 +1144,7 @@ void EnOssan_ContinueShopping(EnOssan* this, PlayState* play) {
}
} else if (talkState == TEXT_STATE_5 && Message_ShouldAdvance(play)) {
EnOssan_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
player->actor.shape.rot.y = BINANG_ROT180(player->actor.shape.rot.y);
player->stateFlags2 |= 0x20000000;
@@ -1184,7 +1184,7 @@ void EnOssan_PositionSelectedItem(EnOssan* this) {
{ -35.0f, 68.0f, -130.0f },
};
EnGirlA* item;
- u8 i = this->cursorIdx;
+ u8 i = this->cursorIndex;
u8 i2;
ShopItem* shopItem = &sShops[this->actor.params][i];
Vec3f worldPos;
@@ -1245,7 +1245,7 @@ void EnOssan_UpdateItemSelectedProperty(EnOssan* this) {
this->drawCursor == 0) {
item->isSelected = false;
} else {
- item->isSelected = this->cursorIdx == i ? true : false;
+ item->isSelected = this->cursorIndex == i ? true : false;
}
}
}
@@ -1479,7 +1479,7 @@ void EnOssan_InitShop(EnOssan* this, PlayState* play) {
this->actor.colChkInfo.cylRadius = 50;
this->stickAccumX = this->stickAccumY = 0;
- this->cursorIdx = 0;
+ this->cursorIndex = 0;
this->cursorPos.z = 1.5f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
@@ -1573,6 +1573,7 @@ void EnOssan_DrawCursor(PlayState* play, EnOssan* this, f32 x, f32 y, f32 z, u8
(void)"../z_en_oB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1587,6 +1588,7 @@ void EnOssan_DrawCursor(PlayState* play, EnOssan* this, f32 x, f32 y, f32 z, u8
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1605,6 +1607,7 @@ void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
(void)"../z_en_oB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1621,6 +1624,7 @@ void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1631,6 +1635,7 @@ void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) {
(void)"../z_en_oB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1665,6 +1670,7 @@ void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1713,6 +1719,7 @@ void EnOssan_CuriosityShopMan_Draw(Actor* thisx, PlayState* play) {
EnOssan* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
@@ -1720,6 +1727,7 @@ void EnOssan_CuriosityShopMan_Draw(Actor* thisx, PlayState* play) {
&this->actor);
EnOssan_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1729,11 +1737,13 @@ void EnOssan_PartTimer_Draw(Actor* thisx, PlayState* play) {
EnOssan* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnOssan_PartTimer_OverrideLimbDraw, EnOssan_PartTimer_PostLimbDraw, &this->actor);
EnOssan_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
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 539906ea8..20d669ea4 100644
--- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
+++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h
@@ -35,7 +35,7 @@ typedef struct EnOssan {
/* 0x230 */ f32 cursorAnimTween;
/* 0x234 */ u8 cursorAnimState;
/* 0x235 */ u8 drawCursor;
- /* 0x236 */ u8 cursorIdx;
+ /* 0x236 */ u8 cursorIndex;
/* 0x238 */ StickDirectionPrompt stickLeftPrompt;
/* 0x270 */ StickDirectionPrompt stickRightPrompt;
/* 0x2A8 */ f32 arrowAnimTween;
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 6ea2c6153..bf93b729f 100644
--- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c
+++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c
@@ -1152,7 +1152,7 @@ void func_80B5E1D8(PlayState* play, EnOtUnkStruct* arg1, s32 arg2) {
Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY);
Matrix_Scale(arg1->unk_04, arg1->unk_04, arg1->unk_04, MTXMODE_APPLY);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, object_ot_DL_000078);
}
diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c
index a2f2c618f..ef348f4cc 100644
--- a/src/overlays/actors/ovl_En_Part/z_en_part.c
+++ b/src/overlays/actors/ovl_En_Part/z_en_part.c
@@ -5,6 +5,7 @@
*/
#include "z_en_part.h"
+#include "overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -96,7 +97,7 @@ void func_808654C4(EnPart* this, PlayState* play) {
effectVelocity.y = Rand_ZeroOne() + 1.0f;
effectScale = Rand_S16Offset(80, 100);
EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &gZeroVec3f, effectScale, 25,
- 0, 1);
+ DTBUBBLE_COLOR_PROFILE_RED, true);
}
break;
}
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 f7e943957..02e660f14 100644
--- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c
+++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c
@@ -788,7 +788,7 @@ void EnPeehat_Update(Actor* thisx, PlayState* play2) {
}
if (this->colliderTris.base.atFlags & AT_ON) {
- thisx->flags |= 0x1000000;
+ thisx->flags |= ACTOR_FLAG_1000000;
CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderTris.base);
if (thisx->params == 0) {
Vec3f sp74;
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 7766fa8fa..7587e38ca 100644
--- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c
+++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c
@@ -1110,7 +1110,7 @@ void EnPp_Mask_SetupDetach(EnPp* this, PlayState* play) {
* Moves the mask through the air and eventually makes it burst into flames.
*/
void EnPp_Mask_Detach(EnPp* this, PlayState* play) {
- if (((this->actor.flags & ACTOR_FLAG_2000) != ACTOR_FLAG_2000) || (this->action == EN_PP_ACTION_MASK_DEAD)) {
+ if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_2000) || (this->action == EN_PP_ACTION_MASK_DEAD)) {
switch (this->actionVar.maskDetachState) {
case EN_PP_MASK_DETACH_STATE_START:
this->action = EN_PP_ACTION_MASK_DEAD;
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 cc98c05e1..9057fdb4c 100644
--- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c
+++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c
@@ -822,7 +822,7 @@ void EnRat_Update(Actor* thisx, PlayState* play) {
if (this->damageReaction.hookedState == EN_RAT_HOOK_STARTED) {
// The player just hit the Real Bombchu with the Hookshot.
this->damageReaction.hookedState = EN_RAT_HOOKED;
- } else if ((this->actor.flags & ACTOR_FLAG_2000) != ACTOR_FLAG_2000) {
+ } else if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_2000)) {
// The player has hooked the Real Bombchu for more than one frame, but
// the actor flag indicating that the Hookshot is attached is *not* set.
EnRat_Explode(this, play);
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 896947fa6..2d976bdd5 100644
--- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c
+++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c
@@ -123,8 +123,8 @@ AnimationInfoS D_80BF5914[] = {
{ &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 },
};
-TexturePtr D_80BF5934[] = {
- gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
+static TexturePtr sDustTextures[] = {
+ gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex,
};
Color_RGBA8 D_80BF5954[] = {
@@ -190,7 +190,7 @@ void func_80BF3920(EnRgStruct* ptr, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
idx = temp_f20 * 7.0f;
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BF5934[idx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[idx]));
gSPDisplayList(POLY_XLU_DISP++, gGoronDustModelDL);
Matrix_Pop();
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 5aa54307a..3eb978314 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
@@ -36,12 +36,12 @@ const ActorInit En_Sc_Ruppe_InitVars = {
};
RuppeInfo sRupeeInfo[] = {
- { gameplay_keep_Tex_061FC0, 1 }, // Green rupee
- { gameplay_keep_Tex_061FE0, 5 }, // Blue rupee
- { gameplay_keep_Tex_062000, 20 }, // Red rupee
- { gameplay_keep_Tex_062040, 200 }, // Orange rupee
- { gameplay_keep_Tex_062020, 50 }, // Purple rupee
- { gameplay_keep_Tex_062060, 10 }, // (unused)
+ { gRupeeGreenTex, 1 }, // Green rupee
+ { gRupeeBlueTex, 5 }, // Blue rupee
+ { gRupeeRedTex, 20 }, // Red rupee
+ { gRupeeOrangeTex, 200 }, // Orange rupee
+ { gRupeePurpleTex, 50 }, // Purple rupee
+ { gRupeeSilverTex, 10 }, // (unused)
};
static ColliderCylinderInit sCylinderInit = {
@@ -185,7 +185,7 @@ void EnScRuppe_Draw(Actor* thisx, PlayState* play) {
func_800B8050(&this->actor, play, 0);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeInfo[this->ruppeIndex].tex));
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0);
+ gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c
index 2265fd22e..4bccdb846 100644
--- a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c
+++ b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c
@@ -16,9 +16,6 @@ void EnScopecoin_Destroy(Actor* thisx, PlayState* play);
void EnScopecoin_Update(Actor* thisx, PlayState* play);
void EnScopecoin_Draw(Actor* thisx, PlayState* play);
-void func_80BFCFA0(EnScopecoin* this, PlayState* play);
-void func_80BFCFB8(EnScopecoin* this, PlayState* play);
-
const ActorInit En_Scopecoin_InitVars = {
ACTOR_EN_SCOPECOIN,
ACTORCAT_NPC,
@@ -31,12 +28,12 @@ const ActorInit En_Scopecoin_InitVars = {
(ActorFunc)EnScopecoin_Draw,
};
-void func_80BFCFA0(EnScopecoin* this, PlayState* play) {
- this->actor.shape.rot.y += 500;
+void EnScopecoin_Spin(EnScopecoin* this, PlayState* play) {
+ this->actor.shape.rot.y += 0x1F4;
}
-void func_80BFCFB8(EnScopecoin* this, PlayState* play) {
- if (Flags_GetCollectible(play, (this->actor.params & 0x7F0) >> 4)) {
+void EnScopecoin_CheckCollectible(EnScopecoin* this, PlayState* play) {
+ if (Flags_GetCollectible(play, OBJMUPICT_GET_RUPEE_FLAG(&this->actor))) {
Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED);
Actor_MarkForDeath(&this->actor);
}
@@ -47,31 +44,32 @@ void EnScopecoin_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawCircle, 10.0f);
- this->unk148 = (this->actor.params & 0xF);
- if (this->unk148 < 0 || this->unk148 >= 8) {
- this->unk148 = 0;
+
+ this->rupeeIndex = OBJMUPICT_GET_RUPEE_INDEX(&this->actor);
+ if ((this->rupeeIndex < 0) || (this->rupeeIndex > 7)) {
+ this->rupeeIndex = 0;
}
- if (play->actorCtx.unk5 & 2) {
- if (this->unk148 == 2 || this->unk148 == 6) {
- if (Flags_GetCollectible(play, (this->actor.params & 0x7F0) >> 4)) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
+ if ((this->rupeeIndex == 2) || (this->rupeeIndex == 6)) {
+ if (Flags_GetCollectible(play, OBJMUPICT_GET_RUPEE_FLAG(&this->actor))) {
Actor_MarkForDeath(&this->actor);
return;
}
}
this->actor.shape.yOffset = 700.0f;
- this->actionFunc = func_80BFCFA0;
- return;
- }
- if (this->unk148 == 2 || this->unk148 == 6) {
- if (Flags_GetCollectible(play, (this->actor.params & 0x7F0) >> 4)) {
- Actor_MarkForDeath(&this->actor);
- } else {
- this->actor.draw = NULL;
- this->actionFunc = func_80BFCFB8;
- }
+ this->actionFunc = EnScopecoin_Spin;
} else {
- Actor_MarkForDeath(&this->actor);
+ if ((this->rupeeIndex == 2) || (this->rupeeIndex == 6)) {
+ if (Flags_GetCollectible(play, OBJMUPICT_GET_RUPEE_FLAG(&this->actor))) {
+ Actor_MarkForDeath(&this->actor);
+ return;
+ }
+ this->actor.draw = NULL;
+ this->actionFunc = EnScopecoin_CheckCollectible;
+ } else {
+ Actor_MarkForDeath(&this->actor);
+ }
}
}
@@ -84,9 +82,8 @@ void EnScopecoin_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
}
-static TexturePtr D_80BFD280[] = {
- gameplay_keep_Tex_061FC0, gameplay_keep_Tex_061FE0, gameplay_keep_Tex_062000, gameplay_keep_Tex_062040,
- gameplay_keep_Tex_062020, gameplay_keep_Tex_062060, gameplay_keep_Tex_062000,
+static TexturePtr sRupeeTextures[] = {
+ gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeeOrangeTex, gRupeePurpleTex, gRupeeSilverTex, gRupeeRedTex,
};
void EnScopecoin_Draw(Actor* thisx, PlayState* play) {
@@ -95,11 +92,12 @@ void EnScopecoin_Draw(Actor* thisx, PlayState* play) {
func_8012C28C(play->state.gfxCtx);
func_800B8050(&this->actor, play, 0);
+
OPEN_DISPS(gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80BFD280[this->unk148]));
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0);
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTextures[this->rupeeIndex]));
+ gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
CLOSE_DISPS(gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h
index 37a6bbf8e..8fd9b142c 100644
--- a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h
+++ b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.h
@@ -5,13 +5,15 @@
struct EnScopecoin;
+#define OBJMUPICT_GET_RUPEE_INDEX(thisx) ((thisx)->params & 0xF)
+#define OBJMUPICT_GET_RUPEE_FLAG(thisx) (((thisx)->params & 0x7F0) >> 4)
+
typedef void (*EnScopecoinActionFunc)(struct EnScopecoin*, PlayState*);
typedef struct EnScopecoin {
/* 0x000 */ Actor actor;
/* 0x144 */ EnScopecoinActionFunc actionFunc;
- /* 0x148 */ s16 unk148;
- /* 0x14A */ s16 unk14A;
+ /* 0x148 */ s16 rupeeIndex;
} EnScopecoin; // size = 0x14C
extern const ActorInit En_Scopecoin_InitVars;
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 fce03f2b8..a4fcb6cb3 100644
--- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c
+++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c
@@ -300,7 +300,7 @@ void EnScopecrow_Init(Actor* thisx, PlayState* play) {
return;
}
- if (play->actorCtx.unk5 & 2) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable,
OBJECT_CROW_LIMB_MAX);
ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f);
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 2553962f9..fd0ced593 100644
--- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c
+++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c
@@ -707,7 +707,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) {
if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_0) {
if (gSaveContext.save.weekEventReg[52] & 0x40) {
Actor_MarkForDeath(&this->actor);
- } else if (play->actorCtx.unk5 & 2) {
+ } else if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F);
this->actor.draw = NULL;
this->actionFunc = func_80BCAFA8;
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 d024fa087..fe769b0c6 100644
--- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
+++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c
@@ -1479,6 +1479,7 @@ void EnSob1_DrawCursor(PlayState* play, EnSob1* this, f32 x, f32 y, f32 z, u8 dr
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1493,6 +1494,7 @@ void EnSob1_DrawCursor(PlayState* play, EnSob1* this, f32 x, f32 y, f32 z, u8 dr
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1511,6 +1513,7 @@ void EnSob1_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
(void)"../z_en_soB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1527,6 +1530,7 @@ void EnSob1_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1537,6 +1541,7 @@ void EnSob1_DrawStickDirectionPrompt(PlayState* play, EnSob1* this) {
(void)"../z_en_soB1.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1571,6 +1576,7 @@ void EnSob1_DrawStickDirectionPrompt(PlayState* play, EnSob1* this) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1596,9 +1602,11 @@ s32 EnSob1_BombShopkeeper_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx**
void EnSob1_BombShopkeeper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
OPEN_DISPS(play->state.gfxCtx);
+
if (limbIndex == BOMB_SHOPKEEPER_LIMB_LEFT_HAND) {
gSPDisplayList(POLY_OPA_DISP++, gBombShopkeeperBombDL);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1619,6 +1627,7 @@ void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, PlayState* play) {
s32 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPSegment(POLY_OPA_DISP++, 0x0C, EnSob1_EndDList(play->state.gfxCtx));
@@ -1632,6 +1641,7 @@ void EnSob1_ZoraShopkeeper_Draw(Actor* thisx, PlayState* play) {
}
EnSob1_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnSob1_DrawStickDirectionPrompt(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1642,6 +1652,7 @@ void EnSob1_GoronShopkeeper_Draw(Actor* thisx, PlayState* play) {
s32 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sGoronShopkeeperEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL,
@@ -1653,6 +1664,7 @@ void EnSob1_GoronShopkeeper_Draw(Actor* thisx, PlayState* play) {
}
EnSob1_DrawCursor(play, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnSob1_DrawStickDirectionPrompt(play, this);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1663,6 +1675,7 @@ void EnSob1_BombShopkeeper_Draw(Actor* thisx, PlayState* play) {
s32 i;
OPEN_DISPS(play->state.gfxCtx);
+
func_8012C28C(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gBombShopkeeperEyeTex));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
@@ -1683,5 +1696,6 @@ void EnSob1_BombShopkeeper_Draw(Actor* thisx, PlayState* play) {
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, -frames * 20, 32, 128));
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
+
CLOSE_DISPS(play->state.gfxCtx);
}
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 77c40d173..4354e7f58 100644
--- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c
+++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c
@@ -103,7 +103,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) {
switch (ENSTH_GET_F(&this->actor)) {
case ENSTH_F_1:
- if (play->actorCtx.unk5 & 2) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20);
this->actionFunc = func_80B67958;
} else {
diff --git a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c
index 3ce5ba447..1bf91af6b 100644
--- a/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c
+++ b/src/overlays/actors/ovl_En_Sth2/z_en_sth2.c
@@ -40,7 +40,7 @@ void EnSth2_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
this->unused = 0;
- if (play->actorCtx.unk5 & 2) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20);
} else {
Actor_MarkForDeath(&this->actor);
diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c
index f631439bd..d9059577c 100644
--- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c
+++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c
@@ -285,7 +285,7 @@ void func_80A365EC(EnSyatekiOkuta* this, PlayState* play) {
sp84.y = Rand_ZeroOne() * 7.0f;
sp84.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &sp84, &D_80A37B98, &D_80A37BA4,
- &D_80A37BA8, Rand_S16Offset(100, 50), 25, 0);
+ &D_80A37BA8, Rand_S16Offset(100, 50), 25, false);
}
func_80A362F8(this);
diff --git a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c
index db6a9d172..0d39a0db2 100644
--- a/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c
+++ b/src/overlays/actors/ovl_En_Tag_Obj/z_en_tag_obj.c
@@ -1,7 +1,7 @@
/*
* File: z_en_tag_obj.c
* Overlay: ovl_En_Tag_Obj
- * Description:
+ * Description: Unused Seahorse Spawner
*/
#include "z_en_tag_obj.h"
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 4f19b73a8..542a564f5 100644
--- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c
+++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c
@@ -371,7 +371,7 @@ void func_80BB71C8(EnTanron2* this, PlayState* play) {
sp9C.z = spA8.z * -0.03f;
EffectSsDtBubble_SpawnCustomColor(play, &sp90, &spA8, &sp9C, &D_80BB81E8, &D_80BB81EC,
- Rand_ZeroFloat(100.0f) + 200.0f, Rand_ZeroFloat(5.0f) + 15.0f, 0);
+ Rand_ZeroFloat(100.0f) + 200.0f, Rand_ZeroFloat(5.0f) + 15.0f, false);
}
}
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 64d8b2dd7..d683cde8c 100644
--- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
+++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
@@ -142,7 +142,8 @@ void EnTanron3_SpawnBubbles(EnTanron3* this, PlayState* play) {
acceleration.y = velocity.y * -0.05f;
acceleration.z = velocity.z * -0.05f;
EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &acceleration, &sPrimColor,
- &sEnvColor, Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f, 0);
+ &sEnvColor, Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f,
+ false);
}
}
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 dc74fa461..45f88ffb7 100644
--- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c
+++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c
@@ -508,9 +508,9 @@ void func_80BE5C10(Actor* thisx, PlayState* play) {
func_8012C28C(play->state.gfxCtx);
if (this->unk_1A0 == 0) {
- texture = gameplay_keep_Tex_05BEF0;
+ texture = gDropArrows1Tex;
} else {
- texture = gameplay_keep_Tex_0617C0;
+ texture = gDropMagicLargeTex;
}
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
@@ -521,7 +521,7 @@ void func_80BE5C10(Actor* thisx, PlayState* play) {
Matrix_RotateZS(this->unk_198, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
+ gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
CLOSE_DISPS(play->state.gfxCtx);
}
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 45459e8b3..ceac1e116 100644
--- a/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c
+++ b/src/overlays/actors/ovl_En_Tanron6/z_en_tanron6.c
@@ -1,7 +1,7 @@
/*
* File: z_en_tanron6.c
* Overlay: ovl_En_Tanron6
- * Description: Swarm of Giant Bees
+ * Description: Unused invisible enemy. Only draws a circle shadow.
*/
#include "z_en_tanron6.h"
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 2e7162aa1..8be05703f 100644
--- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c
+++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c
@@ -53,8 +53,8 @@ static s16 sCurrentCs;
void func_80A41D70(EnTest4* this, PlayState* play) {
if (this->unk_144 != 0) {
func_80151A68(play, sNightMessages1[CURRENT_DAY - 1]);
- } else if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) {
- if (play->actorCtx.unk5 & 2) {
+ } else if ((sCutscenes[this->unk_144] < 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]);
@@ -71,7 +71,7 @@ void func_80A41D70(EnTest4* this, PlayState* play) {
}
if (gSaveContext.cutsceneTrigger == 0) {
- if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) {
+ if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
this->actionFunc = func_80A42F20;
sCurrentCs = sCutscenes[this->unk_144];
this->transitionCsTimer = 0;
@@ -96,7 +96,7 @@ void func_80A41D70(EnTest4* this, PlayState* play) {
void func_80A41FA4(EnTest4* this, PlayState* play) {
if (this->unk_144 != 0) {
func_80151A68(play, sNightMessages2[CURRENT_DAY - 1]);
- } else if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) {
+ } else if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Sram_IncrementDay();
gSaveContext.save.time = CLOCK_TIME(6, 0);
Interface_NewDay(play, CURRENT_DAY);
@@ -108,7 +108,7 @@ void func_80A41FA4(EnTest4* this, PlayState* play) {
}
if (gSaveContext.cutsceneTrigger == 0) {
- if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) {
+ if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
this->actionFunc = func_80A42F20;
sCurrentCs = sCutscenes[this->unk_144];
this->transitionCsTimer = 0;
@@ -282,7 +282,7 @@ void func_80A425E4(EnTest4* this, PlayState* play) {
this->nextBellTime = CLOCK_TIME(17, 30);
}
- if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2) || (CURRENT_DAY == 3) ||
+ if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1) || (CURRENT_DAY == 3) ||
(gSaveContext.save.time >= CLOCK_TIME(17, 0))) {
gSaveContext.screenScale = 1000.0f;
}
@@ -320,12 +320,8 @@ void EnTest4_Init(Actor* thisx, PlayState* play) {
if (gSaveContext.save.time < CLOCK_TIME(6, 1)) {
gSaveContext.save.time = CLOCK_TIME(6, 0);
gSaveContext.gameMode = 0;
- {
- GameState* state = &play->state;
- state->running = false;
- }
- SET_NEXT_GAMESTATE(&play->state, Daytelop_Init, DaytelopContext);
- if (this && this && this) {}
+ STOP_GAMESTATE(&play->state);
+ SET_NEXT_GAMESTATE(&play->state, DayTelop_Init, sizeof(DayTelopState));
this->unk_144 = 1;
gSaveContext.save.time = CLOCK_TIME(6, 0);
Actor_MarkForDeath(&this->actor);
@@ -340,7 +336,8 @@ void EnTest4_Init(Actor* thisx, PlayState* play) {
} else if (gSaveContext.save.time == CLOCK_TIME(6, 0)) {
this->unk_144 = 0;
func_80A41D70(this, play);
- if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) {
+ if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) &&
+ !(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
player->stateFlags1 |= 0x200;
}
} else {
@@ -361,7 +358,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) {
}
this->lastBellTime = gSaveContext.save.time;
- if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) {
+ if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
gSaveContext.screenScaleFlag = 0;
gSaveContext.screenScale = 1000.0f;
}
@@ -388,8 +385,8 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
if ((temp_a3 * temp_a2) <= 0) {
gSaveContext.unk_3CA7 = 1;
- if (play->actorCtx.unk5 & 0x4) {
- play->actorCtx.unk5 &= ~0x4;
+ if (play->actorCtx.flags & ACTORCTX_FLAG_2) {
+ play->actorCtx.flags &= ~ACTORCTX_FLAG_2;
}
if (temp_a0 != CLOCK_TIME(6, 0)) {
@@ -399,7 +396,8 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
Interface_StartMoonCrash(play);
Actor_MarkForDeath(&this->actor);
gSaveContext.eventInf[1] |= 0x80;
- } else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) && CURRENT_DAY != 3) {
+ } else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) &&
+ (CURRENT_DAY != 3)) {
func_80A41FA4(this, play);
} else {
gSaveContext.screenScale = 0.0f;
@@ -424,7 +422,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
}
}
- if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) {
+ if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
player->stateFlags1 |= 0x200;
this->unk_146 = gSaveContext.save.time;
} else {
@@ -447,7 +445,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
s32 playerParams;
u32 entrance = gSaveContext.save.entrance;
- if (play->actorCtx.unk5 & 2) {
+ if ((play->actorCtx.flags & ACTORCTX_FLAG_1)) {
playerParams = 0xCFF;
} else {
playerParams = 0xBFF;
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 82af65e3c..ba375f583 100644
--- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c
+++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c
@@ -80,13 +80,7 @@ u8 D_80A93E80[] = {
};
TexturePtr D_80A9402C[] = {
- NULL,
- gameplay_keep_Tex_05B6F0,
- gameplay_keep_Tex_05CEF0,
- gameplay_keep_Tex_0607C0,
- gameplay_keep_Tex_060FC0,
- gameplay_keep_Tex_061FC0,
- gameplay_keep_Tex_061FE0,
+ NULL, gDropArrows2Tex, gDropBombTex, gDropDekuNutTex, gDropDekuStickTex, gRupeeGreenTex, gRupeeBlueTex,
};
Color_RGB8 D_80A94048 = { 230, 230, 220 };
@@ -221,7 +215,7 @@ void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A9402C[ptr->unk_00]));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
+ gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
}
Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW);
@@ -273,7 +267,7 @@ void func_80A90FC0(EnTest6* this, PlayState* play, EnTest6Struct* ptr) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A9402C[ptr->unk_00]));
- gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0);
+ gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
}
Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW);
@@ -1126,7 +1120,7 @@ void func_80A93298(EnTest6* this, PlayState* play) {
gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255);
gDPSetEnvColor(this->unk_148++, 255, 255, 255, 255);
gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2);
- gSPDisplayList(this->unk_148++, gameplay_keep_DL_07AFB0);
+ gSPDisplayList(this->unk_148++, gSongOfTimeClockDL);
temp_s4 += 0x1000;
cos = Math_CosS(temp_s4) * this->unk_150;
@@ -1140,7 +1134,7 @@ void func_80A93298(EnTest6* this, PlayState* play) {
gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255);
gDPSetEnvColor(this->unk_148++, 255, 255, 255, 255);
gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2);
- gSPDisplayList(this->unk_148++, gameplay_keep_DL_07AFB0);
+ gSPDisplayList(this->unk_148++, gSongOfTimeClockDL);
phi_f24 -= this->unk_14C;
phi_s2 += this->unk_27E;
@@ -1213,7 +1207,7 @@ void func_80A9369C(Actor* thisx, PlayState* play2) {
gDPSetPrimColor(this->unk_148++, 0, 0xFF, this->unk_280, this->unk_280, this->unk_280, 255);
gDPSetEnvColor(this->unk_148++, 235, 238, 235, 255);
gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2);
- gSPDisplayList(this->unk_148++, gameplay_keep_DL_07AFB0);
+ gSPDisplayList(this->unk_148++, gSongOfTimeClockDL);
phi_s2 += 0x505;
}
@@ -1257,7 +1251,7 @@ void func_80A939E8(EnTest6* this, PlayState* play2) {
gDPSetPrimColor(this->unk_148++, 0, 0xFF, 28, 28, 28, 255);
gDPSetEnvColor(this->unk_148++, 245, 245, 200, this->unk_282);
gDPSetRenderMode(this->unk_148++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2);
- gSPDisplayList(this->unk_148++, gameplay_keep_DL_07AFB0);
+ gSPDisplayList(this->unk_148++, gSongOfTimeClockDL);
POLY_XLU_DISP = this->unk_148;
}
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 473ff1edd..6dda48fc7 100644
--- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c
+++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c
@@ -315,7 +315,7 @@ void func_80BA3D38(EnToto* this, PlayState* play) {
this->cutscene = this->actor.cutscene;
this->text = ENTOTO_WEEK_EVENT_FLAGS ? D_80BA50BC : D_80BA5088;
func_80BA4C0C(this, play);
- play->actorCtx.unk5 |= 0x20;
+ play->actorCtx.flags |= ACTORCTX_FLAG_5;
this->unk260[0] = 0;
}
@@ -344,7 +344,7 @@ void func_80BA3DBC(EnToto* this, PlayState* play) {
func_80BA36C0(this, play, 0);
ActorCutscene_Stop(this->cutscene);
- play->actorCtx.unk5 &= ~0x20;
+ play->actorCtx.flags &= ~ACTORCTX_FLAG_5;
}
s32 func_80BA3EC0(EnToto* this, PlayState* play) {
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 cd19adb9e..8dfaca819 100644
--- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c
+++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c
@@ -23,7 +23,7 @@ void EnTrt_Draw(Actor* thisx, PlayState* play);
void EnTrt_GetCutscenes(EnTrt* this, PlayState* play);
void EnTrt_ResetItemPosition(EnTrt* this);
-void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play);
+void EnTrt_TrackPlayer(EnTrt* this, PlayState* play);
s32 EnTrt_ReturnItemToShelf(EnTrt* this);
s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, PlayState* play);
s32 EnTrt_TakeItemOffShelf(EnTrt* this);
@@ -64,17 +64,30 @@ void EnTrt_Blink(EnTrt* this);
void EnTrt_OpenEyes2(EnTrt* this);
void EnTrt_NodOff(EnTrt* this);
+typedef enum {
+ /* 0 */ TRT_ANIM_IDLE,
+ /* 1 */ TRT_ANIM_HALF_AWAKE,
+ /* 2 */ TRT_ANIM_SLEEPING,
+ /* 3 */ TRT_ANIM_WAKE_UP,
+ /* 4 */ TRT_ANIM_SURPRISED,
+ /* 5 */ TRT_ANIM_HANDS_ON_COUNTER,
+ /* 6 */ TRT_ANIM_HOVER,
+ /* 7 */ TRT_ANIM_FLY_LOOK_AROUND,
+ /* 8 */ TRT_ANIM_FLY_DOWN,
+ /* 9 */ TRT_ANIM_FLY
+} TrtAnimation;
+
static AnimationInfoS sAnimationInfo[] = {
- { &object_trt_Anim_00DE68, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00EE98, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00FD34, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_0030EC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_003D78, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00D52C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_000A44, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_001EF4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002224, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002CB0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
};
const ActorInit En_Trt_InitVars = {
@@ -149,7 +162,7 @@ void EnTrt_UpdateCursorPos(PlayState* play, EnTrt* this) {
f32 xOffset = 0.0f;
f32 yOffset = 17.0f;
- Actor_GetScreenPos(play, &this->items[this->cursorIdx]->actor, &x, &y);
+ Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y);
this->cursorPos.x = x + xOffset;
this->cursorPos.y = y + yOffset;
this->cursorPos.z = 1.2f;
@@ -178,18 +191,18 @@ void EnTrt_SetupGetMushroomCutscene(EnTrt* this) {
}
u16 EnTrt_GetItemTextId(EnTrt* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
- if (item->actor.params == SI_POTION_BLUE && !(this->flags & ENTRT_GIVEN_MUSHROOM)) {
+ if ((item->actor.params == SI_POTION_BLUE) && !(this->flags & ENTRT_GIVEN_MUSHROOM)) {
return 0x880;
}
return item->actor.textId;
}
u16 EnTrt_GetItemChoiceTextId(EnTrt* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
- if (item->actor.params == SI_POTION_BLUE && !(gSaveContext.save.weekEventReg[53] & 0x10)) {
+ if ((item->actor.params == SI_POTION_BLUE) && !(gSaveContext.save.weekEventReg[53] & 0x10)) {
this->textId = 0x881;
return 0x881;
}
@@ -384,7 +397,7 @@ void EnTrt_Goodbye(EnTrt* this, PlayState* play) {
}
}
-void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, PlayState* play) {
+void EnTrt_StartRedPotionConversation(EnTrt* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
if (this->textId == 0x88F) {
if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) {
@@ -501,7 +514,7 @@ s32 EnTrt_FacingShopkeeperDialogResult(EnTrt* this, PlayState* play) {
void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
- u8 cursorIdx;
+ u8 cursorIndex;
if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -523,9 +536,9 @@ void EnTrt_FaceShopkeeper(EnTrt* this, PlayState* play) {
if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) {
if ((!Message_ShouldAdvance(play) || !EnTrt_FacingShopkeeperDialogResult(this, play)) &&
(this->stickAccumX > 0)) {
- cursorIdx = EnTrt_SetCursorIndexFromNeutral(this, 2);
- if (cursorIdx != CURSOR_INVALID) {
- this->cursorIdx = cursorIdx;
+ cursorIndex = EnTrt_SetCursorIndexFromNeutral(this, 2);
+ if (cursorIndex != CURSOR_INVALID) {
+ this->cursorIndex = cursorIndex;
this->actionFunc = EnTrt_LookToShelf;
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
this->stickRightPrompt.isEnabled = false;
@@ -562,7 +575,7 @@ void EnTrt_LookToShelf(EnTrt* this, PlayState* play) {
}
void EnTrt_CursorLeftRight(PlayState* play, EnTrt* this) {
- u8 curTemp = this->cursorIdx;
+ u8 curTemp = this->cursorIndex;
if (this->stickAccumX < 0) {
if (curTemp != 2) {
@@ -571,20 +584,20 @@ void EnTrt_CursorLeftRight(PlayState* play, EnTrt* this) {
EnTrt_SetupLookToShopkeeperFromShelf(play, this);
}
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
}
} else if (this->stickAccumX > 0) {
if (curTemp != 0) {
curTemp--;
}
if (this->items[curTemp] != NULL) {
- this->cursorIdx = curTemp;
+ this->cursorIndex = curTemp;
}
}
}
s32 EnTrt_HasPlayerSelectedItem(PlayState* play, EnTrt* this, Input* input) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
if (EnTrt_TestEndInteraction(this, play, input)) {
return true;
@@ -609,8 +622,8 @@ s32 EnTrt_HasPlayerSelectedItem(PlayState* play, EnTrt* this, Input* input) {
void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s32 pad;
- u8 prevCursorIdx = this->cursorIdx;
- u8 cursorIdx;
+ u8 prevCursorIdx = this->cursorIndex;
+ u8 cursorIndex;
if (!EnTrt_ReturnItemToShelf(this)) {
this->delayTimer = 3;
@@ -624,7 +637,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) {
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
if (!EnTrt_HasPlayerSelectedItem(play, this, CONTROLLER1(&play->state))) {
EnTrt_CursorLeftRight(play, this);
- if (this->cursorIdx != prevCursorIdx) {
+ if (this->cursorIndex != prevCursorIdx) {
func_80151938(play, EnTrt_GetItemTextId(this));
play_sound(NA_SE_SY_CURSOR);
}
@@ -636,7 +649,7 @@ void EnTrt_BrowseShelf(EnTrt* this, PlayState* play) {
void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) {
Player* player = GET_PLAYER(play);
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
player->stateFlags2 &= ~0x20000000;
@@ -656,7 +669,7 @@ void EnTrt_SetupCanBuy(PlayState* play, EnTrt* this, u16 textId) {
}
void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
EnGirlA* item2;
switch (item->canBuyFunc(play, item)) {
@@ -666,13 +679,14 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) {
this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED;
}
func_8019F208();
- item2 = this->items[this->cursorIdx];
+ item2 = this->items[this->cursorIndex];
item2->buyFanfareFunc(play, item2);
EnTrt_SetupBuyItemWithFanfare(play, this);
this->drawCursor = 0;
this->shopItemSelectedTween = 0.0f;
item->boughtFunc(play, item);
break;
+
case CANBUY_RESULT_SUCCESS_2:
func_8019F208();
item->buyFunc(play, item);
@@ -681,27 +695,34 @@ void EnTrt_HandleCanBuyItem(PlayState* play, EnTrt* this) {
this->shopItemSelectedTween = 0.0f;
item->boughtFunc(play, item);
break;
+
case CANBUY_RESULT_NO_ROOM:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x641);
break;
+
case CANBUY_RESULT_NEED_EMPTY_BOTTLE:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x846);
break;
+
case CANBUY_RESULT_NEED_RUPEES:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x847);
break;
+
case CANBUY_RESULT_CANNOT_GET_NOW:
play_sound(NA_SE_SY_ERROR);
EnTrt_SetupCannotBuy(play, this, 0x643);
break;
+
+ default:
+ break;
}
}
void EnTrt_SelectItem(EnTrt* this, PlayState* play) {
- EnGirlA* item = this->items[this->cursorIdx];
+ EnGirlA* item = this->items[this->cursorIndex];
u8 talkState = Message_GetState(&play->msgCtx);
if (EnTrt_TakeItemOffShelf(this)) {
@@ -757,8 +778,8 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) {
}
this->prevTextId = this->textId;
- if (player->transformation == PLAYER_FORM_GORON || player->transformation == PLAYER_FORM_ZORA ||
- player->transformation == PLAYER_FORM_DEKU) {
+ if ((player->transformation == PLAYER_FORM_GORON) || (player->transformation == PLAYER_FORM_ZORA) ||
+ (player->transformation == PLAYER_FORM_DEKU)) {
this->textId = 0x850;
}
if (Player_GetMask(play) == PLAYER_MASK_SCENTS) {
@@ -779,14 +800,14 @@ void EnTrt_IdleSleeping(EnTrt* this, PlayState* play) {
player->stateFlags2 |= 0x20000000;
this->timer = 45;
this->actionFunc = EnTrt_BeginInteraction;
- } else if ((player->actor.world.pos.x >= -50.0f && player->actor.world.pos.x <= -25.0f) &&
- (player->actor.world.pos.z >= -19.0f && player->actor.world.pos.z <= 30.0f)) {
+ } else if (((player->actor.world.pos.x >= -50.0f) && (player->actor.world.pos.x <= -25.0f)) &&
+ ((player->actor.world.pos.z >= -19.0f) && (player->actor.world.pos.z <= 30.0f))) {
func_800B8614(&this->actor, play, 200.0f);
}
if (DECR(this->timer) == 0) {
this->timer = 40;
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 1);
- this->animIndex = 1;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_HALF_AWAKE);
+ this->animIndex = TRT_ANIM_HALF_AWAKE;
this->actionFunc = EnTrt_IdleAwake;
this->blinkFunc = EnTrt_OpenThenCloseEyes;
}
@@ -799,7 +820,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
Player* player = GET_PLAYER(play);
this->flags &= ~ENTRT_FULLY_AWAKE;
- if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_FIERCE_DEITY) {
+ if ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_FIERCE_DEITY)) {
if (Player_GetMask(play) == PLAYER_MASK_SCENTS) {
this->textId = 0x890;
} else {
@@ -821,7 +842,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
if (player->transformation == PLAYER_FORM_HUMAN) {
this->flags |= ENTRT_MET;
}
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 2);
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SLEEPING);
this->blinkFunc = EnTrt_EyesClosed;
this->timer = 45;
this->actionFunc = EnTrt_BeginInteraction;
@@ -831,8 +852,8 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
}
if (DECR(this->timer) == 0) {
this->timer = Rand_S16Offset(150, 100);
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 2);
- this->animIndex = 2;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SLEEPING);
+ this->animIndex = TRT_ANIM_SLEEPING;
this->sleepSoundTimer = 10;
this->actor.textId = 0;
this->actionFunc = EnTrt_IdleSleeping;
@@ -842,7 +863,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) {
void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed;
- s16 animLastFrame = Animation_GetLastFrame(&object_trt_Anim_0030EC) / (s16)this->skelAnime.playSpeed;
+ s16 animLastFrame = Animation_GetLastFrame(&gKotakeWakeUpAnim) / (s16)this->skelAnime.playSpeed;
if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) {
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
@@ -852,10 +873,10 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
ActorCutscene_SetIntentToPlay(this->cutscene);
}
} else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) {
- if (this->animIndex != 5) {
+ if (this->animIndex != TRT_ANIM_HANDS_ON_COUNTER) {
if (curFrame == animLastFrame) {
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 3);
- this->animIndex = 3;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_WAKE_UP);
+ this->animIndex = TRT_ANIM_WAKE_UP;
this->blinkFunc = EnTrt_OpenEyesThenSetToBlink;
this->timer = 10;
this->cutsceneState = ENTRT_CUTSCENESTATE_PLAYING;
@@ -868,9 +889,9 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
}
} else if (DECR(this->timer) == 0) {
this->timer = Rand_S16Offset(40, 20);
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 5);
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_HANDS_ON_COUNTER);
Message_StartTextbox(play, this->textId, &this->actor);
- this->animIndex = 5;
+ this->animIndex = TRT_ANIM_HANDS_ON_COUNTER;
switch (this->textId) {
case 0x834:
if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) &&
@@ -880,7 +901,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
this->stickRightPrompt.isEnabled = true;
this->actionFunc = EnTrt_Hello;
} else {
- this->actionFunc = EnTrt_SetupTryToGiveRedPotion;
+ this->actionFunc = EnTrt_StartRedPotionConversation;
}
break;
case 0x83E:
@@ -894,7 +915,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) {
this->actionFunc = EnTrt_SetupEndInteraction;
break;
case 0x88F:
- this->actionFunc = EnTrt_SetupTryToGiveRedPotion;
+ this->actionFunc = EnTrt_StartRedPotionConversation;
break;
}
}
@@ -910,8 +931,8 @@ void EnTrt_Surprised(EnTrt* this, PlayState* play) {
}
} else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) {
if (DECR(this->timer) == 0) {
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 4);
- this->animIndex = 4;
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_SURPRISED);
+ this->animIndex = TRT_ANIM_SURPRISED;
this->blinkFunc = EnTrt_OpenEyes2;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KOTAKE_SURPRISED);
this->timer = 30;
@@ -919,9 +940,9 @@ void EnTrt_Surprised(EnTrt* this, PlayState* play) {
}
} else if (DECR(this->timer) == 0) {
this->timer = Rand_S16Offset(40, 20);
- EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, 5);
+ EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_HANDS_ON_COUNTER);
Message_StartTextbox(play, this->textId, &this->actor);
- this->animIndex = 5;
+ this->animIndex = TRT_ANIM_HANDS_ON_COUNTER;
this->actionFunc = EnTrt_TryToGiveRedPotionAfterSurprised;
}
}
@@ -1057,7 +1078,7 @@ void EnTrt_CanBuy(EnTrt* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->shopItemSelectedTween = 0.0f;
EnTrt_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
this->actionFunc = this->prevActionFunc;
func_80151938(play, EnTrt_GetItemTextId(this));
@@ -1069,7 +1090,7 @@ void EnTrt_BuyItemWithFanfare(EnTrt* this, PlayState* play) {
this->actor.parent = NULL;
this->actionFunc = EnTrt_SetupItemGiven;
} else {
- Actor_PickUp(&this->actor, play, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f);
+ Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f);
}
}
@@ -1096,7 +1117,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) {
Interface_SetAButtonDoAction(play, DO_ACTION_DECIDE);
if (Message_ShouldAdvance(play)) {
EnTrt_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
if (!EnTrt_TestEndInteraction(this, play, CONTROLLER1(&play->state))) {
switch (play->msgCtx.choiceIndex) {
@@ -1119,7 +1140,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) {
} else if (talkState == TEXT_STATE_5) {
if (Message_ShouldAdvance(play)) {
EnTrt_ResetItemPosition(this);
- item = this->items[this->cursorIdx];
+ item = this->items[this->cursorIndex];
item->restockFunc(play, item);
EnTrt_EndInteraction(play, this);
}
@@ -1128,7 +1149,7 @@ void EnTrt_ContinueShopping(EnTrt* this, PlayState* play) {
void EnTrt_PositionSelectedItem(EnTrt* this) {
static Vec3f sSelectedItemPosition = { 6.0f, 35.0f, -12.0f };
- u8 i = this->cursorIdx;
+ u8 i = this->cursorIndex;
EnGirlA* item;
ShopItem* shopItem = &sShop[i];
Vec3f worldPos;
@@ -1189,7 +1210,7 @@ void EnTrt_UpdateItemSelectedProperty(EnTrt* this) {
(this->drawCursor == 0)) {
item->isSelected = false;
} else {
- item->isSelected = this->cursorIdx == i ? true : false;
+ item->isSelected = this->cursorIndex == i ? true : false;
}
}
}
@@ -1278,53 +1299,53 @@ void EnTrt_UpdateStickDirectionPromptAnim(EnTrt* this) {
}
void EnTrt_OpenEyes(EnTrt* this) {
- if (this->eyeTextureIdx <= 0) {
- this->eyeTextureIdx = 0;
+ if (this->eyeTexIndex <= 0) {
+ this->eyeTexIndex = 0;
} else {
- this->eyeTextureIdx--;
+ this->eyeTexIndex--;
}
}
void EnTrt_CloseEyes(EnTrt* this) {
- if (this->eyeTextureIdx >= 2) {
- this->eyeTextureIdx = 2;
+ if (this->eyeTexIndex >= 2) {
+ this->eyeTexIndex = 2;
} else {
- this->eyeTextureIdx++;
+ this->eyeTexIndex++;
}
}
void EnTrt_Blink(EnTrt* this) {
s16 decr = this->blinkTimer - 1;
- s16 eyeTextureIdxTemp;
+ s16 eyeTexIndex;
if (decr != 0) {
this->blinkTimer = decr;
return;
}
- eyeTextureIdxTemp = this->eyeTextureIdx + 1;
- if (eyeTextureIdxTemp > 2) {
- this->eyeTextureIdx = 0;
+ eyeTexIndex = this->eyeTexIndex + 1;
+ if (eyeTexIndex > 2) {
+ this->eyeTexIndex = 0;
this->blinkTimer = (s32)(Rand_ZeroOne() * 60.0f) + 20;
} else {
- this->eyeTextureIdx = eyeTextureIdxTemp;
+ this->eyeTexIndex = eyeTexIndex;
this->blinkTimer = 1;
}
}
void EnTrt_NodOff(EnTrt* this) {
s16 decr = this->blinkTimer - 1;
- s16 eyeTextureIdxTemp;
+ s16 eyeTexIndex;
if (decr != 0) {
this->blinkTimer = decr;
return;
}
- eyeTextureIdxTemp = this->eyeTextureIdx + 1;
- if (eyeTextureIdxTemp > 2) {
- this->eyeTextureIdx = 1;
+ eyeTexIndex = this->eyeTexIndex + 1;
+ if (eyeTexIndex > 2) {
+ this->eyeTexIndex = 1;
this->blinkTimer = 20;
} else {
- this->eyeTextureIdx = eyeTextureIdxTemp;
+ this->eyeTexIndex = eyeTexIndex;
this->blinkTimer = 3;
}
}
@@ -1333,14 +1354,14 @@ void EnTrt_OpenThenCloseEyes(EnTrt* this) {
if (this->skelAnime.curFrame >= 40.0f) {
EnTrt_CloseEyes(this);
} else if (this->skelAnime.curFrame >= 35.0f) {
- this->eyeTextureIdx = 1;
+ this->eyeTexIndex = 1;
} else if (this->skelAnime.curFrame >= 10.0f) {
EnTrt_OpenEyes(this);
}
}
void EnTrt_EyesClosed(EnTrt* this) {
- this->eyeTextureIdx = 2;
+ this->eyeTexIndex = 2;
}
void EnTrt_OpenEyes2(EnTrt* this) {
@@ -1350,7 +1371,7 @@ void EnTrt_OpenEyes2(EnTrt* this) {
void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) {
if (this->skelAnime.curFrame >= 7.0f) {
EnTrt_OpenEyes(this);
- if (this->eyeTextureIdx == 0) {
+ if (this->eyeTexIndex == 0) {
this->blinkFunc = EnTrt_Blink;
}
}
@@ -1363,7 +1384,7 @@ void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) {
if (talkState == TEXT_STATE_5) {
if (Message_ShouldAdvance(play)) {
- if (this->talkOptionTextId == 0x845 || this->talkOptionTextId == 0x882) {
+ if ((this->talkOptionTextId == 0x845) || (this->talkOptionTextId == 0x882)) {
func_80151938(play, 0xFF);
} else {
EnTrt_StartShopping(play, this);
@@ -1441,9 +1462,9 @@ void EnTrt_LookToShopkeeperFromShelf(EnTrt* this, PlayState* play) {
}
void EnTrt_InitShopkeeper(EnTrt* this, PlayState* play) {
- SkelAnime_InitFlex(play, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_00FD34, NULL, NULL, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeSleepingAnim, NULL, NULL, 0);
if (!(gSaveContext.save.weekEventReg[12] & 8) && !(gSaveContext.save.weekEventReg[84] & 0x40) &&
- gSaveContext.save.day >= 2) {
+ (gSaveContext.save.day >= 2)) {
this->actor.draw = NULL;
} else {
this->actor.draw = EnTrt_Draw;
@@ -1472,7 +1493,7 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) {
this->stickAccumY = 0;
this->stickAccumX = 0;
- this->cursorIdx = 0;
+ this->cursorIndex = 0;
this->cursorPos.z = 1.2f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
@@ -1522,7 +1543,7 @@ void EnTrt_InitShop(EnTrt* this, PlayState* play) {
Actor_SetScale(&this->actor, sActorScale);
EnTrt_SpawnShopItems(this, play, sShop);
this->blinkTimer = 20;
- this->eyeTextureIdx = 0;
+ this->eyeTexIndex = 0;
this->blinkFunc = EnTrt_EyesClosed;
if (gSaveContext.save.weekEventReg[53] & 8) {
this->flags |= ENTRT_GIVEN_MUSHROOM;
@@ -1548,6 +1569,7 @@ void EnTrt_DrawCursor(PlayState* play, EnTrt* this, f32 x, f32 y, f32 z, u8 draw
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
+
if (drawCursor != 0) {
func_8012C654(play->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
@@ -1562,6 +1584,7 @@ void EnTrt_DrawCursor(PlayState* play, EnTrt* this, f32 x, f32 y, f32 z, u8 draw
dsdx = (1.0f / z) * 1024.0f;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx);
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1579,6 +1602,7 @@ void EnTrt_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
(void)"../z_en_trt.c";
OPEN_DISPS(play->state.gfxCtx);
+
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a);
@@ -1595,6 +1619,7 @@ void EnTrt_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y
dtdy = dy * unk;
gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy);
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1605,6 +1630,7 @@ void EnTrt_DrawStickDirectionPrompt(PlayState* play, EnTrt* this) {
(void)"../z_en_trt.c";
OPEN_DISPS(play->state.gfxCtx);
+
if (drawStickRightPrompt || drawStickLeftPrompt) {
func_8012C654(play->state.gfxCtx);
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@@ -1639,6 +1665,7 @@ void EnTrt_DrawStickDirectionPrompt(PlayState* play, EnTrt* this) {
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -1668,14 +1695,14 @@ void EnTrt_Update(Actor* thisx, PlayState* play) {
EnTrt_UpdateItemSelectedProperty(this);
EnTrt_UpdateStickDirectionPromptAnim(this);
EnTrt_UpdateCursorAnim(this);
- EnTrt_UpdateHeadYawAndPitch(this, play);
+ EnTrt_TrackPlayer(this, play);
this->actionFunc(this, play);
Actor_SetFocus(&this->actor, 90.0f);
SkelAnime_Update(&this->skelAnime);
EnTrt_UpdateCollider(this, play);
}
-void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play) {
+void EnTrt_TrackPlayer(EnTrt* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Vec3f playerPos;
Vec3f pos;
@@ -1690,7 +1717,7 @@ void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, PlayState* play) {
this->headPitch = CLAMP(this->headPitch, -0x1C70, 0x1C70);
}
-void EnTrt_UpdateHeadPosAndRot(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 isFullyAwake) {
+void EnTrt_UpdateLimb(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 overrideRot) {
Vec3f newPos;
Vec3f zeroVec = gZeroVec3f;
Vec3s newRot;
@@ -1700,7 +1727,7 @@ void EnTrt_UpdateHeadPosAndRot(s16 pitch, s16 yaw, Vec3f* pos, Vec3s* rot, s32 i
Matrix_Get(¤tState);
Matrix_MtxFToYXZRot(¤tState, &newRot, false);
*pos = newPos;
- if (isFullyAwake) {
+ if (overrideRot) {
newRot.x += pitch;
newRot.y += yaw;
Math_SmoothStepToS(&rot->x, newRot.x, 4, 0x1FFE, 1);
@@ -1723,7 +1750,7 @@ s32 EnTrt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
this->items[i]->actor.scale.z = 0.2f;
}
- if (limbIndex == 14) {
+ if (limbIndex == KOTAKE_LIMB_BROOM) {
*dList = NULL;
}
return false;
@@ -1731,14 +1758,14 @@ s32 EnTrt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
void EnTrt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnTrt* this = THIS;
- s32 isFullyAwake;
+ s32 overrideRot;
- isFullyAwake = false;
+ overrideRot = false;
if (this->flags & ENTRT_FULLY_AWAKE) {
- isFullyAwake = true;
+ overrideRot = true;
}
- if (limbIndex == 21) {
- EnTrt_UpdateHeadPosAndRot(this->headPitch, this->headYaw, &this->headPos, &this->headRot, isFullyAwake);
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
+ EnTrt_UpdateLimb(this->headPitch, this->headYaw, &this->headPos, &this->headRot, overrideRot);
Matrix_Translate(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->headRot.y, MTXMODE_APPLY);
@@ -1750,7 +1777,7 @@ void EnTrt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
void EnTrt_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
EnTrt* this = THIS;
- if (limbIndex == 21) {
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
Matrix_Translate(this->headPos.x, this->headPos.y, this->headPos.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->headRot.y, MTXMODE_APPLY);
@@ -1760,15 +1787,15 @@ void EnTrt_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
}
void EnTrt_Draw(Actor* thisx, PlayState* play) {
- static TexturePtr sEyeTextures[] = { object_trt_Tex_00B0B8, object_trt_Tex_00B8B8, object_trt_Tex_00C0B8 };
+ static TexturePtr sEyeTextures[] = { gKotakeEyeOpenTex, gKotakeEyeHalfTex, gKotakeEyeClosedTex };
EnTrt* this = THIS;
s32 pad;
OPEN_DISPS(play->state.gfxCtx);
func_8012C28C(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
- gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
+ gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, EnTrt_OverrideLimbDraw, EnTrt_PostLimbDraw,
EnTrt_TransformLimbDraw, &this->actor);
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 46f070797..9cbf5d51c 100644
--- a/src/overlays/actors/ovl_En_Trt/z_en_trt.h
+++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.h
@@ -22,7 +22,7 @@ typedef struct EnTrt {
/* 0x338 */ s32 stickAccumX;
/* 0x33C */ s32 stickAccumY;
/* 0x340 */ EnGirlA* items[3];
- /* 0x34C */ u8 cursorIdx;
+ /* 0x34C */ u8 cursorIndex;
/* 0x350 */ StickDirectionPrompt stickLeftPrompt;
/* 0x388 */ StickDirectionPrompt stickRightPrompt;
/* 0x3C0 */ f32 shopItemSelectedTween;
@@ -33,7 +33,7 @@ typedef struct EnTrt {
/* 0x3D4 */ u8 arrowAnimState;
/* 0x3D5 */ u8 stickAnimState;
/* 0x3D6 */ s16 blinkTimer;
- /* 0x3D8 */ s16 eyeTextureIdx;
+ /* 0x3D8 */ s16 eyeTexIndex;
/* 0x3DC */ EnTrtBlinkFunc blinkFunc;
/* 0x3E0 */ s16 cutscene;
/* 0x3E2 */ s16 tmpGetMushroomCutscene;
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 9e791dbea..1f521d250 100644
--- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
+++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c
@@ -26,17 +26,30 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play);
void func_80AD5234(EnTrt2* this, PlayState* play);
void func_80AD56E8(Actor* thisx, PlayState* play);
+typedef enum {
+ /* 0 */ TRT2_ANIM_IDLE,
+ /* 1 */ TRT2_ANIM_HALF_AWAKE,
+ /* 2 */ TRT2_ANIM_SLEEPING,
+ /* 3 */ TRT2_ANIM_WAKE_UP,
+ /* 4 */ TRT2_ANIM_SURPRISED,
+ /* 5 */ TRT2_ANIM_HANDS_ON_COUNTER,
+ /* 6 */ TRT2_ANIM_HOVER,
+ /* 7 */ TRT2_ANIM_FLY_LOOK_AROUND,
+ /* 8 */ TRT2_ANIM_FLY_DOWN,
+ /* 9 */ TRT2_ANIM_FLY
+} Trt2Animation;
+
static AnimationInfoS sAnimationInfo[] = {
- { &object_trt_Anim_00DE68, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00EE98, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00FD34, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_0030EC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_003D78, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
- { &object_trt_Anim_00D52C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_000A44, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_001EF4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002224, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
- { &object_trt_Anim_002CB0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
+ { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
+ { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
};
const ActorInit En_Trt2_InitVars = {
@@ -108,18 +121,18 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
-void func_80AD3380(SkelAnime* skelAnime, AnimationInfoS* animation, s32 arg2) {
- f32 phi_f0;
+void EnTrt2_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) {
+ f32 endFrame;
- animation += arg2;
+ animationInfo += animIndex;
- if (animation->frameCount < 0) {
- phi_f0 = Animation_GetLastFrame(animation->animation);
+ if (animationInfo->frameCount < 0) {
+ endFrame = Animation_GetLastFrame(animationInfo->animation);
} else {
- phi_f0 = animation->frameCount;
+ endFrame = animationInfo->frameCount;
}
- Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, phi_f0,
- animation->mode, animation->morphFrames);
+ Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, endFrame,
+ animationInfo->mode, animationInfo->morphFrames);
}
void func_80AD341C(EnTrt2* this, PlayState* play) {
@@ -170,7 +183,7 @@ void func_80AD3530(EnTrt2* this, PlayState* play) {
if (DECR(this->unk_3AE) == 0) {
this->unk_3AE = Rand_S16Offset(20, 20);
- func_80AD3380(&this->skelAnime, sAnimationInfo, 7);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_LOOK_AROUND);
this->unk_3B2 = 5;
}
}
@@ -277,7 +290,7 @@ void func_80AD3A24(EnTrt2* this, PlayState* play) {
Math_ApproachF(&this->actor.speedXZ, 0.0f, 0.2f, 1.0f);
} else if (DECR(this->unk_3AE) == 0) {
this->unk_3AE = Rand_S16Offset(100, 50);
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->unk_3B2 = 4;
}
Actor_MoveWithGravity(&this->actor);
@@ -288,7 +301,7 @@ void func_80AD3AE4(EnTrt2* this, PlayState* play) {
Math_ApproachF(&this->actor.velocity.y, 0.5f, 0.2f, 0.1f);
} else {
this->actor.velocity.y = 0.0f;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->unk_3B2 = 4;
}
Actor_MoveWithGravity(&this->actor);
@@ -298,7 +311,7 @@ void func_80AD3B6C(EnTrt2* this, PlayState* play) {
if (DECR(this->unk_3B0) == 0) {
this->unk_3B0 = 10;
this->actor.velocity.y = -1.0f;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 8);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_DOWN);
this->unk_3B2 = 8;
}
}
@@ -311,7 +324,7 @@ void func_80AD3BE4(EnTrt2* this, PlayState* play) {
this->actor.world.rot.y += this->unk_3C0;
this->actor.shape.rot.y = this->actor.world.rot.y;
if (this->actor.world.pos.y < 5.0f) {
- func_80AD3380(&this->skelAnime, sAnimationInfo, 9);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY);
this->unk_3B2 = 9;
}
}
@@ -335,7 +348,7 @@ void func_80AD3CEC(EnTrt2* this, PlayState* play) {
} else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->unk_3B2 = 4;
}
}
@@ -436,7 +449,7 @@ void func_80AD417C(EnTrt2* this, PlayState* play) {
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
if (this->unk_3A8 == 0x84C) {
- func_80AD3380(&this->skelAnime, sAnimationInfo, 6);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER);
this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F);
this->unk_3B2 = 18;
} else if (this->unk_3A8 == 0x88F) {
@@ -510,7 +523,7 @@ void func_80AD4550(EnTrt2* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
if ((player->transformation != PLAYER_FORM_HUMAN) && (player->transformation != PLAYER_FORM_FIERCE_DEITY)) {
- func_80AD3380(&this->skelAnime, sAnimationInfo, 7);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_LOOK_AROUND);
this->unk_3B2 = 17;
}
@@ -539,7 +552,7 @@ void func_80AD4608(EnTrt2* this) {
}
void func_80AD469C(EnTrt2* this, PlayState* play) {
- SkelAnime_InitFlex(play, &this->skelAnime, &object_trt_Skel_00FEF0, &object_trt_Anim_000A44, NULL, NULL, 0);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeHoverAnim, NULL, NULL, 0);
this->actor.draw = func_80AD56E8;
}
@@ -665,7 +678,7 @@ s32 func_80AD4B4C(EnTrt2* this, PlayState* play) {
} else {
this->unk_3A8 = 0x84F;
this->unk_3D8 = true;
- func_80AD3380(&this->skelAnime, sAnimationInfo, 7);
+ EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_FLY_LOOK_AROUND);
this->unk_3B2 = 7;
}
}
@@ -876,7 +889,8 @@ void func_80AD5394(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4) {
s32 EnTrt2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnTrt2* this = THIS;
- if ((limbIndex == 8) || (limbIndex == 13) || (limbIndex == 19)) {
+ if ((limbIndex == KOTAKE_LIMB_TORSO_LIMB) || (limbIndex == KOTAKE_LIMB_LEFT_HAND) ||
+ (limbIndex == KOTAKE_LIMB_RIGHT_HAND)) {
rot->y += (s16)Math_SinS(this->unk_33C[limbIndex]) * 200;
rot->z += (s16)Math_CosS(this->unk_372[limbIndex]) * 200;
}
@@ -892,7 +906,7 @@ void EnTrt2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
phi_v0 = true;
}
- if (limbIndex == 21) {
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
func_80AD5394(this->unk_3D4, this->unk_3D6, &this->unk_3C8, &this->unk_3C2, phi_v0);
Matrix_Translate(this->unk_3C8.x, this->unk_3C8.y, this->unk_3C8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@@ -906,7 +920,7 @@ void EnTrt2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
void EnTrt2_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
EnTrt2* this = THIS;
- if (limbIndex == 21) {
+ if (limbIndex == KOTAKE_LIMB_HEAD) {
Matrix_Translate(this->unk_3C8.x, this->unk_3C8.y, this->unk_3C8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->unk_3C2.y, MTXMODE_APPLY);
@@ -917,9 +931,9 @@ void EnTrt2_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
void func_80AD56E8(Actor* thisx, PlayState* play) {
static TexturePtr D_80AD5978[] = {
- object_trt_Tex_00B0B8,
- object_trt_Tex_00B8B8,
- object_trt_Tex_00C0B8,
+ gKotakeEyeOpenTex,
+ gKotakeEyeHalfTex,
+ gKotakeEyeClosedTex,
};
s32 pad;
EnTrt2* this = THIS;
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 996a32bef..42cbdc22a 100644
--- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c
+++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c
@@ -80,8 +80,8 @@ static Color_RGBA8 D_80A8B25C[] = {
static f32 D_80A8B274[] = { 60.0f, 255.0f, 60.0f };
-static TexturePtr D_80A8B280[] = {
- gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
+static TexturePtr sDustTextures[] = {
+ gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex,
};
static ColliderSphereInit sSphereInit = {
@@ -307,7 +307,7 @@ void func_80A85F84(EnTruUnkStruct* arg0, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
idx = ((f32)arg0->unk_02 / arg0->unk_01) * 8.0f;
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A8B280[idx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[idx]));
gSPDisplayList(POLY_XLU_DISP++, object_tru_DL_01A830);
Matrix_Pop();
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 5ce0f0286..2dedc7c2a 100644
--- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c
+++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c
@@ -144,8 +144,8 @@ static DamageTable sDamageTable = {
static CollisionCheckInfoInit sColChkInfoInit = { 2, 25, 100, MASS_IMMOVABLE };
TexturePtr D_808CD58C[] = {
- gameplay_keep_Tex_03F300, gameplay_keep_Tex_03FB00, gameplay_keep_Tex_040300, gameplay_keep_Tex_040B00,
- gameplay_keep_Tex_041300, gameplay_keep_Tex_041B00, gameplay_keep_Tex_042300, gameplay_keep_Tex_042B00,
+ gEffEnemyDeathFlame1Tex, gEffEnemyDeathFlame2Tex, gEffEnemyDeathFlame3Tex, gEffEnemyDeathFlame4Tex,
+ gEffEnemyDeathFlame5Tex, gEffEnemyDeathFlame6Tex, gEffEnemyDeathFlame7Tex, gEffEnemyDeathFlame8Tex,
};
static InitChainEntry sInitChain[] = {
@@ -532,7 +532,7 @@ void EnVm_Draw(Actor* thisx, PlayState* play) {
gDPSetPrimColor(&gfx[3], 0, 0, 255, 255, 255, 168);
gDPSetEnvColor(&gfx[4], 0, 0, 255, 0);
gSPSegment(&gfx[5], 0x08, D_808CD58C[play->gameplayFrames & 7]);
- gSPDisplayList(&gfx[6], gameplay_keep_DL_044300);
+ gSPDisplayList(&gfx[6], gEffEnemyDeathFlameDL);
POLY_XLU_DISP = &gfx[7];
}
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 499ca365f..fc1ad7279 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
@@ -1,7 +1,15 @@
/*
* File: z_en_water_effect.c
* Overlay: ovl_En_Water_Effect
- * Description: Water splashing effect (used for Gyorg)
+ * Description: Water/rock drop spawner and Gyorg water splashing effect
+ *
+ * This actor serves two purposes:
+ * - It can act as a "spawner" for either water drops or flaming rocks. This
+ * spawner can be placed in the ceiling to drop these repeatedly.
+ * - It is also used to control various water splashing effects for the Gyorg
+ * fight. Specifically, it handles the splashing that is caused when it
+ * enters or exits the water, and it handles the shockwave that is created
+ * when it rams the center platform.
*/
#include "z_en_water_effect.h"
@@ -85,27 +93,30 @@ void EnWaterEffect_Init(Actor* thisx, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_1;
this->unk_DC4 = Rand_ZeroFloat(100.0f);
- if (this->actor.params == ENWATEREFFECT_1) {
+ if (this->actor.params == ENWATEREFFECT_TYPE_FALLING_ROCK_SPAWNER) {
this->actor.update = func_80A59C04;
this->actor.draw = func_80A5A184;
this->unk_DC6 = Rand_ZeroFloat(100.0f) + 60.0f;
- } else if ((this->actor.params == ENWATEREFFECT_309) || (this->actor.params == ENWATEREFFECT_30A) ||
- (this->actor.params == ENWATEREFFECT_30B) || (this->actor.params == ENWATEREFFECT_30C)) {
+ } else if ((this->actor.params == ENWATEREFFECT_TYPE_GYORG_RIPPLES) ||
+ (this->actor.params == ENWATEREFFECT_TYPE_GYORG_PRIMARY_SPRAY) ||
+ (this->actor.params == ENWATEREFFECT_TYPE_GYORG_SECONDARY_SPRAY) ||
+ (this->actor.params == ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE)) {
this->actor.update = func_80A5A534;
this->actor.draw = func_80A5A6B8;
this->actor.shape.rot.y = Rand_ZeroFloat(0x10000);
Actor_SetScale(&this->actor, this->actor.shape.rot.z * 0.0002f);
- if (this->actor.params == ENWATEREFFECT_309) {
+ if (this->actor.params == ENWATEREFFECT_TYPE_GYORG_RIPPLES) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y,
- this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z, 0x30A);
+ this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z, ENWATEREFFECT_TYPE_GYORG_PRIMARY_SPRAY);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y,
- this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z, 0x30B);
- } else if (this->actor.params == ENWATEREFFECT_30A) {
+ this->actor.world.pos.z, 0, 0, this->actor.shape.rot.z,
+ ENWATEREFFECT_TYPE_GYORG_SECONDARY_SPRAY);
+ } else if (this->actor.params == ENWATEREFFECT_TYPE_GYORG_PRIMARY_SPRAY) {
this->unk_DC4 = -3;
- } else if (this->actor.params == ENWATEREFFECT_30B) {
+ } else if (this->actor.params == ENWATEREFFECT_TYPE_GYORG_SECONDARY_SPRAY) {
this->unk_DC4 = -6;
- } else if (this->actor.params == ENWATEREFFECT_30C) {
+ } else if (this->actor.params == ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE) {
this->unk_DC4 = 23;
}
@@ -285,7 +296,7 @@ void EnWaterEffect_Draw(Actor* thisx, PlayState* play2) {
if (!phi_s4) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex));
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
phi_s4++;
@@ -317,7 +328,7 @@ void EnWaterEffect_Draw(Actor* thisx, PlayState* play2) {
if (!phi_s4) {
func_8012C448(gfxCtx);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex));
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260);
phi_s4++;
@@ -620,7 +631,8 @@ void func_80A5A6B8(Actor* thisx, PlayState* play2) {
Matrix_Push();
Matrix_Push();
- if ((this->actor.params == ENWATEREFFECT_309) || (this->actor.params == ENWATEREFFECT_30A)) {
+ if ((this->actor.params == ENWATEREFFECT_TYPE_GYORG_RIPPLES) ||
+ (this->actor.params == ENWATEREFFECT_TYPE_GYORG_PRIMARY_SPRAY)) {
if (this->unk_E2C > 1.0f) {
func_8012C2DC(play->state.gfxCtx);
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000DE0));
@@ -648,7 +660,7 @@ void func_80A5A6B8(Actor* thisx, PlayState* play2) {
Matrix_Pop();
}
- if ((this->unk_E34 > 1.0f) && (this->actor.params != ENWATEREFFECT_30C)) {
+ if ((this->unk_E34 > 1.0f) && (this->actor.params != ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE)) {
func_8012C2DC(play->state.gfxCtx);
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E40));
Matrix_Scale(this->unk_DC8[3].y, this->unk_DC8[3].z, this->unk_DC8[3].y, MTXMODE_APPLY);
@@ -660,7 +672,8 @@ void func_80A5A6B8(Actor* thisx, PlayState* play2) {
Matrix_Pop();
- if ((this->actor.params == ENWATEREFFECT_309) || (this->actor.params == ENWATEREFFECT_30C)) {
+ if ((this->actor.params == ENWATEREFFECT_TYPE_GYORG_RIPPLES) ||
+ (this->actor.params == ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE)) {
func_8012C2DC(play->state.gfxCtx);
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_water_effect_Matanimheader_000E58));
Matrix_Scale(this->unk_DC8[4].y, this->unk_DC8[4].z, this->unk_DC8[4].y, MTXMODE_APPLY);
@@ -670,7 +683,7 @@ void func_80A5A6B8(Actor* thisx, PlayState* play2) {
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_000CD8);
}
- if (this->actor.params == ENWATEREFFECT_309) {
+ if (this->actor.params == ENWATEREFFECT_TYPE_GYORG_RIPPLES) {
func_8012C2DC(play->state.gfxCtx);
for (i = 0; i < ARRAY_COUNT(this->unk_144) / 2; i++, ptr++) {
@@ -678,7 +691,7 @@ void func_80A5A6B8(Actor* thisx, PlayState* play2) {
if (!phi_s4) {
func_8012C448(play->state.gfxCtx);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex));
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260);
phi_s4++;
diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h
index 35aebd83e..e4fb752dc 100644
--- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h
+++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h
@@ -18,13 +18,14 @@ typedef struct {
/* 0x3C */ s16 unk_3C;
} EnWaterEffectStruct; // size = 0x40
-enum {
- /* 0x001 */ ENWATEREFFECT_1 = 1,
- /* 0x309 */ ENWATEREFFECT_309 = 0x309,
- /* 0x30A */ ENWATEREFFECT_30A,
- /* 0x30B */ ENWATEREFFECT_30B,
- /* 0x30C */ ENWATEREFFECT_30C,
-};
+typedef enum {
+ /* 0x001 */ ENWATEREFFECT_TYPE_FALLING_ROCK_SPAWNER = 1, // Spawner for falling flaming rocks,
+ /* 0x0FF */ ENWATEREFFECT_TYPE_FALLING_WATER_SPAWNER = 0xFF, // Spawner for water dripping from the ceiling
+ /* 0x309 */ ENWATEREFFECT_TYPE_GYORG_RIPPLES = 0x309, // Ripples on the surface when Gyrog enters/leaves the water
+ /* 0x30A */ ENWATEREFFECT_TYPE_GYORG_PRIMARY_SPRAY, // Large "funnel" of water that forms when Gyorg enters/leaves the water
+ /* 0x30B */ ENWATEREFFECT_TYPE_GYORG_SECONDARY_SPRAY, // Secondary "funnel" in the middle of the larger "funnel"
+ /* 0x30C */ ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE, // Shockwave on the surface when Gyorg rams into the central platform
+} EnWaterEffectType;
typedef struct EnWaterEffect {
/* 0x000 */ Actor actor;
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 752447a5d..092c693f2 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
@@ -352,7 +352,7 @@ void func_80966FEC(EnWeatherTag* this, PlayState* play) {
}
// unique pirates fortress behavior?
- if ((play->sceneNum == SCENE_KAIZOKU) && (play->actorCtx.unk5 & 2)) {
+ if ((play->sceneNum == SCENE_KAIZOKU) && (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
EnWeatherTag_SetupAction(this, func_80967060);
}
}
@@ -482,9 +482,10 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) {
EnWeatherTag* this = THIS;
this->actionFunc(this, play);
- if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) &&
- (!FrameAdvance_IsEnabled(&play->state)) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
- (ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) {
+ 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->csCtx.state == 0)) {
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
if (REG(15) != 0) {
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 3098b9a6a..67faa1f3c 100644
--- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c
+++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c
@@ -364,7 +364,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) {
// Despawn extra trees in a group if out of range
if ((this->spawnType == WOOD_SPAWN_SPAWNED) && (thisx->parent != NULL)) {
- if (!(thisx->flags & 0x40) && (this->unk_151 != 2)) {
+ if (!(thisx->flags & ACTOR_FLAG_40) && (this->unk_151 != 2)) {
s32 index = this->unk_14A[0];
s32 phi_v0 = 0;
diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c
index cdf0447e6..1f3fae3ac 100644
--- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c
+++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c
@@ -1,7 +1,7 @@
/*
* File: z_item_inbox.c
* Overlay: ovl_Item_Inbox
- * Description:
+ * Description: Unused, can draw GetItem models. Perhaps intended to draw items inside chests.
*/
#include "z_item_inbox.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 2ce8f6ef3..ef1feb1a9 100644
--- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c
+++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c
@@ -545,7 +545,7 @@ void ObjComb_Update(Actor* thisx, PlayState* play) {
}
if (this->unk_1B7 != 0) {
- play->actorCtx.unk5 |= 8;
+ play->actorCtx.flags |= ACTORCTX_FLAG_3;
this->actor.flags |= ACTOR_FLAG_10;
}
}
diff --git a/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c b/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c
index cbbdf82ed..0c0177d2f 100644
--- a/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c
+++ b/src/overlays/actors/ovl_Obj_Dowsing/z_obj_dowsing.c
@@ -1,7 +1,7 @@
/*
* File: z_obj_dowsing.c
* Overlay: ovl_Obj_Dowsing
- * Description:
+ * Description: Rumbles controller if switch or collectible/chest flag is unset
*/
#include "z_obj_dowsing.h"
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 73c5e32c6..b699cd9af 100644
--- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c
+++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c
@@ -4,7 +4,6 @@
* Description: Breakable Pot With Grass
*/
-#include "prevent_bss_reordering.h"
#include "z_obj_flowerpot.h"
#include "objects/object_flowerpot/object_flowerpot.h"
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 bc1d353fd..cbe3cecfc 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
@@ -1,7 +1,7 @@
/*
* File: z_obj_kendo_kanban.c
* Overlay: ovl_Obj_Kendo_Kanban
- * Description: Swordsman's School - Cuttable Board
+ * Description: Swordsman's School - Cuttable Board at back of school
*/
#include "z_obj_kendo_kanban.h"
@@ -9,20 +9,40 @@
#define FLAGS 0x00000000
+// Board Fragment Flags: Identify which of the 4 quadrants of the board are present.
+#define OBJKENDOKANBAN_PART_FULL 0
+#define OBJKENDOKANBAN_PART_TOP_RIGHT (1 << 0)
+#define OBJKENDOKANBAN_PART_TOP_LEFT (1 << 1)
+#define OBJKENDOKANBAN_PART_BOTTOM_RIGHT (1 << 2)
+#define OBJKENDOKANBAN_PART_BOTTOM_LEFT (1 << 3)
+#define OBJKENDOKANBAN_RIGHT_HALF (OBJKENDOKANBAN_PART_TOP_RIGHT | OBJKENDOKANBAN_PART_BOTTOM_RIGHT)
+#define OBJKENDOKANBAN_LEFT_HALF (OBJKENDOKANBAN_PART_TOP_LEFT | OBJKENDOKANBAN_PART_BOTTOM_LEFT)
+#define OBJKENDOKANBAN_TOP_HALF (OBJKENDOKANBAN_PART_TOP_RIGHT | OBJKENDOKANBAN_PART_TOP_LEFT)
+#define OBJKENDOKANBAN_BOTTOM_HALF (OBJKENDOKANBAN_PART_BOTTOM_RIGHT | OBJKENDOKANBAN_PART_BOTTOM_LEFT)
+
+// Number of bounces the board takes before settling.
+#define MAX_BOUNCE_COUNT (7)
+
#define THIS ((ObjKendoKanban*)thisx)
+typedef enum {
+ /* -1 */ OBJKENDOKANBAN_DIR_DOWN = -1,
+ /* 0 */ OBJKENDOKANBAN_DIR_UNDETERMINED,
+ /* 1 */ OBJKENDOKANBAN_DIR_UP,
+} ObjKendoKanbanDirection;
+
void ObjKendoKanban_Init(Actor* thisx, PlayState* play);
void ObjKendoKanban_Destroy(Actor* thisx, PlayState* play);
void ObjKendoKanban_Update(Actor* thisx, PlayState* play);
void ObjKendoKanban_Draw(Actor* thisx, PlayState* play);
-void func_80B65880(ObjKendoKanban* this);
-void func_80B65894(ObjKendoKanban* this, PlayState* play);
-void func_80B658A4(ObjKendoKanban* this, PlayState* play);
-void func_80B65CE0(ObjKendoKanban* this, PlayState* play);
-void func_80B65D68(ObjKendoKanban* this, PlayState* play);
-void func_80B65DA8(ObjKendoKanban* this, PlayState* play);
-s32 func_80B6618C(ObjKendoKanban* this, PlayState* play);
+void ObjKendoKanban_SetupDoNothing(ObjKendoKanban* this);
+void ObjKendoKanban_DoNothing(ObjKendoKanban* this, PlayState* play);
+void ObjKendoKanban_SetupTumble(ObjKendoKanban* this, PlayState* play);
+void ObjKendoKanban_Tumble(ObjKendoKanban* this, PlayState* play);
+void ObjKendoKanban_Settled(ObjKendoKanban* this, PlayState* play);
+void ObjKendoKanban_HandlePhysics(ObjKendoKanban* this, PlayState* play);
+s32 ObjKendoKanban_IsPlayerOnTop(ObjKendoKanban* this, PlayState* play);
const ActorInit Obj_Kendo_Kanban_InitVars = {
ACTOR_OBJ_KENDO_KANBAN,
@@ -36,29 +56,36 @@ const ActorInit Obj_Kendo_Kanban_InitVars = {
(ActorFunc)ObjKendoKanban_Draw,
};
-Vec3f D_80B66660 = { -1.5f, 10.0f, 0.5f };
-Vec3f D_80B6666C = { 1.5f, 10.0f, 0.5f };
-Vec3f D_80B66678 = { 0.0f, 4.0f, -1.0f };
-Vec3f D_80B66684 = { 1.0f, 7.0f, 4.0f };
-Vec3f D_80B66690 = { -150.0f, 425.0f, 40.0f };
-Vec3f D_80B6669C = { 150.0f, 425.0f, 40.0f };
-Vec3f D_80B666A8 = { 0.0f, 140.0f, 40.0f };
-Vec3f D_80B666B4 = { 0.0f, 565.0f, 40.0f };
+// Directly applied to the velocity of the actor upon object creation.
+static Vec3f sVelocityLeftHalf = { -1.5f, 10.0f, 0.5f }; // Push Left/Up/Forward (Left side Breakaway)
+static Vec3f sVelocityRightHalf = { 1.5f, 10.0f, 0.5f }; // Push Right/Up/Forward (Right side Breakaway)
+static Vec3f sVelocityBottomHalf = { 0.0f, 4.0f, -1.0f }; // Push _/Up/Back (Bottom Breakaway)
+static Vec3f sVelocityTopHalf = { 1.0f, 7.0f, 4.0f }; // Push Right/Up/Forward (Top Breakaway)
-Gfx* D_80B666C0 = gKendoKanbanTopRightDL;
-Gfx* D_80B666C4 = gKendoKanbanTopLeftDL;
-Gfx* D_80B666C8 = gKendoKanbanBottomRightDL;
-Gfx* D_80B666CC = gKendoKanbanBottomLeftDL;
+// Centerpoint of the piece
+static Vec3f sCenterPointLeftHalf = { -150.0f, 425.0f, 40.0f };
+static Vec3f sCenterPointRightHalf = { 150.0f, 425.0f, 40.0f };
+static Vec3f sCenterPointBottomHalf = { 0.0f, 140.0f, 40.0f };
+static Vec3f sCenterPointTopHalf = { 0.0f, 565.0f, 40.0f };
-Vec3f D_80B666D0 = { -300.0f, 850.0f, 40.0f };
-Vec3f D_80B666DC = { 10.0f, 850.0f, 40.0f };
-Vec3f D_80B666E8 = { 300.0f, 850.0f, 40.0f };
-Vec3f D_80B666F4 = { -300.0f, 310.0f, 40.0f };
-Vec3f D_80B66700 = { 0.0f, 280.0f, 40.0f };
-Vec3f D_80B6670C = { 300.0f, 250.0f, 40.0f };
-Vec3f D_80B66718 = { -300.0f, 10.0f, 40.0f };
-Vec3f D_80B66724 = { 0.0f, 10.0f, 40.0f };
-Vec3f D_80B66730 = { 300.0f, 10.0f, 40.0f };
+// Displaylists for the 4 pieces.
+static Gfx* sDisplayLists[] = {
+ gKendoKanbanTopRightDL,
+ gKendoKanbanTopLeftDL,
+ gKendoKanbanBottomRightDL,
+ gKendoKanbanBottomLeftDL,
+};
+
+// Coordinates on the object face upon which the board can break
+static Vec3f sPointTL = { -300.0f, 850.0f, 40.0f };
+static Vec3f sPointTC = { 10.0f, 850.0f, 40.0f };
+static Vec3f sPointTR = { 300.0f, 850.0f, 40.0f };
+static Vec3f sPointCL = { -300.0f, 310.0f, 40.0f };
+static Vec3f sPointCC = { 0.0f, 280.0f, 40.0f }; // Unused
+static Vec3f sPointCR = { 300.0f, 250.0f, 40.0f };
+static Vec3f sPointBL = { -300.0f, 10.0f, 40.0f };
+static Vec3f sPointBC = { 0.0f, 10.0f, 40.0f };
+static Vec3f sPointBR = { 300.0f, 10.0f, 40.0f };
static ColliderTrisElementInit sTrisElementsInit[] = {
{
@@ -155,13 +182,13 @@ static DamageTable sDamageTable = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 8, 0, 0, 0, MASS_HEAVY };
-Vec3f D_80B6681C = { 0.0f, 0.0f, 0.0f };
-Vec3f D_80B66828 = { 1.0f, 0.0f, 0.0f };
+static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
+static Vec3f sUnitVecX = { 1.0f, 0.0f, 0.0f };
void ObjKendoKanban_Init(Actor* thisx, PlayState* play) {
s32 pad[2];
ObjKendoKanban* this = THIS;
- Vec3f sp70[3];
+ Vec3f vertices[3];
s32 i;
s32 j;
@@ -178,35 +205,35 @@ void ObjKendoKanban_Init(Actor* thisx, PlayState* play) {
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
for (i = 0; i < ARRAY_COUNT(this->colliderTrisElements); i++) {
- for (j = 0; j < ARRAY_COUNT(sp70); j++) {
- Matrix_MultVec3f(&sTrisElementsInit[i].dim.vtx[j], &sp70[j]);
+ for (j = 0; j < ARRAY_COUNT(vertices); j++) {
+ Matrix_MultVec3f(&sTrisElementsInit[i].dim.vtx[j], &vertices[j]);
}
- Collider_SetTrisVertices(&this->colliderTris, i, &sp70[0], &sp70[1], &sp70[2]);
+ Collider_SetTrisVertices(&this->colliderTris, i, &vertices[0], &vertices[1], &vertices[2]);
}
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4);
- this->unk_30C = OBJKENDOKANBAN_GET_F(&this->actor);
+ this->boardFragments = OBJKENDOKANBAN_GET_BOARD_FRAGMENTS(&this->actor);
this->actor.gravity = -2.0f;
- this->unk_2CC = D_80B6681C;
- this->unk_2D8 = D_80B6681C;
- this->unk_2E4 = D_80B6681C;
- this->unk_2F0 = D_80B66828;
- this->unk_302 = 0;
- this->unk_304 = 0;
- this->unk_2FC = -1;
- this->unk_300 = 0;
- this->unk_308 = 0;
+ this->centerPoint = sZeroVec;
+ this->centerPos = sZeroVec;
+ this->rootCornerPos = sZeroVec;
+ this->rotAxis = sUnitVecX;
+ this->rotAngle = 0;
+ this->rotVelocity = 0;
+ this->indexLastRootCornerPos = -1;
+ this->hasNewRootCornerPos = false;
+ this->numBounces = 0;
- for (i = 0; i < ARRAY_COUNT(this->unk_26C); i++) {
- this->unk_26C[i] = this->unk_29C[i] = D_80B6681C;
+ for (i = 0; i < ARRAY_COUNT(this->cornerPos); i++) {
+ this->cornerPos[i] = this->cornerPoints[i] = sZeroVec;
}
this->unk_30A = 0;
- if (this->unk_30C == OBJKENDOKANBAN_F_0) {
- func_80B65880(this);
+ if (this->boardFragments == OBJKENDOKANBAN_PART_FULL) {
+ ObjKendoKanban_SetupDoNothing(this);
} else {
- func_80B658A4(this, play);
+ ObjKendoKanban_SetupTumble(this, play);
}
}
@@ -217,135 +244,138 @@ void ObjKendoKanban_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyTris(play, &this->colliderTris);
}
-void func_80B65880(ObjKendoKanban* this) {
- this->actionFunc = func_80B65894;
+void ObjKendoKanban_SetupDoNothing(ObjKendoKanban* this) {
+ this->actionFunc = ObjKendoKanban_DoNothing;
}
-void func_80B65894(ObjKendoKanban* this, PlayState* play) {
+void ObjKendoKanban_DoNothing(ObjKendoKanban* this, PlayState* play) {
}
-void func_80B658A4(ObjKendoKanban* this, PlayState* play) {
+void ObjKendoKanban_SetupTumble(ObjKendoKanban* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- if (this->unk_30C == OBJKENDOKANBAN_F_0) {
+ if (this->boardFragments == OBJKENDOKANBAN_PART_FULL) {
if ((player->meleeWeaponAnimation == PLAYER_MWA_FORWARD_SLASH_1H) ||
(player->meleeWeaponAnimation == PLAYER_MWA_FORWARD_SLASH_2H) ||
(player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_FINISH)) {
- this->unk_30C = (OBJKENDOKANBAN_F_4 | OBJKENDOKANBAN_F_1);
- this->unk_304 = 0x71C;
- this->actor.velocity = D_80B6666C;
- this->unk_2CC = D_80B6669C;
+
+ // Vertical cuts initialize the right half, spawn the left half.
+ this->boardFragments = OBJKENDOKANBAN_RIGHT_HALF;
+ this->rotVelocity = 0x71C; // 10 degrees
+ this->actor.velocity = sVelocityRightHalf;
+ this->centerPoint = sCenterPointRightHalf;
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_KENDO_KANBAN,
this->actor.home.pos.x - 5.0f, this->actor.home.pos.y, this->actor.home.pos.z, 0, 0, 0,
- 0xA);
+ OBJKENDOKANBAN_LEFT_HALF);
- this->unk_29C[0] = D_80B666DC;
- this->unk_29C[1] = D_80B666E8;
- this->unk_29C[2] = D_80B66730;
- this->unk_29C[3] = D_80B66724;
+ this->cornerPoints[0] = sPointTC;
+ this->cornerPoints[1] = sPointTR;
+ this->cornerPoints[2] = sPointBR;
+ this->cornerPoints[3] = sPointBC;
} else {
- this->unk_30C = (OBJKENDOKANBAN_F_8 | OBJKENDOKANBAN_F_4);
- this->unk_304 = -0x71C;
- this->actor.velocity = D_80B66678;
- this->unk_2CC = D_80B666A8;
+ // Horizontal cuts initialize the bottom half, spawn the top half.
+ this->boardFragments = OBJKENDOKANBAN_BOTTOM_HALF;
+ this->rotVelocity = -0x71C; // -10 degrees
+ this->actor.velocity = sVelocityBottomHalf;
+ this->centerPoint = sCenterPointBottomHalf;
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_OBJ_KENDO_KANBAN, this->actor.home.pos.x,
- this->actor.home.pos.y + 5.0f, this->actor.home.pos.z, 0, 0, 0, 3);
+ this->actor.home.pos.y + 5.0f, this->actor.home.pos.z, 0, 0, 0, OBJKENDOKANBAN_TOP_HALF);
- this->unk_29C[0] = D_80B666F4;
- this->unk_29C[1] = D_80B6670C;
- this->unk_29C[2] = D_80B66730;
- this->unk_29C[3] = D_80B66718;
+ this->cornerPoints[0] = sPointCL;
+ this->cornerPoints[1] = sPointCR;
+ this->cornerPoints[2] = sPointBR;
+ this->cornerPoints[3] = sPointBL;
}
- } else if (this->unk_30C == (OBJKENDOKANBAN_F_8 | OBJKENDOKANBAN_F_2)) {
- this->unk_304 = 0x71C;
- this->actor.velocity = D_80B66660;
- this->unk_2CC = D_80B66690;
+ } else if (this->boardFragments == OBJKENDOKANBAN_LEFT_HALF) {
+ // Initialize the newly spawned left half
+ this->rotVelocity = 0x71C; // 10 degrees
+ this->actor.velocity = sVelocityLeftHalf;
+ this->centerPoint = sCenterPointLeftHalf;
- this->unk_29C[0] = D_80B666D0;
- this->unk_29C[1] = D_80B666DC;
- this->unk_29C[2] = D_80B66724;
- this->unk_29C[3] = D_80B66718;
- } else if (this->unk_30C == (OBJKENDOKANBAN_F_2 | OBJKENDOKANBAN_F_1)) {
- this->unk_304 = 0x71C;
- this->actor.velocity = D_80B66684;
- this->unk_2CC = D_80B666B4;
+ this->cornerPoints[0] = sPointTL;
+ this->cornerPoints[1] = sPointTC;
+ this->cornerPoints[2] = sPointBC;
+ this->cornerPoints[3] = sPointBL;
+ } else if (this->boardFragments == OBJKENDOKANBAN_TOP_HALF) {
+ // Initialize the newly spawned top half
+ this->rotVelocity = 0x71C; // 10 degrees
+ this->actor.velocity = sVelocityTopHalf;
+ this->centerPoint = sCenterPointTopHalf;
- this->unk_29C[0] = D_80B666D0;
- this->unk_29C[1] = D_80B666E8;
- this->unk_29C[2] = D_80B6670C;
- this->unk_29C[3] = D_80B666F4;
+ this->cornerPoints[0] = sPointTL;
+ this->cornerPoints[1] = sPointTR;
+ this->cornerPoints[2] = sPointCR;
+ this->cornerPoints[3] = sPointCL;
}
this->unk_30A = 0;
- this->actionFunc = func_80B65CE0;
+ this->actionFunc = ObjKendoKanban_Tumble;
}
-void func_80B65CE0(ObjKendoKanban* this, PlayState* play) {
+void ObjKendoKanban_Tumble(ObjKendoKanban* this, PlayState* play) {
this->actor.velocity.y += this->actor.gravity;
Actor_UpdatePos(&this->actor);
- this->unk_302 += this->unk_304;
- func_80B65DA8(this, play);
+ this->rotAngle += this->rotVelocity;
+ ObjKendoKanban_HandlePhysics(this, play);
if (this->actor.world.pos.y < -200.0f) {
this->actor.world.pos.y = -200.0f;
}
}
-void func_80B65D54(ObjKendoKanban* this) {
- this->actionFunc = func_80B65D68;
+void ObjKendoKanban_SetupSettled(ObjKendoKanban* this) {
+ this->actionFunc = ObjKendoKanban_Settled;
}
-void func_80B65D68(ObjKendoKanban* this, PlayState* play) {
+void ObjKendoKanban_Settled(ObjKendoKanban* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- if (func_80B6618C(this, play) == 1) {
+ if (ObjKendoKanban_IsPlayerOnTop(this, play) == true) {
player->unk_AC0 = 700.0f;
}
}
-void func_80B65DA8(ObjKendoKanban* this, PlayState* play) {
- Vec3f sp5C;
+void ObjKendoKanban_HandlePhysics(ObjKendoKanban* this, PlayState* play) {
+ Vec3f rootCornerPos = this->cornerPos[0];
s32 pad[2];
- Vec3f sp48;
+ Vec3f vecCenterOut = this->actor.world.pos;
s32 pad2;
- s32 index = 0;
+ s32 indexRootCornerPos = 0;
s32 i;
- f32 sp38;
+ f32 verticalScalar;
- sp5C = this->unk_26C[0];
- sp48 = this->actor.world.pos;
-
- sp48.x -= this->unk_2D8.x;
- sp48.y -= this->unk_2D8.y;
- sp48.z -= this->unk_2D8.z;
-
- sp38 = (this->unk_2F0.x * sp48.z) + (this->unk_2F0.z * -sp48.x);
-
- if (sp38 < 0.0f) {
- this->unk_304 += 0x64;
+ // Calculate an affect on the rotation from gravity.
+ vecCenterOut.x -= this->centerPos.x;
+ vecCenterOut.y -= this->centerPos.y;
+ vecCenterOut.z -= this->centerPos.z;
+ verticalScalar = (this->rotAxis.x * vecCenterOut.z) + (this->rotAxis.z * -vecCenterOut.x);
+ if (verticalScalar < 0.0f) {
+ this->rotVelocity += 0x64;
} else {
- this->unk_304 -= 0x64;
+ this->rotVelocity -= 0x64;
}
- for (i = 0; i < ARRAY_COUNT(this->unk_26C); i++) {
- if (this->unk_26C[i].y < sp5C.y) {
- sp5C = this->unk_26C[i];
- index = i;
+ // Find the lowest point
+ for (i = 0; i < ARRAY_COUNT(this->cornerPos); i++) {
+ if (this->cornerPos[i].y < rootCornerPos.y) {
+ rootCornerPos = this->cornerPos[i];
+ indexRootCornerPos = i;
}
}
- if (index != this->unk_2FC) {
- this->unk_300 = 1;
- this->unk_2FC = index;
- this->unk_2E4 = this->unk_29C[index];
+ // When the lowest point changes, re-initialize the actor position to that point
+ if (indexRootCornerPos != this->indexLastRootCornerPos) {
+ this->hasNewRootCornerPos = true;
+ this->indexLastRootCornerPos = indexRootCornerPos;
+ this->rootCornerPos = this->cornerPoints[indexRootCornerPos];
Matrix_Push();
Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
&this->actor.shape.rot);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
- Matrix_MultVec3f(&this->unk_2E4, &this->actor.world.pos);
- this->actor.world.pos = sp5C;
+ Matrix_MultVec3f(&this->rootCornerPos, &this->actor.world.pos);
+ this->actor.world.pos = rootCornerPos;
this->actor.prevPos = this->actor.world.pos;
Matrix_Pop();
}
@@ -353,102 +383,105 @@ void func_80B65DA8(ObjKendoKanban* this, PlayState* play) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4);
if (this->actor.bgCheckFlags & 1) {
+ // When on the ground, apply some friction.
this->actor.velocity.x *= 0.8f;
this->actor.velocity.z *= 0.8f;
}
- if (this->unk_300 == 1) {
- if (this->unk_308 >= 7) {
- s16 temp_v0_3 = this->unk_302 & 0x3FFF;
+ if (this->hasNewRootCornerPos == true) {
+ if (this->numBounces >= MAX_BOUNCE_COUNT) {
+ s16 deltaRotAngle = this->rotAngle & 0x3FFF;
- if (temp_v0_3 >= 0x2000) {
- temp_v0_3 -= 0x4000;
+ if (deltaRotAngle >= 0x2000) { // 45 degrees
+ deltaRotAngle -= 0x4000; // 90 degrees
}
- this->unk_302 -= temp_v0_3;
- this->unk_304 = 0;
- func_80B65D54(this);
+ this->rotAngle -= deltaRotAngle;
+ this->rotVelocity = 0;
+ ObjKendoKanban_SetupSettled(this);
return;
}
if (this->actor.bgCheckFlags & 2) {
+ // Upon touching the ground...
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WOODPLATE_BOUND);
- this->unk_300 = 0;
+ this->hasNewRootCornerPos = false;
this->actor.velocity.y *= 0.5f;
} else if (this->actor.bgCheckFlags & 1) {
- this->unk_308++;
- this->unk_300 = 0;
+ // When on the ground...
+ this->numBounces++;
+ this->hasNewRootCornerPos = false;
this->actor.velocity.x *= 0.3f;
this->actor.velocity.z *= 0.3f;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WOODPLATE_BOUND);
- if (sp38 > 0.0f) {
- if (this->unk_304 > 0) {
- this->unk_304 *= 1.2f;
+ // Adjust and (potentially) reverse rotation depending on the current
+ // facing of the board and the direction in which it is rotating.
+ if (verticalScalar > 0.0f) {
+ if (this->rotVelocity > 0) {
+ this->rotVelocity *= 1.2f;
} else {
- this->unk_304 *= -0.6f;
+ this->rotVelocity *= -0.6f;
}
- } else if (this->unk_304 < 0) {
- this->unk_304 *= 1.2f;
} else {
- this->unk_304 *= -0.6f;
+ if (this->rotVelocity < 0) {
+ this->rotVelocity *= 1.2f;
+ } else {
+ this->rotVelocity *= -0.6f;
+ }
}
}
}
}
-s32 func_80B6618C(ObjKendoKanban* this, PlayState* play) {
+s32 ObjKendoKanban_IsPlayerOnTop(ObjKendoKanban* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- s32 phi_v0;
- s32 phi_v1 = 0;
s32 i;
- f32 x;
- f32 z;
- f32 x2;
- f32 z2;
+ s32 j;
+ Vec2f playerToCornerA;
+ Vec2f playerToCornerB;
+ s32 priorDir = OBJKENDOKANBAN_DIR_UNDETERMINED;
- for (i = 0; i < ARRAY_COUNT(this->unk_26C); i++) {
- if (i != 3) {
- phi_v0 = i + 1;
- } else {
- phi_v0 = 0;
- }
+ for (i = 0; i < ARRAY_COUNT(this->cornerPos); i++) {
+ j = (i != 3) ? (i + 1) : 0;
- z = this->unk_26C[i].z - player->actor.world.pos.z;
- x = this->unk_26C[i].x - player->actor.world.pos.x;
-
- z2 = (this->unk_26C[phi_v0].z - player->actor.world.pos.z);
- x2 = (this->unk_26C[phi_v0].x - player->actor.world.pos.x);
-
- if ((x * z2) < (z * x2)) {
- if (phi_v1 == 0) {
- phi_v1 = 1;
- } else if (phi_v1 != 1) {
+ // For each pair of points (moving clockwise around the shape), verify that the normal
+ // vector's magnitute is in the same direction. This condition being true means
+ // the player is within the bounds of the four cornerPoints.
+ playerToCornerA.z = this->cornerPos[i].z - player->actor.world.pos.z;
+ playerToCornerA.x = this->cornerPos[i].x - player->actor.world.pos.x;
+ playerToCornerB.z = this->cornerPos[j].z - player->actor.world.pos.z;
+ playerToCornerB.x = this->cornerPos[j].x - player->actor.world.pos.x;
+ if ((playerToCornerA.x * playerToCornerB.z) < (playerToCornerA.z * playerToCornerB.x)) {
+ if (priorDir == OBJKENDOKANBAN_DIR_UNDETERMINED) {
+ priorDir = OBJKENDOKANBAN_DIR_UP;
+ } else if (priorDir != OBJKENDOKANBAN_DIR_UP) {
+ return false;
+ }
+ } else {
+ if (priorDir == OBJKENDOKANBAN_DIR_UNDETERMINED) {
+ priorDir = OBJKENDOKANBAN_DIR_DOWN;
+ } else if (priorDir != OBJKENDOKANBAN_DIR_DOWN) {
return false;
}
- } else if (phi_v1 == 0) {
- phi_v1 = -1;
- } else if (phi_v1 != -1) {
- return false;
}
}
return true;
}
-void func_80B66304(ObjKendoKanban* this, PlayState* play) {
- if ((this->actionFunc != func_80B65CE0) && (this->actionFunc != func_80B65D68)) {
+void ObjKendoKanban_UpdateCollision(ObjKendoKanban* this, PlayState* play) {
+ if ((this->actionFunc != ObjKendoKanban_Tumble) && (this->actionFunc != ObjKendoKanban_Settled)) {
if (this->colliderTris.base.acFlags & AC_HIT) {
this->colliderTris.base.acFlags &= ~AC_HIT;
- func_80B658A4(this, play);
+ ObjKendoKanban_SetupTumble(this, play);
}
Collider_UpdateCylinder(&this->actor, &this->colliderCylinder);
this->colliderCylinder.dim.pos.z -= (s16)(20.0f * Math_CosS(this->actor.shape.rot.y));
this->colliderCylinder.dim.pos.x -= (s16)(20.0f * Math_SinS(this->actor.shape.rot.y));
- if (this->actionFunc == func_80B65894) {
+ if (this->actionFunc == ObjKendoKanban_DoNothing) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base);
}
-
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base);
}
}
@@ -457,54 +490,38 @@ void ObjKendoKanban_Update(Actor* thisx, PlayState* play) {
ObjKendoKanban* this = THIS;
this->actionFunc(this, play);
-
- func_80B66304(this, play);
+ ObjKendoKanban_UpdateCollision(this, play);
}
-#ifdef NON_MATCHING
void ObjKendoKanban_Draw(Actor* thisx, PlayState* play) {
ObjKendoKanban* this = THIS;
s32 i;
- Gfx* poly;
OPEN_DISPS(play->state.gfxCtx);
func_8012C28C(play->state.gfxCtx);
- if (this->unk_30C == OBJKENDOKANBAN_F_0) {
+ if (this->boardFragments == OBJKENDOKANBAN_PART_FULL) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gKendoKanbanDL);
} else {
- Matrix_RotateAxisS(this->unk_302, &this->unk_2F0, MTXMODE_APPLY);
- Matrix_Translate(-this->unk_2E4.x, -this->unk_2E4.y, -this->unk_2E4.z, MTXMODE_APPLY);
-
+ Matrix_RotateAxisS(this->rotAngle, &this->rotAxis, MTXMODE_APPLY);
+ Matrix_Translate(-this->rootCornerPos.x, -this->rootCornerPos.y, -this->rootCornerPos.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- if (this->unk_30C & OBJKENDOKANBAN_F_1) {
- gSPDisplayList(POLY_OPA_DISP++, D_80B666C0);
- }
-
- if (this->unk_30C & OBJKENDOKANBAN_F_2) {
- gSPDisplayList(POLY_OPA_DISP++, D_80B666C4);
- }
-
- if (this->unk_30C & OBJKENDOKANBAN_F_4) {
- gSPDisplayList(POLY_OPA_DISP++, D_80B666C8);
- }
-
- if (this->unk_30C & OBJKENDOKANBAN_F_8) {
- gSPDisplayList(POLY_OPA_DISP++, D_80B666CC);
+ // Display only the fragments of the board which are present
+ for (i = 0; i < ARRAY_COUNT(sDisplayLists); i++) {
+ if ((1 << i) & this->boardFragments) {
+ gSPDisplayList(POLY_OPA_DISP++, sDisplayLists[i]);
+ }
}
}
CLOSE_DISPS(play->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->unk_26C); i++) {
- Matrix_MultVec3f(&this->unk_29C[i], &this->unk_26C[i]);
+ // Update the alternate position trackers (Corners and Center of the board)
+ for (i = 0; i < ARRAY_COUNT(this->cornerPos); i++) {
+ Matrix_MultVec3f(&this->cornerPoints[i], &this->cornerPos[i]);
}
-
- Matrix_MultVec3f(&this->unk_2CC, &this->unk_2D8);
+ Matrix_MultVec3f(&this->centerPoint, &this->centerPos);
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Kendo_Kanban/ObjKendoKanban_Draw.s")
-#endif
diff --git a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h
index 8526f4976..9d01b63fc 100644
--- a/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h
+++ b/src/overlays/actors/ovl_Obj_Kendo_Kanban/z_obj_kendo_kanban.h
@@ -7,13 +7,7 @@ struct ObjKendoKanban;
typedef void (*ObjKendoKanbanActionFunc)(struct ObjKendoKanban*, PlayState*);
-#define OBJKENDOKANBAN_GET_F(thisx) ((thisx)->params & 0xF)
-
-#define OBJKENDOKANBAN_F_0 0
-#define OBJKENDOKANBAN_F_1 (1 << 0)
-#define OBJKENDOKANBAN_F_2 (1 << 1)
-#define OBJKENDOKANBAN_F_4 (1 << 2)
-#define OBJKENDOKANBAN_F_8 (1 << 3)
+#define OBJKENDOKANBAN_GET_BOARD_FRAGMENTS(thisx) ((thisx)->params & 0xF)
typedef struct ObjKendoKanban {
/* 0x000 */ Actor actor;
@@ -21,20 +15,20 @@ typedef struct ObjKendoKanban {
/* 0x190 */ ColliderTris colliderTris;
/* 0x1B0 */ ColliderTrisElement colliderTrisElements[2];
/* 0x268 */ ObjKendoKanbanActionFunc actionFunc;
- /* 0x26C */ Vec3f unk_26C[4];
- /* 0x29C */ Vec3f unk_29C[4];
- /* 0x2CC */ Vec3f unk_2CC;
- /* 0x2D8 */ Vec3f unk_2D8;
- /* 0x2E4 */ Vec3f unk_2E4;
- /* 0x2F0 */ Vec3f unk_2F0;
- /* 0x2FC */ s32 unk_2FC;
- /* 0x300 */ s16 unk_300;
- /* 0x302 */ s16 unk_302;
- /* 0x304 */ s16 unk_304;
+ /* 0x26C */ Vec3f cornerPos[4];
+ /* 0x29C */ Vec3f cornerPoints[4];
+ /* 0x2CC */ Vec3f centerPoint;
+ /* 0x2D8 */ Vec3f centerPos;
+ /* 0x2E4 */ Vec3f rootCornerPos;
+ /* 0x2F0 */ Vec3f rotAxis;
+ /* 0x2FC */ s32 indexLastRootCornerPos;
+ /* 0x300 */ s16 hasNewRootCornerPos;
+ /* 0x302 */ s16 rotAngle;
+ /* 0x304 */ s16 rotVelocity;
/* 0x306 */ UNK_TYPE1 pad306[2];
- /* 0x308 */ s16 unk_308;
+ /* 0x308 */ s16 numBounces;
/* 0x30A */ s16 unk_30A;
- /* 0x30C */ u8 unk_30C;
+ /* 0x30C */ u8 boardFragments;
} ObjKendoKanban; // size = 0x310
extern const ActorInit Obj_Kendo_Kanban_InitVars;
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 fcbdfbad4..d32e7a2cd 100644
--- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c
+++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c
@@ -228,7 +228,7 @@ void ObjKibako2_Update(Actor* thisx, PlayState* play) {
ObjKibako2* this = THIS;
if (this->unk_1AC != 0) {
- play->actorCtx.unk5 |= 8;
+ play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
if (this->skulltulaNoiseTimer >= 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 681faf3c1..4c56bb794 100644
--- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c
+++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c
@@ -164,14 +164,14 @@ void func_80BA2790(ObjNozoki* this) {
}
void func_80BA27C4(ObjNozoki* this, PlayState* play) {
- if (!(play->actorCtx.unk5 & 0x20)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_5)) {
if (OBJNOZOKI_GET_200(&this->dyna.actor)) {
if (!func_80BA2708(this, play)) {
return;
}
} else {
if (D_80BA36B0 != 0) {
- play->actorCtx.unk5 |= 0x80;
+ play->actorCtx.flags |= ACTORCTX_FLAG_7;
}
if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) {
@@ -189,7 +189,7 @@ void func_80BA27C4(ObjNozoki* this, PlayState* play) {
if (this->unk_15E < 0) {
this->unk_15E = 50;
}
- play->actorCtx.unk5 |= 0x10;
+ play->actorCtx.flags |= ACTORCTX_FLAG_4;
}
}
GET_PLAYER(play)->linearVelocity = 0.0f;
@@ -204,7 +204,7 @@ void func_80BA28DC(ObjNozoki* this, PlayState* play) {
return;
}
- if (!(play->actorCtx.unk5 & 0x20)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_5)) {
Math_StepToF(&this->dyna.actor.velocity.y, 15.0f, 3.0f);
Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y);
@@ -250,7 +250,7 @@ void func_80BA2AB4(ObjNozoki* this, PlayState* play) {
D_80BA36B0 = 1;
}
- if (!(play->actorCtx.unk5 & 0x20)) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_5)) {
if (!(OBJNOZOKI_GET_200(&this->dyna.actor)) &&
Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) {
func_80BA2790(this);
@@ -316,7 +316,7 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) {
Math_StepToF(&this->dyna.actor.speedXZ, D_80BA34E4[this->unk_15D], 0.1f);
- if ((play->actorCtx.unk5 & 0x40) || (play->actorCtx.unk5 & 0x20)) {
+ if ((play->actorCtx.flags & ACTORCTX_FLAG_6) || (play->actorCtx.flags & ACTORCTX_FLAG_5)) {
temp_f0 = 0.5f;
} else {
temp_f0 = this->dyna.actor.speedXZ;
@@ -326,20 +326,20 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) {
D_80BA36B8 += this->dyna.actor.speedXZ;
- if (play->actorCtx.unk5 & 0x40) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_6) {
if (sp34 <= 5.0f) {
Actor_MarkForDeath(&this->dyna.actor);
}
- } else if (!(play->actorCtx.unk5 & 0x20) && (GET_PLAYER(play)->actor.id == ACTOR_PLAYER) &&
+ } else if (!(play->actorCtx.flags & ACTORCTX_FLAG_5) && (GET_PLAYER(play)->actor.id == ACTOR_PLAYER) &&
Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG2(&this->dyna.actor)) && (sp38 < 20.0f)) {
static Vec3f D_80BA34F0 = { 0.0f, 0.0f, 50.0f };
- play->actorCtx.unk5 |= 0x40;
+ play->actorCtx.flags |= ACTORCTX_FLAG_6;
Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.home.pos, this->dyna.actor.shape.rot.y, &D_80BA34F0,
&this->dyna.actor.world.pos);
this->dyna.actor.shape.rot.x = -0x1F40;
} else if (sp34 < 50.0f) {
- play->actorCtx.unk5 |= 0x20;
+ play->actorCtx.flags |= ACTORCTX_FLAG_5;
if (sp34 < 20.0f) {
this->dyna.actor.velocity.y -= 0.4f;
@@ -369,11 +369,11 @@ void func_80BA3044(ObjNozoki* this, PlayState* play) {
Vec3f* sp1C = &this->dyna.actor.focus.pos;
if (this->unk_15D == 0) {
- if (play->actorCtx.unk5 & 0x40) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_6) {
this->unk_15D = 1;
this->unk_15E = 20;
Math_Vec3f_Copy(&this->dyna.actor.world.pos, sp1C);
- } else if (!(play->actorCtx.unk5 & 0x20) &&
+ } else if (!(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) {
sp1C = &this->dyna.actor.home.pos;
}
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 801cfc3ce..02743db29 100644
--- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c
+++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c
@@ -296,7 +296,7 @@ void ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(ObjSwitch* this, PlayState* pla
s16 yaw;
f32 cos;
- if (play->actorCtx.unk5 & 0x80) {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_7) {
player = GET_PLAYER(play);
// compute yawTowardsPlayer relative to model space
yaw = BINANG_SUB(this->dyna.actor.yawTowardsPlayer, this->dyna.actor.shape.rot.y);
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 9aadc668c..c7aa4549d 100644
--- a/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c
+++ b/src/overlays/actors/ovl_Obj_Taru/z_obj_taru.c
@@ -310,7 +310,7 @@ void ObjTaru_Update(Actor* thisx, PlayState* play) {
if (!OBJ_TARU_GET_80(thisx)) {
if (this->unk_1AC != 0) {
- play->actorCtx.unk5 |= 8;
+ play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
if (this->unk_1AD >= 0) {
switch (this->unk_1AD) {
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 79b2e577e..74c121656 100644
--- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
+++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
@@ -701,7 +701,7 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) {
this->clockTime += 3;
this->actor.draw = ObjTokeidai_Clock_Draw;
} else {
- if (!(play->actorCtx.unk5 & 2) &&
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD &&
ActorCutscene_GetCurrentIndex() == -1) {
this->actor.draw = NULL;
@@ -734,9 +734,9 @@ void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, PlayState* play) {
this->clockTime += 3;
this->actor.draw = ObjTokeidai_ExteriorGear_Draw;
} else {
- if ((play->actorCtx.unk5 & 2) == 0 &&
- OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_TERMINA_FIELD &&
- ActorCutscene_GetCurrentIndex() == -1) {
+ if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
+ (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_TERMINA_FIELD) &&
+ (ActorCutscene_GetCurrentIndex() == -1)) {
this->actor.draw = NULL;
}
this->clockTime = gSaveContext.save.time;
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 c2cc74a82..acba9ec31 100644
--- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c
+++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c
@@ -665,7 +665,7 @@ void ObjTsubo_Update(Actor* thisx, PlayState* play) {
}
if (!this->unk_197) {
if (this->unk_198) {
- play->actorCtx.unk5 |= 8;
+ play->actorCtx.flags |= ACTORCTX_FLAG_3;
this->actor.flags |= ACTOR_FLAG_10;
}
if (this->unk_19A >= 0) {
diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c
index 0247cd23a..4057ff817 100644
--- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c
+++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c
@@ -554,7 +554,7 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) {
gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2);
gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust5Tex));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust5Tex));
}
Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW);
@@ -569,7 +569,7 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) {
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
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_023130);
+ gSPDisplayList(POLY_XLU_DISP++, gEffDustDL);
}
}
@@ -629,14 +629,14 @@ void func_808DD970(Actor* thisx, PlayState* play2) {
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust5Tex));
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust5Tex));
gSPClearGeometryMode(POLY_XLU_DISP++, G_LIGHTING);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2);
gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG);
- gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023130);
+ gSPDisplayList(POLY_XLU_DISP++, gEffDustDL);
}
}
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 bb4cada88..93353f28c 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
@@ -1,27 +1,90 @@
/*
* File: z_eff_ss_blast.c
* Overlay: ovl_Effect_Ss_Blast
- * Description:
+ * Description: Shockwave Effect
*/
#include "z_eff_ss_blast.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
+#define rPrimColorR regs[0]
+#define rPrimColorG regs[1]
+#define rPrimColorB regs[2]
+#define rPrimColorA regs[3]
+#define rEnvColorR regs[4]
+#define rEnvColorG regs[5]
+#define rEnvColorB regs[6]
+#define rEnvColorA regs[7]
+#define rAlphaStep regs[8]
+#define rScale regs[9]
+#define rScaleStep regs[10]
+#define rScaleStepDecay regs[11]
#define PARAMS ((EffectSsBlastInitParams*)initParamsx)
-s32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this);
-#if 0
const EffectSsInit Effect_Ss_Blast_InitVars = {
EFFECT_SS_BLAST,
EffectSsBlast_Init,
};
-#endif
+u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsBlastInitParams* initParams = PARAMS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Blast/EffectSsBlast_Init.s")
+ this->pos = initParams->pos;
+ this->pos.y += 5.0f;
+ this->velocity = initParams->velocity;
+ this->accel = initParams->accel;
+ this->gfx = gEffShockwaveDL;
+ this->life = initParams->life;
+ this->draw = EffectSsBlast_Draw;
+ this->update = EffectSsBlast_Update;
+ this->rPrimColorR = initParams->primColor.r;
+ this->rPrimColorG = initParams->primColor.g;
+ this->rPrimColorB = initParams->primColor.b;
+ this->rPrimColorA = initParams->primColor.a;
+ this->rEnvColorR = initParams->envColor.r;
+ this->rEnvColorG = initParams->envColor.g;
+ this->rEnvColorB = initParams->envColor.b;
+ this->rEnvColorA = initParams->envColor.a;
+ this->rAlphaStep = initParams->primColor.a / initParams->life;
+ this->rScale = initParams->scale;
+ this->rScaleStep = initParams->scaleStep;
+ this->rScaleStepDecay = initParams->scaleStepDecay;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Blast/EffectSsBlast_Draw.s")
+ return 1;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Blast/EffectSsBlast_Update.s")
+void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ MtxF mf;
+ s32 pad;
+ f32 radius;
+
+ OPEN_DISPS(gfxCtx);
+
+ radius = this->rScale * 0.0025f;
+
+ func_8012C2DC(play->state.gfxCtx);
+ gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA);
+ func_801691F0(play, &mf, &this->pos);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA);
+ Matrix_Put(&mf);
+ Matrix_Scale(radius, radius, radius, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, this->gfx);
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this) {
+ Math_StepToS(&this->rPrimColorA, 0, this->rAlphaStep);
+ this->rScale += this->rScaleStep;
+
+ if (this->rScaleStep != 0) {
+ this->rScaleStep -= this->rScaleStepDecay;
+ }
+}
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 2a13227c3..72a264c03 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
@@ -11,7 +11,7 @@ typedef struct {
/* 0x28 */ Color_RGBA8 envColor;
/* 0x2C */ s16 scale;
/* 0x2E */ s16 scaleStep;
- /* 0x30 */ s16 sclaeStepDecay;
+ /* 0x30 */ s16 scaleStepDecay;
/* 0x32 */ s16 life;
} EffectSsBlastInitParams; // size = 0x34
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 7903deffa..d15151d49 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
@@ -1,30 +1,195 @@
/*
* File: z_eff_ss_bomb2.c
* Overlay: ovl_Effect_Ss_Bomb2
- * Description:
+ * Description: Bomb Blast
*/
#include "z_eff_ss_bomb2.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
+#define rScale regs[0]
+#define rTexIndex regs[1]
+#define rPrimColorR regs[2]
+#define rPrimColorG regs[3]
+#define rPrimColorB regs[4]
+#define rPrimColorA regs[5]
+#define rEnvColorR regs[6]
+#define rEnvColorG regs[7]
+#define rEnvColorB regs[8]
+#define rScaleStep regs[9]
+#define rDepth regs[10]
#define PARAMS ((EffectSsBomb2InitParams*)initParamsx)
-s32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+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);
-void func_80978138(PlayState* play, u32 index, EffectSs* this);
-void func_80978304(PlayState* play, u32 index, EffectSs* this);
-#if 0
const EffectSsInit Effect_Ss_Bomb2_InitVars = {
EFFECT_SS_BOMB2,
EffectSsBomb2_Init,
};
-#endif
+static EffectSsDrawFunc sDrawFuncs[] = {
+ EffectSsBomb2_DrawFade,
+ EffectSsBomb2_DrawLayered,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/EffectSsBomb2_Init.s")
+static TexturePtr sTextures[] = {
+ gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex,
+ gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/func_80978138.s")
+static TexturePtr sLayeredTextures[] = {
+ gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex,
+ gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/func_80978304.s")
+u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsBomb2InitParams* initParams = PARAMS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/EffectSsBomb2_Update.s")
+ Math_Vec3f_Copy(&this->pos, &initParams->pos);
+ Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
+ Math_Vec3f_Copy(&this->accel, &initParams->accel);
+ this->gfx = gEffBombExplosion1DL;
+ this->life = 24;
+ this->update = EffectSsBomb2_Update;
+ this->draw = sDrawFuncs[initParams->drawMode];
+ this->rScale = initParams->scale;
+ this->rScaleStep = initParams->scaleStep;
+ this->rPrimColorR = 255;
+ this->rPrimColorG = 255;
+ this->rPrimColorB = 255;
+ this->rPrimColorA = 255;
+ this->rEnvColorR = 0;
+ this->rEnvColorG = 0;
+ this->rEnvColorB = 200;
+
+ return 1;
+}
+
+// unused in the original game. looks like EffectSsBomb but with color
+void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ MtxF mfTrans;
+ MtxF mfScale;
+ MtxF mfResult;
+ MtxF mfTransBillboard;
+ Mtx* mtx;
+ s32 pad;
+ f32 scale;
+
+ OPEN_DISPS(gfxCtx);
+
+ scale = this->rScale * 0.01f;
+ SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
+ SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
+
+ mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
+
+ if (mtx != NULL) {
+ gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ func_8012C974(gfxCtx);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
+ this->rPrimColorA);
+ gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sTextures[this->rTexIndex]));
+ gSPDisplayList(POLY_XLU_DISP++, this->gfx);
+ }
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ MtxF mfTrans;
+ MtxF mfScale;
+ MtxF mfResult;
+ MtxF mfTransBillboard;
+ MtxF mtx2F;
+ Mtx* mtx2;
+ Mtx* mtx;
+ s32 pad[3];
+ f32 scale;
+ f32 depth;
+ f32 layer2Scale = 0.925f;
+ s32 i;
+
+ OPEN_DISPS(gfxCtx);
+
+ depth = this->rDepth;
+ scale = this->rScale * 0.01f;
+ SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
+ SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
+
+ mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
+
+ if (mtx != NULL) {
+ gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+
+ mtx2 = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
+
+ if (mtx2 != NULL) {
+ func_8012C974(gfxCtx);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
+ this->rPrimColorA);
+ gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sLayeredTextures[this->rTexIndex]));
+ gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion2DL);
+ gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL);
+
+ Matrix_MtxToMtxF(mtx2, &mtx2F);
+ Matrix_Put(&mtx2F);
+
+ for (i = 1; i >= 0; i--) {
+ Matrix_Translate(0.0f, 0.0f, depth, MTXMODE_APPLY);
+ Matrix_RotateZF((this->life * 0.02f) + 180.0f, MTXMODE_APPLY);
+ Matrix_Scale(layer2Scale, layer2Scale, layer2Scale, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL);
+ layer2Scale -= 0.15f;
+ }
+ }
+ }
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this) {
+ s32 divisor;
+
+ this->rTexIndex = (23 - this->life) / 3;
+ this->rScale += this->rScaleStep;
+
+ if (this->rScaleStep == 30) {
+ this->rDepth += 4;
+ } else {
+ this->rDepth += 2;
+ }
+
+ if ((this->life < 23) && (this->life > 13)) {
+ divisor = this->life - 13;
+ this->rPrimColorR = func_800B096C(this->rPrimColorR, 255, divisor);
+ this->rPrimColorG = func_800B096C(this->rPrimColorG, 255, divisor);
+ this->rPrimColorB = func_800B096C(this->rPrimColorB, 150, divisor);
+ this->rPrimColorA = func_800B096C(this->rPrimColorA, 255, divisor);
+ this->rEnvColorR = func_800B096C(this->rEnvColorR, 150, divisor);
+ this->rEnvColorG = func_800B096C(this->rEnvColorG, 0, divisor);
+ this->rEnvColorB = func_800B096C(this->rEnvColorB, 0, divisor);
+ } else if ((this->life < 14) && (this->life > -1)) {
+ divisor = this->life + 1;
+ this->rPrimColorR = func_800B096C(this->rPrimColorR, 50, divisor);
+ this->rPrimColorG = func_800B096C(this->rPrimColorG, 50, divisor);
+ this->rPrimColorB = func_800B096C(this->rPrimColorB, 50, divisor);
+ this->rPrimColorA = func_800B096C(this->rPrimColorA, 150, divisor);
+ this->rEnvColorR = func_800B096C(this->rEnvColorR, 10, divisor);
+ this->rEnvColorG = func_800B096C(this->rEnvColorG, 10, divisor);
+ this->rEnvColorB = func_800B096C(this->rEnvColorB, 10, divisor);
+ }
+}
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 011d8a101..9dab9c61a 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
@@ -1,7 +1,7 @@
/*
* File: z_eff_ss_bubble.c
* Overlay: ovl_Effect_Ss_Bubble
- * Description:
+ * Description: Water Bubbles
*/
#include "z_eff_ss_bubble.h"
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 ff8c54053..9d8eecfbc 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
@@ -1,31 +1,115 @@
/*
* File: z_eff_ss_d_fire.c
* Overlay: ovl_Effect_Ss_D_Fire
- * Description:
+ * Description: Dodongo Fire
*/
#include "z_eff_ss_d_fire.h"
+#include "objects/object_dodongo/object_dodongo.h"
+
+#define rScale regs[0]
+#define rTexIndex regs[1]
+#define rAlpha regs[5]
+#define rAlphaStep regs[6]
+#define rFadeDelay regs[7]
+#define rScaleStep regs[8]
+#define rObjectIndex regs[9]
#define PARAMS ((EffectSsDFireInitParams*)initParamsx)
-s32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this);
-#if 0
const EffectSsInit Effect_Ss_D_Fire_InitVars = {
EFFECT_SS_D_FIRE,
EffectSsDFire_Init,
};
-#endif
+static TexturePtr sFireTextures[] = { gDodongoFire0Tex, gDodongoFire1Tex, gDodongoFire2Tex, gDodongoFire3Tex };
-extern UNK_TYPE D_060098A0;
+s32 EffectSsDFire_CheckForObject(EffectSs* this, PlayState* play) {
+ if (((this->rObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_DODONGO)) < 0) ||
+ !Object_IsLoaded(&play->objectCtx, this->rObjectIndex)) {
+ this->life = -1;
+ this->draw = NULL;
+ return false;
+ }
+ return true;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/func_809791B0.s")
+u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsDFireInitParams* initParams = PARAMS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/EffectSsDFire_Init.s")
+ if (EffectSsDFire_CheckForObject(this, play)) {
+ Math_Vec3f_Copy(&this->pos, &initParams->pos);
+ Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
+ Math_Vec3f_Copy(&this->accel, &initParams->accel);
+ this->gfx = gDodongoFireDL;
+ this->life = initParams->life;
+ this->rScale = initParams->scale;
+ this->rScaleStep = initParams->scaleStep;
+ this->draw = EffectSsDFire_Draw;
+ this->update = EffectSsDFire_Update;
+ this->rTexIndex = (play->state.frames & 3) ^ 3; // The xor reverses order, i.e 3 -> 2 -> 1 -> 0 -> 3
+ this->rAlpha = initParams->alpha;
+ this->rFadeDelay = this->life - initParams->fadeDelay;
+ this->rAlphaStep = initParams->alphaStep;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/EffectSsDFire_Draw.s")
+ return 1;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/EffectSsDFire_Update.s")
+ return 0;
+}
+
+void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ s32 pad;
+ void* object;
+ f32 scale;
+
+ if (EffectSsDFire_CheckForObject(this, play)) {
+ object = play->objectCtx.status[this->rObjectIndex].segment;
+
+ OPEN_DISPS(gfxCtx);
+
+ gSegments[6] = VIRTUAL_TO_PHYSICAL(object);
+ gSPSegment(POLY_XLU_DISP++, 0x06, object);
+
+ scale = this->rScale / 100.0f;
+
+ Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
+
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ func_8012C974(gfxCtx);
+ gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 50, this->rAlpha);
+
+ {
+ TexturePtr* tex = sFireTextures[this->rTexIndex];
+
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(tex));
+ }
+
+ gSPDisplayList(POLY_XLU_DISP++, this->gfx);
+
+ CLOSE_DISPS(gfxCtx);
+ }
+}
+
+void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this) {
+ this->rTexIndex++;
+ this->rTexIndex &= 3;
+ this->rScale += this->rScaleStep;
+ if (this->life < this->rFadeDelay) {
+ this->rAlpha -= this->rAlphaStep;
+ if (this->rAlpha < 0) {
+ this->rAlpha = 0;
+ this->life = -1;
+ }
+ }
+
+ EffectSsDFire_CheckForObject(this, play);
+}
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 09298249d..2d657bc43 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
@@ -10,8 +10,8 @@ typedef struct {
/* 0x24 */ s16 scale;
/* 0x26 */ s16 scaleStep;
/* 0x28 */ s16 alpha;
- /* 0x2A */ s16 fadeDelay;
- /* 0x2C */ s16 unk_2C;
+ /* 0x2A */ s16 alphaStep;
+ /* 0x2C */ s16 fadeDelay;
/* 0x30 */ s32 life;
} EffectSsDFireInitParams; // size = 0x34
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 616d30d03..54963eb3b 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
@@ -1,27 +1,129 @@
/*
* File: z_eff_ss_dead_db.c
* Overlay: ovl_Effect_Ss_Dead_Db
- * Description:
+ * Description: Enemy Death Flames
*/
#include "z_eff_ss_dead_db.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
+#define rScale regs[0]
+#define rTexIndex regs[1]
+#define rPrimColorR regs[2]
+#define rPrimColorG regs[3]
+#define rPrimColorB regs[4]
+#define rPrimColorA regs[5]
+#define rEnvColorR regs[6]
+#define rEnvColorG regs[7]
+#define rEnvColorB regs[8]
+#define rScaleStep regs[9]
+#define rTotalLife regs[11]
#define PARAMS ((EffectSsDeadDbInitParams*)initParamsx)
-s32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this);
-#if 0
const EffectSsInit Effect_Ss_Dead_Db_InitVars = {
EFFECT_SS_DEAD_DB,
EffectSsDeadDb_Init,
};
-#endif
+static TexturePtr sTextures[] = {
+ gEffEnemyDeathFlame1Tex, gEffEnemyDeathFlame2Tex, gEffEnemyDeathFlame3Tex, gEffEnemyDeathFlame4Tex,
+ gEffEnemyDeathFlame5Tex, gEffEnemyDeathFlame6Tex, gEffEnemyDeathFlame7Tex, gEffEnemyDeathFlame8Tex,
+ gEffEnemyDeathFlame9Tex, gEffEnemyDeathFlame10Tex,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Db/EffectSsDeadDb_Init.s")
+u32 EffectSsDeadDb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsDeadDbInitParams* initParams = PARAMS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Db/EffectSsDeadDb_Draw.s")
+ Math_Vec3f_Copy(&this->pos, &initParams->pos);
+ Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
+ Math_Vec3f_Copy(&this->accel, &initParams->accel);
+ this->gfx = gEffEnemyDeathFlameDL;
+ this->life = initParams->life;
+ this->flags = 4;
+ this->rScaleStep = initParams->scaleStep;
+ this->rTotalLife = initParams->life;
+ this->draw = EffectSsDeadDb_Draw;
+ this->update = EffectSsDeadDb_Update;
+ this->rScale = initParams->scale;
+ this->rTexIndex = 0;
+ this->rPrimColorR = initParams->primColor.r;
+ this->rPrimColorG = initParams->primColor.g;
+ this->rPrimColorB = initParams->primColor.b;
+ this->rPrimColorA = initParams->primColor.a;
+ this->rEnvColorR = initParams->envColor.r;
+ this->rEnvColorG = initParams->envColor.g;
+ this->rEnvColorB = initParams->envColor.b;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Db/EffectSsDeadDb_Update.s")
+ return 1;
+}
+
+void EffectSsDeadDb_Draw(PlayState* play, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ MtxF mfTrans;
+ MtxF mfScale;
+ MtxF mfResult;
+ Mtx* mtx;
+ f32 scale;
+
+ OPEN_DISPS(gfxCtx);
+
+ scale = this->rScale * 0.01f;
+
+ SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
+ SkinMatrix_SetScale(&mfScale, scale, scale, scale);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &mfScale, &mfResult);
+
+ mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
+
+ if (mtx != NULL) {
+ gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ func_8012C974(gfxCtx);
+ gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
+ this->rPrimColorA);
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sTextures[this->rTexIndex]));
+ gSPDisplayList(POLY_XLU_DISP++, this->gfx);
+ }
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsDeadDb_Update(PlayState* play, u32 index, EffectSs* this) {
+ this->rTexIndex = (f32)((this->rTotalLife - this->life) * 9) / this->rTotalLife;
+ this->rScale += this->rScaleStep;
+
+ this->rPrimColorR -= 10;
+ if (this->rPrimColorR < 0) {
+ this->rPrimColorR = 0;
+ }
+
+ this->rPrimColorG -= 10;
+ if (this->rPrimColorG < 0) {
+ this->rPrimColorG = 0;
+ }
+
+ this->rPrimColorB -= 10;
+ if (this->rPrimColorB < 0) {
+ this->rPrimColorB = 0;
+ }
+
+ this->rEnvColorR -= 10;
+ if (this->rEnvColorR < 0) {
+ this->rEnvColorR = 0;
+ }
+
+ this->rEnvColorG -= 10;
+ if (this->rEnvColorG < 0) {
+ this->rEnvColorG = 0;
+ }
+
+ this->rEnvColorB -= 10;
+ if (this->rEnvColorB < 0) {
+ this->rEnvColorB = 0;
+ }
+}
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 bbdf3c290..a1ac62167 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
@@ -11,8 +11,8 @@ typedef struct {
/* 0x26 */ s16 scaleStep;
/* 0x28 */ Color_RGBA8 primColor;
/* 0x2C */ Color_RGBA8 envColor;
- /* 0x30 */ s32 unk_30;
-} EffectSsDeadDbInitParams; // size = 0x30
+ /* 0x30 */ s32 life;
+} EffectSsDeadDbInitParams; // size = 0x34
extern const EffectSsInit Effect_Ss_Dead_Db_InitVars;
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 6dfbce5a1..5e8a1e451 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
@@ -116,14 +116,13 @@ void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this) {
gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
PRIMITIVE, 0);
- gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054940);
+ gSPDisplayList(POLY_XLU_DISP++, gLensFlareCircleDL);
}
CLOSE_DISPS(gfxCtx);
}
void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this) {
-
this->rScale += this->rScaleStep;
if (this->rScale < 0) {
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 e5079f55d..7bf60c2a1 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
@@ -1,27 +1,124 @@
/*
* File: z_eff_ss_dead_ds.c
* Overlay: ovl_Effect_Ss_Dead_Ds
- * Description:
+ * Description: Burn mark on the floor
*/
#include "z_eff_ss_dead_ds.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
+#define rScale regs[0]
+#define rTimer regs[1]
+#define rRoll regs[2]
+#define rPitch regs[3]
+#define rYaw regs[4]
+#define rAlpha regs[5]
+#define rScaleStep regs[9]
+#define rAlphaStep regs[10]
+#define rHalfOfLife regs[11]
#define PARAMS ((EffectSsDeadDsInitParams*)initParamsx)
-s32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this);
-#if 0
const EffectSsInit Effect_Ss_Dead_Ds_InitVars = {
EFFECT_SS_DEAD_DS,
EffectSsDeadDs_Init,
};
-#endif
+u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsDeadDsInitParams* initParams = PARAMS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Ds/EffectSsDeadDs_Init.s")
+ this->pos = initParams->pos;
+ this->velocity = initParams->velocity;
+ this->accel = initParams->accel;
+ this->life = initParams->life;
+ this->rScaleStep = initParams->scaleStep;
+ this->rHalfOfLife = initParams->life / 2;
+ this->rAlphaStep = initParams->alpha / this->rHalfOfLife;
+ this->draw = EffectSsDeadDs_Draw;
+ this->update = EffectSsDeadDs_Update;
+ this->rScale = initParams->scale;
+ this->rAlpha = initParams->alpha;
+ this->rTimer = 0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Ds/EffectSsDeadDs_Draw.s")
+ return 1;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Ds/EffectSsDeadDs_Update.s")
+void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this) {
+ s32 pad;
+ f32 scale;
+ s32 pad2[2];
+ MtxF mf;
+ f32 yIntersect;
+ Vec3f pos;
+ CollisionPoly* floorPoly;
+
+ OPEN_DISPS(play->state.gfxCtx);
+
+ scale = this->rScale * 0.01f;
+ func_8012C974(play->state.gfxCtx);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, this->rAlpha);
+ gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0);
+ pos = this->pos;
+
+ if (this->rTimer == 0) {
+ Vec3s rot;
+ Vec3f prevPos;
+
+ prevPos.x = pos.x - this->velocity.x;
+ prevPos.y = pos.y - this->velocity.y;
+ prevPos.z = pos.z - this->velocity.z;
+
+ if (BgCheck_EntitySphVsWall1(&play->colCtx, &this->pos, &pos, &prevPos, 1.5f, &floorPoly, 1.0f)) {
+ func_800C0094(floorPoly, this->pos.x, this->pos.y, this->pos.z, &mf);
+ Matrix_Put(&mf);
+ } else {
+ pos.y++;
+ yIntersect = BgCheck_EntityRaycastFloor1(&play->colCtx, &floorPoly, &pos);
+
+ if (floorPoly != NULL) {
+ func_800C0094(floorPoly, this->pos.x, yIntersect + 1.5f, this->pos.z, &mf);
+ Matrix_Put(&mf);
+ } else {
+ Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
+ Matrix_Get(&mf);
+ }
+ }
+
+ Matrix_MtxFToZYXRot(&mf, &rot, false);
+ this->rRoll = rot.x;
+ this->rPitch = rot.y;
+ this->rYaw = rot.z;
+ this->pos.y = mf.yw;
+ this->rTimer++;
+ }
+
+ Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
+ Matrix_RotateZYX(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY);
+ Matrix_RotateXFApply(1.57f); // (M_PI / 2)
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
+ PRIMITIVE, 0);
+ gSPDisplayList(POLY_XLU_DISP++, gLensFlareCircleDL);
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
+
+void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this) {
+ if (this->life < this->rHalfOfLife) {
+
+ this->rScale += this->rScaleStep;
+ if (this->rScale < 0) {
+ this->rScale = 0;
+ }
+
+ this->rAlpha -= this->rAlphaStep;
+ if (this->rAlpha < 0) {
+ this->rAlpha = 0;
+ }
+ }
+}
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 a4aed4732..4d009c00a 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
@@ -1,27 +1,116 @@
/*
* File: z_eff_ss_dt_bubble.c
* Overlay: ovl_Effect_Ss_Dt_Bubble
- * Description:
+ * Description: Non-Water Bubbles (a random mix of translucent and opaque)
*/
#include "z_eff_ss_dt_bubble.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
+#define rPrimColorR regs[0]
+#define rPrimColorG regs[1]
+#define rPrimColorB regs[2]
+#define rPrimColorA regs[3]
+#define rEnvColorR regs[4]
+#define rEnvColorG regs[5]
+#define rEnvColorB regs[6]
+#define rEnvColorA regs[7]
+#define rRandXZ regs[8]
+#define rScale regs[9]
+#define rLifespan regs[10]
#define PARAMS ((EffectSsDtBubbleInitParams*)initParamsx)
-s32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this);
-#if 0
+static Color_RGBA8 sPrimColors[] = {
+ { 255, 255, 100, 255 },
+ { 150, 255, 255, 255 },
+ { 100, 255, 255, 255 },
+ { 255, 255, 255, 255 },
+};
+
+static Color_RGBA8 sEnvColors[] = {
+ { 170, 0, 0, 255 },
+ { 0, 100, 0, 255 },
+ { 0, 0, 255, 255 },
+ { 150, 150, 150, 0 },
+};
+
const EffectSsInit Effect_Ss_Dt_Bubble_InitVars = {
EFFECT_SS_DT_BUBBLE,
EffectSsDtBubble_Init,
};
-#endif
+u32 EffectSsDtBubble_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsDtBubbleInitParams* initParams = PARAMS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dt_Bubble/EffectSsDtBubble_Init.s")
+ {
+ TexturePtr tex = (Rand_ZeroOne() < 0.5f) ? gEffBubble1Tex : gEffBubble2Tex;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dt_Bubble/EffectSsDtBubble_Draw.s")
+ this->gfx = VIRTUAL_TO_PHYSICAL(SEGMENTED_TO_VIRTUAL(tex));
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dt_Bubble/EffectSsDtBubble_Update.s")
+ Math_Vec3f_Copy(&this->pos, &initParams->pos);
+ Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
+ Math_Vec3f_Copy(&this->accel, &initParams->accel);
+ this->life = initParams->life;
+
+ if (!initParams->customColor) {
+ this->rPrimColorR = sPrimColors[initParams->colorProfile].r;
+ this->rPrimColorG = sPrimColors[initParams->colorProfile].g;
+ this->rPrimColorB = sPrimColors[initParams->colorProfile].b;
+ this->rPrimColorA = sPrimColors[initParams->colorProfile].a;
+ this->rEnvColorR = sEnvColors[initParams->colorProfile].r;
+ this->rEnvColorG = sEnvColors[initParams->colorProfile].g;
+ this->rEnvColorB = sEnvColors[initParams->colorProfile].b;
+ this->rEnvColorA = sEnvColors[initParams->colorProfile].a;
+ } else {
+ this->rPrimColorR = initParams->primColor.r;
+ this->rPrimColorG = initParams->primColor.g;
+ this->rPrimColorB = initParams->primColor.b;
+ this->rPrimColorA = initParams->primColor.a;
+ this->rEnvColorR = initParams->envColor.r;
+ this->rEnvColorG = initParams->envColor.g;
+ this->rEnvColorB = initParams->envColor.b;
+ this->rEnvColorA = initParams->envColor.a;
+ }
+
+ this->rRandXZ = initParams->randXZ;
+ this->rScale = initParams->scale;
+ this->rLifespan = initParams->life;
+ this->draw = EffectSsDtBubble_Draw;
+ this->update = EffectSsDtBubble_Update;
+
+ return 1;
+}
+
+void EffectSsDtBubble_Draw(PlayState* play, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ f32 scale;
+
+ OPEN_DISPS(gfxCtx);
+
+ scale = this->rScale * 0.004f;
+ Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ func_8012C28C(gfxCtx);
+ gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
+ (this->rPrimColorA * this->life) / this->rLifespan);
+ gDPSetEnvColor(POLY_OPA_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB,
+ (this->rEnvColorA * this->life) / this->rLifespan);
+ gSPSegment(POLY_OPA_DISP++, 0x08, this->gfx);
+ gSPDisplayList(POLY_OPA_DISP++, gEffBubbleDL);
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsDtBubble_Update(PlayState* play, u32 index, EffectSs* this) {
+ if (this->rRandXZ == true) {
+ this->pos.x += (Rand_ZeroOne() * 2.0f) - 1.0f;
+ this->pos.z += (Rand_ZeroOne() * 2.0f) - 1.0f;
+ }
+}
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 75847c0c4..e572f4a2c 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
@@ -3,6 +3,13 @@
#include "global.h"
+typedef enum {
+ /* 0 */ DTBUBBLE_COLOR_PROFILE_RED,
+ /* 1 */ DTBUBBLE_COLOR_PROFILE_GREEN,
+ /* 2 */ DTBUBBLE_COLOR_PROFILE_BLUE,
+ /* 3 */ DTBUBBLE_COLOR_PROFILE_CLEAR
+} DtBubbleColorProfile;
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
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 c3a72bb7f..7a2274a5d 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
@@ -1,30 +1,192 @@
/*
* File: z_eff_ss_dust.c
* Overlay: ovl_Effect_Ss_Dust
- * Description:
+ * Description: Dust Particle Effect
*/
#include "z_eff_ss_dust.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+
+#define rPrimColorR regs[0]
+#define rPrimColorG regs[1]
+#define rPrimColorB regs[2]
+#define rPrimColorA regs[3]
+#define rEnvColorR regs[4]
+#define rEnvColorG regs[5]
+#define rEnvColorB regs[6]
+#define rEnvColorA regs[7]
+#define rTexIndex regs[8] // this reg is also used to set specific colors in the fire update function
+#define rScale regs[9]
+#define rScaleStep regs[10]
+#define rDrawFlags regs[11]
+#define rLifespan regs[12]
#define PARAMS ((EffectSsDustInitParams*)initParamsx)
-s32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
-void func_809776BC(PlayState* play, u32 index, EffectSs* this);
-void func_809777B4(PlayState* play, u32 index, EffectSs* this);
+u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+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);
-#if 0
const EffectSsInit Effect_Ss_Dust_InitVars = {
EFFECT_SS_DUST,
EffectSsDust_Init,
};
-#endif
+static EffectSsUpdateFunc sUpdateFuncs[] = {
+ EffectSsDust_Update,
+ EffectSsDust_UpdateFire,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/EffectSsDust_Init.s")
+static TexturePtr sDustTextures[] = {
+ gEffDust1Tex, gEffDust2Tex, gEffDust3Tex, gEffDust4Tex, gEffDust5Tex, gEffDust6Tex, gEffDust7Tex, gEffDust8Tex,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/EffectSsDust_Draw.s")
+u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ EffectSsDustInitParams* initParams = PARAMS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/func_809776BC.s")
+ Math_Vec3f_Copy(&this->pos, &initParams->pos);
+ Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
+ Math_Vec3f_Copy(&this->accel, &initParams->accel);
+ this->gfx = gEffDustDL;
+ this->life = initParams->life;
+ this->update = sUpdateFuncs[initParams->updateMode];
+ this->draw = EffectSsDust_Draw;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dust/func_809777B4.s")
+ if (initParams->drawFlags & DUST_DRAWFLAG_RAND_COLOR_OFFSET) {
+ s32 randColorOffset = Rand_ZeroOne() * 20.0f - 10.0f;
+
+ this->rPrimColorR = initParams->primColor.r + randColorOffset;
+ this->rPrimColorG = initParams->primColor.g + randColorOffset;
+ this->rPrimColorB = initParams->primColor.b + randColorOffset;
+ this->rEnvColorR = initParams->envColor.r + randColorOffset;
+ this->rEnvColorG = initParams->envColor.g + randColorOffset;
+ this->rEnvColorB = initParams->envColor.b + randColorOffset;
+ } else {
+ this->rPrimColorR = initParams->primColor.r;
+ this->rPrimColorG = initParams->primColor.g;
+ this->rPrimColorB = initParams->primColor.b;
+ this->rEnvColorR = initParams->envColor.r;
+ this->rEnvColorG = initParams->envColor.g;
+ this->rEnvColorB = initParams->envColor.b;
+ }
+
+ this->rPrimColorA = initParams->primColor.a;
+ this->rEnvColorA = initParams->envColor.a;
+ this->rTexIndex = 0;
+ this->rScale = initParams->scale;
+ this->rScaleStep = initParams->scaleStep;
+ this->rLifespan = initParams->life;
+ this->rDrawFlags = initParams->drawFlags;
+
+ return 1;
+}
+
+void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) {
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ MtxF mfTrans;
+ MtxF mfScale;
+ MtxF mfResult;
+ MtxF mfTransBillboard;
+ s32 pad;
+ Mtx* mtx;
+ f32 scale;
+
+ OPEN_DISPS(gfxCtx);
+
+ scale = this->rScale * 0.0025f;
+ SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
+ SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
+ gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+
+ mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
+
+ if (mtx != NULL) {
+ gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gDPPipeSync(POLY_XLU_DISP++);
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[this->rTexIndex]));
+ POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
+ gDPPipeSync(POLY_XLU_DISP++);
+
+ if (this->rDrawFlags & DUST_DRAWFLAG1) {
+ gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0,
+ COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED);
+ gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2);
+ gSPSetGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING);
+ } else if (this->rDrawFlags & DUST_DRAWFLAG2) {
+ gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_ZB_CLD_SURF2);
+ gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING);
+ } else { // DUST_DRAWFLAG0
+ gSPClearGeometryMode(POLY_XLU_DISP++, G_LIGHTING);
+ }
+
+ gDPPipeSync(POLY_XLU_DISP++);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255);
+ gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA);
+ gSPDisplayList(POLY_XLU_DISP++, this->gfx);
+ }
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this) {
+ this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f;
+ this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f;
+
+ if ((this->life <= this->rLifespan) && (this->life >= (this->rLifespan - 7))) {
+ if (this->rLifespan >= 5) {
+ this->rTexIndex = this->rLifespan - this->life;
+ } else {
+ this->rTexIndex = ((this->rLifespan - this->life) * (ARRAY_COUNT(sDustTextures) / this->rLifespan));
+ }
+ } else {
+ this->rTexIndex = ARRAY_COUNT(sDustTextures) - 1;
+ }
+
+ this->rScale += this->rScaleStep;
+}
+
+// this update mode is unused in the original game
+void EffectSsDust_UpdateFire(PlayState* play, u32 index, EffectSs* this) {
+ this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f;
+ this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f;
+
+ switch (this->rTexIndex) {
+ case 0:
+ this->rPrimColorR = 255;
+ this->rPrimColorG = 150;
+ this->rPrimColorB = 0;
+ this->rEnvColorR = 150;
+ this->rEnvColorG = 50;
+ this->rEnvColorB = 0;
+ break;
+ case 1:
+ this->rPrimColorR = 200;
+ this->rPrimColorG = 50;
+ this->rPrimColorB = 0;
+ this->rEnvColorR = 100;
+ this->rEnvColorG = 0;
+ this->rEnvColorB = 0;
+ break;
+ case 2:
+ this->rPrimColorR = 50;
+ this->rPrimColorG = 0;
+ this->rPrimColorB = 0;
+ this->rEnvColorR = 0;
+ this->rEnvColorG = 0;
+ this->rEnvColorB = 0;
+ break;
+ case 3:
+ this->rPrimColorR = 50;
+ this->rEnvColorR = this->rPrimColorG = this->rEnvColorG = this->rPrimColorB = this->rEnvColorB = 0;
+ break;
+ }
+
+ if (this->rTexIndex < (ARRAY_COUNT(sDustTextures) - 1)) {
+ this->rTexIndex++;
+ }
+
+ this->rScale += this->rScaleStep;
+}
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 7e8bfbfb8..410a14352 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
@@ -3,6 +3,16 @@
#include "global.h"
+#define DUST_DRAWFLAG0 (0)
+#define DUST_DRAWFLAG1 (1 << 0)
+#define DUST_DRAWFLAG2 (1 << 1)
+#define DUST_DRAWFLAG_RAND_COLOR_OFFSET (1 << 2)
+
+typedef enum {
+ /* 0 */ DUST_UPDATE_NORMAL,
+ /* 1 */ DUST_UPDATE_FIRE
+} DustUpdateMode;
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c
index 268f8e1a6..4584cfab2 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c
+++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c
@@ -5,6 +5,7 @@
*/
#include "z_fbdemo_triforce.h"
+#include "assets/objects/object_fbdemo_triforce/ovl_fbdemo_triforce.c"
void* TransitionTriforce_Init(void* thisx);
void TransitionTriforce_Destroy(void* thisx);
@@ -15,35 +16,132 @@ void TransitionTriforce_SetType(void* thisx, s32 type);
void TransitionTriforce_SetColor(void* thisx, u32 color);
s32 TransitionTriforce_IsDone(void* thisx);
-#if 0
const TransitionInit TransitionTriforce_InitVars = {
- TransitionTriforce_Init,
- TransitionTriforce_Destroy,
- TransitionTriforce_Update,
- TransitionTriforce_Draw,
- TransitionTriforce_Start,
- TransitionTriforce_SetType,
- TransitionTriforce_SetColor,
- NULL,
+ TransitionTriforce_Init, TransitionTriforce_Destroy, TransitionTriforce_Update, TransitionTriforce_Draw,
+ TransitionTriforce_Start, TransitionTriforce_SetType, TransitionTriforce_SetColor, NULL,
TransitionTriforce_IsDone,
};
-#endif
+void TransitionTriforce_Start(void* thisx) {
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Start.s")
+ switch (this->state) {
+ case STATE_SPIRAL_IN_SLOW:
+ case STATE_SPIRAL_IN_FAST:
+ this->transPos = 1.0f;
+ return;
+ }
+ this->transPos = 0.03f;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Init.s")
+void* TransitionTriforce_Init(void* thisx) {
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Destroy.s")
+ bzero(this, sizeof(TransitionTriforce));
+ guOrtho(&this->projection, -SCREEN_WIDTH / 2, SCREEN_WIDTH / 2, -SCREEN_HEIGHT / 2, SCREEN_HEIGHT / 2, -1000.0f,
+ 1000.0f, 1.0f);
+ this->transPos = 1.0f;
+ this->state = STATE_SPIRAL_IN_FAST;
+ this->step = 0.015f;
+ this->fadeType = TYPE_TRANSPARENT_TRIFORCE;
+ return this;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Update.s")
+void TransitionTriforce_Destroy(void* thisx) {
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_SetColor.s")
+void TransitionTriforce_Update(void* thisx, s32 updateRate) {
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_SetType.s")
+ for (i = updateRate; i > 0; i--) {
+ if (this->state == STATE_SPIRAL_IN_SLOW) {
+ this->transPos = CLAMP_MIN(this->transPos * (1.0f - this->step), 0.03f);
+ } else if (this->state == STATE_SPIRAL_IN_FAST) {
+ this->transPos = CLAMP_MIN(this->transPos - this->step, 0.03f);
+ } else if (this->state == STATE_SPIRAL_OUT_SLOW) {
+ this->transPos = CLAMP_MAX(this->transPos / (1.0f - this->step), 1.0f);
+ } else if (this->state == STATE_SPIRAL_OUT_FAST) {
+ this->transPos = CLAMP_MAX(this->transPos + this->step, 1.0f);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/func_80AC5280.s")
+void TransitionTriforce_SetColor(void* thisx, u32 color) {
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_Draw.s")
+ this->color.rgba = color;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_fbdemo_triforce/TransitionTriforce_IsDone.s")
+void TransitionTriforce_SetType(void* thisx, s32 type) {
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
+
+ this->fadeType = type;
+}
+
+void TransitionTriforce_SetState(void* thisx, s32 state) {
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
+
+ this->state = state;
+}
+
+void TransitionTriforce_Draw(void* thisx, Gfx** gfxP) {
+ Gfx* gfx = *gfxP;
+ Mtx* modelView;
+ s32 pad[2];
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
+ f32 rotation = this->transPos * 360.0f;
+
+ modelView = this->modelView[this->frame];
+ this->frame ^= 1;
+ guScale(&modelView[0], this->transPos * 0.625f, this->transPos * 0.625f, 1.0f);
+ guRotate(&modelView[1], rotation, 0.0f, 0.0f, 1.0f);
+ guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f);
+ gDPPipeSync(gfx++);
+ gSPDisplayList(gfx++, sTriforceWipeDL);
+ gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba);
+ gDPSetCombineMode(gfx++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
+ gSPMatrix(gfx++, &this->projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
+ gSPMatrix(gfx++, &modelView[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPMatrix(gfx++, &modelView[1], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
+ gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
+ gSPVertex(gfx++, &sTriforceWipeVtx, ARRAY_COUNT(sTriforceWipeVtx), 0);
+ if (!TransitionTriforce_IsDone(this)) {
+ switch (this->fadeType) {
+ case TYPE_TRANSPARENT_TRIFORCE:
+ gSP2Triangles(gfx++, 0, 4, 5, 0, 4, 1, 3, 0);
+ gSP1Triangle(gfx++, 5, 3, 2, 0);
+ break;
+
+ case TYPE_FILLED_TRIFORCE:
+ gSP2Triangles(gfx++, 3, 4, 5, 0, 0, 2, 6, 0);
+ gSP2Triangles(gfx++, 0, 6, 7, 0, 1, 0, 7, 0);
+ gSP2Triangles(gfx++, 1, 7, 8, 0, 1, 8, 9, 0);
+ gSP2Triangles(gfx++, 1, 9, 2, 0, 2, 9, 6, 0);
+ break;
+ }
+
+ } else {
+ switch (this->fadeType) {
+ case TYPE_TRANSPARENT_TRIFORCE:
+ break;
+
+ case TYPE_FILLED_TRIFORCE:
+ gSP1Quadrangle(gfx++, 6, 7, 8, 9, 0);
+ break;
+ }
+ }
+ gDPPipeSync(gfx++);
+ *gfxP = gfx;
+}
+
+s32 TransitionTriforce_IsDone(void* thisx) {
+ TransitionTriforce* this = (TransitionTriforce*)thisx;
+
+ if ((this->state == STATE_SPIRAL_IN_SLOW) || (this->state == STATE_SPIRAL_IN_FAST)) {
+ return this->transPos <= 0.03f;
+ } else if ((this->state == STATE_SPIRAL_OUT_SLOW) || (this->state == STATE_SPIRAL_OUT_FAST)) {
+ return (this->transPos >= 1.0f);
+ }
+ return false;
+}
diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h
index 7d7dcae56..2637b32cf 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h
+++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h
@@ -3,8 +3,29 @@
#include "global.h"
+typedef enum {
+ /* 0 */ STATE_NONE,
+ /* 1 */ STATE_SPIRAL_IN_SLOW,
+ /* 2 */ STATE_SPIRAL_IN_FAST,
+ /* 3 */ STATE_SPIRAL_OUT_SLOW,
+ /* 4 */ STATE_SPIRAL_OUT_FAST
+} FbTriforceState;
+
+typedef enum {
+ /* 0 */ TYPE_NONE,
+ /* 1 */ TYPE_TRANSPARENT_TRIFORCE,
+ /* 2 */ TYPE_FILLED_TRIFORCE
+} TriforceFadeType;
+
typedef struct {
- /* 0x0000 */ char unk_0[0x1E0];
+ /* 0x000 */ Color_RGBA8_u32 color;
+ /* 0x004 */ f32 transPos;
+ /* 0x008 */ f32 step;
+ /* 0x00C */ s32 state;
+ /* 0x010 */ s32 fadeType;
+ /* 0x018 */ Mtx projection;
+ /* 0x058 */ s32 frame;
+ /* 0x060 */ Mtx modelView[2][3];
} TransitionTriforce; // size = 0x1E0
extern const TransitionInit TransitionTriforce_InitVars;
diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
index eac0b8f59..ad5230253 100644
--- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
+++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
@@ -63,7 +63,7 @@ UNK_TYPE D_808158E0[] = {
0x00000001, 0x00000000,
};
-void Daytelop_Update(DaytelopContext* this, GameState* gameState) {
+void DayTelop_Update(DayTelopState* this, GameState* thisx) {
static u8 D_80815FF0 = 0;
s16 new_var;
u8 temp_v0_2;
@@ -77,12 +77,9 @@ void Daytelop_Update(DaytelopContext* this, GameState* gameState) {
gSaveContext.save.day = 1;
}
- {
- GameState* state = &this->state;
- state->running = 0;
- }
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
- SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
gSaveContext.save.time = CLOCK_TIME(6, 0);
D_801BDBC8 = 0xFE;
} else if (this->transitionCountdown == 90) {
@@ -126,7 +123,7 @@ TexturePtr sHoursLeftTextures[] = {
gDaytelop24HoursNESTex,
};
-void Daytelop_Draw(DaytelopContext* this) {
+void DayTelop_Draw(DayTelopState* this) {
GraphicsContext* gfxCtx = this->state.gfxCtx;
OPEN_DISPS(gfxCtx);
@@ -187,11 +184,11 @@ void Daytelop_Draw(DaytelopContext* this) {
0x0400, 0x0400);
}
- CLOSE_DISPS(this->state.gfxCtx);
+ CLOSE_DISPS(gfxCtx);
}
-void Daytelop_Main(GameState* thisx) {
- DaytelopContext* this = (DaytelopContext*)thisx;
+void DayTelop_Main(GameState* thisx) {
+ DayTelopState* this = (DayTelopState*)thisx;
func_8012CF0C(this->state.gfxCtx, true, true, 0, 0, 0);
@@ -200,18 +197,18 @@ void Daytelop_Main(GameState* thisx) {
gSPSegment(POLY_OPA_DISP++, 0x0C, this->gameoverStaticFile);
CLOSE_DISPS(this->state.gfxCtx);
- Daytelop_Draw(this);
- Daytelop_Update(this, &this->state);
+ DayTelop_Draw(this);
+ DayTelop_Update(this, &this->state);
}
-void Daytelop_Destroy(GameState* thisx) {
+void DayTelop_Destroy(GameState* thisx) {
ShrinkWindow_Destroy();
}
-void Daytelop_nop80815770(DaytelopContext* this) {
+void DayTelop_Noop(DayTelopState* this) {
}
-void Daytelop_LoadGraphics(DaytelopContext* this) {
+void DayTelop_LoadGraphics(DayTelopState* this) {
size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static);
this->daytelopStaticFile = THA_AllocEndAlign16(&this->state.heap, segmentSize);
@@ -222,15 +219,15 @@ void Daytelop_LoadGraphics(DaytelopContext* this) {
DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize);
}
-void Daytelop_Init(GameState* thisx) {
- DaytelopContext* this = (DaytelopContext*)thisx;
+void DayTelop_Init(GameState* thisx) {
+ DayTelopState* this = (DayTelopState*)thisx;
- Game_SetFramerateDivisor(thisx, 1);
- Matrix_Init(thisx);
+ Game_SetFramerateDivisor(&this->state, 1);
+ Matrix_Init(&this->state);
ShrinkWindow_Destroy();
- View_Init(&this->view, thisx->gfxCtx);
- thisx->main = Daytelop_Main;
- thisx->destroy = Daytelop_Destroy;
+ View_Init(&this->view, this->state.gfxCtx);
+ this->state.main = DayTelop_Main;
+ this->state.destroy = DayTelop_Destroy;
this->transitionCountdown = 140;
this->fadeInState = DAYTELOP_HOURSTEXT_OFF;
@@ -241,7 +238,7 @@ void Daytelop_Init(GameState* thisx) {
Sram_IncrementDay();
}
- Daytelop_nop80815770(this);
- Daytelop_LoadGraphics(this);
+ DayTelop_Noop(this);
+ DayTelop_LoadGraphics(this);
play_sound(NA_SE_OC_TELOP_IMPACT);
}
diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.h b/src/overlays/gamestates/ovl_daytelop/z_daytelop.h
index d77a5f334..a7350e898 100644
--- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.h
+++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.h
@@ -3,8 +3,8 @@
#include "global.h"
-void Daytelop_Init(GameState* thisx);
-void Daytelop_Destroy(GameState* thisx);
+void DayTelop_Init(GameState* thisx);
+void DayTelop_Destroy(GameState* thisx);
typedef struct {
/* 0x000 */ GameState state;
@@ -16,12 +16,12 @@ typedef struct {
/* 0x240 */ s16 transitionCountdown;
/* 0x242 */ s16 fadeInState;
/* 0x244 */ s16 alpha;
-} DaytelopContext; // size = 0x248
+} DayTelopState; // size = 0x248
typedef enum {
/* 0 */ DAYTELOP_HOURSTEXT_OFF,
/* 1 */ DAYTELOP_HOURSTEXT_FADEIN,
/* 2 */ DAYTELOP_HOURSTEXT_ON
-} Daytelop_FadeState;
+} DaytelopFadeState;
#endif
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h
index 4184ca576..f3231ec56 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.h
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.h
@@ -3,10 +3,10 @@
#include "global.h"
-void FileChoose_Init(GameState* thisx);
-void FileChoose_Destroy(GameState* thisx);
+void FileSelect_Init(GameState* thisx);
+void FileSelect_Destroy(GameState* thisx);
-typedef struct FileChooseContext {
+typedef struct FileSelectState {
/* 0x00000 */ GameState state;
/* 0x000A4 */ Vtx* unk_A4;
/* 0x000A8 */ u8* staticSegment;
@@ -110,6 +110,6 @@ typedef struct FileChooseContext {
/* 0x2454C */ s16 unk_2454C;
/* 0x2454E */ s16 unk_2454E;
/* 0x24550 */ s16 unk_24550;
-} FileChooseContext; // size = 0x24558
+} FileSelectState; // size = 0x24558
#endif
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
index 62ea8ef7e..657a2530f 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
@@ -19,15 +19,15 @@ extern GfxMasterList D_0E000000;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/func_8080BC20.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileChoose_nop8080bc44.s")
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileSelect_nop8080bc44.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileChoose_nop8080BC4C.s")
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileSelect_nop8080BC4C.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/func_8080BC58.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/func_8080BDAC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileChoose_RenderView.s")
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileSelect_RenderView.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/func_8080BE60.s")
@@ -85,13 +85,13 @@ extern GfxMasterList D_0E000000;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/func_80812ED0.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileChoose_UpdateAndDrawSkybox.s")
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileSelect_UpdateAndDrawSkybox.s")
-void FileChoose_Main(GameState* thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileChoose_Main.s")
+void FileSelect_Main(GameState* thisx);
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileSelect_Main.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/func_80813908.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileChoose_Destroy.s")
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileSelect_Destroy.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileChoose_Init.s")
+#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_file_choose/FileSelect_Init.s")
diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c
index bc5e46940..b7e5ec378 100644
--- a/src/overlays/gamestates/ovl_opening/z_opening.c
+++ b/src/overlays/gamestates/ovl_opening/z_opening.c
@@ -6,55 +6,53 @@
#include "z_opening.h"
-void Opening_SetupForTitleCutscene(OpeningContext* this) {
- static s32 openingEntrances[] = { ENTRANCE(CUTSCENE, 0), ENTRANCE(CUTSCENE, 1) };
- static s32 openingCutscenes[] = { 0xFFFA, 0xFFFA };
+void TitleSetup_SetupTitleScreen(TitleSetupState* this) {
+ static s32 sOpeningEntrances[] = { ENTRANCE(CUTSCENE, 0), ENTRANCE(CUTSCENE, 1) };
+ static s32 sOpeningCutscenes[] = { 0xFFFA, 0xFFFA };
gSaveContext.eventInf[1] &= (u8)~0x80;
gSaveContext.gameMode = 1;
Sram_InitNewSave();
- gSaveContext.save.entrance = openingEntrances[D_801BB12C];
- gSaveContext.nextCutsceneIndex = gSaveContext.save.cutscene = openingCutscenes[D_801BB12C];
+ gSaveContext.save.entrance = sOpeningEntrances[D_801BB12C];
+ gSaveContext.nextCutsceneIndex = gSaveContext.save.cutscene = sOpeningCutscenes[D_801BB12C];
gSaveContext.sceneSetupIndex = 0;
gSaveContext.save.time = CLOCK_TIME(8, 0);
gSaveContext.save.day = 1;
- {
- GameState* thisx = &this->gameState;
- thisx->running = false;
- }
- SET_NEXT_GAMESTATE(&this->gameState, Play_Init, PlayState);
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
+
gSaveContext.save.playerForm = PLAYER_FORM_HUMAN;
}
-void func_80803EA0(OpeningContext* this) {
+void func_80803EA0(TitleSetupState* this) {
SREG(33) |= 1;
}
-void Opening_Main(GameState* thisx) {
- OpeningContext* this = (OpeningContext*)thisx;
+void TitleSetup_Main(GameState* thisx) {
+ TitleSetupState* this = (TitleSetupState*)thisx;
- func_8012CF0C(this->gameState.gfxCtx, false, true, 0, 0, 0);
- Opening_SetupForTitleCutscene(this);
+ func_8012CF0C(this->state.gfxCtx, false, true, 0, 0, 0);
+ TitleSetup_SetupTitleScreen(this);
func_80803EA0(this);
}
-void Opening_Destroy(GameState* thisx) {
+void TitleSetup_Destroy(GameState* thisx) {
ShrinkWindow_Destroy();
}
-void Opening_Init(GameState* thisx) {
- OpeningContext* this = (OpeningContext*)thisx;
+void TitleSetup_Init(GameState* thisx) {
+ TitleSetupState* this = (TitleSetupState*)thisx;
- Game_SetFramerateDivisor(&this->gameState, 1);
- Matrix_Init(&this->gameState);
+ Game_SetFramerateDivisor(&this->state, 1);
+ Matrix_Init(&this->state);
ShrinkWindow_Init();
- View_Init(&this->view, this->gameState.gfxCtx);
- this->gameState.main = Opening_Main;
- this->gameState.destroy = Opening_Destroy;
+ View_Init(&this->view, this->state.gfxCtx);
+ this->state.main = TitleSetup_Main;
+ this->state.destroy = TitleSetup_Destroy;
gSaveContext.respawnFlag = 0;
gSaveContext.respawn[RESPAWN_MODE_GORON].entrance = 0xFF;
diff --git a/src/overlays/gamestates/ovl_opening/z_opening.h b/src/overlays/gamestates/ovl_opening/z_opening.h
index 809767fe4..36a01ffe9 100644
--- a/src/overlays/gamestates/ovl_opening/z_opening.h
+++ b/src/overlays/gamestates/ovl_opening/z_opening.h
@@ -3,13 +3,13 @@
#include "global.h"
-void Opening_Init(GameState* thisx);
-void Opening_Destroy(GameState* thisx);
+void TitleSetup_Init(GameState* thisx);
+void TitleSetup_Destroy(GameState* thisx);
typedef struct {
- /* 0x000 */ GameState gameState;
+ /* 0x000 */ GameState state;
/* 0x0A4 */ UNK_TYPE1 unk_A4[0x4];
/* 0x0A8 */ View view;
-} OpeningContext; // size = 0x210
+} TitleSetupState; // size = 0x210
#endif
diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c
index e68e487aa..93b873de5 100644
--- a/src/overlays/gamestates/ovl_select/z_select.c
+++ b/src/overlays/gamestates/ovl_select/z_select.c
@@ -8,13 +8,9 @@
#include "libc/alloca.h"
#include "overlays/gamestates/ovl_title/z_title.h"
-void MapSelect_LoadTitle(MapSelectState* this) {
- {
- GameState* gameState = &this->state;
- gameState->running = false;
- }
-
- SET_NEXT_GAMESTATE(&this->state, Title_Init, TitleContext);
+void MapSelect_LoadConsoleLogo(MapSelectState* this) {
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, ConsoleLogo_Init, sizeof(ConsoleLogoState));
}
void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) {
@@ -55,11 +51,8 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) {
gSaveContext.respawn[RESPAWN_MODE_HUMAN].entrance = 0xFF;
gWeatherMode = 0;
- do {
- GameState* gameState = &this->state;
- gameState->running = false;
- } while (0);
- SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
}
// "Translation" (Actual name)
@@ -501,7 +494,7 @@ static SceneSelectEntry sScenes[] = {
{ "X 1:SPOT00", MapSelect_LoadGame, ENTRANCE(CUTSCENE, 0) },
// "Title" (Title Screen)
- { "title", (void*)MapSelect_LoadTitle, 0 },
+ { "title", (void*)MapSelect_LoadConsoleLogo, 0 },
};
void MapSelect_UpdateMenu(MapSelectState* this) {
diff --git a/src/overlays/gamestates/ovl_select/z_select.h b/src/overlays/gamestates/ovl_select/z_select.h
index efe5f9945..69312e986 100644
--- a/src/overlays/gamestates/ovl_select/z_select.h
+++ b/src/overlays/gamestates/ovl_select/z_select.h
@@ -5,11 +5,11 @@
struct MapSelectState;
-typedef void (*Select_LoadFunc)(struct MapSelectState*, u32, s32);
+typedef void (*SelectLoadFunc)(struct MapSelectState*, u32, s32);
typedef struct {
/* 0x00 */ char* name;
- /* 0x04 */ Select_LoadFunc loadFunc;
+ /* 0x04 */ SelectLoadFunc loadFunc;
/* 0x08 */ s32 entrance;
} SceneSelectEntry; // size = 0xC
diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c
index 68488b336..352997f94 100644
--- a/src/overlays/gamestates/ovl_title/z_title.c
+++ b/src/overlays/gamestates/ovl_title/z_title.c
@@ -8,7 +8,7 @@
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "misc/nintendo_rogo_static/nintendo_rogo_static.h"
-void Title_UpdateCounters(TitleContext* this) {
+void ConsoleLogo_UpdateCounters(ConsoleLogoState* this) {
if ((this->coverAlpha == 0) && (this->visibleDuration != 0)) {
this->timer--;
this->visibleDuration--;
@@ -32,7 +32,7 @@ void Title_UpdateCounters(TitleContext* this) {
this->ult++;
}
-void Title_RenderView(TitleContext* this, f32 x, f32 y, f32 z) {
+void ConsoleLogo_RenderView(ConsoleLogoState* this, f32 x, f32 y, f32 z) {
View* view = &this->view;
Vec3f eye;
Vec3f at;
@@ -49,10 +49,10 @@ void Title_RenderView(TitleContext* this, f32 x, f32 y, f32 z) {
View_RenderView(view, 0xF);
}
-void Title_Draw(GameState* thisx) {
- static s16 titleRotation = 0;
+void ConsoleLogo_Draw(GameState* thisx) {
+ static s16 sTitleRotation = 0;
static Lights1 sTitleLights = gdSPDefLights1(100, 100, 100, 255, 255, 255, 69, 69, 69);
- TitleContext* this = (TitleContext*)thisx;
+ ConsoleLogoState* this = (ConsoleLogoState*)thisx;
u16 y;
u16 idx;
Vec3f lightDir;
@@ -60,7 +60,7 @@ void Title_Draw(GameState* thisx) {
Vec3f eye;
s32 pad[2];
- OPEN_DISPS(this->gameState.gfxCtx);
+ OPEN_DISPS(this->state.gfxCtx);
lightDir.x = 69.0f;
lightDir.y = 69.0f;
@@ -74,20 +74,20 @@ void Title_Draw(GameState* thisx) {
eye.y = 4002.5417f;
eye.z = 1119.0837f;
- Hilite_DrawOpa(&object, &eye, &lightDir, this->gameState.gfxCtx);
+ Hilite_DrawOpa(&object, &eye, &lightDir, this->state.gfxCtx);
gSPSetLights1(POLY_OPA_DISP++, sTitleLights);
- Title_RenderView(this, 0.0f, 150.0f, 300.0f);
- func_8012C28C(this->gameState.gfxCtx);
+ ConsoleLogo_RenderView(this, 0.0f, 150.0f, 300.0f);
+ func_8012C28C(this->state.gfxCtx);
Matrix_Translate(-53.0f, -5.0f, 0.0f, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
- Matrix_RotateZYX(0, titleRotation, 0, MTXMODE_APPLY);
+ Matrix_RotateZYX(0, sTitleRotation, 0, MTXMODE_APPLY);
- gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(this->gameState.gfxCtx), G_MTX_LOAD);
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(this->state.gfxCtx), G_MTX_LOAD);
gSPDisplayList(POLY_OPA_DISP++, gNintendo64LogoNDL);
- func_8012C628(this->gameState.gfxCtx);
+ func_8012C628(this->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_2CYCLE);
@@ -109,62 +109,58 @@ void Title_Draw(GameState* thisx) {
1 << 10, 1 << 10);
}
- func_800FC444(this->gameState.gfxCtx, 0, 0, 0, this->coverAlpha, 2);
+ func_800FC444(this->state.gfxCtx, 0, 0, 0, this->coverAlpha, 2);
- titleRotation += 300;
+ sTitleRotation += 300;
- CLOSE_DISPS(this->gameState.gfxCtx);
+ CLOSE_DISPS(this->state.gfxCtx);
}
-void Title_Main(GameState* thisx) {
- TitleContext* this = (TitleContext*)thisx;
+void ConsoleLogo_Main(GameState* thisx) {
+ ConsoleLogoState* this = (ConsoleLogoState*)thisx;
- func_8012CF0C(this->gameState.gfxCtx, true, true, 0, 0, 0);
+ func_8012CF0C(this->state.gfxCtx, true, true, 0, 0, 0);
- OPEN_DISPS(this->gameState.gfxCtx);
+ OPEN_DISPS(this->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x01, this->staticSegment);
- Title_UpdateCounters(this);
- Title_Draw(&this->gameState);
+ ConsoleLogo_UpdateCounters(this);
+ ConsoleLogo_Draw(&this->state);
if (this->exit) {
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.gameMode = 1;
- {
- GameState* gameState = &this->gameState;
- gameState->running = false;
- }
- SET_NEXT_GAMESTATE(&this->gameState, Opening_Init, OpeningContext);
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState));
}
- CLOSE_DISPS(this->gameState.gfxCtx);
+ CLOSE_DISPS(this->state.gfxCtx);
}
-void Title_Destroy(GameState* thisx) {
- TitleContext* this = (TitleContext*)thisx;
+void ConsoleLogo_Destroy(GameState* thisx) {
+ ConsoleLogoState* this = (ConsoleLogoState*)thisx;
- Sram_InitSram(&this->gameState, &this->sramCtx);
+ Sram_InitSram(&this->state, &this->sramCtx);
ShrinkWindow_Destroy();
CIC6105_Nop80081828();
}
-void Title_Init(GameState* thisx) {
- TitleContext* this = (TitleContext*)thisx;
- uintptr_t segmentSize =
- (uintptr_t)_nintendo_rogo_staticSegmentRomEnd - (uintptr_t)_nintendo_rogo_staticSegmentRomStart;
+void ConsoleLogo_Init(GameState* thisx) {
+ ConsoleLogoState* this = (ConsoleLogoState*)thisx;
+ uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static);
- this->staticSegment = THA_AllocEndAlign16(&this->gameState.heap, segmentSize);
- DmaMgr_SendRequest0(this->staticSegment, (uintptr_t)_nintendo_rogo_staticSegmentRomStart, segmentSize);
+ this->staticSegment = THA_AllocEndAlign16(&this->state.heap, segmentSize);
+ DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize);
- Game_SetFramerateDivisor(thisx, 1);
- Matrix_Init(thisx);
+ Game_SetFramerateDivisor(&this->state, 1);
+ Matrix_Init(&this->state);
ShrinkWindow_Init();
- View_Init(&this->view, thisx->gfxCtx);
+ View_Init(&this->view, this->state.gfxCtx);
- thisx->main = Title_Main;
- thisx->destroy = Title_Destroy;
+ this->state.main = ConsoleLogo_Main;
+ this->state.destroy = ConsoleLogo_Destroy;
this->exit = false;
if (!(Padmgr_GetControllerBitmask() & 1)) {
diff --git a/src/overlays/gamestates/ovl_title/z_title.h b/src/overlays/gamestates/ovl_title/z_title.h
index 7f2f34425..0cb19da1a 100644
--- a/src/overlays/gamestates/ovl_title/z_title.h
+++ b/src/overlays/gamestates/ovl_title/z_title.h
@@ -3,11 +3,11 @@
#include "global.h"
-void Title_Init(GameState* thisx);
-void Title_Destroy(GameState* thisx);
+void ConsoleLogo_Init(GameState* thisx);
+void ConsoleLogo_Destroy(GameState* thisx);
typedef struct {
- /* 0x000 */ GameState gameState;
+ /* 0x000 */ GameState state;
/* 0x0A4 */ u8* staticSegment;
/* 0x0A8 */ View view;
/* 0x210 */ SramContext sramCtx;
@@ -18,6 +18,6 @@ typedef struct {
/* 0x240 */ s16 ult;
/* 0x242 */ s16 uls;
/* 0x244 */ u8 exit;
-} TitleContext; // size = 0x248
+} ConsoleLogoState; // size = 0x248
#endif
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 aa24bf2e2..f8f61c5dc 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
@@ -50,18 +50,10 @@ s16 D_8082B6DC[] = {
0x0000,
};
-s32 D_8082B6E4[] = { 0, 0, 0 };
-
-s16 D_8082B6F0[] = { 100, 255 };
-
-s32 D_8082B6F4 = 0;
-
-s16 D_8082B6F8[] = { 10, 0, 0, 0 };
+s16 D_8082B6E4 = 0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081FF80.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808204AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80820FA4.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821730.s")
diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c
new file mode 100644
index 000000000..53453e8e7
--- /dev/null
+++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c
@@ -0,0 +1,49 @@
+/*
+ * File: z_kaleido_prompt.c
+ * Overlay: ovl_kaleido_scope
+ * Description: Pause Menu - Save and Continue Prompt
+ */
+
+#include "z_kaleido_scope.h"
+
+s16 sPromptAlphaTargets[] = { 100, 255 };
+
+// Unused remnant of OoT
+void KaleidoScope_UpdatePrompt(PlayState* play) {
+ static s16 sPromptAlphaTargetIndex = 0;
+ static s16 sPromptAlphaTimer = 10;
+ PauseContext* pauseCtx = &play->pauseCtx;
+ Input* input = CONTROLLER1(&play->state);
+ s8 relStickX = input->rel.stick_x;
+ s16 alphaStep;
+
+ if (((pauseCtx->state == 7) && (pauseCtx->unk_208 == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x11)) {
+
+ // Move the prompt
+ if ((pauseCtx->promptChoice == PAUSE_PROMPT_YES) && (relStickX >= 30)) {
+ // Move right to the no prompt
+ play_sound(NA_SE_SY_CURSOR);
+ pauseCtx->promptChoice = PAUSE_PROMPT_NO;
+ } else if ((pauseCtx->promptChoice != PAUSE_PROMPT_YES) && (relStickX <= -30)) {
+ // Move left to the yes prompt
+ play_sound(NA_SE_SY_CURSOR);
+ pauseCtx->promptChoice = PAUSE_PROMPT_YES;
+ }
+
+ // Update the alpha for the green glowing orb above the prompt
+ alphaStep = ABS_ALT(pauseCtx->promptAlpha - sPromptAlphaTargets[sPromptAlphaTargetIndex]) / sPromptAlphaTimer;
+
+ if (pauseCtx->promptAlpha >= sPromptAlphaTargets[sPromptAlphaTargetIndex]) {
+ pauseCtx->promptAlpha -= alphaStep;
+ } else {
+ pauseCtx->promptAlpha += alphaStep;
+ }
+
+ sPromptAlphaTimer--;
+ if (sPromptAlphaTimer == 0) {
+ pauseCtx->promptAlpha = sPromptAlphaTargets[sPromptAlphaTargetIndex];
+ sPromptAlphaTimer = sPromptAlphaTargetIndex + 20;
+ sPromptAlphaTargetIndex ^= 1;
+ }
+ }
+}
diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h
index f4c91e9e8..b4d2a192f 100644
--- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h
+++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h
@@ -18,6 +18,9 @@ typedef enum {
/* 3 */ DEBUG_EDITOR_EVENTS
} DebugEditor;
+#define PAUSE_PROMPT_YES 0
+#define PAUSE_PROMPT_NO 4
+
// Debug
void KaleidoScope_DrawInventoryEditor(PlayState* play);
void KaleidoScope_UpdateInventoryEditor(PlayState* play);
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 9f02ee601..58913229c 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -3116,10 +3116,10 @@
0x80172ED0:("AudioMgr_ThreadEntry",),
0x80173048:("AudioMgr_Unlock",),
0x80173074:("AudioMgr_Init",),
- 0x80173130:("TitleSetup_GameStateResetContext",),
- 0x801732DC:("TitleSetup_InitImpl",),
- 0x8017332C:("TitleSetup_Destroy",),
- 0x80173338:("TitleSetup_Init",),
+ 0x80173130:("Setup_SetRegs",),
+ 0x801732DC:("Setup_InitImpl",),
+ 0x8017332C:("Setup_Destroy",),
+ 0x80173338:("Setup_Init",),
0x80173360:("Game_UpdateFramerateVariables",),
0x801733A8:("Game_SetFramerateDivisor",),
0x801733DC:("GameState_SetFBFilter",),
@@ -3134,8 +3134,8 @@
0x80173880:("GameState_Realloc",),
0x80173950:("GameState_Init",),
0x80173A50:("GameState_Destroy",),
- 0x80173B00:("GameState_GetNextStateInit",),
- 0x80173B0C:("GameState_GetNextStateSize",),
+ 0x80173B00:("GameState_GetInit",),
+ 0x80173B0C:("GameState_GetSize",),
0x80173B18:("GameState_IsRunning",),
0x80173B24:("GameState_GetArenaSize",),
0x80173B48:("func_80173B48",),
@@ -3546,8 +3546,8 @@
0x8018A808:("func_8018A808",),
0x8018ACC4:("func_8018ACC4",),
0x8018AE34:("func_8018AE34",),
- 0x8018B0F0:("func_8018B0F0",),
- 0x8018B10C:("func_8018B10C",),
+ 0x8018B0F0:("AudioHeap_CalculateAdsrDecay",),
+ 0x8018B10C:("AudioHeap_InitAdsrDecayTable",),
0x8018B250:("AudioHeap_ResetLoadStatus",),
0x8018B318:("AudioHeap_DiscardFont",),
0x8018B3FC:("AudioHeap_ReleaseNotesForFont",),
@@ -3560,16 +3560,16 @@
0x8018B640:("AudioHeap_AllocZeroed",),
0x8018B69C:("AudioHeap_TestAlloc",),
0x8018B6E8:("AudioHeap_Alloc",),
- 0x8018B740:("AudioHeap_AllocPoolInit",),
- 0x8018B768:("AudioHeap_ClearPersistentCache",),
- 0x8018B77C:("AudioHeap_ClearTemporaryCache",),
+ 0x8018B740:("AudioHeap_InitPool",),
+ 0x8018B768:("AudioHeap_InitPersistentCache",),
+ 0x8018B77C:("AudioHeap_InitTemporaryCache",),
0x8018B7AC:("AudioHeap_ResetPool",),
- 0x8018B7BC:("AudioHeap_PopCache",),
+ 0x8018B7BC:("AudioHeap_PopPersistentCache",),
0x8018B8FC:("AudioHeap_InitMainPool",),
0x8018B95C:("AudioHeap_InitSessionPool",),
0x8018B9E0:("AudioHeap_InitCachePool",),
- 0x8018BA64:("AudioHeap_InitPersistentCache",),
- 0x8018BB28:("AudioHeap_InitTemporaryCache",),
+ 0x8018BA64:("AudioHeap_InitPersistentPoolsAndCaches",),
+ 0x8018BB28:("AudioHeap_InitTemporaryPoolsAndCaches",),
0x8018BBEC:("AudioHeap_AllocCached",),
0x8018C380:("AudioHeap_SearchCaches",),
0x8018C3D8:("AudioHeap_SearchRegularCaches",),
@@ -3645,7 +3645,7 @@
0x80190B08:("AudioLoad_ProcessLoads",),
0x80190B38:("AudioLoad_SetDmaHandler",),
0x80190B44:("AudioLoad_SetUnusedHandler",),
- 0x80190B50:("AudioLoad_InitSoundFontMeta",),
+ 0x80190B50:("AudioLoad_InitSoundFont",),
0x80190BB0:("AudioLoad_Init",),
0x80190F50:("AudioLoad_InitSlowLoads",),
0x80190F64:("AudioLoad_SlowLoadSample",),
@@ -3731,10 +3731,10 @@
0x80194E60:("AudioPlayback_NoteInit",),
0x80194F20:("AudioPlayback_NoteDisable",),
0x80194F84:("AudioPlayback_ProcessNotes",),
- 0x801954CC:("AudioPlayback_InstrumentGetSound",),
+ 0x801954CC:("AudioPlayback_GetInstrumentTunedSample",),
0x80195508:("AudioPlayback_GetInstrumentInner",),
0x801955DC:("AudioPlayback_GetDrum",),
- 0x801956C0:("AudioPlayback_GetSfx",),
+ 0x801956C0:("AudioPlayback_GetSoundEffect",),
0x801957B4:("AudioPlayback_SetFontInstrument",),
0x801958F8:("AudioPlayback_SeqLayerDecayRelease",),
0x80195C40:("AudioPlayback_SeqLayerNoteDecay",),
@@ -4083,13 +4083,13 @@
0x801AA624:("GameOver_FadeLights",),
0x801AA68C:("GameOver_Update",),
0x801AAAA0:("func_801AAAA0",),
- 0x80800000:("Title_UpdateCounters",),
- 0x8080009C:("Title_RenderView",),
- 0x80800134:("Title_Draw",),
- 0x8080066C:("Title_Main",),
- 0x8080071C:("Title_Destroy",),
- 0x8080074C:("Title_Init",),
- 0x80800910:("MapSelect_LoadTitle",),
+ 0x80800000:("ConsoleLogo_UpdateCounters",),
+ 0x8080009C:("ConsoleLogo_RenderView",),
+ 0x80800134:("ConsoleLogo_Draw",),
+ 0x8080066C:("ConsoleLogo_Main",),
+ 0x8080071C:("ConsoleLogo_Destroy",),
+ 0x8080074C:("ConsoleLogo_Init",),
+ 0x80800910:("MapSelect_LoadConsoleLogo",),
0x80800930:("MapSelect_LoadGame",),
0x80800A44:("MapSelect_UpdateMenu",),
0x808013B8:("MapSelect_PrintMenu",),
@@ -4102,11 +4102,11 @@
0x80801AFC:("MapSelect_Main",),
0x80801B28:("MapSelect_Destroy",),
0x80801B4C:("MapSelect_Init",),
- 0x80803DF0:("Opening_SetupForTitleCutscene",),
+ 0x80803DF0:("TitleSetup_SetupTitleScreen",),
0x80803EA0:("func_80803EA0",),
- 0x80803EC0:("Opening_Main",),
- 0x80803F0C:("Opening_Destroy",),
- 0x80803F30:("Opening_Init",),
+ 0x80803EC0:("TitleSetup_Main",),
+ 0x80803F0C:("TitleSetup_Destroy",),
+ 0x80803F30:("TitleSetup_Init",),
0x80804010:("func_80804010",),
0x808041A0:("func_808041A0",),
0x80804654:("func_80804654",),
@@ -4152,11 +4152,11 @@
0x8080A708:("func_8080A708",),
0x8080BBFC:("func_8080BBFC",),
0x8080BC20:("func_8080BC20",),
- 0x8080BC44:("FileChoose_nop8080bc44",),
- 0x8080BC4C:("FileChoose_nop8080BC4C",),
+ 0x8080BC44:("FileSelect_nop8080bc44",),
+ 0x8080BC4C:("FileSelect_nop8080BC4C",),
0x8080BC58:("func_8080BC58",),
0x8080BDAC:("func_8080BDAC",),
- 0x8080BDDC:("FileChoose_RenderView",),
+ 0x8080BDDC:("FileSelect_RenderView",),
0x8080BE60:("func_8080BE60",),
0x8080C040:("func_8080C040",),
0x8080C228:("func_8080C228",),
@@ -4185,18 +4185,18 @@
0x80812D94:("func_80812D94",),
0x80812E94:("func_80812E94",),
0x80812ED0:("func_80812ED0",),
- 0x8081313C:("FileChoose_UpdateAndDrawSkybox",),
- 0x80813268:("FileChoose_Main",),
+ 0x8081313C:("FileSelect_UpdateAndDrawSkybox",),
+ 0x80813268:("FileSelect_Main",),
0x80813908:("func_80813908",),
- 0x80813C74:("FileChoose_Destroy",),
- 0x80813C98:("FileChoose_Init",),
- 0x80814EB0:("Daytelop_Update",),
- 0x80814FE8:("Daytelop_Draw",),
- 0x808156B4:("Daytelop_Main",),
- 0x8081574C:("Daytelop_Destroy",),
- 0x80815770:("Daytelop_nop80815770",),
- 0x8081577C:("Daytelop_LoadGraphics",),
- 0x80815820:("Daytelop_Init",),
+ 0x80813C74:("FileSelect_Destroy",),
+ 0x80813C98:("FileSelect_Init",),
+ 0x80814EB0:("DayTelop_Update",),
+ 0x80814FE8:("DayTelop_Draw",),
+ 0x808156B4:("DayTelop_Main",),
+ 0x8081574C:("DayTelop_Destroy",),
+ 0x80815770:("DayTelop_Noop",),
+ 0x8081577C:("DayTelop_LoadGraphics",),
+ 0x80815820:("DayTelop_Init",),
0x808160A0:("func_808160A0",),
0x80817B5C:("func_80817B5C",),
0x80818904:("func_80818904",),
@@ -4217,7 +4217,7 @@
0x8081FF80:("func_8081FF80",),
0x808204AC:("func_808204AC",),
0x80820FA4:("func_80820FA4",),
- 0x80821730:("func_80821730",),
+ 0x80821730:("KaleidoScope_UpdatePrompt",),
0x80821900:("func_80821900",),
0x8082192C:("func_8082192C",),
0x80821958:("func_80821958",),
@@ -8129,16 +8129,16 @@
0x809765A0:("OceffWipe_Draw",),
0x80977210:("EffectSsDust_Init",),
0x80977394:("EffectSsDust_Draw",),
- 0x809776BC:("func_809776BC",),
- 0x809777B4:("func_809777B4",),
+ 0x809776BC:("EffectSsDust_Update",),
+ 0x809777B4:("EffectSsDust_UpdateFire",),
0x80977A00:("EffectSsKirakira_Init",),
0x80977B5C:("EffectSsKirakira_Draw",),
0x80977DB4:("func_80977DB4",),
0x80977E6C:("func_80977E6C",),
0x80977F28:("func_80977F28",),
0x80978070:("EffectSsBomb2_Init",),
- 0x80978138:("func_80978138",),
- 0x80978304:("func_80978304",),
+ 0x80978138:("EffectSsBomb2_DrawFade",),
+ 0x80978304:("EffectSsBomb2_DrawLayered",),
0x80978628:("EffectSsBomb2_Update",),
0x809788D0:("EffectSsBlast_Init",),
0x809789FC:("EffectSsBlast_Draw",),
@@ -8147,7 +8147,7 @@
0x80978D70:("EffectSsGSpk_Draw",),
0x80978F40:("EffectSsGSpk_Update",),
0x80979068:("EffectSsGSpk_UpdateNoAccel",),
- 0x809791B0:("func_809791B0",),
+ 0x809791B0:("EffectSsDFire_CheckForObject",),
0x80979228:("EffectSsDFire_Init",),
0x8097930C:("EffectSsDFire_Draw",),
0x809794D4:("EffectSsDFire_Update",),
@@ -11270,7 +11270,7 @@
0x80A8BFE0:("EnTrt_GetMushroom",),
0x80A8C168:("EnTrt_PayForMushroom",),
0x80A8C1E8:("EnTrt_Goodbye",),
- 0x80A8C288:("EnTrt_SetupTryToGiveRedPotion",),
+ 0x80A8C288:("EnTrt_StartRedPotionConversation",),
0x80A8C488:("EnTrt_GiveRedPotionForKoume",),
0x80A8C564:("EnTrt_GivenRedPotionForKoume",),
0x80A8C64C:("EnTrt_EndConversation",),
@@ -11327,8 +11327,8 @@
0x80A8F7AC:("EnTrt_Init",),
0x80A8F7E8:("EnTrt_Destroy",),
0x80A8F828:("EnTrt_Update",),
- 0x80A8F8C4:("EnTrt_UpdateHeadYawAndPitch",),
- 0x80A8FA00:("EnTrt_UpdateHeadPosAndRot",),
+ 0x80A8F8C4:("EnTrt_TrackPlayer",),
+ 0x80A8FA00:("EnTrt_UpdateLimb",),
0x80A8FB34:("EnTrt_OverrideLimbDraw",),
0x80A8FBB4:("EnTrt_PostLimbDraw",),
0x80A8FC64:("EnTrt_TransformLimbDraw",),
@@ -11956,7 +11956,7 @@
0x80AC5154:("TransitionTriforce_Update",),
0x80AC5268:("TransitionTriforce_SetColor",),
0x80AC5274:("TransitionTriforce_SetType",),
- 0x80AC5280:("func_80AC5280",),
+ 0x80AC5280:("TransitionTriforce_SetState",),
0x80AC528C:("TransitionTriforce_Draw",),
0x80AC559C:("TransitionTriforce_IsDone",),
0x80AC57B0:("TransitionWipe1_Start",),
@@ -12163,7 +12163,7 @@
0x80AD3054:("BgCtowerGear_UpdateOrgan",),
0x80AD3124:("BgCtowerGear_Draw",),
0x80AD3164:("BgCtowerGear_DrawOrgan",),
- 0x80AD3380:("func_80AD3380",),
+ 0x80AD3380:("EnTrt2_ChangeAnim",),
0x80AD341C:("func_80AD341C",),
0x80AD349C:("func_80AD349C",),
0x80AD3530:("func_80AD3530",),
@@ -14230,15 +14230,15 @@
0x80B64DFC:("func_80B64DFC",),
0x80B654C0:("ObjKendoKanban_Init",),
0x80B65840:("ObjKendoKanban_Destroy",),
- 0x80B65880:("func_80B65880",),
- 0x80B65894:("func_80B65894",),
- 0x80B658A4:("func_80B658A4",),
- 0x80B65CE0:("func_80B65CE0",),
- 0x80B65D54:("func_80B65D54",),
- 0x80B65D68:("func_80B65D68",),
- 0x80B65DA8:("func_80B65DA8",),
- 0x80B6618C:("func_80B6618C",),
- 0x80B66304:("func_80B66304",),
+ 0x80B65880:("ObjKendoKanban_SetupDoNothing",),
+ 0x80B65894:("ObjKendoKanban_DoNothing",),
+ 0x80B658A4:("ObjKendoKanban_SetupTumble",),
+ 0x80B65CE0:("ObjKendoKanban_Tumble",),
+ 0x80B65D54:("ObjKendoKanban_SetupSettled",),
+ 0x80B65D68:("ObjKendoKanban_Settled",),
+ 0x80B65DA8:("ObjKendoKanban_HandlePhysics",),
+ 0x80B6618C:("ObjKendoKanban_IsPlayerOnTop",),
+ 0x80B66304:("ObjKendoKanban_UpdateCollision",),
0x80B66418:("ObjKendoKanban_Update",),
0x80B66454:("ObjKendoKanban_Draw",),
0x80B66A20:("ObjHariko_Init",),
@@ -16430,8 +16430,8 @@
0x80BFC9E4:("EnRz_Update",),
0x80BFCAD0:("func_80BFCAD0",),
0x80BFCB3C:("EnRz_Draw",),
- 0x80BFCFA0:("func_80BFCFA0",),
- 0x80BFCFB8:("func_80BFCFB8",),
+ 0x80BFCFA0:("EnScopecoin_Spin",),
+ 0x80BFCFB8:("EnScopecoin_CheckCollectible",),
0x80BFD010:("EnScopecoin_Init",),
0x80BFD148:("EnScopecoin_Destroy",),
0x80BFD158:("EnScopecoin_Update",),
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index c0d637b49..dcfe1030b 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -377,12 +377,12 @@
0x801ADEC0:("En_Item00_InitVars","ActorInit","",0x20),
0x801ADEE0:("enItem00CylinderInit","ColliderCylinderInit","",0x2c),
0x801ADF0C:("enItem00InitVars","ActorInitVar","[1]",0x4),
- 0x801ADF10:("D_801ADF10","ColorRGBA8","",0x4),
- 0x801ADF14:("D_801ADF14","ColorRGBA8","",0x4),
- 0x801ADF18:("D_801ADF18","Vec3f","",0xc),
- 0x801ADF24:("D_801ADF24","Vec3f","",0xc),
- 0x801ADF30:("D_801ADF30","UNK_PTR","[5]",0x14),
- 0x801ADF44:("D_801ADF44","UNK_PTR","[12]",0x30),
+ 0x801ADF10:("sEffectPrimColor","ColorRGBA8","",0x4),
+ 0x801ADF14:("sEffectEnvColor","ColorRGBA8","",0x4),
+ 0x801ADF18:("sEffectVelocity","Vec3f","",0xc),
+ 0x801ADF24:("sEffectAccel","Vec3f","",0xc),
+ 0x801ADF30:("sRupeeTextures","UNK_PTR","[5]",0x14),
+ 0x801ADF44:("sItemDropTextures","UNK_PTR","[12]",0x30),
0x801ADF74:("sDropTable","u8","[272]",0x110),
0x801AE084:("sDropTableAmounts","u8","[272]",0x110),
0x801AE194:("D_801AE194","s32","[32]",0x80),
@@ -3814,7 +3814,7 @@
0x801E10B0:("jtbl_801E10B0","UNK_PTR","",0x4),
0x801E10C4:("jtbl_801E10C4","UNK_PTR","",0x4),
0x801E1100:("gAudioTatumInit","s16","[2]",0x4),
- 0x801E1104:("gAudioContextInitSizes","AudioContextInitSizes","",0xC),
+ 0x801E1104:("gAudioHeapInitSizes","AudioHeapInitSizes","",0xC),
0x801E1110:("sGameOverTimer","UNK_TYPE2","",0x2),
0x801E1120:("jtbl_801E1120","UNK_PTR","",0x4),
0x801E1180:("gSoundFontTable","UNK_TYPE2","",0x2),
@@ -4734,9 +4734,9 @@
0x8082B6D4:("D_8082B6D4","UNK_TYPE1","",0x1),
0x8082B6DC:("D_8082B6DC","UNK_TYPE1","",0x1),
0x8082B6E4:("D_8082B6E4","UNK_TYPE2","",0x2),
- 0x8082B6F0:("D_8082B6F0","UNK_TYPE1","",0x1),
- 0x8082B6F4:("D_8082B6F4","UNK_TYPE2","",0x2),
- 0x8082B6F8:("D_8082B6F8","UNK_TYPE2","",0x2),
+ 0x8082B6F0:("sPromptAlphaTargets","UNK_TYPE1","",0x1),
+ 0x8082B6F4:("sPromptAlphaTargetIndex","UNK_TYPE2","",0x2),
+ 0x8082B6F8:("sPromptAlphaTimer","UNK_TYPE2","",0x2),
0x8082B700:("D_8082B700","UNK_TYPE1","",0x1),
0x8082B73C:("D_8082B73C","UNK_TYPE1","",0x1),
0x8082B778:("D_8082B778","UNK_TYPE1","",0x1),
@@ -11090,10 +11090,10 @@
0x80A297D0:("D_80A297D0","f32","",0x4),
0x80A2B870:("D_80A2B870","UNK_TYPE1","",0x1),
0x80A2B88C:("Bg_Dblue_Movebg_InitVars","UNK_TYPE1","",0x1),
- 0x80A2B8AC:("D_80A2B8AC","UNK_TYPE1","",0x1),
- 0x80A2B8DC:("D_80A2B8DC","UNK_TYPE1","",0x1),
- 0x80A2B90C:("D_80A2B90C","UNK_TYPE1","",0x1),
- 0x80A2B93C:("D_80A2B93C","UNK_TYPE1","",0x1),
+ 0x80A2B8AC:("sOpaDLists","UNK_TYPE1","",0x1),
+ 0x80A2B8DC:("sXluDLists","UNK_TYPE1","",0x1),
+ 0x80A2B90C:("sColHeaders","UNK_TYPE1","",0x1),
+ 0x80A2B93C:("sTexAnims","UNK_TYPE1","",0x1),
0x80A2B96C:("D_80A2B96C","UNK_TYPE1","",0x1),
0x80A2B974:("D_80A2B974","UNK_TYPE2","",0x2),
0x80A2B978:("D_80A2B978","UNK_TYPE1","",0x1),
@@ -12339,7 +12339,7 @@
0x80A8B188:("D_80A8B188","UNK_TYPE1","",0x1),
0x80A8B250:("D_80A8B250","UNK_TYPE4","",0x4),
0x80A8B25C:("D_80A8B25C","Color_RGBA8","[6]",0x18),
- 0x80A8B280:("D_80A8B280","UNK_TYPE1","",0x1),
+ 0x80A8B280:("sDustTextures","UNK_TYPE1","",0x1),
0x80A8B2A0:("D_80A8B2A0","UNK_TYPE1","",0x1),
0x80A8B2CC:("D_80A8B2CC","UNK_TYPE1","",0x1),
0x80A8B2D8:("sAnimationInfo","UNK_TYPE1","",0x1),
@@ -12442,8 +12442,8 @@
0x80A9930C:("D_80A9930C","UNK_TYPE1","",0x1),
0x80A993AC:("D_80A993AC","UNK_TYPE1","",0x1),
0x80A993D0:("D_80A993D0","UNK_TYPE1","",0x1),
- 0x80A993F4:("D_80A993F4","UNK_TYPE1","",0x1),
- 0x80A99404:("D_80A99404","UNK_TYPE1","",0x1),
+ 0x80A993F4:("sYoungerBrotherEyeTextures","UNK_TYPE1","",0x1),
+ 0x80A99404:("sYoungerBrotherBeltTextures","UNK_TYPE1","",0x1),
0x80A99410:("D_80A99410","UNK_TYPE1","",0x1),
0x80A9941C:("D_80A9941C","UNK_TYPE1","",0x1),
0x80A99428:("D_80A99428","UNK_TYPE1","",0x1),
@@ -12926,8 +12926,8 @@
0x80AC4F60:("D_80AC4F60","f32","",0x4),
0x80AC4F64:("D_80AC4F64","f32","",0x4),
0x80AC5060:("D_80AC5060","UNK_TYPE1","",0x1),
- 0x80AC5630:("D_80AC5630","UNK_TYPE1","",0x1),
- 0x80AC5660:("D_80AC5660","UNK_TYPE1","",0x1),
+ 0x80AC5630:("sTriforceWipeDL","UNK_TYPE1","",0x1),
+ 0x80AC5660:("sTriforceWipeVtx","UNK_TYPE1","",0x1),
0x80AC5700:("TransitionTriforce_InitVars","UNK_PTR","",0x4),
0x80AC5730:("D_80AC5730","f32","",0x4),
0x80AC5734:("D_80AC5734","f32","",0x4),
@@ -13328,8 +13328,8 @@
0x80AF0050:("D_80AF0050","UNK_TYPE1","",0x1),
0x80AF00F0:("Bg_Market_Step_InitVars","UNK_TYPE1","",0x1),
0x80AF0110:("D_80AF0110","UNK_TYPE1","",0x1),
- 0x80AF0120:("D_80AF0120","UNK_TYPE1","",0x1),
- 0x80AF0128:("D_80AF0128","UNK_TYPE1","",0x1),
+ 0x80AF0120:("sMarketDLs","UNK_TYPE1","",0x1),
+ 0x80AF0128:("sBankAdvertisementsAndFakeDoorDLs","UNK_TYPE1","",0x1),
0x80AF0720:("Obj_Lupygamelift_InitVars","UNK_TYPE1","",0x1),
0x80AF0740:("D_80AF0740","UNK_TYPE1","",0x1),
0x80AF0750:("D_80AF0750","f32","",0x4),
@@ -15082,7 +15082,7 @@
0x80B82228:("D_80B82228","f32","",0x4),
0x80B8222C:("D_80B8222C","f32","",0x4),
0x80B83A00:("Bg_Dblue_Balance_InitVars","UNK_TYPE1","",0x1),
- 0x80B83A20:("D_80B83A20","UNK_TYPE4","",0x4),
+ 0x80B83A20:("sTypeInfo","UNK_TYPE4","",0x4),
0x80B83A74:("D_80B83A74","UNK_TYPE1","",0x1),
0x80B83A90:("D_80B83A90","UNK_TYPE1","",0x1),
0x80B83A92:("D_80B83A92","UNK_TYPE1","",0x1),
@@ -15288,9 +15288,9 @@
0x80B96178:("D_80B96178","UNK_TYPE1","",0x1),
0x80B963C0:("Obj_Jg_Gakki_InitVars","UNK_TYPE1","",0x1),
0x80B96540:("Bg_Inibs_Movebg_InitVars","UNK_TYPE1","",0x1),
- 0x80B96560:("D_80B96560","UNK_TYPE1","",0x1),
- 0x80B96568:("D_80B96568","UNK_TYPE1","",0x1),
- 0x80B96570:("D_80B96570","UNK_TYPE1","",0x1),
+ 0x80B96560:("sOpaDLists","UNK_TYPE1","",0x1),
+ 0x80B96568:("sXluDLists","UNK_TYPE1","",0x1),
+ 0x80B96570:("sSandTexAnims","UNK_TYPE1","",0x1),
0x80B96578:("D_80B96578","UNK_TYPE1","",0x1),
0x80B998C0:("En_Zot_InitVars","UNK_TYPE1","",0x1),
0x80B998E0:("D_80B998E0","UNK_TYPE1","",0x1),
@@ -16250,7 +16250,7 @@
0x80BFCD78:("D_80BFCD78","f32","",0x4),
0x80BFCD7C:("D_80BFCD7C","f32","",0x4),
0x80BFD260:("En_Scopecoin_InitVars","UNK_TYPE1","",0x1),
- 0x80BFD280:("D_80BFD280","UNK_TYPE1","",0x1),
+ 0x80BFD280:("sRupeeTextures","UNK_TYPE1","",0x1),
0x80BFDEA0:("D_80BFDEA0","UNK_TYPE1","",0x1),
0x80BFDEB4:("D_80BFDEB4","UNK_TYPE1","",0x1),
0x80BFDF28:("En_Bjt_InitVars","UNK_TYPE1","",0x1),
diff --git a/tools/namefixer.py b/tools/namefixer.py
index 1d4545a51..e3251d1be 100755
--- a/tools/namefixer.py
+++ b/tools/namefixer.py
@@ -712,6 +712,8 @@ wordReplace = {
"globalCtx->envCtx.unk_DC": "play->envCtx.lightBlend",
"globalCtx->interfaceCtx.unk_21E": "play->interfaceCtx.bButtonDoAction",
+ # "play->actorCtx.flags": "play->actorCtx.sceneFlags",
+ # "play->actorCtx.unk5": "play->actorCtx.flags",
"play->msgCtx.unk11F04": "play->msgCtx.currentTextId",
"play->msgCtx.unk11F10": "play->msgCtx.msgLength",
"play->msgCtx.unk11F22": "play->msgCtx.msgMode",
diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv
index 00ef41f88..cab10fda9 100644
--- a/tools/sizes/code_functions.csv
+++ b/tools/sizes/code_functions.csv
@@ -2630,10 +2630,10 @@ asm/non_matchings/code/audioMgr/AudioMgr_HandlePRENMI.s,AudioMgr_HandlePRENMI,0x
asm/non_matchings/code/audioMgr/AudioMgr_ThreadEntry.s,AudioMgr_ThreadEntry,0x80172ED0,0x5E
asm/non_matchings/code/audioMgr/AudioMgr_Unlock.s,AudioMgr_Unlock,0x80173048,0xB
asm/non_matchings/code/audioMgr/AudioMgr_Init.s,AudioMgr_Init,0x80173074,0x2F
-asm/non_matchings/code/title_setup/TitleSetup_GameStateResetContext.s,TitleSetup_GameStateResetContext,0x80173130,0x6B
-asm/non_matchings/code/title_setup/TitleSetup_InitImpl.s,TitleSetup_InitImpl,0x801732DC,0x14
-asm/non_matchings/code/title_setup/TitleSetup_Destroy.s,TitleSetup_Destroy,0x8017332C,0x3
-asm/non_matchings/code/title_setup/TitleSetup_Init.s,TitleSetup_Init,0x80173338,0xA
+asm/non_matchings/code/title_setup/Setup_SetRegs.s,Setup_SetRegs,0x80173130,0x6B
+asm/non_matchings/code/title_setup/Setup_InitImpl.s,Setup_InitImpl,0x801732DC,0x14
+asm/non_matchings/code/title_setup/Setup_Destroy.s,Setup_Destroy,0x8017332C,0x3
+asm/non_matchings/code/title_setup/Setup_Init.s,Setup_Init,0x80173338,0xA
asm/non_matchings/code/game/Game_UpdateFramerateVariables.s,Game_UpdateFramerateVariables,0x80173360,0x12
asm/non_matchings/code/game/Game_SetFramerateDivisor.s,Game_SetFramerateDivisor,0x801733A8,0xD
asm/non_matchings/code/game/GameState_SetFBFilter.s,GameState_SetFBFilter,0x801733DC,0x56
@@ -2648,8 +2648,8 @@ asm/non_matchings/code/game/Game_InitHeap.s,Game_InitHeap,0x80173810,0x1C
asm/non_matchings/code/game/Game_ResizeHeap.s,Game_ResizeHeap,0x80173880,0x34
asm/non_matchings/code/game/GameState_Init.s,GameState_Init,0x80173950,0x40
asm/non_matchings/code/game/GameState_Destroy.s,GameState_Destroy,0x80173A50,0x2C
-asm/non_matchings/code/game/GameState_GetNextStateInit.s,GameState_GetNextStateInit,0x80173B00,0x3
-asm/non_matchings/code/game/GameState_GetNextStateSize.s,GameState_GetNextStateSize,0x80173B0C,0x3
+asm/non_matchings/code/game/GameState_GetInit.s,GameState_GetInit,0x80173B00,0x3
+asm/non_matchings/code/game/GameState_GetSize.s,GameState_GetSize,0x80173B0C,0x3
asm/non_matchings/code/game/GameState_IsRunning.s,GameState_IsRunning,0x80173B18,0x3
asm/non_matchings/code/game/Game_GetHeapFreeSize.s,Game_GetHeapFreeSize,0x80173B24,0x9
asm/non_matchings/code/game/func_80173B48.s,func_80173B48,0x80173B48,0x2A
@@ -3076,16 +3076,16 @@ asm/non_matchings/code/audio_heap/AudioHeap_AllocDmaMemoryZeroed.s,AudioHeap_All
asm/non_matchings/code/audio_heap/AudioHeap_AllocZeroed.s,AudioHeap_AllocZeroed,0x8018B640,0x17
asm/non_matchings/code/audio_heap/AudioHeap_TestAlloc.s,AudioHeap_TestAlloc,0x8018B69C,0x13
asm/non_matchings/code/audio_heap/Audio_Alloc.s,Audio_Alloc,0x8018B6E8,0x16
-asm/non_matchings/code/audio_heap/AudioHeap_AllocPoolInit.s,AudioHeap_AllocPoolInit,0x8018B740,0xA
-asm/non_matchings/code/audio_heap/AudioHeap_ClearPersistentCache.s,AudioHeap_ClearPersistentCache,0x8018B768,0x5
-asm/non_matchings/code/audio_heap/AudioHeap_ClearTemporaryCache.s,AudioHeap_ClearTemporaryCache,0x8018B77C,0xC
+asm/non_matchings/code/audio_heap/AudioHeap_InitPool.s,AudioHeap_InitPool,0x8018B740,0xA
+asm/non_matchings/code/audio_heap/AudioHeap_InitPersistentCache.s,AudioHeap_InitPersistentCache,0x8018B768,0x5
+asm/non_matchings/code/audio_heap/AudioHeap_InitTemporaryCache.s,AudioHeap_InitTemporaryCache,0x8018B77C,0xC
asm/non_matchings/code/audio_heap/AudioHeap_ResetPool.s,AudioHeap_ResetPool,0x8018B7AC,0x4
-asm/non_matchings/code/audio_heap/AudioHeap_PopCache.s,AudioHeap_PopCache,0x8018B7BC,0x50
+asm/non_matchings/code/audio_heap/AudioHeap_PopPersistentCache.s,AudioHeap_PopPersistentCache,0x8018B7BC,0x50
asm/non_matchings/code/audio_heap/AudioHeap_InitMainPool.s,AudioHeap_InitMainPool,0x8018B8FC,0x18
asm/non_matchings/code/audio_heap/AudioHeap_InitSessionPool.s,AudioHeap_InitSessionPool,0x8018B95C,0x21
asm/non_matchings/code/audio_heap/AudioHeap_InitCachePool.s,AudioHeap_InitCachePool,0x8018B9E0,0x21
-asm/non_matchings/code/audio_heap/AudioHeap_InitPersistentCache.s,AudioHeap_InitPersistentCache,0x8018BA64,0x31
-asm/non_matchings/code/audio_heap/AudioHeap_InitTemporaryCache.s,AudioHeap_InitTemporaryCache,0x8018BB28,0x31
+asm/non_matchings/code/audio_heap/AudioHeap_InitPersistentPoolsAndCaches.s,AudioHeap_InitPersistentPoolsAndCaches,0x8018BA64,0x31
+asm/non_matchings/code/audio_heap/AudioHeap_InitTemporaryPoolsAndCaches.s,AudioHeap_InitTemporaryPoolsAndCaches,0x8018BB28,0x31
asm/non_matchings/code/audio_heap/AudioHeap_AllocCached.s,AudioHeap_AllocCached,0x8018BBEC,0x1E5
asm/non_matchings/code/audio_heap/AudioHeap_SearchCaches.s,AudioHeap_SearchCaches,0x8018C380,0x16
asm/non_matchings/code/audio_heap/AudioHeap_SearchRegularCaches.s,AudioHeap_SearchRegularCaches,0x8018C3D8,0x43
@@ -3161,7 +3161,7 @@ asm/non_matchings/code/audio_load/AudioLoad_AsyncLoadInner.s,AudioLoad_AsyncLoad
asm/non_matchings/code/audio_load/AudioLoad_ProcessLoads.s,AudioLoad_ProcessLoads,0x80190B08,0xC
asm/non_matchings/code/audio_load/AudioLoad_SetDmaHandler.s,AudioLoad_SetDmaHandler,0x80190B38,0x3
asm/non_matchings/code/audio_load/AudioLoad_SetUnusedHandler.s,AudioLoad_SetUnusedHandler,0x80190B44,0x3
-asm/non_matchings/code/audio_load/AudioLoad_InitSoundFontMeta.s,AudioLoad_InitSoundFontMeta,0x80190B50,0x18
+asm/non_matchings/code/audio_load/AudioLoad_InitSoundFont.s,AudioLoad_InitSoundFont,0x80190B50,0x18
asm/non_matchings/code/audio_load/AudioLoad_Init.s,AudioLoad_Init,0x80190BB0,0xE8
asm/non_matchings/code/audio_load/AudioLoad_InitSlowLoads.s,AudioLoad_InitSlowLoads,0x80190F50,0x5
asm/non_matchings/code/audio_load/AudioLoad_SlowLoadSample.s,AudioLoad_SlowLoadSample,0x80190F64,0x74
@@ -3247,10 +3247,10 @@ asm/non_matchings/code/audio_playback/AudioPlayback_NoteSetResamplingRate.s,Audi
asm/non_matchings/code/audio_playback/AudioPlayback_NoteInit.s,AudioPlayback_NoteInit,0x80194E60,0x30
asm/non_matchings/code/audio_playback/AudioPlayback_NoteDisable.s,AudioPlayback_NoteDisable,0x80194F20,0x19
asm/non_matchings/code/audio_playback/AudioPlayback_ProcessNotes.s,AudioPlayback_ProcessNotes,0x80194F84,0x152
-asm/non_matchings/code/audio_playback/AudioPlayback_InstrumentGetSound.s,AudioPlayback_InstrumentGetSound,0x801954CC,0xF
+asm/non_matchings/code/audio_playback/AudioPlayback_GetInstrumentTunedSample.s,AudioPlayback_GetInstrumentTunedSample,0x801954CC,0xF
asm/non_matchings/code/audio_playback/AudioPlayback_GetInstrumentInner.s,AudioPlayback_GetInstrumentInner,0x80195508,0x35
asm/non_matchings/code/audio_playback/AudioPlayback_GetDrum.s,AudioPlayback_GetDrum,0x801955DC,0x39
-asm/non_matchings/code/audio_playback/AudioPlayback_GetSfx.s,AudioPlayback_GetSfx,0x801956C0,0x3D
+asm/non_matchings/code/audio_playback/AudioPlayback_GetSoundEffect.s,AudioPlayback_GetSoundEffect,0x801956C0,0x3D
asm/non_matchings/code/audio_playback/AudioPlayback_SetFontInstrument.s,AudioPlayback_SetFontInstrument,0x801957B4,0x51
asm/non_matchings/code/audio_playback/AudioPlayback_SeqLayerDecayRelease.s,AudioPlayback_SeqLayerDecayRelease,0x801958F8,0xD2
asm/non_matchings/code/audio_playback/AudioPlayback_SeqLayerNoteDecay.s,AudioPlayback_SeqLayerNoteDecay,0x80195C40,0x8
diff --git a/undefined_syms.txt b/undefined_syms.txt
index 20a4cf5e2..5cb5cdf0b 100644
--- a/undefined_syms.txt
+++ b/undefined_syms.txt
@@ -385,9 +385,6 @@ D_04014560 = 0x04014560;
D_04015DB0 = 0x04015DB0;
D_04015FA0 = 0x04015FA0;
D_04016360 = 0x04016360;
-D_0401A4D0 = 0x0401A4D0;
-D_0401A538 = 0x0401A538;
-D_0401A590 = 0x0401A590;
D_0401ACF0 = 0x0401ACF0;
D_0401ED00 = 0x0401ED00;
D_0401F0F0 = 0x0401F0F0;
@@ -428,7 +425,6 @@ D_040377B0 = 0x040377B0;
D_04037850 = 0x04037850;
D_0403A0F0 = 0x0403A0F0;
D_0403F230 = 0x0403F230;
-D_04044300 = 0x04044300;
D_0404F250 = 0x0404F250;
D_04050550 = 0x04050550;
D_04050D10 = 0x04050D10;
@@ -845,14 +841,6 @@ D_060057D8 = 0x060057D8;
D_060058C8 = 0x060058C8;
D_06007238 = 0x06007238;
-// ovl_Effect_Ss_D_Fire
-
-D_060098A0 = 0x060098A0;
-
-// ovl_Effect_Ss_Extra
-
-D_06000DC0 = 0x06000DC0;
-
// ovl_Eff_Kamejima_Wave
D_06000000 = 0x06000000;