diff --git a/assets/xml/objects/object_boj.xml b/assets/xml/objects/object_boj.xml index cfb10e97aa..20c661bb59 100644 --- a/assets/xml/objects/object_boj.xml +++ b/assets/xml/objects/object_boj.xml @@ -87,8 +87,8 @@ - - - + + + diff --git a/assets/xml/objects/object_dnj.xml b/assets/xml/objects/object_dnj.xml new file mode 100644 index 0000000000..95b563913f --- /dev/null +++ b/assets/xml/objects/object_dnj.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dno.xml b/assets/xml/objects/object_dno.xml index 6646636287..e1528989cc 100644 --- a/assets/xml/objects/object_dno.xml +++ b/assets/xml/objects/object_dno.xml @@ -1,86 +1,94 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_dnp.xml b/assets/xml/objects/object_dnp.xml deleted file mode 100644 index d9494909ce..0000000000 --- a/assets/xml/objects/object_dnp.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/xml/objects/object_dnq.xml b/assets/xml/objects/object_dnq.xml index 92d818a4ba..63f27a6f81 100644 --- a/assets/xml/objects/object_dnq.xml +++ b/assets/xml/objects/object_dnq.xml @@ -1,94 +1,88 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_grasshopper.xml b/assets/xml/objects/object_grasshopper.xml index 3ef7b8e64a..f08536c905 100644 --- a/assets/xml/objects/object_grasshopper.xml +++ b/assets/xml/objects/object_grasshopper.xml @@ -1,67 +1,79 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mu.xml b/assets/xml/objects/object_mu.xml index 1f246b07b5..37886e8f50 100644 --- a/assets/xml/objects/object_mu.xml +++ b/assets/xml/objects/object_mu.xml @@ -1,62 +1,63 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ru2.xml b/assets/xml/objects/object_ru2.xml index 08f182bb9e..72510149c0 100644 --- a/assets/xml/objects/object_ru2.xml +++ b/assets/xml/objects/object_ru2.xml @@ -1,78 +1,98 @@  + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_zos.xml b/assets/xml/objects/object_zos.xml index 016831ac55..a1364a8429 100644 --- a/assets/xml/objects/object_zos.xml +++ b/assets/xml/objects/object_zos.xml @@ -1,69 +1,84 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_Oceff_Wipe4.xml b/assets/xml/overlays/ovl_Oceff_Wipe4.xml new file mode 100644 index 0000000000..995ad18b13 --- /dev/null +++ b/assets/xml/overlays/ovl_Oceff_Wipe4.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/docs/tutorial/object_decomp_example.md b/docs/tutorial/object_decomp_example.md index d1cc4738af..f4030be5bf 100644 --- a/docs/tutorial/object_decomp_example.md +++ b/docs/tutorial/object_decomp_example.md @@ -149,7 +149,7 @@ Gfx object_dns_DL_001A50[] = { }; ``` -Using `0x08000000` with `gsDPLoadTextureBlock` signals that this display list is expecting a texture in segment 8. What kind of texture is it expecting? We can look at the arguments after the `0x08000000`. It's looking for an RBGA16 texture with dimensions of 8x8, so we can define these textures in the XML like so: +Using `0x08000000` with `gsDPLoadTextureBlock` signals that this display list is expecting a texture in segment 8. What kind of texture is it expecting? We can look at the arguments after the `0x08000000`. It's looking for an RGBA16 texture with dimensions of 8x8, so we can define these textures in the XML like so: ```xml diff --git a/include/functions.h b/include/functions.h index 42933599e3..308c1a4f7b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1654,7 +1654,7 @@ s16 func_80105318(void); void func_8010549C(PlayState* play, void* segmentAddress); void func_8010565C(PlayState* play, u8 num, void* segmentAddress); void func_80105818(PlayState* play, u32 uParm2, TransitionActorEntry* puParm3); -void func_80105A40(void); +void func_80105A40(PlayState* play); void func_80105B34(PlayState* play); void func_80105C40(s16 arg0); // void func_80105FE0(void); @@ -1731,7 +1731,7 @@ s32 func_8010A0A4(PlayState* play); // void func_8010A2AC(PlayState* play); void Minimap_SavePlayerRoomInitInfo(PlayState* play); void Map_InitRoomData(PlayState* play, s16 room); -// void Map_Destroy(void); +void Map_Destroy(PlayState* play); // void Map_Init(PlayState* play); // void Minimap_Draw(PlayState* play); // void Map_Update(PlayState* play); @@ -1810,26 +1810,19 @@ Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b); void OLib_DbCameraVec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); // void func_8010CB80(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); -// void func_8010CD98(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); +Gfx* func_8010CD98(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); // void func_8010CFBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); // void func_8010D2D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11); // void func_8010D480(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16); -// void func_8010D7D0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10); +Gfx* func_8010D7D0(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); // void func_8010D9F4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE2 param_13, UNK_TYPE2 param_14); -// void func_8010DC58(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); +Gfx* func_8010DC58(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, u16 i); // void func_8010DE38(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); // void func_8010E028(void); -// void func_8010E968(void); -void func_8010E9F0(s16 arg0, s16 arg1); -void func_8010EA9C(s32 arg0, s32 arg1); -// void func_8010EB50(void); -// void func_8010EBA0(void); -// void func_8010EC54(void); +void Interface_StartTimer(s16 timerId, s16 seconds); +void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState); void func_8010EE74(PlayState* play, s32 day); -void Interface_ChangeAlpha(u16 param_1); -// void func_8010EF9C(void); -// void func_8010F0D4(void); -// void func_8010F1A8(void); +void Interface_SetHudVisibility(u16 hudVisibility); // void func_80110038(void); // void func_80111CB4(void); void func_801129E4(PlayState* play); @@ -1876,17 +1869,14 @@ void func_8011B4E0(PlayState* play, s32 arg1); // void func_8011B9E0(void); // void func_8011BF70(void); // void func_8011C4C4(void); -void func_8011C808(PlayState* play); -// void func_8011C898(void); -// void func_8011CA64(void); -// void func_8011E3B4(void); +void Interface_StartMoonCrash(PlayState* play); // void func_8011E730(void); void Interface_Draw(PlayState* play); // void func_80120F90(void); // void func_80121000(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, UNK_TYPE1 param_8, UNK_TYPE1 param_9, UNK_TYPE1 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE4 param_13, UNK_TYPE4 param_14); // void func_80121064(void); void Interface_Update(PlayState* play); -void func_80121F94(PlayState* play); +void Interface_Destroy(PlayState* play); void func_80121FC4(PlayState* play); Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); @@ -1906,7 +1896,7 @@ void func_80122BA4(PlayState* play, struct_80122D44_arg1* arg1, s32 arg2, s32 al void func_80122C20(PlayState* play, struct_80122D44_arg1* arg1); void func_80122D44(PlayState* play, struct_80122D44_arg1* arg1); u8 Player_MaskIdToItemId(s32 maskIdMinusOne); -u8 Player_GetCurMaskItemId(PlayState* play); +s32 Player_GetCurMaskItemId(PlayState* play); void func_80122F28(Player* player); s32 func_80122F9C(PlayState* play); s32 func_80122FCC(PlayState* play); @@ -1953,7 +1943,7 @@ s32 Player_ActionToExplosive(Player* player, s32 actionParam); s32 Player_GetExplosiveHeld(Player* player); s32 func_80124278(Actor* actor, s32 arg1); s32 func_801242B4(Player* player); -s32 func_801242DC(PlayState* play); +s32 Player_GetEnvTimerType(PlayState* play); void func_80124420(Player* player); void func_80124618(struct_80124618 arg0[], f32 curFrame, Vec3f* arg2); void func_801246F4(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots, s32 face, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor); @@ -2100,7 +2090,7 @@ s32 Inventory_GetBtnBItem(PlayState* play); void Inventory_ChangeEquipment(s16 value); u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, u32 value); -s32 Inventory_IsMapVisible(s16 sceneNum); +s32 Inventory_IsMapVisible(s16 sceneId); void Inventory_SetMapVisibility(s16 tingleIndex); void Inventory_SaveDekuPlaygroundHighScore(s16 timerId); void Inventory_IncrementSkullTokenCount(s16 sceneIndex); @@ -2186,8 +2176,8 @@ void Scene_DrawConfig5(PlayState* play); void Scene_DrawConfigMatAnimManualStep(PlayState* play); void Scene_DrawConfigGreatBayTemple(PlayState* play); EntranceTableEntry* Entrance_GetTableEntry(u16 entrance); -s32 Entrance_GetSceneNum(u16 entrance); -s32 Entrance_GetSceneNumAbsolute(u16 entrance); +s32 Entrance_GetSceneId(u16 entrance); +s32 Entrance_GetSceneIdAbsolute(u16 entrance); s32 Entrance_GetSpawnNum(u16 entrance); s32 Entrance_GetTransitionFlags(u16 entrance); s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleOutput* output); @@ -2405,7 +2395,7 @@ void func_8014D304(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_ // void func_8014D7B4(void); void func_80150A84(PlayState* play); void func_80150D08(PlayState* play, u32 uParm2); -// void func_801514B0(void); +void func_801514B0(PlayState* play, u16 arg1, u8 arg2); void Message_StartTextbox(PlayState* play, u16 textId, Actor* Actor); void func_80151938(PlayState* play, u16 textId); void func_80151A68(PlayState* play, u16 textId); @@ -2571,7 +2561,7 @@ s32 Play_ChangeCameraSetting(PlayState* play, s16 camId, s16 setting); void func_80169AFC(PlayState* play, s16 camId, s16 arg2); u16 Play_GetActorCsCamSetting(PlayState* play, s32 csCamDataIndex); Vec3s* Play_GetActorCsCamFuncData(PlayState* play, s32 csCamDataIndex); -s16 Play_GetOriginalSceneNumber(s16 sceneNum); +s16 Play_GetOriginalSceneId(s16 sceneId); void Play_SaveCycleSceneFlags(GameState* gameState); void Play_SetRespawnData(GameState* gameState, s32 respawnNumber, u16 sceneSetup, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw); void Play_SetupRespawnPoint(GameState* gameState, s32 respawnNumber, s32 playerParams); @@ -2710,8 +2700,8 @@ void Main(void* arg); u32 Padmgr_GetControllerBitmask(void); void func_80174F24(void (*arg0)(void*), void* arg1); void func_80174F44(void (*arg0)(void*), void* arg1); -// void func_80174F7C(void); -// void func_80174F9C(void); +void func_80174F7C(void (*arg0)(s32), void* arg1); +void func_80174F9C(void (*arg0)(s32), void* arg1); // OSMesgQueue* Padmgr_GetEventCallback(void); // void func_80175008(void); void Padmgr_SetEventCallback(OSMesg pvParm1); diff --git a/include/regs.h b/include/regs.h index aa3ba523b2..cf15b236af 100644 --- a/include/regs.h +++ b/include/regs.h @@ -71,6 +71,8 @@ #define R_A_ICON_X XREG(20) #define R_A_BTN_COLOR(i) XREG(22 + i) #define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41) +#define R_MOON_CRASH_TIMER_Y XREG(80) +#define R_MOON_CRASH_TIMER_X XREG(81) #define R_MINIMAP_DISABLED XREG(95) #define R_B_LABEL_DD WREG(0) #define R_OW_MINIMAP_X WREG(29) diff --git a/include/segment_symbols.h b/include/segment_symbols.h index e133437cc2..1339c879c2 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -922,7 +922,7 @@ DECLARE_ROM_SEGMENT(object_driftice) DECLARE_ROM_SEGMENT(object_fall) DECLARE_ROM_SEGMENT(object_hanareyama_obj) DECLARE_ROM_SEGMENT(object_crace_object) -DECLARE_ROM_SEGMENT(object_dnq) +DECLARE_ROM_SEGMENT(object_dno) DECLARE_ROM_SEGMENT(object_obj_tokeidai) DECLARE_ROM_SEGMENT(object_eg) DECLARE_ROM_SEGMENT(object_tru) @@ -993,7 +993,7 @@ DECLARE_ROM_SEGMENT(object_gg) DECLARE_ROM_SEGMENT(object_maruta) DECLARE_ROM_SEGMENT(object_ghaka) DECLARE_ROM_SEGMENT(object_oyu) -DECLARE_ROM_SEGMENT(object_dnp) +DECLARE_ROM_SEGMENT(object_dnq) DECLARE_ROM_SEGMENT(object_dai) DECLARE_ROM_SEGMENT(object_kgy) DECLARE_ROM_SEGMENT(object_fb) @@ -1014,7 +1014,7 @@ DECLARE_ROM_SEGMENT(object_gi_loach) DECLARE_ROM_SEGMENT(object_gi_seahorse) DECLARE_ROM_SEGMENT(object_bigpo) DECLARE_ROM_SEGMENT(object_hariko) -DECLARE_ROM_SEGMENT(object_dno) +DECLARE_ROM_SEGMENT(object_dnj) DECLARE_ROM_SEGMENT(object_sinkai_kabe) DECLARE_ROM_SEGMENT(object_kin2_obj) DECLARE_ROM_SEGMENT(object_ishi) diff --git a/include/variables.h b/include/variables.h index 8225112fd1..75630fd2ea 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1031,21 +1031,21 @@ extern UNK_PTR D_801BF5C0; // extern UNK_TYPE2 sMagicMeterOutlinePrimBlue; // extern UNK_TYPE2 sMagicBorderRatio; // extern UNK_TYPE2 sMagicBorderStep; -// extern UNK_TYPE2 D_801BF8DC; -// extern UNK_TYPE2 D_801BF8E0; -// extern UNK_TYPE2 D_801BF8E4; -// extern UNK_TYPE4 D_801BF8E8; -// extern UNK_TYPE4 D_801BF8F0; +// extern UNK_TYPE2 sEnvTimerType; +// extern UNK_TYPE2 sEnvTimerActive; +// extern UNK_TYPE2 sPostmanBunnyHoodState; +// extern UNK_TYPE4 sTimerPausedOsTime; +// extern UNK_TYPE4 sBottleTimerPausedOsTime; // extern UNK_TYPE4 D_801BF8F4; // extern UNK_TYPE4 D_801BF8F8; // extern UNK_TYPE4 D_801BF8FC; // extern UNK_TYPE4 D_801BF930; // extern UNK_TYPE4 D_801BF934; -// extern UNK_TYPE1 D_801BF968; +// extern UNK_TYPE1 sIsTimerPaused; // extern UNK_TYPE1 D_801BF96A; -// extern UNK_TYPE1 D_801BF96C; +// extern UNK_TYPE1 sIsBottleTimerPaused; // extern UNK_TYPE1 D_801BF96E; -// extern UNK_TYPE2 D_801BF970; +// extern UNK_TYPE2 sTimerId; // extern UNK_TYPE1 D_801BF972; // extern UNK_TYPE2 D_801BF974; // extern UNK_TYPE2 D_801BF978; @@ -1083,7 +1083,7 @@ extern UNK_PTR D_801BF5C0; // extern UNK_TYPE2 D_801BFA4C; // extern UNK_TYPE2 D_801BFA64; // extern UNK_TYPE2 D_801BFA74; -// extern UNK_TYPE4 D_801BFA84; +// extern UNK_TYPE4 sPostmanTimerInputBtnAPressed; // extern UNK_TYPE1 D_801BFAB0; // extern UNK_TYPE1 D_801BFAB8; // extern UNK_TYPE1 D_801BFAC4; @@ -1135,15 +1135,15 @@ extern UNK_PTR D_801BF5C0; // extern UNK_TYPE2 D_801BFCA8; // extern UNK_TYPE1 D_801BFCB8; // extern UNK_TYPE4 D_801BFCC4; -// extern UNK_TYPE2 D_801BFCE4; -// extern UNK_TYPE2 D_801BFCE8; +// extern UNK_TYPE2 sTimerStateTimer; +// extern UNK_TYPE2 sTimerDigits; // extern UNK_TYPE2 D_801BFCEA; // extern UNK_TYPE2 D_801BFCEC; // extern UNK_TYPE2 D_801BFCEE; // extern UNK_TYPE2 D_801BFCF0; // extern UNK_TYPE2 D_801BFCF2; // extern UNK_TYPE2 D_801BFCF4; -// extern UNK_TYPE2 D_801BFCF8; +// extern UNK_TYPE2 sTimerBeepSfxSeconds; // extern UNK_TYPE2 D_801BFCFC; // extern UNK_TYPE2 D_801BFD0C; // extern UNK_TYPE1 D_801BFD1C; @@ -1312,7 +1312,7 @@ extern u32 gGsFlagsShift[]; extern void* gItemIcons[]; extern u8 gItemSlots[]; extern s16 gItemPrices[]; -extern u16 gScenesPerRegion[11][27]; +extern u16 gSceneIdsPerRegion[11][27]; extern u32 D_801C2410[]; extern s16 gPlayerFormObjectIndices[8]; extern RomFile gObjectTable[643]; @@ -3151,7 +3151,7 @@ extern s16 D_801F4E7A; // extern UNK_TYPE1 D_801F57B4; // extern UNK_TYPE1 D_801F5834; // extern NmiBuff* gNMIBuffer; -// extern UNK_TYPE1 D_801F5850; +// extern UNK_TYPE1 sPostmanTimerInput; // extern UNK_TYPE1 D_801F58B0; // extern UNK_TYPE1 D_801F59AC; // extern UNK_TYPE1 D_801F59B0; diff --git a/include/z64.h b/include/z64.h index a5d2db55a1..83b4ac1bbe 100644 --- a/include/z64.h +++ b/include/z64.h @@ -444,15 +444,15 @@ typedef struct { /* 0x22C */ s32 unk_22C; /* 0x230 */ s32 stickRelX; /* 0x234 */ s32 stickRelY; - /* 0x238 */ s16 unk_238[5]; - /* 0x242 */ s16 unk_242[5]; - /* 0x24C */ s16 unk_24C[5]; + /* 0x238 */ s16 cursorPoint[5]; + /* 0x242 */ s16 cursorX[5]; + /* 0x24C */ s16 cursorY[5]; /* 0x256 */ s16 unk_256; - /* 0x258 */ s16 unk_258; - /* 0x25A */ s16 unk_25A; + /* 0x258 */ s16 cursorSpecialPos; + /* 0x25A */ s16 pageSwitchTimer; /* 0x25C */ u16 unk_25C; /* 0x25E */ u16 cursorItem[5]; - /* 0x268 */ u16 unk_268[5]; + /* 0x268 */ u16 cursorSlot[5]; /* 0x272 */ u16 equipTargetItem; /* 0x274 */ u16 equipTargetSlot; /* 0x276 */ u16 equipTargetCBtn; @@ -461,8 +461,8 @@ typedef struct { /* 0x27C */ s16 equipAnimAlpha; /* 0x27E */ s16 unk_27E; /* 0x280 */ u16 unk_280; - /* 0x282 */ u16 unk_282; - /* 0x284 */ s16 unk_284; + /* 0x282 */ u16 nameColorSet; + /* 0x284 */ s16 cursorColorSet; /* 0x286 */ s16 unk_286; /* 0x288 */ f32 unk_288; /* 0x28C */ f32 unk_28C; @@ -476,9 +476,9 @@ typedef struct { /* 0x2B6 */ u8 unk_2B6; /* 0x2B7 */ u8 unk_2B7; /* 0x2B8 */ u8 unk_2B8; - /* 0x2B9 */ u8 unk_2B9; - /* 0x2BA */ s16 unk_2BA; - /* 0x2BC */ s16 unk_2BC; + /* 0x2B9 */ u8 itemDescriptionOn; // helpful description of item given through a message box + /* 0x2BA */ s16 equipAnimScale; // scale of item icon while moving being equipped to c-button + /* 0x2BC */ s16 equipAnimShrinkRate; // rate the scale is shrinking for the item icon while moving being equipped to c-button /* 0x2BE */ s16 unk_2BE[5]; /* 0x2C8 */ u16 unk_2C8; /* 0x2CA */ s16 unk_2CA; @@ -1121,7 +1121,7 @@ typedef struct { struct PlayState { /* 0x00000 */ GameState state; - /* 0x000A4 */ s16 sceneNum; + /* 0x000A4 */ s16 sceneId; /* 0x000A6 */ u8 sceneConfig; /* 0x000A7 */ char unk_A7[0x9]; /* 0x000B0 */ void* sceneSegment; diff --git a/include/z64item.h b/include/z64item.h index f683558588..d8a2185cc1 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -285,7 +285,7 @@ typedef enum { /* 0xF2 */ ITEM_F2, /* 0xFD */ ITEM_FD = 0xFD, /* 0xFF */ ITEM_NONE = 0xFF -} ItemID; +} ItemId; #define BOTTLE_FIRST 0 #define BOTTLE_MAX 6 @@ -428,7 +428,7 @@ typedef enum { /* 0xB8 */ GI_TINGLE_MAP_GREAT_BAY, /* 0xB9 */ GI_TINGLE_MAP_STONE_TOWER, /* 0xBA */ GI_MAX -} GetItemID; +} GetItemId; typedef enum { /* 0x00 */ GID_BOTTLE, diff --git a/include/z64object.h b/include/z64object.h index 3b221088ac..306f84ebd8 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -404,7 +404,7 @@ typedef enum { /* 0x188 */ OBJECT_FALL, /* 0x189 */ OBJECT_HANAREYAMA_OBJ, /* 0x18A */ OBJECT_CRACE_OBJECT, - /* 0x18B */ OBJECT_DNQ, + /* 0x18B */ OBJECT_DNO, /* 0x18C */ OBJECT_OBJ_TOKEIDAI, /* 0x18D */ OBJECT_EG, /* 0x18E */ OBJECT_TRU, @@ -477,7 +477,7 @@ typedef enum { /* 0x1D1 */ OBJECT_MARUTA, /* 0x1D2 */ OBJECT_GHAKA, /* 0x1D3 */ OBJECT_OYU, - /* 0x1D4 */ OBJECT_DNP, + /* 0x1D4 */ OBJECT_DNQ, /* 0x1D5 */ OBJECT_DAI, /* 0x1D6 */ OBJECT_KGY, /* 0x1D7 */ OBJECT_FB, @@ -508,7 +508,7 @@ typedef enum { /* 0x1F0 */ OBJECT_GI_SEAHORSE, /* 0x1F1 */ OBJECT_BIGPO, /* 0x1F2 */ OBJECT_HARIKO, - /* 0x1F3 */ OBJECT_DNO, + /* 0x1F3 */ OBJECT_DNJ, /* 0x1F4 */ OBJECT_SINKAI_KABE, /* 0x1F5 */ OBJECT_KIN2_OBJ, /* 0x1F6 */ OBJECT_ISHI, diff --git a/include/z64player.h b/include/z64player.h index f49f30688a..2f101b5588 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -70,6 +70,14 @@ typedef enum { /* 0x19 */ PLAYER_MASK_MAX } PlayerMask; +typedef enum { + /* 0 */ PLAYER_ENV_TIMER_NONE, + /* 1 */ PLAYER_ENV_TIMER_HOTROOM, + /* 2 */ PLAYER_ENV_TIMER_UNDERWATER_FLOOR, + /* 3 */ PLAYER_ENV_TIMER_SWIMMING, + /* 4 */ PLAYER_ENV_TIMER_UNDERWATER_FREE +} PlayerEnvTimerType; + typedef enum PlayerActionParam { /* -1 */ PLAYER_AP_MINUS1 = -1, /* 0x00 */ PLAYER_AP_NONE, @@ -594,7 +602,7 @@ typedef struct Player { /* 0xAD0 */ f32 linearVelocity; /* 0xAD4 */ s16 currentYaw; /* 0xAD6 */ s16 targetYaw; - /* 0xAD8 */ u16 unk_AD8; + /* 0xAD8 */ u16 underwaterTimer; /* 0xADA */ s8 meleeWeaponAnimation; /* 0xADB */ s8 meleeWeaponState; /* 0xADC */ s8 unk_ADC; diff --git a/include/z64save.h b/include/z64save.h index 2185b04c5a..91f0c0a733 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -2,6 +2,7 @@ #define Z64SAVE_H #include "ultra64.h" +#include "z64item.h" #include "z64math.h" #include "os.h" @@ -54,6 +55,84 @@ typedef enum { #define MAGIC_NORMAL_METER 0x30 #define MAGIC_DOUBLE_METER (2 * MAGIC_NORMAL_METER) +#define SECONDS_TO_TIMER(seconds) ((seconds) * 100) + +#define OSTIME_TO_TIMER(osTime) ((osTime) * 64 / 3000 / 10000) +#define OSTIME_TO_TIMER_ALT(osTime) ((osTime) / 10000 * 64 / 3000) + +// 1 centisecond = 10 milliseconds = 1/100 seconds +#define SECONDS_TO_TIMER_PRECISE(seconds, centiSeconds) ((seconds) * 100 + (centiSeconds)) + +typedef enum { + /* 0 */ TIMER_ID_POSTMAN, // postman's counting minigame + /* 1 */ TIMER_ID_MINIGAME_1, // minigame timer + /* 2 */ TIMER_ID_2, + /* 3 */ TIMER_ID_MOON_CRASH, // timer used for mooncrash on the clocktower roof + /* 4 */ TIMER_ID_MINIGAME_2, // minigame timer + /* 5 */ TIMER_ID_ENV, // environmental timer (underwater or hot room) + /* 6 */ TIMER_ID_GORON_RACE_UNUSED, + /* 7 */ TIMER_ID_MAX, + /* 99 */ TIMER_ID_NONE = 99, +} TimerId; + +typedef enum { + /* 0 */ TIMER_COUNT_DOWN, + /* 1 */ TIMER_COUNT_UP +} TimerDirection; + +typedef enum { + /* 0 */ TIMER_STATE_OFF, + /* 1 */ TIMER_STATE_START, + /* 2 */ TIMER_STATE_HOLD_TIMER, // Hold timer frozen at the screen center + /* 3 */ TIMER_STATE_MOVING_TIMER, // Move timer to a target location + /* 4 */ TIMER_STATE_COUNTING, + /* 5 */ TIMER_STATE_STOP, + /* 6 */ TIMER_STATE_6, // like `TIMER_STATE_STOP` but with extra minigame checks + /* 7 */ TIMER_STATE_7, // stopped but still update `timerCurTimes` + /* 8 */ TIMER_STATE_ENV_START, + /* 9 */ TIMER_STATE_ALT_START, + /* 10 */ TIMER_STATE_10, // precursor to `TIMER_STATE_ALT_COUNTING` + /* 11 */ TIMER_STATE_ALT_COUNTING, + /* 12 */ TIMER_STATE_12, // Updated paused time? + /* 13 */ TIMER_STATE_POSTMAN_START, + /* 14 */ TIMER_STATE_POSTMAN_COUNTING, + /* 15 */ TIMER_STATE_POSTMAN_STOP, + /* 16 */ TIMER_STATE_POSTMAN_END +} TimerState; + +typedef enum { + /* 0 */ BOTTLE_TIMER_STATE_OFF, + /* 1 */ BOTTLE_TIMER_STATE_COUNTING +} BottleTimerState; + +typedef enum { + /* 0 */ HUD_VISIBILITY_IDLE, + /* 1 */ HUD_VISIBILITY_NONE, + /* 2 */ HUD_VISIBILITY_NONE_ALT, // Identical to HUD_VISIBILITY_NONE + /* 3 */ HUD_VISIBILITY_HEARTS_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 4 */ HUD_VISIBILITY_A, + /* 5 */ HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 6 */ HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 7 */ HUD_VISIBILITY_ALL_NO_MINIMAP_W_DISABLED, // Only raises button alphas if not disabled + /* 8 */ HUD_VISIBILITY_B, + /* 9 */ HUD_VISIBILITY_HEARTS_MAGIC, + /* 10 */ HUD_VISIBILITY_B_ALT, + /* 11 */ HUD_VISIBILITY_HEARTS, + /* 12 */ HUD_VISIBILITY_A_B_MINIMAP, + /* 13 */ HUD_VISIBILITY_HEARTS_MAGIC_WITH_OVERWRITE, // Uses Interface_UpdateButtonAlphas so gives the opportunity to dim only disabled buttons + /* 14 */ HUD_VISIBILITY_HEARTS_MAGIC_C, + /* 15 */ HUD_VISIBILITY_ALL_NO_MINIMAP, + /* 16 */ HUD_VISIBILITY_A_B_C, + /* 17 */ HUD_VISIBILITY_B_MINIMAP, + /* 18 */ HUD_VISIBILITY_HEARTS_MAGIC_MINIMAP, + /* 19 */ HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP, + /* 20 */ HUD_VISIBILITY_B_MAGIC, + /* 21 */ HUD_VISIBILITY_A_B, + /* 22 */ HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP, + /* 50 */ HUD_VISIBILITY_ALL = 50, + /* 52 */ HUD_VISIBILITY_NONE_INSTANT = 52 +} HudVisibility; + typedef struct SramContext { /* 0x00 */ u8* readBuff; /* 0x04 */ u8 *saveBuf; @@ -86,7 +165,7 @@ typedef struct Inventory { } Inventory; // size = 0x88 typedef struct HorseData { - /* 0x0 */ s16 scene; // "spot_no" + /* 0x0 */ s16 sceneId; // "spot_no" /* 0x2 */ Vec3s pos; // "horse_x", "horse_y" and "horse_z" /* 0x8 */ s16 yaw; // "horse_a" } HorseData; // size = 0xA @@ -147,7 +226,7 @@ typedef struct SavePlayerData { /* 0x20 */ u8 unk_20; // "first_memory" /* 0x22 */ u16 owlActivationFlags; // "memory_warp_point" /* 0x24 */ u8 unk_24; // "last_warp_pt" - /* 0x26 */ s16 savedSceneNum; // "scene_data_ID" + /* 0x26 */ s16 savedSceneId; // "scene_data_ID" } SavePlayerData; // size = 0x28 typedef struct Save { @@ -214,11 +293,11 @@ typedef struct SaveContext { /* 0x1015 */ u8 unk_1015; /* 0x1016 */ u16 jinxTimer; /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" - /* 0x101A */ u8 unk_101A[6]; // "bottle_status", one entry for each bottle - /* 0x1020 */ OSTime unk_1020[6]; // "bottle_ostime", one entry for each bottle - /* 0x1050 */ OSTime unk_1050[6]; // "bottle_sub", one entry for each bottle - /* 0x1080 */ OSTime unk_1080[6]; // "bottle_time", one entry for each bottle - /* 0x10B0 */ OSTime unk_10B0[6]; // "bottle_stop_time", one entry for each bottle + /* 0x101A */ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status" + /* 0x1020 */ OSTime bottleTimerStartOsTimes[BOTTLE_MAX]; // The osTime when the timer starts. "bottle_ostime" + /* 0x1050 */ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // The original total time given before the timer expires, in centiseconds (1/100th sec). "bottle_sub" + /* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time" + /* 0x10B0 */ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // The cumulative osTime spent with the timer paused. "bottle_stop_time" /* 0x10E0 */ u64 pictoPhoto[1400]; // buffer containing the pictograph photo /* 0x3CA0 */ s32 fileNum; // "file_no" /* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer" @@ -237,25 +316,25 @@ typedef struct SaveContext { /* 0x3DBF */ u8 showTitleCard; // "name_display" /* 0x3DC0 */ s16 unk_3DC0; // "shield_magic_timer" /* 0x3DC2 */ u8 unk_3DC2; // "pad1" - /* 0x3DC8 */ OSTime unk_3DC8; // "get_time" - /* 0x3DD0 */ u8 unk_3DD0[7]; // "event_fg" - /* 0x3DD7 */ u8 unk_3DD7[7]; // "calc_flag" - /* 0x3DE0 */ OSTime unk_3DE0[7]; // "event_ostime" - /* 0x3E18 */ OSTime unk_3E18[7]; // "event_sub" - /* 0x3E50 */ OSTime unk_3E50[7]; // "func_time" - /* 0x3E88 */ OSTime unk_3E88[7]; // "func_end_time" - /* 0x3EC0 */ OSTime unk_3EC0[7]; // "func_stop_time" - /* 0x3EF8 */ s16 timerX[7]; // "event_xp" - /* 0x3F06 */ s16 timerY[7]; // "event_yp" + /* 0x3DC8 */ OSTime postmanTimerStopOsTime; // The osTime when the timer stops for the postman minigame. "get_time" + /* 0x3DD0 */ u8 timerStates[TIMER_ID_MAX]; // See the `TimerState` enum. "event_fg" + /* 0x3DD7 */ u8 timerDirections[TIMER_ID_MAX]; // See the `TimerDirection` enum. "calc_flag" + /* 0x3DE0 */ u64 timerCurTimes[TIMER_ID_MAX]; // For countdown, the remaining time left. For countup, the time since the start. In centiseconds (1/100th sec). "event_ostime" + /* 0x3E18 */ u64 timerTimeLimits[TIMER_ID_MAX]; // The original total time given for the timer to count from, in centiseconds (1/100th sec). "event_sub" + /* 0x3E50 */ OSTime timerStartOsTimes[TIMER_ID_MAX]; // The osTime when the timer starts. "func_time" + /* 0x3E88 */ u64 timerStopTimes[TIMER_ID_MAX]; // The total amount of time taken between the start and end of the timer, in centiseconds (1/100th sec). "func_end_time" + /* 0x3EC0 */ OSTime timerPausedOsTimes[TIMER_ID_MAX]; // The cumulative osTime spent with the timer paused. "func_stop_time" + /* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp" + /* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp" /* 0x3F14 */ s16 unk_3F14; // "character_change" /* 0x3F16 */ u8 seqIndex; // "old_bgm" /* 0x3F17 */ u8 nightSeqIndex; // "old_env" /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" - /* 0x3F1E */ u8 unk_3F1E; // "ck_fg" - /* 0x3F20 */ u16 unk_3F20; // "alpha_type" - /* 0x3F22 */ u16 unk_3F22; // "prev_alpha_type" - /* 0x3F24 */ u16 unk_3F24; // "alpha_count" - /* 0x3F26 */ u16 unk_3F26; // "last_time_type" + /* 0x3F1E */ u8 hudVisibilityForceButtonAlphasByStatus; // if btn alphas are updated through Interface_UpdateButtonAlphas, instead update them through Interface_UpdateButtonAlphasByStatus "ck_fg" + /* 0x3F20 */ u16 nextHudVisibility; // triggers the hud to change visibility to the requested value. Reset to HUD_VISIBILITY_IDLE when target is reached "alpha_type" + /* 0x3F22 */ u16 hudVisibility; // current hud visibility "prev_alpha_type" + /* 0x3F24 */ u16 hudVisibilityTimer; // number of frames in the transition to a new hud visibility. Used to step alpha "alpha_count" + /* 0x3F26 */ u16 prevHudVisibility; // used to store and recover hud visibility for pause menu and text boxes "last_time_type" /* 0x3F28 */ s16 magicState; // determines magic meter behavior on each frame "magic_flag" /* 0x3F2A */ s16 isMagicRequested; // a request to add magic has been given "recovery_magic_flag" /* 0x3F2C */ s16 magicFlag; // Set to 0 in func_80812D94(), otherwise unused "keep_magic_flag" diff --git a/include/z64scene.h b/include/z64scene.h index 20573958f6..047d994751 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -271,7 +271,7 @@ typedef struct { } Room; // size = 0x14 typedef struct { - /* 0x00 */ Room currRoom; + /* 0x00 */ Room curRoom; /* 0x14 */ Room prevRoom; /* 0x28 */ void* roomMemPages[2]; // In a scene with transitions, roomMemory is split between two pages that toggle each transition. This is one continuous range, as the second page allocates from the end /* 0x30 */ u8 activeMemPage; // 0 - First page in memory, 1 - Second page @@ -316,7 +316,7 @@ typedef struct { } EntranceEntry; // size = 0x2 typedef struct { - /* 0x0 */ s8 sceneNum; + /* 0x0 */ s8 sceneId; /* 0x1 */ s8 spawnNum; /* 0x2 */ u16 flags; } EntranceTableEntry; // size = 0x4 @@ -535,119 +535,119 @@ typedef union { } SceneCmd; // size = 0x8 typedef enum { - /* 0x00 */ SCENE_20SICHITAI2, + /* 0x00 */ SCENE_20SICHITAI2, // Southern Swamp (Clear) /* 0x01 */ SCENE_UNSET_1, /* 0x02 */ SCENE_UNSET_2, /* 0x03 */ SCENE_UNSET_3, /* 0x04 */ SCENE_UNSET_4, /* 0x05 */ SCENE_UNSET_5, /* 0x06 */ SCENE_UNSET_6, - /* 0x07 */ SCENE_KAKUSIANA, - /* 0x08 */ SCENE_SPOT00, + /* 0x07 */ SCENE_KAKUSIANA, // Lone Peak Shrine & Grottos + /* 0x08 */ SCENE_SPOT00, // Cutscene Scene /* 0x09 */ SCENE_UNSET_9, - /* 0x0A */ SCENE_WITCH_SHOP, - /* 0x0B */ SCENE_LAST_BS, - /* 0x0C */ SCENE_HAKASHITA, - /* 0x0D */ SCENE_AYASHIISHOP, + /* 0x0A */ SCENE_WITCH_SHOP, // Magic Hags' Potion Shop + /* 0x0B */ SCENE_LAST_BS, // Majora's Lair + /* 0x0C */ SCENE_HAKASHITA, // Beneath the Graveyard + /* 0x0D */ SCENE_AYASHIISHOP, // Curiosity Shop /* 0x0E */ SCENE_UNSET_E, /* 0x0F */ SCENE_UNSET_F, - /* 0x10 */ SCENE_OMOYA, - /* 0x11 */ SCENE_BOWLING, - /* 0x12 */ SCENE_SONCHONOIE, - /* 0x13 */ SCENE_IKANA, - /* 0x14 */ SCENE_KAIZOKU, - /* 0x15 */ SCENE_MILK_BAR, - /* 0x16 */ SCENE_INISIE_N, - /* 0x17 */ SCENE_TAKARAYA, - /* 0x18 */ SCENE_INISIE_R, - /* 0x19 */ SCENE_OKUJOU, - /* 0x1A */ SCENE_OPENINGDAN, - /* 0x1B */ SCENE_MITURIN, - /* 0x1C */ SCENE_13HUBUKINOMITI, - /* 0x1D */ SCENE_CASTLE, - /* 0x1E */ SCENE_DEKUTES, - /* 0x1F */ SCENE_MITURIN_BS, - /* 0x20 */ SCENE_SYATEKI_MIZU, - /* 0x21 */ SCENE_HAKUGIN, - /* 0x22 */ SCENE_ROMANYMAE, - /* 0x23 */ SCENE_PIRATE, - /* 0x24 */ SCENE_SYATEKI_MORI, - /* 0x25 */ SCENE_SINKAI, - /* 0x26 */ SCENE_YOUSEI_IZUMI, - /* 0x27 */ SCENE_KINSTA1, - /* 0x28 */ SCENE_KINDAN2, - /* 0x29 */ SCENE_TENMON_DAI, - /* 0x2A */ SCENE_LAST_DEKU, - /* 0x2B */ SCENE_22DEKUCITY, - /* 0x2C */ SCENE_KAJIYA, - /* 0x2D */ SCENE_00KEIKOKU, - /* 0x2E */ SCENE_POSTHOUSE, - /* 0x2F */ SCENE_LABO, - /* 0x30 */ SCENE_DANPEI2TEST, + /* 0x10 */ SCENE_OMOYA, // Mama's House (Ranch House in PAL) & Barn + /* 0x11 */ SCENE_BOWLING, // Honey & Darling's Shop + /* 0x12 */ SCENE_SONCHONOIE, // The Mayor's Residence + /* 0x13 */ SCENE_IKANA, // Ikana Canyon + /* 0x14 */ SCENE_KAIZOKU, // Pirates' Fortress + /* 0x15 */ SCENE_MILK_BAR, // Milk Bar + /* 0x16 */ SCENE_INISIE_N, // Stone Tower Temple + /* 0x17 */ SCENE_TAKARAYA, // Treasure Chest Shop + /* 0x18 */ SCENE_INISIE_R, // Inverted Stone Tower Temple + /* 0x19 */ SCENE_OKUJOU, // Clock Tower Rooftop + /* 0x1A */ SCENE_OPENINGDAN, // Before Clock Town + /* 0x1B */ SCENE_MITURIN, // Woodfall Temple + /* 0x1C */ SCENE_13HUBUKINOMITI, // Path to Mountain Village + /* 0x1D */ SCENE_CASTLE, // Ancient Castle of Ikana + /* 0x1E */ SCENE_DEKUTES, // Deku Scrub Playground + /* 0x1F */ SCENE_MITURIN_BS, // Odolwa's Lair + /* 0x20 */ SCENE_SYATEKI_MIZU, // Town Shooting Gallery + /* 0x21 */ SCENE_HAKUGIN, // Snowhead Temple + /* 0x22 */ SCENE_ROMANYMAE, // Milk Road + /* 0x23 */ SCENE_PIRATE, // Pirates' Fortress Interior + /* 0x24 */ SCENE_SYATEKI_MORI, // Swamp Shooting Gallery + /* 0x25 */ SCENE_SINKAI, // Pinnacle Rock + /* 0x26 */ SCENE_YOUSEI_IZUMI, // Fairy's Fountain + /* 0x27 */ SCENE_KINSTA1, // Swamp Spider House + /* 0x28 */ SCENE_KINDAN2, // Oceanside Spider House + /* 0x29 */ SCENE_TENMON_DAI, // Astral Observatory + /* 0x2A */ SCENE_LAST_DEKU, // Moon Deku Trial + /* 0x2B */ SCENE_22DEKUCITY, // Deku Palace + /* 0x2C */ SCENE_KAJIYA, // Mountain Smithy + /* 0x2D */ SCENE_00KEIKOKU, // Termina Field + /* 0x2E */ SCENE_POSTHOUSE, // Post Office + /* 0x2F */ SCENE_LABO, // Marine Research Lab + /* 0x30 */ SCENE_DANPEI2TEST, // Beneath the Graveyard (Day 3) and Dampe's House /* 0x31 */ SCENE_UNSET_31, - /* 0x32 */ SCENE_16GORON_HOUSE, - /* 0x33 */ SCENE_33ZORACITY, - /* 0x34 */ SCENE_8ITEMSHOP, - /* 0x35 */ SCENE_F01, - /* 0x36 */ SCENE_INISIE_BS, - /* 0x37 */ SCENE_30GYOSON, - /* 0x38 */ SCENE_31MISAKI, - /* 0x39 */ SCENE_TAKARAKUJI, + /* 0x32 */ SCENE_16GORON_HOUSE, // Goron Shrine + /* 0x33 */ SCENE_33ZORACITY, // Zora Hall + /* 0x34 */ SCENE_8ITEMSHOP, // Trading Post + /* 0x35 */ SCENE_F01, // Romani Ranch + /* 0x36 */ SCENE_INISIE_BS, // Twinmold's Lair + /* 0x37 */ SCENE_30GYOSON, // Great Bay Coast + /* 0x38 */ SCENE_31MISAKI, // Zora Cape + /* 0x39 */ SCENE_TAKARAKUJI, // Lottery Shop /* 0x3A */ SCENE_UNSET_3A, - /* 0x3B */ SCENE_TORIDE, - /* 0x3C */ SCENE_FISHERMAN, - /* 0x3D */ SCENE_GORONSHOP, - /* 0x3E */ SCENE_DEKU_KING, - /* 0x3F */ SCENE_LAST_GORON, - /* 0x40 */ SCENE_24KEMONOMITI, - /* 0x41 */ SCENE_F01_B, - /* 0x42 */ SCENE_F01C, - /* 0x43 */ SCENE_BOTI, - /* 0x44 */ SCENE_HAKUGIN_BS, - /* 0x45 */ SCENE_20SICHITAI, - /* 0x46 */ SCENE_21MITURINMAE, - /* 0x47 */ SCENE_LAST_ZORA, - /* 0x48 */ SCENE_11GORONNOSATO2, - /* 0x49 */ SCENE_SEA, - /* 0x4A */ SCENE_35TAKI, - /* 0x4B */ SCENE_REDEAD, - /* 0x4C */ SCENE_BANDROOM, - /* 0x4D */ SCENE_11GORONNOSATO, - /* 0x4E */ SCENE_GORON_HAKA, - /* 0x4F */ SCENE_SECOM, - /* 0x50 */ SCENE_10YUKIYAMANOMURA, - /* 0x51 */ SCENE_TOUGITES, - /* 0x52 */ SCENE_DANPEI, - /* 0x53 */ SCENE_IKANAMAE, - /* 0x54 */ SCENE_DOUJOU, - /* 0x55 */ SCENE_MUSICHOUSE, - /* 0x56 */ SCENE_IKNINSIDE, - /* 0x57 */ SCENE_MAP_SHOP, - /* 0x58 */ SCENE_F40, - /* 0x59 */ SCENE_F41, - /* 0x5A */ SCENE_10YUKIYAMANOMURA2, - /* 0x5B */ SCENE_14YUKIDAMANOMITI, - /* 0x5C */ SCENE_12HAKUGINMAE, - /* 0x5D */ SCENE_17SETUGEN, - /* 0x5E */ SCENE_17SETUGEN2, - /* 0x5F */ SCENE_SEA_BS, - /* 0x60 */ SCENE_RANDOM, - /* 0x61 */ SCENE_YADOYA, - /* 0x62 */ SCENE_KONPEKI_ENT, - /* 0x63 */ SCENE_INSIDETOWER, - /* 0x64 */ SCENE_26SARUNOMORI, - /* 0x65 */ SCENE_LOST_WOODS, - /* 0x66 */ SCENE_LAST_LINK, - /* 0x67 */ SCENE_SOUGEN, - /* 0x68 */ SCENE_BOMYA, - /* 0x69 */ SCENE_KYOJINNOMA, - /* 0x6A */ SCENE_KOEPONARACE, - /* 0x6B */ SCENE_GORONRACE, - /* 0x6C */ SCENE_TOWN, - /* 0x6D */ SCENE_ICHIBA, - /* 0x6E */ SCENE_BACKTOWN, - /* 0x6F */ SCENE_CLOCKTOWER, - /* 0x70 */ SCENE_ALLEY, + /* 0x3B */ SCENE_TORIDE, // Pirates' Fortress Moat + /* 0x3C */ SCENE_FISHERMAN, // Fisherman's Hut + /* 0x3D */ SCENE_GORONSHOP, // Goron Shop + /* 0x3E */ SCENE_DEKU_KING, // Deku King's Chamber + /* 0x3F */ SCENE_LAST_GORON, // Moon Goron Trial + /* 0x40 */ SCENE_24KEMONOMITI, // Road to Southern Swamp + /* 0x41 */ SCENE_F01_B, // Doggy Racetrack + /* 0x42 */ SCENE_F01C, // Cucco Shack + /* 0x43 */ SCENE_BOTI, // Ikana Graveyard + /* 0x44 */ SCENE_HAKUGIN_BS, // Goht's Lair + /* 0x45 */ SCENE_20SICHITAI, // Southern Swamp (poison) + /* 0x46 */ SCENE_21MITURINMAE, // Woodfall + /* 0x47 */ SCENE_LAST_ZORA, // Moon Zora Trial + /* 0x48 */ SCENE_11GORONNOSATO2, // Goron Village (spring) + /* 0x49 */ SCENE_SEA, // Great Bay Temple + /* 0x4A */ SCENE_35TAKI, // Waterfall Rapids + /* 0x4B */ SCENE_REDEAD, // Beneath the Well + /* 0x4C */ SCENE_BANDROOM, // Zora Hall Rooms + /* 0x4D */ SCENE_11GORONNOSATO, // Goron Village (winter) + /* 0x4E */ SCENE_GORON_HAKA, // Goron Graveyard + /* 0x4F */ SCENE_SECOM, // Sakon's Hideout + /* 0x50 */ SCENE_10YUKIYAMANOMURA, // Mountain Village (winter) + /* 0x51 */ SCENE_TOUGITES, // Ghost Hut + /* 0x52 */ SCENE_DANPEI, // Deku Shrine + /* 0x53 */ SCENE_IKANAMAE, // Road to Ikana + /* 0x54 */ SCENE_DOUJOU, // Swordsman's School + /* 0x55 */ SCENE_MUSICHOUSE, // Music Box House + /* 0x56 */ SCENE_IKNINSIDE, // Igos du Ikana's Lair + /* 0x57 */ SCENE_MAP_SHOP, // Tourist Information + /* 0x58 */ SCENE_F40, // Stone Tower + /* 0x59 */ SCENE_F41, // Inverted Stone Tower + /* 0x5A */ SCENE_10YUKIYAMANOMURA2, // Mountain Village (spring) + /* 0x5B */ SCENE_14YUKIDAMANOMITI, // Path to Snowhead + /* 0x5C */ SCENE_12HAKUGINMAE, // Snowhead + /* 0x5D */ SCENE_17SETUGEN, // Path to Goron Village (winter) + /* 0x5E */ SCENE_17SETUGEN2, // Path to Goron Village (spring) + /* 0x5F */ SCENE_SEA_BS, // Gyorg's Lair + /* 0x60 */ SCENE_RANDOM, // Secret Shrine + /* 0x61 */ SCENE_YADOYA, // Stock Pot Inn + /* 0x62 */ SCENE_KONPEKI_ENT, // Great Bay Cutscene + /* 0x63 */ SCENE_INSIDETOWER, // Clock Tower Interior + /* 0x64 */ SCENE_26SARUNOMORI, // Woods of Mystery + /* 0x65 */ SCENE_LOST_WOODS, // Lost Woods (Intro) + /* 0x66 */ SCENE_LAST_LINK, // Moon Link Trial + /* 0x67 */ SCENE_SOUGEN, // The Moon + /* 0x68 */ SCENE_BOMYA, // Bomb Shop + /* 0x69 */ SCENE_KYOJINNOMA, // Giants' Chamber + /* 0x6A */ SCENE_KOEPONARACE, // Gorman Track + /* 0x6B */ SCENE_GORONRACE, // Goron Racetrack + /* 0x6C */ SCENE_TOWN, // East Clock Town + /* 0x6D */ SCENE_ICHIBA, // West Clock Town + /* 0x6E */ SCENE_BACKTOWN, // North Clock Town + /* 0x6F */ SCENE_CLOCKTOWER, // South Clock Town + /* 0x70 */ SCENE_ALLEY, // Laundry Pool /* 0x71 */ SCENE_MAX } SceneId; @@ -844,11 +844,11 @@ typedef enum { #define SCENE_CMD_SPECIAL_FILES(elfMessageFile, keepObjectId) \ { SCENE_CMD_ID_SPECIAL_FILES, elfMessageFile, CMD_W(keepObjectId) } -#define SCENE_CMD_ROOM_BEHAVIOR(currRoomUnk3, currRoomUnk2, currRoomUnk5, msgCtxunk12044, enablePosLights, \ +#define SCENE_CMD_ROOM_BEHAVIOR(curRoomUnk3, curRoomUnk2, curRoomUnk5, msgCtxunk12044, enablePosLights, \ kankyoContextUnkE2) \ { \ - SCENE_CMD_ID_ROOM_BEHAVIOR, currRoomUnk3, \ - currRoomUnk2 | _SHIFTL(currRoomUnk5, 8, 1) | _SHIFTL(msgCtxunk12044, 10, 1) | \ + SCENE_CMD_ID_ROOM_BEHAVIOR, curRoomUnk3, \ + curRoomUnk2 | _SHIFTL(curRoomUnk5, 8, 1) | _SHIFTL(msgCtxunk12044, 10, 1) | \ _SHIFTL(enablePosLights, 11, 1) | _SHIFTL(kankyoContextUnkE2, 12, 1) \ } diff --git a/include/z64schedule.h b/include/z64schedule.h index cff6224f4f..69906e584c 100644 --- a/include/z64schedule.h +++ b/include/z64schedule.h @@ -42,8 +42,8 @@ typedef enum { /* 0x07 */ SCHEDULE_CMD_ID_NOP, // No-Op /* 0x08 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch /* 0x09 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value - /* 0x0A */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneNum and branches if so, short range branch - /* 0x0B */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneNum and branches if so, long range branch + /* 0x0A */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneId and branches if so, short range branch + /* 0x0B */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneId and branches if so, long range branch /* 0x0C */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_S, // Checks if the current day is not Day and branches if so, short range branch /* 0x0D */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_L, // Checks if the current day is not Day and branches if so, long range branch /* 0x0E */ SCHEDULE_CMD_ID_RET_TIME, // Returns 2 time values @@ -130,15 +130,15 @@ typedef struct { typedef struct { /* 0x0 */ ScheduleCmdBase base; - /* 0x1 */ u8 sceneH; - /* 0x2 */ u8 sceneL; + /* 0x1 */ u8 sceneIdH; + /* 0x2 */ u8 sceneIdL; /* 0x3 */ s8 offset; } ScheduleCmdCheckNotInSceneS; // size = 0x4 typedef struct { /* 0x0 */ ScheduleCmdBase base; - /* 0x1 */ u8 sceneH; - /* 0x2 */ u8 sceneL; + /* 0x1 */ u8 sceneIdH; + /* 0x2 */ u8 sceneIdL; /* 0x3 */ u8 offsetH; /* 0x4 */ u8 offsetL; } ScheduleCmdCheckNotInSceneL; // size = 0x5 diff --git a/spec b/spec index bbbd3fc8cb..06a111bc5f 100644 --- a/spec +++ b/spec @@ -2028,8 +2028,7 @@ beginseg name "ovl_En_Tg" compress include "build/src/overlays/actors/ovl_En_Tg/z_en_tg.o" - include "build/data/ovl_En_Tg/ovl_En_Tg.data.o" - include "build/data/ovl_En_Tg/ovl_En_Tg.reloc.o" + include "build/src/overlays/actors/ovl_En_Tg/ovl_En_Tg_reloc.o" endseg beginseg @@ -2079,9 +2078,7 @@ beginseg name "ovl_Oceff_Wipe4" compress include "build/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.o" - include "build/data/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4.data.o" - include "build/data/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4.bss.o" - include "build/data/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4.reloc.o" + include "build/src/overlays/actors/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4_reloc.o" endseg beginseg @@ -2174,8 +2171,7 @@ beginseg name "ovl_En_Grasshopper" compress include "build/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.o" - include "build/data/ovl_En_Grasshopper/ovl_En_Grasshopper.data.o" - include "build/data/ovl_En_Grasshopper/ovl_En_Grasshopper.reloc.o" + include "build/src/overlays/actors/ovl_En_Grasshopper/ovl_En_Grasshopper_reloc.o" endseg beginseg @@ -2640,8 +2636,7 @@ beginseg name "ovl_En_Ru" compress include "build/src/overlays/actors/ovl_En_Ru/z_en_ru.o" - include "build/data/ovl_En_Ru/ovl_En_Ru.data.o" - include "build/data/ovl_En_Ru/ovl_En_Ru.reloc.o" + include "build/src/overlays/actors/ovl_En_Ru/ovl_En_Ru_reloc.o" endseg beginseg @@ -4569,8 +4564,7 @@ beginseg name "ovl_En_Nimotsu" compress include "build/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.o" - include "build/data/ovl_En_Nimotsu/ovl_En_Nimotsu.data.o" - include "build/data/ovl_En_Nimotsu/ovl_En_Nimotsu.reloc.o" + include "build/src/overlays/actors/ovl_En_Nimotsu/ovl_En_Nimotsu_reloc.o" endseg beginseg @@ -5099,8 +5093,7 @@ beginseg name "ovl_Obj_Swprize" compress include "build/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.o" - include "build/data/ovl_Obj_Swprize/ovl_Obj_Swprize.data.o" - include "build/data/ovl_Obj_Swprize/ovl_Obj_Swprize.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Swprize/ovl_Obj_Swprize_reloc.o" endseg beginseg @@ -7012,11 +7005,11 @@ beginseg endseg beginseg - name "object_dnq" + name "object_dno" compress romalign 0x1000 number 6 - include "build/assets/objects/object_dnq/object_dnq.o" + include "build/assets/objects/object_dno/object_dno.o" endseg beginseg @@ -7580,11 +7573,11 @@ beginseg endseg beginseg - name "object_dnp" + name "object_dnq" compress romalign 0x1000 number 6 - include "build/assets/objects/object_dnp/object_dnp.o" + include "build/assets/objects/object_dnq/object_dnq.o" endseg beginseg @@ -7748,11 +7741,11 @@ beginseg endseg beginseg - name "object_dno" + name "object_dnj" compress romalign 0x1000 number 6 - include "build/assets/objects/object_dno/object_dno.o" + include "build/assets/objects/object_dnj/object_dnj.o" endseg beginseg diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index ee2070610b..278ef0830d 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -365,7 +365,7 @@ s16 gItemPrices[] = { }; // Used to map scene indexes to their region in Termina -u16 gScenesPerRegion[11][27] = { +u16 gSceneIdsPerRegion[11][27] = { // Great Bay { SCENE_30GYOSON, @@ -522,7 +522,7 @@ void Inventory_ChangeUpgrade(s16 upgrade, u32 value) { gSaveContext.save.inventory.upgrades = upgrades; } -s32 Inventory_IsMapVisible(s16 sceneNum) { +s32 Inventory_IsMapVisible(s16 sceneId) { s16 index = 0; /** @@ -530,30 +530,30 @@ s32 Inventory_IsMapVisible(s16 sceneNum) { * increment to the next index of scenesVisible so that every scene gets a unique flag in scenesVisible, * 224 bits were allocated to this although there are only 112 scenes */ - if (sceneNum >= 0x20) { - if (sceneNum < 0x40) { + if (sceneId >= 0x20) { + if (sceneId < 0x40) { index = 1; - } else if (sceneNum < 0x60) { + } else if (sceneId < 0x60) { index = 2; - } else if (sceneNum < 0x80) { + } else if (sceneId < 0x80) { index = 3; - } else if (sceneNum < 0xA0) { + } else if (sceneId < 0xA0) { index = 4; - } else if (sceneNum < 0xC0) { + } else if (sceneId < 0xC0) { index = 5; - } else if (sceneNum < 0xE0) { + } else if (sceneId < 0xE0) { index = 6; } } - if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneNum - (index << 5)]) { + if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneId - (index << 5)]) { return true; } return false; } -static u16 sScenesPerTingleMap[6][12] = { +static u16 sSceneIdsPerTingleMap[6][12] = { { // Clock Town Tingle Map SCENE_00KEIKOKU, @@ -630,11 +630,11 @@ static u16 sScenesPerTingleMap[6][12] = { void Inventory_SetMapVisibility(s16 tingleIndex) { s16 i = 0; s16 index = 0; - u16(*tingleMapSceneIndices)[] = &sScenesPerTingleMap[tingleIndex]; + u16(*tingleMapSceneIds)[] = &sSceneIdsPerTingleMap[tingleIndex]; if ((tingleIndex >= 0) && (tingleIndex < 6)) { while (true) { - if ((*tingleMapSceneIndices)[i] == 0xFFFF) { + if ((*tingleMapSceneIds)[i] == 0xFFFF) { break; } @@ -643,38 +643,38 @@ void Inventory_SetMapVisibility(s16 tingleIndex) { * increment to the next index of scenesVisible so that every scene gets a unique flag in scenesVisible, * 224 bits were allocated to this although there are only 112 scenes */ - if (((s16)(*tingleMapSceneIndices)[i]) < 0x20) { + if (((s16)(*tingleMapSceneIds)[i]) < 0x20) { index = 0; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0x40) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0x40) { index = 1; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0x60) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0x60) { index = 2; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0x80) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0x80) { index = 3; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0xA0) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0xA0) { index = 4; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0xC0) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0xC0) { index = 5; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0xE0) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0xE0) { index = 6; } gSaveContext.save.scenesVisible[index] = - gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIndices)[i] - (index << 5)]; + gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIds)[i] - (index << 5)]; i++; } - if ((*tingleMapSceneIndices) == sScenesPerTingleMap[0]) { + if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[0]) { gSaveContext.save.mapsVisible |= 3; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[1]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[1]) { gSaveContext.save.mapsVisible |= 0x1C; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[2]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[2]) { gSaveContext.save.mapsVisible |= 0xE0; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[3]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[3]) { gSaveContext.save.mapsVisible |= 0x100; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[4]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[4]) { gSaveContext.save.mapsVisible |= 0x1E00; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[5]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[5]) { gSaveContext.save.mapsVisible |= 0x6000; } } @@ -688,7 +688,7 @@ void Inventory_SetMapVisibility(s16 tingleIndex) { void Inventory_SaveDekuPlaygroundHighScore(s16 timerId) { s16 i; - gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.unk_3DE0[timerId]; + gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.timerCurTimes[timerId]; for (i = 0; i < 8; i++) { gSaveContext.save.inventory.dekuPlaygroundPlayerName[CURRENT_DAY - 1][i] = diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 1b70ff75b8..8aa9bd2711 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1336,7 +1336,7 @@ s32 func_800B715C(PlayState* play) { } void Actor_SetCameraHorseSetting(PlayState* play, Player* player) { - if ((play->roomCtx.currRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { + if ((play->roomCtx.curRoom.unk3 != 4) && (player->actor.id == ACTOR_PLAYER)) { EnHorse* rideActor = (EnHorse*)player->rideActor; if ((rideActor != NULL) && !(rideActor->unk_1EC & 0x10)) { @@ -2235,7 +2235,7 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto s32 i; gSaveContext.save.weekEventReg[92] |= 0x80; - cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(play->sceneNum)]; + cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneId(play->sceneId)]; bzero(actorCtx, sizeof(ActorContext)); ActorOverlayTable_Init(); @@ -2252,8 +2252,8 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto 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]; + if (play->sceneId == SCENE_INISIE_R) { + cycleFlags = &gSaveContext.cycleSceneFlags[play->sceneId]; } actorCtx->sceneFlags.collectible[0] = cycleFlags->collectible; actorCtx->sceneFlags.clearedRoom = cycleFlags->clearedRoom; @@ -2499,7 +2499,7 @@ void Actor_Draw(PlayState* play, Actor* actor) { OPEN_DISPS(play->state.gfxCtx); light = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx); - if ((actor->flags & ACTOR_FLAG_10000000) && (play->roomCtx.currRoom.enablePosLights || (MREG(93) != 0))) { + if ((actor->flags & ACTOR_FLAG_10000000) && (play->roomCtx.curRoom.enablePosLights || (MREG(93) != 0))) { light->enablePosLights = true; } @@ -2669,7 +2669,7 @@ void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors) { gDPSetPrimColor(spAC++, 0, 0, 0, 0, 0, 255); // temp_s1_5 = spAC; - if (play->roomCtx.currRoom.unk5 == 0) { + if (play->roomCtx.curRoom.unk5 == 0) { // temp_s1_5->words.w0 = 0xFC61E6C3; // temp_s1_5->words.w1 = 0x11CF9FCF; // phi_s1 = temp_s1_5 + 8; @@ -2719,7 +2719,7 @@ void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors) { // temp_a0_2 = &spAC; // if (sp34->unk_6E5 == 0) { - if (play->roomCtx.currRoom.unk5 == 0) { + if (play->roomCtx.curRoom.unk5 == 0) { // temp_s1_10->unk_0 = 0xFC119623; // temp_s1_10->unk_4 = 0xFF2FFFFF; // phi_s1_4 = temp_s1_10 + 8; @@ -2882,8 +2882,8 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { actor->isDrawn = false; if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & actorFlags)) { if ((actor->flags & ACTOR_FLAG_80) && - ((play->roomCtx.currRoom.unk5 == 0) || (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) || - (actor->room != play->roomCtx.currRoom.num))) { + ((play->roomCtx.curRoom.unk5 == 0) || (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) || + (actor->room != play->roomCtx.curRoom.num))) { if (Actor_RecordUndrawnActor(play, actor)) {} } else { Actor_Draw(play, actor); @@ -2960,7 +2960,7 @@ void func_800BA798(PlayState* play, ActorContext* actorCtx) { actor = actorCtx->actorLists[i].first; while (actor != NULL) { - if ((actor->room >= 0) && (actor->room != play->roomCtx.currRoom.num) && + if ((actor->room >= 0) && (actor->room != play->roomCtx.curRoom.num) && (actor->room != play->roomCtx.prevRoom.num)) { if (!actor->isDrawn) { actor = Actor_Delete(actorCtx, actor, play); @@ -3091,9 +3091,9 @@ Actor* Actor_RemoveFromCategory(PlayState* play, ActorContext* actorCtx, Actor* actorToRemove->next = NULL; actorToRemove->prev = NULL; - if ((actorToRemove->room == play->roomCtx.currRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && + if ((actorToRemove->room == play->roomCtx.curRoom.num) && (actorToRemove->category == ACTORCAT_ENEMY) && (actorCtx->actorLists[ACTORCAT_ENEMY].length == 0)) { - Flags_SetClearTemp(play, play->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.curRoom.num); } return newHead; @@ -3180,8 +3180,8 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 } objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId); - if ((objBankIndex < 0) || ((actorInit->type == ACTORCAT_ENEMY) && - Flags_GetClear(play, play->roomCtx.currRoom.num) && (actorInit->id != ACTOR_BOSS_05))) { + if ((objBankIndex < 0) || ((actorInit->type == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num) && + (actorInit->id != ACTOR_BOSS_05))) { Actor_FreeOverlay(&gActorOverlayTable[index]); return NULL; } @@ -3219,7 +3219,7 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 actor->parent = parent; parent->child = actor; } else { - actor->room = play->roomCtx.currRoom.num; + actor->room = play->roomCtx.curRoom.num; } actor->home.pos.x = x; @@ -3267,10 +3267,10 @@ void Actor_SpawnTransitionActors(PlayState* play, ActorContext* actorCtx) { for (i = 0; i < numTransitionActors; transitionActorList++, i++) { if (transitionActorList->id >= 0) { if ((transitionActorList->sides[0].room >= 0 && - (play->roomCtx.currRoom.num == transitionActorList->sides[0].room || + (play->roomCtx.curRoom.num == transitionActorList->sides[0].room || play->roomCtx.prevRoom.num == transitionActorList->sides[0].room)) || (transitionActorList->sides[1].room >= 0 && - (play->roomCtx.currRoom.num == transitionActorList->sides[1].room || + (play->roomCtx.curRoom.num == transitionActorList->sides[1].room || play->roomCtx.prevRoom.num == transitionActorList->sides[1].room))) { s16 rotY = ((transitionActorList->rotY >> 7) & 0x1FF) * (0x10000 / 360.0f); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index e73dd7f6e5..130fdc9706 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "vt.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" @@ -46,7 +47,7 @@ u8 D_801B46C0[] = { /* 0x0E */ 1 }; -s16 sSmallMemScenes[] = { +s16 sSmallMemSceneIds[] = { SCENE_F01, }; @@ -1462,10 +1463,10 @@ u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLo * Returns whether the current scene should reserve less memory for it's collision lookup */ s32 BgCheck_IsSmallMemScene(PlayState* play) { - s16* i; + s16* sceneId; - for (i = sSmallMemScenes; i < sSmallMemScenes + ARRAY_COUNT(sSmallMemScenes); i++) { - if (play->sceneNum == *i) { + for (sceneId = sSmallMemSceneIds; sceneId < sSmallMemSceneIds + ARRAY_COUNT(sSmallMemSceneIds); sceneId++) { + if (play->sceneId == *sceneId) { return true; } } @@ -1504,7 +1505,7 @@ s32 BgCheck_GetSpecialSceneMaxObjects(PlayState* play, s32* maxNodes, s32* maxPo s32 i; for (i = 0; i < ARRAY_COUNT(sCustomDynapolyMem); i++) { - if (play->sceneNum == sCustomDynapolyMem[i].sceneId) { + if (play->sceneId == sCustomDynapolyMem[i].sceneId) { *maxNodes = sCustomDynapolyMem[i].maxNodes; *maxPolygons = sCustomDynapolyMem[i].maxPolygons; *maxVertices = sCustomDynapolyMem[i].maxVertices; @@ -1541,7 +1542,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader s32 useCustomSubdivisions; s32 i; - if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) { + if (BgCheck_TryGetCustomMemsize(play->sceneId, &customMemSize)) { colCtx->memSize = customMemSize; } else { colCtx->memSize = 0x23000; @@ -1554,7 +1555,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader useCustomSubdivisions = false; for (i = 0; i < ARRAY_COUNT(sSceneSubdivisionList); i++) { - if (play->sceneNum == sSceneSubdivisionList[i].sceneId) { + if (play->sceneId == sSceneSubdivisionList[i].sceneId) { colCtx->subdivAmount.x = sSceneSubdivisionList[i].subdivAmount.x; colCtx->subdivAmount.y = sSceneSubdivisionList[i].subdivAmount.y; colCtx->subdivAmount.z = sSceneSubdivisionList[i].subdivAmount.z; @@ -4404,7 +4405,7 @@ s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f3 for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = 0x3F & (curWaterBox->properties >> 13); - if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) { if (curWaterBox->properties & 0x80000) { continue; } @@ -4489,7 +4490,7 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos, waterBox = &colHeader->waterBoxes[i]; room = WATERBOX_ROOM(waterBox->properties); - if (!(room == play->roomCtx.currRoom.num || room == 0x3F)) { + if (!(room == play->roomCtx.curRoom.num || room == 0x3F)) { continue; } if ((waterBox->properties & 0x80000)) { @@ -4631,7 +4632,7 @@ s32 func_800CA6F0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = WATERBOX_ROOM(curWaterBox->properties); - if (room == (u32)play->roomCtx.currRoom.num || room == 0x3F) { + if (room == (u32)play->roomCtx.curRoom.num || room == 0x3F) { if ((curWaterBox->properties & 0x80000) != 0) { if (curWaterBox->minPos.x < x && x < curWaterBox->minPos.x + curWaterBox->xLength) { if (curWaterBox->minPos.z < z && z < curWaterBox->minPos.z + curWaterBox->zLength) { diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 955f548701..c970282a89 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -16,7 +16,7 @@ void SaveContext_Init(void) { gSaveContext.skyboxTime = 0; gSaveContext.dogIsLost = true; gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; - gSaveContext.unk_3F26 = 50; + gSaveContext.prevHudVisibility = HUD_VISIBILITY_ALL; gSaveContext.options.language = 1; gSaveContext.options.audioSetting = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 02fa0a66e2..ba77ee7537 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -105,7 +105,7 @@ s32 func_800EA220(PlayState* play, CutsceneContext* csCtx, f32 target) { } void func_800EA258(PlayState* play, CutsceneContext* csCtx) { - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_SetLetterboxTarget(32); if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); @@ -115,7 +115,7 @@ void func_800EA258(PlayState* play, CutsceneContext* csCtx) { void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) { func_800ED980(play, csCtx); - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_SetLetterboxTarget(32); if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); @@ -215,7 +215,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c gVisMonoColor.a = 255 * progress; break; case 0xC: - play->roomCtx.currRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; break; case 0xD: if (play->state.frames & 8) { @@ -561,7 +561,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* gSaveContext.cutsceneTransitionControl = 1; if ((gSaveContext.gameMode != 0) && (csCtx->frames != cmd->startFrame)) { - gSaveContext.unk_3F1E = 1; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; } gSaveContext.save.cutscene = 0; @@ -1078,7 +1078,7 @@ void Cutscene_Command_Textbox(PlayState* play, CutsceneContext* csCtx, CsCmdText } if (originalCsFrames == csCtx->frames) { - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); D_801BB124 = 0; D_801BB128 = 0; func_80161C0C(); @@ -1451,7 +1451,7 @@ void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { csCtx->unk_18 = 0xFFFF; if (gSaveContext.cutsceneTrigger == 0) { - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); ShrinkWindow_SetLetterboxTarget(32); ShrinkWindow_SetLetterboxMagnitude(0x20); csCtx->state++; diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index 25d6f8ca89..11e4a2743c 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -20,7 +20,7 @@ u16 ElfMessage_GetFirstCycleHint(PlayState* play) { if (gSaveContext.save.weekEventReg[9] & 1) { return 0x21E; } - if (play->sceneNum == SCENE_YOUSEI_IZUMI) { + if (play->sceneId == SCENE_YOUSEI_IZUMI) { return 0; } return 0x21D; @@ -29,7 +29,7 @@ u16 ElfMessage_GetFirstCycleHint(PlayState* play) { return 0x21F; } if (INV_CONTENT(ITEM_DEED_LAND) == ITEM_DEED_LAND) { - if (play->sceneNum != SCENE_OKUJOU) { + if (play->sceneId != SCENE_OKUJOU) { return 0x244; } return 0; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index cfcc8905de..92f7b78dc3 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -18,14 +18,14 @@ static s16 sGameOverTimer = 0; void GameOver_Update(PlayState* play) { GameOverContext* gameOverCtx = &play->gameOverCtx; - s16 i; + s16 timerId; switch (gameOverCtx->state) { case GAMEOVER_DEATH_START: func_801477B4(play); - for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) { - gSaveContext.unk_3DD0[i] = 0; + for (timerId = 0; timerId < TIMER_ID_MAX; timerId++) { + gSaveContext.timerStates[timerId] = TIMER_STATE_OFF; } gSaveContext.eventInf[1] &= ~1; @@ -57,10 +57,10 @@ void GameOver_Update(PlayState* play) { gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; - gSaveContext.unk_3F1E = 0; - gSaveContext.unk_3F20 = 0; - gSaveContext.unk_3F22 = 0; - gSaveContext.unk_3F24 = 0; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; + gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibilityTimer = 0; Kankyo_InitGameOverLights(play); sGameOverTimer = 20; Rumble_Request(0.0f, 126, 124, 63); diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index b054dac74e..1135f2de97 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -33,12 +33,12 @@ void func_800F4A10(PlayState* play) { for (i = 9; i >= 0; i--) { if ((gSaveContext.save.playerData.owlActivationFlags >> i) & 1) { pauseCtx->worldMapPoints[i] = 1; - pauseCtx->unk_238[4] = i; + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = i; } } if ((gSaveContext.save.playerData.owlActivationFlags >> 4) & 1) { - pauseCtx->unk_238[4] = 4; + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 4; } } @@ -81,8 +81,8 @@ void KaleidoSetup_Update(PlayState* play) { 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.unk_3F26 = gSaveContext.unk_3F22; - pauseCtx->unk_2B9 = 0; + gSaveContext.prevHudVisibility = gSaveContext.hudVisibility; + pauseCtx->itemDescriptionOn = false; pauseCtx->state = 1; func_800F4A10(play); pauseCtx->mode = pauseCtx->pageIndex * 2 + 1; @@ -122,23 +122,23 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->unk_20C = 936.0f; pauseCtx->unk_220 = -314.0f; - pauseCtx->unk_238[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorPoint[PAUSE_MAP] = XREG(94) + 3; - pauseCtx->unk_258 = 11; - pauseCtx->unk_25A = 0; + pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT; + pauseCtx->pageSwitchTimer = 0; - pauseCtx->cursorItem[PAUSE_ITEM] = 999; + pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE; pauseCtx->cursorItem[PAUSE_MAP] = XREG(94) + 3; - pauseCtx->cursorItem[PAUSE_QUEST] = 999; - pauseCtx->cursorItem[PAUSE_MASK] = 999; + pauseCtx->cursorItem[PAUSE_QUEST] = PAUSE_ITEM_NONE; + pauseCtx->cursorItem[PAUSE_MASK] = PAUSE_ITEM_NONE; - pauseCtx->unk_268[PAUSE_ITEM] = 0; - pauseCtx->unk_268[PAUSE_MAP] = XREG(94) + 3; + pauseCtx->cursorSlot[PAUSE_ITEM] = 0; + pauseCtx->cursorSlot[PAUSE_MAP] = XREG(94) + 3; - pauseCtx->unk_284 = 2; + pauseCtx->cursorColorSet = 2; pauseCtx->unk_2A0 = -1; - pauseCtx->unk_2BA = 320; - pauseCtx->unk_2BC = 40; + pauseCtx->equipAnimScale = 320; + pauseCtx->equipAnimShrinkRate = 40; pauseCtx->promptAlpha = 100; View_Init(&pauseCtx->view, play->state.gfxCtx); diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 5135a3c410..2b5eb1aac9 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -5,7 +5,7 @@ s16 sMinimapInitPosX = 0; s16 sMinimapInitPosZ = 0; s16 sMinimapInitDir = 0; -s32 sDungeonAndBossScenes[] = { +s32 sDungeonAndBossSceneIds[] = { SCENE_MITURIN, SCENE_HAKUGIN, SCENE_SEA, SCENE_INISIE_N, SCENE_INISIE_R, SCENE_MITURIN_BS, SCENE_HAKUGIN_BS, SCENE_SEA_BS, SCENE_INISIE_BS, }; @@ -17,8 +17,8 @@ s32 sDungeonAndBossScenes[] = { s32 Map_GetDungeonOrBossAreaIndex(PlayState* play) { s32 i; - for (i = 0; i < ARRAY_COUNT(sDungeonAndBossScenes); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == sDungeonAndBossScenes[i]) { + for (i = 0; i < ARRAY_COUNT(sDungeonAndBossSceneIds); i++) { + if (Play_GetOriginalSceneId(play->sceneId) == sDungeonAndBossSceneIds[i]) { return i; } } @@ -45,7 +45,7 @@ s32 func_8010A0A4(PlayState* play) { return true; } -s32 sDungeonScenes[] = { +s32 sDungeonSceneIds[] = { SCENE_MITURIN, SCENE_HAKUGIN, SCENE_SEA, SCENE_INISIE_N, SCENE_INISIE_R, }; @@ -56,8 +56,8 @@ s32 sDungeonScenes[] = { s32 Map_GetDungeonAreaIndex(PlayState* play) { s32 i; - for (i = 0; i < ARRAY_COUNT(sDungeonScenes); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == sDungeonScenes[i]) { + for (i = 0; i < ARRAY_COUNT(sDungeonSceneIds); i++) { + if (Play_GetOriginalSceneId(play->sceneId) == sDungeonSceneIds[i]) { return i; } } @@ -76,7 +76,7 @@ s32 Map_IsInDungeonArea(PlayState* play) { return true; } -s32 sBossScenes[] = { +s32 sBossSceneIds[] = { SCENE_MITURIN_BS, // DUNGEON_INDEX_WOODFALL_TEMPLE SCENE_HAKUGIN_BS, // DUNGEON_INDEX_SNOWHEAD_TEMPLE SCENE_SEA_BS, // DUNGEON_INDEX_GREAT_BAY_TEMPLE @@ -90,8 +90,8 @@ s32 sBossScenes[] = { s32 Map_GetBossAreaIndex(PlayState* play) { s32 i; - for (i = 0; i < ARRAY_COUNT(sBossScenes); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == sBossScenes[i]) { + for (i = 0; i < ARRAY_COUNT(sBossSceneIds); i++) { + if (Play_GetOriginalSceneId(play->sceneId) == sBossSceneIds[i]) { return i; } } @@ -120,7 +120,7 @@ s32 func_8010A238(PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(D_801BF5A4); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == D_801BF5A4[i]) { + if (Play_GetOriginalSceneId(play->sceneId) == D_801BF5A4[i]) { return i; } } @@ -156,7 +156,7 @@ void Map_InitRoomData(PlayState* play, s16 room) { if (room >= 0) { if (Map_IsInDungeonOrBossArea(play)) { - gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneNumber(play->sceneNum)].rooms |= gBitFlags[room]; + gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].rooms |= gBitFlags[room]; interfaceCtx->mapRoomNum = room; interfaceCtx->dungeonOrBossAreaMapIndex = mapIndex; } @@ -169,15 +169,15 @@ void Map_InitRoomData(PlayState* play, s16 room) { } } -void Map_Destroy(void) { - func_80105A40(); +void Map_Destroy(PlayState* play) { + func_80105A40(play); } void Map_Init(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; s32 dungeonIndex; - func_80105C40(play->roomCtx.currRoom.num); + func_80105C40(play->roomCtx.curRoom.num); interfaceCtx->unk_278 = -1; interfaceCtx->dungeonOrBossAreaMapIndex = -1; interfaceCtx->mapSegment = THA_AllocEndAlign16(&play->state.heap, 0x1000); @@ -189,7 +189,7 @@ void Map_Init(PlayState* play) { if (Map_IsInDungeonOrBossArea(play)) { dungeonIndex = Map_GetDungeonOrBossAreaIndex(play); gSaveContext.mapIndex = dungeonIndex; - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_MITURIN_BS: dungeonIndex = DUNGEON_INDEX_WOODFALL_TEMPLE; break; @@ -208,7 +208,7 @@ void Map_Init(PlayState* play) { } gSaveContext.dungeonIndex = dungeonIndex; - Map_InitRoomData(play, play->roomCtx.currRoom.num); + Map_InitRoomData(play, play->roomCtx.curRoom.num); } } @@ -243,7 +243,7 @@ void Map_Update(PlayState* play) { if (Map_IsInDungeonArea(play)) { floor = func_80109124(player->actor.world.pos.y); if (floor != -1) { - gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneNumber(play->sceneNum)].unk_14 |= + gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].unk_14 |= gBitFlags[FLOOR_INDEX_MAX - floor]; XREG(94) = FLOOR_INDEX_MAX - floor; if (interfaceCtx->mapRoomNum != sLastRoomNum) { diff --git a/src/code/z_message.c b/src/code/z_message.c index 60421a9de9..162974f365 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -267,10 +267,10 @@ void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { s16 phi_v0; s16 phi_s0; - if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) { + if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { phi_v0 = 0xA; } else { - phi_v0 = pauseCtx->unk_238[PAUSE_WORLD_MAP]; + phi_v0 = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; } temp_s6 = D_801D0250[phi_v0]; @@ -360,7 +360,7 @@ void func_80151A68(PlayState* play, u16 textId) { XREG(77) = 0x3C; XREG(76) = 0x1C; msgCtx->unk11F1A[0] = msgCtx->unk11F1A[1] = msgCtx->unk11F1A[2] = 0; - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); } } diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index 9231ca9b92..fef293b46f 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -254,10 +254,10 @@ void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decod s16 currentArea; s16 stringLimit; - if ((func_8010A0A4(play) != 0) || (play->sceneNum == SCENE_SECOM)) { + if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { currentArea = 10; } else { - currentArea = play->pauseCtx.unk_238[PAUSE_WORLD_MAP]; + currentArea = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP]; } stringLimit = D_801D07C4[currentArea]; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 79385a7890..189258be93 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,8 +1,11 @@ #include "global.h" + #include "interface/parameter_static/parameter_static.h" #include "interface/do_action_static/do_action_static.h" #include "misc/story_static/story_static.h" + #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" +#include "overlays/actors/ovl_En_Mm3/z_en_mm3.h" typedef struct { /* 0x00 */ u8 scene; @@ -11,7 +14,7 @@ typedef struct { /* 0x03 */ u8 flags3; } RestrictionFlags; -Input D_801F5850[4]; +Input sPostmanTimerInput[4]; RestrictionFlags sRestrictionFlags[] = { { SCENE_20SICHITAI2, 0x00, 0x00, 0x00 }, @@ -167,23 +170,21 @@ s16 sExtraItemBases[] = { ITEM_NUT, // ITEM_NUT_UPGRADE_30 }; -s16 D_801BF8DC = 0; -s16 D_801BF8E0 = 0; -s16 D_801BF8E4 = 0; - -OSTime D_801BF8E8 = 0; -OSTime D_801BF8F0 = 0; +s16 sEnvTimerType = PLAYER_ENV_TIMER_NONE; +s16 sEnvTimerActive = false; +s16 sPostmanBunnyHoodState = POSTMAN_MINIGAME_BUNNY_HOOD_OFF; +OSTime sTimerPausedOsTime = 0; +OSTime sBottleTimerPausedOsTime = 0; OSTime D_801BF8F8[] = { 0, 0, 0, 0, 0, 0, 0, }; OSTime D_801BF930[] = { 0, 0, 0, 0, 0, 0, 0, }; +u8 sIsTimerPaused = false; +u8 sIsBottleTimerPaused = false; +s16 sTimerId = TIMER_ID_NONE; -u8 D_801BF968 = false; -u8 D_801BF96C = false; - -s16 D_801BF970 = 99; s16 D_801BF974 = 0; s16 D_801BF978 = 10; s16 D_801BF97C = 255; @@ -264,30 +265,879 @@ s16 D_801BFA74[] = { #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010E028.s") -s32 D_801BFA84 = 0; +s32 sPostmanTimerInputBtnAPressed = false; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010E968.s") +void Interface_PostmanTimerCallback(s32 arg0) { + s32 btnAPressed; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010E9F0.s") + func_80175E68(&sPostmanTimerInput[0], 0); + btnAPressed = CHECK_BTN_ALL(sPostmanTimerInput[0].cur.button, BTN_A); + if ((btnAPressed != sPostmanTimerInputBtnAPressed) && btnAPressed) { + gSaveContext.postmanTimerStopOsTime = osGetTime(); + gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_STOP; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EA9C.s") + sPostmanTimerInputBtnAPressed = btnAPressed; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EB50.s") +void Interface_StartTimer(s16 timerId, s16 seconds) { + gSaveContext.timerX[timerId] = 115; + gSaveContext.timerY[timerId] = 80; -void func_8010EBA0(s16 timer, s16 timerId); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EBA0.s") + sEnvTimerActive = false; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EC54.s") + gSaveContext.timerCurTimes[timerId] = SECONDS_TO_TIMER(seconds); + gSaveContext.timerTimeLimits[timerId] = gSaveContext.timerCurTimes[timerId]; + + if (gSaveContext.timerCurTimes[timerId] != SECONDS_TO_TIMER(0)) { + gSaveContext.timerDirections[timerId] = TIMER_COUNT_DOWN; + } else { + gSaveContext.timerDirections[timerId] = TIMER_COUNT_UP; + } + + gSaveContext.timerStates[timerId] = TIMER_STATE_START; +} + +void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState) { + gSaveContext.timerX[TIMER_ID_POSTMAN] = 115; + gSaveContext.timerY[TIMER_ID_POSTMAN] = 80; + + sPostmanBunnyHoodState = bunnyHoodState; + + gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(seconds); + gSaveContext.timerTimeLimits[TIMER_ID_POSTMAN] = gSaveContext.timerCurTimes[TIMER_ID_POSTMAN]; + + if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] != SECONDS_TO_TIMER(0)) { + gSaveContext.timerDirections[TIMER_ID_POSTMAN] = TIMER_COUNT_DOWN; + } else { + gSaveContext.timerDirections[TIMER_ID_POSTMAN] = TIMER_COUNT_UP; + } + + gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_START; + gSaveContext.timerStopTimes[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(0); + gSaveContext.timerPausedOsTimes[TIMER_ID_POSTMAN] = 0; +} + +// Unused, goron race actually uses TIMER_ID_MINIGAME_2 +void Interface_StartGoronRaceTimer(s32 arg0) { + if (gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] != TIMER_STATE_OFF) { + // Goron race started + if (gSaveContext.eventInf[1] & 1) { + gSaveContext.timerCurTimes[TIMER_ID_GORON_RACE_UNUSED] = SECONDS_TO_TIMER_PRECISE(2, 39); + } else { + gSaveContext.timerCurTimes[TIMER_ID_GORON_RACE_UNUSED] = SECONDS_TO_TIMER_PRECISE(0, 1); + } + } +} + +void Interface_StartBottleTimer(s16 seconds, s16 timerId) { + gSaveContext.bottleTimerStates[timerId] = BOTTLE_TIMER_STATE_COUNTING; + gSaveContext.bottleTimerCurTimes[timerId] = SECONDS_TO_TIMER(seconds); + gSaveContext.bottleTimerTimeLimits[timerId] = gSaveContext.bottleTimerCurTimes[timerId]; + gSaveContext.bottleTimerStartOsTimes[timerId] = osGetTime(); + gSaveContext.bottleTimerPausedOsTimes[timerId] = 0; + sBottleTimerPausedOsTime = 0; +} + +u32 Interface_GetCompressedTimerDigits(s16 timerId) { + u64 time; + s16 timerArr[6]; + + time = gSaveContext.timerCurTimes[timerId]; + + // 6 minutes + timerArr[0] = time / SECONDS_TO_TIMER(360); + time -= timerArr[0] * SECONDS_TO_TIMER(360); + + // minutes + timerArr[1] = time / SECONDS_TO_TIMER(60); + time -= timerArr[1] * SECONDS_TO_TIMER(60); + + // 10 seconds + timerArr[2] = time / SECONDS_TO_TIMER(10); + time -= timerArr[2] * SECONDS_TO_TIMER(10); + + // seconds + timerArr[3] = time / SECONDS_TO_TIMER(1); + time -= timerArr[3] * SECONDS_TO_TIMER(1); + + // 100 milliseconds + timerArr[4] = time / SECONDS_TO_TIMER_PRECISE(0, 10); + time -= timerArr[4] * SECONDS_TO_TIMER_PRECISE(0, 10); + + // 10 milliseconds + timerArr[5] = time; + + return (timerArr[0] << 0x14) | (timerArr[1] << 0x10) | (timerArr[2] << 0xC) | (timerArr[3] << 8) | + (timerArr[4] << 4) | timerArr[5]; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EE74.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_ChangeAlpha.s") +void Interface_SetHudVisibility(u16 hudVisibility) { + if (gSaveContext.hudVisibility != hudVisibility) { + gSaveContext.hudVisibility = hudVisibility; + gSaveContext.nextHudVisibility = hudVisibility; + gSaveContext.hudVisibilityTimer = 1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EF9C.s") +/** + * Sets the button alphas to be dimmed for disabled buttons, or to the requested alpha for non-disabled buttons + */ +void Interface_UpdateButtonAlphasByStatus(PlayState* play, s16 risingAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010F0D4.s") + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if (interfaceCtx->bAlpha != 70) { + interfaceCtx->bAlpha = 70; + } + } else { + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010F1A8.s") + if (gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] == BTN_DISABLED) { + if (interfaceCtx->cLeftAlpha != 70) { + interfaceCtx->cLeftAlpha = 70; + } + } else { + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] == BTN_DISABLED) { + if (interfaceCtx->cDownAlpha != 70) { + interfaceCtx->cDownAlpha = 70; + } + } else { + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] == BTN_DISABLED) { + if (interfaceCtx->cRightAlpha != 70) { + interfaceCtx->cRightAlpha = 70; + } + } else { + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + } + + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) { + if (interfaceCtx->aAlpha != 70) { + interfaceCtx->aAlpha = 70; + } + } else { + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + } +} + +/** + * Lower button alphas on the HUD to the requested value + * If (gSaveContext.hudVisibilityForceButtonAlphasByStatus), then instead update button alphas + * depending on button status + */ +void Interface_UpdateButtonAlphas(PlayState* play, s16 dimmingAlpha, s16 risingAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + + if (gSaveContext.hudVisibilityForceButtonAlphasByStatus) { + Interface_UpdateButtonAlphasByStatus(play, risingAlpha); + return; + } + + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } +} + +void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + s16 risingAlpha = 255 - dimmingAlpha; + + switch (gSaveContext.nextHudVisibility) { + case HUD_VISIBILITY_NONE: + case HUD_VISIBILITY_NONE_ALT: + case HUD_VISIBILITY_B: + if (gSaveContext.nextHudVisibility == HUD_VISIBILITY_B) { + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + } else { + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_WITH_OVERWRITE: + // aAlpha is immediately overwritten in Interface_UpdateButtonAlphas + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha + 0); + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + // aAlpha is immediately overwritten below + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_HEARTS_MAGIC_WITH_OVERWRITE: + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha); + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + // aAlpha overwrites the value set in Interface_UpdateButtonAlphas + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE: + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha); + + // aAlpha overwrites the value set in Interface_UpdateButtonAlphas + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (play->sceneId == SCENE_SPOT00) { + if (interfaceCtx->minimapAlpha < 170) { + interfaceCtx->minimapAlpha = risingAlpha; + } else { + interfaceCtx->minimapAlpha = 170; + } + } else if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_ALL_NO_MINIMAP_W_DISABLED: + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + Interface_UpdateButtonAlphasByStatus(play, risingAlpha); + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_B_ALT: + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B_MINIMAP: + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if ((gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) || (gSaveContext.unk_1015 == ITEM_NONE)) { + if (interfaceCtx->bAlpha != 70) { + interfaceCtx->bAlpha = 70; + } + } else { + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC_WITH_OVERWRITE: + Interface_UpdateButtonAlphas(play, dimmingAlpha, risingAlpha); + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + // aAlpha overwrites the value set in Interface_UpdateButtonAlphas + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC_C: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_ALL_NO_MINIMAP: + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B_C: + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->cLeftAlpha != 255) { + interfaceCtx->cLeftAlpha = risingAlpha; + } + + if (interfaceCtx->cDownAlpha != 255) { + interfaceCtx->cDownAlpha = risingAlpha; + } + + if (interfaceCtx->cRightAlpha != 255) { + interfaceCtx->cRightAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_B_MINIMAP: + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_HEARTS_MAGIC_MINIMAP: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP: + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > dimmingAlpha)) { + interfaceCtx->bAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_B_MAGIC: + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > dimmingAlpha)) { + interfaceCtx->aAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B: + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > dimmingAlpha)) { + interfaceCtx->minimapAlpha = dimmingAlpha; + } + + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > dimmingAlpha)) { + interfaceCtx->magicAlpha = dimmingAlpha; + } + + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > dimmingAlpha)) { + interfaceCtx->healthAlpha = dimmingAlpha; + } + + break; + + case HUD_VISIBILITY_A_B_HEARTS_MAGIC_MINIMAP: + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > dimmingAlpha)) { + interfaceCtx->cLeftAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > dimmingAlpha)) { + interfaceCtx->cDownAlpha = dimmingAlpha; + } + + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > dimmingAlpha)) { + interfaceCtx->cRightAlpha = dimmingAlpha; + } + + if (interfaceCtx->bAlpha != 255) { + interfaceCtx->bAlpha = risingAlpha; + } + + if (interfaceCtx->aAlpha != 255) { + interfaceCtx->aAlpha = risingAlpha; + } + + if (interfaceCtx->minimapAlpha != 255) { + interfaceCtx->minimapAlpha = risingAlpha; + } + + if (interfaceCtx->magicAlpha != 255) { + interfaceCtx->magicAlpha = risingAlpha; + } + + if (interfaceCtx->healthAlpha != 255) { + interfaceCtx->healthAlpha = risingAlpha; + } + + break; + } + + if ((play->roomCtx.curRoom.unk3 == 1) && (interfaceCtx->minimapAlpha >= 255)) { + interfaceCtx->minimapAlpha = 255; + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80110038.s") @@ -323,7 +1173,7 @@ u8 Item_Give(PlayState* play, u8 item) { if (item == ITEM_SKULL_TOKEN) { SET_QUEST_ITEM(item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN); - Inventory_IncrementSkullTokenCount(play->sceneNum); + Inventory_IncrementSkullTokenCount(play->sceneId); return ITEM_NONE; } else if (item == ITEM_TINGLE_MAP) { @@ -683,7 +1533,7 @@ u8 Item_Give(PlayState* play, u8 item) { for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { if (gSaveContext.save.inventory.items[slot + i] == ITEM_BOTTLE) { if (item == ITEM_HOT_SPRING_WATER) { - func_8010EBA0(60, i); + Interface_StartBottleTimer(60, i); } if ((slot + i) == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) { @@ -997,7 +1847,7 @@ void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 btn) { gSaveContext.buttonStatus[btn] = BTN_ENABLED; if (item == ITEM_HOT_SPRING_WATER) { - func_8010EBA0(60, GET_CUR_FORM_BTN_SLOT(btn) - SLOT_BOTTLE_1); + Interface_StartBottleTimer(60, GET_CUR_FORM_BTN_SLOT(btn) - SLOT_BOTTLE_1); } } @@ -1463,7 +2313,8 @@ void Magic_Update(PlayState* play) { !Play_InCsMode(play)) { if ((gSaveContext.save.playerData.magic == 0) || - ((func_801242DC(play) >= 2) && (func_801242DC(play) <= 4)) || + ((Player_GetEnvTimerType(play) >= PLAYER_ENV_TIMER_UNDERWATER_FLOOR) && + (Player_GetEnvTimerType(play) <= PLAYER_ENV_TIMER_UNDERWATER_FREE)) || ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) != ITEM_LENS) && (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) != ITEM_LENS) && (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) != ITEM_LENS)) || @@ -1755,25 +2606,582 @@ TexturePtr D_801BFCC4[] = { #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011C4C4.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011C808.s") +void Interface_StartMoonCrash(PlayState* play) { + if (play->actorCtx.flags & ACTORCTX_FLAG_1) { + Audio_QueueSeqCmd(0xE0000100); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011C898.s") + gSaveContext.save.day = 4; + gSaveContext.save.daysElapsed = 4; + gSaveContext.save.time = CLOCK_TIME(6, 0) + 10; + play->nextEntrance = ENTRANCE(TERMINA_FIELD, 12); + gSaveContext.nextCutsceneIndex = 0; + play->transitionTrigger = TRANS_TRIGGER_START; + play->transitionType = TRANS_TYPE_FADE_WHITE; +} -s16 D_801BFCE4 = 0; -s16 D_801BFCE8[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -s16 D_801BFCF8 = 99; -s16 D_801BFCFC[] = { - // timer digit width - 16, 25, 34, 42, 51, 60, 68, 77, -}; -s16 D_801BFD0C[] = { - // digit width - 9, 9, 8, 9, 9, 8, 9, 9, -}; +void Interface_GetTimerDigits(u64 timer, s16* timerArr) { + u64 time = timer; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011CA64.s") + // 6 minutes + timerArr[0] = time / SECONDS_TO_TIMER(360); + time -= timerArr[0] * SECONDS_TO_TIMER(360); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011E3B4.s") + // minutes + timerArr[1] = time / SECONDS_TO_TIMER(60); + time -= timerArr[1] * SECONDS_TO_TIMER(60); + + // 10 seconds + timerArr[3] = time / SECONDS_TO_TIMER(10); + time -= timerArr[3] * SECONDS_TO_TIMER(10); + + // seconds + timerArr[4] = time / SECONDS_TO_TIMER(1); + time -= timerArr[4] * SECONDS_TO_TIMER(1); + + // 100 milliseconds + timerArr[6] = time / SECONDS_TO_TIMER_PRECISE(0, 10); + time -= timerArr[6] * SECONDS_TO_TIMER_PRECISE(0, 10); + + // 10 milliseconds + timerArr[7] = time; +} + +#define IS_POSTMAN_TIMER_DRAWN \ + (((sTimerId == TIMER_ID_POSTMAN) && \ + (gSaveContext.timerStates[TIMER_ID_POSTMAN] == TIMER_STATE_POSTMAN_COUNTING) && \ + (sPostmanBunnyHoodState == POSTMAN_MINIGAME_BUNNY_HOOD_OFF) && \ + (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] < SECONDS_TO_TIMER(3))) || \ + (sPostmanBunnyHoodState == POSTMAN_MINIGAME_BUNNY_HOOD_ON)) + +/** + * Update and draw the timers + */ +void Interface_DrawTimers(PlayState* play) { + static s16 sTimerStateTimer = 0; + static s16 sTimerDigits[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + static s16 sTimerBeepSfxSeconds = 99; + static s16 sTimerDigitsOffsetX[] = { + 16, 25, 34, 42, 51, 60, 68, 77, + }; + static s16 sTimerDigitsWidth[] = { + 9, 9, 8, 9, 9, 8, 9, 9, + }; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; + Player* player = GET_PLAYER(play); + OSTime osTime; + OSTime timerOsTime; + s16 j; + s16 i; + + OPEN_DISPS(play->state.gfxCtx); + + // Not satisfying any of these conditions will pause the timer + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + ((msgCtx->msgMode == 0) || + ((msgCtx->msgMode != 0) && (msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && + !(player->stateFlags1 & PLAYER_STATE1_200) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { + + // Account for osTime when the timer is paused + if (sIsTimerPaused) { + osTime = osGetTime(); + + for (j = 0; j < TIMER_ID_MAX; j++) { + if (gSaveContext.timerStates[j] == TIMER_STATE_COUNTING) { + gSaveContext.timerPausedOsTimes[j] = + gSaveContext.timerPausedOsTimes[j] + (osTime - sTimerPausedOsTime); + } + } + sIsTimerPaused = false; + } + + sTimerId = TIMER_ID_NONE; + + // Update all timer states + for (i = 0; i < TIMER_ID_MAX; i++) { + if (gSaveContext.timerStates[i] == TIMER_STATE_OFF) { + continue; + } + + sTimerId = i; + + // Process the timer for the postman counting minigame + if (sTimerId == TIMER_ID_POSTMAN) { + switch (gSaveContext.timerStates[TIMER_ID_POSTMAN]) { + case TIMER_STATE_POSTMAN_START: + if (gSaveContext.timerDirections[TIMER_ID_POSTMAN] != TIMER_COUNT_DOWN) { + gSaveContext.timerStartOsTimes[TIMER_ID_POSTMAN] = osGetTime(); + } + gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_COUNTING; + sPostmanTimerInputBtnAPressed = true; + func_80174F7C(Interface_PostmanTimerCallback, NULL); + break; + + case TIMER_STATE_POSTMAN_STOP: + timerOsTime = gSaveContext.postmanTimerStopOsTime; + gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = + OSTIME_TO_TIMER(timerOsTime - ((void)0, gSaveContext.timerStartOsTimes[TIMER_ID_POSTMAN]) - + ((void)0, gSaveContext.timerPausedOsTimes[TIMER_ID_POSTMAN])); + gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_END; + func_80174F9C(Interface_PostmanTimerCallback, NULL); + break; + + case TIMER_STATE_POSTMAN_COUNTING: + case TIMER_STATE_POSTMAN_END: + break; + } + break; + } + + // process the remaining timers + switch (gSaveContext.timerStates[sTimerId]) { + case TIMER_STATE_START: + case TIMER_STATE_ALT_START: + sTimerStateTimer = 20; + if (interfaceCtx->unk_280 != 0) { + + // Set the timer position + gSaveContext.timerX[sTimerId] = 26; + + if (interfaceCtx->magicAlpha != 255) { + gSaveContext.timerY[sTimerId] = 22; + } else if (gSaveContext.save.playerData.healthCapacity > 0xA0) { + gSaveContext.timerY[sTimerId] = 54; + } else { + gSaveContext.timerY[sTimerId] = 46; + } + + if ((interfaceCtx->unk_280 == 8) || (interfaceCtx->unk_280 == 30)) { + if (gSaveContext.timerStates[sTimerId] == TIMER_STATE_START) { + gSaveContext.timerStates[sTimerId] = TIMER_STATE_COUNTING; + } else { + gSaveContext.timerStates[sTimerId] = TIMER_STATE_ALT_COUNTING; + D_801BF8F8[sTimerId] = osGetTime(); + D_801BF930[sTimerId] = 0; + } + + gSaveContext.timerStartOsTimes[sTimerId] = osGetTime(); + gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(0); + gSaveContext.timerPausedOsTimes[sTimerId] = 0; + } + } else { + gSaveContext.timerStates[sTimerId] = TIMER_STATE_HOLD_TIMER; + } + break; + + case TIMER_STATE_HOLD_TIMER: + sTimerStateTimer--; + if (sTimerStateTimer == 0) { + sTimerStateTimer = 20; + gSaveContext.timerStates[sTimerId] = TIMER_STATE_MOVING_TIMER; + } + break; + + case TIMER_STATE_MOVING_TIMER: + // Move the timer from the center of the screen to the timer location where it will count. + if (sTimerId == TIMER_ID_MOON_CRASH) { + j = ((((void)0, gSaveContext.timerX[sTimerId]) - R_MOON_CRASH_TIMER_X) / sTimerStateTimer); + gSaveContext.timerX[sTimerId] = ((void)0, gSaveContext.timerX[sTimerId]) - j; + j = ((((void)0, gSaveContext.timerY[sTimerId]) - R_MOON_CRASH_TIMER_Y) / sTimerStateTimer); + gSaveContext.timerY[sTimerId] = ((void)0, gSaveContext.timerY[sTimerId]) - j; + } else { + j = ((((void)0, gSaveContext.timerX[sTimerId]) - 26) / sTimerStateTimer); + gSaveContext.timerX[sTimerId] = ((void)0, gSaveContext.timerX[sTimerId]) - j; + + j = (gSaveContext.save.playerData.healthCapacity > 0xA0) + ? ((((void)0, gSaveContext.timerY[sTimerId]) - 54) / sTimerStateTimer) + : ((((void)0, gSaveContext.timerY[sTimerId]) - 46) / sTimerStateTimer); + gSaveContext.timerY[sTimerId] = ((void)0, gSaveContext.timerY[sTimerId]) - j; + } + + sTimerStateTimer--; + if (sTimerStateTimer == 0) { + sTimerStateTimer = 20; + + if (sTimerId == TIMER_ID_MOON_CRASH) { + gSaveContext.timerY[sTimerId] = R_MOON_CRASH_TIMER_Y; + } else { + gSaveContext.timerX[sTimerId] = 26; + if (gSaveContext.save.playerData.healthCapacity > 0xA0) { + gSaveContext.timerY[sTimerId] = 54; + } else { + gSaveContext.timerY[sTimerId] = 46; + } + } + + gSaveContext.timerStates[sTimerId] = TIMER_STATE_COUNTING; + gSaveContext.timerStartOsTimes[sTimerId] = osGetTime(); + gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(0); + gSaveContext.timerPausedOsTimes[sTimerId] = 0; + } + // fallthrough + case TIMER_STATE_COUNTING: + if ((gSaveContext.timerStates[sTimerId] == TIMER_STATE_COUNTING) && + (sTimerId == TIMER_ID_MOON_CRASH)) { + gSaveContext.timerX[TIMER_ID_MOON_CRASH] = R_MOON_CRASH_TIMER_X; + gSaveContext.timerY[TIMER_ID_MOON_CRASH] = R_MOON_CRASH_TIMER_Y; + } + break; + + case TIMER_STATE_10: + D_801BF8F8[sTimerId] = osGetTime(); + D_801BF930[sTimerId] = 0; + gSaveContext.timerStates[sTimerId] = TIMER_STATE_ALT_COUNTING; + // fallthrough + case TIMER_STATE_ALT_COUNTING: + D_801BF930[sTimerId] = osGetTime() - D_801BF8F8[sTimerId]; + break; + + case TIMER_STATE_12: + osTime = osGetTime(); + + gSaveContext.timerPausedOsTimes[sTimerId] = + gSaveContext.timerPausedOsTimes[sTimerId] + osTime - D_801BF8F8[sTimerId]; + D_801BF930[sTimerId] = 0; + gSaveContext.timerStates[sTimerId] = TIMER_STATE_COUNTING; + break; + + case TIMER_STATE_ENV_START: + gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(gSaveContext.save.playerData.health >> 1); + gSaveContext.timerDirections[sTimerId] = TIMER_COUNT_DOWN; + gSaveContext.timerTimeLimits[sTimerId] = gSaveContext.timerCurTimes[sTimerId]; + sTimerStateTimer = 20; + gSaveContext.timerStates[sTimerId] = TIMER_STATE_MOVING_TIMER; + break; + + case TIMER_STATE_STOP: + osTime = osGetTime(); + + gSaveContext.timerStopTimes[sTimerId] = + OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerStartOsTimes[sTimerId]) - + ((void)0, gSaveContext.timerPausedOsTimes[sTimerId])); + + gSaveContext.timerStates[sTimerId] = TIMER_STATE_OFF; + + if (sTimerId == TIMER_ID_MOON_CRASH) { + gSaveContext.save.day = 4; + if ((play->sceneId == SCENE_OKUJOU) && (gSaveContext.sceneSetupIndex == 3)) { + play->nextEntrance = ENTRANCE(TERMINA_FIELD, 1); + gSaveContext.nextCutsceneIndex = 0xFFF0; + play->transitionTrigger = TRANS_TRIGGER_START; + } else { + Interface_StartMoonCrash(play); + } + } else if (gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] != TIMER_STATE_OFF) { + gSaveContext.timerX[TIMER_ID_GORON_RACE_UNUSED] = 115; + gSaveContext.timerY[TIMER_ID_GORON_RACE_UNUSED] = 80; + if (gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] <= TIMER_STATE_10) { + gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] = TIMER_STATE_MOVING_TIMER; + } + } + break; + + case TIMER_STATE_6: + osTime = osGetTime(); + + gSaveContext.timerStopTimes[sTimerId] = + OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerStartOsTimes[sTimerId]) - + ((void)0, gSaveContext.timerPausedOsTimes[sTimerId])); + + if ((gSaveContext.minigameState == 1) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { + if (gSaveContext.timerStopTimes[sTimerId] >= SECONDS_TO_TIMER(120)) { + gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(120); + gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); + } + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES) && + (gSaveContext.timerStopTimes[sTimerId] >= SECONDS_TO_TIMER(120))) { + gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); + } + gSaveContext.timerStates[sTimerId] = TIMER_STATE_7; + + if (gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] != TIMER_STATE_OFF) { + gSaveContext.timerX[TIMER_ID_GORON_RACE_UNUSED] = 115; + gSaveContext.timerY[TIMER_ID_GORON_RACE_UNUSED] = 80; + if (gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] <= TIMER_STATE_10) { + gSaveContext.timerStates[TIMER_ID_GORON_RACE_UNUSED] = TIMER_STATE_MOVING_TIMER; + } + gSaveContext.timerStates[sTimerId] = TIMER_STATE_OFF; + } + break; + } + break; + } + + // Update timer counting + if ((sTimerId != TIMER_ID_NONE) && gSaveContext.timerStates[sTimerId]) { // != TIMER_STATE_OFF + if (gSaveContext.timerDirections[sTimerId] == TIMER_COUNT_DOWN) { + sTimerDigits[0] = sTimerDigits[1] = sTimerDigits[3] = sTimerDigits[4] = sTimerDigits[6] = 0; + + // Used to index the counter colon + sTimerDigits[2] = sTimerDigits[5] = 10; + + // Get the total amount of unpaused time since the start of the timer, centiseconds (1/100th sec). + if ((gSaveContext.timerStates[sTimerId] == TIMER_STATE_COUNTING) || + (gSaveContext.timerStates[sTimerId] == TIMER_STATE_10) || + (gSaveContext.timerStates[sTimerId] == TIMER_STATE_ALT_COUNTING) || + (gSaveContext.timerStates[sTimerId] == TIMER_STATE_POSTMAN_COUNTING)) { + osTime = osGetTime(); + + osTime = + OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerPausedOsTimes[sTimerId]) - + D_801BF930[sTimerId] - ((void)0, gSaveContext.timerStartOsTimes[sTimerId])); + } else if (gSaveContext.timerStates[sTimerId] == TIMER_STATE_7) { + osTime = gSaveContext.timerStopTimes[sTimerId]; + } else { + osTime = 0; + } + + // Check how much unpaused time has passed + if (osTime == 0) { + // No unpaused time has passed since the start of the timer. + gSaveContext.timerCurTimes[sTimerId] = gSaveContext.timerTimeLimits[sTimerId] - osTime; + } else if (osTime <= gSaveContext.timerTimeLimits[sTimerId]) { + // Time has passed, but the time limit has not been exceeded + if (osTime >= gSaveContext.timerTimeLimits[sTimerId]) { + // The time is exactly at the time limit. No time remaining. + gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(0); + } else { + // Update the time remaining + gSaveContext.timerCurTimes[sTimerId] = gSaveContext.timerTimeLimits[sTimerId] - osTime; + } + } else { + // Time has passed, and the time limit has been exceeded. + gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(0); + gSaveContext.timerStates[sTimerId] = TIMER_STATE_STOP; + if (sEnvTimerActive) { + gSaveContext.save.playerData.health = 0; + play->damagePlayer(play, -(((void)0, gSaveContext.save.playerData.health) + 2)); + } + sEnvTimerActive = false; + } + + Interface_GetTimerDigits(((void)0, gSaveContext.timerCurTimes[sTimerId]), sTimerDigits); + + // Use seconds to determine when to beep + if (gSaveContext.timerCurTimes[sTimerId] > SECONDS_TO_TIMER(60)) { + if ((sTimerBeepSfxSeconds != sTimerDigits[4]) && (sTimerDigits[4] == 1)) { + play_sound(NA_SE_SY_MESSAGE_WOMAN); + sTimerBeepSfxSeconds = sTimerDigits[4]; + } + } else if (gSaveContext.timerCurTimes[sTimerId] > SECONDS_TO_TIMER(10)) { + if ((sTimerBeepSfxSeconds != sTimerDigits[4]) && ((sTimerDigits[4] % 2) != 0)) { + play_sound(NA_SE_SY_WARNING_COUNT_N); + sTimerBeepSfxSeconds = sTimerDigits[4]; + } + } else if (sTimerBeepSfxSeconds != sTimerDigits[4]) { + play_sound(NA_SE_SY_WARNING_COUNT_E); + sTimerBeepSfxSeconds = sTimerDigits[4]; + } + } else { // TIMER_COUNT_UP + sTimerDigits[0] = sTimerDigits[1] = sTimerDigits[3] = sTimerDigits[4] = sTimerDigits[6] = 0; + + // Used to index the counter colon + sTimerDigits[2] = sTimerDigits[5] = 10; + + // Get the total amount of unpaused time since the start of the timer, centiseconds (1/100th sec). + if ((gSaveContext.timerStates[sTimerId] == TIMER_STATE_COUNTING) || + (gSaveContext.timerStates[sTimerId] == TIMER_STATE_POSTMAN_COUNTING)) { + osTime = osGetTime(); + osTime = + OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerStartOsTimes[sTimerId]) - + ((void)0, gSaveContext.timerPausedOsTimes[sTimerId]) - D_801BF930[sTimerId]); + } else if (gSaveContext.timerStates[sTimerId] == TIMER_STATE_7) { + osTime = gSaveContext.timerStopTimes[sTimerId]; + } else if (sTimerId == TIMER_ID_POSTMAN) { + osTime = gSaveContext.timerCurTimes[sTimerId]; + } else { + osTime = SECONDS_TO_TIMER(0); + } + + if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { + if (osTime >= SECONDS_TO_TIMER(120)) { + osTime = SECONDS_TO_TIMER(120); + } + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES) && + (osTime >= SECONDS_TO_TIMER(120))) { + osTime = SECONDS_TO_TIMER(120); + } + + // Update the time remaining with the total amount of time since the start of the timer, + gSaveContext.timerCurTimes[sTimerId] = osTime; + + Interface_GetTimerDigits(osTime, sTimerDigits); + + // Use seconds to determine when to beep + if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { + if ((gSaveContext.timerCurTimes[sTimerId] > SECONDS_TO_TIMER(110)) && + (sTimerBeepSfxSeconds != sTimerDigits[4])) { + play_sound(NA_SE_SY_WARNING_COUNT_E); + sTimerBeepSfxSeconds = sTimerDigits[4]; + } + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES)) { + if ((((void)0, gSaveContext.timerCurTimes[sTimerId]) > + (gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] - SECONDS_TO_TIMER(9))) && + (sTimerBeepSfxSeconds != sTimerDigits[4])) { + play_sound(NA_SE_SY_WARNING_COUNT_E); + sTimerBeepSfxSeconds = sTimerDigits[4]; + } + } + } + + // Draw timer + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + OVERLAY_DISP = + func_8010CD98(OVERLAY_DISP, gTimerClockIconTex, 0x10, 0x10, ((void)0, gSaveContext.timerX[sTimerId]), + ((void)0, gSaveContext.timerY[sTimerId]) + 2, 0x10, 0x10, 1 << 10, 1 << 10); + gDPPipeSync(OVERLAY_DISP++); + gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, + 0, PRIMITIVE, 0); + + if (IS_POSTMAN_TIMER_DRAWN || (gSaveContext.timerStates[sTimerId] <= TIMER_STATE_12)) { + // Set the timer color + if (gSaveContext.timerStates[sTimerId]) { // != TIMER_STATE_OFF + if (sTimerId == TIMER_ID_2) { + if ((gSaveContext.timerCurTimes[sTimerId] == SECONDS_TO_TIMER(0)) || + (gSaveContext.timerStates[sTimerId] == TIMER_STATE_COUNTING)) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + } + } else if ((gSaveContext.minigameState == 1) && + (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { + if (gSaveContext.timerCurTimes[sTimerId] >= SECONDS_TO_TIMER(110)) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + } + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES)) { + if (((void)0, gSaveContext.timerCurTimes[sTimerId]) >= + gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); + } else if (((void)0, gSaveContext.timerCurTimes[sTimerId]) >= + (gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] - + SECONDS_TO_TIMER(9))) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 0, 255); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + } + } else if ((gSaveContext.timerCurTimes[sTimerId] < SECONDS_TO_TIMER(10)) && + (gSaveContext.timerDirections[sTimerId] == TIMER_COUNT_DOWN) && + (gSaveContext.timerStates[sTimerId] != TIMER_STATE_ALT_COUNTING)) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + } + } + + // Draw the timer + if (sTimerId == TIMER_ID_POSTMAN) { + if (sPostmanBunnyHoodState == POSTMAN_MINIGAME_BUNNY_HOOD_ON) { + // draw sTimerDigits[3] (10s of seconds) to sTimerDigits[6] (100s of milliseconds) + for (j = 0; j < 4; j++) { + OVERLAY_DISP = func_8010D7D0( + OVERLAY_DISP, ((u8*)gCounterDigit0Tex + (8 * 16 * sTimerDigits[j + 3])), 8, 0x10, + ((void)0, gSaveContext.timerX[sTimerId]) + sTimerDigitsOffsetX[j], + ((void)0, gSaveContext.timerY[sTimerId]), sTimerDigitsWidth[j], 0xFA, 0x370, 0x370); + } + } else { + // draw sTimerDigits[3] (10s of seconds) to sTimerDigits[7] (10s of milliseconds) + for (j = 0; j < 5; j++) { + OVERLAY_DISP = func_8010D7D0( + OVERLAY_DISP, ((u8*)gCounterDigit0Tex + (8 * 16 * sTimerDigits[j + 3])), 8, 0x10, + ((void)0, gSaveContext.timerX[sTimerId]) + sTimerDigitsOffsetX[j], + ((void)0, gSaveContext.timerY[sTimerId]), sTimerDigitsWidth[j], 0xFA, 0x370, 0x370); + } + } + } else { + // draw sTimerDigits[3] (6s of minutes) to sTimerDigits[7] (10s of milliseconds) + for (j = 0; j < 8; j++) { + OVERLAY_DISP = func_8010D7D0( + OVERLAY_DISP, ((u8*)gCounterDigit0Tex + (8 * 16 * sTimerDigits[j])), 8, 0x10, + ((void)0, gSaveContext.timerX[sTimerId]) + sTimerDigitsOffsetX[j], + ((void)0, gSaveContext.timerY[sTimerId]), sTimerDigitsWidth[j], 0xFA, 0x370, 0x370); + } + } + } + } + + } else if (!sIsTimerPaused) { + sTimerPausedOsTime = osGetTime(); + sIsTimerPaused = true; + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void Interface_UpdateBottleTimers(PlayState* play) { + MessageContext* msgCtx = &play->msgCtx; + s16 i; + s16 j; + u64 osTime; + s32 pad[2]; + + // Not satisfying any of these conditions will pause the bottle timer + if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + ((msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) || + ((msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && + !Play_InCsMode(play)) { + + // Account for osTime when the timer is paused + if (sIsBottleTimerPaused) { + osTime = osGetTime(); + + for (j = BOTTLE_FIRST; j < BOTTLE_MAX; j++) { + if (gSaveContext.bottleTimerStates[j] == BOTTLE_TIMER_STATE_COUNTING) { + gSaveContext.bottleTimerPausedOsTimes[j] += osTime - sBottleTimerPausedOsTime; + } + } + + sIsBottleTimerPaused = false; + } + + sTimerId = TIMER_ID_NONE; + + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.bottleTimerStates[i] == BOTTLE_TIMER_STATE_COUNTING) { + osTime = osGetTime(); + + // Get the total amount of unpaused time since the start of the timer, centiseconds (1/100th sec). + osTime = OSTIME_TO_TIMER_ALT(osTime - ((void)0, gSaveContext.bottleTimerPausedOsTimes[i]) - + ((void)0, gSaveContext.bottleTimerStartOsTimes[i])); + + if (osTime == 0) { + // No unpaused time has passed since the start of the timer. + gSaveContext.bottleTimerCurTimes[i] = gSaveContext.bottleTimerTimeLimits[i] - osTime; + } else if (osTime <= gSaveContext.bottleTimerTimeLimits[i]) { + // Time has passed, but the time limit has not been exceeded + if (osTime >= gSaveContext.bottleTimerTimeLimits[i]) { + // The time is exactly at the time limit. No time remaining. + gSaveContext.bottleTimerCurTimes[i] = SECONDS_TO_TIMER(0); + } else { + // Update the time remaining + gSaveContext.bottleTimerCurTimes[i] = gSaveContext.bottleTimerTimeLimits[i] - osTime; + } + } else { + // Time has passed, and the time limit has been exceeded. + gSaveContext.bottleTimerCurTimes[i] = SECONDS_TO_TIMER(0); + + if (gSaveContext.save.inventory.items[i + SLOT_BOTTLE_1] == ITEM_HOT_SPRING_WATER) { + Inventory_UpdateItem(play, i + SLOT_BOTTLE_1, ITEM_SPRING_WATER); + Message_StartTextbox(play, 0xFA, NULL); + } + gSaveContext.bottleTimerStates[i] = BOTTLE_TIMER_STATE_OFF; + } + } + } + } else if (!sIsBottleTimerPaused) { + sBottleTimerPausedOsTime = osGetTime(); + sIsBottleTimerPaused = true; + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011E730.s") @@ -1832,6 +3240,9 @@ s16 D_801BFD9C = 0; #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_Update.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80121F94.s") +void Interface_Destroy(PlayState* play) { + Map_Destroy(play); + func_80174F9C(Interface_PostmanTimerCallback, NULL); +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80121FC4.s") diff --git a/src/code/z_play.c b/src/code/z_play.c index 720e74239f..1613b019d7 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -450,7 +450,7 @@ void Play_Destroy(GameState* thisx) { } gSaveContext.save.weekEventReg[0x5C] &= (u8)~0x80; - func_80121F94(this); + Interface_Destroy(this); KaleidoScopeCall_Destroy(this); KaleidoManager_Destroy(); ZeldaArena_Cleanup(); @@ -593,7 +593,7 @@ void Play_UpdateTransition(PlayState* this) { if (this->transitionTrigger != TRANS_TRIGGER_END) { s16 sceneLayer = 0; - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); if (gSaveContext.nextCutsceneIndex >= 0xFFF0) { sceneLayer = (gSaveContext.nextCutsceneIndex & 0xF) + 1; @@ -608,7 +608,7 @@ void Play_UpdateTransition(PlayState* this) { !(gSaveContext.save.weekEventReg[0x37] & 0x80)) || ((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) && !(gSaveContext.save.weekEventReg[0x34] & 0x20))) && - (!func_800FE590(this) || (Entrance_GetSceneNum(this->nextEntrance + sceneLayer) < 0) || + (!func_800FE590(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) || (func_801A8A50(0) != NA_BGM_FINAL_HOURS))) { func_801A4058(20); gSaveContext.seqIndex = 0xFF; @@ -621,7 +621,7 @@ void Play_UpdateTransition(PlayState* this) { gSaveContext.nightSeqIndex = 0xFF; } - if (func_800FE590(this) && (Entrance_GetSceneNum(this->nextEntrance + sceneLayer) >= 0) && + if (func_800FE590(this) && (Entrance_GetSceneId(this->nextEntrance + sceneLayer) >= 0) && (func_801A8A50(0) == NA_BGM_FINAL_HOURS)) { func_801A41C8(20); } @@ -1012,7 +1012,7 @@ void Play_Update(PlayState* this) { Rumble_SetUpdateEnabled(false); } - Room_nop8012D510(this, &this->roomCtx.currRoom, &pad58[1], 0); + Room_nop8012D510(this, &this->roomCtx.curRoom, &pad58[1], 0); Room_nop8012D510(this, &this->roomCtx.prevRoom, &pad58[1], 1); SkyboxDraw_Update(&this->skyboxCtx); @@ -1149,7 +1149,7 @@ void Play_Draw(PlayState* this) { } if ((SREG(94) < 2) && (gTrnsnUnkState < 2)) { - if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.currRoom.mesh->type0.type == 1)) { + if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.curRoom.mesh->type0.type == 1)) { func_8012CF0C(gfxCtx, 0, 1, 0, 0, 0); } else { func_8012CF0C(gfxCtx, 1, 1, this->lightCtx.unk7, this->lightCtx.unk8, this->lightCtx.unk9); @@ -1299,7 +1299,7 @@ void Play_Draw(PlayState* this) { func_800FE390(this); sp268 = LightContext_NewLights(&this->lightCtx, gfxCtx); - if (this->roomCtx.currRoom.enablePosLights || (MREG(93) != 0)) { + if (this->roomCtx.curRoom.enablePosLights || (MREG(93) != 0)) { sp268->enablePosLights = true; } @@ -1314,7 +1314,7 @@ void Play_Draw(PlayState* this) { // `if (stuff that evaluates to 0 but not trivially)` s64 roomDrawFlags = 3; - Room_Draw(this, &this->roomCtx.currRoom, roomDrawFlags); + Room_Draw(this, &this->roomCtx.curRoom, roomDrawFlags); Room_Draw(this, &this->roomCtx.prevRoom, roomDrawFlags); } @@ -1575,13 +1575,13 @@ void func_801692C4(PlayState* this, s32 spawn) { func_8016927C(this, this->skyboxId); } -void Play_SceneInit(PlayState* this, s32 scene, s32 spawn) { +void Play_SceneInit(PlayState* this, s32 sceneId, s32 spawn) { s32 pad; - SceneTableEntry* sp1C = &gSceneTable[scene]; + SceneTableEntry* sp1C = &gSceneTable[sceneId]; sp1C->unk_D = 0; this->loadedScene = sp1C; - this->sceneNum = scene; + this->sceneId = sceneId; this->sceneConfig = sp1C->drawConfig; this->sceneSegment = Play_LoadScene(this, &sp1C->segment); sp1C->unk_D = 0; @@ -1818,38 +1818,38 @@ Vec3s* Play_GetActorCsCamFuncData(PlayState* this, s32 csCamDataIndex) { * Converts the number of a scene to its "original" equivalent, the default version of the area which the player first * enters. */ -s16 Play_GetOriginalSceneNumber(s16 sceneNum) { +s16 Play_GetOriginalSceneId(s16 sceneId) { // Inverted Stone Tower Temple -> Stone Tower Temple - if (sceneNum == SCENE_INISIE_R) { + if (sceneId == SCENE_INISIE_R) { return SCENE_INISIE_N; } // Purified Southern Swamp -> Poisoned Sothern Swamp - if (sceneNum == SCENE_20SICHITAI2) { + if (sceneId == SCENE_20SICHITAI2) { return SCENE_20SICHITAI; } // Spring Mountain Village -> Winter Mountain Village - if (sceneNum == SCENE_10YUKIYAMANOMURA2) { + if (sceneId == SCENE_10YUKIYAMANOMURA2) { return SCENE_10YUKIYAMANOMURA; } // Spring Goron Village -> Winter Goron Village - if (sceneNum == SCENE_11GORONNOSATO2) { + if (sceneId == SCENE_11GORONNOSATO2) { return SCENE_11GORONNOSATO; } // Spring Path to Goron Village -> Winter Path to Goron Village - if (sceneNum == SCENE_17SETUGEN2) { + if (sceneId == SCENE_17SETUGEN2) { return SCENE_17SETUGEN; } // Inverted Stone Tower -> Stone Tower - if (sceneNum == SCENE_F41) { + if (sceneId == SCENE_F41) { return SCENE_F40; } - return sceneNum; + return sceneId; } /** @@ -1860,13 +1860,13 @@ void Play_SaveCycleSceneFlags(GameState* thisx) { PlayState* this = (PlayState*)thisx; CycleSceneFlags* cycleSceneFlags; - cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(this->sceneNum)]; + cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneId(this->sceneId)]; 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]; + if (this->sceneId == SCENE_INISIE_R) { // Inverted Stone Tower Temple + cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneId]; } cycleSceneFlags->collectible = this->actorCtx.sceneFlags.collectible[0]; @@ -1891,16 +1891,16 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) PlayState* this = (PlayState*)thisx; Player* player = GET_PLAYER(this); - if (this->sceneNum != SCENE_KAKUSIANA) { // Grottos + if (this->sceneId != SCENE_KAKUSIANA) { // Grottos Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entrance), - this->roomCtx.currRoom.num, playerParams, &player->actor.world.pos, + this->roomCtx.curRoom.num, playerParams, &player->actor.world.pos, player->actor.shape.rot.y); } } // Override respawn data in Sakon's Hideout void func_80169ECC(PlayState* this) { - if (this->sceneNum == SCENE_SECOM) { + if (this->sceneId == SCENE_SECOM) { this->nextEntrance = ENTRANCE(IKANA_CANYON, 6); gSaveContext.respawnFlag = -7; } @@ -1943,7 +1943,7 @@ void func_80169FDC(GameState* thisx) { s32 func_80169FFC(GameState* thisx) { PlayState* this = (PlayState*)thisx; - return this->roomCtx.currRoom.mesh->type0.type != 1; + return this->roomCtx.curRoom.mesh->type0.type != 1; } s32 FrameAdvance_IsEnabled(GameState* thisx) { @@ -2214,7 +2214,7 @@ void Play_Init(GameState* thisx) { Play_SceneInit( this, - Entrance_GetSceneNumAbsolute(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneSetupIndex)), + Entrance_GetSceneIdAbsolute(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneSetupIndex)), Entrance_GetSpawnNum(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneSetupIndex))); KaleidoScopeCall_Init(this); func_80121FC4(this); @@ -2301,7 +2301,7 @@ void Play_Init(GameState* thisx) { while (Room_HandleLoadCallbacks(this, &this->roomCtx) == 0) {} - if ((CURRENT_DAY != 0) && ((this->roomCtx.currRoom.unk3 == 1) || (this->roomCtx.currRoom.unk3 == 5))) { + if ((CURRENT_DAY != 0) && ((this->roomCtx.curRoom.unk3 == 1) || (this->roomCtx.curRoom.unk3 == 5))) { Actor_Spawn(&this->actorCtx, this, 0x15A, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0); } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 1566077f1a..0888be7c53 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -30,7 +30,7 @@ void func_80127B64(struct_801F58B0 arg0[], UNK_TYPE arg1, Vec3f* arg2); s32 func_801226E0(PlayState* play, s32 arg1) { if (arg1 == 0) { Play_SetupRespawnPoint(&play->state, RESPAWN_MODE_DOWN, 0xBFF); - if (play->sceneNum == SCENE_KAKUSIANA) { + if (play->sceneId == SCENE_KAKUSIANA) { return 1; } } @@ -274,7 +274,7 @@ u8 Player_MaskIdToItemId(s32 maskIdMinusOne) { return sMaskItemIds[maskIdMinusOne]; } -u8 Player_GetCurMaskItemId(PlayState* play) { +s32 Player_GetCurMaskItemId(PlayState* play) { Player* player = GET_PLAYER(play); if (player->currentMask != PLAYER_MASK_NONE) { @@ -389,7 +389,7 @@ void func_80123140(PlayState* play, Player* player) { IREG(69) = bootRegs[16]; MREG(95) = bootRegs[17]; - if (play->roomCtx.currRoom.unk3 == 2) { + if (play->roomCtx.curRoom.unk3 == 2) { R_RUN_SPEED_LIMIT = 500; } @@ -508,20 +508,23 @@ s32 func_8012364C(PlayState* play, Player* player, s32 arg2) { if (arg2 == 1) { return (gSaveContext.buttonStatus[1] != BTN_DISABLED) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_LEFT] - : (gSaveContext.unk_3F22 == 0x10) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_LEFT] - : ITEM_NONE; + : (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) + ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_LEFT] + : ITEM_NONE; } if (arg2 == 2) { return (gSaveContext.buttonStatus[2] != BTN_DISABLED) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_DOWN] - : (gSaveContext.unk_3F22 == 0x10) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_DOWN] - : ITEM_NONE; + : (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) + ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_DOWN] + : ITEM_NONE; } return (gSaveContext.buttonStatus[3] != BTN_DISABLED) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_RIGHT] - : (gSaveContext.unk_3F22 == 0x10) ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_RIGHT] - : ITEM_NONE; + : (gSaveContext.hudVisibility == HUD_VISIBILITY_A_B_C) + ? gSaveContext.save.equips.buttonItems[0][EQUIP_SLOT_C_RIGHT] + : ITEM_NONE; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80123810.s") @@ -857,39 +860,40 @@ s32 func_80124278(Actor* actor, s32 actionParam) { } s32 func_801242B4(Player* player) { - return (player->stateFlags1 & PLAYER_STATE1_8000000) && player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER; + return (player->stateFlags1 & PLAYER_STATE1_8000000) && (player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER); } -s32 func_801242DC(PlayState* play) { +s32 Player_GetEnvTimerType(PlayState* play) { Player* player = GET_PLAYER(play); TextTriggerEntry* triggerEntry; - s32 envIndex; + s32 envTimerType; - if (play->roomCtx.currRoom.unk2 == 3) { // Room is hot - envIndex = 0; - } else if ((player->transformation != PLAYER_FORM_ZORA) && (player->unk_AD8 > 80)) { - envIndex = 3; + if (play->roomCtx.curRoom.unk2 == 3) { // Room is hot + envTimerType = PLAYER_ENV_TIMER_HOTROOM - 1; + } else if ((player->transformation != PLAYER_FORM_ZORA) && (player->underwaterTimer > 80)) { + envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FREE - 1; } else if (player->stateFlags1 & PLAYER_STATE1_8000000) { if ((player->transformation == PLAYER_FORM_ZORA) && (player->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) && (player->actor.bgCheckFlags & 1)) { - envIndex = 1; + envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FLOOR - 1; } else { - envIndex = 2; + envTimerType = PLAYER_ENV_TIMER_SWIMMING - 1; } } else { - return 0; + return PLAYER_ENV_TIMER_NONE; } // Trigger general textboxes under certain conditions, like "It's so hot in here!". Unused in MM - triggerEntry = &sEnvironmentTextTriggers[envIndex]; + triggerEntry = &sEnvironmentTextTriggers[envTimerType]; if (!Player_InCsMode(play)) { - if ((triggerEntry->flag) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) && (envIndex == 0)) { + if ((triggerEntry->flag) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) && + (envTimerType == (PLAYER_ENV_TIMER_HOTROOM - 1))) { Message_StartTextbox(play, triggerEntry->textId, NULL); gSaveContext.textTriggerFlags |= triggerEntry->flag; } } - return envIndex + 1; + return envTimerType + 1; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80124420.s") diff --git a/src/code/z_room.c b/src/code/z_room.c index 169d6d5b5a..e198e95ed3 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -64,8 +64,8 @@ void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) { void Room_Init(PlayState* play, RoomContext* roomCtx) { s32 i; - roomCtx->currRoom.num = -1; - roomCtx->currRoom.segment = NULL; + roomCtx->curRoom.num = -1; + roomCtx->curRoom.segment = NULL; roomCtx->unk78 = 1; roomCtx->unk79 = 0; for (i = 0; i < 3; i++) { @@ -79,9 +79,9 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) { if (roomCtx->unk31 == 0) { s32 size; - roomCtx->prevRoom = roomCtx->currRoom; - roomCtx->currRoom.num = index; - roomCtx->currRoom.segment = NULL; + roomCtx->prevRoom = roomCtx->curRoom; + roomCtx->curRoom.num = index; + roomCtx->curRoom.segment = NULL; roomCtx->unk31 = 1; size = play->roomList[index].vromEnd - play->roomList[index].vromStart; @@ -103,16 +103,15 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { if (roomCtx->unk31 == 1) { if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { roomCtx->unk31 = 0; - roomCtx->currRoom.segment = roomCtx->activeRoomVram; + roomCtx->curRoom.segment = roomCtx->activeRoomVram; // TODO: Segment number enum gSegments[0x03] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram); - Scene_ProcessHeader(play, (SceneCmd*)roomCtx->currRoom.segment); + Scene_ProcessHeader(play, (SceneCmd*)roomCtx->curRoom.segment); func_80123140(play, GET_PLAYER(play)); Actor_SpawnTransitionActors(play, &play->actorCtx); - if (((play->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && - (play->sceneNum != SCENE_IKNINSIDE)) { + if (((play->sceneId != SCENE_IKANA) || (roomCtx->curRoom.num != 1)) && (play->sceneId != SCENE_IKNINSIDE)) { play->envCtx.lightSettingOverride = 0xFF; play->envCtx.unk_E0 = 0; } @@ -142,9 +141,9 @@ void func_8012EBF8(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.segment = NULL; func_800BA798(play, &play->actorCtx); Actor_SpawnTransitionActors(play, &play->actorCtx); - if (roomCtx->currRoom.num > -1) { - Map_InitRoomData(play, roomCtx->currRoom.num); + if (roomCtx->curRoom.num > -1) { + Map_InitRoomData(play, roomCtx->curRoom.num); Minimap_SavePlayerRoomInitInfo(play); } - func_801A3CD8(play->roomCtx.currRoom.echo); + func_801A3CD8(play->roomCtx.curRoom.echo); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index edc57e6199..db721efc5a 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -28,12 +28,12 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) { u32 spaceSize; s32 i; - if (play->sceneNum == SCENE_CLOCKTOWER || play->sceneNum == SCENE_TOWN || play->sceneNum == SCENE_BACKTOWN || - play->sceneNum == SCENE_ICHIBA) { + if (play->sceneId == SCENE_CLOCKTOWER || play->sceneId == SCENE_TOWN || play->sceneId == SCENE_BACKTOWN || + play->sceneId == SCENE_ICHIBA) { spaceSize = OBJECT_SPACE_SIZE_CLOCK_TOWN; - } else if (play->sceneNum == SCENE_MILK_BAR) { + } else if (play->sceneId == SCENE_MILK_BAR) { spaceSize = OBJECT_SPACE_SIZE_MILK_BAR; - } else if (play->sceneNum == SCENE_00KEIKOKU) { + } else if (play->sceneId == SCENE_00KEIKOKU) { spaceSize = OBJECT_SPACE_SIZE_TERMINA_FIELD; } else { spaceSize = OBJECT_SPACE_SIZE_DEFAULT; @@ -234,17 +234,17 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x08: Room Behavior void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) { - play->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1; - play->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; - play->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; + play->roomCtx.curRoom.unk3 = cmd->roomBehavior.gpFlag1; + play->roomCtx.curRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; + play->roomCtx.curRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; - play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1; + play->roomCtx.curRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1; play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xC) & 1; } // SceneTableEntry Header Command 0x0A: Mesh Header void Scene_HeaderCmdMesh(PlayState* play, SceneCmd* cmd) { - play->roomCtx.currRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); + play->roomCtx.curRoom.mesh = Lib_SegmentedToVirtual(cmd->mesh.segment); } // SceneTableEntry Header Command 0x0B: Object List @@ -446,7 +446,7 @@ void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x16: Echo Setting void Scene_HeaderCmdEchoSetting(PlayState* play, SceneCmd* cmd) { - play->roomCtx.currRoom.echo = cmd->echoSettings.echo; + play->roomCtx.curRoom.echo = cmd->echoSettings.echo; } // SceneTableEntry Header Command 0x18: Alternate Header List= @@ -497,23 +497,23 @@ void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { s16 i = 0; while (true) { - if (gScenesPerRegion[i][j] == 0xFFFF) { + if (gSceneIdsPerRegion[i][j] == 0xFFFF) { i++; j = 0; - if (i == ARRAY_COUNT(gScenesPerRegion)) { + if (i == ARRAY_COUNT(gSceneIdsPerRegion)) { break; } } - if (play->sceneNum == gScenesPerRegion[i][j]) { + if (play->sceneId == gSceneIdsPerRegion[i][j]) { break; } j++; } - if (i < ARRAY_COUNT(gScenesPerRegion)) { + if (i < ARRAY_COUNT(gSceneIdsPerRegion)) { gSaveContext.save.mapsVisited = (gBitFlags[i] | gSaveContext.save.mapsVisited) | gSaveContext.save.mapsVisited; } } diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index ea822a2c7b..f80ad551da 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -123,15 +123,15 @@ SceneTableEntry gSceneTable[] = { }; static EntranceTableEntry sMayorsResidenceEntrance0[] = { - { 0x12, 0x00, 0x4102 }, + { SCENE_SONCHONOIE, 0, 0x4102 }, }; static EntranceTableEntry sMayorsResidenceEntrance1[] = { - { 0x12, 0x01, 0x4102 }, + { SCENE_SONCHONOIE, 1, 0x4102 }, }; static EntranceTableEntry sMayorsResidenceEntrance2[] = { - { 0x12, 0x02, 0x4102 }, + { SCENE_SONCHONOIE, 2, 0x4102 }, }; static EntranceTableEntry* sMayorsResidenceEntranceTable[] = { @@ -141,7 +141,7 @@ static EntranceTableEntry* sMayorsResidenceEntranceTable[] = { }; static EntranceTableEntry sMajorasLairEntrance0[] = { - { 0xF5, 0x00, 0x0387 }, + { -SCENE_LAST_BS, 0, 0x0387 }, }; static EntranceTableEntry* sMajorasLairEntranceTable[] = { @@ -149,7 +149,7 @@ static EntranceTableEntry* sMajorasLairEntranceTable[] = { }; static EntranceTableEntry sMagicHagsPotionShopEntrance0[] = { - { 0x0A, 0x00, 0x4102 }, + { SCENE_WITCH_SHOP, 0, 0x4102 }, }; static EntranceTableEntry* sMagicHagsPotionShopEntranceTable[] = { @@ -157,11 +157,11 @@ static EntranceTableEntry* sMagicHagsPotionShopEntranceTable[] = { }; static EntranceTableEntry sRanchHouseEntrance0[] = { - { 0x10, 0x00, 0x0102 }, + { SCENE_OMOYA, 0, 0x0102 }, }; static EntranceTableEntry sRanchHouseEntrance1[] = { - { 0x10, 0x01, 0x4102 }, + { SCENE_OMOYA, 1, 0x4102 }, }; static EntranceTableEntry* sRanchHouseEntranceTable[] = { @@ -170,7 +170,7 @@ static EntranceTableEntry* sRanchHouseEntranceTable[] = { }; static EntranceTableEntry sHoneyAndDarlingsShopEntrance0[] = { - { 0x11, 0x00, 0x4102 }, + { SCENE_BOWLING, 0, 0x4102 }, }; static EntranceTableEntry* sHoneyAndDarlingsShopEntranceTable[] = { @@ -178,11 +178,11 @@ static EntranceTableEntry* sHoneyAndDarlingsShopEntranceTable[] = { }; static EntranceTableEntry sBeneathTheGraveryardEntrance0[] = { - { 0xF4, 0x00, 0x4102 }, + { -SCENE_HAKASHITA, 0, 0x4102 }, }; static EntranceTableEntry sBeneathTheGraveryardEntrance1[] = { - { 0xF4, 0x01, 0x4102 }, + { -SCENE_HAKASHITA, 1, 0x4102 }, }; static EntranceTableEntry* sBeneathTheGraveryardEntranceTable[] = { @@ -191,47 +191,47 @@ static EntranceTableEntry* sBeneathTheGraveryardEntranceTable[] = { }; static EntranceTableEntry sSouthernSwampClearedEntrance0[] = { - { 0x00, 0x00, 0xCA14 }, + { SCENE_20SICHITAI2, 0, 0xCA14 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance1[] = { - { 0x00, 0x01, 0x4102 }, + { SCENE_20SICHITAI2, 1, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance2[] = { - { 0x00, 0x02, 0xC102 }, + { SCENE_20SICHITAI2, 2, 0xC102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance3[] = { - { 0x00, 0x03, 0x4102 }, + { SCENE_20SICHITAI2, 3, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance4[] = { - { 0x00, 0x04, 0x4102 }, + { SCENE_20SICHITAI2, 4, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance5[] = { - { 0x00, 0x05, 0x4102 }, + { SCENE_20SICHITAI2, 5, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance6[] = { - { 0x00, 0x06, 0x0102 }, + { SCENE_20SICHITAI2, 6, 0x0102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance7[] = { - { 0x00, 0x07, 0x4102 }, + { SCENE_20SICHITAI2, 7, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance8[] = { - { 0x00, 0x08, 0x4102 }, + { SCENE_20SICHITAI2, 8, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance9[] = { - { 0x00, 0x09, 0x4A14 }, + { SCENE_20SICHITAI2, 9, 0x4A14 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance10[] = { - { 0x00, 0x0A, 0x4A14 }, + { SCENE_20SICHITAI2, 10, 0x4A14 }, }; static EntranceTableEntry* sSouthernSwampClearedEntranceTable[] = { @@ -242,19 +242,19 @@ static EntranceTableEntry* sSouthernSwampClearedEntranceTable[] = { }; static EntranceTableEntry sCuriosityShopEntrance0[] = { - { 0x0D, 0x00, 0x4102 }, + { SCENE_AYASHIISHOP, 0, 0x4102 }, }; static EntranceTableEntry sCuriosityShopEntrance1[] = { - { 0x0D, 0x01, 0x0102 }, + { SCENE_AYASHIISHOP, 1, 0x0102 }, }; static EntranceTableEntry sCuriosityShopEntrance2[] = { - { 0x0D, 0x02, 0x8A95 }, + { SCENE_AYASHIISHOP, 2, 0x8A95 }, }; static EntranceTableEntry sCuriosityShopEntrance3[] = { - { 0x0D, 0x03, 0x8102 }, + { SCENE_AYASHIISHOP, 3, 0x8102 }, }; static EntranceTableEntry* sCuriosityShopEntranceTable[] = { @@ -265,113 +265,113 @@ static EntranceTableEntry* sCuriosityShopEntranceTable[] = { }; static EntranceTableEntry sIkanaCanyonEntrance0[] = { - { 0x13, 0x00, 0xCA14 }, { 0x13, 0x00, 0x8A14 }, { 0x13, 0x00, 0x0A14 }, - { 0x13, 0x00, 0x4A14 }, { 0x13, 0x00, 0x8102 }, + { SCENE_IKANA, 0, 0xCA14 }, { SCENE_IKANA, 0, 0x8A14 }, { SCENE_IKANA, 0, 0x0A14 }, + { SCENE_IKANA, 0, 0x4A14 }, { SCENE_IKANA, 0, 0x8102 }, }; static EntranceTableEntry sIkanaCanyonEntrance1[] = { - { 0x13, 0x01, 0x4102 }, - { 0x13, 0x01, 0x4102 }, - { 0x13, 0x01, 0xCA14 }, - { 0x13, 0x01, 0x4102 }, + { SCENE_IKANA, 1, 0x4102 }, + { SCENE_IKANA, 1, 0x4102 }, + { SCENE_IKANA, 1, 0xCA14 }, + { SCENE_IKANA, 1, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance2[] = { - { 0x13, 0x02, 0x4102 }, - { 0x13, 0x02, 0x4102 }, - { 0x13, 0x02, 0x4102 }, - { 0x13, 0x02, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance3[] = { - { 0x13, 0x03, 0x4102 }, - { 0x13, 0x03, 0x4102 }, - { 0x13, 0x03, 0x4102 }, - { 0x13, 0x03, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance4[] = { - { 0x13, 0x04, 0x4A14 }, - { 0x13, 0x04, 0x4A14 }, - { 0x13, 0x04, 0x4A14 }, - { 0x13, 0x04, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance5[] = { - { 0x13, 0x05, 0x4102 }, - { 0x13, 0x05, 0x4102 }, - { 0x13, 0x05, 0x4102 }, - { 0x13, 0x05, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance6[] = { - { 0x13, 0x06, 0x4102 }, - { 0x13, 0x06, 0x4102 }, - { 0x13, 0x06, 0x4102 }, - { 0x13, 0x06, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance7[] = { - { 0x13, 0x07, 0x4A14 }, - { 0x13, 0x07, 0x4A14 }, - { 0x13, 0x07, 0x4A14 }, - { 0x13, 0x07, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance8[] = { - { 0x13, 0x08, 0x4102 }, - { 0x13, 0x08, 0x4102 }, - { 0x13, 0x08, 0x4102 }, - { 0x13, 0x08, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance9[] = { - { 0x13, 0x09, 0x4A14 }, - { 0x13, 0x09, 0x4A14 }, - { 0x13, 0x09, 0x4A14 }, - { 0x13, 0x09, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance10[] = { - { 0x13, 0x0A, 0x4A14 }, - { 0x13, 0x0A, 0x4A14 }, - { 0x13, 0x0A, 0x4A14 }, - { 0x13, 0x0A, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance11[] = { - { 0x13, 0x0B, 0x4102 }, - { 0x13, 0x0B, 0x4102 }, - { 0x13, 0x0B, 0x4102 }, - { 0x13, 0x0B, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance12[] = { - { 0x13, 0x0C, 0x4102 }, - { 0x13, 0x0C, 0x4102 }, - { 0x13, 0x0C, 0x4102 }, - { 0x13, 0x0C, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance13[] = { - { 0x13, 0x0D, 0x8102 }, - { 0x13, 0x0D, 0x8102 }, - { 0x13, 0x0D, 0x8102 }, - { 0x13, 0x0D, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, }; static EntranceTableEntry sIkanaCanyonEntrance14[] = { - { 0x13, 0x0E, 0x8102 }, - { 0x13, 0x0E, 0x8102 }, - { 0x13, 0x0E, 0x8102 }, - { 0x13, 0x0E, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, }; static EntranceTableEntry sIkanaCanyonEntrance15[] = { - { 0x13, 0x0F, 0x8102 }, - { 0x13, 0x0F, 0x8102 }, - { 0x13, 0x0F, 0x8102 }, - { 0x13, 0x0F, 0x0183 }, + { SCENE_IKANA, 15, 0x8102 }, + { SCENE_IKANA, 15, 0x8102 }, + { SCENE_IKANA, 15, 0x8102 }, + { SCENE_IKANA, 15, 0x0183 }, }; static EntranceTableEntry* sIkanaCanyonEntranceTable[] = { @@ -382,66 +382,66 @@ static EntranceTableEntry* sIkanaCanyonEntranceTable[] = { }; static EntranceTableEntry sPiratesFortressEntrance0[] = { - { 0x14, 0x00, 0x8102 }, - { 0x14, 0x00, 0x8102 }, - { 0x14, 0x00, 0x8102 }, + { SCENE_KAIZOKU, 0, 0x8102 }, + { SCENE_KAIZOKU, 0, 0x8102 }, + { SCENE_KAIZOKU, 0, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance1[] = { - { 0x14, 0x01, 0x8102 }, - { 0x14, 0x01, 0x8102 }, + { SCENE_KAIZOKU, 1, 0x8102 }, + { SCENE_KAIZOKU, 1, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance2[] = { - { 0x14, 0x02, 0x8102 }, + { SCENE_KAIZOKU, 2, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance3[] = { - { 0x14, 0x03, 0x8102 }, + { SCENE_KAIZOKU, 3, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance4[] = { - { 0x14, 0x04, 0x8102 }, + { SCENE_KAIZOKU, 4, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance5[] = { - { 0x14, 0x05, 0x8102 }, + { SCENE_KAIZOKU, 5, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance6[] = { - { 0x14, 0x06, 0x8102 }, + { SCENE_KAIZOKU, 6, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance7[] = { - { 0x14, 0x07, 0x8102 }, + { SCENE_KAIZOKU, 7, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance8[] = { - { 0x14, 0x08, 0x8102 }, + { SCENE_KAIZOKU, 8, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance9[] = { - { 0x14, 0x09, 0x8102 }, + { SCENE_KAIZOKU, 9, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance10[] = { - { 0x14, 0x0A, 0x8A95 }, + { SCENE_KAIZOKU, 10, 0x8A95 }, }; static EntranceTableEntry sPiratesFortressEntrance11[] = { - { 0x14, 0x0B, 0x8102 }, + { SCENE_KAIZOKU, 11, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance12[] = { - { 0x14, 0x0C, 0x8102 }, + { SCENE_KAIZOKU, 12, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance13[] = { - { 0x14, 0x0D, 0x8102 }, + { SCENE_KAIZOKU, 13, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance14[] = { - { 0x14, 0x0E, 0x8102 }, + { SCENE_KAIZOKU, 14, 0x8102 }, }; static EntranceTableEntry* sPiratesFortressEntranceTable[] = { @@ -452,8 +452,8 @@ static EntranceTableEntry* sPiratesFortressEntranceTable[] = { }; static EntranceTableEntry sMilkBarEntrance0[] = { - { 0x15, 0x00, 0x4102 }, { 0x15, 0x00, 0x8102 }, { 0x15, 0x00, 0x8102 }, - { 0x15, 0x00, 0x8102 }, { 0x15, 0x00, 0x8102 }, + { SCENE_MILK_BAR, 0, 0x4102 }, { SCENE_MILK_BAR, 0, 0x8102 }, { SCENE_MILK_BAR, 0, 0x8102 }, + { SCENE_MILK_BAR, 0, 0x8102 }, { SCENE_MILK_BAR, 0, 0x8102 }, }; static EntranceTableEntry* sMilkBarEntranceTable[] = { @@ -461,11 +461,11 @@ static EntranceTableEntry* sMilkBarEntranceTable[] = { }; static EntranceTableEntry sStoneTowerTempleEntrance0[] = { - { 0xEA, 0x00, 0xC102 }, + { -SCENE_INISIE_N, 0, 0xC102 }, }; static EntranceTableEntry sStoneTowerTempleEntrance1[] = { - { 0xEA, 0x01, 0x4102 }, + { -SCENE_INISIE_N, 1, 0x4102 }, }; static EntranceTableEntry* sStoneTowerTempleEntranceTable[] = { @@ -474,11 +474,11 @@ static EntranceTableEntry* sStoneTowerTempleEntranceTable[] = { }; static EntranceTableEntry sTreasureChestShopEntrance0[] = { - { 0x17, 0x00, 0x4102 }, + { SCENE_TAKARAYA, 0, 0x4102 }, }; static EntranceTableEntry sTreasureChestShopEntrance1[] = { - { 0x17, 0x01, 0x0102 }, + { SCENE_TAKARAYA, 1, 0x0102 }, }; static EntranceTableEntry* sTreasureChestShopEntranceTable[] = { @@ -487,15 +487,15 @@ static EntranceTableEntry* sTreasureChestShopEntranceTable[] = { }; static EntranceTableEntry sStoneTowerTempleInvertedEntrance0[] = { - { 0xE8, 0x00, 0xC102 }, + { -SCENE_INISIE_R, 0, 0xC102 }, }; static EntranceTableEntry sStoneTowerTempleInvertedEntrance1[] = { - { 0xE8, 0x01, 0x8102 }, + { -SCENE_INISIE_R, 1, 0x8102 }, }; static EntranceTableEntry sStoneTowerTempleInvertedEntrance2[] = { - { 0xE8, 0x02, 0x8102 }, + { -SCENE_INISIE_R, 2, 0x8102 }, }; static EntranceTableEntry* sStoneTowerTempleInvertedEntranceTable[] = { @@ -505,22 +505,22 @@ static EntranceTableEntry* sStoneTowerTempleInvertedEntranceTable[] = { }; static EntranceTableEntry sClockTowerRooftopEntrance0[] = { - { 0xE7, 0x00, 0x0102 }, - { 0xE7, 0x00, 0x8102 }, - { 0xE7, 0x00, 0x0102 }, - { 0xE7, 0x00, 0x0102 }, + { -SCENE_OKUJOU, 0, 0x0102 }, + { -SCENE_OKUJOU, 0, 0x8102 }, + { -SCENE_OKUJOU, 0, 0x0102 }, + { -SCENE_OKUJOU, 0, 0x0102 }, }; static EntranceTableEntry sClockTowerRooftopEntrance1[] = { - { 0xE7, 0x01, 0x0102 }, - { 0xE7, 0x01, 0x0102 }, - { 0xE7, 0x01, 0x0102 }, + { -SCENE_OKUJOU, 1, 0x0102 }, + { -SCENE_OKUJOU, 1, 0x0102 }, + { -SCENE_OKUJOU, 1, 0x0102 }, }; static EntranceTableEntry sClockTowerRooftopEntrance2[] = { - { 0xE7, 0x02, 0x858B }, - { 0xE7, 0x02, 0x858B }, - { 0xE7, 0x02, 0x8102 }, + { -SCENE_OKUJOU, 2, 0x858B }, + { -SCENE_OKUJOU, 2, 0x858B }, + { -SCENE_OKUJOU, 2, 0x8102 }, }; static EntranceTableEntry* sClockTowerRooftopEntranceTable[] = { @@ -530,24 +530,24 @@ static EntranceTableEntry* sClockTowerRooftopEntranceTable[] = { }; static EntranceTableEntry sOpeningDungeonEntrance0[] = { - { 0xE6, 0x00, 0x0102 }, - { 0xE6, 0x00, 0x8102 }, + { -SCENE_OPENINGDAN, 0, 0x0102 }, + { -SCENE_OPENINGDAN, 0, 0x8102 }, }; static EntranceTableEntry sOpeningDungeonEntrance1[] = { - { 0xE6, 0x01, 0x0102 }, + { -SCENE_OPENINGDAN, 1, 0x0102 }, }; static EntranceTableEntry sOpeningDungeonEntrance2[] = { - { 0xE6, 0x02, 0x0102 }, + { -SCENE_OPENINGDAN, 2, 0x0102 }, }; static EntranceTableEntry sOpeningDungeonEntrance3[] = { - { 0xE6, 0x03, 0x0102 }, + { -SCENE_OPENINGDAN, 3, 0x0102 }, }; static EntranceTableEntry sOpeningDungeonEntrance4[] = { - { 0xE6, 0x04, 0x058B }, + { -SCENE_OPENINGDAN, 4, 0x058B }, }; static EntranceTableEntry* sOpeningDungeonEntranceTable[] = { @@ -556,15 +556,15 @@ static EntranceTableEntry* sOpeningDungeonEntranceTable[] = { }; static EntranceTableEntry sWoodfallTempleEntrance0[] = { - { 0xE5, 0x00, 0x4102 }, + { -SCENE_MITURIN, 0, 0x4102 }, }; static EntranceTableEntry sWoodfallTempleEntrance1[] = { - { 0xE5, 0x01, 0x0102 }, + { -SCENE_MITURIN, 1, 0x0102 }, }; static EntranceTableEntry sWoodfallTempleEntrance2[] = { - { 0xE5, 0x02, 0x0102 }, + { -SCENE_MITURIN, 2, 0x0102 }, }; static EntranceTableEntry* sWoodfallTempleEntranceTable[] = { @@ -574,13 +574,13 @@ static EntranceTableEntry* sWoodfallTempleEntranceTable[] = { }; static EntranceTableEntry sPathToMountainVillageEntrance0[] = { - { 0x1C, 0x00, 0x8A14 }, - { 0x1C, 0x00, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 0, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 0, 0x8A14 }, }; static EntranceTableEntry sPathToMountainVillageEntrance1[] = { - { 0x1C, 0x01, 0x8A14 }, - { 0x1C, 0x01, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 1, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 1, 0x8A14 }, }; static EntranceTableEntry* sPathToMountainVillageEntranceTable[] = { @@ -589,31 +589,31 @@ static EntranceTableEntry* sPathToMountainVillageEntranceTable[] = { }; static EntranceTableEntry sIkanaCastleEntrance0[] = { - { 0xE3, 0x00, 0x4102 }, + { -SCENE_CASTLE, 0, 0x4102 }, }; static EntranceTableEntry sIkanaCastleEntrance1[] = { - { 0xE3, 0x01, 0x4102 }, + { -SCENE_CASTLE, 1, 0x4102 }, }; static EntranceTableEntry sIkanaCastleEntrance2[] = { - { 0xE3, 0x02, 0x8102 }, + { -SCENE_CASTLE, 2, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance3[] = { - { 0xE3, 0x03, 0x8102 }, + { -SCENE_CASTLE, 3, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance4[] = { - { 0xE3, 0x04, 0x8102 }, + { -SCENE_CASTLE, 4, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance5[] = { - { 0xE3, 0x05, 0x8102 }, + { -SCENE_CASTLE, 5, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance6[] = { - { 0xE3, 0x06, 0x8102 }, + { -SCENE_CASTLE, 6, 0x8102 }, }; static EntranceTableEntry* sIkanaCastleEntranceTable[] = { @@ -622,11 +622,11 @@ static EntranceTableEntry* sIkanaCastleEntranceTable[] = { }; static EntranceTableEntry sDekuScrubPlaygroundEntrance0[] = { - { 0x1E, 0x00, 0x0102 }, + { SCENE_DEKUTES, 0, 0x0102 }, }; static EntranceTableEntry sDekuScrubPlaygroundEntrance1[] = { - { 0x1E, 0x01, 0x0102 }, + { SCENE_DEKUTES, 1, 0x0102 }, }; static EntranceTableEntry* sDekuScrubPlaygroundEntranceTable[] = { @@ -635,7 +635,7 @@ static EntranceTableEntry* sDekuScrubPlaygroundEntranceTable[] = { }; static EntranceTableEntry sOdolwasLairEntrance0[] = { - { 0xE1, 0x00, 0x8102 }, + { -SCENE_MITURIN_BS, 0, 0x8102 }, }; static EntranceTableEntry* sOdolwasLairEntranceTable[] = { @@ -643,11 +643,11 @@ static EntranceTableEntry* sOdolwasLairEntranceTable[] = { }; static EntranceTableEntry sTownShootingGalleryEntrance0[] = { - { 0x20, 0x00, 0x4102 }, + { SCENE_SYATEKI_MIZU, 0, 0x4102 }, }; static EntranceTableEntry sTownShootingGalleryEntrance1[] = { - { 0x20, 0x01, 0x0102 }, + { SCENE_SYATEKI_MIZU, 1, 0x0102 }, }; static EntranceTableEntry* sTownShootingGalleryEntranceTable[] = { @@ -656,11 +656,11 @@ static EntranceTableEntry* sTownShootingGalleryEntranceTable[] = { }; static EntranceTableEntry sSnowheadTempleEntrance0[] = { - { 0xDF, 0x00, 0x4102 }, + { -SCENE_HAKUGIN, 0, 0x4102 }, }; static EntranceTableEntry sSnowheadTempleEntrance1[] = { - { 0xDF, 0x01, 0x4102 }, + { -SCENE_HAKUGIN, 1, 0x4102 }, }; static EntranceTableEntry* sSnowheadTempleEntranceTable[] = { @@ -669,31 +669,31 @@ static EntranceTableEntry* sSnowheadTempleEntranceTable[] = { }; static EntranceTableEntry sMilkRoadEntrance0[] = { - { 0x22, 0x00, 0xCA14 }, + { SCENE_ROMANYMAE, 0, 0xCA14 }, }; static EntranceTableEntry sMilkRoadEntrance1[] = { - { 0x22, 0x01, 0x4A14 }, + { SCENE_ROMANYMAE, 1, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance2[] = { - { 0x22, 0x02, 0x4A14 }, + { SCENE_ROMANYMAE, 2, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance3[] = { - { 0x22, 0x03, 0x4A14 }, + { SCENE_ROMANYMAE, 3, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance4[] = { - { 0x22, 0x04, 0x4A14 }, + { SCENE_ROMANYMAE, 4, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance5[] = { - { 0x22, 0x05, 0x0102 }, + { SCENE_ROMANYMAE, 5, 0x0102 }, }; static EntranceTableEntry sMilkRoadEntrance6[] = { - { 0x22, 0x06, 0x0102 }, + { SCENE_ROMANYMAE, 6, 0x0102 }, }; static EntranceTableEntry* sMilkRoadEntranceTable[] = { @@ -702,67 +702,67 @@ static EntranceTableEntry* sMilkRoadEntranceTable[] = { }; static EntranceTableEntry sPiratesFortressInteriorEntrance0[] = { - { 0x23, 0x00, 0x8102 }, + { SCENE_PIRATE, 0, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance1[] = { - { 0x23, 0x01, 0x8102 }, + { SCENE_PIRATE, 1, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance2[] = { - { 0x23, 0x02, 0x8102 }, + { SCENE_PIRATE, 2, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance3[] = { - { 0x23, 0x03, 0x8102 }, + { SCENE_PIRATE, 3, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance4[] = { - { 0x23, 0x04, 0x8102 }, + { SCENE_PIRATE, 4, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance5[] = { - { 0x23, 0x05, 0x8102 }, + { SCENE_PIRATE, 5, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance6[] = { - { 0x23, 0x06, 0x8102 }, + { SCENE_PIRATE, 6, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance7[] = { - { 0x23, 0x07, 0x8102 }, + { SCENE_PIRATE, 7, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance8[] = { - { 0x23, 0x08, 0x8102 }, + { SCENE_PIRATE, 8, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance9[] = { - { 0x23, 0x09, 0x8993 }, + { SCENE_PIRATE, 9, 0x8993 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance10[] = { - { 0x23, 0x0A, 0x8102 }, + { SCENE_PIRATE, 10, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance11[] = { - { 0x23, 0x0B, 0x8102 }, + { SCENE_PIRATE, 11, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance12[] = { - { 0x23, 0x0C, 0x8102 }, + { SCENE_PIRATE, 12, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance13[] = { - { 0x23, 0x0D, 0x8102 }, + { SCENE_PIRATE, 13, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance14[] = { - { 0x23, 0x0E, 0x8102 }, + { SCENE_PIRATE, 14, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance15[] = { - { 0x23, 0x0F, 0x8102 }, + { SCENE_PIRATE, 15, 0x8102 }, }; static EntranceTableEntry* sPiratesFortressInteriorEntranceTable[] = { @@ -775,7 +775,7 @@ static EntranceTableEntry* sPiratesFortressInteriorEntranceTable[] = { }; static EntranceTableEntry sSwampShootingGalleryEntrance0[] = { - { 0x24, 0x00, 0x4102 }, + { SCENE_SYATEKI_MORI, 0, 0x4102 }, }; static EntranceTableEntry* sSwampShootingGalleryEntranceTable[] = { @@ -783,11 +783,11 @@ static EntranceTableEntry* sSwampShootingGalleryEntranceTable[] = { }; static EntranceTableEntry sPinnacleRockEntrance0[] = { - { 0x25, 0x00, 0x4A14 }, + { SCENE_SINKAI, 0, 0x4A14 }, }; static EntranceTableEntry sPinnacleRockEntrance1[] = { - { 0x25, 0x01, 0x0A14 }, + { SCENE_SINKAI, 1, 0x0A14 }, }; static EntranceTableEntry* sPinnacleRockEntranceTable[] = { @@ -796,44 +796,44 @@ static EntranceTableEntry* sPinnacleRockEntranceTable[] = { }; static EntranceTableEntry sFairyFountainEntrance0[] = { - { 0x26, 0x00, 0x4102 }, - { 0x26, 0x00, 0x8102 }, + { SCENE_YOUSEI_IZUMI, 0, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 0, 0x8102 }, }; static EntranceTableEntry sFairyFountainEntrance1[] = { - { 0x26, 0x01, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 1, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance2[] = { - { 0x26, 0x02, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 2, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance3[] = { - { 0x26, 0x03, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 3, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance4[] = { - { 0x26, 0x04, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 4, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance5[] = { - { 0x26, 0x05, 0x8183 }, + { SCENE_YOUSEI_IZUMI, 5, 0x8183 }, }; static EntranceTableEntry sFairyFountainEntrance6[] = { - { 0x26, 0x06, 0x858B }, + { SCENE_YOUSEI_IZUMI, 6, 0x858B }, }; static EntranceTableEntry sFairyFountainEntrance7[] = { - { 0x26, 0x07, 0x858B }, + { SCENE_YOUSEI_IZUMI, 7, 0x858B }, }; static EntranceTableEntry sFairyFountainEntrance8[] = { - { 0x26, 0x08, 0x858B }, + { SCENE_YOUSEI_IZUMI, 8, 0x858B }, }; static EntranceTableEntry sFairyFountainEntrance9[] = { - { 0x26, 0x09, 0x858B }, + { SCENE_YOUSEI_IZUMI, 9, 0x858B }, }; static EntranceTableEntry* sFairyFountainEntranceTable[] = { @@ -843,7 +843,7 @@ static EntranceTableEntry* sFairyFountainEntranceTable[] = { }; static EntranceTableEntry sSwampSpiderHouseEntrance0[] = { - { 0xD9, 0x00, 0x4102 }, + { -SCENE_KINSTA1, 0, 0x4102 }, }; static EntranceTableEntry* sSwampSpiderHouseEntranceTable[] = { @@ -851,7 +851,7 @@ static EntranceTableEntry* sSwampSpiderHouseEntranceTable[] = { }; static EntranceTableEntry sOceansideSpiderHouseEntrance0[] = { - { 0xD8, 0x00, 0x4102 }, + { -SCENE_KINDAN2, 0, 0x4102 }, }; static EntranceTableEntry* sOceansideSpiderHouseEntranceTable[] = { @@ -859,15 +859,15 @@ static EntranceTableEntry* sOceansideSpiderHouseEntranceTable[] = { }; static EntranceTableEntry sAstralObservatoryEntrance0[] = { - { 0x29, 0x00, 0x0102 }, + { SCENE_TENMON_DAI, 0, 0x0102 }, }; static EntranceTableEntry sAstralObservatoryEntrance1[] = { - { 0x29, 0x01, 0x4102 }, + { SCENE_TENMON_DAI, 1, 0x4102 }, }; static EntranceTableEntry sAstralObservatoryEntrance2[] = { - { 0x29, 0x02, 0x8115 }, + { SCENE_TENMON_DAI, 2, 0x8115 }, }; static EntranceTableEntry* sAstralObservatoryEntranceTable[] = { @@ -877,7 +877,7 @@ static EntranceTableEntry* sAstralObservatoryEntranceTable[] = { }; static EntranceTableEntry sMoonDekuTrialEntrance0[] = { - { 0xD6, 0x00, 0x0387 }, + { -SCENE_LAST_DEKU, 0, 0x0387 }, }; static EntranceTableEntry* sMoonDekuTrialEntranceTable[] = { @@ -885,47 +885,47 @@ static EntranceTableEntry* sMoonDekuTrialEntranceTable[] = { }; static EntranceTableEntry sDekuPalaceEntrance0[] = { - { 0x2B, 0x00, 0x4102 }, + { SCENE_22DEKUCITY, 0, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance1[] = { - { 0x2B, 0x01, 0x8A14 }, + { SCENE_22DEKUCITY, 1, 0x8A14 }, }; static EntranceTableEntry sDekuPalaceEntrance2[] = { - { 0x2B, 0x02, 0xC102 }, + { SCENE_22DEKUCITY, 2, 0xC102 }, }; static EntranceTableEntry sDekuPalaceEntrance3[] = { - { 0x2B, 0x03, 0xC102 }, + { SCENE_22DEKUCITY, 3, 0xC102 }, }; static EntranceTableEntry sDekuPalaceEntrance4[] = { - { 0x2B, 0x04, 0x4102 }, + { SCENE_22DEKUCITY, 4, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance5[] = { - { 0x2B, 0x05, 0x4102 }, + { SCENE_22DEKUCITY, 5, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance6[] = { - { 0x2B, 0x06, 0x4102 }, + { SCENE_22DEKUCITY, 6, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance7[] = { - { 0x2B, 0x07, 0x4102 }, + { SCENE_22DEKUCITY, 7, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance8[] = { - { 0x2B, 0x08, 0x4102 }, + { SCENE_22DEKUCITY, 8, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance9[] = { - { 0x2B, 0x09, 0x4102 }, + { SCENE_22DEKUCITY, 9, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance10[] = { - { 0x2B, 0x0A, 0x4102 }, + { SCENE_22DEKUCITY, 10, 0x4102 }, }; static EntranceTableEntry* sDekuPalaceEntranceTable[] = { @@ -935,7 +935,7 @@ static EntranceTableEntry* sDekuPalaceEntranceTable[] = { }; static EntranceTableEntry sMountainSmithyEntrance0[] = { - { 0x2C, 0x00, 0x4102 }, + { SCENE_KAJIYA, 0, 0x4102 }, }; static EntranceTableEntry* sMountainSmithyEntranceTable[] = { @@ -943,79 +943,81 @@ static EntranceTableEntry* sMountainSmithyEntranceTable[] = { }; static EntranceTableEntry sTerminaFieldEntrance0[] = { - { 0x2D, 0x00, 0x4102 }, { 0xD3, 0x00, 0x0A14 }, { 0xD3, 0x00, 0x0A14 }, { 0xD3, 0x00, 0x058B }, - { 0x2D, 0x00, 0x0A14 }, { 0x2D, 0x00, 0x0A14 }, { 0x2D, 0x00, 0x058B }, { 0x2D, 0x00, 0x8102 }, - { 0x2D, 0x00, 0x0102 }, { 0x2D, 0x00, 0x8102 }, + { SCENE_00KEIKOKU, 0, 0x4102 }, { -SCENE_00KEIKOKU, 0, 0x0A14 }, { -SCENE_00KEIKOKU, 0, 0x0A14 }, + { -SCENE_00KEIKOKU, 0, 0x058B }, { SCENE_00KEIKOKU, 0, 0x0A14 }, { SCENE_00KEIKOKU, 0, 0x0A14 }, + { SCENE_00KEIKOKU, 0, 0x058B }, { SCENE_00KEIKOKU, 0, 0x8102 }, { SCENE_00KEIKOKU, 0, 0x0102 }, + { SCENE_00KEIKOKU, 0, 0x8102 }, }; static EntranceTableEntry sTerminaFieldEntrance1[] = { - { 0x2D, 0x01, 0xCA14 }, { 0x2D, 0x01, 0x0A14 }, { 0x2D, 0x01, 0x058B }, { 0xD3, 0x01, 0x858B }, - { 0x2D, 0x01, 0x0A14 }, { 0x2D, 0x01, 0x0A14 }, { 0x2D, 0x01, 0x058B }, { 0x2D, 0x01, 0x858B }, - { 0x2D, 0x01, 0x0102 }, { 0x2D, 0x01, 0x8102 }, + { SCENE_00KEIKOKU, 1, 0xCA14 }, { SCENE_00KEIKOKU, 1, 0x0A14 }, { SCENE_00KEIKOKU, 1, 0x058B }, + { -SCENE_00KEIKOKU, 1, 0x858B }, { SCENE_00KEIKOKU, 1, 0x0A14 }, { SCENE_00KEIKOKU, 1, 0x0A14 }, + { SCENE_00KEIKOKU, 1, 0x058B }, { SCENE_00KEIKOKU, 1, 0x858B }, { SCENE_00KEIKOKU, 1, 0x0102 }, + { SCENE_00KEIKOKU, 1, 0x8102 }, }; static EntranceTableEntry sTerminaFieldEntrance2[] = { - { 0x2D, 0x02, 0xCA14 }, { 0xD3, 0x02, 0x0A14 }, { 0xD3, 0x02, 0x0A14 }, - { 0xD3, 0x02, 0x058B }, { 0x2D, 0x02, 0x0A14 }, { 0x2D, 0x02, 0x0A14 }, + { SCENE_00KEIKOKU, 2, 0xCA14 }, { -SCENE_00KEIKOKU, 2, 0x0A14 }, { -SCENE_00KEIKOKU, 2, 0x0A14 }, + { -SCENE_00KEIKOKU, 2, 0x058B }, { SCENE_00KEIKOKU, 2, 0x0A14 }, { SCENE_00KEIKOKU, 2, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance3[] = { - { 0x2D, 0x03, 0xCA14 }, { 0xD3, 0x03, 0x0A14 }, { 0xD3, 0x03, 0x0A14 }, - { 0xD3, 0x03, 0x058B }, { 0x2D, 0x03, 0x0A14 }, { 0x2D, 0x03, 0x0A14 }, + { SCENE_00KEIKOKU, 3, 0xCA14 }, { -SCENE_00KEIKOKU, 3, 0x0A14 }, { -SCENE_00KEIKOKU, 3, 0x0A14 }, + { -SCENE_00KEIKOKU, 3, 0x058B }, { SCENE_00KEIKOKU, 3, 0x0A14 }, { SCENE_00KEIKOKU, 3, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance4[] = { - { 0x2D, 0x04, 0xCA14 }, { 0xD3, 0x04, 0x0A14 }, { 0xD3, 0x04, 0x0A14 }, - { 0xD3, 0x04, 0x058B }, { 0x2D, 0x04, 0x0A14 }, { 0x2D, 0x04, 0x0A14 }, + { SCENE_00KEIKOKU, 4, 0xCA14 }, { -SCENE_00KEIKOKU, 4, 0x0A14 }, { -SCENE_00KEIKOKU, 4, 0x0A14 }, + { -SCENE_00KEIKOKU, 4, 0x058B }, { SCENE_00KEIKOKU, 4, 0x0A14 }, { SCENE_00KEIKOKU, 4, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance5[] = { - { 0x2D, 0x05, 0xCA14 }, { 0xD3, 0x05, 0x0A14 }, { 0xD3, 0x05, 0x0A14 }, - { 0xD3, 0x05, 0x858B }, { 0x2D, 0x05, 0x0A14 }, { 0x2D, 0x05, 0x0A14 }, + { SCENE_00KEIKOKU, 5, 0xCA14 }, { -SCENE_00KEIKOKU, 5, 0x0A14 }, { -SCENE_00KEIKOKU, 5, 0x0A14 }, + { -SCENE_00KEIKOKU, 5, 0x858B }, { SCENE_00KEIKOKU, 5, 0x0A14 }, { SCENE_00KEIKOKU, 5, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance6[] = { - { 0x2D, 0x06, 0x4102 }, { 0xD3, 0x06, 0x0A14 }, { 0xD3, 0x06, 0x0A14 }, - { 0xD3, 0x06, 0x858B }, { 0x2D, 0x06, 0x0A14 }, { 0x2D, 0x06, 0x0A14 }, + { SCENE_00KEIKOKU, 6, 0x4102 }, { -SCENE_00KEIKOKU, 6, 0x0A14 }, { -SCENE_00KEIKOKU, 6, 0x0A14 }, + { -SCENE_00KEIKOKU, 6, 0x858B }, { SCENE_00KEIKOKU, 6, 0x0A14 }, { SCENE_00KEIKOKU, 6, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance7[] = { - { 0x2D, 0x07, 0x4102 }, { 0xD3, 0x07, 0x0A14 }, { 0xD3, 0x07, 0x0A14 }, - { 0xD3, 0x07, 0x858B }, { 0x2D, 0x07, 0x0A14 }, { 0x2D, 0x07, 0x0A14 }, + { SCENE_00KEIKOKU, 7, 0x4102 }, { -SCENE_00KEIKOKU, 7, 0x0A14 }, { -SCENE_00KEIKOKU, 7, 0x0A14 }, + { -SCENE_00KEIKOKU, 7, 0x858B }, { SCENE_00KEIKOKU, 7, 0x0A14 }, { SCENE_00KEIKOKU, 7, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance8[] = { - { 0x2D, 0x08, 0x4102 }, { 0xD3, 0x08, 0x0A14 }, { 0xD3, 0x08, 0x0A14 }, - { 0xD3, 0x08, 0x058B }, { 0x2D, 0x08, 0x0A14 }, { 0x2D, 0x08, 0x0A14 }, + { SCENE_00KEIKOKU, 8, 0x4102 }, { -SCENE_00KEIKOKU, 8, 0x0A14 }, { -SCENE_00KEIKOKU, 8, 0x0A14 }, + { -SCENE_00KEIKOKU, 8, 0x058B }, { SCENE_00KEIKOKU, 8, 0x0A14 }, { SCENE_00KEIKOKU, 8, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance9[] = { - { 0x2D, 0x09, 0x4102 }, { 0xD3, 0x09, 0x0A14 }, { 0xD3, 0x09, 0x0A14 }, - { 0xD3, 0x09, 0x058B }, { 0x2D, 0x09, 0x0A14 }, { 0x2D, 0x09, 0x0A14 }, + { SCENE_00KEIKOKU, 9, 0x4102 }, { -SCENE_00KEIKOKU, 9, 0x0A14 }, { -SCENE_00KEIKOKU, 9, 0x0A14 }, + { -SCENE_00KEIKOKU, 9, 0x058B }, { SCENE_00KEIKOKU, 9, 0x0A14 }, { SCENE_00KEIKOKU, 9, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance10[] = { - { 0x2D, 0x0A, 0x8A95 }, { 0xD3, 0x0A, 0x0A14 }, { 0xD3, 0x0A, 0x0A14 }, - { 0xD3, 0x0A, 0x058B }, { 0x2D, 0x0A, 0x0A14 }, { 0x2D, 0x0A, 0x0A95 }, + { SCENE_00KEIKOKU, 10, 0x8A95 }, { -SCENE_00KEIKOKU, 10, 0x0A14 }, { -SCENE_00KEIKOKU, 10, 0x0A14 }, + { -SCENE_00KEIKOKU, 10, 0x058B }, { SCENE_00KEIKOKU, 10, 0x0A14 }, { SCENE_00KEIKOKU, 10, 0x0A95 }, }; static EntranceTableEntry sTerminaFieldEntrance11[] = { - { 0x2D, 0x0B, 0x4A14 }, { 0xD3, 0x0B, 0x0A14 }, { 0xD3, 0x0B, 0x0A14 }, - { 0xD3, 0x0B, 0x058B }, { 0x2D, 0x0B, 0x0A14 }, { 0x2D, 0x0B, 0x0A14 }, + { SCENE_00KEIKOKU, 11, 0x4A14 }, { -SCENE_00KEIKOKU, 11, 0x0A14 }, { -SCENE_00KEIKOKU, 11, 0x0A14 }, + { -SCENE_00KEIKOKU, 11, 0x058B }, { SCENE_00KEIKOKU, 11, 0x0A14 }, { SCENE_00KEIKOKU, 11, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance12[] = { - { 0x2D, 0x0C, 0x0A14 }, { 0xD3, 0x0C, 0x0A14 }, { 0xD3, 0x0C, 0x0A14 }, - { 0xD3, 0x0C, 0x058B }, { 0x2D, 0x0C, 0x0A14 }, { 0x2D, 0x0C, 0x0A14 }, + { SCENE_00KEIKOKU, 12, 0x0A14 }, { -SCENE_00KEIKOKU, 12, 0x0A14 }, { -SCENE_00KEIKOKU, 12, 0x0A14 }, + { -SCENE_00KEIKOKU, 12, 0x058B }, { SCENE_00KEIKOKU, 12, 0x0A14 }, { SCENE_00KEIKOKU, 12, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance13[] = { - { 0x2D, 0x0D, 0x0A14 }, { 0xD3, 0x0D, 0x0A14 }, { 0xD3, 0x0D, 0x0A14 }, - { 0xD3, 0x0D, 0x058B }, { 0x2D, 0x0D, 0x0A14 }, { 0x2D, 0x0D, 0x0A14 }, + { SCENE_00KEIKOKU, 13, 0x0A14 }, { -SCENE_00KEIKOKU, 13, 0x0A14 }, { -SCENE_00KEIKOKU, 13, 0x0A14 }, + { -SCENE_00KEIKOKU, 13, 0x058B }, { SCENE_00KEIKOKU, 13, 0x0A14 }, { SCENE_00KEIKOKU, 13, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance14[] = { - { 0x2D, 0x0E, 0x858B }, + { SCENE_00KEIKOKU, 14, 0x858B }, }; static EntranceTableEntry* sTerminaFieldEntranceTable[] = { @@ -1026,7 +1028,7 @@ static EntranceTableEntry* sTerminaFieldEntranceTable[] = { }; static EntranceTableEntry sPostOfficeEntrance0[] = { - { 0x2E, 0x00, 0x4102 }, + { SCENE_POSTHOUSE, 0, 0x4102 }, }; static EntranceTableEntry* sPostOfficeEntranceTable[] = { @@ -1034,7 +1036,7 @@ static EntranceTableEntry* sPostOfficeEntranceTable[] = { }; static EntranceTableEntry sMarineResearchLabEntrance0[] = { - { 0x2F, 0x00, 0x4102 }, + { SCENE_LABO, 0, 0x4102 }, }; static EntranceTableEntry* sMarineResearchLabEntranceTable[] = { @@ -1042,11 +1044,11 @@ static EntranceTableEntry* sMarineResearchLabEntranceTable[] = { }; static EntranceTableEntry sDampesHouseEntrance0[] = { - { 0x30, 0x00, 0x4102 }, + { SCENE_DANPEI2TEST, 0, 0x4102 }, }; static EntranceTableEntry sDampesHouseEntrance1[] = { - { 0x30, 0x01, 0x0102 }, + { SCENE_DANPEI2TEST, 1, 0x0102 }, }; static EntranceTableEntry* sDampesHouseEntranceTable[] = { @@ -1055,23 +1057,23 @@ static EntranceTableEntry* sDampesHouseEntranceTable[] = { }; static EntranceTableEntry sGoronShrineEntrance0[] = { - { 0x32, 0x00, 0x4102 }, - { 0x32, 0x00, 0x4102 }, + { SCENE_16GORON_HOUSE, 0, 0x4102 }, + { SCENE_16GORON_HOUSE, 0, 0x4102 }, }; static EntranceTableEntry sGoronShrineEntrance1[] = { - { 0x32, 0x01, 0x0102 }, - { 0x32, 0x01, 0x0102 }, + { SCENE_16GORON_HOUSE, 1, 0x0102 }, + { SCENE_16GORON_HOUSE, 1, 0x0102 }, }; static EntranceTableEntry sGoronShrineEntrance2[] = { - { 0x32, 0x02, 0x058B }, - { 0x32, 0x02, 0x058B }, + { SCENE_16GORON_HOUSE, 2, 0x058B }, + { SCENE_16GORON_HOUSE, 2, 0x058B }, }; static EntranceTableEntry sGoronShrineEntrance3[] = { - { 0x32, 0x03, 0x0102 }, - { 0x32, 0x03, 0x0102 }, + { SCENE_16GORON_HOUSE, 3, 0x0102 }, + { SCENE_16GORON_HOUSE, 3, 0x0102 }, }; static EntranceTableEntry* sGoronShrineEntranceTable[] = { @@ -1082,40 +1084,40 @@ static EntranceTableEntry* sGoronShrineEntranceTable[] = { }; static EntranceTableEntry sZoraHallEntrance0[] = { - { 0x33, 0x00, 0x4993 }, - { 0x33, 0x00, 0x8102 }, + { SCENE_33ZORACITY, 0, 0x4993 }, + { SCENE_33ZORACITY, 0, 0x8102 }, }; static EntranceTableEntry sZoraHallEntrance1[] = { - { 0x33, 0x01, 0x4102 }, + { SCENE_33ZORACITY, 1, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance2[] = { - { 0x33, 0x02, 0x4102 }, + { SCENE_33ZORACITY, 2, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance3[] = { - { 0x33, 0x03, 0x4102 }, + { SCENE_33ZORACITY, 3, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance4[] = { - { 0x33, 0x04, 0x4102 }, + { SCENE_33ZORACITY, 4, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance5[] = { - { 0x33, 0x05, 0x4102 }, + { SCENE_33ZORACITY, 5, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance6[] = { - { 0x33, 0x06, 0x4102 }, + { SCENE_33ZORACITY, 6, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance7[] = { - { 0x33, 0x07, 0x058B }, + { SCENE_33ZORACITY, 7, 0x058B }, }; static EntranceTableEntry sZoraHallEntrance8[] = { - { 0x33, 0x08, 0x8183 }, + { SCENE_33ZORACITY, 8, 0x8183 }, }; static EntranceTableEntry* sZoraHallEntranceTable[] = { @@ -1124,11 +1126,11 @@ static EntranceTableEntry* sZoraHallEntranceTable[] = { }; static EntranceTableEntry sTradingPostEntrance0[] = { - { 0x34, 0x00, 0x4102 }, + { SCENE_8ITEMSHOP, 0, 0x4102 }, }; static EntranceTableEntry sTradingPostEntrance1[] = { - { 0x34, 0x01, 0x0102 }, + { SCENE_8ITEMSHOP, 1, 0x0102 }, }; static EntranceTableEntry* sTradingPostEntranceTable[] = { @@ -1137,52 +1139,52 @@ static EntranceTableEntry* sTradingPostEntranceTable[] = { }; static EntranceTableEntry sRomaniRanchEntrance0[] = { - { 0x35, 0x00, 0x4A14 }, { 0x35, 0x00, 0x0A14 }, { 0x35, 0x00, 0x8102 }, { 0x35, 0x00, 0x858B }, - { 0x35, 0x00, 0x858B }, { 0x35, 0x00, 0x0102 }, { 0x35, 0x00, 0x8102 }, + { SCENE_F01, 0, 0x4A14 }, { SCENE_F01, 0, 0x0A14 }, { SCENE_F01, 0, 0x8102 }, { SCENE_F01, 0, 0x858B }, + { SCENE_F01, 0, 0x858B }, { SCENE_F01, 0, 0x0102 }, { SCENE_F01, 0, 0x8102 }, }; static EntranceTableEntry sRomaniRanchEntrance1[] = { - { 0x35, 0x01, 0x0A14 }, + { SCENE_F01, 1, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance2[] = { - { 0x35, 0x02, 0x0102 }, + { SCENE_F01, 2, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance3[] = { - { 0x35, 0x03, 0x0102 }, + { SCENE_F01, 3, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance4[] = { - { 0x35, 0x04, 0x8102 }, + { SCENE_F01, 4, 0x8102 }, }; static EntranceTableEntry sRomaniRanchEntrance5[] = { - { 0x35, 0x05, 0x8102 }, + { SCENE_F01, 5, 0x8102 }, }; static EntranceTableEntry sRomaniRanchEntrance6[] = { - { 0x35, 0x06, 0x0A14 }, + { SCENE_F01, 6, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance7[] = { - { 0x35, 0x07, 0x0A14 }, + { SCENE_F01, 7, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance8[] = { - { 0x35, 0x08, 0x0A14 }, + { SCENE_F01, 8, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance9[] = { - { 0x35, 0x09, 0x0102 }, + { SCENE_F01, 9, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance10[] = { - { 0x35, 0x0A, 0x0102 }, + { SCENE_F01, 10, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance11[] = { - { 0x35, 0x0B, 0x0102 }, + { SCENE_F01, 11, 0x0102 }, }; static EntranceTableEntry* sRomaniRanchEntranceTable[] = { @@ -1192,23 +1194,23 @@ static EntranceTableEntry* sRomaniRanchEntranceTable[] = { }; static EntranceTableEntry sTwinmoldsLairEntrance0[] = { - { 0xCA, 0x00, 0x0102 }, + { -SCENE_INISIE_BS, 0, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance1[] = { - { 0xCA, 0x01, 0x0102 }, + { -SCENE_INISIE_BS, 1, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance2[] = { - { 0xCA, 0x02, 0x0102 }, + { -SCENE_INISIE_BS, 2, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance3[] = { - { 0xCA, 0x03, 0x0102 }, + { -SCENE_INISIE_BS, 3, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance4[] = { - { 0xCA, 0x04, 0x0102 }, + { -SCENE_INISIE_BS, 4, 0x0102 }, }; static EntranceTableEntry* sTwinmoldsLairEntranceTable[] = { @@ -1217,74 +1219,74 @@ static EntranceTableEntry* sTwinmoldsLairEntranceTable[] = { }; static EntranceTableEntry sGreatBayCoastEntrance0[] = { - { 0x37, 0x00, 0xCA14 }, - { 0x37, 0x00, 0xCA14 }, - { 0x37, 0x00, 0x8102 }, + { SCENE_30GYOSON, 0, 0xCA14 }, + { SCENE_30GYOSON, 0, 0xCA14 }, + { SCENE_30GYOSON, 0, 0x8102 }, }; static EntranceTableEntry sGreatBayCoastEntrance1[] = { - { 0x37, 0x01, 0xCA14 }, - { 0x37, 0x01, 0xCA14 }, + { SCENE_30GYOSON, 1, 0xCA14 }, + { SCENE_30GYOSON, 1, 0xCA14 }, }; static EntranceTableEntry sGreatBayCoastEntrance2[] = { - { 0x37, 0x02, 0x4993 }, - { 0x37, 0x02, 0x4993 }, + { SCENE_30GYOSON, 2, 0x4993 }, + { SCENE_30GYOSON, 2, 0x4993 }, }; static EntranceTableEntry sGreatBayCoastEntrance3[] = { - { 0x37, 0x03, 0x4A14 }, - { 0x37, 0x03, 0x4A14 }, + { SCENE_30GYOSON, 3, 0x4A14 }, + { SCENE_30GYOSON, 3, 0x4A14 }, }; static EntranceTableEntry sGreatBayCoastEntrance4[] = { - { 0x37, 0x04, 0x4102 }, - { 0x37, 0x04, 0x4102 }, + { SCENE_30GYOSON, 4, 0x4102 }, + { SCENE_30GYOSON, 4, 0x4102 }, }; static EntranceTableEntry sGreatBayCoastEntrance5[] = { - { 0x37, 0x05, 0x4993 }, - { 0x37, 0x05, 0x4993 }, + { SCENE_30GYOSON, 5, 0x4993 }, + { SCENE_30GYOSON, 5, 0x4993 }, }; static EntranceTableEntry sGreatBayCoastEntrance6[] = { - { 0x37, 0x06, 0x4993 }, - { 0x37, 0x06, 0x4993 }, + { SCENE_30GYOSON, 6, 0x4993 }, + { SCENE_30GYOSON, 6, 0x4993 }, }; static EntranceTableEntry sGreatBayCoastEntrance7[] = { - { 0x37, 0x07, 0x4102 }, - { 0x37, 0x07, 0x4102 }, + { SCENE_30GYOSON, 7, 0x4102 }, + { SCENE_30GYOSON, 7, 0x4102 }, }; static EntranceTableEntry sGreatBayCoastEntrance8[] = { - { 0x37, 0x08, 0x4102 }, - { 0x37, 0x08, 0x4102 }, + { SCENE_30GYOSON, 8, 0x4102 }, + { SCENE_30GYOSON, 8, 0x4102 }, }; static EntranceTableEntry sGreatBayCoastEntrance9[] = { - { 0x37, 0x09, 0x058B }, - { 0x37, 0x09, 0x058B }, + { SCENE_30GYOSON, 9, 0x058B }, + { SCENE_30GYOSON, 9, 0x058B }, }; static EntranceTableEntry sGreatBayCoastEntrance10[] = { - { 0x37, 0x0A, 0x858B }, - { 0x37, 0x0A, 0x858B }, + { SCENE_30GYOSON, 10, 0x858B }, + { SCENE_30GYOSON, 10, 0x858B }, }; static EntranceTableEntry sGreatBayCoastEntrance11[] = { - { 0x37, 0x0B, 0x0A14 }, - { 0x37, 0x0B, 0x0A14 }, + { SCENE_30GYOSON, 11, 0x0A14 }, + { SCENE_30GYOSON, 11, 0x0A14 }, }; static EntranceTableEntry sGreatBayCoastEntrance12[] = { - { 0x37, 0x0C, 0x0A14 }, - { 0x37, 0x0C, 0x0A14 }, + { SCENE_30GYOSON, 12, 0x0A14 }, + { SCENE_30GYOSON, 12, 0x0A14 }, }; static EntranceTableEntry sGreatBayCoastEntrance13[] = { - { 0x37, 0x0D, 0x0A14 }, - { 0x37, 0x0D, 0x0A14 }, + { SCENE_30GYOSON, 13, 0x0A14 }, + { SCENE_30GYOSON, 13, 0x0A14 }, }; static EntranceTableEntry* sGreatBayCoastEntranceTable[] = { @@ -1295,53 +1297,53 @@ static EntranceTableEntry* sGreatBayCoastEntranceTable[] = { }; static EntranceTableEntry sZoraCapeEntrance0[] = { - { 0x38, 0x00, 0x8A14 }, - { 0x38, 0x00, 0x8A14 }, + { SCENE_31MISAKI, 0, 0x8A14 }, + { SCENE_31MISAKI, 0, 0x8A14 }, }; static EntranceTableEntry sZoraCapeEntrance1[] = { - { 0x38, 0x01, 0x4993 }, - { 0x38, 0x01, 0x4993 }, + { SCENE_31MISAKI, 1, 0x4993 }, + { SCENE_31MISAKI, 1, 0x4993 }, }; static EntranceTableEntry sZoraCapeEntrance2[] = { - { 0x38, 0x02, 0x4102 }, - { 0x38, 0x02, 0x4102 }, + { SCENE_31MISAKI, 2, 0x4102 }, + { SCENE_31MISAKI, 2, 0x4102 }, }; static EntranceTableEntry sZoraCapeEntrance3[] = { - { 0x38, 0x03, 0x0993 }, - { 0x38, 0x03, 0x0993 }, + { SCENE_31MISAKI, 3, 0x0993 }, + { SCENE_31MISAKI, 3, 0x0993 }, }; static EntranceTableEntry sZoraCapeEntrance4[] = { - { 0x38, 0x04, 0x4102 }, - { 0x38, 0x04, 0x4102 }, + { SCENE_31MISAKI, 4, 0x4102 }, + { SCENE_31MISAKI, 4, 0x4102 }, }; static EntranceTableEntry sZoraCapeEntrance5[] = { - { 0x38, 0x05, 0x0102 }, - { 0x38, 0x05, 0x0102 }, + { SCENE_31MISAKI, 5, 0x0102 }, + { SCENE_31MISAKI, 5, 0x0102 }, }; static EntranceTableEntry sZoraCapeEntrance6[] = { - { 0x38, 0x06, 0x0A14 }, - { 0x38, 0x06, 0x0A14 }, + { SCENE_31MISAKI, 6, 0x0A14 }, + { SCENE_31MISAKI, 6, 0x0A14 }, }; static EntranceTableEntry sZoraCapeEntrance7[] = { - { 0x38, 0x07, 0x0A14 }, - { 0x38, 0x07, 0x0A14 }, + { SCENE_31MISAKI, 7, 0x0A14 }, + { SCENE_31MISAKI, 7, 0x0A14 }, }; static EntranceTableEntry sZoraCapeEntrance8[] = { - { 0x38, 0x08, 0x0A14 }, - { 0x38, 0x08, 0x0A14 }, + { SCENE_31MISAKI, 8, 0x0A14 }, + { SCENE_31MISAKI, 8, 0x0A14 }, }; static EntranceTableEntry sZoraCapeEntrance9[] = { - { 0x38, 0x09, 0x0A14 }, - { 0x38, 0x09, 0x0A14 }, + { SCENE_31MISAKI, 9, 0x0A14 }, + { SCENE_31MISAKI, 9, 0x0A14 }, }; static EntranceTableEntry* sZoraCapeEntranceTable[] = { @@ -1350,7 +1352,7 @@ static EntranceTableEntry* sZoraCapeEntranceTable[] = { }; static EntranceTableEntry sLotteryShopEntrance0[] = { - { 0x39, 0x00, 0x4102 }, + { SCENE_TAKARAKUJI, 0, 0x4102 }, }; static EntranceTableEntry* sLotteryShopEntranceTable[] = { @@ -1358,31 +1360,31 @@ static EntranceTableEntry* sLotteryShopEntranceTable[] = { }; static EntranceTableEntry sPiratesFortressExteriorEntrance0[] = { - { 0x3B, 0x00, 0x4993 }, + { SCENE_TORIDE, 0, 0x4993 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance1[] = { - { 0x3B, 0x01, 0x8102 }, + { SCENE_TORIDE, 1, 0x8102 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance2[] = { - { 0x3B, 0x02, 0x8993 }, + { SCENE_TORIDE, 2, 0x8993 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance3[] = { - { 0x3B, 0x03, 0x8993 }, + { SCENE_TORIDE, 3, 0x8993 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance4[] = { - { 0x3B, 0x04, 0x8102 }, + { SCENE_TORIDE, 4, 0x8102 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance5[] = { - { 0x3B, 0x05, 0x8102 }, + { SCENE_TORIDE, 5, 0x8102 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance6[] = { - { 0x3B, 0x06, 0x8102 }, + { SCENE_TORIDE, 6, 0x8102 }, }; static EntranceTableEntry* sPiratesFortressExteriorEntranceTable[] = { @@ -1392,7 +1394,7 @@ static EntranceTableEntry* sPiratesFortressExteriorEntranceTable[] = { }; static EntranceTableEntry sFishermansHutEntrance0[] = { - { 0x3C, 0x00, 0x4102 }, + { SCENE_FISHERMAN, 0, 0x4102 }, }; static EntranceTableEntry* sFishermansHutEntranceTable[] = { @@ -1400,7 +1402,7 @@ static EntranceTableEntry* sFishermansHutEntranceTable[] = { }; static EntranceTableEntry sGoronShopEntrance0[] = { - { 0x3D, 0x00, 0x4102 }, + { SCENE_GORONSHOP, 0, 0x4102 }, }; static EntranceTableEntry* sGoronShopEntranceTable[] = { @@ -1408,20 +1410,20 @@ static EntranceTableEntry* sGoronShopEntranceTable[] = { }; static EntranceTableEntry sDekuKingsChamberEntrance0[] = { - { 0xC2, 0x00, 0xC102 }, - { 0xC2, 0x00, 0x8102 }, + { -SCENE_DEKU_KING, 0, 0xC102 }, + { -SCENE_DEKU_KING, 0, 0x8102 }, }; static EntranceTableEntry sDekuKingsChamberEntrance1[] = { - { 0xC2, 0x01, 0xC102 }, + { -SCENE_DEKU_KING, 1, 0xC102 }, }; static EntranceTableEntry sDekuKingsChamberEntrance2[] = { - { 0xC2, 0x02, 0x858B }, + { -SCENE_DEKU_KING, 2, 0x858B }, }; static EntranceTableEntry sDekuKingsChamberEntrance3[] = { - { 0xC2, 0x03, 0x0102 }, + { -SCENE_DEKU_KING, 3, 0x0102 }, }; static EntranceTableEntry* sDekuKingsChamberEntranceTable[] = { @@ -1432,7 +1434,7 @@ static EntranceTableEntry* sDekuKingsChamberEntranceTable[] = { }; static EntranceTableEntry sMoonGoronTrialEntrance0[] = { - { 0xC1, 0x00, 0x0387 }, + { -SCENE_LAST_GORON, 0, 0x0387 }, }; static EntranceTableEntry* sMoonGoronTrialEntranceTable[] = { @@ -1440,15 +1442,15 @@ static EntranceTableEntry* sMoonGoronTrialEntranceTable[] = { }; static EntranceTableEntry sRoadToSouthernSwampEntrance0[] = { - { 0x40, 0x00, 0x8A14 }, + { SCENE_24KEMONOMITI, 0, 0x8A14 }, }; static EntranceTableEntry sRoadToSouthernSwampEntrance1[] = { - { 0x40, 0x01, 0x8A14 }, + { SCENE_24KEMONOMITI, 1, 0x8A14 }, }; static EntranceTableEntry sRoadToSouthernSwampEntrance2[] = { - { 0x40, 0x02, 0x0102 }, + { SCENE_24KEMONOMITI, 2, 0x0102 }, }; static EntranceTableEntry* sRoadToSouthernSwampEntranceTable[] = { @@ -1458,11 +1460,11 @@ static EntranceTableEntry* sRoadToSouthernSwampEntranceTable[] = { }; static EntranceTableEntry sDoggyRacetrackEntrance0[] = { - { 0x41, 0x00, 0xC102 }, + { SCENE_F01_B, 0, 0xC102 }, }; static EntranceTableEntry sDoggyRacetrackEntrance1[] = { - { 0x41, 0x01, 0x0A14 }, + { SCENE_F01_B, 1, 0x0A14 }, }; static EntranceTableEntry* sDoggyRacetrackEntranceTable[] = { @@ -1471,12 +1473,12 @@ static EntranceTableEntry* sDoggyRacetrackEntranceTable[] = { }; static EntranceTableEntry sCuccoShackEntrance0[] = { - { 0x42, 0x00, 0xC102 }, - { 0x42, 0x00, 0x8102 }, + { SCENE_F01C, 0, 0xC102 }, + { SCENE_F01C, 0, 0x8102 }, }; static EntranceTableEntry sCuccoShackEntrance1[] = { - { 0x42, 0x01, 0x0A14 }, + { SCENE_F01C, 1, 0x0A14 }, }; static EntranceTableEntry* sCuccoShackEntranceTable[] = { @@ -1485,28 +1487,28 @@ static EntranceTableEntry* sCuccoShackEntranceTable[] = { }; static EntranceTableEntry sIkanaGraveyardEntrance0[] = { - { 0x43, 0x00, 0x4A14 }, - { 0x43, 0x00, 0x8102 }, + { SCENE_BOTI, 0, 0x4A14 }, + { SCENE_BOTI, 0, 0x8102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance1[] = { - { 0x43, 0x01, 0x4102 }, + { SCENE_BOTI, 1, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance2[] = { - { 0x43, 0x02, 0x4102 }, + { SCENE_BOTI, 2, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance3[] = { - { 0x43, 0x03, 0x4102 }, + { SCENE_BOTI, 3, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance4[] = { - { 0x43, 0x04, 0x4102 }, + { SCENE_BOTI, 4, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance5[] = { - { 0x43, 0x05, 0x058B }, + { SCENE_BOTI, 5, 0x058B }, }; static EntranceTableEntry* sIkanaGraveyardEntranceTable[] = { @@ -1515,7 +1517,7 @@ static EntranceTableEntry* sIkanaGraveyardEntranceTable[] = { }; static EntranceTableEntry sGohtsLairEntrance0[] = { - { 0xBC, 0x00, 0x8102 }, + { -SCENE_HAKUGIN_BS, 0, 0x8102 }, }; static EntranceTableEntry* sGohtsLairEntranceTable[] = { @@ -1523,47 +1525,47 @@ static EntranceTableEntry* sGohtsLairEntranceTable[] = { }; static EntranceTableEntry sSouthernSwampPoisonedEntrance0[] = { - { 0x45, 0x00, 0xCA14 }, + { SCENE_20SICHITAI, 0, 0xCA14 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance1[] = { - { 0x45, 0x01, 0x4102 }, + { SCENE_20SICHITAI, 1, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance2[] = { - { 0x45, 0x02, 0xC102 }, + { SCENE_20SICHITAI, 2, 0xC102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance3[] = { - { 0x45, 0x03, 0x4102 }, + { SCENE_20SICHITAI, 3, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance4[] = { - { 0x45, 0x04, 0x4102 }, + { SCENE_20SICHITAI, 4, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance5[] = { - { 0x45, 0x05, 0x4102 }, + { SCENE_20SICHITAI, 5, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance6[] = { - { 0x45, 0x06, 0x0102 }, + { SCENE_20SICHITAI, 6, 0x0102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance7[] = { - { 0x45, 0x07, 0x4102 }, + { SCENE_20SICHITAI, 7, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance8[] = { - { 0x45, 0x08, 0x4102 }, + { SCENE_20SICHITAI, 8, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance9[] = { - { 0x45, 0x09, 0x4A14 }, + { SCENE_20SICHITAI, 9, 0x4A14 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance10[] = { - { 0x45, 0x0A, 0x4A14 }, + { SCENE_20SICHITAI, 10, 0x4A14 }, }; static EntranceTableEntry* sSouthernSwampPoisonedEntranceTable[] = { @@ -1574,33 +1576,33 @@ static EntranceTableEntry* sSouthernSwampPoisonedEntranceTable[] = { }; static EntranceTableEntry sWoodfallEntrance0[] = { - { 0x46, 0x00, 0xC102 }, - { 0x46, 0x00, 0x0183 }, - { 0x46, 0x00, 0xC102 }, + { SCENE_21MITURINMAE, 0, 0xC102 }, + { SCENE_21MITURINMAE, 0, 0x0183 }, + { SCENE_21MITURINMAE, 0, 0xC102 }, }; static EntranceTableEntry sWoodfallEntrance1[] = { - { 0x46, 0x01, 0x4102 }, - { 0x46, 0x01, 0x0183 }, - { 0x46, 0x01, 0x4102 }, + { SCENE_21MITURINMAE, 1, 0x4102 }, + { SCENE_21MITURINMAE, 1, 0x0183 }, + { SCENE_21MITURINMAE, 1, 0x4102 }, }; static EntranceTableEntry sWoodfallEntrance2[] = { - { 0x46, 0x02, 0x4102 }, - { 0x46, 0x02, 0x0183 }, - { 0x46, 0x02, 0x4102 }, + { SCENE_21MITURINMAE, 2, 0x4102 }, + { SCENE_21MITURINMAE, 2, 0x0183 }, + { SCENE_21MITURINMAE, 2, 0x4102 }, }; static EntranceTableEntry sWoodfallEntrance3[] = { - { 0x46, 0x03, 0x4102 }, - { 0x46, 0x03, 0x0183 }, - { 0x46, 0x03, 0x4102 }, + { SCENE_21MITURINMAE, 3, 0x4102 }, + { SCENE_21MITURINMAE, 3, 0x0183 }, + { SCENE_21MITURINMAE, 3, 0x4102 }, }; static EntranceTableEntry sWoodfallEntrance4[] = { - { 0x46, 0x04, 0x4102 }, - { 0x46, 0x04, 0x0183 }, - { 0x46, 0x04, 0x4102 }, + { SCENE_21MITURINMAE, 4, 0x4102 }, + { SCENE_21MITURINMAE, 4, 0x0183 }, + { SCENE_21MITURINMAE, 4, 0x4102 }, }; static EntranceTableEntry* sWoodfallEntranceTable[] = { @@ -1608,11 +1610,11 @@ static EntranceTableEntry* sWoodfallEntranceTable[] = { }; static EntranceTableEntry sMoonZoraTrialEntrance0[] = { - { 0xB9, 0x00, 0x0387 }, + { -SCENE_LAST_ZORA, 0, 0x0387 }, }; static EntranceTableEntry sMoonZoraTrialEntrance1[] = { - { 0xB9, 0x01, 0x0102 }, + { -SCENE_LAST_ZORA, 1, 0x0102 }, }; static EntranceTableEntry* sMoonZoraTrialEntranceTable[] = { @@ -1621,24 +1623,24 @@ static EntranceTableEntry* sMoonZoraTrialEntranceTable[] = { }; static EntranceTableEntry sGoronVillageSpringEntrance0[] = { - { 0x48, 0x00, 0xC102 }, - { 0x48, 0x00, 0x8102 }, + { SCENE_11GORONNOSATO2, 0, 0xC102 }, + { SCENE_11GORONNOSATO2, 0, 0x8102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance1[] = { - { 0x48, 0x01, 0x4102 }, + { SCENE_11GORONNOSATO2, 1, 0x4102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance2[] = { - { 0x48, 0x02, 0x4102 }, + { SCENE_11GORONNOSATO2, 2, 0x4102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance3[] = { - { 0x48, 0x03, 0x4102 }, + { SCENE_11GORONNOSATO2, 3, 0x4102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance4[] = { - { 0x48, 0x04, 0x0A14 }, + { SCENE_11GORONNOSATO2, 4, 0x0A14 }, }; static EntranceTableEntry* sGoronVillageSpringEntranceTable[] = { @@ -1647,15 +1649,15 @@ static EntranceTableEntry* sGoronVillageSpringEntranceTable[] = { }; static EntranceTableEntry sGreatBayTempleEntrance0[] = { - { 0xB7, 0x00, 0x4102 }, + { -SCENE_SEA, 0, 0x4102 }, }; static EntranceTableEntry sGreatBayTempleEntrance1[] = { - { 0xB7, 0x01, 0x0102 }, + { -SCENE_SEA, 1, 0x0102 }, }; static EntranceTableEntry sGreatBayTempleEntrance2[] = { - { 0xB7, 0x02, 0x0102 }, + { -SCENE_SEA, 2, 0x0102 }, }; static EntranceTableEntry* sGreatBayTempleEntranceTable[] = { @@ -1665,19 +1667,19 @@ static EntranceTableEntry* sGreatBayTempleEntranceTable[] = { }; static EntranceTableEntry sWaterfallRapidsEntrance0[] = { - { 0x4A, 0x00, 0x4102 }, + { SCENE_35TAKI, 0, 0x4102 }, }; static EntranceTableEntry sWaterfallRapidsEntrance1[] = { - { 0x4A, 0x01, 0x0A14 }, + { SCENE_35TAKI, 1, 0x0A14 }, }; static EntranceTableEntry sWaterfallRapidsEntrance2[] = { - { 0x4A, 0x02, 0x0A14 }, + { SCENE_35TAKI, 2, 0x0A14 }, }; static EntranceTableEntry sWaterfallRapidsEntrance3[] = { - { 0x4A, 0x03, 0x0A14 }, + { SCENE_35TAKI, 3, 0x0A14 }, }; static EntranceTableEntry* sWaterfallRapidsEntranceTable[] = { @@ -1688,11 +1690,11 @@ static EntranceTableEntry* sWaterfallRapidsEntranceTable[] = { }; static EntranceTableEntry sBeneathTheWellEntrance0[] = { - { 0xB5, 0x00, 0x4102 }, + { -SCENE_REDEAD, 0, 0x4102 }, }; static EntranceTableEntry sBeneathTheWellEntrance1[] = { - { 0xB5, 0x01, 0x4102 }, + { -SCENE_REDEAD, 1, 0x4102 }, }; static EntranceTableEntry* sBeneathTheWellEntranceTable[] = { @@ -1701,31 +1703,31 @@ static EntranceTableEntry* sBeneathTheWellEntranceTable[] = { }; static EntranceTableEntry sZoraHallRoomsEntrance0[] = { - { 0x4C, 0x00, 0x0102 }, + { SCENE_BANDROOM, 0, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance1[] = { - { 0x4C, 0x01, 0x0102 }, + { SCENE_BANDROOM, 1, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance2[] = { - { 0x4C, 0x02, 0x0102 }, + { SCENE_BANDROOM, 2, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance3[] = { - { 0x4C, 0x03, 0x0102 }, + { SCENE_BANDROOM, 3, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance4[] = { - { 0x4C, 0x04, 0x858B }, + { SCENE_BANDROOM, 4, 0x858B }, }; static EntranceTableEntry sZoraHallRoomsEntrance5[] = { - { 0x4C, 0x05, 0x0102 }, + { SCENE_BANDROOM, 5, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance6[] = { - { 0x4C, 0x06, 0x0102 }, + { SCENE_BANDROOM, 6, 0x0102 }, }; static EntranceTableEntry* sZoraHallRoomsEntranceTable[] = { @@ -1734,23 +1736,23 @@ static EntranceTableEntry* sZoraHallRoomsEntranceTable[] = { }; static EntranceTableEntry sGoronVillageWinterEntrance0[] = { - { 0x4D, 0x00, 0xC102 }, + { SCENE_11GORONNOSATO, 0, 0xC102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance1[] = { - { 0x4D, 0x01, 0x4102 }, + { SCENE_11GORONNOSATO, 1, 0x4102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance2[] = { - { 0x4D, 0x02, 0x4102 }, + { SCENE_11GORONNOSATO, 2, 0x4102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance3[] = { - { 0x4D, 0x03, 0x4102 }, + { SCENE_11GORONNOSATO, 3, 0x4102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance4[] = { - { 0x4D, 0x04, 0x0A14 }, + { SCENE_11GORONNOSATO, 4, 0x0A14 }, }; static EntranceTableEntry* sGoronVillageWinterEntranceTable[] = { @@ -1759,11 +1761,11 @@ static EntranceTableEntry* sGoronVillageWinterEntranceTable[] = { }; static EntranceTableEntry sGoronGraveryardEntrance0[] = { - { 0x4E, 0x00, 0x4102 }, + { SCENE_GORON_HAKA, 0, 0x4102 }, }; static EntranceTableEntry sGoronGraveryardEntrance1[] = { - { 0x4E, 0x01, 0x058B }, + { SCENE_GORON_HAKA, 1, 0x058B }, }; static EntranceTableEntry* sGoronGraveryardEntranceTable[] = { @@ -1772,7 +1774,7 @@ static EntranceTableEntry* sGoronGraveryardEntranceTable[] = { }; static EntranceTableEntry sSakonsHideoutEntrance0[] = { - { 0x4F, 0x00, 0x4102 }, + { SCENE_SECOM, 0, 0x4102 }, }; static EntranceTableEntry* sSakonsHideoutEntranceTable[] = { @@ -1780,39 +1782,39 @@ static EntranceTableEntry* sSakonsHideoutEntranceTable[] = { }; static EntranceTableEntry sMountainVillageWinterEntrance0[] = { - { 0x50, 0x00, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 0, 0x4A14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance1[] = { - { 0x50, 0x01, 0x4102 }, + { SCENE_10YUKIYAMANOMURA, 1, 0x4102 }, }; static EntranceTableEntry sMountainVillageWinterEntrance2[] = { - { 0x50, 0x02, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA, 2, 0xCA14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance3[] = { - { 0x50, 0x03, 0x4102 }, + { SCENE_10YUKIYAMANOMURA, 3, 0x4102 }, }; static EntranceTableEntry sMountainVillageWinterEntrance4[] = { - { 0x50, 0x04, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA, 4, 0xCA14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance5[] = { - { 0x50, 0x05, 0x4102 }, + { SCENE_10YUKIYAMANOMURA, 5, 0x4102 }, }; static EntranceTableEntry sMountainVillageWinterEntrance6[] = { - { 0x50, 0x06, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 6, 0x4A14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance7[] = { - { 0x50, 0x07, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 7, 0x4A14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance8[] = { - { 0x50, 0x08, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 8, 0x4A14 }, }; static EntranceTableEntry* sMountainVillageWinterEntranceTable[] = { @@ -1822,15 +1824,15 @@ static EntranceTableEntry* sMountainVillageWinterEntranceTable[] = { }; static EntranceTableEntry sGhostHutEntrance0[] = { - { 0x51, 0x00, 0x4102 }, + { SCENE_TOUGITES, 0, 0x4102 }, }; static EntranceTableEntry sGhostHutEntrance1[] = { - { 0x51, 0x01, 0x0102 }, + { SCENE_TOUGITES, 1, 0x0102 }, }; static EntranceTableEntry sGhostHutEntrance2[] = { - { 0x51, 0x02, 0x0102 }, + { SCENE_TOUGITES, 2, 0x0102 }, }; static EntranceTableEntry* sGhostHutEntranceTable[] = { @@ -1840,15 +1842,15 @@ static EntranceTableEntry* sGhostHutEntranceTable[] = { }; static EntranceTableEntry sDekuShrineEntrance0[] = { - { 0x52, 0x00, 0x4102 }, + { SCENE_DANPEI, 0, 0x4102 }, }; static EntranceTableEntry sDekuShrineEntrance1[] = { - { 0x52, 0x01, 0x0102 }, + { SCENE_DANPEI, 1, 0x0102 }, }; static EntranceTableEntry sDekuShrineEntrance2[] = { - { 0x52, 0x02, 0x0102 }, + { SCENE_DANPEI, 2, 0x0102 }, }; static EntranceTableEntry* sDekuShrineEntranceTable[] = { @@ -1858,15 +1860,15 @@ static EntranceTableEntry* sDekuShrineEntranceTable[] = { }; static EntranceTableEntry sRoadToIkanaEntrance0[] = { - { 0x53, 0x00, 0x8A14 }, + { SCENE_IKANAMAE, 0, 0x8A14 }, }; static EntranceTableEntry sRoadToIkanaEntrance1[] = { - { 0x53, 0x01, 0x8A14 }, + { SCENE_IKANAMAE, 1, 0x8A14 }, }; static EntranceTableEntry sRoadToIkanaEntrance2[] = { - { 0x53, 0x02, 0x0A14 }, + { SCENE_IKANAMAE, 2, 0x0A14 }, }; static EntranceTableEntry* sRoadToIkanaEntranceTable[] = { @@ -1876,7 +1878,7 @@ static EntranceTableEntry* sRoadToIkanaEntranceTable[] = { }; static EntranceTableEntry sMusicBoxHouseEntrance0[] = { - { 0x55, 0x00, 0x4102 }, + { SCENE_MUSICHOUSE, 0, 0x4102 }, }; static EntranceTableEntry* sMusicBoxHouseEntranceTable[] = { @@ -1884,8 +1886,8 @@ static EntranceTableEntry* sMusicBoxHouseEntranceTable[] = { }; static EntranceTableEntry sIgosDuIkanasLairEntrance0[] = { - { 0xAA, 0x00, 0x8102 }, - { 0xAA, 0x00, 0x8102 }, + { -SCENE_IKNINSIDE, 0, 0x8102 }, + { -SCENE_IKNINSIDE, 0, 0x8102 }, }; static EntranceTableEntry* sIgosDuIkanasLairEntranceTable[] = { @@ -1893,7 +1895,7 @@ static EntranceTableEntry* sIgosDuIkanasLairEntranceTable[] = { }; static EntranceTableEntry sSwordmansSchoolEntrance0[] = { - { 0x54, 0x00, 0x4102 }, + { SCENE_DOUJOU, 0, 0x4102 }, }; static EntranceTableEntry* sSwordmansSchoolEntranceTable[] = { @@ -1901,15 +1903,15 @@ static EntranceTableEntry* sSwordmansSchoolEntranceTable[] = { }; static EntranceTableEntry sTouristInformationEntrance0[] = { - { 0x57, 0x00, 0x4102 }, + { SCENE_MAP_SHOP, 0, 0x4102 }, }; static EntranceTableEntry sTouristInformationEntrance1[] = { - { 0x57, 0x01, 0x0102 }, + { SCENE_MAP_SHOP, 1, 0x0102 }, }; static EntranceTableEntry sTouristInformationEntrance2[] = { - { 0x57, 0x02, 0x0102 }, + { SCENE_MAP_SHOP, 2, 0x0102 }, }; static EntranceTableEntry* sTouristInformationEntranceTable[] = { @@ -1919,19 +1921,19 @@ static EntranceTableEntry* sTouristInformationEntranceTable[] = { }; static EntranceTableEntry sStoneTowerEntrance0[] = { - { 0x58, 0x00, 0x4102 }, + { SCENE_F40, 0, 0x4102 }, }; static EntranceTableEntry sStoneTowerEntrance1[] = { - { 0x58, 0x01, 0xCA14 }, + { SCENE_F40, 1, 0xCA14 }, }; static EntranceTableEntry sStoneTowerEntrance2[] = { - { 0x58, 0x02, 0xC102 }, + { SCENE_F40, 2, 0xC102 }, }; static EntranceTableEntry sStoneTowerEntrance3[] = { - { 0x58, 0x03, 0x4A14 }, + { SCENE_F40, 3, 0x4A14 }, }; static EntranceTableEntry* sStoneTowerEntranceTable[] = { @@ -1942,11 +1944,11 @@ static EntranceTableEntry* sStoneTowerEntranceTable[] = { }; static EntranceTableEntry sStoneTowerInvertedEntrance0[] = { - { 0x59, 0x00, 0x4A14 }, + { SCENE_F41, 0, 0x4A14 }, }; static EntranceTableEntry sStoneTowerInvertedEntrance1[] = { - { 0x59, 0x01, 0xC102 }, + { SCENE_F41, 1, 0xC102 }, }; static EntranceTableEntry* sStoneTowerInvertedEntranceTable[] = { @@ -1955,40 +1957,40 @@ static EntranceTableEntry* sStoneTowerInvertedEntranceTable[] = { }; static EntranceTableEntry sMountainVillageSpringEntrance0[] = { - { 0x5A, 0x00, 0x4A14 }, - { 0x5A, 0x00, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA2, 0, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA2, 0, 0x4A14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance1[] = { - { 0x5A, 0x01, 0x4102 }, + { SCENE_10YUKIYAMANOMURA2, 1, 0x4102 }, }; static EntranceTableEntry sMountainVillageSpringEntrance2[] = { - { 0x5A, 0x02, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA2, 2, 0xCA14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance3[] = { - { 0x5A, 0x03, 0x4102 }, + { SCENE_10YUKIYAMANOMURA2, 3, 0x4102 }, }; static EntranceTableEntry sMountainVillageSpringEntrance4[] = { - { 0x5A, 0x04, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA2, 4, 0xCA14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance5[] = { - { 0x5A, 0x05, 0x4102 }, + { SCENE_10YUKIYAMANOMURA2, 5, 0x4102 }, }; static EntranceTableEntry sMountainVillageSpringEntrance6[] = { - { 0x5A, 0x06, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA2, 6, 0xCA14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance7[] = { - { 0x5A, 0x07, 0x458B }, + { SCENE_10YUKIYAMANOMURA2, 7, 0x458B }, }; static EntranceTableEntry sMountainVillageSpringEntrance8[] = { - { 0x5A, 0x08, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA2, 8, 0x4A14 }, }; static EntranceTableEntry* sMountainVillageSpringEntranceTable[] = { @@ -1998,13 +2000,13 @@ static EntranceTableEntry* sMountainVillageSpringEntranceTable[] = { }; static EntranceTableEntry sPathToSnowheadEntrance0[] = { - { 0x5B, 0x00, 0xCA14 }, - { 0x5B, 0x00, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 0, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 0, 0xCA14 }, }; static EntranceTableEntry sPathToSnowheadEntrance1[] = { - { 0x5B, 0x01, 0xCA14 }, - { 0x5B, 0x01, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 1, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 1, 0xCA14 }, }; static EntranceTableEntry* sPathToSnowheadEntranceTable[] = { @@ -2013,23 +2015,23 @@ static EntranceTableEntry* sPathToSnowheadEntranceTable[] = { }; static EntranceTableEntry sSnowheadEntrance0[] = { - { 0x5C, 0x00, 0xCA14 }, - { 0x5C, 0x00, 0xCA14 }, + { SCENE_12HAKUGINMAE, 0, 0xCA14 }, + { SCENE_12HAKUGINMAE, 0, 0xCA14 }, }; static EntranceTableEntry sSnowheadEntrance1[] = { - { 0x5C, 0x01, 0x4102 }, - { 0x5C, 0x01, 0x4102 }, + { SCENE_12HAKUGINMAE, 1, 0x4102 }, + { SCENE_12HAKUGINMAE, 1, 0x4102 }, }; static EntranceTableEntry sSnowheadEntrance2[] = { - { 0x5C, 0x02, 0x4102 }, - { 0x5C, 0x02, 0x4102 }, + { SCENE_12HAKUGINMAE, 2, 0x4102 }, + { SCENE_12HAKUGINMAE, 2, 0x4102 }, }; static EntranceTableEntry sSnowheadEntrance3[] = { - { 0x5C, 0x03, 0x4102 }, - { 0x5C, 0x03, 0x4102 }, + { SCENE_12HAKUGINMAE, 3, 0x4102 }, + { SCENE_12HAKUGINMAE, 3, 0x4102 }, }; static EntranceTableEntry* sSnowheadEntranceTable[] = { @@ -2040,15 +2042,15 @@ static EntranceTableEntry* sSnowheadEntranceTable[] = { }; static EntranceTableEntry sPathToGoronVillageWinterEntrance0[] = { - { 0x5D, 0x00, 0x8A14 }, + { SCENE_17SETUGEN, 0, 0x8A14 }, }; static EntranceTableEntry sPathToGoronVillageWinterEntrance1[] = { - { 0x5D, 0x01, 0x8102 }, + { SCENE_17SETUGEN, 1, 0x8102 }, }; static EntranceTableEntry sPathToGoronVillageWinterEntrance2[] = { - { 0x5D, 0x02, 0x0102 }, + { SCENE_17SETUGEN, 2, 0x0102 }, }; static EntranceTableEntry* sPathToGoronVillageWinterEntranceTable[] = { @@ -2058,15 +2060,15 @@ static EntranceTableEntry* sPathToGoronVillageWinterEntranceTable[] = { }; static EntranceTableEntry sPathToGoronVillageSpringEntrance0[] = { - { 0x5E, 0x00, 0x8A14 }, + { SCENE_17SETUGEN2, 0, 0x8A14 }, }; static EntranceTableEntry sPathToGoronVillageSpringEntrance1[] = { - { 0x5E, 0x01, 0x8102 }, + { SCENE_17SETUGEN2, 1, 0x8102 }, }; static EntranceTableEntry sPathToGoronVillageSpringEntrance2[] = { - { 0x5E, 0x02, 0x0102 }, + { SCENE_17SETUGEN2, 2, 0x0102 }, }; static EntranceTableEntry* sPathToGoronVillageSpringEntranceTable[] = { @@ -2076,11 +2078,11 @@ static EntranceTableEntry* sPathToGoronVillageSpringEntranceTable[] = { }; static EntranceTableEntry sGyorgsLairEntrance0[] = { - { 0xA1, 0x00, 0x8102 }, + { -SCENE_SEA_BS, 0, 0x8102 }, }; static EntranceTableEntry sGyorgsLairEntrance1[] = { - { 0xA1, 0x01, 0x8102 }, + { -SCENE_SEA_BS, 1, 0x8102 }, }; static EntranceTableEntry* sGyorgsLairEntranceTable[] = { @@ -2089,7 +2091,7 @@ static EntranceTableEntry* sGyorgsLairEntranceTable[] = { }; static EntranceTableEntry sSecretShrineEntrance0[] = { - { 0xA0, 0x00, 0x4102 }, + { -SCENE_RANDOM, 0, 0x4102 }, }; static EntranceTableEntry* sSecretShrineEntranceTable[] = { @@ -2097,28 +2099,28 @@ static EntranceTableEntry* sSecretShrineEntranceTable[] = { }; static EntranceTableEntry sStockPotInnEntrance0[] = { - { 0x61, 0x00, 0x4102 }, - { 0x61, 0x00, 0x8102 }, + { SCENE_YADOYA, 0, 0x4102 }, + { SCENE_YADOYA, 0, 0x8102 }, }; static EntranceTableEntry sStockPotInnEntrance1[] = { - { 0x61, 0x01, 0x4102 }, + { SCENE_YADOYA, 1, 0x4102 }, }; static EntranceTableEntry sStockPotInnEntrance2[] = { - { 0x61, 0x02, 0x0102 }, + { SCENE_YADOYA, 2, 0x0102 }, }; static EntranceTableEntry sStockPotInnEntrance3[] = { - { 0x61, 0x03, 0x0102 }, + { SCENE_YADOYA, 3, 0x0102 }, }; static EntranceTableEntry sStockPotInnEntrance4[] = { - { 0x61, 0x04, 0x0102 }, + { SCENE_YADOYA, 4, 0x0102 }, }; static EntranceTableEntry sStockPotInnEntrance5[] = { - { 0x61, 0x05, 0x0102 }, + { SCENE_YADOYA, 5, 0x0102 }, }; static EntranceTableEntry* sStockPotInnEntranceTable[] = { @@ -2127,7 +2129,7 @@ static EntranceTableEntry* sStockPotInnEntranceTable[] = { }; static EntranceTableEntry sGreatBayCutsceneEntrance0[] = { - { 0x62, 0x00, 0x4102 }, + { SCENE_KONPEKI_ENT, 0, 0x4102 }, }; static EntranceTableEntry* sGreatBayCutsceneEntranceTable[] = { @@ -2135,31 +2137,31 @@ static EntranceTableEntry* sGreatBayCutsceneEntranceTable[] = { }; static EntranceTableEntry sClockTowerInteriorEntrance0[] = { - { 0x63, 0x00, 0x0102 }, + { SCENE_INSIDETOWER, 0, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance1[] = { - { 0x63, 0x01, 0x0102 }, + { SCENE_INSIDETOWER, 1, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance2[] = { - { 0x63, 0x02, 0x058B }, + { SCENE_INSIDETOWER, 2, 0x058B }, }; static EntranceTableEntry sClockTowerInteriorEntrance3[] = { - { 0x63, 0x03, 0x0102 }, + { SCENE_INSIDETOWER, 3, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance4[] = { - { 0x63, 0x04, 0x058B }, + { SCENE_INSIDETOWER, 4, 0x058B }, }; static EntranceTableEntry sClockTowerInteriorEntrance5[] = { - { 0x63, 0x05, 0x0102 }, + { SCENE_INSIDETOWER, 5, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance6[] = { - { 0x63, 0x06, 0x858B }, + { SCENE_INSIDETOWER, 6, 0x858B }, }; static EntranceTableEntry* sClockTowerInteriorEntranceTable[] = { @@ -2169,7 +2171,7 @@ static EntranceTableEntry* sClockTowerInteriorEntranceTable[] = { }; static EntranceTableEntry sWoodsOfMysteryEntrance0[] = { - { 0x64, 0x00, 0x4102 }, + { SCENE_26SARUNOMORI, 0, 0x4102 }, }; static EntranceTableEntry* sWoodsOfMysteryEntranceTable[] = { @@ -2177,24 +2179,24 @@ static EntranceTableEntry* sWoodsOfMysteryEntranceTable[] = { }; static EntranceTableEntry sLostWoodsEntrance0[] = { - { 0x9B, 0x00, 0x858B }, - { 0x9B, 0x00, 0x8183 }, - { 0x9B, 0x00, 0x858B }, - { 0x9B, 0x00, 0x8102 }, + { -SCENE_LOST_WOODS, 0, 0x858B }, + { -SCENE_LOST_WOODS, 0, 0x8183 }, + { -SCENE_LOST_WOODS, 0, 0x858B }, + { -SCENE_LOST_WOODS, 0, 0x8102 }, }; static EntranceTableEntry sLostWoodsEntrance1[] = { - { 0x9B, 0x01, 0x058B }, - { 0x9B, 0x01, 0x058B }, - { 0x9B, 0x01, 0x058B }, - { 0x9B, 0x01, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, }; static EntranceTableEntry sLostWoodsEntrance2[] = { - { 0x9B, 0x02, 0x058B }, - { 0x9B, 0x02, 0x058B }, - { 0x9B, 0x02, 0x058B }, - { 0x9B, 0x02, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, }; static EntranceTableEntry* sLostWoodsEntranceTable[] = { @@ -2204,7 +2206,7 @@ static EntranceTableEntry* sLostWoodsEntranceTable[] = { }; static EntranceTableEntry sMoonLinkTrialEntrance0[] = { - { 0x66, 0x00, 0x0387 }, + { SCENE_LAST_LINK, 0, 0x0387 }, }; static EntranceTableEntry* sMoonLinkTrialEntranceTable[] = { @@ -2212,7 +2214,7 @@ static EntranceTableEntry* sMoonLinkTrialEntranceTable[] = { }; static EntranceTableEntry sTheMoonEntrance0[] = { - { 0x67, 0x00, 0x0387 }, + { SCENE_SOUGEN, 0, 0x0387 }, }; static EntranceTableEntry* sTheMoonEntranceTable[] = { @@ -2220,11 +2222,11 @@ static EntranceTableEntry* sTheMoonEntranceTable[] = { }; static EntranceTableEntry sBombShopEntrance0[] = { - { 0x68, 0x00, 0x4102 }, + { SCENE_BOMYA, 0, 0x4102 }, }; static EntranceTableEntry sBombShopEntrance1[] = { - { 0x68, 0x01, 0x0102 }, + { SCENE_BOMYA, 1, 0x0102 }, }; static EntranceTableEntry* sBombShopEntranceTable[] = { @@ -2233,9 +2235,10 @@ static EntranceTableEntry* sBombShopEntranceTable[] = { }; static EntranceTableEntry sGiantsChamberEntrance0[] = { - { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, - { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, - { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, }; static EntranceTableEntry* sGiantsChamberEntranceTable[] = { @@ -2243,27 +2246,27 @@ static EntranceTableEntry* sGiantsChamberEntranceTable[] = { }; static EntranceTableEntry sGormanTrackEntrance0[] = { - { 0x6A, 0x00, 0x4A14 }, + { SCENE_KOEPONARACE, 0, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance1[] = { - { 0x6A, 0x01, 0x4A14 }, + { SCENE_KOEPONARACE, 1, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance2[] = { - { 0x6A, 0x02, 0x4A14 }, + { SCENE_KOEPONARACE, 2, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance3[] = { - { 0x6A, 0x03, 0x4A14 }, + { SCENE_KOEPONARACE, 3, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance4[] = { - { 0x6A, 0x04, 0x0102 }, + { SCENE_KOEPONARACE, 4, 0x0102 }, }; static EntranceTableEntry sGormanTrackEntrance5[] = { - { 0x6A, 0x05, 0x0A14 }, + { SCENE_KOEPONARACE, 5, 0x0A14 }, }; static EntranceTableEntry* sGormanTrackEntranceTable[] = { @@ -2272,18 +2275,18 @@ static EntranceTableEntry* sGormanTrackEntranceTable[] = { }; static EntranceTableEntry sGoronRacetrackEntrance0[] = { - { 0x6B, 0x00, 0x4102 }, - { 0x6B, 0x00, 0x4102 }, + { SCENE_GORONRACE, 0, 0x4102 }, + { SCENE_GORONRACE, 0, 0x4102 }, }; static EntranceTableEntry sGoronRacetrackEntrance1[] = { - { 0x6B, 0x01, 0x8A14 }, - { 0x6B, 0x01, 0x8A14 }, + { SCENE_GORONRACE, 1, 0x8A14 }, + { SCENE_GORONRACE, 1, 0x8A14 }, }; static EntranceTableEntry sGoronRacetrackEntrance2[] = { - { 0x6B, 0x02, 0x0A14 }, - { 0x6B, 0x02, 0x0A14 }, + { SCENE_GORONRACE, 2, 0x0A14 }, + { SCENE_GORONRACE, 2, 0x0A14 }, }; static EntranceTableEntry* sGoronRacetrackEntranceTable[] = { @@ -2293,57 +2296,57 @@ static EntranceTableEntry* sGoronRacetrackEntranceTable[] = { }; static EntranceTableEntry sEastClockTownEntrance0[] = { - { 0x6C, 0x00, 0x4102 }, - { 0x6C, 0x00, 0x8102 }, - { 0x6C, 0x00, 0x058B }, + { SCENE_TOWN, 0, 0x4102 }, + { SCENE_TOWN, 0, 0x8102 }, + { SCENE_TOWN, 0, 0x058B }, }; static EntranceTableEntry sEastClockTownEntrance1[] = { - { 0x6C, 0x01, 0xCA14 }, + { SCENE_TOWN, 1, 0xCA14 }, }; static EntranceTableEntry sEastClockTownEntrance2[] = { - { 0x6C, 0x02, 0x4102 }, + { SCENE_TOWN, 2, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance3[] = { - { 0x6C, 0x03, 0xC102 }, + { SCENE_TOWN, 3, 0xC102 }, }; static EntranceTableEntry sEastClockTownEntrance4[] = { - { 0x6C, 0x04, 0x4102 }, + { SCENE_TOWN, 4, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance5[] = { - { 0x6C, 0x05, 0xC102 }, + { SCENE_TOWN, 5, 0xC102 }, }; static EntranceTableEntry sEastClockTownEntrance6[] = { - { 0x6C, 0x06, 0x4102 }, + { SCENE_TOWN, 6, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance7[] = { - { 0x6C, 0x07, 0x4102 }, + { SCENE_TOWN, 7, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance8[] = { - { 0x6C, 0x08, 0x4102 }, + { SCENE_TOWN, 8, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance9[] = { - { 0x6C, 0x09, 0x4102 }, + { SCENE_TOWN, 9, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance10[] = { - { 0x6C, 0x0A, 0x4102 }, + { SCENE_TOWN, 10, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance11[] = { - { 0x6C, 0x0B, 0x4102 }, + { SCENE_TOWN, 11, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance12[] = { - { 0x6C, 0x0C, 0x4102 }, + { SCENE_TOWN, 12, 0x4102 }, }; static EntranceTableEntry* sEastClockTownEntranceTable[] = { @@ -2354,44 +2357,44 @@ static EntranceTableEntry* sEastClockTownEntranceTable[] = { }; static EntranceTableEntry sWestClockTownEntrance0[] = { - { 0x6D, 0x00, 0x4102 }, - { 0x6D, 0x00, 0x8102 }, + { SCENE_ICHIBA, 0, 0x4102 }, + { SCENE_ICHIBA, 0, 0x8102 }, }; static EntranceTableEntry sWestClockTownEntrance1[] = { - { 0x6D, 0x01, 0xC102 }, + { SCENE_ICHIBA, 1, 0xC102 }, }; static EntranceTableEntry sWestClockTownEntrance2[] = { - { 0x6D, 0x02, 0xCA14 }, + { SCENE_ICHIBA, 2, 0xCA14 }, }; static EntranceTableEntry sWestClockTownEntrance3[] = { - { 0x6D, 0x03, 0x4102 }, + { SCENE_ICHIBA, 3, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance4[] = { - { 0x6D, 0x04, 0x4102 }, + { SCENE_ICHIBA, 4, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance5[] = { - { 0x6D, 0x05, 0x4102 }, + { SCENE_ICHIBA, 5, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance6[] = { - { 0x6D, 0x06, 0x4102 }, + { SCENE_ICHIBA, 6, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance7[] = { - { 0x6D, 0x07, 0x4102 }, + { SCENE_ICHIBA, 7, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance8[] = { - { 0x6D, 0x08, 0x4102 }, + { SCENE_ICHIBA, 8, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance9[] = { - { 0x6D, 0x09, 0x4A14 }, + { SCENE_ICHIBA, 9, 0x4A14 }, }; static EntranceTableEntry* sWestClockTownEntranceTable[] = { @@ -2401,36 +2404,36 @@ static EntranceTableEntry* sWestClockTownEntranceTable[] = { }; static EntranceTableEntry sNorthClockTownEntrance0[] = { - { 0x6E, 0x00, 0x4102 }, - { 0x6E, 0x00, 0x458B }, + { SCENE_BACKTOWN, 0, 0x4102 }, + { SCENE_BACKTOWN, 0, 0x458B }, }; static EntranceTableEntry sNorthClockTownEntrance1[] = { - { 0x6E, 0x01, 0xC102 }, + { SCENE_BACKTOWN, 1, 0xC102 }, }; static EntranceTableEntry sNorthClockTownEntrance2[] = { - { 0x6E, 0x02, 0xC102 }, + { SCENE_BACKTOWN, 2, 0xC102 }, }; static EntranceTableEntry sNorthClockTownEntrance3[] = { - { 0x6E, 0x03, 0x4102 }, + { SCENE_BACKTOWN, 3, 0x4102 }, }; static EntranceTableEntry sNorthClockTownEntrance4[] = { - { 0x6E, 0x04, 0x4102 }, + { SCENE_BACKTOWN, 4, 0x4102 }, }; static EntranceTableEntry sNorthClockTownEntrance5[] = { - { 0x6E, 0x05, 0x8A14 }, + { SCENE_BACKTOWN, 5, 0x8A14 }, }; static EntranceTableEntry sNorthClockTownEntrance6[] = { - { 0x6E, 0x06, 0x8A14 }, + { SCENE_BACKTOWN, 6, 0x8A14 }, }; static EntranceTableEntry sNorthClockTownEntrance7[] = { - { 0x6E, 0x07, 0x8A14 }, + { SCENE_BACKTOWN, 7, 0x8A14 }, }; static EntranceTableEntry* sNorthClockTownEntranceTable[] = { @@ -2439,51 +2442,51 @@ static EntranceTableEntry* sNorthClockTownEntranceTable[] = { }; static EntranceTableEntry sSouthClockTownEntrance0[] = { - { 0x6F, 0x00, 0x4102 }, - { 0x6F, 0x00, 0x8102 }, - { 0x6F, 0x00, 0x0A14 }, - { 0x6F, 0x00, 0x0102 }, + { SCENE_CLOCKTOWER, 0, 0x4102 }, + { SCENE_CLOCKTOWER, 0, 0x8102 }, + { SCENE_CLOCKTOWER, 0, 0x0A14 }, + { SCENE_CLOCKTOWER, 0, 0x0102 }, }; static EntranceTableEntry sSouthClockTownEntrance1[] = { - { 0x6F, 0x01, 0x4102 }, - { 0x6F, 0x01, 0x8102 }, + { SCENE_CLOCKTOWER, 1, 0x4102 }, + { SCENE_CLOCKTOWER, 1, 0x8102 }, }; static EntranceTableEntry sSouthClockTownEntrance2[] = { - { 0x6F, 0x02, 0xC102 }, + { SCENE_CLOCKTOWER, 2, 0xC102 }, }; static EntranceTableEntry sSouthClockTownEntrance3[] = { - { 0x6F, 0x03, 0xCA14 }, + { SCENE_CLOCKTOWER, 3, 0xCA14 }, }; static EntranceTableEntry sSouthClockTownEntrance4[] = { - { 0x6F, 0x04, 0xC102 }, + { SCENE_CLOCKTOWER, 4, 0xC102 }, }; static EntranceTableEntry sSouthClockTownEntrance5[] = { - { 0x6F, 0x05, 0xC102 }, + { SCENE_CLOCKTOWER, 5, 0xC102 }, }; static EntranceTableEntry sSouthClockTownEntrance6[] = { - { 0x6F, 0x06, 0xCA14 }, + { SCENE_CLOCKTOWER, 6, 0xCA14 }, }; static EntranceTableEntry sSouthClockTownEntrance7[] = { - { 0x6F, 0x07, 0xCA14 }, + { SCENE_CLOCKTOWER, 7, 0xCA14 }, }; static EntranceTableEntry sSouthClockTownEntrance8[] = { - { 0x6F, 0x08, 0x4A14 }, + { SCENE_CLOCKTOWER, 8, 0x4A14 }, }; static EntranceTableEntry sSouthClockTownEntrance9[] = { - { 0x6F, 0x09, 0x4A14 }, + { SCENE_CLOCKTOWER, 9, 0x4A14 }, }; static EntranceTableEntry sSouthClockTownEntrance10[] = { - { 0x6F, 0x0A, 0x058B }, + { SCENE_CLOCKTOWER, 10, 0x058B }, }; static EntranceTableEntry* sSouthClockTownEntranceTable[] = { @@ -2493,15 +2496,15 @@ static EntranceTableEntry* sSouthClockTownEntranceTable[] = { }; static EntranceTableEntry sLaundryPoolEntrance0[] = { - { 0x70, 0x00, 0xCA14 }, + { SCENE_ALLEY, 0, 0xCA14 }, }; static EntranceTableEntry sLaundryPoolEntrance1[] = { - { 0x70, 0x01, 0x4A14 }, + { SCENE_ALLEY, 1, 0x4A14 }, }; static EntranceTableEntry sLaundryPoolEntrance2[] = { - { 0x70, 0x02, 0x4102 }, + { SCENE_ALLEY, 2, 0x4102 }, }; static EntranceTableEntry* sLaundryPoolEntranceTable[] = { @@ -2511,71 +2514,71 @@ static EntranceTableEntry* sLaundryPoolEntranceTable[] = { }; static EntranceTableEntry sGrottosEntrance0[] = { - { 0x07, 0x00, 0x0102 }, + { SCENE_KAKUSIANA, 0, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance1[] = { - { 0x07, 0x01, 0x0102 }, + { SCENE_KAKUSIANA, 1, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance2[] = { - { 0x07, 0x02, 0x0102 }, + { SCENE_KAKUSIANA, 2, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance3[] = { - { 0x07, 0x03, 0x0102 }, + { SCENE_KAKUSIANA, 3, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance4[] = { - { 0x07, 0x04, 0x0102 }, + { SCENE_KAKUSIANA, 4, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance5[] = { - { 0x07, 0x05, 0x0102 }, + { SCENE_KAKUSIANA, 5, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance6[] = { - { 0x07, 0x06, 0x0102 }, + { SCENE_KAKUSIANA, 6, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance7[] = { - { 0x07, 0x07, 0x0102 }, + { SCENE_KAKUSIANA, SCENE_KAKUSIANA, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance8[] = { - { 0x07, 0x08, 0x0102 }, + { SCENE_KAKUSIANA, 8, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance9[] = { - { 0x07, 0x09, 0x0102 }, + { SCENE_KAKUSIANA, 9, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance10[] = { - { 0x07, 0x0A, 0x0102 }, + { SCENE_KAKUSIANA, 10, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance11[] = { - { 0x07, 0x0B, 0x0102 }, + { SCENE_KAKUSIANA, 11, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance12[] = { - { 0x07, 0x0C, 0x0102 }, + { SCENE_KAKUSIANA, 12, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance13[] = { - { 0x07, 0x0D, 0x0102 }, + { SCENE_KAKUSIANA, 13, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance14[] = { - { 0x07, 0x0E, 0x0102 }, + { SCENE_KAKUSIANA, 14, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance15[] = { - { 0x07, 0x0F, 0x0102 }, + { SCENE_KAKUSIANA, 15, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance16[] = { - { 0x07, 0x10, 0x0102 }, + { SCENE_KAKUSIANA, 16, 0x0102 }, }; static EntranceTableEntry* sGrottosEntranceTable[] = { @@ -2586,63 +2589,73 @@ static EntranceTableEntry* sGrottosEntranceTable[] = { }; static EntranceTableEntry sCutsceneEntrance0[] = { - { 0xF8, 0x00, 0x0102 }, { 0xF8, 0x00, 0x0102 }, { 0xF8, 0x00, 0x8102 }, { 0xF8, 0x00, 0x0102 }, - { 0xF8, 0x00, 0x058B }, { 0xF8, 0x00, 0x058B }, { 0xF8, 0x00, 0x058B }, { 0xF8, 0x00, 0x058B }, - { 0xF8, 0x00, 0x0183 }, { 0xF8, 0x00, 0x0183 }, { 0xF8, 0x00, 0x8102 }, { 0xF8, 0x00, 0x0102 }, + { -SCENE_SPOT00, 0, 0x0102 }, { -SCENE_SPOT00, 0, 0x0102 }, { -SCENE_SPOT00, 0, 0x8102 }, + { -SCENE_SPOT00, 0, 0x0102 }, { -SCENE_SPOT00, 0, 0x058B }, { -SCENE_SPOT00, 0, 0x058B }, + { -SCENE_SPOT00, 0, 0x058B }, { -SCENE_SPOT00, 0, 0x058B }, { -SCENE_SPOT00, 0, 0x0183 }, + { -SCENE_SPOT00, 0, 0x0183 }, { -SCENE_SPOT00, 0, 0x8102 }, { -SCENE_SPOT00, 0, 0x0102 }, }; static EntranceTableEntry sCutsceneEntrance1[] = { - { 0xF8, 0x01, 0x0183 }, { 0xF8, 0x01, 0x0102 }, { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x0102 }, - { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x058B }, { 0xF8, 0x01, 0x058B }, { 0xF8, 0x01, 0x058B }, - { 0xF8, 0x01, 0x058B }, { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x0102 }, + { -SCENE_SPOT00, 1, 0x0183 }, { -SCENE_SPOT00, 1, 0x0102 }, { -SCENE_SPOT00, 1, 0x8102 }, + { -SCENE_SPOT00, 1, 0x0102 }, { -SCENE_SPOT00, 1, 0x8102 }, { -SCENE_SPOT00, 1, 0x058B }, + { -SCENE_SPOT00, 1, 0x058B }, { -SCENE_SPOT00, 1, 0x058B }, { -SCENE_SPOT00, 1, 0x058B }, + { -SCENE_SPOT00, 1, 0x8102 }, { -SCENE_SPOT00, 1, 0x8102 }, { -SCENE_SPOT00, 1, 0x0102 }, }; static EntranceTableEntry sCutsceneEntrance2[] = { - { 0xF8, 0x02, 0x0183 }, { 0xF8, 0x02, 0x0102 }, { 0xF8, 0x02, 0x8102 }, { 0xF8, 0x02, 0x0102 }, - { 0xF8, 0x02, 0x8102 }, { 0xF8, 0x02, 0x058B }, { 0xF8, 0x02, 0x058B }, { 0xF8, 0x02, 0x058B }, - { 0xF8, 0x02, 0x058B }, { 0xF8, 0x02, 0x858B }, { 0xF8, 0x02, 0x8102 }, + { -SCENE_SPOT00, 2, 0x0183 }, { -SCENE_SPOT00, 2, 0x0102 }, { -SCENE_SPOT00, 2, 0x8102 }, + { -SCENE_SPOT00, 2, 0x0102 }, { -SCENE_SPOT00, 2, 0x8102 }, { -SCENE_SPOT00, 2, 0x058B }, + { -SCENE_SPOT00, 2, 0x058B }, { -SCENE_SPOT00, 2, 0x058B }, { -SCENE_SPOT00, 2, 0x058B }, + { -SCENE_SPOT00, 2, 0x858B }, { -SCENE_SPOT00, 2, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance3[] = { - { 0xF8, 0x03, 0x0183 }, { 0xF8, 0x03, 0x0102 }, { 0xF8, 0x03, 0x8102 }, { 0xF8, 0x03, 0x0102 }, - { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, - { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x8102 }, + { -SCENE_SPOT00, 3, 0x0183 }, { -SCENE_SPOT00, 3, 0x0102 }, { -SCENE_SPOT00, 3, 0x8102 }, + { -SCENE_SPOT00, 3, 0x0102 }, { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x058B }, + { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x058B }, + { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance4[] = { - { 0xF8, 0x04, 0x0183 }, { 0xF8, 0x04, 0x0102 }, { 0xF8, 0x04, 0x8102 }, { 0xF8, 0x04, 0x0102 }, - { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, - { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x8102 }, + { -SCENE_SPOT00, 4, 0x0183 }, { -SCENE_SPOT00, 4, 0x0102 }, { -SCENE_SPOT00, 4, 0x8102 }, + { -SCENE_SPOT00, 4, 0x0102 }, { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x058B }, + { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x058B }, + { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance5[] = { - { 0xF8, 0x05, 0x0183 }, { 0xF8, 0x05, 0x0102 }, { 0xF8, 0x05, 0x8102 }, { 0xF8, 0x05, 0x0102 }, - { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x058B }, - { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x858B }, { 0xF8, 0x05, 0x8102 }, + { -SCENE_SPOT00, 5, 0x0183 }, { -SCENE_SPOT00, 5, 0x0102 }, { -SCENE_SPOT00, 5, 0x8102 }, + { -SCENE_SPOT00, 5, 0x0102 }, { -SCENE_SPOT00, 5, 0x058B }, { -SCENE_SPOT00, 5, 0x058B }, + { -SCENE_SPOT00, 5, 0x058B }, { -SCENE_SPOT00, 5, 0x058B }, { -SCENE_SPOT00, 5, 0x058B }, + { -SCENE_SPOT00, 5, 0x858B }, { -SCENE_SPOT00, 5, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance6[] = { - { 0xF8, 0x06, 0x0183 }, { 0xF8, 0x06, 0x0102 }, { 0xF8, 0x06, 0x8102 }, { 0xF8, 0x06, 0x0102 }, - { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x058B }, - { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x858B }, { 0xF8, 0x06, 0x8102 }, + { -SCENE_SPOT00, 6, 0x0183 }, { -SCENE_SPOT00, 6, 0x0102 }, { -SCENE_SPOT00, 6, 0x8102 }, + { -SCENE_SPOT00, 6, 0x0102 }, { -SCENE_SPOT00, 6, 0x058B }, { -SCENE_SPOT00, 6, 0x058B }, + { -SCENE_SPOT00, 6, 0x058B }, { -SCENE_SPOT00, 6, 0x058B }, { -SCENE_SPOT00, 6, 0x058B }, + { -SCENE_SPOT00, 6, 0x858B }, { -SCENE_SPOT00, 6, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance7[] = { - { 0xF8, 0x07, 0x0183 }, { 0xF8, 0x07, 0x0102 }, { 0xF8, 0x07, 0x8102 }, { 0xF8, 0x07, 0x0102 }, - { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x058B }, - { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x858B }, { 0xF8, 0x07, 0x8102 }, + { -SCENE_SPOT00, 7, 0x0183 }, { -SCENE_SPOT00, 7, 0x0102 }, { -SCENE_SPOT00, 7, 0x8102 }, + { -SCENE_SPOT00, 7, 0x0102 }, { -SCENE_SPOT00, 7, 0x058B }, { -SCENE_SPOT00, 7, 0x058B }, + { -SCENE_SPOT00, 7, 0x058B }, { -SCENE_SPOT00, 7, 0x058B }, { -SCENE_SPOT00, 7, 0x058B }, + { -SCENE_SPOT00, 7, 0x858B }, { -SCENE_SPOT00, 7, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance8[] = { - { 0xF8, 0x08, 0x0183 }, { 0xF8, 0x08, 0x0102 }, { 0xF8, 0x08, 0x8102 }, { 0xF8, 0x08, 0x0102 }, - { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x058B }, - { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x858B }, { 0xF8, 0x08, 0x8102 }, + { -SCENE_SPOT00, 8, 0x0183 }, { -SCENE_SPOT00, 8, 0x0102 }, { -SCENE_SPOT00, 8, 0x8102 }, + { -SCENE_SPOT00, 8, 0x0102 }, { -SCENE_SPOT00, 8, 0x058B }, { -SCENE_SPOT00, 8, 0x058B }, + { -SCENE_SPOT00, 8, 0x058B }, { -SCENE_SPOT00, 8, 0x058B }, { -SCENE_SPOT00, 8, 0x058B }, + { -SCENE_SPOT00, 8, 0x858B }, { -SCENE_SPOT00, 8, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance9[] = { - { 0xF8, 0x09, 0x0183 }, { 0xF8, 0x09, 0x0102 }, { 0xF8, 0x09, 0x8102 }, { 0xF8, 0x09, 0x0102 }, - { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x058B }, - { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x858B }, { 0xF8, 0x09, 0x8102 }, + { -SCENE_SPOT00, 9, 0x0183 }, { -SCENE_SPOT00, 9, 0x0102 }, { -SCENE_SPOT00, 9, 0x8102 }, + { -SCENE_SPOT00, 9, 0x0102 }, { -SCENE_SPOT00, 9, 0x058B }, { -SCENE_SPOT00, 9, 0x058B }, + { -SCENE_SPOT00, 9, 0x058B }, { -SCENE_SPOT00, 9, 0x058B }, { -SCENE_SPOT00, 9, 0x058B }, + { -SCENE_SPOT00, 9, 0x858B }, { -SCENE_SPOT00, 9, 0x8102 }, }; static EntranceTableEntry* sCutsceneEntranceTable[] = { @@ -2783,19 +2796,19 @@ EntranceTableEntry* Entrance_GetTableEntry(u16 entrance) { /** * Returns the scene index from a given entrance index. */ -s32 Entrance_GetSceneNum(u16 entrance) { +s32 Entrance_GetSceneId(u16 entrance) { EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); - return tableEntry->sceneNum; + return tableEntry->sceneId; } /** * Returns the absolute value scene index (since for some reason some of them are negative) from a given entrance index. */ -s32 Entrance_GetSceneNumAbsolute(u16 entrance) { +s32 Entrance_GetSceneIdAbsolute(u16 entrance) { EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); - return ABS_ALT(tableEntry->sceneNum); + return ABS_ALT(tableEntry->sceneId); } /** diff --git a/src/code/z_schedule.c b/src/code/z_schedule.c index cfc6293ba4..6a24926316 100644 --- a/src/code/z_schedule.c +++ b/src/code/z_schedule.c @@ -130,9 +130,9 @@ s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleOutput* output) s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInSceneS* cmd = (ScheduleCmdCheckNotInSceneS*)*script; - s16 scene = (cmd->sceneH << 8) | cmd->sceneL; + s16 sceneId = (cmd->sceneIdH << 8) | cmd->sceneIdL; - if (scene != play->sceneNum) { + if (sceneId != play->sceneId) { *script += cmd->offset; } @@ -141,9 +141,9 @@ s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleOutput* outp s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInSceneL* cmd = (ScheduleCmdCheckNotInSceneL*)*script; - s16 scene = (cmd->sceneH << 8) | cmd->sceneL; + s16 sceneId = (cmd->sceneIdH << 8) | cmd->sceneIdL; - if (scene != play->sceneNum) { + if (sceneId != play->sceneId) { *script = *script + (s16)((cmd->offsetH << 8) | cmd->offsetL); } diff --git a/src/code/z_snap.c b/src/code/z_snap.c index 7a234ca225..5d37e3eac7 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -21,7 +21,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) { gSaveContext.save.pictoFlags0 = 0; gSaveContext.save.pictoFlags1 = 0; - if (play->sceneNum == SCENE_20SICHITAI) { + if (play->sceneId == SCENE_20SICHITAI) { Snap_SetFlag(PICTOGRAPH_IN_SWAMP); } @@ -30,7 +30,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) { seen = 0; // Actors which must be pictographed in a specific scene - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_20SICHITAI: if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) { seen = PICTO_SEEN_IN_SCENE; diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index ed7945ec37..73b0a0af09 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -219,13 +219,13 @@ void Sram_ActivateOwl(u8 owlId) { void Sram_ClearHighscores(void) { gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF) | 0x130000; gSaveContext.save.unk_EE8 = (gSaveContext.save.unk_EE8 & 0xFFFF0000) | 0xA; - gSaveContext.save.horseBackBalloonHighScore = 6000; // 60 seconds + gSaveContext.save.horseBackBalloonHighScore = SECONDS_TO_TIMER(60); SET_TOWN_SHOOTING_GALLERY_HIGH_SCORE(39); SET_SWAMP_SHOOTING_GALLERY_HIGH_SCORE(10); - gSaveContext.save.dekuPlaygroundHighScores[0] = 7500; // 75 seconds - gSaveContext.save.dekuPlaygroundHighScores[1] = 7500; // 75 seconds - gSaveContext.save.dekuPlaygroundHighScores[2] = 7600; // 76 seconds + gSaveContext.save.dekuPlaygroundHighScores[0] = SECONDS_TO_TIMER(75); + gSaveContext.save.dekuPlaygroundHighScores[1] = SECONDS_TO_TIMER(75); + gSaveContext.save.dekuPlaygroundHighScores[2] = SECONDS_TO_TIMER(76); } /** @@ -248,7 +248,7 @@ void Sram_ClearFlagsAtDawnOfTheFirstDay(void) { * Used by Song of Time (when clicking "Yes") and (indirectly) by the "Dawn of the New Day" cutscene */ void Sram_SaveEndOfCycle(PlayState* play) { - s16 sceneNum; + s16 sceneId; s32 j; s32 i; u8 slot; @@ -264,13 +264,13 @@ void Sram_SaveEndOfCycle(PlayState* play) { gSaveContext.save.playerData.deaths = 999; } - sceneNum = Play_GetOriginalSceneNumber(play->sceneNum); + sceneId = Play_GetOriginalSceneId(play->sceneId); Play_SaveCycleSceneFlags(&play->state); - 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.chest &= D_801C5FC0[sceneId][2]; + play->actorCtx.sceneFlags.switches[0] &= D_801C5FC0[sceneId][0]; + play->actorCtx.sceneFlags.switches[1] &= D_801C5FC0[sceneId][1]; + play->actorCtx.sceneFlags.collectible[0] &= D_801C5FC0[sceneId][3]; play->actorCtx.sceneFlags.clearedRoom = 0; for (i = 0; i < SCENE_MAX; i++) { @@ -608,7 +608,7 @@ SavePlayerData sSaveDefaultPlayerData = { 0xFF, // unk_20 0x0000, // owlActivationFlags 0xFF, // unk_24 - SCENE_SPOT00, // savedSceneNum + SCENE_SPOT00, // savedSceneId }; ItemEquips sSaveDefaultItemEquips = { @@ -646,7 +646,7 @@ Inventory sSaveDefaultInventory = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonKeys { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, - // defenceHearts + // defenseHearts 0, // strayFairies { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -679,7 +679,7 @@ void Sram_InitNewSave(void) { Lib_MemCpy(&gSaveContext.save.inventory, &sSaveDefaultInventory, sizeof(Inventory)); Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDefaultChecksum, sizeof(gSaveContext.save.checksum)); - gSaveContext.save.horseData.scene = SCENE_F01; + gSaveContext.save.horseData.sceneId = SCENE_F01; gSaveContext.save.horseData.pos.x = -1420; gSaveContext.save.horseData.pos.y = 257; gSaveContext.save.horseData.pos.z = -1285; @@ -708,7 +708,7 @@ SavePlayerData sSaveDebugPlayerData = { 0xFF, // unk_20 0, // owlActivationFlags 0xFF, // unk_24 - SCENE_SPOT00, // savedSceneNum + SCENE_SPOT00, // savedSceneId }; ItemEquips sSaveDebugItemEquips = { @@ -792,7 +792,7 @@ Inventory sSaveDebugInventory = { { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }, // dungeonKeys { 8, 8, 8, 8, 8, 8, 8, 8, 8 }, - // defenceHearts + // defenseHearts 0, // strayFairies { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -839,7 +839,7 @@ void Sram_InitDebugSave(void) { gSaveContext.save.hasTatl = true; - gSaveContext.save.horseData.scene = SCENE_F01; + gSaveContext.save.horseData.sceneId = SCENE_F01; gSaveContext.save.horseData.pos.x = -1420; gSaveContext.save.horseData.pos.y = 257; gSaveContext.save.horseData.pos.z = -1285; @@ -894,13 +894,13 @@ void func_80144A94(SramContext* sramCtx) { gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; } - for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) { - gSaveContext.unk_3DD0[i] = 0; - gSaveContext.unk_3DE0[i] = 0; - gSaveContext.unk_3E18[i] = 0; - gSaveContext.unk_3E50[i] = 0; - gSaveContext.unk_3E88[i] = 0; - gSaveContext.unk_3EC0[i] = 0; + for (i = 0; i < TIMER_ID_MAX; i++) { + gSaveContext.timerStates[i] = TIMER_STATE_OFF; + gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerStartOsTimes[i] = 0; + gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerPausedOsTimes[i] = 0; } D_801BDAA0 = 1; @@ -969,13 +969,13 @@ void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) { gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible; } - for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3DD0); i++) { - gSaveContext.unk_3DD0[i] = 0; - gSaveContext.unk_3DE0[i] = 0; - gSaveContext.unk_3E18[i] = 0; - gSaveContext.unk_3E50[i] = 0; - gSaveContext.unk_3E88[i] = 0; - gSaveContext.unk_3EC0[i] = 0; + for (i = 0; i < TIMER_ID_MAX; i++) { + gSaveContext.timerStates[i] = TIMER_STATE_OFF; + gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerStartOsTimes[i] = 0; + gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerPausedOsTimes[i] = 0; } if (gSaveContext.save.isFirstCycle) { @@ -1598,7 +1598,7 @@ void func_80147068(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (((osGetTime() - sramCtx->unk_18) * 0x40) / 3000 / 10000 >= 200) { + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->unk_18) >= SECONDS_TO_TIMER(2)) { sramCtx->status = 0; } } @@ -1635,7 +1635,7 @@ void func_80147198(SramContext* sramCtx) { sramCtx->status = 4; } } - } else if (((osGetTime() - sramCtx->unk_18) * 0x40) / 3000 / 10000 >= 200) { + } else if (OSTIME_TO_TIMER(osGetTime() - sramCtx->unk_18) >= SECONDS_TO_TIMER(2)) { sramCtx->status = 0; bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE); gSaveContext.save.isOwlSave = false; diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 7975b1c857..6dd46633c9 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -75,7 +75,7 @@ void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) skyboxCtx->envB = 40; // Inverted Stone Tower Temple and Inverted Stone Tower - if ((play->sceneNum == SCENE_F41) || (play->sceneNum == SCENE_INISIE_R)) { + if ((play->sceneId == SCENE_F41) || (play->sceneId == SCENE_INISIE_R)) { skyboxCtx->rotZ = 3.15000009537f; } } 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 53a3300d4e..8e0c025e28 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 @@ -340,14 +340,14 @@ void func_80A2A1E0(BgDblueMovebg* this, PlayState* play) { Math_StepToS(&this->unk_1CC, this->unk_1CE, 12); this->dyna.actor.shape.rot.y += this->unk_1CC; - if (play->roomCtx.currRoom.num == 0) { + if (play->roomCtx.curRoom.num == 0) { this->opaDList = gGreatBayTempleObjectGearShaftWithPlatformsDL; - } else if (play->roomCtx.currRoom.num == 8) { + } else if (play->roomCtx.curRoom.num == 8) { this->opaDList = NULL; } - if (play->roomCtx.currRoom.num != this->unk_170) { - if (play->roomCtx.currRoom.num != this->unk_171) { + if (play->roomCtx.curRoom.num != this->unk_170) { + if (play->roomCtx.curRoom.num != this->unk_171) { if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) { D_80A2BBF4.unk_01 = 0; Actor_MarkForDeath(&this->dyna.actor); @@ -628,8 +628,8 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { s32 pad; s32 temp_v0_3; - if (play->roomCtx.currRoom.num != this->unk_170) { - if (play->roomCtx.currRoom.num != this->unk_171) { + if (play->roomCtx.curRoom.num != this->unk_170) { + if (play->roomCtx.curRoom.num != this->unk_171) { if ((play->roomCtx.prevRoom.num != this->unk_170) && (play->roomCtx.prevRoom.num != this->unk_171)) { D_80A2BBF4.unk_00 = 0; Actor_MarkForDeath(&this->dyna.actor); @@ -669,7 +669,7 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { this->dyna.actor.shape.rot.x += this->unk_1CC; if (this->unk_160 == 8) { - if (play->roomCtx.currRoom.num == 8) { + if (play->roomCtx.curRoom.num == 8) { func_80A2ABD0(this, play); this->unk_172 |= 0x20; } else { @@ -677,9 +677,9 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) { } } - if (play->roomCtx.currRoom.num == 0) { + if (play->roomCtx.curRoom.num == 0) { this->opaDList = gGreatBayTempleObjectWaterwheelDL; - } else if (play->roomCtx.currRoom.num == 8) { + } else if (play->roomCtx.curRoom.num == 8) { this->opaDList = gGreatBayTempleObjectWaterwheelWithFakeGearDL; } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index e7d96d205e..ca8ad214f5 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -155,7 +155,7 @@ void Boss04_Init(Actor* thisx, PlayState* play2) { s16 phi_s0_2; s32 pad; - if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index 541a4d93da..58d27d448b 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -162,7 +162,7 @@ void DmAh_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.01f); this->unk_27C |= 1; - if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) { this->unk_280 = func_80C1D78C(play); func_80C1D410(this, 1); this->actionFunc = func_80C1D92C; 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 4cd28f454c..5e03eb74c1 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -183,7 +183,7 @@ void func_80C1C958(DmAn* this, PlayState* play) { this->unk_2AE |= 1; this->actor.draw = func_80C1D0B0; - if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) { this->unk_2B4 = func_80C1C8E8(play); func_80C1C4D8(this, play, 1); this->actionFunc = func_80C1CC80; diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 177c5784dc..cd130e218f 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -449,7 +449,7 @@ void func_80AA5E2C(DmChar00* this, PlayState* play) { void func_80AA5EBC(DmChar00* this, PlayState* play) { if (play->csCtx.state != 0) { - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_LOST_WOODS: if (gSaveContext.sceneSetupIndex == 1) { func_80AA561C(this, play); @@ -527,7 +527,7 @@ void DmChar00_Init(Actor* thisx, PlayState* play) { s32 pad; DmChar00* this = THIS; - if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { + if ((play->sceneId == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(thisx); } @@ -914,8 +914,8 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) { s32 pad; Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4); - if ((play->csCtx.state == 0) && ((play->sceneNum != SCENE_OPENINGDAN) || (gSaveContext.sceneSetupIndex != 0) || - (play->roomCtx.currRoom.num != 0) || (play->csCtx.currentCsIndex != 1) || + if ((play->csCtx.state == 0) && ((play->sceneId != SCENE_OPENINGDAN) || (gSaveContext.sceneSetupIndex != 0) || + (play->roomCtx.curRoom.num != 0) || (play->csCtx.currentCsIndex != 1) || (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { return; } diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index 5a66958169..da67e6f1cd 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -75,7 +75,7 @@ void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) } void DmChar02_PlaySfxForCutscenes(DmChar02* this, PlayState* play) { - if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_OKUJOU) && (play->csCtx.currentCsIndex == 1)) { + if ((play->csCtx.state != 0) && (play->sceneId == SCENE_OKUJOU) && (play->csCtx.currentCsIndex == 1)) { DmChar02_PlaySfxForDroppingOcarinaCutscene(this, play); } } diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c index 44e5732add..c0cb242812 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -544,7 +544,7 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) { } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_3) { - if (play->sceneNum == SCENE_OKUJOU) { + if (play->sceneId == SCENE_OKUJOU) { if (gSaveContext.sceneSetupIndex == 2) { if (play->csCtx.currentCsIndex == 0) { func_80AAD3F8(this, play); @@ -552,7 +552,7 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) { func_80AAD450(this, play); } } - } else if (play->sceneNum == SCENE_SPOT00) { + } else if (play->sceneId == SCENE_SPOT00) { if (gSaveContext.sceneSetupIndex == 9) { if ((play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 255)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); 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 b51f4df8dd..1ed25ede25 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -183,7 +183,7 @@ void func_80C248A8(DmGm* this, PlayState* play) { this->unk_2AE |= 1; this->actor.draw = func_80C25000; - if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) { this->unk_2B4 = func_80C24838(play); func_80C24428(this, play, 1); this->actionFunc = func_80C24BD0; diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c index 4e3915af0c..910293b77f 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c @@ -95,7 +95,7 @@ void DmOpstage_Update(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; this->actionFunc(this, play); - if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.frames == 480)) { + if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.frames == 480)) { // This actor is responsible for playing the fairy sound during the exposition in the intro, // during the transition to Lost Woods, before Ocarina gets stolen. func_8019F128(NA_SE_EV_NAVY_FLY_REBIRTH); diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 120c9ea49c..5988d1913e 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -917,7 +917,7 @@ void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, PlayState* play) { */ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { if (play->csCtx.state != 0) { - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_LOST_WOODS: if (gSaveContext.sceneSetupIndex == 1) { DmStk_PlaySfxForIntroCutsceneFirstPart(this, play); @@ -1028,13 +1028,13 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->fogG = play->lightCtx.unk8; this->fogB = play->lightCtx.unk9; - if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { + if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { this->alpha = 0; this->fogN = 0; this->fogF = 1000; this->fogScale = 1.0f; this->actionFunc = DmStk_DoNothing; - } else if (play->sceneNum == SCENE_OKUJOU) { + } else if (play->sceneId == SCENE_OKUJOU) { this->alpha = 255; this->fogN = 996; this->fogF = 1000; @@ -1045,11 +1045,11 @@ void DmStk_Init(Actor* thisx, PlayState* play) { if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_ROOFTOP, 0)) { if (gSaveContext.sceneSetupIndex == 0) { - if (gSaveContext.unk_3DD0[3] == 0) { + if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) { // Starts a 5 minute (300 second) timer until the moon falls. - func_8010E9F0(3, 300); - XREG(80) = 200; - XREG(81) = 115; + Interface_StartTimer(TIMER_ID_MOON_CRASH, 300); + R_MOON_CRASH_TIMER_Y = 200; + R_MOON_CRASH_TIMER_X = 115; } if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { @@ -1062,12 +1062,12 @@ void DmStk_Init(Actor* thisx, PlayState* play) { } else if (gSaveContext.sceneSetupIndex == 3) { this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; - if (gSaveContext.unk_3DD0[3] == 0) { + if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) { // This code is called when the Giants fail to stop the moon. // Starts a 1 minute (60 second) timer until the moon falls. - func_8010E9F0(3, 60); - XREG(80) = 200; - XREG(81) = 115; + Interface_StartTimer(TIMER_ID_MOON_CRASH, 60); + R_MOON_CRASH_TIMER_Y = 200; + R_MOON_CRASH_TIMER_X = 115; } this->actor.world.pos.y = 120.0f; @@ -1088,7 +1088,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - } else if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) { + } else if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) { if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) { Actor_MarkForDeath(&this->actor); } @@ -1101,7 +1101,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->animIndex = SK_ANIM_BENT_OVER_HEAD_TWITCH; this->actionFunc = DmStk_WaitForTelescope; } else { - if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { + if ((play->sceneId == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(&this->actor); } @@ -1127,8 +1127,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); - if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && - (play->csCtx.currentCsIndex > 0)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && (play->csCtx.currentCsIndex > 0)) { play->envCtx.unk_17 = 15; play->envCtx.unk_18 = 15; } @@ -1316,7 +1315,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { if (play->csCtx.frames == play->csCtx.actorActions[actorActionIndex]->startFrame) { if (this->csAction != play->csCtx.actorActions[actorActionIndex]->action) { this->csAction = play->csCtx.actorActions[actorActionIndex]->action; - if (play->sceneNum == SCENE_CLOCKTOWER) { + if (play->sceneId == SCENE_CLOCKTOWER) { this->handType = SK_HAND_TYPE_HOLDING_FLUTE; } else { this->handType = SK_HAND_TYPE_DEFAULT; @@ -1685,7 +1684,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK; } else if (((this->animIndex >= SK_ANIM_HUDDLE_WITH_FAIRIES) && (this->animIndex <= SK_ANIM_DRAW)) || ((this->animIndex >= SK_ANIM_PLAY_FLUTE) && (this->animIndex <= SK_ANIM_CARTWHEEL)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) { + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) { this->maskType = SK_MASK_TYPE_NO_MASK; if ((this->animIndex == SK_ANIM_HOLD_UP_MASK_START) || (this->animIndex == SK_ANIM_HOLD_UP_MASK_LOOP)) { this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK_AND_FLUTE; @@ -1777,7 +1776,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (play->sceneNum == SCENE_OKUJOU) { + if (play->sceneId == SCENE_OKUJOU) { DmStk_UpdateCollision(this, play); } @@ -1824,8 +1823,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { } } - if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && - (play->csCtx.currentCsIndex > 0)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && (play->csCtx.currentCsIndex > 0)) { play->envCtx.unk_17 = 15; play->envCtx.unk_18 = 15; } @@ -1888,7 +1886,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot break; case SK_MASK_TYPE_NORMAL: - if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1) && + if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.frames < 1400)) { if (this->fogN == this->fogF) { this->fogF = this->fogN; @@ -1950,7 +1948,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot case SK_HAND_TYPE_HOLDING_OCARINA: gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaHoldingRightHand); - if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { + if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL); } break; @@ -1988,7 +1986,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot break; case SK_HAND_TYPE_HOLDING_OCARINA: - if ((play->sceneNum != SCENE_LOST_WOODS) || (gSaveContext.sceneSetupIndex != 1)) { + if ((play->sceneId != SCENE_LOST_WOODS) || (gSaveContext.sceneSetupIndex != 1)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL); } gSPDisplayList(POLY_OPA_DISP++, gSkullKidTwoFingersExtendedLeftHand); 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 b5f75efaac..6bf8adc727 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -100,7 +100,7 @@ static InitChainEntry sInitChain[] = { }; typedef struct { - /* 0x00 */ s16 sceneNum; + /* 0x00 */ s16 sceneId; /* 0x02 */ u8 index; } ShutterSceneInfo; // size = 0x4 @@ -114,8 +114,8 @@ ShutterSceneInfo D_808A2258[] = { }; typedef struct { - /* 0x00 */ s16 dungeonScene; - /* 0x02 */ s16 bossScene; + /* 0x00 */ s16 dungeonSceneId; + /* 0x02 */ s16 bossSceneId; /* 0x04 */ u8 index; } BossDoorInfo; // size = 0x6 @@ -209,7 +209,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { ShutterSceneInfo* shutterSceneInfo = &D_808A2258[0]; for (i = 0; i < ARRAY_COUNT(D_808A2258) - 1; i++, shutterSceneInfo++) { - if (play->sceneNum == shutterSceneInfo->sceneNum) { + if (play->sceneId == shutterSceneInfo->sceneId) { break; } } @@ -222,7 +222,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { BossDoorInfo* bossDoorInfo = &D_808A22A0[0]; for (i = 0; i < ARRAY_COUNT(D_808A22A0) - 1; i++, bossDoorInfo++) { - if ((play->sceneNum == bossDoorInfo->dungeonScene) || (play->sceneNum == bossDoorInfo->bossScene)) { + if ((play->sceneId == bossDoorInfo->dungeonSceneId) || (play->sceneId == bossDoorInfo->bossSceneId)) { break; } } @@ -553,9 +553,9 @@ void func_808A1884(DoorShutter* this, PlayState* play) { play->doorCtx.transitionActorList[DOORSHUTTER_GET_FC00(&this->actor)].sides[(sp44.z < 0.0f) ? 0 : 1].room; if (room != this->actor.room) { - Room temp = play->roomCtx.currRoom; + Room temp = play->roomCtx.curRoom; - play->roomCtx.currRoom = play->roomCtx.prevRoom; + play->roomCtx.curRoom = play->roomCtx.prevRoom; play->roomCtx.prevRoom = temp; play->roomCtx.activeMemPage ^= 1; } diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index f43f7c58cd..be9b5c0931 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -54,7 +54,7 @@ typedef struct { // Maps scenes to SpiralObjectType typedef struct { - /* 0x00 */ s16 sceneNum; + /* 0x00 */ s16 sceneId; /* 0x02 */ u8 objectType; } SpiralSceneInfo; @@ -116,7 +116,7 @@ s32 DoorSpiral_SetSpiralType(DoorSpiral* this, PlayState* play) { this->spiralType = doorObjectInfo->spiralType; if ((this->spiralType == SPIRAL_DAMPES_HOUSE) || - ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && play->roomCtx.currRoom.enablePosLights)) { + ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && play->roomCtx.curRoom.enablePosLights)) { if (this->spiralType == SPIRAL_WOODFALL_TEMPLE) { this->spiralType = SPIRAL_WOODFALL_TEMPLE_ALT; } @@ -147,7 +147,7 @@ s32 DoorSpiral_GetObjectType(PlayState* play) { s32 type; for (i = 0; i < ARRAY_COUNT(spiralSceneInfo); sceneInfo++, i++) { - if (play->sceneNum == sceneInfo->sceneNum) { + if (play->sceneId == sceneInfo->sceneId) { break; } } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 2bf0d716e6..6e4f763d0c 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -75,13 +75,13 @@ void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { s32 func_808B849C(DoorWarp1* this, PlayState* play) { s32 ret = 0; - if ((play->sceneNum == SCENE_MITURIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA)) { + if ((play->sceneId == SCENE_MITURIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA)) { ret = 1; - } else if ((play->sceneNum == SCENE_HAKUGIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { + } else if ((play->sceneId == SCENE_HAKUGIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { ret = 2; - } else if ((play->sceneNum == SCENE_SEA_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { + } else if ((play->sceneId == SCENE_SEA_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { ret = 3; - } else if ((play->sceneNum == SCENE_INISIE_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { + } else if ((play->sceneId == SCENE_INISIE_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { ret = 4; } return ret; @@ -161,8 +161,8 @@ void DoorWarp1_Init(Actor* thisx, PlayState* play) { break; } - if ((play->sceneNum == SCENE_MITURIN_BS) || (play->sceneNum == SCENE_HAKUGIN_BS) || - (play->sceneNum == SCENE_INISIE_BS) || (play->sceneNum == SCENE_SEA_BS)) { + if ((play->sceneId == SCENE_MITURIN_BS) || (play->sceneId == SCENE_HAKUGIN_BS) || + (play->sceneId == SCENE_INISIE_BS) || (play->sceneId == SCENE_SEA_BS)) { func_800FE484(); play->interfaceCtx.restrictions.unk_312 = 1; play->interfaceCtx.restrictions.songOfSoaring = 1; @@ -268,7 +268,7 @@ void func_808B8E78(DoorWarp1* this, PlayState* play) { this->unk_1A8 = 0.0f; this->unk_1AC = 0.0f; this->unk_1A4 = 700.0f; - if (play->sceneNum == SCENE_INISIE_N) { + if (play->sceneId == SCENE_INISIE_N) { DoorWarp1_SetupAction(this, func_808B96A0); } else if (gSaveContext.save.weekEventReg[86] & 0x80) { this->unk_1D4 = 0; @@ -307,12 +307,12 @@ void func_808B90CC(DoorWarp1* this, PlayState* play) { s16 sp2E = 0; f32 phi_f0 = 0.0f; - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { sp2E = -10; phi_f0 = -5.0f; - } else if (play->sceneNum == SCENE_HAKUGIN) { + } else if (play->sceneId == SCENE_HAKUGIN) { sp2E = -20; - } else if (play->sceneNum == SCENE_SEA) { + } else if (play->sceneId == SCENE_SEA) { sp2E = -20; } @@ -551,7 +551,7 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { return; } - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_MITURIN_BS: gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFFFFFF00) | (((u8)gSaveContext.save.unk_ECC[1]) & 0xFF); @@ -598,7 +598,7 @@ void func_808B9F10(DoorWarp1* this, PlayState* play) { if ((this->unk_203 == 0) && func_808B866C(this, play) && !Play_InCsMode(play) && (this->unk_203 == 0)) { Player* player = GET_PLAYER(play); - Interface_ChangeAlpha(1); + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); func_800B7298(play, &this->dyna.actor, 9); player->unk_3A0.x = this->dyna.actor.world.pos.x; player->unk_3A0.z = this->dyna.actor.world.pos.z; @@ -635,16 +635,16 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { u8 phi_a0; s32 phi_v0_3; - if ((play->sceneNum == SCENE_MITURIN_BS) || (play->sceneNum == SCENE_HAKUGIN_BS) || - (play->sceneNum == SCENE_INISIE_BS) || (play->sceneNum == SCENE_SEA_BS)) { - D_801F4DE2 = play->sceneNum; - if (play->sceneNum == SCENE_MITURIN_BS) { + if ((play->sceneId == SCENE_MITURIN_BS) || (play->sceneId == SCENE_HAKUGIN_BS) || + (play->sceneId == SCENE_INISIE_BS) || (play->sceneId == SCENE_SEA_BS)) { + D_801F4DE2 = play->sceneId; + if (play->sceneId == SCENE_MITURIN_BS) { phi_v0_2 = 0; - } else if (play->sceneNum == SCENE_HAKUGIN_BS) { + } else if (play->sceneId == SCENE_HAKUGIN_BS) { phi_v0_2 = 1; - } else if (play->sceneNum == SCENE_INISIE_BS) { + } else if (play->sceneId == SCENE_INISIE_BS) { phi_v0_2 = 2; - } else if (play->sceneNum == SCENE_SEA_BS) { + } else if (play->sceneId == SCENE_SEA_BS) { phi_v0_2 = 3; } else { phi_v0_2 = 0; @@ -871,7 +871,7 @@ void func_808BA550(DoorWarp1* this, PlayState* play) { play->envCtx.lightSettings.fogNear = -500.0f * temp_f0; if (play->envCtx.lightSettings.fogNear < -300) { - play->roomCtx.currRoom.segment = NULL; + play->roomCtx.curRoom.segment = NULL; } } } @@ -882,7 +882,7 @@ void func_808BAAF4(DoorWarp1* this, PlayState* play) { f32 phi_f2; phi_f2 = 200.0f; - if (play->sceneNum == SCENE_SEA) { + if (play->sceneId == SCENE_SEA) { phi_f2 = 85.0f; } @@ -1039,12 +1039,12 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) { return; } - if (play->sceneNum != SCENE_MITURIN) { - if (play->sceneNum == SCENE_HAKUGIN) { + if (play->sceneId != SCENE_MITURIN) { + if (play->sceneId == SCENE_HAKUGIN) { sp60 = 1; - } else if (play->sceneNum == SCENE_SEA) { + } else if (play->sceneId == SCENE_SEA) { sp60 = 2; - } else if (play->sceneNum == SCENE_INISIE_R) { + } else if (play->sceneId == SCENE_INISIE_R) { sp60 = 3; } } 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 7fe52d8391..fc3a9b5834 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -402,7 +402,7 @@ void EnAz_Destroy(Actor* thisx, PlayState* play2) { EnAz* this = THIS; if (gSaveContext.save.entrance != ENTRANCE(WATERFALL_RAPIDS, 1)) { - gSaveContext.unk_3DD0[4] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; } Collider_DestroyCylinder(play2, &this->collider); } @@ -1486,11 +1486,11 @@ void func_80A97D5C(EnAz* this, PlayState* play) { gSaveContext.minigameScore = (this->unk_374 & 2) ? 25 : 20; play->interfaceCtx.unk_280 = 1; if ((this->unk_2FA == 1) || (this->unk_2FA == 3)) { - func_8010E9F0(4, 120); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); } else if (gSaveContext.save.weekEventReg[25] & 1) { - func_8010E9F0(4, 100); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 100); } else { - func_8010E9F0(4, 110); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 110); } this->actionFunc = func_80A97E48; } @@ -1547,7 +1547,7 @@ void func_80A97F9C(EnAz* this, PlayState* play) { } else { gSaveContext.save.weekEventReg[24] |= 1; } - gSaveContext.unk_3DD0[4] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; this->unk_374 &= ~0x10; play->nextEntrance = Entrance_CreateFromSpawn(2); gSaveContext.nextCutsceneIndex = 0; @@ -1557,8 +1557,8 @@ void func_80A97F9C(EnAz* this, PlayState* play) { this->actor.speedXZ = 0.0f; func_80A979DC(this, play); } else { - if (gSaveContext.unk_3DE0[4] == 0) { - gSaveContext.unk_3DD0[4] = 5; + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) { + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; this->unk_374 |= 0x4000; func_80A97A28(this, play); } diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 4d783942dd..dcbbee65d6 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -503,12 +503,12 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { this->stateFlags |= BOMB_SHOP_LADY_STATE_DRAW_SHADOW; this->actor.flags |= ACTOR_FLAG_1; - if (play->sceneNum == SCENE_BOMYA) { + if (play->sceneId == SCENE_BOMYA) { this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_Idle; - } else if (play->sceneNum == SCENE_BACKTOWN) { + } else if (play->sceneId == SCENE_BACKTOWN) { if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE) && (gSaveContext.save.entrance != ENTRANCE(NORTH_CLOCK_TOWN, 7)) && (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F)) { diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index fe1eb9fd84..5bec14e3e9 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -178,7 +178,7 @@ void EnBat_Destroy(Actor* thisx, PlayState* play) { } s32 EnBat_IsGraveyardOnSecondDay(PlayState* play) { - if ((CURRENT_DAY == 2) && (play->sceneNum == SCENE_BOTI)) { + if ((CURRENT_DAY == 2) && (play->sceneId == SCENE_BOTI)) { return true; } else { return false; 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 4f8f28f3c7..ba7273f598 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -485,7 +485,7 @@ s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, PlayState* play) { void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { if ((this->bodyCollider.base.acFlags & AC_ON) && ((this->bodyCollider.base.acFlags & AC_HIT) || - ((play->sceneNum == SCENE_20SICHITAI || play->sceneNum == SCENE_20SICHITAI2) && + ((play->sceneId == SCENE_20SICHITAI || play->sceneId == SCENE_20SICHITAI2) && EnBigokuta_IsNearSwampBoat(this, play)))) { Enemy_StartFinishingBlow(play, &this->picto.actor); diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 392f9a441f..6cc0b2e72b 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -339,7 +339,7 @@ void EnBigslime_Init(Actor* thisx, PlayState* play2) { this->gekkoCollider.base.ocFlags1 &= ~OC1_NO_PUSH; this->actor.params = CLAMP(this->actor.params, 1, 4); - if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_MarkForDeath(&this->actor); if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { @@ -2497,7 +2497,7 @@ void EnBigslime_Despawn(EnBigslime* this, PlayState* play) { } if (!this->isDespawned) { - Flags_SetClearTemp(play, play->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.curRoom.num); this->isDespawned = true; } diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 5d5b01ee8b..d4fe409cd7 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -301,7 +301,7 @@ void func_80871058(EnBom* this, PlayState* play) { void func_808714D4(EnBom* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actionFunc = func_80871058; - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.bgCheckFlags &= ~1; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 31e3264092..6abf4da13e 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -176,7 +176,7 @@ s32 func_80B3E5DC(EnDai* this, s32 arg1) { s32 func_80B3E69C(EnDai* this, PlayState* play) { s32 ret = false; - if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_12HAKUGINMAE) && (play->csCtx.currentCsIndex == 0) && + if ((play->csCtx.state != 0) && (play->sceneId == SCENE_12HAKUGINMAE) && (play->csCtx.currentCsIndex == 0) && !(gSaveContext.save.weekEventReg[30] & 1)) { if (!(this->unk_1CE & 0x10)) { Flags_SetSwitch(play, 20); diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index ef93a501a6..de2c586e9b 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -335,11 +335,11 @@ void EnDg_MoveAlongPath(EnDg* this, PlayState* play) { } if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || - ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneNum == SCENE_OMOYA))) { + ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneId == SCENE_OMOYA))) { Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); - } else if (play->sceneNum == SCENE_CLOCKTOWER) { + } else if (play->sceneId == SCENE_CLOCKTOWER) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); @@ -397,11 +397,11 @@ void EnDg_PlaySfxGrowl(EnDg* this, f32 frame) { void EnDg_SetupIdleMove(EnDg* this, PlayState* play) { if (!(this->actor.bgCheckFlags & 0x20)) { if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || - ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneNum == SCENE_OMOYA))) { + ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneId == SCENE_OMOYA))) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); - } else if (play->sceneNum == SCENE_CLOCKTOWER) { + } else if (play->sceneId == SCENE_CLOCKTOWER) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); @@ -1319,7 +1319,7 @@ void EnDg_Init(Actor* thisx, PlayState* play) { this->index = ENDG_GET_INDEX(&this->actor); this->behavior = DOG_BEHAVIOR_INITIAL; this->grabState = DOG_GRAB_STATE_NONE; - if (play->sceneNum == SCENE_F01_B) { + if (play->sceneId == SCENE_F01_B) { this->sitAfterThrowTimer = 100; EnDg_UpdateTextId(this); } @@ -1340,7 +1340,7 @@ void EnDg_Update(Actor* thisx, PlayState* play) { Vec3f floorRot = { 0.0f, 0.0f, 0.0f }; this->selectedDogIndex = sSelectedRacetrackDogInfo.index; - if (!(player->stateFlags1 & 0x20) || (play->sceneNum != SCENE_CLOCKTOWER)) { + if (!(player->stateFlags1 & 0x20) || (play->sceneId != SCENE_CLOCKTOWER)) { if (EnDg_ShouldReactToNonHumanPlayer(this, play)) { EnDg_ChooseActionForForm(this, play); } else if (this->behavior != DOG_BEHAVIOR_DEFAULT) { diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 65c11e0352..c17acf8cc9 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -551,7 +551,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } if (this->skelAnime.curFrame > 35.0f) { - if ((play->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 38.0f)) { + if ((play->sceneId == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 38.0f)) { play->envCtx.lightSettingOverride = 11; } @@ -562,7 +562,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } } - if ((play->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) { + if ((play->sceneId == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) { play->envCtx.lightSettingOverride = 0xFF; } @@ -1053,7 +1053,7 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { worldSphere->center.z = this->limbPos[10].z; } - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = 11; } @@ -1114,7 +1114,7 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { void func_8089CF00(EnDinofos* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_0017B8); this->colliderJntSph.base.atFlags &= ~AT_ON; - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = 255; } this->actionFunc = func_8089CF70; @@ -1285,7 +1285,7 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { func_8089ACEC(this, play); func_8089AD70(this); - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = 255; } diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index 7afd4e2242..0086742925 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -447,7 +447,7 @@ void func_80A52074(EnDnk* this, PlayState* play) { } void func_80A52134(EnDnk* this, PlayState* play) { - if ((play->csCtx.state != 0) && (ENDNK_GET_3C(&this->actor) == 4) && (play->sceneNum == SCENE_SPOT00) && + if ((play->csCtx.state != 0) && (ENDNK_GET_3C(&this->actor) == 4) && (play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 2)) { func_80A52074(this, play); } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index d935a1daeb..9b421dfd49 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -2,12 +2,16 @@ * File: z_en_dno.c * Overlay: ovl_En_Dno * Description: Deku Butler + * + * This actor's name is probably short for "Dekunuts Ou (king)". This is likely a misnamed actor, + * since it uses assets from object_dnj (probably short for "Dekunuts Jii (grandfather, elderly + * person"). Note that the Deku Princess and King both call the Butler "Jii" in the Japanese text. */ #include "z_en_dno.h" #include "overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_dno/object_dno.h" +#include "objects/object_dnj/object_dnj.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -41,23 +45,23 @@ s32 EnDno_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); static AnimationSpeedInfo sAnimations[] = { - { &object_dno_Anim_000470, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_0008F0, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dno_Anim_000F6C, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dno_Anim_001A50, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dno_Anim_002530, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_003320, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dno_Anim_0036D0, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dno_Anim_0041CC, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dno_Anim_004DD8, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_005F98, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_dno_Anim_006488, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_0073E4, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_dno_Anim_0077A8, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dno_Anim_007CA4, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_dno_Anim_008324, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dno_Anim_008AE4, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dno_Anim_009100, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dno_Anim_0051E4, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dno_Anim_005E20, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dno_Anim_006F84, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &object_dnj_Anim_000470, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_0008F0, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &object_dnj_Anim_000F6C, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_001A50, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &object_dnj_Anim_002530, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_003320, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &object_dnj_Anim_0036D0, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_0041CC, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &object_dnj_Anim_004DD8, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_005F98, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &object_dnj_Anim_006488, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_0073E4, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &object_dnj_Anim_0077A8, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_007CA4, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &object_dnj_Anim_008324, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_008AE4, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &object_dnj_Anim_009100, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_0051E4, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &object_dnj_Anim_005E20, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_006F84, 1.0f, ANIMMODE_LOOP, 0.0f }, }; const ActorInit En_Dno_InitVars = { ACTOR_EN_DNO, ACTORCAT_NPC, FLAGS, - OBJECT_DNO, + OBJECT_DNJ, sizeof(EnDno), (ActorFunc)EnDno_Init, (ActorFunc)EnDno_Destroy, @@ -194,7 +198,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) { if (actor == NULL) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dno_Skel_00E1F8, &object_dno_Anim_007CA4, + SkelAnime_InitFlex(play, &this->skelAnime, &object_dnj_Skel_00E1F8, &object_dnj_Anim_007CA4, this->jointTable, this->morphTable, 28); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); @@ -216,7 +220,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) { } else { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); thisx->room = -1; - gSaveContext.unk_3DD0[1] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); this->unk_3B0 |= 1; this->actionFunc = func_80A72438; @@ -817,7 +821,7 @@ void func_80A73244(EnDno* this, PlayState* play) { this->unk_328 = 2; this->actor.speedXZ = 0.0f; Flags_UnsetSwitch(play, ENDNO_GET_3F80(&this->actor)); - gSaveContext.unk_3DD0[1] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->unk_44E = 0; this->actionFunc = func_80A732C8; } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 6044536407..63371ee2fa 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -2,10 +2,13 @@ * File: z_en_dnp.c * Overlay: ovl_En_Dnp * Description: Deku Princess + * + * This actor's name is probably short for "Dekunuts Princess". It uses assets from object_dnq, + * which is probably short for "Dekunuts Queen". */ #include "z_en_dnp.h" -#include "objects/object_dnp/object_dnp.h" +#include "objects/object_dnq/object_dnq.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -26,7 +29,7 @@ const ActorInit En_Dnp_InitVars = { ACTOR_EN_DNP, ACTORCAT_NPC, FLAGS, - OBJECT_DNP, + OBJECT_DNQ, sizeof(EnDnp), (ActorFunc)EnDnp_Init, (ActorFunc)EnDnp_Destroy, @@ -57,32 +60,32 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static AnimationInfoS sAnimationInfo[] = { - { &object_dnp_Anim_0007D8, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_0021DC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnp_Anim_0021DC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_0026B8, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_004D08, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_0071F4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_007960, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_008588, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnp_Anim_00A900, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_00AEB8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_00B754, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_00674C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_00BAD8, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_006B74, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_012428, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_00B324, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnp_Anim_00B324, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_0115B8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_0115B8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnp_Anim_00923C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_009AA0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_00125C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnp_Anim_0017F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnp_Anim_001C1C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnp_Anim_0057AC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnp_Anim_00625C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_0007D8, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_0021DC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_dnq_Anim_0021DC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_0026B8, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_004D08, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_0071F4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_007960, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_008588, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dnq_Anim_00A900, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_00AEB8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_00B754, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_00674C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_00BAD8, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_006B74, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_012428, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_00B324, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_dnq_Anim_00B324, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_0115B8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_0115B8, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_dnq_Anim_00923C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_009AA0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_00125C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dnq_Anim_0017F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dnq_Anim_001C1C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dnq_Anim_0057AC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dnq_Anim_00625C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; static s32 D_80B3DE58[] = { @@ -247,7 +250,7 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { s32 temp_v0; s32 val; - if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (play->sceneNum == SCENE_MITURIN) && + if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (play->sceneId == SCENE_MITURIN) && (play->csCtx.currentCsIndex == 0)) { this->unk_322 |= 0x20; gSaveContext.save.weekEventReg[29] |= 0x40; @@ -347,7 +350,7 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { EnDnp* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 16.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dnp_Skel_010D60, NULL, this->jointTable, this->morphTable, 26); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dnq_Skel_010D60, NULL, this->jointTable, this->morphTable, 26); this->unk_340 = -1; func_80B3CC38(this, 15); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -370,7 +373,7 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.0085f); SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 |= 0x400; - if ((play->sceneNum == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { + if ((play->sceneId == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { this->unk_322 |= 0x20; func_80B3CC38(this, 1); } @@ -479,10 +482,10 @@ void EnDnp_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void EnDnp_Draw(Actor* thisx, PlayState* play) { static TexturePtr D_80B3DEAC[] = { - object_dnp_Tex_0103D0, - object_dnp_Tex_0105D0, - object_dnp_Tex_0107D0, - object_dnp_Tex_0109D0, + object_dnq_Tex_0103D0, + object_dnq_Tex_0105D0, + object_dnq_Tex_0107D0, + object_dnq_Tex_0109D0, }; EnDnp* this = THIS; diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 6b21d3fc15..3e252c0341 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -2,10 +2,13 @@ * File: z_en_dnq.c * Overlay: ovl_En_Dnq * Description: Deku King + * + * This actor's name is probably short for "Dekunuts Queen". This is likely a misnamed actor, + * since it uses assets from object_dno (probably short for "Dekunuts Ou (king)"). */ #include "z_en_dnq.h" -#include "objects/object_dnq/object_dnq.h" +#include "objects/object_dno/object_dno.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -27,7 +30,7 @@ const ActorInit En_Dnq_InitVars = { ACTOR_EN_DNQ, ACTORCAT_NPC, FLAGS, - OBJECT_DNQ, + OBJECT_DNO, sizeof(EnDnq), (ActorFunc)EnDnq_Init, (ActorFunc)EnDnq_Destroy, @@ -58,26 +61,26 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; static AnimationInfoS sAnimationInfo[] = { - { &object_dnq_Anim_008328, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_dnq_Anim_008328, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnq_Anim_007528, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnq_Anim_0006F0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnq_Anim_000BF8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnq_Anim_002690, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnq_Anim_002690, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnq_Anim_003408, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnq_Anim_006984, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnq_Anim_005E18, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnq_Anim_005A14, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnq_Anim_005284, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnq_Anim_001AEC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnq_Anim_001100, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &object_dnq_Anim_004EA0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnq_Anim_00F504, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnq_Anim_0047B8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnq_Anim_003DBC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &object_dnq_Anim_005A14, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &object_dnq_Anim_003DBC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_008328, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &object_dno_Anim_008328, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_007528, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dno_Anim_0006F0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dno_Anim_000BF8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_002690, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dno_Anim_002690, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dno_Anim_003408, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_006984, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dno_Anim_005E18, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dno_Anim_005A14, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dno_Anim_005284, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dno_Anim_001AEC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dno_Anim_001100, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, + { &object_dno_Anim_004EA0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_00F504, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_0047B8, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_003DBC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, + { &object_dno_Anim_005A14, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &object_dno_Anim_003DBC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, }; s32 EnDnq_ValidatePictograph(PlayState* play, Actor* thisx) { @@ -417,7 +420,7 @@ void EnDnq_Init(Actor* thisx, PlayState* play) { EnDnq* this = THIS; ActorShape_Init(&this->picto.actor.shape, 0.0f, NULL, 14.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dnq_Skel_00EB48, NULL, this->jointTable, this->morphTable, 33); + SkelAnime_InitFlex(play, &this->skelAnime, &object_dno_Skel_00EB48, NULL, this->jointTable, this->morphTable, 33); this->unk_398 = -1; func_80A5257C(this, 0); Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &sCylinderInit); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index d9bc5cee1c..892eab09c7 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -290,7 +290,7 @@ const ActorInit En_Door_InitVars = { }; typedef struct { - /* 0x00 */ s16 sceneNum; + /* 0x00 */ s16 sceneId; /* 0x02 */ u8 dListIndex; /* 0x04 */ s16 objectId; } EnDoorInfo; @@ -405,7 +405,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { objectInfo = &sObjInfo[17 + this->switchFlag]; } else { for (i = 0; i < ARRAY_COUNT(sObjInfo) - 34; i++, objectInfo++) { - if (play->sceneNum == objectInfo->sceneNum) { + if (play->sceneId == objectInfo->sceneId) { break; } } 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 c7ea4f5b00..f551373676 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -903,13 +903,13 @@ void func_8088E850(EnElf* this, PlayState* play) { func_8088D660(this, &nextPos, 0.2f); } - if ((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 0) && + if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 0) && ((play->csCtx.frames == 149) || (play->csCtx.frames == 381) || (play->csCtx.frames == 591))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } - if ((play->sceneNum == SCENE_SECOM) && (gSaveContext.sceneSetupIndex == 0) && + if ((play->sceneId == SCENE_SECOM) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 4) && (play->csCtx.frames == 95)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index 61457bf508..897641a9ef 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -205,13 +205,13 @@ s32 func_80A39C1C(PlayState* play, s32 arg1) { } if (arg1 == 0) { - if (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1) { + if (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1) { return 25; } return 24; } - temp_v1 = (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; + temp_v1 = (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; if (temp_v1 < 10) { temp_v1 = 10; } else if (temp_v1 > 25) { @@ -227,13 +227,13 @@ void func_80A39CD4(PlayState* play, s32 arg1, s32 arg2) { if (arg1 == 0) { if (arg2 == 25) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 1; } else { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~1; } } else { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= arg2 << ((arg1 * 5) - 4); + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= arg2 << ((arg1 * 5) - 4); } } 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 df4597dcae..71bbe262f9 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -315,7 +315,8 @@ void EnFall_Setup(EnFall* this, PlayState* play) { void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { static s32 sGiantsCutsceneState = 0; - if (play->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 1 && play->csCtx.currentCsIndex == 0) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 1) && + (play->csCtx.currentCsIndex == 0)) { switch (sGiantsCutsceneState) { case 0: if (play->csCtx.state != 0) { @@ -408,7 +409,7 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat } } - if (play->sceneNum == SCENE_OKUJOU && gSaveContext.sceneSetupIndex == 2) { + if (play->sceneId == SCENE_OKUJOU && gSaveContext.sceneSetupIndex == 2) { switch (play->csCtx.currentCsIndex) { case 0: switch (play->csCtx.frames) { @@ -452,7 +453,7 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat } void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { - if (play->csCtx.state != 0 && play->sceneNum == SCENE_OKUJOU) { + if (play->csCtx.state != 0 && play->sceneId == SCENE_OKUJOU) { func_800B9010(&this->actor, NA_SE_EV_MOON_FALL - SFX_FLAG); } } @@ -574,7 +575,7 @@ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if (play->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 0 && play->csCtx.currentCsIndex == 2) { + if (play->sceneId == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 0 && play->csCtx.currentCsIndex == 2) { play->skyboxCtx.rotY -= 0.05f; } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 268768660b..d5dc5469ae 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -167,7 +167,7 @@ Actor* func_8091D944(EnFish* this, PlayState* play) { } s32 func_8091DA14(EnFish* this, PlayState* play) { - return play->sceneNum == SCENE_LABO && func_8091D944(this, play); + return (play->sceneId == SCENE_LABO) && func_8091D944(this, play); } void EnFish_Init(Actor* thisx, PlayState* play) { @@ -853,7 +853,8 @@ void func_8091F5A4(Actor* thisx, PlayState* play) { func_8091D7C4(this); Actor_MoveWithGravity(&this->actor); if (this->unk_248 != 0) { - u32 temp = (play->sceneNum ^ SCENE_LABO) != 0; + u32 temp = (play->sceneId != SCENE_LABO); + phi_f0 = BREG(1) + 10.0f; if (temp) { 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 2aabec27f2..8bd1b7e0ec 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -5166,7 +5166,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamAt.y = mainCam->at.y; sSubCamAt.z = mainCam->at.z; D_8090CD4C = 2; - Interface_ChangeAlpha(12); + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); sSubCamVelFactor = 0.0f; // fallthrough case 2: 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 0c00c60404..45206159e2 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -393,7 +393,7 @@ void EnFsn_EndInteraction(EnFsn* this, PlayState* play) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -922,11 +922,7 @@ void EnFsn_DeterminePrice(EnFsn* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_16) { itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { - if (player->heldItemButton == 0) { - buttonItem = CUR_FORM_EQUIP(player->heldItemButton); - } else { - buttonItem = gSaveContext.save.equips.buttonItems[0][player->heldItemButton]; - } + buttonItem = GET_CUR_FORM_BTN_ITEM(player->heldItemButton); this->price = (buttonItem < ITEM_MOON_TEAR) ? gItemPrices[buttonItem] : 0; if (this->price > 0) { player->actor.textId = 0x29EF; @@ -1161,7 +1157,7 @@ void EnFsn_HandleCanPlayerBuyItem(EnFsn* this, PlayState* play) { Actor_PickUp(&this->actor, play, this->items[this->cursorIndex]->getItemId, 300.0f, 300.0f); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->shopItemSelectedTween = 0.0f; item = this->items[this->cursorIndex]; 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 6b0a7e3b96..8ab640253a 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -74,13 +74,13 @@ static Vec3f D_80964B18 = { 0.0f, 55.0f, 12.0f }; static Vec3f D_80964B24 = { 0.0f, 60.0f, 0.0f }; static AnimationInfo sAnimationInfo[] = { - { &object_mu_Anim_0053E0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_mu_Anim_001F74, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_mu_Anim_002F64, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_mu_Anim_004904, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_mu_Anim_005304, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &object_mu_Anim_005304, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_mu_Anim_00BAC4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, + { &gHoneyAndDarlingIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gHoneyAndDarlingCupCheeksLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gHoneyAndDarlingHugLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gHoneyAndDarlingGameDanceLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gHoneyAndDarlingSurpiseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, }; static ColliderCylinderInit sCylinderInit = { @@ -194,8 +194,8 @@ void EnFu_Init(Actor* thisx, PlayState* play) { if (fuKaiten != NULL) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_mu_Skel_00B2B0, &object_mu_Anim_001F74, this->jointTable, - this->morphTable, 21); + SkelAnime_InitFlex(play, &this->skelAnime, &gHoneyAndDarlingSkel, &gHoneyAndDarlingCupCheeksLoopAnim, + this->jointTable, this->morphTable, HONEY_AND_DARLING_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -401,7 +401,8 @@ void func_80962340(EnFu* this, PlayState* play) { Message_StartTextbox(play, 0x287E, &this->actor); this->unk_552 = 0x287E; } - } else if ((gSaveContext.unk_3DE0[4] == 0) && (this->unk_552 != 0x2888)) { + } else if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) && + (this->unk_552 != 0x2888)) { Message_StartTextbox(play, 0x2886, &this->actor); this->unk_552 = 0x2886; } else { @@ -644,7 +645,7 @@ void func_80962A10(EnFu* this, PlayState* play) { play_sound(NA_SE_SY_FOUND); player->stateFlags1 &= ~0x20; - func_8010E9F0(4, 60); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 60); if (this->unk_546 == 1) { func_809616E0(this, play); } else { @@ -681,7 +682,7 @@ void func_80962BCC(EnFu* this, PlayState* play) { play_sound(NA_SE_SY_FOUND); player->stateFlags1 &= ~0x20; player->stateFlags3 |= 0x400000; - func_8010E9F0(4, 60); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 60); if (this->unk_546 == 1) { func_809616E0(this, play); @@ -712,7 +713,7 @@ void func_80962D60(EnFu* this, PlayState* play) { play_sound(NA_SE_SY_FOUND); player->stateFlags1 &= ~0x20; player->stateFlags3 |= 0x400000; - func_8010E9F0(4, 60); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 60); if (this->unk_546 == 1) { func_809616E0(this, play); @@ -760,11 +761,11 @@ void func_80962F4C(EnFu* this, PlayState* play) { break; } - if (gSaveContext.unk_3DE0[4] < 2000) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(20)) { s16 val = D_80964B00[this->unk_542] + 200; Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5); - } else if (gSaveContext.unk_3DE0[4] < 4000) { + } else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(40)) { s16 val = D_80964B00[this->unk_542] + 100; Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5); @@ -776,12 +777,12 @@ void func_80962F4C(EnFu* this, PlayState* play) { if ((!DynaPolyActor_IsInRidingRotatingState((DynaPolyActor*)this->actor.child) && (player->actor.bgCheckFlags & 1)) || - (gSaveContext.unk_3DE0[4] < 1) || (this->unk_548 == this->unk_54C)) { + (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] <= SECONDS_TO_TIMER(0)) || (this->unk_548 == this->unk_54C)) { player->stateFlags3 &= ~0x400000; func_80961E88(play); player->stateFlags1 |= 0x20; if (this->unk_548 < this->unk_54C) { - if (gSaveContext.unk_3DE0[4] == 0) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) { Message_StartTextbox(play, 0x2885, &this->actor); this->unk_552 = 0x2885; } else { @@ -789,15 +790,15 @@ void func_80962F4C(EnFu* this, PlayState* play) { this->unk_552 = 0x2888; } func_801A2C20(); - gSaveContext.unk_3DE0[4] = 0; - gSaveContext.unk_3DD0[4] = 5; + gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; this->unk_548 = 0; func_809632D0(this); } else { this->unk_548 = 0; func_801A2C20(); - gSaveContext.unk_3DE0[4] = 0; - gSaveContext.unk_3DD0[4] = 5; + gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; func_801A3098(NA_BGM_GET_ITEM | 0x900); func_8011B4E0(play, 1); this->unk_54A = 3; @@ -820,7 +821,7 @@ void func_8096326C(EnFu* this, PlayState* play) { void func_809632D0(EnFu* this) { if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } gSaveContext.save.weekEventReg[8] &= (u8)~1; @@ -1453,7 +1454,7 @@ void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len) { for (i = 0; i < len; i++, ptr++) { if (ptr->unk_36 == 1) { if (!flag) { - gSPDisplayList(POLY_OPA_DISP++, object_mu_DL_00B0A0); + gSPDisplayList(POLY_OPA_DISP++, gHoneyAndDarlingHeartMaterialDL); flag = true; } Matrix_Translate(ptr->unk_08.x, ptr->unk_08.y, ptr->unk_08.z, MTXMODE_NEW); @@ -1462,7 +1463,7 @@ void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len) { 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); + gSPDisplayList(POLY_OPA_DISP++, gHoneyAndDarlingHeartModelDL); } } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 17bec0df61..45d6661eb6 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -459,7 +459,7 @@ void func_80B10240(EnGb2* this, PlayState* play) { D_80B119B0[this->unk_280].unk_04.y, D_80B119B0[this->unk_280].unk_04.z, 0, 0, 0, this->unk_27E); if (this->unk_280 == 0) { - func_8010E9F0(1, 180); + Interface_StartTimer(TIMER_ID_MINIGAME_1, 180); } this->actionFunc = func_80B10344; } else { @@ -487,7 +487,7 @@ void func_80B10344(EnGb2* this, PlayState* play) { if (this->unk_26C & 0x200) { if (this->unk_280 == 3) { this->unk_26C &= ~0x200; - gSaveContext.unk_3DD0[1] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; func_800FE498(); gSaveContext.eventInf[4] |= 0x40; func_80B0FE7C(play); @@ -506,7 +506,7 @@ void func_80B10344(EnGb2* this, PlayState* play) { } if (gSaveContext.save.playerData.health < 49) { - gSaveContext.unk_3DD0[1] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; gSaveContext.eventInf[4] |= 0x40; gSaveContext.eventInf[4] |= 0x20; @@ -519,8 +519,8 @@ void func_80B10344(EnGb2* this, PlayState* play) { } func_80B0FE7C(play); - } else if (gSaveContext.unk_3DE0[1] == 0) { - gSaveContext.unk_3DD0[1] = 5; + } else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) { + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; gSaveContext.eventInf[4] |= 0x40; gSaveContext.eventInf[4] |= 0x10; @@ -806,11 +806,11 @@ void func_80B110F8(EnGb2* this, PlayState* play) { void func_80B111AC(EnGb2* this, PlayState* play) { s32 index; - if (play->roomCtx.currRoom.num == 1) { + if (play->roomCtx.curRoom.num == 1) { return; } - switch (play->roomCtx.currRoom.num) { + switch (play->roomCtx.curRoom.num) { case 2: index = 1; break; @@ -837,7 +837,7 @@ void func_80B111AC(EnGb2* this, PlayState* play) { } void func_80B11268(EnGb2* this, PlayState* play) { - if (play->roomCtx.currRoom.num == 1) { + if (play->roomCtx.curRoom.num == 1) { this->unk_290 = 0; this->unk_282[0] = this->actor.cutscene; if (Flags_GetClear(play, 2) && Flags_GetClear(play, 3) && Flags_GetClear(play, 4) && Flags_GetClear(play, 5)) { diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index ebbaaca7f0..a9aaedaa18 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -213,15 +213,15 @@ void func_80B3B294(EnGg2* this, PlayState* play) { Vec3s sp30; if (this->unk_2F1 == 0) { - if (play->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneId == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] |= 4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneId == SCENE_17SETUGEN) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] |= 8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] |= 0x10; @@ -239,15 +239,15 @@ void func_80B3B294(EnGg2* this, PlayState* play) { this->unk_1DC++; } else { this->unk_2F1 = 1; - if (play->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneId == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] |= 4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneId == SCENE_17SETUGEN) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] |= 8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] |= 0x10; @@ -380,14 +380,14 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { this->unk_2EC = 20; this->unk_2EA = 0; - if (play->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneId == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; this->unk_2EE = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3AFB0; - } else if (play->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneId == SCENE_17SETUGEN) { if ((gSaveContext.save.weekEventReg[20] & 4) && !(gSaveContext.save.weekEventReg[20] & 8) && !(gSaveContext.save.weekEventReg[20] & 0x10)) { gSaveContext.save.weekEventReg[20] &= (u8)~4; @@ -397,7 +397,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { } else { Actor_MarkForDeath(&this->actor); } - } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { if (!(gSaveContext.save.weekEventReg[20] & 4) && (gSaveContext.save.weekEventReg[20] & 8) && !(gSaveContext.save.weekEventReg[20] & 0x10)) { gSaveContext.save.weekEventReg[20] &= (u8)~8; 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 d3dfcd6bf1..80626d4b91 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -118,7 +118,7 @@ Color_RGBA8 D_80B533A4 = { 50, 150, 150, 0 }; u16 func_80B50410(EnGk* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->sceneNum == SCENE_17SETUGEN2) { + if (play->sceneId == SCENE_17SETUGEN2) { if (player->transformation == PLAYER_FORM_GORON) { if (!(gSaveContext.save.weekEventReg[40] & 0x80)) { switch (this->unk_31C) { @@ -164,7 +164,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { this->unk_1E4 |= 1; return 0xE81; } - } else if (play->sceneNum == SCENE_GORONRACE) { + } else if (play->sceneId == SCENE_GORONRACE) { if (player->transformation == PLAYER_FORM_GORON) { if (!(gSaveContext.save.weekEventReg[41] & 4)) { if (this->unk_31C == 0xE88) { @@ -645,7 +645,7 @@ void func_80B51760(EnGk* this, PlayState* play) { this->unk_1E4 |= 2; } } else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) && - (gSaveContext.save.entrance != 0xD010)) { + (gSaveContext.save.entrance != ENTRANCE(GORON_RACETRACK, 1))) { func_800B863C(&this->actor, play); } @@ -1018,7 +1018,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { if (ENGK_GET_F(&this->actor) == ENGK_F_1) { this->unk_2E4 = 5; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); - if (play->sceneNum == SCENE_17SETUGEN2) { + if (play->sceneId == SCENE_17SETUGEN2) { if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { Actor_MarkForDeath(&this->actor); } else { @@ -1026,7 +1026,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 0xF); this->actionFunc = func_80B51760; } - } else if (play->sceneNum == SCENE_GORONRACE) { + } else if (play->sceneId == SCENE_GORONRACE) { if (gSaveContext.save.weekEventReg[33] & 0x80) { if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { this->actionFunc = func_80B51760; 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 3faf24a1c2..b10f78ac30 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -328,8 +328,8 @@ s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) { s32 func_8094E0F8(EnGm* this, PlayState* play) { s32 ret = false; - if ((this->unk_260 != play->roomCtx.currRoom.num) && (play->roomCtx.unk31 == 0)) { - this->unk_260 = play->roomCtx.currRoom.num; + if ((this->unk_260 != play->roomCtx.curRoom.num) && (play->roomCtx.unk31 == 0)) { + this->unk_260 = play->roomCtx.curRoom.num; this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, play); this->actor.draw = NULL; this->unk_3FC = 1; @@ -762,7 +762,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { if (play->csCtx.state != 0) { if (this->unk_3F8 == 0) { - if ((play->sceneNum == SCENE_MILK_BAR) && (gSaveContext.sceneSetupIndex == 2)) { + if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.sceneSetupIndex == 2)) { func_8094E054(this, play, 0); this->unk_258 = 255; } @@ -771,7 +771,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { } ret = true; } else if (this->unk_3F8 != 0) { - if (play->sceneNum == SCENE_MILK_BAR) { + if (play->sceneId == SCENE_MILK_BAR) { this->unk_400 = 0; } this->unk_3F8 = 0; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index e5775d1296..5fc1d4c70c 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -537,7 +537,7 @@ s32 func_80A1222C(EnGo* this, PlayState* play) { if (((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) && (this->unk_3EC == 0) && (this->actor.xzDistToPlayer < 400.0f)) || - (!(gSaveContext.save.weekEventReg[22] & 4) && (play->sceneNum == SCENE_16GORON_HOUSE) && + (!(gSaveContext.save.weekEventReg[22] & 4) && (play->sceneId == SCENE_16GORON_HOUSE) && (gSaveContext.sceneSetupIndex == 0) && (this->unk_3EC == 0) && (play->csCtx.currentCsIndex == 1))) { ret = true; } @@ -710,7 +710,7 @@ s32 func_80A12868(EnGo* this, PlayState* play) { s32 func_80A12954(EnGo* this, PlayState* play) { if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (play->csCtx.state != 0) && (this->actor.draw != NULL) && - (play->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && + (play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { if (this->unk_3F0 == 0) { this->actor.flags &= ~ACTOR_FLAG_1; @@ -1411,7 +1411,7 @@ void func_80A144F4(EnGo* this, PlayState* play) { void func_80A145AC(EnGo* this, PlayState* play) { if ((ENGO_GET_70(&this->actor) == ENGO_70_1) && - (((play->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && + (((play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) || !(gSaveContext.save.weekEventReg[21] & 8))) { this->actor.child = func_80A13400(this, play); diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c index be274690ca..aa2ce49157 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.c @@ -5,6 +5,7 @@ */ #include "z_en_grasshopper.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10) @@ -15,41 +16,125 @@ void EnGrasshopper_Destroy(Actor* thisx, PlayState* play); void EnGrasshopper_Update(Actor* thisx, PlayState* play); void EnGrasshopper_Draw(Actor* thisx, PlayState* play); -#if 0 -// static DamageTable sDamageTable = { -static DamageTable D_809A8CDC = { - /* Deku Nut */ DMG_ENTRY(1, 0xF), - /* Deku Stick */ DMG_ENTRY(1, 0xF), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(1, 0xF), - /* Zora boomerang */ DMG_ENTRY(1, 0xF), - /* Normal arrow */ DMG_ENTRY(1, 0xF), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0xE), - /* Goron punch */ DMG_ENTRY(1, 0xF), - /* Sword */ DMG_ENTRY(1, 0xF), - /* Goron pound */ DMG_ENTRY(0, 0xF), - /* Fire arrow */ DMG_ENTRY(2, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0xF), - /* Deku spin */ DMG_ENTRY(1, 0xF), - /* Deku bubble */ DMG_ENTRY(1, 0xF), - /* Deku launch */ DMG_ENTRY(2, 0xF), - /* UNK_DMG_0x12 */ DMG_ENTRY(1, 0xF), - /* Zora barrier */ DMG_ENTRY(1, 0xF), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0xF), - /* Zora punch */ DMG_ENTRY(1, 0xF), - /* Spin attack */ DMG_ENTRY(1, 0xF), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0xE), +void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex); +void EnGrasshopper_RaiseTail(EnGrasshopper* this); +void EnGrasshopper_LowerTail(EnGrasshopper* this); +void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_SetupFly(EnGrasshopper* this); +void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_SetupBank(EnGrasshopper* this); +void EnGrasshopper_Bank(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_SetupBounced(EnGrasshopper* this); +void EnGrasshopper_Bounced(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_SetupApproachPlayer(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_ApproachPlayer(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_SetupAttack(EnGrasshopper* this); +void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_SetupWaitAfterAttack(EnGrasshopper* this); +void EnGrasshopper_WaitAfterAttack(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_Damaged(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_SetupFall(EnGrasshopper* this); +void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_InitializeEffect(EnGrasshopper* this, Vec3f* pos); +void EnGrasshopper_UpdateEffects(EnGrasshopper* this, PlayState* play); +void EnGrasshopper_DrawEffects(EnGrasshopper* this, PlayState* play); + +typedef enum { + /* 0 */ EN_GRASSHOPPER_ACTION_FLY, + /* 1 */ EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES, + /* 2 */ EN_GRASSHOPPER_ACTION_BANK, + /* 3 */ EN_GRASSHOPPER_ACTION_BOUNCED, + /* 4 */ EN_GRASSHOPPER_ACTION_DECIDE_ACTION, + /* 5 */ EN_GRASSHOPPER_ACTION_APPROACH_PLAYER, + /* 6 */ EN_GRASSHOPPER_ACTION_ATTACK, + /* 7 */ EN_GRASSHOPPER_ACTION_WAIT_AFTER_ATTACK, + /* 8 */ EN_GRASSHOPPER_ACTION_DAMAGED, + /* 9 */ EN_GRASSHOPPER_ACTION_DEAD, + /* 10 */ EN_GRASSHOPPER_ACTION_FALL, +} EnGrasshopperAction; + +typedef enum { + /* 0 */ EN_GRASSHOPPER_DECISION_ATTACK, + /* 1 */ EN_GRASSHOPPER_DECISION_FLY, + /* 2 */ EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES, // Never used in the final game +} EnGrasshopperNextAction; + +typedef enum { + /* 0 */ EN_GRASSHOPPER_BANK_STATE_BANKING, + /* 1 */ EN_GRASSHOPPER_BANK_STATE_DONE, +} EnGrasshopperBankState; + +typedef enum { + /* 0 */ EN_GRASSHOPPER_ANIM_RAISE_TAIL, + /* 1 */ EN_GRASSHOPPER_ANIM_LOWER_TAIL, + /* 2 */ EN_GRASSHOPPER_ANIM_FLY, + /* 3 */ EN_GRASSHOPPER_ANIM_ATTACK, + /* 4 */ EN_GRASSHOPPER_ANIM_HOVER, + /* 5 */ EN_GRASSHOPPER_ANIM_DAMAGE, + /* 6 */ EN_GRASSHOPPER_ANIM_DEAD, + /* 7 */ EN_GRASSHOPPER_ANIM_FALL, +} EnGrasshopperAnim; + +static s32 sOccupiedIndices[] = { + false, false, false, false, false, +}; + +static s8 sLimbIndexToShadowBodyPartsIndex[DRAGONFLY_LIMB_MAX] = { + -1, -1, 0, 1, 2, 3, 4, 5, -1, -1, 6, 7, -1, 8, 9, -1, 10, 11, -1, 12, 13, -1, -1, -1, +}; + +static s8 sParentBodyParts[DRAGONFLY_LIMB_MAX] = { + -1, -1, -1, 0, 1, 2, 3, -1, -1, -1, -1, 6, -1, -1, 8, -1, -1, 10, -1, -1, 12, -1, -1, -1, +}; + +static u8 sShadowSizes[DRAGONFLY_LIMB_MAX] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +typedef enum { + /* 0x0 */ EN_GRASSHOPPER_DMGEFF_IMMUNE, // Deals no damage + /* 0x2 */ EN_GRASSHOPPER_DMGEFF_FIRE = 0x2, // Damages and sets the Dragonfly on fire + /* 0x3 */ EN_GRASSHOPPER_DMGEFF_FREEZE, // Damages and freezes the Dragonfly in ice + /* 0x4 */ EN_GRASSHOPPER_DMGEFF_LIGHT_ORB, // Damages and surrounds the Dragonfly with light orbs + /* 0xE */ EN_GRASSHOPPER_DMGEFF_HOOK = 0xE, // If hit by the Hookshot, it pulls the Dragonfly towards the player + /* 0xF */ EN_GRASSHOPPER_DMGEFF_NONE, // Deals regular damage with no extra effect +} EnDragonflyDamageEffect; + +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Deku Stick */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* Explosives */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* Hookshot */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_HOOK), + /* Goron punch */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_FREEZE), + /* Light arrow */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_LIGHT_ORB), + /* Goron spikes */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Deku bubble */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, EN_GRASSHOPPER_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Zora barrier */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Normal shield */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* Light ray */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* Thrown object */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* Normal Roll */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* Unblockable */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, EN_GRASSHOPPER_DMGEFF_IMMUNE), + /* Powder Keg */ DMG_ENTRY(1, EN_GRASSHOPPER_DMGEFF_HOOK), }; const ActorInit En_Grasshopper_InitVars = { @@ -64,92 +149,996 @@ const ActorInit En_Grasshopper_InitVars = { (ActorFunc)EnGrasshopper_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[2] = { -static ColliderJntSphElementInit D_809A8D1C[2] = { +static ColliderJntSphElementInit sJntSphElementsInit[2] = { { - { ELEMTYPE_UNK3, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, - { 7, { { 0, 0, 0 }, 0 }, 0 }, + { + ELEMTYPE_UNK3, + { 0xF7CFFFFF, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, + { DRAGONFLY_LIMB_THORAX, { { 0, 0, 0 }, 0 }, 0 }, }, { - { ELEMTYPE_UNK2, { 0xF7CFFFFF, 0x07, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, - { 6, { { 0, 0, 0 }, 0 }, 0 }, + { + ELEMTYPE_UNK2, + { 0xF7CFFFFF, 0x07, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, + { DRAGONFLY_LIMB_TAIL_TIP, { { 0, 0, 0 }, 0 }, 0 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_809A8D64 = { - { COLTYPE_HIT2, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_1, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), D_809A8D1C, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_HIT2, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_1, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; -#endif +void EnGrasshopper_Init(Actor* thisx, PlayState* play) { + EnGrasshopper* this = THIS; + s32 i; -extern DamageTable D_809A8CDC; -extern ColliderJntSphElementInit D_809A8D1C[2]; -extern ColliderJntSphInit D_809A8D64; + this->actor.hintId = TATL_HINT_ID_DRAGONFLY; + this->actor.targetMode = 4; + this->actor.colChkInfo.mass = 60; + this->actor.colChkInfo.health = 2; -extern UNK_TYPE D_06000F9C; + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + this->collider.elements[0].dim.modelSphere.radius = 1; + this->collider.elements[0].dim.scale = 22.0f; + this->collider.elements[1].dim.modelSphere.radius = 1; + this->collider.elements[1].dim.scale = 16.0f; + this->collider.elements[1].dim.modelSphere.center.x = 1000; + this->collider.elements[0].dim.modelSphere.center.x = this->collider.elements[0].dim.modelSphere.center.y = + this->collider.elements[0].dim.modelSphere.center.z = this->collider.elements[1].dim.modelSphere.center.y = + this->collider.elements[1].dim.modelSphere.center.z = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/EnGrasshopper_Init.s") + this->actor.flags |= ACTOR_FLAG_200; + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 1.0f); + this->actor.colChkInfo.damageTable = &sDamageTable; + Math_Vec3f_Copy(&this->flyingHomePos, &this->actor.home.pos); + this->action = EN_GRASSHOPPER_ACTION_FLY; + this->index = -1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/EnGrasshopper_Destroy.s") + for (i = 0; i < ARRAY_COUNT(sOccupiedIndices); i++) { + if (!sOccupiedIndices[i]) { + this->index = i; + sOccupiedIndices[i] = true; + break; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6524.s") + // Deciding a random index like this if all indices are occupied causes a bug in EnGrasshopper_Destroy. + if (this->index < 0) { + this->index = Rand_ZeroFloat(4.99f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A65D8.s") + SkelAnime_Init(play, &this->skelAnime, &gDragonflySkel, &gDragonflyFlyAnim, this->jointTable, this->morphTable, + DRAGONFLY_LIMB_MAX); + this->type = EN_GRASSHOPPER_GET_TYPE(&this->actor); + if (this->type < EN_GRASSHOPPER_TYPE_UNUSED_NORMAL) { + this->type = EN_GRASSHOPPER_TYPE_NORMAL; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6628.s") + if (this->type != EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED) { + this->dragonflyScale = 0.01f; + } else { + this->dragonflyScale = 0.0f; + Actor_SetScale(&this->actor, 0.0f); + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + Math_Vec3f_Copy(&this->flyingHomePos, &this->actor.world.pos); + this->flyingHomePos.y += 90.0f; + this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[1].dim.modelSphere.radius = + this->type; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6668.s") + this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + EnGrasshopper_SetupFly(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6754.s") +void EnGrasshopper_Destroy(Actor* thisx, PlayState* play) { + EnGrasshopper* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A67A4.s") + Collider_DestroyJntSph(play, &this->collider); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6B6C.s") + //! @bug If the dragonfly selected a random index in EnGrasshopper_Init (because all indices were occupied), + //! then two dragonflies will have the same index. When one of those dragonflies sharing an index is destroyed, + //! it will mark the index as unoccupied, when it still occupied by at least one dragonfly. + sOccupiedIndices[this->index] = false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6E18.s") +static AnimationHeader* sAnimations[] = { + &gDragonflyRaiseTailAnim, // EN_GRASSHOPPER_ANIM_RAISE_TAIL + &gDragonflyLowerTailAnim, // EN_GRASSHOPPER_ANIM_LOWER_TAIL + &gDragonflyFlyAnim, // EN_GRASSHOPPER_ANIM_FLY + &gDragonflyAttackAnim, // EN_GRASSHOPPER_ANIM_ATTACK + &gDragonflyHoverAnim, // EN_GRASSHOPPER_ANIM_HOVER + &gDragonflyDamageAnim, // EN_GRASSHOPPER_ANIM_DAMAGE + &gDragonflyDeadAnim, // EN_GRASSHOPPER_ANIM_DEAD + &gDragonflyFallAnim, // EN_GRASSHOPPER_ANIM_FALL +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6E74.s") +static u8 sAnimationModes[] = { + ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_RAISE_TAIL + ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_LOWER_TAIL + ANIMMODE_LOOP, // EN_GRASSHOPPER_ANIM_FLY + ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_ATTACK + ANIMMODE_LOOP, // EN_GRASSHOPPER_ANIM_HOVER + ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_DAMAGE + ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_DEAD + ANIMMODE_ONCE, // EN_GRASSHOPPER_ANIM_FALL +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A6F8C.s") +void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex) { + f32 morphFrames; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A700C.s") + this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]); + morphFrames = 0.0f; + if ((animIndex == EN_GRASSHOPPER_ANIM_ATTACK) || (animIndex == EN_GRASSHOPPER_ANIM_HOVER) || + (animIndex == EN_GRASSHOPPER_ANIM_DAMAGE)) { + morphFrames = -3.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7134.s") + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->endFrame, sAnimationModes[animIndex], + morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A71CC.s") +void EnGrasshopper_RaiseTail(EnGrasshopper* this) { + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_RAISE_TAIL); + if (this->decision != EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES) { + this->decision = EN_GRASSHOPPER_DECISION_FLY; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7494.s") + this->action = EN_GRASSHOPPER_ACTION_DECIDE_ACTION; + this->actionFunc = EnGrasshopper_DecideAction; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A753C.s") +void EnGrasshopper_LowerTail(EnGrasshopper* this) { + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_LOWER_TAIL); + this->action = EN_GRASSHOPPER_ACTION_DECIDE_ACTION; + this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + this->actionFunc = EnGrasshopper_DecideAction; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7844.s") +void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A78EC.s") + if (curFrame >= this->endFrame) { + if (this->decision == EN_GRASSHOPPER_DECISION_ATTACK) { + EnGrasshopper_SetupAttack(this); + } else { + Math_Vec3f_Copy(&this->flyingHomePos, &this->actor.world.pos); + this->flyingHomePos.y = this->actor.floorHeight + 90.0f; + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY); + if (this->decision != EN_GRASSHOPPER_DECISION_ROAM_IN_CIRCLES) { + if (Player_GetMask(play) == PLAYER_MASK_STONE) { + EnGrasshopper_SetupFly(this); + } else { + EnGrasshopper_SetupApproachPlayer(this, play); + } + } else { + this->timer = 0; + this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; + this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + this->waitTimer = this->timer; + this->actionFunc = EnGrasshopper_RoamInCircles; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A797C.s") +void EnGrasshopper_SetupFly(EnGrasshopper* this) { + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FLY); + this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + this->action = EN_GRASSHOPPER_ACTION_FLY; + this->actionFunc = EnGrasshopper_Fly; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7A8C.s") +void EnGrasshopper_Fly(EnGrasshopper* this, PlayState* play) { + f32 diffX; + f32 diffZ; + f32 targetSpeed; + Vec3f collisionCheckPos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7AE4.s") + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + diffX = this->flyingHomePos.x - this->actor.world.pos.x; + diffZ = this->flyingHomePos.z - this->actor.world.pos.z; + if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && + (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + this->bobPhase += 0xAF0; + this->targetPosY = (Math_SinS(this->bobPhase) * 10.0f) + this->baseFlyHeight; + Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); + collisionCheckPos.x = (Math_SinS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.x; + collisionCheckPos.y = this->actor.world.pos.y; + collisionCheckPos.z = (Math_CosS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7BBC.s") + if (this->collider.elements[0].info.ocElemFlags & OCELEM_HIT) { + this->shouldTurn = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7C98.s") + if (BgCheck_SphVsFirstPoly(&play->colCtx, &collisionCheckPos, 10.0f)) { + this->shouldTurn = true; + } else { + this->shouldTurn = false; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A7CE0.s") + //! @bug Unreachable code. To get here, the type must NOT be EN_GRASSHOPPER_TYPE_WOODFALL + if (this->type == EN_GRASSHOPPER_TYPE_WOODFALL) { + if (sqrtf(SQ(this->actor.world.pos.x) + SQ(this->actor.world.pos.z)) < 600.0f) { + this->shouldTurn = true; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A8044.s") + if (this->shouldTurn) { + this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + this->targetRot.y = Math_Atan2S(diffX, diffZ); + this->timer = Rand_S16Offset(30, 30); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/EnGrasshopper_Update.s") + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && !(gSaveContext.eventInf[4] & 2) && !this->shouldTurn && + (this->actor.xzDistToPlayer < 200.0f)) { + EnGrasshopper_SetupApproachPlayer(this, play); + } else { + Math_SmoothStepToS(&this->actor.world.rot.z, this->targetRot.z, 5, 0x3E8, 5); + this->targetRot.z *= 0.8f; + if (this->waitTimer != 0) { + Math_ApproachZeroF(&this->actor.speedXZ, 0.2f, 0.5f); + } else { + this->targetRot.z = (this->actor.world.rot.y - this->targetRot.y) * 0.2f; + targetSpeed = (this->index * 0.1f) + 4.0f; + Math_ApproachF(&this->actor.speedXZ, targetSpeed, 0.4f, 0.7f); + Math_ApproachF(&this->rotationalVelocity, 2000.0f, 1.0f, 50.0f); + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->rotationalVelocity, 5); + if (this->timer == 0) { + if (Rand_ZeroFloat(1.0f) < 0.3f) { + this->waitTimer = Rand_S16Offset(10, 10); + this->rotationalVelocity = 0.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A847C.s") + this->targetRot.y = Math_Atan2S(diffX, diffZ); + this->timer = Rand_S16Offset(30, 70); + this->baseFlyHeight = randPlusMinusPoint5Scaled(50.0f) + this->flyingHomePos.y; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/EnGrasshopper_Draw.s") +/** + * Unused in the final game. Makes the dragonfly roam the area in a very wide circular arc. + */ +void EnGrasshopper_RoamInCircles(EnGrasshopper* this, PlayState* play) { + f32 diffX; + f32 diffZ; + f32 targetSpeed; + s16 rotationSpeed; + s32 pad; + Vec3f collisionCheckPos; + Player* player = GET_PLAYER(play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A8870.s") + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + if (Player_GetMask(play) == PLAYER_MASK_STONE) { + EnGrasshopper_SetupFly(this); + } else { + diffX = player->actor.world.pos.x - this->actor.world.pos.x; + diffZ = player->actor.world.pos.z - this->actor.world.pos.z; + this->bobPhase += 0xAF0; + this->targetPosY = player->actor.world.pos.y + 60.0f; + this->baseFlyHeight = Math_SinS(this->bobPhase) * 10.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A8924.s") + if (this->timer == 0) { + this->baseFlyHeight = randPlusMinusPoint5Scaled(10.0f); + this->timer = Rand_S16Offset(30, 30); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Grasshopper/func_809A8A64.s") + Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); + collisionCheckPos.x = (Math_SinS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.x; + collisionCheckPos.y = this->actor.world.pos.y; + collisionCheckPos.z = (Math_CosS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.z; + + if ((this->actor.bgCheckFlags & 8) || BgCheck_SphVsFirstPoly(&play->colCtx, &collisionCheckPos, 10.0f)) { + EnGrasshopper_SetupBank(this); + } else if (player->stateFlags1 & PLAYER_STATE1_8000000) { + this->collider.elements[0].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); + EnGrasshopper_RaiseTail(this); + } else if (this->collider.base.atFlags & AT_BOUNCED) { + this->collider.elements[0].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); + EnGrasshopper_SetupBounced(this); + } else { + this->targetRot.z = (this->actor.world.rot.y - this->targetRot.y) * 0.2f; + Math_SmoothStepToS(&this->actor.world.rot.z, this->targetRot.z, 5, 0x3E8, 5); + rotationSpeed = this->index + 70; + targetSpeed = (this->index * 0.05f) + 4.0f; + this->targetRot.y = Math_Atan2S(diffX, diffZ); + Math_ApproachF(&this->actor.speedXZ, targetSpeed, 0.4f, 0.8f); + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, rotationSpeed, 0xFA0, 0xA); + } + } +} + +/** + * Unused in the final game. + */ +void EnGrasshopper_SetupBank(EnGrasshopper* this) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + this->targetBankRot.y = this->actor.world.rot.y + 0x8000; + this->action = EN_GRASSHOPPER_ACTION_BANK; + this->bankState = EN_GRASSHOPPER_BANK_STATE_BANKING; + this->actor.speedXZ = 2.0f; + this->actionFunc = EnGrasshopper_Bank; +} + +/** + * Unused in the final game. Makes the dragonfly perform a wide banking turn on its side, then + * it flies forward for 100 frames. + */ +void EnGrasshopper_Bank(EnGrasshopper* this, PlayState* play) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + switch (this->bankState) { + case EN_GRASSHOPPER_BANK_STATE_BANKING: + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetBankRot.y, 0x64, 0x3E8, 0x3E8); + Math_SmoothStepToS(&this->actor.world.rot.z, 0x4000, 0x64, 0x1F40, 0xBB8); + if (fabsf(this->actor.world.rot.y - (f32)this->targetBankRot.y) < 10.0f) { + this->postBankTimer = 100; + this->bankState = EN_GRASSHOPPER_BANK_STATE_DONE; + } + break; + + case EN_GRASSHOPPER_BANK_STATE_DONE: + Math_SmoothStepToS(&this->actor.world.rot.z, 0, 0x64, 0x1F40, 0xBB8); + if (this->postBankTimer == 0) { + this->timer = 0; + this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; + this->decision = EN_GRASSHOPPER_DECISION_ATTACK; + this->waitTimer = this->timer; + this->actionFunc = EnGrasshopper_RoamInCircles; + } + break; + } +} + +/** + * Unused in the final game. + */ +void EnGrasshopper_SetupBounced(EnGrasshopper* this) { + this->targetRot.y = -this->actor.yawTowardsPlayer; + this->timer = Rand_S16Offset(30, 30); + this->targetRot.z = (this->actor.world.rot.y - this->targetRot.y) * 0.2f; + this->action = EN_GRASSHOPPER_ACTION_BOUNCED; + this->actionFunc = EnGrasshopper_Bounced; +} + +/** + * Unused in the final game. Makes the dragonfly rotate away from the player, then go + * back to roaming in circles. + */ +void EnGrasshopper_Bounced(EnGrasshopper* this, PlayState* play) { + f32 targetSpeed; + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + targetSpeed = (this->index * 0.05f) + 7.0f; + Math_ApproachF(&this->actor.speedXZ, targetSpeed, 0.4f, 0.8f); + Math_SmoothStepToS(&this->actor.world.rot.z, this->targetRot.z, 5, 0x3E8, 5); + this->targetRot.z *= 0.8f; + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetRot.y, 5, this->rotationalVelocity, 5); + if (this->timer == 0) { + this->collider.elements[0].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); + this->timer = 0; + this->action = EN_GRASSHOPPER_ACTION_ROAM_IN_CIRCLES; + this->waitTimer = this->timer; + this->actionFunc = EnGrasshopper_RoamInCircles; + } +} + +void EnGrasshopper_SetupApproachPlayer(EnGrasshopper* this, PlayState* play) { + s32 pad; + Player* player = GET_PLAYER(play); + + this->timer = 50; + this->action = EN_GRASSHOPPER_ACTION_APPROACH_PLAYER; + this->approachSpeed = 0.0f; + this->targetApproachPos.x = (Math_SinS(player->actor.shape.rot.y) * 130.0f) + player->actor.world.pos.x; + this->targetApproachPos.z = (Math_CosS(player->actor.shape.rot.y) * 130.0f) + player->actor.world.pos.z; + this->actionFunc = EnGrasshopper_ApproachPlayer; +} + +/** + * Approaches the player in preparation for an attack. It will also attack if the timer reaches 0. + */ +void EnGrasshopper_ApproachPlayer(EnGrasshopper* this, PlayState* play) { + Player* player = GET_PLAYER(play); + WaterBox* waterBox; + Vec3f splashPos; + + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_FLY - SFX_FLAG); + this->bobPhase += 0xAF0; + this->targetApproachPos.y = (Math_SinS(this->bobPhase) * 10.0f) + (player->actor.world.pos.y + 120.0f); + + Math_SmoothStepToS(&this->actor.world.rot.z, 0, 5, 0x3E8, 5); + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.shape.rot.y, 0xA, 0xFA0, 0xA); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA); + Math_ApproachF(&this->actor.world.pos.x, this->targetApproachPos.x, 0.3f, this->approachSpeed); + Math_ApproachF(&this->actor.world.pos.y, this->targetApproachPos.y, 0.1f, this->approachSpeed); + Math_ApproachF(&this->actor.world.pos.z, this->targetApproachPos.z, 0.3f, this->approachSpeed); + Math_ApproachF(&this->approachSpeed, 7.0f, 0.3f, 1.0f); + + if (WaterBox_GetSurface1(play, &play->colCtx, this->tailTipPos.x, this->tailTipPos.z, &this->waterSurface, + &waterBox)) { + if (this->tailTipPos.y < this->waterSurface) { + if ((this->splashCount < 3) || !(play->gameplayFrames % 8)) { + this->splashCount++; + Math_Vec3f_Copy(&splashPos, &this->tailTipPos); + splashPos.x += randPlusMinusPoint5Scaled(20.0f); + splashPos.z += randPlusMinusPoint5Scaled(20.0f); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (((s32)Rand_ZeroOne() * 100) + 400)); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + } + } else { + this->splashCount = 0; + } + } + + if ((this->timer == 0) || ((fabsf(this->targetApproachPos.x - this->actor.world.pos.x) <= 10.0f) && + (fabsf(this->targetApproachPos.y - this->actor.world.pos.y) <= 20.0f) && + (fabsf(this->targetApproachPos.z - this->actor.world.pos.z) <= 10.0f))) { + EnGrasshopper_LowerTail(this); + } +} + +void EnGrasshopper_SetupAttack(EnGrasshopper* this) { + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_ATTACK); + this->approachSpeed = 0.0f; + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA); + this->actor.speedXZ = 3.0f; + this->baseFlyHeight = this->actor.world.pos.y; + this->collider.elements[0].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); + this->collider.elements[1].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_ATTACK); + this->action = EN_GRASSHOPPER_ACTION_ATTACK; + this->actionFunc = EnGrasshopper_Attack; +} + +void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play) { + Player* player = GET_PLAYER(play); + f32 curFrame = this->skelAnime.curFrame; + Vec3f hitPos; + Vec3f diff; + f32 playerToHitPosDist; + s32 i; + WaterBox* waterBox; + Vec3f splashPos; + + for (i = 0; i < 6; i++) { + EnGrasshopper_InitializeEffect(this, &this->tailTipPos); + } + + if (WaterBox_GetSurface1(play, &play->colCtx, this->tailTipPos.x, this->tailTipPos.z, &this->waterSurface, + &waterBox)) { + if (this->tailTipPos.y < this->waterSurface) { + if ((this->splashCount < 3) || !(play->gameplayFrames % 8)) { + this->splashCount++; + Math_Vec3f_Copy(&splashPos, &this->tailTipPos); + splashPos.x += randPlusMinusPoint5Scaled(20.0f); + splashPos.z += randPlusMinusPoint5Scaled(20.0f); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, ((s32)Rand_ZeroOne() * 100) + 400); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + } + } else { + this->splashCount = 0; + } + } + + this->bobPhase += 0xAF0; + this->targetApproachPos.y = (Math_SinS(this->bobPhase) * 10.0f) + (player->actor.world.pos.y + 60.0f); + + hitPos.x = this->collider.elements[1].info.bumper.hitPos.x; + hitPos.y = this->collider.elements[1].info.bumper.hitPos.y; + hitPos.z = this->collider.elements[1].info.bumper.hitPos.z; + diff.x = hitPos.x - player->actor.world.pos.x; + diff.y = hitPos.y - player->actor.world.pos.y; + diff.z = hitPos.z - player->actor.world.pos.z; + playerToHitPosDist = sqrtf(SQXYZ(diff)); + + if ((this->collider.base.atFlags & AT_BOUNCED) || + ((player->stateFlags1 & PLAYER_STATE1_400000) && (playerToHitPosDist <= 60.0f) && + ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) < 0x2000) && + ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) > -0x2000))) { + this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); + } + + Math_ApproachF(&this->actor.world.pos.y, this->targetApproachPos.y, 0.1f, this->approachSpeed); + Math_ApproachF(&this->approachSpeed, 10.0f, 0.1f, 1.0f); + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA); + if (curFrame >= this->endFrame) { + EnGrasshopper_SetupWaitAfterAttack(this); + } +} + +void EnGrasshopper_SetupWaitAfterAttack(EnGrasshopper* this) { + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_HOVER); + this->bobPhase += 0xAF0; + this->targetPosY = (Math_SinS(this->bobPhase) * 10.0f) + this->baseFlyHeight; + Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); + this->action = EN_GRASSHOPPER_ACTION_WAIT_AFTER_ATTACK; + this->waitTimer = 20; + this->actor.speedXZ = 0.0f; + this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); + this->actionFunc = EnGrasshopper_WaitAfterAttack; +} + +/** + * Hover in place for a bit after an attack before raising the tail back up. + */ +void EnGrasshopper_WaitAfterAttack(EnGrasshopper* this, PlayState* play) { + this->bobPhase += 0xAF0; + this->targetPosY = (Math_SinS(this->bobPhase) * 10.0f) + this->baseFlyHeight; + Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); + if (this->waitTimer == 0) { + this->collider.elements[0].info.toucherFlags |= (TOUCH_ON | TOUCH_SFX_WOOD); + EnGrasshopper_RaiseTail(this); + } +} + +void EnGrasshopper_SetupDamaged(EnGrasshopper* this, PlayState* play) { + Vec3f damagedVelocity; + + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DAMAGE); + this->actor.speedXZ = 0.0f; + this->actor.flags |= ACTOR_FLAG_1; + this->approachSpeed = 0.0f; + this->collider.elements[1].info.toucherFlags &= ~(TOUCH_ON | TOUCH_SFX_WOOD); + Matrix_RotateYS(this->actor.yawTowardsPlayer, MTXMODE_NEW); + Matrix_MultVecZ(-20.0f, &damagedVelocity); + Math_Vec3f_Copy(&this->damagedVelocity, &damagedVelocity); + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer != 0)) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.3f, 0.2f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 8); + this->action = EN_GRASSHOPPER_ACTION_DAMAGED; + this->actionFunc = EnGrasshopper_Damaged; +} + +void EnGrasshopper_Damaged(EnGrasshopper* this, PlayState* play) { + Math_SmoothStepToS(&this->actor.world.rot.z, 0, 5, 0x3E8, 5); + if (this->actor.colorFilterTimer == 0) { + EnGrasshopper_RaiseTail(this); + } +} + +void EnGrasshopper_SetupDead(EnGrasshopper* this, PlayState* play) { + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_DEAD); + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.speedXZ = 0.0f; + this->approachSpeed = 0.0f; + this->actor.velocity.y = 5.0f; + this->actor.gravity = -0.5f; + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 25); + Enemy_StartFinishingBlow(play, &this->actor); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_DEAD); + this->action = EN_GRASSHOPPER_ACTION_DEAD; + this->actionFunc = EnGrasshopper_Dead; +} + +/** + * Plays the death animation before transitioning to falling from the sky. + */ +void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play) { + f32 curFrame = this->skelAnime.curFrame; + + Math_SmoothStepToS(&this->actor.world.rot.z, 0, 5, 0x3E8, 5); + if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer < 2)) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.3f, 0.2f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + if (curFrame >= this->endFrame) { + this->actor.flags &= ~ACTOR_FLAG_10; + EnGrasshopper_SetupFall(this); + } +} + +void EnGrasshopper_SetupFall(EnGrasshopper* this) { + EnGrasshopper_ChangeAnim(this, EN_GRASSHOPPER_ANIM_FALL); + this->action = EN_GRASSHOPPER_ACTION_FALL; + this->actor.speedXZ = 0.0f; + this->approachSpeed = 0.0f; + this->actionFunc = EnGrasshopper_Fall; +} + +/** + * Falls from the sky and bursts into flames once it touches land or water. + */ +void EnGrasshopper_Fall(EnGrasshopper* this, PlayState* play) { + WaterBox* waterBox; + f32 waterSurface; + s32 isUnderWater = false; + + this->actor.shape.rot.y += 0x1388; + if ((this->actor.floorHeight <= -32000.0f) || (this->actor.floorHeight >= 32000.0f)) { + Actor_MarkForDeath(&this->actor); + return; + } + + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &waterSurface, + &waterBox)) { + if (this->actor.world.pos.y < waterSurface) { + Vec3f splashPos; + s32 i; + + for (i = 0; i < 3; i++) { + Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); + splashPos.x += randPlusMinusPoint5Scaled((i * 5.0f) + 20.0f); + splashPos.z += randPlusMinusPoint5Scaled((i * 5.0f) + 20.0f); + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, (((s32)Rand_ZeroOne() * 100) + 400)); + } + + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_BOMB_DROP_WATER); + isUnderWater = true; + } + } + + if ((BgCheck_SphVsFirstPoly(&play->colCtx, &this->tailTipPos, 40.0f)) && + (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX)) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && + (this->drawDmgEffTimer != 0)) { + Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.3f, 0.2f); + this->drawDmgEffTimer = 0; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + } + + if (isUnderWater || (BgCheck_SphVsFirstPoly(&play->colCtx, &this->tailTipPos, 10.0f))) { + Vec3f firePos; + Vec3f sFireVelocityAndAccel[] = { + { 1.0f, 0.0f, 0.5f }, { 1.0f, 0.0f, -0.5f }, { -1.0f, 0.0f, 0.5f }, + { -1.0f, 0.0f, -0.5f }, { 0.5f, 0.0f, 1.0f }, { -0.5f, 0.0f, 1.0f }, + { 0.5f, 0.0f, -1.0f }, { -0.5f, 0.0f, -1.0f }, { 0.0f, 0.0f, 0.0f }, + }; + s32 i; + + for (i = 0; i < ARRAY_COUNT(sFireVelocityAndAccel); i++) { + Math_Vec3f_Copy(&firePos, &this->actor.world.pos); + firePos.x += randPlusMinusPoint5Scaled(30.0f); + if (!isUnderWater) { + firePos.y = this->actor.floorHeight; + } else if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, + &waterSurface, &waterBox)) { + firePos.y = waterSurface; + } + + firePos.z += randPlusMinusPoint5Scaled(30.0f); + func_800B3030(play, &firePos, &sFireVelocityAndAccel[i], &sFireVelocityAndAccel[i], 100, 0, 2); + } + + SoundSource_PlaySfxEachFrameAtFixedWorldPos(play, &this->actor.world.pos, 10, + NA_SE_EN_COMMON_EXTINCT_LEV - SFX_FLAG); + Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x60); + Actor_MarkForDeath(&this->actor); + } +} + +void EnGrasshopper_UpdateDamage(EnGrasshopper* this, PlayState* play) { + s32 pad; + s16 attackDealsDamage = false; + + if ((this->collider.elements[0].info.bumperFlags & BUMP_HIT) || + (this->collider.elements[1].info.bumperFlags & BUMP_HIT)) { + this->collider.base.acFlags &= ~AC_HIT; + if ((this->action != EN_GRASSHOPPER_ACTION_DAMAGED) && (this->action != EN_GRASSHOPPER_ACTION_DEAD) && + (this->action != EN_GRASSHOPPER_ACTION_FALL)) { + if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_NONE) { + attackDealsDamage = true; + } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_FIRE) { + this->drawDmgEffTimer = 40; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; + attackDealsDamage = true; + } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_FREEZE) { + if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_BLUE_FIRE) || (this->drawDmgEffTimer == 0)) { + Actor_ApplyDamage(&this->actor); + attackDealsDamage = false; + this->drawDmgEffTimer = 80; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; + this->drawDmgEffScale = 0.0f; + this->drawDmgEffFrozenSteamScale = 1.5f; + } + + if (this->actor.colChkInfo.health <= 0) { + EnGrasshopper_SetupDead(this, play); + return; + } + } else if (this->actor.colChkInfo.damageEffect == EN_GRASSHOPPER_DMGEFF_LIGHT_ORB) { + Actor_SetColorFilter(&this->actor, 0x8000, 255, 0, 25); + this->drawDmgEffTimer = 20; + this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->actor.focus.pos.x, this->actor.focus.pos.y, + this->actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + attackDealsDamage = true; + } + } + } + + if (attackDealsDamage) { + Actor_ApplyDamage(&this->actor); + if (this->actor.colChkInfo.health > 0) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BATTA_DAMAGE); + EnGrasshopper_SetupDamaged(this, play); + } else { + EnGrasshopper_SetupDead(this, play); + } + } +} + +void EnGrasshopper_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnGrasshopper* this = THIS; + + SkelAnime_Update(&this->skelAnime); + EnGrasshopper_UpdateDamage(this, play); + this->actionFunc(this, play); + + Actor_SetFocus(&this->actor, 0.0f); + Actor_SetScale(&this->actor, this->dragonflyScale); + + DECR(this->timer); + DECR(this->waitTimer); + DECR(this->postBankTimer); + DECR(this->drawDmgEffTimer); + + Actor_MoveWithGravity(&this->actor); + this->actor.world.pos.x += this->damagedVelocity.x; + this->actor.world.pos.y += this->damagedVelocity.y; + this->actor.world.pos.z += this->damagedVelocity.z; + Math_ApproachZeroF(&this->damagedVelocity.x, 1.0f, 2.0f); + Math_ApproachZeroF(&this->damagedVelocity.y, 1.0f, 2.0f); + Math_ApproachZeroF(&this->damagedVelocity.z, 1.0f, 2.0f); + if ((this->action != EN_GRASSHOPPER_ACTION_FALL) && (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D); + } + + this->actor.shape.rot.z = this->actor.world.rot.z; + if (this->type == EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED) { + f32 targetScale = this->type * 0.01f; + + if (targetScale >= 0.018f) { + targetScale = 0.018f; + } + + Math_ApproachF(&this->dragonflyScale, targetScale, 0.1f, 0.01f); + } + + if ((this->action != EN_GRASSHOPPER_ACTION_FALL) && (this->action != EN_GRASSHOPPER_ACTION_APPROACH_PLAYER)) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 5, 0x3E8, 5); + } + + EnGrasshopper_UpdateEffects(this, play); + if ((this->action != EN_GRASSHOPPER_ACTION_DEAD) && (this->action != EN_GRASSHOPPER_ACTION_FALL)) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + if ((this->action == EN_GRASSHOPPER_ACTION_APPROACH_PLAYER) || (this->action == EN_GRASSHOPPER_ACTION_ATTACK)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } + } +} + +void EnGrasshopper_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnGrasshopper* this = THIS; + Vec3f sEffectOffsetFromTailTop = { 500.0f, 0.0f, 0.0f }; + Vec3f sZeroVec3f = { 0.0f, 0.0f, 0.0f }; + + Matrix_Push(); + + if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && + (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + if ((s8)(sLimbIndexToShadowBodyPartsIndex[limbIndex] >= 0)) { + Matrix_MultVec3f(&sZeroVec3f, &this->shadowBodyPartsPos[sLimbIndexToShadowBodyPartsIndex[limbIndex]]); + } + } + + if (limbIndex == DRAGONFLY_LIMB_TAIL_TIP) { + Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_MultVec3f(&gZeroVec3f, &this->tailTipPos); + Matrix_MultVec3f(&sEffectOffsetFromTailTop, &this->effectBasePos); + } + + Collider_UpdateSpheres(limbIndex, &this->collider); + if ((limbIndex == DRAGONFLY_LIMB_ROOT) || (limbIndex == DRAGONFLY_LIMB_TAIL_SEGMENT_2) || + (limbIndex == DRAGONFLY_LIMB_TAIL_TIP) || (limbIndex == DRAGONFLY_LIMB_BACK_LEFT_UPPER_LEG) || + (limbIndex == DRAGONFLY_LIMB_BACK_RIGHT_UPPER_LEG) || (limbIndex == DRAGONFLY_LIMB_FRONT_LEFT_UPPER_LEG) || + (limbIndex == DRAGONFLY_LIMB_FRONT_LEFT_FOOT) || (limbIndex == DRAGONFLY_LIMB_FRONT_RIGHT_UPPER_LEG) || + (limbIndex == DRAGONFLY_LIMB_HEAD) || + //! @bug: These do not check for valid limbs. Limb index 24 is DRAGONFLY_LIMB_MAX, so it (and any index + //! larger than it) is not tied to an actual limb. + (limbIndex == 24) || (limbIndex == 25) || + // While checking for DRAGONFLY_LIMB_ROOT twice is not a bug by itself, it causes another bug below. + (limbIndex == DRAGONFLY_LIMB_ROOT)) { + //! @bug: This code only works properly if all 12 elements of bodyPartsPos are updated every frame, since + //! otherwise bodyPartsPosIndex will be non-zero at the end of a frame. Despite the fact that there are 12 + //! checks in the above if-statement, only 9 of them are valid and non-duplicate, so only 9 elements of + //! bodyPartsPos are updated on each frame. As a result, three elements in bodyPartsPos will either be (0, 0, 0) + //! or be a value carried over from the previous frame. + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); + this->bodyPartsPosIndex++; + if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { + this->bodyPartsPosIndex = 0; + } + } + + Matrix_Pop(); +} + +// We need to pass in 14 into SubS_GenShadowTex for the bodyPartsNum, NOT the actual size of the +// parent body parts array. This is both necessary to match and to prevent extra dots from being +// drawn with the shadow. +#define SHADOW_BODY_PARTS_NUM 14 + +void EnGrasshopper_Draw(Actor* thisx, PlayState* play) { + EnGrasshopper* this = THIS; + s32 i; + u8* shadowTex = GRAPH_ALLOC(play->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); + u8* shadowTexIter; + + func_8012C2DC(play->state.gfxCtx); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnGrasshopper_PostLimbDraw, + &this->actor); + if ((this->type != EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM) && + (this->type != EN_GRASSHOPPER_TYPE_WOODFALL)) { + Matrix_RotateXS(0, MTXMODE_NEW); + + for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) { + *shadowTexIter++ = 0; + } + + for (i = 0; i < 5; i++) { + SubS_GenShadowTex(this->shadowBodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f, + SHADOW_BODY_PARTS_NUM, sShadowSizes, sParentBodyParts); + //! FAKE: Needed to fix some regs and stack + //! https://decomp.me/scratch/4wJBW + if ((shadowTex && shadowTex) && shadowTex) {} + } + + SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); + } + + if (this->drawDmgEffTimer != 0) { + f32 drawDmgEffAlpha = this->drawDmgEffTimer * 0.05f; + + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { + this->drawDmgEffScale += 0.3f; + if (this->drawDmgEffScale > 0.5f) { + this->drawDmgEffScale = 0.5f; + } + + Math_ApproachF(&this->drawDmgEffFrozenSteamScale, this->drawDmgEffScale, 0.1f, 0.04f); + } else { + this->drawDmgEffScale = 0.8f; + this->drawDmgEffFrozenSteamScale = 0.8f; + } + + Actor_DrawDamageEffects(play, &this->actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), + this->drawDmgEffScale, this->drawDmgEffFrozenSteamScale, drawDmgEffAlpha, + this->drawDmgEffType); + } + + EnGrasshopper_DrawEffects(this, play); +} + +void EnGrasshopper_InitializeEffect(EnGrasshopper* this, Vec3f* pos) { + EnGrasshopperEffect* effect = this->effects; + s16 i; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (!effect->isEnabled) { + effect->isEnabled = true; + effect->pos = *pos; + effect->timer = 10; + effect->velocity.x = randPlusMinusPoint5Scaled(20.0f); + effect->velocity.y = randPlusMinusPoint5Scaled(20.0f); + effect->velocity.z = randPlusMinusPoint5Scaled(20.0f); + effect->yaw = randPlusMinusPoint5Scaled(30000.0f); + return; + } + } +} + +void EnGrasshopper_UpdateEffects(EnGrasshopper* this, PlayState* play) { + EnGrasshopperEffect* effect = this->effects; + s32 i; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + effect->pos.x = this->effectBasePos.x + effect->velocity.x; + effect->pos.y = this->effectBasePos.y + effect->velocity.y; + effect->pos.z = this->effectBasePos.z + effect->velocity.z; + if (effect->timer != 0) { + effect->timer--; + effect->lightningIndex++; + Math_ApproachF(&effect->scale.x, 0.1f, 0.1f, 0.05f); + if (effect->lightningIndex >= 8) { + effect->lightningIndex = 0; + } + } else { + Math_ApproachZeroF(&effect->scale.x, 0.1f, 0.1f); + if (effect->scale.x < 0.2f) { + effect->isEnabled = 0; + } + } + + effect->scale.y = effect->scale.z = effect->scale.x; + } + } +} + +static TexturePtr sLightningTextures[] = { + gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, + gEffLightning5Tex, gEffLightning6Tex, gEffLightning7Tex, gEffLightning8Tex, +}; + +void EnGrasshopper_DrawEffects(EnGrasshopper* this, PlayState* play) { + s32 pad[2]; + EnGrasshopperEffect* effect; + s16 i; + MtxF mfResult; + MtxF mfTrans; + MtxF mfScale; + MtxF mfRot; + MtxF mfTransBillboard; + MtxF mfTransBillboardRot; + Mtx* mtx; + + OPEN_DISPS(play->state.gfxCtx); + + effect = this->effects; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + SkinMatrix_SetTranslate(&mfTrans, effect->pos.x, effect->pos.y, effect->pos.z); + SkinMatrix_SetScale(&mfScale, effect->scale.x, effect->scale.y, effect->scale.z); + SkinMatrix_SetRotateRPY(&mfRot, 0, 0, effect->yaw); + SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); + SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRot, &mfTransBillboardRot); + SkinMatrix_MtxFMtxFMult(&mfTransBillboardRot, &mfScale, &mfResult); + + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + mtx = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &mfResult); + + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + func_8012C9BC(play->state.gfxCtx); + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sLightningTextures[effect->lightningIndex])); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 255, 255); + gSPDisplayList(POLY_XLU_DISP++, Lib_SegmentedToVirtual(gEffLightningDL)); + } + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h index dc8e95008a..d414e4100c 100644 --- a/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h +++ b/src/overlays/actors/ovl_En_Grasshopper/z_en_grasshopper.h @@ -2,16 +2,77 @@ #define Z_EN_GRASSHOPPER_H #include "global.h" +#include "objects/object_grasshopper/object_grasshopper.h" + +#define EN_GRASSHOPPER_GET_TYPE(thisx) ((thisx)->params) struct EnGrasshopper; typedef void (*EnGrasshopperActionFunc)(struct EnGrasshopper*, PlayState*); +typedef enum EnGrasshopperType { + /* -1 */ EN_GRASSHOPPER_TYPE_UNUSED_NORMAL = -1, // Acts exactly like EN_GRASSHOPPER_TYPE_NORMAL + /* 0 */ EN_GRASSHOPPER_TYPE_NORMAL, + /* 1 */ EN_GRASSHOPPER_TYPE_GROWS_WHEN_SPAWNED, // Spawned by EnEncount1 + /* 2 */ EN_GRASSHOPPER_TYPE_WOODFALL_TEMPLE_FINAL_ROOM, + /* 3 */ EN_GRASSHOPPER_TYPE_WOODFALL, +} EnGrasshopperType; + +typedef struct EnGrasshopperEffect { + /* 0x00 */ u8 isEnabled; + /* 0x04 */ Vec3f pos; + /* 0x10 */ Vec3f velocity; + /* 0x1C */ f32 yaw; + /* 0x20 */ Vec3f scale; + /* 0x2C */ s16 timer; + /* 0x2E */ s16 lightningIndex; +} EnGrasshopperEffect; // size = 0x30 + +#define EN_GRASSHOPPER_EFFECT_COUNT 100 + typedef struct EnGrasshopper { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x164]; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[DRAGONFLY_LIMB_MAX]; + /* 0x0218 */ Vec3s morphTable[DRAGONFLY_LIMB_MAX]; /* 0x02A8 */ EnGrasshopperActionFunc actionFunc; - /* 0x02AC */ char unk_2AC[0x15C4]; + /* 0x02AC */ u8 decision; + /* 0x02AD */ u8 shouldTurn; + /* 0x02AE */ UNK_TYPE1 unk_2AE[2]; + /* 0x02B0 */ s16 timer; + /* 0x02B2 */ s16 waitTimer; + /* 0x02B4 */ s16 postBankTimer; + /* 0x02B6 */ s16 drawDmgEffTimer; + /* 0x02B8 */ s16 drawDmgEffType; + /* 0x02BC */ f32 drawDmgEffScale; + /* 0x02C0 */ f32 drawDmgEffFrozenSteamScale; + /* 0x02C4 */ Vec3f bodyPartsPos[12]; + /* 0x0354 */ s16 bodyPartsPosIndex; + /* 0x0356 */ s16 splashCount; + /* 0x0358 */ s16 action; + /* 0x035A */ s16 index; // Has a minor effect on speed for some reason. + /* 0x035C */ s16 bankState; + /* 0x035E */ s16 type; + /* 0x0360 */ f32 dragonflyScale; + /* 0x0364 */ f32 rotationalVelocity; + /* 0x0368 */ f32 endFrame; + /* 0x036C */ f32 approachSpeed; + /* 0x0370 */ f32 baseFlyHeight; + /* 0x0374 */ f32 targetPosY; + /* 0x0376 */ Vec3s targetRot; + /* 0x0380 */ Vec3f flyingHomePos; + /* 0x038C */ s16 bobPhase; + /* 0x038E */ UNK_TYPE1 unk_38E[0x26]; + /* 0x03B4 */ Vec3f targetApproachPos; + /* 0x03C0 */ Vec3f tailTipPos; + /* 0x03CC */ Vec3f effectBasePos; + /* 0x03D8 */ Vec3f shadowBodyPartsPos[DRAGONFLY_LIMB_MAX]; + /* 0x04F8 */ f32 waterSurface; + /* 0x04FC */ Vec3f damagedVelocity; + /* 0x0508 */ Vec3s targetBankRot; + /* 0x0510 */ ColliderJntSph collider; + /* 0x0530 */ ColliderJntSphElement colliderElements[2]; + /* 0x0570 */ EnGrasshopperEffect effects[EN_GRASSHOPPER_EFFECT_COUNT]; } EnGrasshopper; // size = 0x1870 extern const ActorInit En_Grasshopper_InitVars; diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index de0880e963..cf32db0bc0 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -330,7 +330,7 @@ void func_80B23934(EnHanabi* this, PlayState* play) { } } - if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7) && + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7) && (play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 610)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_GROAN); } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 3579f23cc7..0e58e2b858 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -138,9 +138,9 @@ void EnHoll_Destroy(Actor* thisx, PlayState* play) { } void EnHoll_ChangeRooms(PlayState* play) { - Room tempRoom = play->roomCtx.currRoom; + Room tempRoom = play->roomCtx.curRoom; - play->roomCtx.currRoom = play->roomCtx.prevRoom; + play->roomCtx.curRoom = play->roomCtx.prevRoom; play->roomCtx.prevRoom = tempRoom; play->roomCtx.activeMemPage ^= 1; } @@ -170,7 +170,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { EnHoll_SetPlayerSide(play, this, &transformedPlayerPos); playerDistFromCentralPlane = fabsf(transformedPlayerPos.z); - if (play->sceneNum == SCENE_IKANA) { + if (play->sceneId == SCENE_IKANA) { enHollBottom = EN_HOLL_BOTTOM_IKANA; enHollHalfwidth = EN_HOLL_HALFWIDTH_IKANA; } @@ -204,12 +204,12 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { s32 unclampedAlpha = EN_HOLL_SCALE_ALPHA(playerDistFromCentralPlane); this->alpha = CLAMP(unclampedAlpha, 0, 255); - if (play->roomCtx.currRoom.num != this->actor.room) { + if (play->roomCtx.curRoom.num != this->actor.room) { EnHoll_ChangeRooms(play); } } } - } else if ((this->type == EN_HOLL_TYPE_DEFAULT) && (play->sceneNum == SCENE_26SARUNOMORI) && + } else if ((this->type == EN_HOLL_TYPE_DEFAULT) && (play->sceneId == SCENE_26SARUNOMORI) && (sInstancePlayingSound == NULL)) { sInstancePlayingSound = this; } @@ -225,7 +225,7 @@ void EnHoll_TransparentIdle(EnHoll* this, PlayState* play) { Actor_OffsetOfPointInActorCoords(&this->actor, &transformedPlayerPos, useViewEye ? &play->view.eye : &player->actor.world.pos); - enHollTop = (play->sceneNum == SCENE_PIRATE) ? EN_HOLL_TOP_PIRATE : EN_HOLL_TOP_DEFAULT; + enHollTop = (play->sceneId == SCENE_PIRATE) ? EN_HOLL_TOP_PIRATE : EN_HOLL_TOP_DEFAULT; if ((transformedPlayerPos.y > EN_HOLL_BOTTOM_DEFAULT) && (transformedPlayerPos.y < enHollTop) && (fabsf(transformedPlayerPos.x) < EN_HOLL_HALFWIDTH_TRANSPARENT)) { @@ -239,7 +239,7 @@ void EnHoll_TransparentIdle(EnHoll* this, PlayState* play) { this->actor.room = room; - if ((this->actor.room != play->roomCtx.currRoom.num) && + if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; } @@ -264,7 +264,7 @@ void EnHoll_VerticalBgCoverIdle(EnHoll* this, PlayState* play) { this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; - if ((this->actor.room != play->roomCtx.currRoom.num) && + if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; this->bgCoverAlphaActive = true; @@ -287,7 +287,7 @@ void EnHoll_VerticalIdle(EnHoll* this, PlayState* play) { s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; this->actor.room = play->doorCtx.transitionActorList[enHollId].sides[playerSide].room; - if ((this->actor.room != play->roomCtx.currRoom.num) && + if ((this->actor.room != play->roomCtx.curRoom.num) && Room_StartRoomTransition(play, &play->roomCtx, this->actor.room)) { this->actionFunc = EnHoll_RoomTransitionIdle; } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 259594d560..4388c7c739 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -792,7 +792,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->stateFlags = 0; } - if (((play->sceneNum == SCENE_KOEPONARACE) && (GET_RACE_FLAGS == 1)) || + if (((play->sceneId == SCENE_KOEPONARACE) && (GET_RACE_FLAGS == 1)) || ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && Cutscene_GetSceneSetupIndex(play))) { this->stateFlags |= ENHORSE_FLAG_25; } @@ -878,7 +878,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { func_80112AFC(play); } else if (thisx->params == ENHORSE_14) { func_808846F0(this, play); - if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { + if ((play->sceneId == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(&this->actor); } } else if (thisx->params == ENHORSE_16) { @@ -3498,7 +3498,7 @@ void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, this->unk_1EC |= 0x80; this->actor.world.pos = this->actor.prevPos; this->actor.speedXZ = 0.0f; - } else if ((play->sceneNum != SCENE_KOEPONARACE) || (this->unk_1EC & 2)) { + } else if ((play->sceneId != SCENE_KOEPONARACE) || (this->unk_1EC & 2)) { this->unk_1EC &= ~2; this->actor.world.pos = this->lastPos; this->stateFlags |= ENHORSE_OBSTACLE; @@ -3822,7 +3822,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { } if (((movingFast == false) && (intersectDist < 80.0f)) || ((movingFast == true) && (intersectDist < 150.0f))) { - if ((play->sceneNum != SCENE_KOEPONARACE) && (Math_CosS(sp7E) < 0.9f) && (this->playerControlled == true)) { + if ((play->sceneId != SCENE_KOEPONARACE) && (Math_CosS(sp7E) < 0.9f) && (this->playerControlled == true)) { if (movingFast == false) { this->stateFlags |= ENHORSE_FORCE_REVERSING; } else if (movingFast == true) { @@ -3876,7 +3876,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { COLPOLY_GET_NORMAL(obstacleFloor->normal.z), obstacleFloor->dist, &this->actor.world.pos) > 40.0f)) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && - (play->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } @@ -3888,7 +3888,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { if ((Math_CosS(sp7E) < 0.9f) && (movingFast == true) && (this->playerControlled == true) && - (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneNum != SCENE_KOEPONARACE)) { + (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } @@ -3951,13 +3951,13 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && - (play->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } } else if (behindObstacleHeight < -70.0f) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && - (play->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 9221bb3c4e..9f5ef65e7c 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -121,7 +121,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { return false; } - func_8010E9F0(4, 0); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); play->interfaceCtx.unk_280 = 1; this->horse1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, @@ -145,7 +145,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { } s32 func_808F8E94(EnHorseGameCheck* this, PlayState* play) { - gSaveContext.unk_3DD0[4] = 0; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; return true; } @@ -247,11 +247,11 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { return true; } - if (gSaveContext.unk_3DE0[4] >= 0x4650) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(180)) { Audio_QueueSeqCmd(0x8041); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; - gSaveContext.unk_3DD0[4] = 6; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_RACE_FLAGS(RACE_FLAG_4); this->unk_174 = 60; } @@ -284,7 +284,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { Audio_QueueSeqCmd(0x8041); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x40000; - gSaveContext.unk_3DD0[4] = 6; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_RACE_FLAGS(RACE_FLAG_3); this->unk_174 = 60; } @@ -317,7 +317,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { Audio_QueueSeqCmd(0x8041); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x02000000; - gSaveContext.unk_3DD0[4] = 6; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_RACE_FLAGS(RACE_FLAG_3); this->unk_174 = 60; } @@ -346,7 +346,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) { Audio_QueueSeqCmd(0x8041); play_sound(NA_SE_SY_START_SHOT); this->unk_164 |= 0x800; - gSaveContext.unk_3DD0[4] = 6; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; SET_RACE_FLAGS(RACE_FLAG_2); this->unk_174 = 60; } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index b44d1bb29d..26c5bbbbc5 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -532,7 +532,7 @@ void func_8095E95C(EnIshi* this, PlayState* play) { s32 sp2C; if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; if (ENISHI_GET_1(&this->actor) == 1) { Flags_SetSwitch(play, ENISHI_GET_FE00(&this->actor)); } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index bb5ec72ee1..b7ad5c9ddc 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -948,7 +948,7 @@ void EnJg_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (!EN_JG_IS_IN_GORON_SHRINE(thisx)) { - if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7) && + if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7) && (play->csCtx.currentCsIndex == 0)) { // This is the elder that appears in the cutscene for learning the full Goron Lullaby. this->animIndex = EN_JG_ANIM_IDLE; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index cd1d5ffb47..e9d5647e0a 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -155,7 +155,7 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (this->actor.flags & ACTOR_FLAG_10000) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (gSaveContext.unk_3DE0[4] > 0) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] > SECONDS_TO_TIMER(0)) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); Message_StartTextbox(play, 0x10A2, &this->actor); this->unk_300 = 0x10A2; @@ -287,7 +287,7 @@ void func_80C1410C(EnJgameTsn* this, PlayState* play) { play->interfaceCtx.unk_280 = 1; func_80112AFC(play); gSaveContext.save.weekEventReg[90] |= 0x20; - func_8010E9F0(4, 0x78); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); this->actionFunc = func_80C1418C; } @@ -352,7 +352,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) { func_80C14030(this); } - if (gSaveContext.unk_3DE0[4] == 0) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) { Message_StartTextbox(play, 0x10A1, &this->actor); this->unk_300 = 0x10A1; player->stateFlags1 |= 0x20; @@ -479,7 +479,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) { case 0x10A1: func_801477B4(play); gSaveContext.minigameState = 3; - gSaveContext.unk_3DD0[4] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; gSaveContext.save.weekEventReg[90] &= (u8)~0x20; func_80C144E4(this); break; 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 6d7cc29eac..3acbece163 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -238,10 +238,10 @@ void EnKakasi_CheckAnimationSfx(EnKakasi* this) { void EnKakasi_CheckPlayerPosition(EnKakasi* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->sceneNum == SCENE_8ITEMSHOP) { + if (play->sceneId == SCENE_8ITEMSHOP) { player->actor.world.pos.x = -50.0f; player->actor.world.pos.z = 155.0f; - } else if (play->sceneNum == SCENE_TENMON_DAI) { + } else if (play->sceneId == SCENE_TENMON_DAI) { player->actor.world.pos.x = 60.0f; player->actor.world.pos.z = -190.0f; } @@ -998,7 +998,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { tempWorldPos.x += randPlusMinusPoint5Scaled(2.0f); tempWorldPos.z += randPlusMinusPoint5Scaled(2.0f); - if (play->sceneNum == SCENE_8ITEMSHOP) { + if (play->sceneId == SCENE_8ITEMSHOP) { EffectSsGSplash_Spawn(play, &tempWorldPos, 0, 0, 0, randPlusMinusPoint5Scaled(100.0f) + 200.0f); SoundSource_PlaySfxAtFixedWorldPos(play, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c index ad85d9edb7..78d9032076 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c @@ -71,12 +71,12 @@ void EnKbt_Destroy(Actor* thisx, PlayState* play) { } s32 func_80B33E64(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1; } s32 func_80B33E8C(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 2))) { return true; } return false; diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index de2d1c207f..c9349b2c55 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -151,33 +151,33 @@ ObjIcePoly* EnKgy_FindIceBlock(PlayState* play) { } void func_80B40C74(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 1; if (CURRENT_DAY == 1) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 2; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 2; } else { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~2; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~2; } } void func_80B40D00(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 4; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 4; } void func_80B40D30(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~7; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~7; } s32 func_80B40D64(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1; } s32 func_80B40D8C(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 4; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 4; } s32 func_80B40DB4(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 2))) { return true; } return false; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index dc3ecc56ce..9d0c412953 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -4,7 +4,6 @@ * Description: Grass / Bush */ -#include "prevent_bss_reordering.h" #include "z_en_kusa.h" #include "objects/object_kusa/object_kusa.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -510,7 +509,7 @@ void EnKusa_LiftedUp(EnKusa* this, PlayState* play) { s32 bgId; if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; EnKusa_SetupFall(this); this->actor.velocity.x = this->actor.speedXZ * Math_SinS(this->actor.world.rot.y); this->actor.velocity.z = this->actor.speedXZ * Math_CosS(this->actor.world.rot.y); @@ -683,7 +682,7 @@ void EnKusa_Update(Actor* thisx, PlayState* play2) { } else { this->actor.shape.yOffset = 0.0f; } - if ((kusaGameplayFrames != play->gameplayFrames) && (play->roomCtx.currRoom.unk3 == 0)) { + if ((kusaGameplayFrames != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { EnKusa_Sway(); kusaGameplayFrames = play->gameplayFrames; } @@ -695,7 +694,7 @@ void EnKusa_DrawBush(Actor* thisx, PlayState* play2) { if ((this->actor.projectedPos.z <= 1200.0f) || ((this->isInWater & 1) && (this->actor.projectedPos.z < 1300.0f))) { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } @@ -724,7 +723,7 @@ void EnKusa_DrawGrass(Actor* thisx, PlayState* play) { if (this->isCut) { Gfx_DrawDListOpa(play, gKusaStump); } else { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == EnKusa_WaitForInteract)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { EnKusa_ApplySway(&D_80936AD8[this->kusaMtxIdx]); } diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 435d319727..4ed5b82a04 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -1033,7 +1033,7 @@ void func_80A5D9C8(EnKusa2* this, PlayState* play) { D_80A5EAFC.z = Math_SinS(D_80A5EB04.z) * 1000.0f; if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.colChkInfo.mass = 80; this->actor.home.rot.y = this->actor.world.rot.y; this->actor.velocity.y = 12.5f; @@ -1289,7 +1289,7 @@ void func_80A5E604(Actor* thisx, PlayState* play) { } else { this->actor.draw = func_80A5E6F0; - if (play->roomCtx.currRoom.unk3 == 0) { + if (play->roomCtx.curRoom.unk3 == 0) { func_80A5B508(); } func_80A5CAF4(&D_80A5F1C0); @@ -1352,7 +1352,7 @@ void EnKusa2_Draw(Actor* thisx, PlayState* play) { EnKusa2* this = THIS; if (this->actor.projectedPos.z <= 1200.0f) { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A5B954(&D_80A60908[this->unk_1CE], 0.0015f); } diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 9f248e30d2..7461abebe3 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -674,7 +674,7 @@ void EnMa4_HorsebackGameCheckPlayerInteractions(EnMa4* this, PlayState* play) { // "You're feeling confident" Message_StartTextbox(play, 0x336E, &this->actor); this->actionFunc = EnMa4_HorsebackGameTalking; - } else if ((gSaveContext.unk_3DE0[4] < 115 * 100)) { // timer < 115 seconds + } else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(115)) { func_800B8614(&this->actor, play, 100.0f); } } @@ -689,7 +689,7 @@ void EnMa4_InitHorsebackGame(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); play->interfaceCtx.unk_280 = 1; - func_8010E9F0(4, 0); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); gSaveContext.save.weekEventReg[8] |= 1; func_80112AFC(play); player->stateFlags1 |= 0x20; @@ -717,9 +717,9 @@ void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play) { play->interfaceCtx.unk_25C = 1; } - if ((gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) // timer >= 2 minutes - || (this->poppedBalloonCounter == 10)) { - gSaveContext.unk_3DD0[4] = 6; + if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) || + (this->poppedBalloonCounter == 10)) { + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; EnMa4_SetupHorsebackGameEnd(this, play); D_80AC0258 = 0; } @@ -898,13 +898,13 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { gSaveContext.save.weekEventReg[21] |= 0x40; } } else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) { - if (gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) { // "Too bad Grasshopper" EnMa4_SetFaceExpression(this, 0, 0); Message_StartTextbox(play, 0x336D, &this->actor); this->textId = 0x336D; } else { - time = gSaveContext.unk_3DE0[4]; + time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { // [Score] New record! gSaveContext.save.horseBackBalloonHighScore = time; @@ -943,12 +943,12 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { Message_StartTextbox(play, 0x3354, &this->actor); this->textId = 0x3354; } else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) { - if (gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) { // "Try again?" Message_StartTextbox(play, 0x3356, &this->actor); this->textId = 0x3356; } else { - time = gSaveContext.unk_3DE0[4]; + time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { gSaveContext.save.horseBackBalloonHighScore = time; EnMa4_SetFaceExpression(this, 0, 3); @@ -970,12 +970,12 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) { Message_StartTextbox(play, 0x3358, &this->actor); this->textId = 0x3358; } else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) { - if (gSaveContext.unk_3DE0[4] >= 2 * 60 * 100) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) { // "Try again?" Message_StartTextbox(play, 0x3356, &this->actor); this->textId = 0x3356; } else { - time = gSaveContext.unk_3DE0[4]; + time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2]; if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) { // New record gSaveContext.save.horseBackBalloonHighScore = time; diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index f7d9a6e1ef..3c905b0adf 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -135,7 +135,7 @@ void EnMag_Init(Actor* thisx, PlayState* play) { this->unk11F02 = 30; this->unk11F00 = this->state = MAG_STATE_INITIAL; - if (gSaveContext.unk_3F1E != 0) { + if (gSaveContext.hudVisibilityForceButtonAlphasByStatus) { this->mainTitleAlpha = 210; this->unk11F32 = 255; this->copyrightAlpha = 255; @@ -158,7 +158,7 @@ void EnMag_Init(Actor* thisx, PlayState* play) { this->displayEffectEnvColor[1] = 255; this->displayEffectEnvColor[2] = 155; - gSaveContext.unk_3F1E = 0; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; this->state = MAG_STATE_FADE_IN_MASK; sInputDelayTimer = 20; gSaveContext.transFadeDuration = 1; diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index cb25445b9d..dc5e755793 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -120,7 +120,7 @@ void EnMk_Destroy(Actor* thisx, PlayState* play) { } s32 func_80959524(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 7; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 7; } void func_8095954C(EnMk* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index c24bf76010..8e2c5260bb 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -185,7 +185,7 @@ void func_80965DB4(EnMm* this, PlayState* play) { void func_8096611C(EnMm* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { EnMm_SetupAction(this, func_80965DB4); - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.bgCheckFlags &= ~1; Math_Vec3s_ToVec3f(&this->actor.prevPos, &this->actor.home.rot); gSaveContext.unk_1014 = 0; diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 0f73088263..6909183f38 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -249,13 +249,14 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { break; case 0x2791: - if (gSaveContext.unk_3DE0[0] == 1000) { + if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) { Message_StartTextbox(play, 0x2792, &this->actor); this->unk_2B4 = 0x2792; - } else if ((gSaveContext.unk_3DE0[0] >= 1500)) { + } else if ((gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] >= SECONDS_TO_TIMER(15))) { Message_StartTextbox(play, 0x2797, &this->actor); this->unk_2B4 = 0x2797; - } else if ((gSaveContext.unk_3DE0[0] <= 1050) && (gSaveContext.unk_3DE0[0] >= 950)) { + } else if ((gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] <= SECONDS_TO_TIMER_PRECISE(10, 50)) && + (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] >= SECONDS_TO_TIMER_PRECISE(9, 50))) { Message_StartTextbox(play, 0x2795, &this->actor); this->unk_2B4 = 0x2795; } else { @@ -301,7 +302,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { } else if ((this->unk_2AC > 0) && (this->unk_2B4 == 0x2791)) { this->unk_2AC--; if (this->unk_2AC == 0) { - if (gSaveContext.unk_3DE0[0] == 1000) { + if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) { func_801A3098(0x922); } else { play_sound(NA_SE_SY_ERROR); @@ -342,9 +343,9 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) { player->stateFlags1 |= 0x20; if (Player_GetMask(play) == PLAYER_MASK_BUNNY) { - func_8010EA9C(0, 2); + Interface_StartPostmanTimer(0, POSTMAN_MINIGAME_BUNNY_HOOD_ON); } else { - func_8010EA9C(0, 0); + Interface_StartPostmanTimer(0, POSTMAN_MINIGAME_BUNNY_HOOD_OFF); } func_801477B4(play); play_sound(NA_SE_SY_START_SHOT); @@ -381,18 +382,20 @@ void func_80A6FBA0(EnMm3* this) { void func_80A6FBFC(EnMm3* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (gSaveContext.unk_3DD0[0] == 0x10) { + if (gSaveContext.timerStates[TIMER_ID_POSTMAN] == TIMER_STATE_POSTMAN_END) { player->stateFlags1 &= ~0x20; this->actor.flags |= ACTOR_FLAG_10000; - if (gSaveContext.unk_3DE0[0] > 1500) { - gSaveContext.unk_3DE0[0] = 1500; - } else if ((((void)0, gSaveContext.unk_3DE0[0]) >= (OSTime)(995 - XREG(16))) && - (((void)0, gSaveContext.unk_3DE0[0]) <= (OSTime)(1005 + XREG(17)))) { - gSaveContext.unk_3DE0[0] = 1000; + if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] > SECONDS_TO_TIMER(15)) { + gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(15); + } else if ((((void)0, gSaveContext.timerCurTimes[TIMER_ID_POSTMAN]) >= + (OSTime)(SECONDS_TO_TIMER_PRECISE(10, -5) - XREG(16))) && + (((void)0, gSaveContext.timerCurTimes[TIMER_ID_POSTMAN]) <= + (OSTime)(SECONDS_TO_TIMER_PRECISE(10, 5) + XREG(17)))) { + gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(10); } - } else if (gSaveContext.unk_3DE0[0] > 1500) { - gSaveContext.unk_3DD0[0] = 15; - gSaveContext.unk_3DC8 = osGetTime(); + } else if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] > SECONDS_TO_TIMER(15)) { + gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_STOP; + gSaveContext.postmanTimerStopOsTime = osGetTime(); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { @@ -401,7 +404,7 @@ void func_80A6FBFC(EnMm3* this, PlayState* play) { Message_StartTextbox(play, 0x2791, &this->actor); this->unk_2B4 = 0x2791; this->unk_2AC = 7; - gSaveContext.unk_3DD0[0] = 0; + gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_OFF; this->actor.flags &= ~ACTOR_FLAG_10000; play_sound(NA_SE_SY_START_SHOT); func_80A6F9C8(this); diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h index b6f653935e..1cc1946f54 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h @@ -7,6 +7,11 @@ struct EnMm3; typedef void (*EnMm3ActionFunc)(struct EnMm3*, PlayState*); +typedef enum { + /* 0 */ POSTMAN_MINIGAME_BUNNY_HOOD_OFF, + /* 2 */ POSTMAN_MINIGAME_BUNNY_HOOD_ON = 2 +} PostmanMinigameBunnyHoodState; + typedef struct EnMm3 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index 1fc99ace8e..b87d376e2b 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -253,7 +253,7 @@ s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType * Displays the text which says that the player has made a false start. */ void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) { - gSaveContext.unk_3DD0[4] = 0; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; Message_StartTextbox(play, 0xE95, NULL); // An entrant made a false start func_800B7298(play, &this->actor, 7); Audio_QueueSeqCmd(0x101400FF); @@ -314,7 +314,7 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { gSaveContext.eventInf[1] |= 8; } else { if (DECR(this->timer) == 60) { - func_8010E9F0(4, 0); + Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); play->interfaceCtx.unk_280 = 1; Audio_QueueSeqCmd(NA_BGM_GORON_RACE | 0x8000); play->envCtx.unk_E4 = 0xFE; @@ -359,14 +359,14 @@ void EnMttag_Race(EnMttag* this, PlayState* play) { s32 playerCheatStatus; if (EnMttag_IsInFinishLine(playerPos)) { - gSaveContext.unk_3DD0[4] = 6; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; play_sound(NA_SE_SY_START_SHOT); Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); this->timer = 55; gSaveContext.eventInf[1] |= 2; this->actionFunc = EnMttag_RaceFinish; } else if (EnMttag_IsAnyRaceGoronOverFinishLine(this)) { - gSaveContext.unk_3DD0[4] = 6; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6; play_sound(NA_SE_SY_START_SHOT); Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000); this->timer = 55; @@ -456,7 +456,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) { if (play->msgCtx.choiceIndex != 0) { // Exit the race func_8019F230(); - gSaveContext.unk_3DD0[4] = 0; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF; EnMttag_ExitRace(play, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK); gSaveContext.eventInf[1] &= (u8)~8; gSaveContext.eventInf[1] |= 4; @@ -502,12 +502,14 @@ void EnMttag_Init(Actor* thisx, PlayState* play) { void EnMttag_Destroy(Actor* thisx, PlayState* play) { EnMttag* this = THIS; - if (gSaveContext.unk_3DD0[4] != 6) { - gSaveContext.unk_3DD0[4] = 5; + + if (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] != TIMER_STATE_6) { + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; } } void EnMttag_Update(Actor* thisx, PlayState* play) { EnMttag* this = THIS; + this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c index 966f3671bc..11872a0a17 100644 --- a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c +++ b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.c @@ -5,6 +5,7 @@ */ #include "z_en_nimotsu.h" +#include "assets/objects/object_boj/object_boj.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,7 +16,8 @@ void EnNimotsu_Destroy(Actor* thisx, PlayState* play); void EnNimotsu_Update(Actor* thisx, PlayState* play); void EnNimotsu_Draw(Actor* thisx, PlayState* play); -#if 0 +void EnNimotsu_UpdateCollision(EnNimotsu* this, PlayState* play); + const ActorInit En_Nimotsu_InitVars = { ACTOR_EN_NIMOTSU, ACTORCAT_PROP, @@ -28,25 +30,93 @@ const ActorInit En_Nimotsu_InitVars = { (ActorFunc)EnNimotsu_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BE1FB0 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK4, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 10, 30, 0, { 0, 0, 0 } }, }; -#endif +void EnNimotsu_UpdateCollision(EnNimotsu* this, PlayState* play) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 4); +} -extern ColliderCylinderInit D_80BE1FB0; +void EnNimotsu_Init(Actor* thisx, PlayState* play) { + EnNimotsu* this = THIS; -extern UNK_TYPE D_06013380; + Collider_InitCylinder(play, &this->collider); + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Nimotsu/func_80BE1C80.s") + this->timer = 10; + this->actor.gravity = -0.5f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Nimotsu/EnNimotsu_Init.s") + Actor_SetScale(&this->actor, 0.01f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Nimotsu/EnNimotsu_Destroy.s") +void EnNimotsu_Destroy(Actor* thisx, PlayState* play) { + EnNimotsu* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Nimotsu/EnNimotsu_Update.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Nimotsu/EnNimotsu_Draw.s") +void EnNimotsu_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnNimotsu* this = THIS; + Vec3f dustPosition; + + Actor_MoveWithGravity(&this->actor); + + if (!(this->dustDone & 1) && (this->actor.bgCheckFlags & 1)) { + if (DECR(this->timer) == 0) { + this->dustDone |= 1; + } + + if ((play->state.frames % 3) == 0) { + dustPosition.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(15.0f); + dustPosition.y = this->actor.world.pos.y; + dustPosition.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(15.0f); + Actor_SpawnFloorDustRing(play, &this->actor, &dustPosition, 20.0f, 0, 2.0f, 0, 0, 0); + } + } + + EnNimotsu_UpdateCollision(this, play); +} + +void EnNimotsu_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnNimotsu* this = THIS; + Vec3f position; + Vec3f scale; + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, &gBombShopBagDL); + func_8012C2DC(play->state.gfxCtx); + + position.x = this->actor.world.pos.x + 7.0f; + position.y = this->actor.world.pos.y; + position.z = this->actor.world.pos.z + 2.0f; + + scale.x = 0.2f; + scale.y = 0.2f; + scale.z = 0.2f; + + func_800BC620(&position, &scale, 255, play); + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.h b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.h index 634697736f..e839c9393f 100644 --- a/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.h +++ b/src/overlays/actors/ovl_En_Nimotsu/z_en_nimotsu.h @@ -7,7 +7,10 @@ struct EnNimotsu; typedef struct EnNimotsu { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x98]; + /* 0x144 */ UNK_TYPE1 unk_144[0x48]; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ u16 dustDone; + /* 0x1DA */ s16 timer; } EnNimotsu; // size = 0x1DC extern const ActorInit En_Nimotsu_InitVars; diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index b2fee9d8d4..fd3146032c 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -731,7 +731,7 @@ void func_80AD16A8(EnOsn* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_1EC); } - if ((this->unk_1EC == 5) && (play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0xB) && + if ((this->unk_1EC == 5) && (play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0xB) && (play->csCtx.frames == 400)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_OMVO00); } @@ -795,7 +795,7 @@ void EnOsn_Init(Actor* thisx, PlayState* play) { this->unk_1EA |= 1; } this->unk_1F0 = 1; - if (play->sceneNum == SCENE_INSIDETOWER) { + if (play->sceneId == SCENE_INSIDETOWER) { if ((gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 2)) || (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 6))) { this->actionFunc = func_80AD16A8; 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 ef46c5e816..618a30986c 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -302,7 +302,7 @@ void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -985,7 +985,7 @@ void EnOssan_SetupBuyItemWithFanfare(PlayState* play, EnOssan* this) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; EnOssan_SetupAction(this, EnOssan_BuyItemWithFanfare); } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 2ff9d814e0..b1b3d9cbc9 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -190,7 +190,7 @@ void EnPametfrog_Init(Actor* thisx, PlayState* play) { GEKKO_LIMB_MAX); Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colElement); this->params = CLAMP(this->actor.params, 1, 4); - if (Flags_GetClear(play, play->roomCtx.currRoom.num)) { + if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_MarkForDeath(&this->actor); if (!(gSaveContext.save.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { @@ -963,7 +963,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play) { this->collider.base.ocFlags1 &= ~OC1_ON; func_800B0DE0(play, &vec1, &gZeroVec3f, &gZeroVec3f, &primColor, &envColor, 800, 50); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); - Flags_SetClearTemp(play, play->roomCtx.currRoom.num); + Flags_SetClearTemp(play, play->roomCtx.curRoom.num); for (i = 0; i < 25; i++) { vel.x = randPlusMinusPoint5Scaled(5.0f); diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 3995207e9e..75bcbc8e80 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -1017,7 +1017,7 @@ s32 func_80AF86F0(EnPm* this, PlayState* play) { s32 func_80AF87C4(EnPm* this, PlayState* play) { s32 ret = false; - if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 9) && + if ((play->csCtx.state != 0) && (play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 9) && (play->curSpawn == 1)) { if (!this->unk_380) { func_80AF7E98(this, 0); 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 7587e38ca7..5d04b7567a 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -1539,10 +1539,10 @@ void EnPp_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, (limbIndex == HIPLOOP_LIMB_CENTER_WING_BASE) || (limbIndex == HIPLOOP_LIMB_CENTER_WING_MIDDLE) || (limbIndex == HIPLOOP_LIMB_BACK_LEFT_LOWER_LEG) || (limbIndex == HIPLOOP_LIMB_RIGHT_EYE) || (limbIndex == HIPLOOP_LIMB_LEFT_EYE)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosCount]); - this->bodyPartsPosCount++; - if (this->bodyPartsPosCount >= ARRAY_COUNT(this->bodyPartsPos)) { - this->bodyPartsPosCount = 0; + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); + this->bodyPartsPosIndex++; + if (this->bodyPartsPosIndex >= ARRAY_COUNT(this->bodyPartsPos)) { + this->bodyPartsPosIndex = 0; } if ((this->action == EN_PP_ACTION_SPAWN_BODY_PARTS) && (this->deadBodyPartsSpawnedCount < 6) && diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.h b/src/overlays/actors/ovl_En_Pp/z_en_pp.h index 291c6473b6..d181c08de7 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.h +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.h @@ -67,7 +67,7 @@ typedef struct EnPp { /* 0x400 */ f32 attackRange; /* 0x404 */ s32 hasBeenDamaged; /* 0x408 */ Vec3f bodyPartsPos[11]; - /* 0x48C */ s16 bodyPartsPosCount; + /* 0x48C */ s16 bodyPartsPosIndex; /* 0x490 */ f32 maskAccelY; /* 0x494 */ ColliderJntSph maskCollider; /* 0x4B4 */ ColliderJntSphElement maskColliderElements[1]; diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index 56201271b4..088e06149b 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -296,7 +296,7 @@ void EnRailSkb_Init(Actor* thisx, PlayState* play) { this->unk_3F8 = 0; } - if ((play->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 0333cb011c..1a57cba7bc 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -15,9 +15,8 @@ void EnRu_Destroy(Actor* thisx, PlayState* play); void EnRu_Update(Actor* thisx, PlayState* play); void EnRu_Draw(Actor* thisx, PlayState* play); -void func_80A38DF4(EnRu* this, PlayState* play); +void EnRu_DoNothing(EnRu* this, PlayState* play); -#if 0 const ActorInit En_Ru_InitVars = { ACTOR_EN_RU, ACTORCAT_NPC, @@ -30,18 +29,29 @@ const ActorInit En_Ru_InitVars = { (ActorFunc)EnRu_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A39450 = { - { COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT0, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 64, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80A3947C = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_80A39488 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(0, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -76,34 +86,268 @@ static DamageTable D_80A39488 = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -#endif +static AnimationInfoS sAnimationInfo[] = { + { &gAdultRutoIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gAdultRutoIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoRaisingArmsUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoCrossingArmsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoLookingDownLeftAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoIdleHandsOnHipsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoHeadTurnDownLeftAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoSwimmingUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +}; -extern ColliderCylinderInit D_80A39450; -extern CollisionCheckInfoInit2 D_80A3947C; -extern DamageTable D_80A39488; +// in PostLimbdraw, converts limbIndex to bodyPartsPos index +static s8 sBodyPartPosIndices[] = { + -1, -1, 12, 13, 14, -1, 9, 10, 11, -1, 0, 6, -1, -1, 7, 8, 2, -1, -1, 3, 4, 2, 1, +}; -extern UNK_TYPE D_0600C700; +static s8 sRuBodyParts[RU_BODYPARTSPOS_COUNT] = { + 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A389A0.s") +static u8 sRuShadowSizes[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38A68.s") +static TrackOptionsSet sTrackOptions = { + { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 }, { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 } +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38B7C.s") +s32 EnRu_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { + s16 lastFrame; + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38BF0.s") + if ((animIndex >= 0) && (animIndex < ARRAY_COUNT(sAnimationInfo))) { + lastFrame = sAnimationInfo[animIndex].frameCount; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38C70.s") + ret = true; + if (lastFrame < 0) { + lastFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38DF4.s") + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, + sAnimationInfo[animIndex].startFrame, lastFrame, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Init.s") + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Destroy.s") +// En_Zo has a copy of this function +s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) { + u8 leftWasGrounded; + u8 rightWasGrounded; + s32 waterSfxId; + s16 sfxId; + u8 isFootGrounded; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Update.s") + leftWasGrounded = this->isLeftFootGrounded; + rightWasGrounded = this->isRightFootGrounded; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38FB4.s") + if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.depthInWater < 20.0f) { + waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + } else { + waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A390F8.s") + sfxId = waterSfxId + SFX_FLAG; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Draw.s") + } else { + sfxId = SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG; + } + + this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); + + if (this->isLeftFootGrounded && !leftWasGrounded && isFootGrounded) { + Actor_PlaySfxAtPos(&this->actor, sfxId); + } + + this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->rightFootPos, -6.0f); + if (this->isRightFootGrounded && !rightWasGrounded && isFootGrounded) { + Actor_PlaySfxAtPos(&this->actor, sfxId); + } + + return false; +} + +// This function is only ever called with eyeStateMax == 3 +void EnRu_UpdateEyes(EnRu* this, s32 eyeStateMax) { + if (DECR(this->blinkTimer) == 0) { + this->eyeState++; + if (this->eyeState >= eyeStateMax) { + this->eyeState = 0; + this->blinkTimer = Rand_S16Offset(30, 30); + } + } +} + +void EnRu_UpdateCollider(EnRu* this, PlayState* play) { + this->collider.dim.pos.x = this->actor.world.pos.x; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->collider.dim.pos.z = this->actor.world.pos.z; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} + +void EnRu_UpdateModel(EnRu* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + SkelAnime_Update(&this->skelAnime); + + // Head and Torso tracking to Player if in front of Ru. + if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) { + Vec3f playerPos; + + playerPos.x = player->actor.world.pos.x; + playerPos.y = player->bodyPartsPos[7].y + 3.0f; + playerPos.z = player->actor.world.pos.z; + SubS_TrackPoint(&playerPos, &this->actor.focus.pos, &this->actor.shape.rot, &this->trackTarget, &this->headRot, + &this->torsoRot, &sTrackOptions); + + } else { // smooth her back to facing forward + Math_SmoothStepToS(&this->trackTarget.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->trackTarget.y, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->headRot.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->headRot.y, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->torsoRot.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); + } + + EnRu_UpdateEyes(this, 3); + EnRu_PlayWalkingSound(this, play); + SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, RU2_LIMB_MAX); +} + +void EnRu_DoNothing(EnRu* this, PlayState* play) { +} + +void EnRu_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnRu* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gAdultRutoSkel, NULL, this->jointTable, this->morphTable, RU2_LIMB_MAX); + EnRu_ChangeAnim(&this->skelAnime, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + + this->path = SubS_GetPathByIndex(play, RU_GET_PATH(thisx), 0x3F); + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = EnRu_DoNothing; + this->actor.gravity = -4.0f; +} + +void EnRu_Destroy(Actor* thisx, PlayState* play) { + EnRu* this = THIS; + + Collider_DestroyCylinder(play, &this->collider); +} + +void EnRu_Update(Actor* thisx, PlayState* play) { + EnRu* this = THIS; + + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + EnRu_UpdateModel(this, play); + EnRu_UpdateCollider(this, play); +} + +s32 EnRu_OverrideLimbdraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + EnRu* this = THIS; + + if (limbIndex == RU2_LIMB_HEAD) { + Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY); + Matrix_RotateZS(this->headRot.x, MTXMODE_APPLY); + Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } + + if (limbIndex == RU2_LIMB_TORSO) { + Matrix_RotateYS(this->torsoRot.y, MTXMODE_APPLY); + Matrix_RotateXS(this->torsoRot.x, MTXMODE_APPLY); + } + + if ((limbIndex == RU2_LIMB_TORSO) || (limbIndex == RU2_LIMB_LEFT_UPPER_ARM) || + (limbIndex == RU2_LIMB_RIGHT_UPPER_ARM)) { + rot->y += (s16)(Math_SinS(this->limbRotTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->limbRotTableZ[limbIndex]) * 200.0f); + } + + return false; +} + +void EnRu_PostLimbdraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + EnRu* this = THIS; + Vec3f headFocus = { 800.0f, 0, 0 }; + Vec3f bodyPartPos = { 0, 0, 0 }; + + if (sBodyPartPosIndices[limbIndex] >= 0) { + Matrix_MultVec3f(&bodyPartPos, &this->bodyPartsPos[sBodyPartPosIndices[limbIndex]]); + } + if (limbIndex == RU2_LIMB_HEAD) { + Matrix_MultVec3f(&headFocus, &thisx->focus.pos); + } + + if (limbIndex == RU2_LIMB_LEFT_FOOT) { + Matrix_MultVec3f(&bodyPartPos, &this->leftFootPos); + } + if (limbIndex == RU2_LIMB_RIGHT_FOOT) { + Matrix_MultVec3f(&bodyPartPos, &this->rightFootPos); + } +} + +// This is a copy of displaylist found in En_Zo +static Gfx sTransparencyDlist[] = { + gsDPSetRenderMode(AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + G_RM_FOG_SHADE_A, + AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)), + gsDPSetAlphaCompare(G_AC_THRESHOLD), + gsSPEndDisplayList(), +}; + +void EnRu_Draw(Actor* thisx, PlayState* play) { + EnRu* this = THIS; + u8* shadowTex = GRAPH_ALLOC(play->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); + u8* shadowTexIter; + s32 i; + TexturePtr eyeTextures[] = { gAdultRutoEyeOpenTex, gAdultRutoEyeHalfTex, gAdultRutoEyeClosedTex }; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + + gDPPipeSync(POLY_OPA_DISP++); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(eyeTextures[this->eyeState])); + + // only runs the last command of the display list, which is gsSPEndDisplayList + gSPSegment(POLY_OPA_DISP++, 0x0C, &sTransparencyDlist[2]); + + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRu_OverrideLimbdraw, EnRu_PostLimbdraw, &this->actor, POLY_OPA_DISP); + + Matrix_RotateXS(0, MTXMODE_NEW); + + for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) { + *shadowTexIter++ = 0; + } + + for (i = 0; i < 5; i++) { + SubS_GenShadowTex(&this->bodyPartsPos[0], &this->actor.world.pos, shadowTex, (i / 5.0f), + (ARRAY_COUNT(sRuBodyParts)), sRuShadowSizes, sRuBodyParts); + } + + SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.h b/src/overlays/actors/ovl_En_Ru/z_en_ru.h index 29c903aff2..b1144f88d7 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.h +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.h @@ -2,15 +2,40 @@ #define Z_EN_RU_H #include "global.h" +#include "objects/object_ru2/object_ru2.h" + +#define RU_GET_PATH(thisx) ((thisx->params & 0x7E00) >> 9) struct EnRu; typedef void (*EnRuActionFunc)(struct EnRu*, PlayState*); +#define RU_BODYPARTSPOS_COUNT 15 + typedef struct EnRu { /* 0x000 */ Actor actor; /* 0x144 */ EnRuActionFunc actionFunc; - /* 0x148 */ char unk_148[0x30C]; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ UNK_TYPE1 pad1D8[0x4]; + /* 0x1DC */ Path* path; // path is prepared in EnRu_Init, but unused after + /* 0x1E0 */ UNK_TYPE1 pad1E0[0x4]; + /* 0x1E4 */ Vec3f leftFootPos; + /* 0x1F0 */ Vec3f rightFootPos; + /* 0x1FC */ u8 isLeftFootGrounded; + /* 0x1FD */ u8 isRightFootGrounded; + /* 0x1FE */ Vec3s jointTable[RU2_LIMB_MAX]; + /* 0x288 */ Vec3s morphTable[RU2_LIMB_MAX]; + /* 0x312 */ Vec3s trackTarget; + /* 0x318 */ Vec3s headRot; + /* 0x31E */ Vec3s torsoRot; + /* 0x324 */ UNK_TYPE1 pad324[0x12]; + /* 0x336 */ s16 limbRotTableY[RU2_LIMB_MAX]; + /* 0x364 */ s16 limbRotTableZ[RU2_LIMB_MAX]; + /* 0x394 */ Vec3f bodyPartsPos[RU_BODYPARTSPOS_COUNT]; + /* 0x348 */ UNK_TYPE1 padUNK[6]; + /* 0x44E */ s16 eyeState; + /* 0x450 */ s16 blinkTimer; } EnRu; // size = 0x454 extern const ActorInit En_Ru_InitVars; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 62cb638d94..ea4f7be32b 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -230,7 +230,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->unk_3D6 = ENSKB_GET_F0(&this->actor); this->actor.floorHeight = this->actor.world.pos.y; - if ((play->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } 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 4f17b98806..b698777588 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -442,7 +442,7 @@ void EnSob1_EndInteraction(PlayState* play, EnSob1* this) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -933,7 +933,7 @@ void EnSob1_SetupBuyItemWithFanfare(PlayState* play, EnSob1* this) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; EnSob1_SetupAction(this, EnSob1_BuyItemWithFanfare); } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 6e79155393..408ca1b2f2 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -654,7 +654,7 @@ void EnSsh_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; this->initialYaw = this->actor.world.rot.y; EnSsh_SetupAction(this, EnSsh_Start); - if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { Actor_MarkForDeath(&this->actor); } } 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 4354e7f58d..1d9ddf4e96 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -113,7 +113,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { break; case ENSTH_F_2: - if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { this->actionFunc = func_80B67DA0; } else { Actor_MarkForDeath(&this->actor); @@ -148,7 +148,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { break; case ENSTH_F_5: - if (!(gSaveContext.save.weekEventReg[13] & 0x20) || (Inventory_GetSkullTokenCount(play->sceneNum) < 30)) { + if (!(gSaveContext.save.weekEventReg[13] & 0x20) || (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { Actor_MarkForDeath(&this->actor); return; } @@ -446,7 +446,7 @@ void func_80B67984(EnSth* this, PlayState* play) { sp1E = 0x918; } func_80B670A4(this, 2); - } else if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + } else if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { if (INV_CONTENT(ITEM_MASK_TRUTH) == ITEM_MASK_TRUTH) { this->unk_29C |= 4; sp1E = 0x919; @@ -559,7 +559,7 @@ void func_80B67DA0(EnSth* this, PlayState* play) { void func_80B67E20(Actor* thisx, PlayState* play) { EnSth* this = THIS; - if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { this->actor.update = func_80B680A8; this->actor.draw = func_80B6849C; this->actor.flags |= ACTOR_FLAG_1; @@ -580,7 +580,7 @@ void EnSth_Update(Actor* thisx, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_0045B4); this->unk_29A = 1; if ((gSaveContext.save.weekEventReg[34] & 0x10) || (gSaveContext.save.weekEventReg[34] & 0x20) || - (gSaveContext.save.weekEventReg[34] & 0x40) || (Inventory_GetSkullTokenCount(play->sceneNum) >= 30)) { + (gSaveContext.save.weekEventReg[34] & 0x40) || (Inventory_GetSkullTokenCount(play->sceneId) >= 30)) { func_80B670A4(this, 3); } } else { @@ -610,7 +610,7 @@ void EnSth_Update(Actor* thisx, PlayState* play) { break; } - if ((ENSTH_GET_F(&this->actor) == ENSTH_F_4) && (Inventory_GetSkullTokenCount(play->sceneNum) < 30)) { + if ((ENSTH_GET_F(&this->actor) == ENSTH_F_4) && (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { this->actor.update = func_80B67E20; this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 10cdec0791..bbce2ee6ca 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -942,7 +942,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->morphTable, 16); this->actor.draw = EnSuttari_Draw; this->actor.flags |= ACTOR_FLAG_1; - if (play->sceneNum == SCENE_IKANA) { + if (play->sceneId == SCENE_IKANA) { this->flags1 |= 1; if (gSaveContext.save.day == 1 || gSaveContext.save.day == 2) { this->animIndex = 2; @@ -958,7 +958,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BACEE0; return; } - } else if (play->sceneNum == SCENE_BACKTOWN) { + } else if (play->sceneId == SCENE_BACKTOWN) { if (gSaveContext.save.time >= CLOCK_TIME(0, 20) && gSaveContext.save.time < CLOCK_TIME(6, 00)) { Actor_MarkForDeath(&this->actor); } @@ -974,7 +974,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = func_80BAD004; return; - } else if (play->sceneNum == SCENE_ICHIBA) { + } else if (play->sceneId == SCENE_ICHIBA) { if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; @@ -984,7 +984,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->flags1 |= 2; this->actionFunc = func_80BAD5F8; return; - } else if (play->sceneNum == SCENE_AYASHIISHOP) { + } else if (play->sceneId == SCENE_AYASHIISHOP) { if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; @@ -1461,7 +1461,7 @@ void EnSuttari_Init(Actor* thisx, PlayState* play) { void EnSuttari_Destroy(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; - if ((play->sceneNum == SCENE_BACKTOWN) && !(this->flags2 & 4)) { + if ((play->sceneId == SCENE_BACKTOWN) && !(this->flags2 & 4)) { Audio_QueueSeqCmd(0x101400FF); } Collider_DestroyCylinder(play, &this->collider); @@ -1542,7 +1542,7 @@ void EnSuttari_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } else { func_8012C28C(play->state.gfxCtx); OPEN_DISPS(play->state.gfxCtx); - gSPDisplayList(POLY_OPA_DISP++, object_boj_DL_013380); + gSPDisplayList(POLY_OPA_DISP++, gBombShopBagDL); CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index ef89732958..6b05f739d1 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -6,7 +6,6 @@ #include "z_en_syateki_crow.h" #include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" -#include "objects/object_crow/object_crow.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) @@ -17,14 +16,14 @@ void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play); void EnSyatekiCrow_Update(Actor* thisx, PlayState* play); void EnSyatekiCrow_Draw(Actor* thisx, PlayState* play); -void func_809CA5D4(EnSyatekiCrow* this); -void func_809CA67C(EnSyatekiCrow* this, PlayState* play); -void func_809CA71C(EnSyatekiCrow* this); -void func_809CA840(EnSyatekiCrow* this, PlayState* play); -void func_809CA8E4(EnSyatekiCrow* this, PlayState* play); -void func_809CABC0(EnSyatekiCrow* this, PlayState* play); +void EnSyatekiCrow_SetupWaitForSpawn(EnSyatekiCrow* this); +void EnSyatekiCrow_WaitForSpawn(EnSyatekiCrow* this, PlayState* play); +void EnSyatekiCrow_SetupWaitToMove(EnSyatekiCrow* this); +void EnSyatekiCrow_WaitToMove(EnSyatekiCrow* this, PlayState* play); +void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play); +void EnSyatekiCrow_Dead(EnSyatekiCrow* this, PlayState* play); -static Vec3f D_809CB050 = { 0.0f, 0.0f, 0.0f }; +static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; const ActorInit En_Syateki_Crow_InitVars = { ACTOR_EN_SYATEKI_CROW, @@ -72,12 +71,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP), }; -static Vec3f D_809CB0C0 = { 0.0f, 20.0f, 0.0f }; - -static Vec3f D_809CB0CC = { 0.0f, 0.0f, 0.0f }; - -static Vec3f D_809CB0D8 = { 2500.0f, 0.0f, 0.0f }; - void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnSyatekiCrow* this = THIS; @@ -97,9 +90,9 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); - Collider_InitJntSph(play, &this->unk_23C); - Collider_SetJntSph(play, &this->unk_23C, &this->actor, &sJntSphInit, &this->unk_25C); - this->unk_23C.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); if ((path == NULL) || (EN_SYATEKI_CROW_GET_NUMBER(&this->actor) >= 0x80)) { @@ -107,108 +100,110 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { return; } - this->unk_1C8 = Lib_SegmentedToVirtual(path->points); - this->unk_1CC = 1; - this->unk_1CE = path->count; - this->unk_1C4 = 0x14; - this->unk_1BC = 0; - func_809CA5D4(this); + this->pathPoints = Lib_SegmentedToVirtual(path->points); + this->currentPointIndex = 1; + this->maxPointIndex = path->count; + this->deathTimer = 20; + this->waitTimer = 0; + EnSyatekiCrow_SetupWaitForSpawn(this); } void EnSyatekiCrow_Destroy(Actor* thisx, PlayState* play) { EnSyatekiCrow* this = THIS; - Collider_DestroyJntSph(play, &this->unk_23C); + Collider_DestroyJntSph(play, &this->collider); } -void func_809CA5D4(EnSyatekiCrow* this) { +void EnSyatekiCrow_SetupWaitForSpawn(EnSyatekiCrow* this) { Actor_SetScale(&this->actor, 0.03f); this->actor.speedXZ = 0.0f; this->actor.gravity = 0.0f; this->actor.world = this->actor.home; this->actor.prevPos = this->actor.home.pos; this->actor.shape.rot = this->actor.world.rot; - this->unk_1CC = 1; + this->currentPointIndex = 1; this->actor.draw = NULL; - this->actionFunc = func_809CA67C; + this->actionFunc = EnSyatekiCrow_WaitForSpawn; } -void func_809CA67C(EnSyatekiCrow* this, PlayState* play) { +/** + * Waits until the shooting gallery man sets the appropriate Guay flag to spawn. + */ +void EnSyatekiCrow_WaitForSpawn(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->unk_1C2 == 1) && + if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isActive == true) && (syatekiMan->guayFlags & (1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)))) { - func_809CA71C(this); + EnSyatekiCrow_SetupWaitToMove(this); } else if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { - this->unk_1C2 = 1; + this->isActive = true; } if ((syatekiMan->guayFlags == 0) && (syatekiMan->guayFlags == 0)) { - this->unk_1C2 = 1; + this->isActive = true; } } -void func_809CA71C(EnSyatekiCrow* this) { - Vec3f sp24; - s16 temp; +void EnSyatekiCrow_SetupWaitToMove(EnSyatekiCrow* this) { + Vec3f targetPos; - this->actor.world.pos.x = this->unk_1C8[0].x; - this->actor.world.pos.y = this->unk_1C8[0].y; - this->actor.world.pos.z = this->unk_1C8[0].z; - sp24.x = this->unk_1C8[this->unk_1CC].x; - sp24.y = this->unk_1C8[this->unk_1CC].y; - sp24.z = this->unk_1C8[this->unk_1CC].z; - temp = Math_Vec3f_Yaw(&this->actor.world.pos, &sp24); - this->actor.world.rot.y = temp; - this->actor.shape.rot.y = temp; - temp = Math_Vec3f_Pitch(&this->actor.world.pos, &sp24); - this->actor.shape.rot.x = temp; - this->actor.world.rot.x = temp; + this->actor.world.pos.x = this->pathPoints[0].x; + this->actor.world.pos.y = this->pathPoints[0].y; + this->actor.world.pos.z = this->pathPoints[0].z; + targetPos.x = this->pathPoints[this->currentPointIndex].x; + targetPos.y = this->pathPoints[this->currentPointIndex].y; + targetPos.z = this->pathPoints[this->currentPointIndex].z; + this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &targetPos); + this->actor.world.rot.x = this->actor.shape.rot.x = Math_Vec3f_Pitch(&this->actor.world.pos, &targetPos); this->actor.draw = EnSyatekiCrow_Draw; - this->actionFunc = func_809CA840; + this->actionFunc = EnSyatekiCrow_WaitToMove; } -void func_809CA840(EnSyatekiCrow* this, PlayState* play) { - if (((EN_SYATEKI_CROW_GET_PARAM_F(&this->actor) * 20) + 20) < this->unk_1BC) { +/** + * Waits until the wait timer reaches a certain point, then starts flying forward. + * How long the Guay should wait is controlled by its params. + */ +void EnSyatekiCrow_WaitToMove(EnSyatekiCrow* this, PlayState* play) { + if (((EN_SYATEKI_CROW_GET_WAIT_MOD(&this->actor) * 20) + 20) < this->waitTimer) { Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_KAICHO_CRY); - this->unk_1BC = 0; - this->actor.speedXZ = EN_SYATEKI_CROW_GET_PARAM_F0(&this->actor) + 6.0f; + this->waitTimer = 0; + this->actor.speedXZ = EN_SYATEKI_CROW_GET_SPEED_MOD(&this->actor) + 6.0f; this->actor.gravity = -0.5f; - this->actionFunc = func_809CA8E4; + this->actionFunc = EnSyatekiCrow_Fly; } else { - this->unk_1BC++; + this->waitTimer++; } } -void func_809CA8E4(EnSyatekiCrow* this, PlayState* play) { - Vec3f sp34; - f32 sp30; +void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play) { + Vec3f targetPoint; + f32 distToTarget; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { - func_809CA5D4(this); + EnSyatekiCrow_SetupWaitForSpawn(this); return; } - sp34.x = this->unk_1C8[this->unk_1CC].x; - sp34.y = this->unk_1C8[this->unk_1CC].y; - sp34.z = this->unk_1C8[this->unk_1CC].z; + targetPoint.x = this->pathPoints[this->currentPointIndex].x; + targetPoint.y = this->pathPoints[this->currentPointIndex].y; + targetPoint.z = this->pathPoints[this->currentPointIndex].z; - sp30 = Math_Vec3f_DistXZ(&this->actor.world.pos, &sp34); - this->unk_1C0 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp34); - this->unk_1BE = Math_Vec3f_Pitch(&this->actor.world.pos, &sp34); + distToTarget = Math_Vec3f_DistXZ(&this->actor.world.pos, &targetPoint); + this->yawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &targetPoint); + this->pitchTarget = Math_Vec3f_Pitch(&this->actor.world.pos, &targetPoint); - if (sp30 > 100.0f) { - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_1C0, 5, 0x3000, 0x100); + if (distToTarget > 100.0f) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTarget, 5, 0x3000, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; - Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk_1BE, 5, 0x3000, 0x100); + Math_SmoothStepToS(&this->actor.shape.rot.x, this->pitchTarget, 5, 0x3000, 0x100); this->actor.world.rot.x = -this->actor.shape.rot.x; - } else if (this->unk_1CC < (this->unk_1CE - 1)) { - this->unk_1CC++; + } else if (this->currentPointIndex < (this->maxPointIndex - 1)) { + this->currentPointIndex++; } else { - this->unk_1C2 = 0; + this->isActive = false; syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)); - func_809CA5D4(this); + EnSyatekiCrow_SetupWaitForSpawn(this); } SkelAnime_Update(&this->skelAnime); @@ -218,21 +213,21 @@ void func_809CA8E4(EnSyatekiCrow* this, PlayState* play) { } } -void func_809CAAF8(EnSyatekiCrow* this) { +void EnSyatekiCrow_SetupDead(EnSyatekiCrow* this) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; syatekiMan->score += 60; - this->unk_1C2 = 0; + this->isActive = false; this->actor.speedXZ *= Math_CosS(this->actor.world.rot.x); this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &gGuayFlyAnim, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f); this->actor.bgCheckFlags &= ~1; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KAICHO_DEAD); Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40); - this->actionFunc = func_809CABC0; + this->actionFunc = EnSyatekiCrow_Dead; } -void func_809CABC0(EnSyatekiCrow* this, PlayState* play) { +void EnSyatekiCrow_Dead(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); @@ -243,30 +238,34 @@ void func_809CABC0(EnSyatekiCrow* this, PlayState* play) { this->actor.shape.rot.z += 0x1780; } - if (this->unk_1C4 > 20) { - func_800B3030(play, &this->actor.world.pos, &D_809CB050, &D_809CB050, this->actor.scale.x * 10000.0f, 0, 0); + if (this->deathTimer > 20) { + func_800B3030(play, &this->actor.world.pos, &sZeroVec, &sZeroVec, this->actor.scale.x * 10000.0f, 0, 0); syatekiMan->guayHitCounter++; syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)); - func_809CA5D4(this); + EnSyatekiCrow_SetupWaitForSpawn(this); } - this->unk_1C4++; + this->deathTimer++; } -void func_809CACD0(EnSyatekiCrow* this, PlayState* play) { - if (this->actionFunc == func_809CA8E4) { - if (this->unk_23C.base.acFlags & AC_HIT) { +static Vec3f sVelocity = { 0.0f, 20.0f, 0.0f }; + +static Vec3f sAccel = { 0.0f, 0.0f, 0.0f }; + +void EnSyatekiCrow_UpdateDamage(EnSyatekiCrow* this, PlayState* play) { + if (this->actionFunc == EnSyatekiCrow_Fly) { + if (this->collider.base.acFlags & AC_HIT) { play_sound(NA_SE_SY_TRE_BOX_APPEAR); - this->unk_1C4 = 0; - this->unk_23C.base.acFlags &= ~AC_HIT; - EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_809CB0C0, &D_809CB0CC, 5, 1); - func_809CAAF8(this); + this->deathTimer = 0; + this->collider.base.acFlags &= ~AC_HIT; + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 1); + EnSyatekiCrow_SetupDead(this); } else { - this->unk_23C.elements->dim.worldSphere.center.x = this->actor.world.pos.x; - this->unk_23C.elements->dim.worldSphere.center.y = + this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; + this->collider.elements[0].dim.worldSphere.center.y = sJntSphInit.elements[0].dim.modelSphere.center.y + this->actor.world.pos.y; - this->unk_23C.elements->dim.worldSphere.center.z = this->actor.world.pos.z; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_23C.base); + this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } } @@ -276,39 +275,41 @@ void EnSyatekiCrow_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->actionFunc != func_809CABC0) { + if (this->actionFunc != EnSyatekiCrow_Dead) { Actor_MoveWithoutGravity(&this->actor); } else { Actor_MoveWithGravity(&this->actor); } - func_809CACD0(this, play); + EnSyatekiCrow_UpdateDamage(this, play); } s32 EnSyatekiCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSyatekiCrow* this = THIS; if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) { - rot->y += (s16)(3072.0f * sin_rad(this->skelAnime.curFrame * (M_PI / 4))); + rot->y += (s16)(0xC00 * sin_rad(this->skelAnime.curFrame * (M_PI / 4))); } else if (limbIndex == OBJECT_CROW_LIMB_TAIL) { - rot->y += (s16)(5120.0f * sin_rad((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); + rot->y += (s16)(0x1400 * sin_rad((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); } return false; } +static Vec3f sBodyOffset = { 2500.0f, 0.0f, 0.0f }; + void EnSyatekiCrow_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnSyatekiCrow* this = THIS; - Vec3f* sp1C; + Vec3f* bodyPartPos; if (limbIndex == OBJECT_CROW_LIMB_BODY) { - Matrix_MultVec3f(&D_809CB0D8, &this->unk_144[0]); - this->unk_144[0].y -= 20.0f; + Matrix_MultVec3f(&sBodyOffset, &this->bodyPartsPos[0]); + this->bodyPartsPos[0].y -= 20.0f; } else if ((limbIndex == OBJECT_CROW_LIMB_RIGHT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_LEFT_WING_TIP) || (limbIndex == OBJECT_CROW_LIMB_TAIL)) { - sp1C = &this->unk_144[(limbIndex >> 1) - 1]; - Matrix_MultVec3f(&D_809CB050, sp1C); - sp1C->y -= 20.0f; + bodyPartPos = &this->bodyPartsPos[(limbIndex >> 1) - 1]; + Matrix_MultVec3f(&sZeroVec, bodyPartPos); + bodyPartPos->y -= 20.0f; } } diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h index 05eec4ad0c..e70a3dd216 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h @@ -2,11 +2,12 @@ #define Z_EN_SYATEKI_CROW_H #include "global.h" +#include "objects/object_crow/object_crow.h" -#define EN_SYATEKI_CROW_GET_PARAM_F(thisx) ((thisx)->params & 0xF) -#define EN_SYATEKI_CROW_GET_PARAM_F0(thisx) (((thisx)->params & 0xF0) >> 4) +#define EN_SYATEKI_CROW_GET_WAIT_MOD(thisx) ((thisx)->params & 0xF) +#define EN_SYATEKI_CROW_GET_SPEED_MOD(thisx) (((thisx)->params & 0xF0) >> 4) #define EN_SYATEKI_CROW_GET_NUMBER(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_CROW_PARAMS(number, unkF0, unkF) (((number << 8) & 0xFF00) | ((unkF0 << 4) & 0xF0) | (unkF & 0xF)) +#define EN_SYATEKI_CROW_PARAMS(number, speedMod, waitMod) (((number << 8) & 0xFF00) | ((speedMod << 4) & 0xF0) | (waitMod & 0xF)) struct EnSyatekiCrow; @@ -14,21 +15,21 @@ typedef void (*EnSyatekiCrowActionFunc)(struct EnSyatekiCrow*, PlayState*); typedef struct EnSyatekiCrow { /* 0x000 */ Actor actor; - /* 0x144 */ Vec3f unk_144[4]; + /* 0x144 */ Vec3f bodyPartsPos[4]; /* 0x174 */ SkelAnime skelAnime; /* 0x1B8 */ EnSyatekiCrowActionFunc actionFunc; - /* 0x1BC */ s16 unk_1BC; - /* 0x1BE */ s16 unk_1BE; - /* 0x1C0 */ s16 unk_1C0; - /* 0x1C2 */ s16 unk_1C2; - /* 0x1C4 */ s16 unk_1C4; - /* 0x1C8 */ Vec3s* unk_1C8; - /* 0x1CC */ s16 unk_1CC; - /* 0x1CE */ s16 unk_1CE; - /* 0x1D0 */ Vec3s jointTable[9]; - /* 0x206 */ Vec3s morphTable[9]; - /* 0x23C */ ColliderJntSph unk_23C; - /* 0x25C */ ColliderJntSphElement unk_25C; + /* 0x1BC */ s16 waitTimer; + /* 0x1BE */ s16 pitchTarget; + /* 0x1C0 */ s16 yawTarget; + /* 0x1C2 */ s16 isActive; + /* 0x1C4 */ s16 deathTimer; + /* 0x1C8 */ Vec3s* pathPoints; + /* 0x1CC */ s16 currentPointIndex; + /* 0x1CE */ s16 maxPointIndex; + /* 0x1D0 */ Vec3s jointTable[OBJECT_CROW_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CROW_LIMB_MAX]; + /* 0x23C */ ColliderJntSph collider; + /* 0x25C */ ColliderJntSphElement colliderElements[1]; } EnSyatekiCrow; // size = 0x29C extern const ActorInit En_Syateki_Crow_InitVars; diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index 51a941b284..1d504dc621 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -271,7 +271,8 @@ void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play) { void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((gSaveContext.unk_3DE0[1] <= 0) || (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) { + if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] <= SECONDS_TO_TIMER(0)) || + (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) { func_80A2C3AC(this); } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 7852aa24b8..a504ab5212 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -154,7 +154,7 @@ static s32 sSwampTargetActorListLengths[] = { }; static Vec3f sSwampPlayerPos = { 0.0f, 10.0f, 140.0f }; -static Vec3f sTownFierceDietyPlayerPos = { -20.0f, 20.0f, 198.0f }; +static Vec3f sTownFierceDeityPlayerPos = { -20.0f, 20.0f, 198.0f }; static Vec3f sTownPlayerPos = { -20.0f, 40.0f, 175.0f }; /** @@ -179,7 +179,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 1; Actor_SetScale(&this->actor, 0.01f); - if (play->sceneNum == SCENE_SYATEKI_MORI) { + if (play->sceneId == SCENE_SYATEKI_MORI) { SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, &gSwampShootingGalleryManHeadScratchLoopAnim, this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); } else { @@ -205,7 +205,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { this->eyeIndex = 0; this->blinkTimer = 0; - if (play->sceneNum == SCENE_SYATEKI_MORI) { + if (play->sceneId == SCENE_SYATEKI_MORI) { this->path = path; EnSyatekiMan_Swamp_SpawnTargetActors(this, play, sSwampTargetActorLists[this->swampTargetActorListIndex], actorListLength); @@ -247,9 +247,9 @@ s32 EnSyatekiMan_MovePlayerToPos(PlayState* play, Vec3f pos) { } void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play) { - if (play->sceneNum == SCENE_SYATEKI_MORI) { + if (play->sceneId == SCENE_SYATEKI_MORI) { this->actionFunc = EnSyatekiMan_Swamp_Idle; - } else if (play->sceneNum == SCENE_SYATEKI_MIZU) { + } else if (play->sceneId == SCENE_SYATEKI_MIZU) { this->actionFunc = EnSyatekiMan_Town_Idle; } } @@ -1012,7 +1012,7 @@ void EnSyatekiMan_Swamp_StartGame(EnSyatekiMan* this, PlayState* play) { this->guayHitCounter = 0; this->currentWave = 0; this->perGameVar2.bonusDekuScrubHitCounter = 0; - func_8010E9F0(1, 100); + Interface_StartTimer(TIMER_ID_MINIGAME_1, 100); this->actor.draw = NULL; this->actionFunc = EnSyatekiMan_Swamp_RunGame; } @@ -1061,9 +1061,9 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { this->perGameVar1.guaySpawnTimer++; - if (gSaveContext.unk_3DE0[1] == 0) { - gSaveContext.unk_3DE0[1] = 0; - gSaveContext.unk_3DD0[1] = 5; + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) { + gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0); + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->actor.draw = EnSyatekiMan_Draw; this->flagsIndex = 0; this->currentWave = 0; @@ -1082,10 +1082,10 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) { this->shootingGameState = SG_GAME_STATE_GIVING_BONUS; if (this->score == 2120) { func_8011B4E0(play, 2); - gSaveContext.unk_3DD0[1] = 6; + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_6; this->actionFunc = EnSyatekiMan_Swamp_AddBonusPoints; } else { - gSaveContext.unk_3DD0[1] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->actionFunc = EnSyatekiMan_Swamp_EndGame; } } @@ -1148,15 +1148,15 @@ void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) { player->stateFlags1 |= 0x20; if (play->interfaceCtx.unk_286 == 0) { - if (gSaveContext.unk_3DE0[1] == 0) { - gSaveContext.unk_3DE0[1] = 0; - gSaveContext.unk_3DD0[1] = 5; + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) { + gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0); + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->flagsIndex = 0; this->currentWave = 0; this->actionFunc = EnSyatekiMan_Swamp_EndGame; sBonusTimer = 0; } else if (sBonusTimer > 10) { - gSaveContext.unk_3E88[1] += 100; + gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] += SECONDS_TO_TIMER(1); play->interfaceCtx.unk_25C += 10; this->score += 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); @@ -1171,7 +1171,7 @@ void EnSyatekiMan_Town_MovePlayerAndSayHighScore(EnSyatekiMan* this, PlayState* Vec3f targetPlayerPos; if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) { - targetPlayerPos = sTownFierceDietyPlayerPos; + targetPlayerPos = sTownFierceDeityPlayerPos; } else { targetPlayerPos = sTownPlayerPos; } @@ -1198,7 +1198,7 @@ void EnSyatekiMan_Town_StartGame(EnSyatekiMan* this, PlayState* play) { if (sGameStartTimer == 30) { if (player->transformation == PLAYER_FORM_FIERCE_DEITY) { - player->actor.world.pos = sTownFierceDietyPlayerPos; + player->actor.world.pos = sTownFierceDeityPlayerPos; } else { player->actor.world.pos = sTownPlayerPos; } @@ -1220,7 +1220,7 @@ void EnSyatekiMan_Town_StartGame(EnSyatekiMan* this, PlayState* play) { this->perGameVar1.octorokState = SG_OCTO_STATE_INITIAL; this->perGameVar2.octorokHitType = SG_OCTO_HIT_TYPE_NONE; sGameStartTimer = 30; - func_8010E9F0(1, 75); + Interface_StartTimer(TIMER_ID_MINIGAME_1, 75); this->actor.draw = NULL; this->actionFunc = EnSyatekiMan_Town_RunGame; } @@ -1292,7 +1292,8 @@ static const s32 sOctorokFlagsPerWave[] = { void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { static s32 sModFromLosingTime = 0; Player* player = GET_PLAYER(play); - s32 timer = (((void)0, gSaveContext.unk_3DE0[1]) * 0.1f) + 1.0f; // unit is tenths of a second + s32 timer = + (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1]) * 0.1f) + 1.0f; // unit is tenths of a second if (timer <= 750) { s32 waveTimer; // unit is hundredths of a second @@ -1302,9 +1303,10 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { // begin hiding. This code will ultimately correct waveTimer such that its value is not affected by // hitting Blue Octoroks. if (sModFromLosingTime == 0) { - waveTimer = ((void)0, gSaveContext.unk_3DE0[1]) % 500; + waveTimer = ((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1]) % SECONDS_TO_TIMER(5); } else { - waveTimer = (((void)0, gSaveContext.unk_3DE0[1]) + 250) % 500; + waveTimer = (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1]) + SECONDS_TO_TIMER_PRECISE(2, 50)) % + SECONDS_TO_TIMER(5); } // Octoroks begin hiding four seconds after a wave begins. @@ -1314,7 +1316,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { if (this->perGameVar2.octorokHitType != SG_OCTO_HIT_TYPE_NONE) { if (this->perGameVar2.octorokHitType == SG_OCTO_HIT_TYPE_BLUE) { - gSaveContext.unk_3E18[1] -= 250; + gSaveContext.timerTimeLimits[TIMER_ID_MINIGAME_1] -= SECONDS_TO_TIMER_PRECISE(2, 50); sModFromLosingTime = (sModFromLosingTime + 25) % 50; } @@ -1336,11 +1338,11 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { } } - if (gSaveContext.unk_3DE0[1] == 0) { + if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) { this->flagsIndex = 0; this->perGameVar1.octorokState = SG_OCTO_STATE_HIDING; - gSaveContext.unk_3DE0[1] = 0; - gSaveContext.unk_3DD0[1] = 5; + gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0); + gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; player->stateFlags1 |= 0x20; sModFromLosingTime = 0; this->actor.draw = EnSyatekiMan_Draw; @@ -1445,7 +1447,7 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSyatekiMan* this = THIS; - if ((play->sceneNum == SCENE_SYATEKI_MIZU) && (limbIndex == BURLY_GUY_LIMB_HEAD)) { + if ((play->sceneId == SCENE_SYATEKI_MIZU) && (limbIndex == BURLY_GUY_LIMB_HEAD)) { *dList = gTownShootingGalleryManHeadDL; } @@ -1479,7 +1481,7 @@ void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { EnSyatekiMan* this = THIS; s32 pad; - if (play->sceneNum == SCENE_SYATEKI_MIZU) { + if (play->sceneId == SCENE_SYATEKI_MIZU) { sEyeTextures[0] = gTownShootingGalleryManEyeOpenTex; sEyeTextures[1] = gTownShootingGalleryManEyeClosedTex; sEyeTextures[2] = gTownShootingGalleryManEyeClosedTex; diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.c b/src/overlays/actors/ovl_En_Test2/z_en_test2.c index 54c3f0609c..c9151d6216 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -96,7 +96,7 @@ void EnTest2_Update(Actor* thisx, PlayState* play) { Actor_SetObjectDependency(play, &this->actor); this->animMat = Lib_SegmentedToVirtual(modelInfo->animMat); } - if (play->roomCtx.currRoom.unk5) { + if (play->roomCtx.curRoom.unk5) { this->actor.update = EnTest2_UpdateForLens; } else { this->actor.update = Actor_Noop; 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 2329c022f7..43989a4db3 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -388,7 +388,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { func_80A41FA4(this, play); } else if (temp_a0 == CLOCK_TIME(6, 0)) { if (CURRENT_DAY == 3) { - func_8011C808(play); + Interface_StartMoonCrash(play); Actor_MarkForDeath(&this->actor); gSaveContext.eventInf[1] |= 0x80; } else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) && @@ -436,7 +436,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { if (CURRENT_DAY == 3) { if ((this->nextBellTime == CLOCK_TIME(0, 0)) && ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || - (play->sceneNum == SCENE_CLOCKTOWER))) { + (play->sceneId == SCENE_CLOCKTOWER))) { s32 playerParams; u32 entrance = gSaveContext.save.entrance; @@ -448,7 +448,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, entrance, player->unk_3CE, playerParams, &player->unk_3C0, player->unk_3CC); - if ((play->sceneNum == SCENE_TENMON_DAI) || (play->sceneNum == SCENE_00KEIKOKU)) { + if ((play->sceneId == SCENE_TENMON_DAI) || (play->sceneId == SCENE_00KEIKOKU)) { play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0); } else { play->nextEntrance = ENTRANCE(SOUTH_CLOCK_TOWN, 0); @@ -507,9 +507,9 @@ void func_80A42F20(EnTest4* this, PlayState* play) { if (sCurrentCs >= 0) { ActorCutscene_Stop(sCurrentCs); } - gSaveContext.unk_3F22 = 0; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; gSaveContext.eventInf[1] &= (u8)~0x80; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } } diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index 6c6f3bd0fe..fa7ddde52e 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -658,7 +658,7 @@ void func_80AF2350(EnTest7* this, PlayState* play) { this->unk_148.unk_10 -= 0x2EE0; - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { play->nextEntrance = ENTRANCE(IKANA_CANYON, 6); } else if (ENTEST7_GET(&this->actor) == ENTEST7_26) { func_80169F78(&play->state); @@ -762,7 +762,7 @@ void func_80AF2938(EnTest7* this, PlayState* play) { player->stateFlags2 |= 0x20000000; this->unk_144 |= 2; this->unk_148.unk_04 = 30.0f; - if (play->roomCtx.currRoom.unk3 != 1) { + if (play->roomCtx.curRoom.unk3 != 1) { func_80AF082C(this, func_80AF2AE8); } else { func_80AF082C(this, func_80AF2EC8); diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index c090a050de..f4c970ea80 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -1,10 +1,11 @@ /* * File: z_en_tg.c * Overlay: ovl_En_Tg - * Description: Target Game (Honey & Darling) + * Description: Target Game (Honey & Darling) - End Credits Scene */ #include "z_en_tg.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -15,9 +16,11 @@ void EnTg_Destroy(Actor* thisx, PlayState* play); void EnTg_Update(Actor* thisx, PlayState* play); void EnTg_Draw(Actor* thisx, PlayState* play); -void func_8098FA70(EnTg* this, PlayState* play); +void EnTg_Idle(EnTg* this, PlayState* play); +void EnTg_UpdateHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects); +void EnTg_DrawHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects); +void EnTg_SpawnHeart(EnTg* this, EnTgHeartEffect* effect, Vec3f* heartStartPos, s32 numEffects); -#if 0 const ActorInit En_Tg_InitVars = { ACTOR_EN_TG, ACTORCAT_NPC, @@ -30,18 +33,29 @@ const ActorInit En_Tg_InitVars = { (ActorFunc)EnTg_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809901C0 = { - { COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT0, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 64, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_809901EC = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_809901F8 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(0, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -76,37 +90,193 @@ static DamageTable D_809901F8 = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -#endif +static AnimationInfoS sAnimationInfo[] = { + { &gHoneyAndDarlingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +}; -extern ColliderCylinderInit D_809901C0; -extern CollisionCheckInfoInit2 D_809901EC; -extern DamageTable D_809901F8; +void EnTg_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s16 animIndex) { + f32 endFrame; -extern UNK_TYPE D_0600B0E0; -extern UNK_TYPE D_0600B2B0; + animationInfo += animIndex; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098F800.s") + if (animationInfo->frameCount < 0) { + endFrame = Animation_GetLastFrame(animationInfo->animation); + } else { + endFrame = animationInfo->frameCount; + } + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, endFrame, + animationInfo->mode, animationInfo->morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098F8A8.s") +void EnTg_UpdateCollider(EnTg* this, PlayState* play) { + this->collider.dim.pos.x = this->actor.world.pos.x; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->collider.dim.pos.z = this->actor.world.pos.z; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098F928.s") +void EnTg_UpdateSkelAnime(EnTg* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Init.s") +void EnTg_Init(Actor* thisx, PlayState* play) { + EnTg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Destroy.s") + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gHoneyAndDarlingSkel, NULL, this->jointTable, this->morphTable, + HONEY_AND_DARLING_LIMB_MAX); + EnTg_ChangeAnim(&this->skelAnime, sAnimationInfo, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = EnTg_Idle; + this->actor.gravity = -4.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FA70.s") +void EnTg_Destroy(Actor* thisx, PlayState* play) { + EnTg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Update.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FBB4.s") +/** + * The actor spins, and a heart is spawned above the actor every 12 frames. + */ +void EnTg_Idle(EnTg* this, PlayState* play) { + Vec3f heartStartPos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FBD0.s") + this->actor.shape.rot.y += sREG(0) + 0x258; + this->actor.world.rot = this->actor.shape.rot; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Draw.s") + if (DECR(this->spawnHeartTimer) == 0) { + this->spawnHeartTimer = 12; + heartStartPos = this->actor.world.pos; + heartStartPos.y += 62.0f; + EnTg_SpawnHeart(this, this->effects, &heartStartPos, ARRAY_COUNT(this->effects)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FD50.s") +void EnTg_Update(Actor* thisx, PlayState* play) { + EnTg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FEA8.s") + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + EnTg_UpdateSkelAnime(this, play); + EnTg_UpdateHearts(play, this->effects, ARRAY_COUNT(this->effects)); + EnTg_UpdateCollider(this, play); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8099000C.s") +s32 EnTg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + return false; +} + +void EnTg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnTg* this = THIS; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + + if (limbIndex == HONEY_AND_DARLING_LIMB_MAN_HEAD) { + Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); + } +} + +void EnTg_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnTg* this = THIS; + + Matrix_Push(); + EnTg_DrawHearts(play, this->effects, ARRAY_COUNT(this->effects)); + Matrix_Pop(); + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 0, 50, 160, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 255, 255, 255, 0)); + + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTg_OverrideLimbDraw, EnTg_PostLimbDraw, &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Spawns a heart at the first effects array index that's not enabled. + * Because of the frame counts, only two hearts are ever spawned at a time. + */ +void EnTg_SpawnHeart(EnTg* this, EnTgHeartEffect* effect, Vec3f* heartStartPos, s32 numEffects) { + Vec3f heartVelocity = { 0.0f, 1.5f, 0.0f }; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + s32 i; + + for (i = 0; i < numEffects && effect->isEnabled; i++, effect++) {} + + if (i < numEffects) { + effect->isEnabled = true; + effect->pos = *heartStartPos; + effect->velocity = heartVelocity; + effect->unusedZeroVec = zeroVec; + effect->scale = 0.01f; + effect->pos.x += 4.0f * Math_SinS(this->actor.shape.rot.y); + effect->pos.z += 4.0f * Math_CosS(this->actor.shape.rot.y); + effect->timer = 16; + } +} + +/** + * The heart path is curvy as it floats up because of the use of Math_SinS and Math_CosS. + */ +void EnTg_UpdateHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects) { + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + s16 yaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); + s32 i; + + for (i = 0; i < numEffects; i++, effect++) { + if (effect->isEnabled == true) { + if (DECR(effect->timer) == 0) { + effect->isEnabled = false; + } + effect->pos.y += effect->velocity.y; + effect->pos.x += 2.0f * Math_SinS(effect->angle); + effect->pos.z += 2.0f * Math_CosS(effect->angle); + + Matrix_Push(); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_RotateYS(yaw, MTXMODE_APPLY); + Matrix_MultVec3f(&zeroVec, &effect->pos); + Matrix_Pop(); + + effect->angle += 0x1770; + } + } +} + +void EnTg_DrawHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects) { + s32 i; + s32 isMaterialApplied = false; + + OPEN_DISPS(play->state.gfxCtx); + + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); + POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); + + for (i = 0; i < numEffects; i++, effect++) { + if (effect->isEnabled == true) { + if (!isMaterialApplied) { + gSPDisplayList(POLY_OPA_DISP++, gHoneyAndDarlingHeartMaterialDL); + isMaterialApplied = true; + } + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); + + 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++, gHoneyAndDarlingHeartModelDL); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.h b/src/overlays/actors/ovl_En_Tg/z_en_tg.h index 2798b99b3d..3cdcb57f1d 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.h +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.h @@ -2,15 +2,33 @@ #define Z_EN_TG_H #include "global.h" +#include "objects/object_mu/object_mu.h" struct EnTg; typedef void (*EnTgActionFunc)(struct EnTg*, PlayState*); +typedef struct EnTgHeartEffect { + /* 0x00 */ u8 isEnabled; + /* 0x01 */ u8 timer; + /* 0x04 */ f32 scale; + /* 0x08 */ UNK_TYPE1 unk8[0xC]; + /* 0x14 */ Vec3f pos; + /* 0x20 */ Vec3f unusedZeroVec; + /* 0x2C */ Vec3f velocity; + /* 0x38 */ s16 angle; +} EnTgHeartEffect; // size = 0x3C + typedef struct EnTg { /* 0x000 */ Actor actor; /* 0x144 */ EnTgActionFunc actionFunc; - /* 0x148 */ char unk_148[0x400]; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ UNK_TYPE1 unk1D8[0x18]; + /* 0x1F0 */ Vec3s jointTable[HONEY_AND_DARLING_LIMB_MAX]; + /* 0x26E */ Vec3s morphTable[HONEY_AND_DARLING_LIMB_MAX]; + /* 0x2EC */ s16 spawnHeartTimer; + /* 0x2F0 */ EnTgHeartEffect effects[10]; } EnTg; // size = 0x548 extern const ActorInit En_Tg_InitVars; diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index b6dea09f33..04e44bb168 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -90,7 +90,7 @@ void func_80AC9FE4(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actionFunc = func_80AC9FD4; - gSaveContext.unk_3DD0[3] = 0; + gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { gSaveContext.save.weekEventReg[25] |= 2; @@ -107,7 +107,7 @@ void func_80ACA0A8(EnTimeTag* this, PlayState* play) { if (this->actor.cutscene != -1) { this->actionFunc = func_80AC9FE4; ActorCutscene_SetIntentToPlay(this2->actor.cutscene); - gSaveContext.unk_3DD0[3] = 0; + gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; } play->msgCtx.ocarinaMode = 4; } @@ -284,7 +284,7 @@ void func_80ACA840(EnTimeTag* this, PlayState* play) { s16 temp_ft4; s16 temp_hi; - if ((play->sceneNum != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { + if ((play->sceneId != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { temp_ft4 = gSaveContext.save.time * (24.0f / 0x10000); // TIME_TO_HOURS_F temp_hi = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; if (gSaveContext.save.weekEventReg[63] & 1) { 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 6dda48fc7f..a55c899eff 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -184,15 +184,15 @@ void EnToto_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (play->sceneNum == SCENE_MILK_BAR && - (gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < CLOCK_TIME(21, 30))) { + if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)) && + (gSaveContext.save.time < CLOCK_TIME(21, 30))) { Actor_MarkForDeath(&this->actor); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= 0x400; SkelAnime_InitFlex(play, &this->skelAnime, &object_zm_Skel_00A978, - ((play->sceneNum == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), + ((play->sceneId == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), this->jointTable, this->morphTable, 18); func_80BA36C0(this, play, 0); this->actor.shape.rot.x = 0; @@ -220,7 +220,7 @@ void func_80BA383C(EnToto* this, PlayState* play) { void func_80BA3930(EnToto* this, PlayState* play) { AnimationHeader* animationHeader = &object_zm_Anim_00C880; - if (play->sceneNum == SCENE_SONCHONOIE) { + if (play->sceneId == SCENE_SONCHONOIE) { animationHeader = &object_zm_Anim_003AA8; } Animation_MorphToLoop(&this->skelAnime, animationHeader, -4.0f); @@ -242,7 +242,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { func_80BA383C(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80BA36C0(this, play, 1); - if (play->sceneNum != SCENE_SONCHONOIE) { + if (play->sceneId != SCENE_SONCHONOIE) { Flags_SetSwitch(play, this->actor.params & 0x7F); } else if (player->transformation == PLAYER_FORM_DEKU) { Flags_SetSwitch(play, this->actor.home.rot.x); @@ -252,9 +252,9 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro - if ((play->sceneNum == SCENE_MILK_BAR && - !(gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < 0xED02)) || - (play->sceneNum != SCENE_MILK_BAR && func_80BA397C(this, 0x2000))) { + if (((play->sceneId == SCENE_MILK_BAR) && + !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < 0xED02))) || + ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { this->text = D_80BA5044; this->actor.flags |= ACTOR_FLAG_10000; @@ -262,7 +262,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } else { this->actor.flags &= ~ACTOR_FLAG_10000; func_800B8614(&this->actor, play, 50.0f); - if (play->sceneNum == SCENE_SONCHONOIE) { + if (play->sceneId == SCENE_SONCHONOIE) { if (player->transformation == PLAYER_FORM_DEKU) { if (!Flags_GetSwitch(play, this->actor.home.rot.x)) { this->text = D_80BA5068; @@ -286,7 +286,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } void func_80BA3BFC(EnToto* this, PlayState* play) { - if (play->sceneNum == SCENE_SONCHONOIE) { + if (play->sceneId == SCENE_SONCHONOIE) { Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_000C80, -4.0f); this->unk2B4 = 0; } else { 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 39a16dea9e..71abb140ac 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -219,7 +219,7 @@ void EnTrt_EndInteraction(PlayState* play, EnTrt* this) { Actor_ProcessTalkRequest(&this->actor, &play->state); play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->stickLeftPrompt.isEnabled = false; this->stickRightPrompt.isEnabled = false; @@ -653,7 +653,7 @@ void EnTrt_SetupBuyItemWithFanfare(PlayState* play, EnTrt* this) { play->msgCtx.msgMode = 0x43; play->msgCtx.stateTimer = 4; player->stateFlags2 &= ~0x20000000; - Interface_ChangeAlpha(50); + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); this->drawCursor = 0; this->actionFunc = EnTrt_BuyItemWithFanfare; } 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 1f521d250a..ac6a4f4763 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -752,7 +752,7 @@ void func_80AD4DB4(EnTrt2* this, PlayState* play) { return; } - if ((play->sceneNum == SCENE_20SICHITAI) || (play->sceneNum == SCENE_20SICHITAI2)) { + if ((play->sceneId == SCENE_20SICHITAI) || (play->sceneId == SCENE_20SICHITAI2)) { if (gSaveContext.save.day == 2) { if (!(gSaveContext.save.weekEventReg[15] & 0x80)) { gSaveContext.save.weekEventReg[15] |= 0x80; @@ -790,7 +790,7 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play) { D_80AD5910[this->unk_3B2](this, play); Actor_MoveWithGravity(&this->actor); - if (play->sceneNum != SCENE_20SICHITAI) { + if (play->sceneId != SCENE_20SICHITAI) { Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 43c2dc1e5d..926f88f700 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -102,7 +102,7 @@ void func_8089F17C(EnViewer* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 xzDist = fabsf(this->actor.xzDistToPlayer); - if ((((play->roomCtx.currRoom.num == this->actor.room) && (xzDist <= this->unk_148)) && + if ((((play->roomCtx.curRoom.num == this->actor.room) && (xzDist <= this->unk_148)) && (this->actor.playerHeightRel <= this->unk_150)) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { xzDist = this->actor.playerHeightRel / this->unk_150; @@ -117,7 +117,7 @@ void func_8089F218(EnViewer* this, PlayState* play) { f32 xzDist = fabsf(this->actor.xzDistToPlayer); f32 temp; - if ((play->roomCtx.currRoom.num == this->actor.room) && (xzDist <= this->unk_148) && + if ((play->roomCtx.curRoom.num == this->actor.room) && (xzDist <= this->unk_148) && (this->actor.playerHeightRel <= this->unk_150) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { temp = (xzDist - this->unk_14C) / (this->unk_148 - this->unk_14C); func_8089F014(this, play, temp); @@ -135,7 +135,7 @@ void func_8089F2C4(EnViewer* this, PlayState* play) { if (this->unk_14C == 0.0f) { this->unk_14C = 0.1f; } - if ((play->roomCtx.currRoom.num == this->actor.room) && (sp20.x < fabsf(this->unk_148))) { + if ((play->roomCtx.curRoom.num == this->actor.room) && (sp20.x < fabsf(this->unk_148))) { temp = sp20.z / this->unk_14C; func_8089F014(this, play, temp); } else { 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 092c693f2c..ec6f12aeb5 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 @@ -351,8 +351,7 @@ void func_80966FEC(EnWeatherTag* this, PlayState* play) { D_801F4E7A = distance; } - // unique pirates fortress behavior? - if ((play->sceneNum == SCENE_KAIZOKU) && (play->actorCtx.flags & ACTORCTX_FLAG_1)) { + if ((play->sceneId == SCENE_KAIZOKU) && (play->actorCtx.flags & ACTORCTX_FLAG_1)) { EnWeatherTag_SetupAction(this, func_80967060); } } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 508734a9b8..bda36c0b6b 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -207,7 +207,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) && ((play->csCtx.currentCsIndex != 2) || (gSaveContext.sceneSetupIndex != 0) || - (play->sceneNum != SCENE_30GYOSON))) { + (play->sceneId != SCENE_30GYOSON))) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index f20b953ba3..fba4baf7a4 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -206,13 +206,13 @@ void EnZoraegg_Destroy(Actor* thisx, PlayState* play) { } s32 func_80B319A8(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 7; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 7; } void func_80B319D0(PlayState* play, s32 arg1) { if ((arg1 < 8) && (arg1 >= 0)) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~7; - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= arg1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~7; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= arg1; } } diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 1419a7ecd9..1b7be4e0b1 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -5,7 +5,6 @@ */ #include "z_en_zos.h" -#include "objects/object_zos/object_zos.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_2000000) @@ -16,7 +15,7 @@ void EnZos_Destroy(Actor* thisx, PlayState* play); void EnZos_Update(Actor* thisx, PlayState* play); void EnZos_Draw(Actor* thisx, PlayState* play); -void func_80BBAE84(EnZos* this, s16 arg1, u8 arg2); +void EnZos_ChangeAnim(EnZos* this, s16 arg1, u8 arg2); void func_80BBB2C4(EnZos* this, PlayState* play); void func_80BBB354(EnZos* this, PlayState* play); void func_80BBB4CC(EnZos* this, PlayState* play); @@ -34,6 +33,23 @@ void func_80BBC24C(EnZos* this, PlayState* play); void func_80BBC298(EnZos* this, PlayState* play); void func_80BBC37C(EnZos* this, PlayState* play); +typedef enum { + /* 0 */ EN_ZOS_ANIM_LEAN_ON_KEYBOARD, + /* 1 */ EN_ZOS_ANIM_LEAN_ON_KEYBOARD_AND_SIGH, + /* 2 */ EN_ZOS_ANIM_HANDS_ON_HIPS, + /* 3 */ EN_ZOS_ANIM_TALK_FOOT_TAP, + /* 4 */ EN_ZOS_ANIM_TALK_LOOK_DOWN, + /* 5 */ EN_ZOS_ANIM_TALK_ARMS_OUT, + /* 6 */ EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, + /* 7 */ EN_ZOS_ANIM_PLAY_RIGHT, + /* 8 */ EN_ZOS_ANIM_PLAY_LEFT, + /* 9 */ EN_ZOS_ANIM_INSPIRED, + /* 10 */ EN_ZOS_ANIM_SLOW_PLAY, + /* 11 */ EN_ZOS_ANIM_PLAY_RIGHT_SHORTENED, + /* 12 */ EN_ZOS_ANIM_PLAY_LEFT_SHORTENED, + /* 13 */ EN_ZOS_ANIM_MAX +} EnZosAnimation; + const ActorInit En_Zos_InitVars = { ACTOR_EN_ZOS, ACTORCAT_NPC, @@ -73,14 +89,14 @@ void EnZos_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80BBBDE0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - SkelAnime_InitFlex(play, &this->skelAnime, &object_zos_Skel_015238, &object_zos_Anim_00A164, this->jointTable, - this->morphTable, 18); - Animation_PlayLoop(&this->skelAnime, &object_zos_Anim_00A164); + SkelAnime_InitFlex(play, &this->skelAnime, &gEvanSkel, &gEvanLeanOnKeyboardAnim, this->jointTable, this->morphTable, + EVAN_LIMB_MAX); + Animation_PlayLoop(&this->skelAnime, &gEvanLeanOnKeyboardAnim); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_2B6 = 0; this->actor.terminalVelocity = -4.0f; this->actor.gravity = -4.0f; - func_80BBAE84(this, 0, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD, ANIMMODE_ONCE); switch (ENZOS_GET_F(&this->actor)) { case ENZOS_F_1: @@ -93,12 +109,12 @@ void EnZos_Init(Actor* thisx, PlayState* play) { } else { this->actionFunc = func_80BBC14C; } - func_80BBAE84(this, 0, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD, ANIMMODE_ONCE); break; case ENZOS_F_2: this->actionFunc = func_80BBC37C; - func_80BBAE84(this, 7, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_RIGHT, ANIMMODE_ONCE); this->unk_2BC = -1; this->unk_2B6 |= 0x40; break; @@ -118,23 +134,34 @@ void EnZos_Destroy(Actor* thisx, PlayState* play) { gSaveContext.save.weekEventReg[52] &= (u8)~0x10; } -void func_80BBAE84(EnZos* this, s16 arg1, u8 arg2) { - static AnimationHeader* sAnimations[] = { - &object_zos_Anim_00A164, &object_zos_Anim_01621C, &object_zos_Anim_016980, &object_zos_Anim_007C40, - &object_zos_Anim_008630, &object_zos_Anim_0090CC, &object_zos_Anim_009830, &object_zos_Anim_005E04, - &object_zos_Anim_007334, &object_zos_Anim_0048D4, &object_zos_Anim_001CFC, &object_zos_Anim_005E04, - &object_zos_Anim_007334, - }; - f32 phi_f0; +static AnimationHeader* sAnimations[] = { + &gEvanLeanOnKeyboardAnim, // EN_ZOS_ANIM_LEAN_ON_KEYBOARD + &gEvanLeanOnKeyboardAndSighAnim, // EN_ZOS_ANIM_LEAN_ON_KEYBOARD_AND_SIGH + &gEvanHandsOnHipsAnim, // EN_ZOS_ANIM_HANDS_ON_HIPS + &gEeanTalkFootTapAnim, // EN_ZOS_ANIM_TALK_FOOT_TAP + &gEvanTalkLookDownAnim, // EN_ZOS_ANIM_TALK_LOOK_DOWN + &gEvanTalkArmsOutAnim, // EN_ZOS_ANIM_TALK_ARMS_OUT + &gEvanTalkHandsOnHipsAnim, // EN_ZOS_ANIM_TALK_HANDS_ON_HIPS + &gEvanPlayRightAnim, // EN_ZOS_ANIM_PLAY_RIGHT + &gEvanPlayLeftAnim, // EN_ZOS_ANIM_PLAY_LEFT + &gEvanInspiredAnim, // EN_ZOS_ANIM_INSPIRED + &gEvanSlowPlayAnim, // EN_ZOS_ANIM_SLOW_PLAY + &gEvanPlayRightAnim, // EN_ZOS_ANIM_PLAY_RIGHT_SHORTENED + &gEvanPlayLeftAnim, // EN_ZOS_ANIM_PLAY_LEFT_SHORTENED +}; - if ((arg1 != this->unk_2B8) && (arg1 >= 0) && (arg1 < 13)) { - if (arg1 > 10) { - phi_f0 = 29.0f; +void EnZos_ChangeAnim(EnZos* this, s16 animIndex, u8 animMode) { + f32 endFrame; + + if ((animIndex != this->animIndex) && (animIndex >= EN_ZOS_ANIM_LEAN_ON_KEYBOARD) && + (animIndex < EN_ZOS_ANIM_MAX)) { + if (animIndex > EN_ZOS_ANIM_SLOW_PLAY) { + endFrame = 29.0f; } else { - phi_f0 = Animation_GetLastFrame(sAnimations[arg1]); + endFrame = Animation_GetLastFrame(sAnimations[animIndex]); } - Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, phi_f0, arg2, -5.0f); - this->unk_2B8 = arg1; + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, endFrame, animMode, -5.0f); + this->animIndex = animIndex; this->unk_2B6 &= ~0x80; } } @@ -153,19 +180,19 @@ s32 func_80BBAFFC(EnZos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { switch ((s16)Rand_ZeroFloat(4.0f)) { case 0: - func_80BBAE84(this, 7, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_RIGHT, ANIMMODE_ONCE); break; case 1: - func_80BBAE84(this, 8, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_LEFT, ANIMMODE_ONCE); break; case 2: - func_80BBAE84(this, 11, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_RIGHT_SHORTENED, ANIMMODE_ONCE); break; default: - func_80BBAE84(this, 12, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_LEFT_SHORTENED, ANIMMODE_ONCE); break; } return true; @@ -176,9 +203,9 @@ s32 func_80BBAFFC(EnZos* this, PlayState* play) { void func_80BBB0D4(EnZos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroFloat(1.0f) < 0.9f) { - func_80BBAE84(this, 0, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD, ANIMMODE_ONCE); } else { - func_80BBAE84(this, 1, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD_AND_SIGH, ANIMMODE_ONCE); } SkelAnime_Update(&this->skelAnime); } @@ -190,31 +217,31 @@ void func_80BBB15C(EnZos* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { if (this->unk_2B6 & 8) { textId = 0x1235; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 2; } else if (this->unk_2B6 & 4) { textId = 0x123E; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 2; } else if (gSaveContext.save.weekEventReg[40] & 0x20) { textId = 0x1236; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 0x80; } else { textId = 0x1231; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 0x80; } } else { this->unk_2B6 &= ~2; if (gSaveContext.save.weekEventReg[39] & 0x10) { textId = 0x1243; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 0x80; } else { textId = 0x1244; gSaveContext.save.weekEventReg[39] |= 0x10; - func_80BBAE84(this, 4, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_LOOK_DOWN, ANIMMODE_LOOP); this->unk_2B6 |= 0x10; } } @@ -261,11 +288,11 @@ void func_80BBB414(EnZos* this, PlayState* play) { switch (action) { case 1: - func_80BBAE84(this, 1, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD_AND_SIGH, ANIMMODE_LOOP); break; case 2: - func_80BBAE84(this, 10, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_SLOW_PLAY, ANIMMODE_LOOP); break; } } @@ -304,7 +331,7 @@ void func_80BBB574(EnZos* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { switch (play->msgCtx.currentTextId) { case 0x124B: - if (this->unk_2B8 == 9) { + if (this->animIndex == EN_ZOS_ANIM_INSPIRED) { play->msgCtx.msgLength = 0; this->unk_2B6 |= 0x20; } else { @@ -315,12 +342,12 @@ void func_80BBB574(EnZos* this, PlayState* play) { case 0x124C: play->msgCtx.msgLength = 0; this->actionFunc = func_80BBB4CC; - func_80BBAE84(this, 10, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_SLOW_PLAY, ANIMMODE_LOOP); break; case 0x124D: this->unk_2B6 &= ~0x10; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); func_80151938(play, 0x124E); break; @@ -346,7 +373,7 @@ void func_80BBB718(EnZos* this, PlayState* play) { if (sp24 == 25) { player->actor.textId = 0x1232; - func_80BBAE84(this, 5, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); this->unk_2B6 |= 8; gSaveContext.save.weekEventReg[40] |= 0x20; } else if (gSaveContext.save.weekEventReg[39] & 8) { @@ -354,7 +381,7 @@ void func_80BBB718(EnZos* this, PlayState* play) { } else { player->actor.textId = 0x1237; gSaveContext.save.weekEventReg[39] |= 8; - func_80BBAE84(this, 4, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_LOOK_DOWN, ANIMMODE_LOOP); this->unk_2B6 |= 4; } this->actionFunc = func_80BBB8AC; @@ -364,7 +391,7 @@ void func_80BBB718(EnZos* this, PlayState* play) { } else { func_80151938(play, 0x1237); gSaveContext.save.weekEventReg[39] |= 8; - func_80BBAE84(this, 4, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_LOOK_DOWN, ANIMMODE_LOOP); this->unk_2B6 |= 4; } this->actionFunc = func_80BBB8AC; @@ -382,7 +409,7 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x1000, 0x200); this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->unk_2B6 & 0x80) && (this->actor.yawTowardsPlayer == this->actor.shape.rot.y)) { - func_80BBAE84(this, 3, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_FOOT_TAP, ANIMMODE_LOOP); } } @@ -402,7 +429,7 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { case 0x1244: this->unk_2B6 &= ~0x10; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); func_80151938(play, play->msgCtx.currentTextId + 1); break; @@ -412,18 +439,18 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { case 0x1239: case 0x1246: - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1233: - func_80BBAE84(this, 5, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); func_80151938(play, play->msgCtx.currentTextId + 1); break; case 0x1245: case 0x1248: - func_80BBAE84(this, 3, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_FOOT_TAP, ANIMMODE_LOOP); func_80151938(play, play->msgCtx.currentTextId + 1); break; @@ -434,7 +461,7 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { case 0x1243: case 0x1249: - func_80BBAE84(this, 2, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); func_801477B4(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; @@ -443,7 +470,7 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { case 0x1234: case 0x123D: case 0x1242: - func_80BBAE84(this, 2, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); Actor_ProcessTalkRequest(&this->actor, &play->state); func_801477B4(play); this->actionFunc = func_80BBBDE0; @@ -451,7 +478,7 @@ void func_80BBB8AC(EnZos* this, PlayState* play) { break; case 0x1236: - func_80BBAE84(this, 2, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); func_801477B4(play); this->actionFunc = func_80BBBDE0; this->unk_2B6 |= 1; @@ -473,17 +500,17 @@ void func_80BBBB84(EnZos* this, PlayState* play) { if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA) { Message_StartTextbox(play, 0x1248, &this->actor); this->actionFunc = func_80BBB8AC; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); this->unk_2B6 |= 2; } else if (gSaveContext.save.weekEventReg[41] & 0x10) { Message_StartTextbox(play, 0x124A, &this->actor); this->actionFunc = func_80BBB8AC; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); } else { gSaveContext.save.weekEventReg[41] |= 0x10; Message_StartTextbox(play, 0x124B, &this->actor); this->actionFunc = func_80BBB574; - func_80BBAE84(this, 9, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_INSPIRED, ANIMMODE_ONCE); this->unk_2B6 |= 0x10; } } else { @@ -494,7 +521,7 @@ void func_80BBBB84(EnZos* this, PlayState* play) { void func_80BBBCBC(EnZos* this, PlayState* play) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - func_80BBAE84(this, 5, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); Message_StartTextbox(play, 0x124D, &this->actor); this->actionFunc = func_80BBB574; } else { @@ -519,7 +546,7 @@ void func_80BBBDE0(EnZos* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x1000, 0x200); this->actor.world.rot.y = thisx->shape.rot.y; if (this->actor.home.rot.y == thisx->shape.rot.y) { - func_80BBAE84(this, 0, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD, ANIMMODE_ONCE); this->unk_2B6 &= ~1; } } @@ -567,10 +594,10 @@ void func_80BBBFBC(EnZos* this, PlayState* play) { textId = 0x1259; gSaveContext.save.weekEventReg[78] |= 0x80; } - func_80BBAE84(this, 5, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_ARMS_OUT, ANIMMODE_LOOP); } else { textId = 0x1258; - func_80BBAE84(this, 6, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_TALK_HANDS_ON_HIPS, ANIMMODE_LOOP); } Message_StartTextbox(play, textId, &this->actor); } @@ -583,7 +610,7 @@ void func_80BBC070(EnZos* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_5: if (Message_ShouldAdvance(play)) { - func_80BBAE84(this, 2, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); func_801477B4(play); this->actionFunc = func_80BBC14C; this->unk_2B6 |= 1; @@ -591,7 +618,7 @@ void func_80BBC070(EnZos* this, PlayState* play) { break; case TEXT_STATE_CLOSING: - func_80BBAE84(this, 2, ANIMMODE_LOOP); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_HANDS_ON_HIPS, ANIMMODE_LOOP); this->actionFunc = func_80BBC14C; this->unk_2B6 |= 1; break; @@ -605,7 +632,7 @@ void func_80BBC14C(EnZos* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 2, 0x1000, 0x200); this->actor.world.rot.y = thisx->shape.rot.y; if (this->actor.home.rot.y == this->actor.shape.rot.y) { - func_80BBAE84(this, 0, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_LEAN_ON_KEYBOARD, ANIMMODE_ONCE); this->unk_2B6 &= ~1; } } @@ -628,7 +655,7 @@ void func_80BBC24C(EnZos* this, PlayState* play) { func_80BBB0D4(this, play); if (gSaveContext.save.weekEventReg[79] & 1) { this->actionFunc = func_80BBC22C; - func_80BBAE84(this, 7, ANIMMODE_ONCE); + EnZos_ChangeAnim(this, EN_ZOS_ANIM_PLAY_RIGHT, ANIMMODE_ONCE); } } @@ -675,13 +702,13 @@ void EnZos_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (DECR(this->unk_2AE) == 0) { - this->unk_2AE = Rand_S16Offset(60, 60); + if (DECR(this->blinkTimer) == 0) { + this->blinkTimer = Rand_S16Offset(60, 60); } - this->unk_2AC = this->unk_2AE; - if (this->unk_2AC >= 3) { - this->unk_2AC = 0; + this->eyeIndex = this->blinkTimer; + if (this->eyeIndex >= 3) { + this->eyeIndex = 0; } } @@ -692,16 +719,16 @@ s32 func_80BBC4E4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s void func_80BBC500(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { static Vec3f D_80BBC750 = { 0.0f, 0.0f, 0.0f }; - if (limbIndex == 9) { + if (limbIndex == EVAN_LIMB_HEAD) { Matrix_MultVec3f(&D_80BBC750, &thisx->focus.pos); } } void EnZos_Draw(Actor* thisx, PlayState* play) { - static TexturePtr D_80BBC75C[] = { - object_zos_Tex_010918, - object_zos_Tex_011118, - object_zos_Tex_011918, + static TexturePtr sEyeTextures[] = { + gEvanEyeOpenTex, + gEvanEyeHalfTex, + gEvanEyeClosedTex, }; EnZos* this = THIS; Gfx* gfx; @@ -716,15 +743,15 @@ void EnZos_Draw(Actor* thisx, PlayState* play) { gfx = POLY_OPA_DISP; - gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(D_80BBC75C[this->unk_2AC])); + gSPSegment(&gfx[0], 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); Matrix_Push(); Matrix_RotateYS(this->actor.home.rot.y - this->actor.shape.rot.y, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -974.4f, MTXMODE_APPLY); gSPMatrix(&gfx[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(&gfx[2], object_zos_DL_0136E0); - gSPDisplayList(&gfx[3], object_zos_DL_013088); + gSPDisplayList(&gfx[2], gEvanUnknownWhiteTriangleDL); + gSPDisplayList(&gfx[3], gEvanKeyboardDL); POLY_OPA_DISP = &gfx[4]; diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.h b/src/overlays/actors/ovl_En_Zos/z_en_zos.h index 99125aad34..bf5a9c07b8 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.h +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.h @@ -2,6 +2,7 @@ #define Z_EN_ZOS_H #include "global.h" +#include "objects/object_zos/object_zos.h" struct EnZos; @@ -16,15 +17,15 @@ enum { typedef struct EnZos { /* 0x000 */ Actor actor; - /* 0x144 */ Vec3s jointTable[18]; - /* 0x1B0 */ Vec3s morphTable[18]; + /* 0x144 */ Vec3s jointTable[EVAN_LIMB_MAX]; + /* 0x1B0 */ Vec3s morphTable[EVAN_LIMB_MAX]; /* 0x21C */ SkelAnime skelAnime; /* 0x260 */ ColliderCylinder collider; - /* 0x2AC */ s16 unk_2AC; - /* 0x2AE */ s16 unk_2AE; + /* 0x2AC */ s16 eyeIndex; + /* 0x2AE */ s16 blinkTimer; /* 0x2B0 */ UNK_TYPE1 unk2B0[6]; /* 0x2B6 */ u16 unk_2B6; - /* 0x2B8 */ s16 unk_2B8; + /* 0x2B8 */ s16 animIndex; /* 0x2BA */ s16 unk_2BA; /* 0x2BC */ s16 unk_2BC; /* 0x2C0 */ EnZosActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index 5783118de0..6c6d6e02ad 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -60,7 +60,7 @@ void ObjDemo_Init(Actor* thisx, PlayState* play) { } void func_80983634(PlayState* play) { - if ((play->sceneNum == SCENE_CASTLE) && (func_801A8A50(0) == NA_BGM_IKANA_CASTLE)) { + if ((play->sceneId == SCENE_CASTLE) && (func_801A8A50(0) == NA_BGM_IKANA_CASTLE)) { Audio_QueueSeqCmd(0x100100FF); } } @@ -88,7 +88,7 @@ void func_80983704(ObjDemo* this, PlayState* play) { } else { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } - if (play->sceneNum == SCENE_CASTLE) { + if (play->sceneId == SCENE_CASTLE) { Audio_QueueSeqCmd(NA_BGM_IKANA_CASTLE | 0x8000); } this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); 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 b699cd9afd..79961ad82b 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -387,7 +387,7 @@ void func_80A1C5E8(ObjFlowerpot* this, PlayState* play) { } void func_80A1C62C(ObjFlowerpot* this, PlayState* play) { - if (!(this->unk_1EA & 4) && (play->roomCtx.currRoom.num != this->unk_1EC)) { + if (!(this->unk_1EA & 4) && (play->roomCtx.curRoom.num != this->unk_1EC)) { this->unk_1EA |= 4; } } @@ -536,7 +536,7 @@ void func_80A1CC0C(ObjFlowerpot* this, PlayState* play) { func_80A1C62C(this, play); if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { func_80A1C818(this); func_800B8E58(GET_PLAYER(play), NA_SE_PL_PUT_DOWN_POT); @@ -653,7 +653,7 @@ void ObjFlowerpot_Update(Actor* thisx, PlayState* play2) { func_80A1C554(this); - if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.currRoom.unk3 == 0)) { + if ((D_80A1D830 != play->gameplayFrames) && (play->roomCtx.curRoom.unk3 == 0)) { func_80A1B3D0(); D_80A1D830 = play->gameplayFrames; } @@ -678,7 +678,7 @@ void ObjFlowerpot_Draw(Actor* thisx, PlayState* play) { } if (!(this->unk_1EA & 2)) { - if ((play->roomCtx.currRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { + if ((play->roomCtx.curRoom.unk3 == 0) && (this->actionFunc == func_80A1C838)) { if ((this->actor.projectedPos.z > -150.0f) && (this->actor.projectedPos.z < 400.0f)) { func_80A1B840(&D_80A1D838[this->unk_1EB]); diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index 249e7ffde4..19d35ffffb 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -409,7 +409,7 @@ void func_80A54CEC(ObjHugebombiwa* this, PlayState* play) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); Flags_SetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor)); if (!(ENHUGEBOMBIWA_GET_100(&this->actor)) && - ((play->sceneNum == SCENE_17SETUGEN) || (play->sceneNum == SCENE_17SETUGEN2))) { + ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_17SETUGEN2))) { gSaveContext.save.weekEventReg[19] |= 2; } diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 3289699b0c..384d1cbad2 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -420,8 +420,8 @@ void func_80B9D0FC(ObjHunsui* this, PlayState* play) { void func_80B9D120(ObjHunsui* this, PlayState* play) { if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && - ((this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num))) { + (this->unk_16C != play->roomCtx.curRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + ((this->unk_16D != play->roomCtx.curRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num))) { switch (this->unk_160) { case OBJHUNSUI_F000_5: D_80B9DED8.unk_01 = 0; @@ -525,8 +525,8 @@ void func_80B9D4D0(ObjHunsui* this, PlayState* play) { void func_80B9D508(ObjHunsui* this, PlayState* play) { if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && - (this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { + (this->unk_16C != play->roomCtx.curRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + (this->unk_16D != play->roomCtx.curRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { switch (this->unk_160) { case OBJHUNSUI_F000_5: D_80B9DED8.unk_01 = 0; @@ -544,7 +544,7 @@ void func_80B9D508(ObjHunsui* this, PlayState* play) { func_80B9D094(this, play); if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) && - (play->roomCtx.currRoom.num == 8)) { + (play->roomCtx.curRoom.num == 8)) { func_80B9D334(this, play); } @@ -572,8 +572,8 @@ void func_80B9D714(ObjHunsui* this, PlayState* play) { s16 cs; f32 sp28; - if ((this->unk_16C != play->roomCtx.currRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && - (this->unk_16D != play->roomCtx.currRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { + if ((this->unk_16C != play->roomCtx.curRoom.num) && (this->unk_16C != play->roomCtx.prevRoom.num) && + (this->unk_16D != play->roomCtx.curRoom.num) && (this->unk_16D != play->roomCtx.prevRoom.num)) { Actor_MarkForDeath(&this->dyna.actor); } else { if (Flags_GetSwitch(play, this->unk_168)) { diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 0210b5ba78..2ba1e4352d 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -116,7 +116,7 @@ void ObjIcePoly_Init(Actor* thisx, PlayState* play) { thisx->shape.rot.z = -0x500; if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) || - ((play->sceneNum == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { + ((play->sceneId == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { Actor_MarkForDeath(thisx); return; } @@ -205,7 +205,7 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { this->actionFunc = func_80931E58; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; - if (play->sceneNum == SCENE_00KEIKOKU) { + if (play->sceneId == SCENE_00KEIKOKU) { Actor* actor = NULL; do { diff --git a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c index 497d9a219a..7758fc5bc9 100644 --- a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c +++ b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c @@ -36,11 +36,10 @@ void ObjJgGakki_Init(Actor* thisx, PlayState* play2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_Init(play, &this->skelAnime, &gGoronElderDrumSkel, NULL, NULL, NULL, 0); - if (((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7)) && - (play->csCtx.currentCsIndex == 0)) { + if (((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7)) && (play->csCtx.currentCsIndex == 0)) { Animation_Change(&this->skelAnime, &gGoronElderDrumTakeOutAnim, 1.0f, frameCount, frameCount, ANIMMODE_ONCE, 0.0f); - } else if ((play->sceneNum == SCENE_17SETUGEN) || (play->sceneNum == SCENE_10YUKIYAMANOMURA)) { + } else if ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_10YUKIYAMANOMURA)) { Animation_Change(&this->skelAnime, &gGoronElderDrumTakeOutAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); } else { Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 6f98958b1e..e2a71db925 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -127,7 +127,7 @@ void func_80926318(ObjKibako* this, PlayState* play) { } void func_80926394(ObjKibako* this, PlayState* play) { - if ((this->isDropCollected == 0) && (play->roomCtx.currRoom.num != this->unk199)) { + if ((this->isDropCollected == 0) && (play->roomCtx.curRoom.num != this->unk199)) { this->isDropCollected = 1; } } @@ -339,7 +339,7 @@ void ObjKibako_Held(ObjKibako* this, PlayState* play) { func_80926394(this, play); if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { ObjKibako_SetupIdle(this); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; 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 4c56bb794e..7cc7add22e 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -71,7 +71,7 @@ void ObjNozoki_Init(Actor* thisx, PlayState* play) { this->dyna.actor.shape.rot.z = 0; this->unk_15F = this->dyna.actor.cutscene; - if (play->sceneNum == SCENE_AYASHIISHOP) { + if (play->sceneId == SCENE_AYASHIISHOP) { this->unk_15C = 4; ObjNozoki_SetupAction(this, func_80BA3230); this->dyna.actor.colChkInfo.cylRadius = -40; diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index b39187c756..0ce2f38a16 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -45,14 +45,14 @@ void ObjRoomtimer_Init(Actor* thisx, PlayState* play) { void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play) { ObjRoomtimer* this = THIS; - if (this->actor.params != 0x1FF && gSaveContext.unk_3DD0[4] > 0) { - gSaveContext.unk_3DD0[4] = 5; + if ((this->actor.params != 0x1FF) && (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] >= TIMER_STATE_START)) { + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; } } void func_80973CD8(ObjRoomtimer* this, PlayState* play) { if (this->actor.params != 0x1FF) { - func_8010E9F0(4, this->actor.params); + Interface_StartTimer(TIMER_ID_MINIGAME_2, this->actor.params); } func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); @@ -62,11 +62,11 @@ void func_80973CD8(ObjRoomtimer* this, PlayState* play) { void func_80973D3C(ObjRoomtimer* this, PlayState* play) { if (Flags_GetClearTemp(play, this->actor.room)) { if (this->actor.params != 0x1FF) { - gSaveContext.unk_3DD0[4] = 5; + gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; } ActorCutscene_SetIntentToPlay(this->actor.cutscene); this->actionFunc = func_80973DE0; - } else if (this->actor.params != 0x1FF && gSaveContext.unk_3DD0[4] == 0) { + } else if ((this->actor.params != 0x1FF) && (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_OFF)) { play_sound(NA_SE_OC_ABYSS); func_80169EFC(&play->state); Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index 937a61d79f..74fa8fd578 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -296,7 +296,7 @@ void func_80B39908(ObjSnowball2* this, PlayState* play) { } void func_80B39B28(ObjSnowball2* this, PlayState* play) { - if ((this->unk_1AE == 0) && (play->roomCtx.currRoom.num != this->unk_1AF)) { + if ((this->unk_1AE == 0) && (play->roomCtx.curRoom.num != this->unk_1AF)) { this->unk_1AE = 1; } } @@ -416,7 +416,7 @@ void func_80B39FA8(ObjSnowball2* this, PlayState* play) { } if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; this->actor.speedXZ *= 3.8f; this->actor.velocity.y *= 0.4f; this->actor.gravity = -2.8f; 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 02743db291..c31168f724 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -348,7 +348,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { DynaPolyActor_LoadMesh(play, &this->dyna, &gFloorSwitchCol); } if (type == OBJSWITCH_TYPE_FLOOR) { - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { this->floorSwitchUpScale = 33.0f / 200.0f / 3.0f; this->floorSwitchDownScale = 33.0f / 2000.0f / 3.0f; } else { @@ -357,7 +357,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { } } if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_LARGE) { - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { Color_RGB8* color = &sSakonHideoutColor[OBJ_SWITCH_GET_COLOR_ID(&this->dyna.actor)]; this->color.r = color->r; @@ -584,7 +584,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { case OBJSWITCH_SUBTYPE_ONCE: case OBJSWITCH_SUBTYPE_SYNC: if (!Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { - if (play->sceneNum == SCENE_SECOM && DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if ((play->sceneId == SCENE_SECOM) && DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { ObjSwitch_SetSwitchFlagState(this, play, true); } else { ObjSwitch_FloorSwitchRiseUpInit(this); @@ -595,7 +595,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { case OBJSWITCH_SUBTYPE_RESET: case OBJSWITCH_SUBTYPE_RESET_INVERTED: if (!DynaPolyActor_IsInSwitchPressedState(&this->dyna) && - (!Player_InCsMode(play) || play->sceneNum == SCENE_SECOM)) { + (!Player_InCsMode(play) || (play->sceneId == SCENE_SECOM))) { if (this->floorSwitchReleaseTimer <= 0) { if (subType == OBJSWITCH_SUBTYPE_RESET) { ObjSwitch_SetSwitchFlagState(this, play, false); @@ -607,7 +607,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { } } } else { - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { this->floorSwitchReleaseTimer = 2; } else { this->floorSwitchReleaseTimer = 6; diff --git a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c index 4472c4fc33..6a50a018fc 100644 --- a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c +++ b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.c @@ -14,12 +14,15 @@ void ObjSwprize_Init(Actor* thisx, PlayState* play); void ObjSwprize_Destroy(Actor* thisx, PlayState* play); void ObjSwprize_Update(Actor* thisx, PlayState* play); +void ObjSwprize_DoNothing(ObjSwprize* this, PlayState* play); void func_80C25654(ObjSwprize* this, PlayState* play); +void func_80C25640(ObjSwprize* this); +void func_80C25698(ObjSwprize* this); void func_80C256AC(ObjSwprize* this, PlayState* play); +void func_80C25710(ObjSwprize* this); void func_80C2572C(ObjSwprize* this, PlayState* play); -void func_80C25794(ObjSwprize* this, PlayState* play); +void ObjSwprize_SetupDoNothing(ObjSwprize* this); -#if 0 const ActorInit Obj_Swprize_InitVars = { ACTOR_OBJ_SWPRIZE, ACTORCAT_PROP, @@ -32,30 +35,113 @@ const ActorInit Obj_Swprize_InitVars = { (ActorFunc)NULL, }; -#endif +s16 D_80C257F0[] = { 2, 0x14, 1, 8 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25360.s") +s16 D_80C257F8[] = { -0x888, 0, 0x888 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C253D0.s") +void func_80C25360(ObjSwprize* this, Vec3f* vec) { + Matrix_Push(); + Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); + Matrix_RotateXS(this->actor.shape.rot.x, MTXMODE_APPLY); + Matrix_RotateZS(this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_MultVecY(1.0f, vec); + Matrix_Pop(); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/ObjSwprize_Init.s") +void func_80C253D0(ObjSwprize* this, PlayState* play) { + Actor* thisx = &this->actor; + s32 i; + Actor* collectible; + Vec3f sp78; + s32 type = OBJ_SWPRIZE_GET_TYPE(thisx); + s32 temp_s0 = D_80C257F0[type]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/ObjSwprize_Destroy.s") + func_80C25360(this, &sp78); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25640.s") + if (type == 2) { + for (i = 0; i < 3; i++) { + collectible = Item_DropCollectible(play, &thisx->world.pos, temp_s0); + if (collectible != NULL) { + if (sp78.y < 0.98f) { + collectible->velocity.y = (sp78.y + 1.0f) * 4.0f; + collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f; + collectible->world.rot.y = Math_FAtan2F(sp78.z, sp78.x) + D_80C257F8[i]; + } else { + collectible->world.rot.y = i * (0x10000 / 3); + } + } + } + } else { + collectible = Item_DropCollectible(play, &thisx->world.pos, temp_s0); + if ((collectible != NULL) && (sp78.y < 0.98f)) { + collectible->velocity.y = (sp78.y + 1.0f) * 4.0f; + collectible->speedXZ = (2.0f * (1.0f - fabsf(sp78.y))) + 2.0f; + collectible->world.rot.y = Math_FAtan2F(sp78.z, sp78.x); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25654.s") +void ObjSwprize_Init(Actor* thisx, PlayState* play) { + ObjSwprize* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25698.s") + if (Flags_GetSwitch(play, OBJ_SWPRIZE_GET_SWITCH_FLAG(&this->actor))) { + ObjSwprize_SetupDoNothing(this); + } else { + func_80C25640(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C256AC.s") +void ObjSwprize_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25710.s") +void func_80C25640(ObjSwprize* this) { + this->actionFunc = func_80C25654; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C2572C.s") +void func_80C25654(ObjSwprize* this, PlayState* play) { + if (Flags_GetSwitch(play, OBJ_SWPRIZE_GET_SWITCH_FLAG(&this->actor))) { + func_80C25698(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25780.s") +void func_80C25698(ObjSwprize* this) { + this->actionFunc = func_80C256AC; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/func_80C25794.s") +void func_80C256AC(ObjSwprize* this, PlayState* play) { + if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + func_80C253D0(this, play); + func_80C25710(this); + } else { + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Swprize/ObjSwprize_Update.s") +void func_80C25710(ObjSwprize* this) { + this->timer = 40; + this->actionFunc = func_80C2572C; +} + +void func_80C2572C(ObjSwprize* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; + if (this->timer == 0) { + ActorCutscene_Stop(this->actor.cutscene); + ObjSwprize_SetupDoNothing(this); + } + } +} + +void ObjSwprize_SetupDoNothing(ObjSwprize* this) { + this->actionFunc = ObjSwprize_DoNothing; +} + +void ObjSwprize_DoNothing(ObjSwprize* this, PlayState* play) { +} + +void ObjSwprize_Update(Actor* thisx, PlayState* play) { + ObjSwprize* this = THIS; + + this->actionFunc(this, play); +} diff --git a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h index 29654f9924..5b7cd2e091 100644 --- a/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h +++ b/src/overlays/actors/ovl_Obj_Swprize/z_obj_swprize.h @@ -3,6 +3,9 @@ #include "global.h" +#define OBJ_SWPRIZE_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) +#define OBJ_SWPRIZE_GET_TYPE(thisx) (((thisx)->params >> 8) & 3) + struct ObjSwprize; typedef void (*ObjSwprizeActionFunc)(struct ObjSwprize*, PlayState*); @@ -10,7 +13,7 @@ typedef void (*ObjSwprizeActionFunc)(struct ObjSwprize*, PlayState*); typedef struct ObjSwprize { /* 0x000 */ Actor actor; /* 0x144 */ ObjSwprizeActionFunc actionFunc; - /* 0x148 */ char unk_148[0x4]; + /* 0x148 */ s16 timer; } ObjSwprize; // size = 0x14C extern const ActorInit Obj_Swprize_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 780c31c9a0..62cb402758 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -193,7 +193,7 @@ void ObjTokeiStep_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - if ((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) { DynaPolyActor_LoadMesh(play, &this->dyna, &gClocktowerPanelCol); ObjTokeiStep_InitSteps(this); diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 8cb13e7026..4a36a2c8ea 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -121,9 +121,9 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { this->opaDList = gClockTowerExteriorGearDL; ObjTokeidai_SetupClockOrExteriorGear(this); - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { @@ -140,9 +140,9 @@ void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, PlayState* play) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_Clock_Init(this); - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { @@ -175,9 +175,9 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, PlayState* play) { this->spotlightIntensity = 0; } - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0))) { this->spotlightIntensity = 0; ObjTokeidai_SetupTowerOpening(this); @@ -448,9 +448,9 @@ void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { if (Cutscene_CheckActorAction(play, 132) != 0 && play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 5) { gSaveContext.save.weekEventReg[8] |= 0x40; - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0))) { Audio_SetCutsceneFlag(false); gSaveContext.save.cutscene = 0; 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 acba9ec31c..9d635d7eb1 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -162,11 +162,11 @@ void func_80927818(ObjTsubo* this, PlayState* play, s32 arg2) { } s32 ObjTsubo_IsSceneNotGohtOrTwinmold(ObjTsubo* this, PlayState* play) { - return (play->sceneNum != SCENE_HAKUGIN_BS) && (play->sceneNum != SCENE_INISIE_BS); + return (play->sceneId != SCENE_HAKUGIN_BS) && (play->sceneId != SCENE_INISIE_BS); } void func_8092788C(ObjTsubo* this, PlayState* play) { - if (!this->unk_197 && (play->roomCtx.currRoom.num != this->homeRoom)) { + if (!this->unk_197 && (play->roomCtx.curRoom.num != this->homeRoom)) { this->unk_197 = true; } } @@ -527,7 +527,7 @@ void func_80928D80(ObjTsubo* this, PlayState* play) { func_8092788C(this, play); if (Actor_HasNoParent(&this->actor, play)) { - this->actor.room = play->roomCtx.currRoom.num; + this->actor.room = play->roomCtx.curRoom.num; Actor_MoveWithGravity(&this->actor); this->actor.flags &= ~ACTOR_FLAG_4000000; Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 15.0f, 0.0f, 0xC5); diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index 820a5fd1da..f1071a7589 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -42,8 +42,8 @@ void func_808A7968(ObjWturn* this, PlayState* play) { if (play->msgCtx.ocarinaMode >= 28 && play->msgCtx.ocarinaMode < 39) { Flags_UnsetSwitch(play, this->actor.params); Actor_MarkForDeath(&this->actor); - } else if ((Flags_GetSwitch(play, this->actor.params) && (play->sceneNum == SCENE_F40)) || - (!Flags_GetSwitch(play, this->actor.params) && (play->sceneNum == SCENE_F41))) { + } else if ((Flags_GetSwitch(play, this->actor.params) && (play->sceneId == SCENE_F40)) || + (!Flags_GetSwitch(play, this->actor.params) && (play->sceneId == SCENE_F41))) { func_808A7A24(this); } } @@ -112,7 +112,7 @@ void func_808A7C78(ObjWturn* this, PlayState* play) { play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextCutsceneIndex = 0; - if (play->sceneNum == SCENE_F40) { + if (play->sceneId == SCENE_F40) { play->nextEntrance = ENTRANCE(STONE_TOWER_INVERTED, 0); } else { play->nextEntrance = ENTRANCE(STONE_TOWER, 1); 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 4057ff8175..264167db52 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -588,7 +588,7 @@ void func_808DD970(Actor* thisx, PlayState* play2) { ObjectKankyo* this = THIS; f32 tempA; - if (play->sceneNum == SCENE_KYOJINNOMA) { + if (play->sceneId == SCENE_KYOJINNOMA) { phi_f26 = 1.0f; } else { tempA = Camera_GetWaterYPos(GET_ACTIVE_CAM(play)); diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 56942962dc..18fecfe718 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -15,7 +15,6 @@ void OceffWipe4_Destroy(Actor* thisx, PlayState* play); void OceffWipe4_Update(Actor* thisx, PlayState* play); void OceffWipe4_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Oceff_Wipe4_InitVars = { ACTOR_OCEFF_WIPE4, ACTORCAT_ITEMACTION, @@ -28,12 +27,87 @@ const ActorInit Oceff_Wipe4_InitVars = { (ActorFunc)OceffWipe4_Draw, }; -#endif +#include "assets/overlays/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4.c" -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe4/OceffWipe4_Init.s") +s32 D_8099E780; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe4/OceffWipe4_Destroy.s") +void OceffWipe4_Init(Actor* thisx, PlayState* play) { + OceffWipe4* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe4/OceffWipe4_Update.s") + Actor_SetScale(&this->actor, 0.1f); + this->counter = 0; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe4/OceffWipe4_Draw.s") +void OceffWipe4_Destroy(Actor* thisx, PlayState* play) { + OceffWipe4* this = THIS; + + Magic_Reset(play); + play->msgCtx.unk120B0 = 0; +} + +void OceffWipe4_Update(Actor* thisx, PlayState* play) { + OceffWipe4* this = THIS; + + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; + if (this->counter < 50) { + this->counter++; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +void OceffWipe4_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFFF; + OceffWipe4* this = THIS; + f32 z; + u8 alpha; + s32 pad[2]; + Vec3f eye = GET_ACTIVE_CAM(play)->eye; + Vtx* vtxPtr; + Vec3f quakeOffset; + + Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play)); + + if (this->counter < 16) { + z = Math_SinS(this->counter * 0x400) * 1220.0f; + } else { + z = 1220.0f; + } + + vtxPtr = sScarecrowSongFrustumVtx; + if (this->counter >= 30) { + alpha = 12 * (50 - this->counter); + } else { + alpha = 255; + } + + vtxPtr[1].v.cn[3] = vtxPtr[3].v.cn[3] = vtxPtr[5].v.cn[3] = vtxPtr[7].v.cn[3] = vtxPtr[9].v.cn[3] = + vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[17].v.cn[3] = vtxPtr[19].v.cn[3] = + vtxPtr[21].v.cn[3] = alpha; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_RotateXS(0x708, MTXMODE_APPLY); + Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if (this->actor.params == OCEFF_WIPE4_UNUSED) { + gSPDisplayList(POLY_XLU_DISP++, sScarecrowSongUnusedMaterialDL); + } else { + gSPDisplayList(POLY_XLU_DISP++, sScarecrowSongMaterialDL); + } + + gSPDisplayList(POLY_XLU_DISP++, sScarecrowSongModelDL); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 2, scroll * -2, 32, + 64, 1, scroll * -1, scroll, 32, 32)); + gSPDisplayList(POLY_XLU_DISP++, &sScarecrowSongModelDL[11]); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h index 76debbeed8..59b592318b 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h @@ -3,11 +3,16 @@ #include "global.h" +typedef enum { + /* 0 */ OCEFF_WIPE4_SCARECROWS, + /* 1 */ OCEFF_WIPE4_UNUSED +} OceffWipe4Type; + struct OceffWipe4; typedef struct OceffWipe4 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s16 counter; } OceffWipe4; // size = 0x148 extern const ActorInit Oceff_Wipe4_InitVars; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 9fd81dcd85..aa3d2e2b0a 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -23,10 +23,10 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; - gSaveContext.unk_3F1E = 0; - gSaveContext.unk_3F20 = 0; - gSaveContext.unk_3F22 = 0; - gSaveContext.unk_3F24 = 0; + gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; + gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + gSaveContext.hudVisibilityTimer = 0; Audio_QueueSeqCmd(NA_BGM_STOP); gSaveContext.save.entrance = entrance; @@ -507,13 +507,13 @@ void MapSelect_UpdateMenu(MapSelectState* this) { if (this->verticalInputAccumulator == 0) { if (CHECK_BTN_ALL(controller1->press.button, BTN_A) || CHECK_BTN_ALL(controller1->press.button, BTN_START)) { - for (i = 0; i < ARRAY_COUNT(gSaveContext.unk_3EC0); i++) { - gSaveContext.unk_3DD0[i] = 0; - gSaveContext.unk_3DE0[i] = 0; - gSaveContext.unk_3E18[i] = 0; - gSaveContext.unk_3E50[i] = 0; - gSaveContext.unk_3E88[i] = 0; - gSaveContext.unk_3EC0[i] = 0; + for (i = 0; i < TIMER_ID_MAX; i++) { + gSaveContext.timerStates[i] = TIMER_STATE_OFF; + gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerStartOsTimes[i] = 0; + gSaveContext.timerStopTimes[i] = SECONDS_TO_TIMER(0); + gSaveContext.timerPausedOsTimes[i] = 0; } gSaveContext.minigameState = 0; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c index 2854b02c6c..9f6a58a860 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c @@ -34,10 +34,10 @@ s16 sCurRow = 0; // Geometry of the highlights for the selected section typedef struct { - /* 0 */ s16 screenX; - /* 1 */ s16 screenY; - /* 2 */ s16 width; -} SectionPosition; + /* 0x0 */ s16 screenX; + /* 0x2 */ s16 screenY; + /* 0x4 */ s16 width; +} SectionPosition; // size = 0x6; // clang-format off SectionPosition sSectionPositions[] = { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index ae2140f2c6..7f57ac7a39 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -1,85 +1,1004 @@ /* * File: z_kaleido_item.c * Overlay: ovl_kaleido_scope - * Description: + * Description: Pause Menu - Item Page */ #include "z_kaleido_scope.h" +#include "interface/parameter_static/parameter_static.h" -extern UNK_TYPE D_02001360; -extern UNK_TYPE D_020044A0; -extern UNK_TYPE D_02004AA0; -extern UNK_TYPE D_0200B998; -extern UNK_TYPE D_08062000; -extern UNK_TYPE D_08064340; -extern UNK_TYPE D_0B000000; -extern UNK_TYPE D_0C000000; -extern UNK_TYPE D_0C006C00; +typedef enum { + /* 0 */ EQUIP_STATE_MAGIC_ARROW_GROW_ORB, + /* 1 */ EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT, + /* 2 */ EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT, + /* 3 */ EQUIP_STATE_MOVE_TO_C_BTN +} EquipState; -s32 D_8082B3C0 = 0; +s16 sEquipState = EQUIP_STATE_MAGIC_ARROW_GROW_ORB; -s32 D_8082B3C4 = 0; +// Timer to hold magic arrow icon over magic arrow slot before moving when equipping. +s16 sEquipMagicArrowSlotHoldTimer = 0; -s16 D_8082B3C8 = 10; +// Number of frames to move icon from slot to target position when equipping. +s16 sEquipAnimTimer = 10; -u8 D_8082B3CC[5][24] = { +u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][24] = { + // Fierce Deity { - false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, true, true, true, true, true, true, + false, // SLOT_OCARINA + false, // SLOT_BOW + false, // SLOT_ARROW_FIRE + false, // SLOT_ARROW_ICE + false, // SLOT_ARROW_LIGHT + false, // SLOT_TRADE_DEED + false, // SLOT_BOMB + false, // SLOT_BOMBCHU + false, // SLOT_STICK + false, // SLOT_NUT + false, // SLOT_MAGIC_BEANS + false, // SLOT_TRADE_KEY_MAMA + false, // SLOT_POWDER_KEG + false, // SLOT_PICTO_BOX + false, // SLOT_LENS + false, // SLOT_HOOKSHOT + false, // SLOT_SWORD_GREAT_FAIRY + false, // SLOT_TRADE_COUPLE + true, // SLOT_BOTTLE_1 + true, // SLOT_BOTTLE_2 + true, // SLOT_BOTTLE_3 + true, // SLOT_BOTTLE_4 + true, // SLOT_BOTTLE_5 + true, // SLOT_BOTTLE_6 }, + // Goron { - true, false, false, false, false, true, false, false, false, false, false, true, - true, true, true, false, false, true, true, true, true, true, true, true, + true, // SLOT_OCARINA + false, // SLOT_BOW + false, // SLOT_ARROW_FIRE + false, // SLOT_ARROW_ICE + false, // SLOT_ARROW_LIGHT + true, // SLOT_TRADE_DEED + false, // SLOT_BOMB + false, // SLOT_BOMBCHU + false, // SLOT_STICK + false, // SLOT_NUT + false, // SLOT_MAGIC_BEANS + true, // SLOT_TRADE_KEY_MAMA + true, // SLOT_POWDER_KEG + true, // SLOT_PICTO_BOX + true, // SLOT_LENS + false, // SLOT_HOOKSHOT + false, // SLOT_SWORD_GREAT_FAIRY + true, // SLOT_TRADE_COUPLE + true, // SLOT_BOTTLE_1 + true, // SLOT_BOTTLE_2 + true, // SLOT_BOTTLE_3 + true, // SLOT_BOTTLE_4 + true, // SLOT_BOTTLE_5 + true, // SLOT_BOTTLE_6 }, + // Zora { - true, false, false, false, false, true, false, false, false, false, false, true, - false, true, true, false, false, true, true, true, true, true, true, true, + true, // SLOT_OCARINA + false, // SLOT_BOW + false, // SLOT_ARROW_FIRE + false, // SLOT_ARROW_ICE + false, // SLOT_ARROW_LIGHT + true, // SLOT_TRADE_DEED + false, // SLOT_BOMB + false, // SLOT_BOMBCHU + false, // SLOT_STICK + false, // SLOT_NUT + false, // SLOT_MAGIC_BEANS + true, // SLOT_TRADE_KEY_MAMA + false, // SLOT_POWDER_KEG + true, // SLOT_PICTO_BOX + true, // SLOT_LENS + false, // SLOT_HOOKSHOT + false, // SLOT_SWORD_GREAT_FAIRY + true, // SLOT_TRADE_COUPLE + true, // SLOT_BOTTLE_1 + true, // SLOT_BOTTLE_2 + true, // SLOT_BOTTLE_3 + true, // SLOT_BOTTLE_4 + true, // SLOT_BOTTLE_5 + true, // SLOT_BOTTLE_6 }, + // Deku { - true, false, false, false, false, true, false, false, false, true, false, true, - false, true, true, false, false, true, true, true, true, true, true, true, + true, // SLOT_OCARINA + false, // SLOT_BOW + false, // SLOT_ARROW_FIRE + false, // SLOT_ARROW_ICE + false, // SLOT_ARROW_LIGHT + true, // SLOT_TRADE_DEED + false, // SLOT_BOMB + false, // SLOT_BOMBCHU + false, // SLOT_STICK + true, // SLOT_NUT + false, // SLOT_MAGIC_BEANS + true, // SLOT_TRADE_KEY_MAMA + false, // SLOT_POWDER_KEG + true, // SLOT_PICTO_BOX + true, // SLOT_LENS + false, // SLOT_HOOKSHOT + false, // SLOT_SWORD_GREAT_FAIRY + true, // SLOT_TRADE_COUPLE + true, // SLOT_BOTTLE_1 + true, // SLOT_BOTTLE_2 + true, // SLOT_BOTTLE_3 + true, // SLOT_BOTTLE_4 + true, // SLOT_BOTTLE_5 + true, // SLOT_BOTTLE_6 }, + // Human { - true, true, true, true, true, true, true, true, true, true, true, true, - false, true, true, true, true, true, true, true, true, true, true, true, + true, // SLOT_OCARINA + true, // SLOT_BOW + true, // SLOT_ARROW_FIRE + true, // SLOT_ARROW_ICE + true, // SLOT_ARROW_LIGHT + true, // SLOT_TRADE_DEED + true, // SLOT_BOMB + true, // SLOT_BOMBCHU + true, // SLOT_STICK + true, // SLOT_NUT + true, // SLOT_MAGIC_BEANS + true, // SLOT_TRADE_KEY_MAMA + false, // SLOT_POWDER_KEG + true, // SLOT_PICTO_BOX + true, // SLOT_LENS + true, // SLOT_HOOKSHOT + true, // SLOT_SWORD_GREAT_FAIRY + true, // SLOT_TRADE_COUPLE + true, // SLOT_BOTTLE_1 + true, // SLOT_BOTTLE_2 + true, // SLOT_BOTTLE_3 + true, // SLOT_BOTTLE_4 + true, // SLOT_BOTTLE_5 + true, // SLOT_BOTTLE_6 }, }; -s16 D_8082B444[] = { - 0x005F, 0x003E, 0x005F, 0x0080, 0x00A1, 0x00C2, 0x003E, 0x005F, +s16 sAmmoRectLeft[] = { + 95, // SLOT_BOW + 62, // SLOT_BOMB + 95, // SLOT_BOMBCHU + 128, // SLOT_STICK + 161, // SLOT_NUT + 194, // SLOT_MAGIC_BEANS + 62, // SLOT_POWDER_KEG + 95, // SLOT_PICTO_BOX }; -s16 D_8082B454[] = { - 0x0055, 0x0075, 0x0075, 0x0075, 0x0075, 0x0075, 0x0096, 0x0096, 0x00FF, 0x0064, - 0x00FF, 0x0000, 0x0000, 0x0064, 0x00FF, 0x0000, 0x0000, 0x00FF, 0x0064, 0x0000, +s16 sAmmoRectHeight[] = { + 85, // SLOT_BOW + 117, // SLOT_BOMB + 117, // SLOT_BOMBCHU + 117, // SLOT_STICK + 117, // SLOT_NUT + 117, // SLOT_MAGIC_BEANS + 150, // SLOT_POWDER_KEG + 150, // SLOT_PICTO_BOX }; -u8 D_8082B47C[] = { - 0x35, 0x33, 0x34, 0x32, 0xFF, +void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, s16 item, u16 ammoIndex) { + s16 ammoUpperDigit; + s16 ammo; + + OPEN_DISPS(gfxCtx); + + if (item == ITEM_PICTO_BOX) { + if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { + ammo = 0; + } else { + ammo = 1; + } + } else { + ammo = AMMO(item); + } + + gDPPipeSync(POLY_OPA_DISP++); + + if (!gPlayerFormSlotRestrictions[((void)0, gSaveContext.save.playerForm)][SLOT(item)]) { + // Ammo item is restricted + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 100, 100, pauseCtx->alpha); + } else { + // Default ammo + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + if (ammo == 0) { + // Out of ammo + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 130, 130, 130, pauseCtx->alpha); + } else if (((item == ITEM_BOMB) && (AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((item == ITEM_BOW) && (AMMO(item) == CUR_CAPACITY(UPG_QUIVER))) || + ((item == ITEM_STICK) && (AMMO(item) == CUR_CAPACITY(UPG_STICKS))) || + ((item == ITEM_NUT) && (AMMO(item) == CUR_CAPACITY(UPG_NUTS))) || + ((item == ITEM_BOMBCHU) && (AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((item == ITEM_POWDER_KEG) && (ammo == 1)) || ((item == ITEM_PICTO_BOX) && (ammo == 1)) || + ((item == ITEM_MAGIC_BEANS) && (ammo == 20))) { + // Ammo at capacity + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 120, 255, 0, pauseCtx->alpha); + } + } + + // Separate ammo into upper and lower digits + for (ammoUpperDigit = 0; ammo >= 10; ammoUpperDigit++) { + ammo -= 10; + } + + gDPPipeSync(POLY_OPA_DISP++); + + // Draw upper digit + if (ammoUpperDigit != 0) { + POLY_OPA_DISP = func_8010CD98(POLY_OPA_DISP, ((u8*)gAmmoDigit0Tex + (8 * 8 * ammoUpperDigit)), 8, 8, + sAmmoRectLeft[ammoIndex], sAmmoRectHeight[ammoIndex], 8, 8, 1 << 10, 1 << 10); + } + + // Draw lower digit + POLY_OPA_DISP = func_8010CD98(POLY_OPA_DISP, ((u8*)gAmmoDigit0Tex + (8 * 8 * ammo)), 8, 8, + sAmmoRectLeft[ammoIndex] + 6, sAmmoRectHeight[ammoIndex], 8, 8, 1 << 10, 1 << 10); + + CLOSE_DISPS(gfxCtx); +} + +void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx) { + pauseCtx->cursorVtx[0].v.ob[0] = vtx[index].v.ob[0]; + pauseCtx->cursorVtx[0].v.ob[1] = vtx[index].v.ob[1]; +} + +s16 sMagicArrowEffectsR[] = { 255, 100, 255 }; +s16 sMagicArrowEffectsG[] = { 0, 100, 255 }; +s16 sMagicArrowEffectsB[] = { 0, 255, 100 }; + +void KaleidoScope_DrawItemSelect(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + u16 i; + u16 j; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C8AC(play->state.gfxCtx); + + // Draw a white box around the items that are equipped on the C buttons + // Loop over c-buttons (i) and vtx offset (j) + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + for (i = 0, j = 24 * 4; i < 3; i++, j += 4) { + if (GET_CUR_FORM_BTN_ITEM(i + 1) != ITEM_NONE) { + if (GET_CUR_FORM_BTN_SLOT(i + 1) < 24) { + gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j], 4, 0); + POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); + } + } + } + + gDPPipeSync(POLY_OPA_DISP++); + + // Draw the item icons + // Loop over slots (i) and vtx offset (j) + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + for (j = 0, i = 0; i < 24; i++, j += 4) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + if (((void)0, gSaveContext.save.inventory.items[i]) != ITEM_NONE) { + if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && (pauseCtx->cursorSpecialPos == 0) && + gPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) { + if ((sEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) && (i == SLOT_ARROW_ICE)) { + // Possible bug: + // Supposed to be `SLOT_BOW`, unchanged from OoT, instead increase size of ice arrow icon + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sMagicArrowEffectsR[pauseCtx->equipTargetItem - 0xB5], + sMagicArrowEffectsG[pauseCtx->equipTargetItem - 0xB5], + sMagicArrowEffectsB[pauseCtx->equipTargetItem - 0xB5], pauseCtx->alpha); + + pauseCtx->itemVtx[j + 0].v.ob[0] = pauseCtx->itemVtx[j + 2].v.ob[0] = + pauseCtx->itemVtx[j + 0].v.ob[0] - 2; + pauseCtx->itemVtx[j + 1].v.ob[0] = pauseCtx->itemVtx[j + 3].v.ob[0] = + pauseCtx->itemVtx[j + 0].v.ob[0] + 32; + pauseCtx->itemVtx[j + 0].v.ob[1] = pauseCtx->itemVtx[j + 1].v.ob[1] = + pauseCtx->itemVtx[j + 0].v.ob[1] + 2; + pauseCtx->itemVtx[j + 2].v.ob[1] = pauseCtx->itemVtx[j + 3].v.ob[1] = + pauseCtx->itemVtx[j + 0].v.ob[1] - 32; + + } else if (i == pauseCtx->cursorSlot[PAUSE_ITEM]) { + // Increase the size of the selected item + pauseCtx->itemVtx[j + 0].v.ob[0] = pauseCtx->itemVtx[j + 2].v.ob[0] = + pauseCtx->itemVtx[j + 0].v.ob[0] - 2; + pauseCtx->itemVtx[j + 1].v.ob[0] = pauseCtx->itemVtx[j + 3].v.ob[0] = + pauseCtx->itemVtx[j + 0].v.ob[0] + 32; + pauseCtx->itemVtx[j + 0].v.ob[1] = pauseCtx->itemVtx[j + 1].v.ob[1] = + pauseCtx->itemVtx[j + 0].v.ob[1] + 2; + pauseCtx->itemVtx[j + 2].v.ob[1] = pauseCtx->itemVtx[j + 3].v.ob[1] = + pauseCtx->itemVtx[j + 0].v.ob[1] - 32; + } + } + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0); + KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, + gItemIcons[((void)0, gSaveContext.save.inventory.items[i])], 32, 32, 0); + } + } + + // Draw the ammo digits + if (pauseCtx->pageIndex == PAUSE_ITEM) { + if ((pauseCtx->state == 6) && ((pauseCtx->unk_200 == 0) || (pauseCtx->unk_200 == 3)) && + (pauseCtx->state != 7) && ((pauseCtx->state < 8) || (pauseCtx->state >= 0x13))) { + func_8012C628(play->state.gfxCtx); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + // Loop over slots (i) and ammoIndex (j) + for (j = 0, i = 0; i < 24; i++) { + if (gAmmoItems[i] != ITEM_NONE) { + if (((void)0, gSaveContext.save.inventory.items[i]) != ITEM_NONE) { + KaleidoScope_DrawAmmoCount(pauseCtx, play->state.gfxCtx, + ((void)0, gSaveContext.save.inventory.items[i]), j); + } + j++; + } + } + func_8012C8AC(play->state.gfxCtx); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +u8 sPlayerFormItems[] = { + ITEM_MASK_FIERCE_DEITY, ITEM_MASK_GORON, ITEM_MASK_ZORA, ITEM_MASK_DEKU, ITEM_NONE, }; -s16 D_8082B484[] = { - 0x0294, - 0x0384, - 0x0474, - 0x0000, -}; +void KaleidoScope_UpdateItemCursor(PlayState* play) { + s32 pad1; + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + u16 vtxIndex; + u16 cursorItem; + u16 cursorSlot; + u8 magicArrowIndex; + s16 cursorPoint; + s16 cursorX; + s16 cursorY; + s16 oldCursorPoint; + s16 moveCursorResult; + s16 pad2; -s16 D_8082B48C[] = { - 0x044C, - 0x0398, - 0x044C, - 0x0000, -}; + pauseCtx->cursorColorSet = 0; + pauseCtx->nameColorSet = 0; -s32 D_8082B494[] = { 0, 0, 0 }; + if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && + !pauseCtx->itemDescriptionOn) { + moveCursorResult = 0; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081B240.s") + cursorItem = pauseCtx->cursorItem[PAUSE_ITEM]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081B6BC.s") + // Move cursor left/right + if (pauseCtx->cursorSpecialPos == 0) { + // cursor is currently on a slot + pauseCtx->cursorColorSet = 2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081B6EC.s") + if (ABS_ALT(pauseCtx->stickRelX) > 30) { + cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; + cursorX = pauseCtx->cursorX[PAUSE_ITEM]; + cursorY = pauseCtx->cursorY[PAUSE_ITEM]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081BCA8.s") + // Search for slot to move to + while (moveCursorResult == 0) { + if (pauseCtx->stickRelX < -30) { + // move cursor left + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorX[PAUSE_ITEM] != 0) { + pauseCtx->cursorX[PAUSE_ITEM]--; + pauseCtx->cursorPoint[PAUSE_ITEM]--; + moveCursorResult = 1; + } else { + pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + pauseCtx->cursorY[PAUSE_ITEM]++; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081C684.s") + if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) { + pauseCtx->cursorY[PAUSE_ITEM] = 0; + } + + pauseCtx->cursorPoint[PAUSE_ITEM] = + pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6); + + if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) { + pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM]; + } + + if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) { + pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; + + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + + moveCursorResult = 2; + } + } + } else if (pauseCtx->stickRelX > 30) { + // move cursor right + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorX[PAUSE_ITEM] <= 4) { + pauseCtx->cursorX[PAUSE_ITEM]++; + pauseCtx->cursorPoint[PAUSE_ITEM]++; + moveCursorResult = 1; + } else { + pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + pauseCtx->cursorY[PAUSE_ITEM]++; + + if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) { + pauseCtx->cursorY[PAUSE_ITEM] = 0; + } + + pauseCtx->cursorPoint[PAUSE_ITEM] = + pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6); + + if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) { + pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM]; + } + + if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) { + pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; + + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + + moveCursorResult = 2; + } + } + } + } + + if (moveCursorResult == 1) { + cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; + } + } + } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + if (pauseCtx->stickRelX > 30) { + func_80821A04(play); + cursorY = 0; + cursorX = 0; + cursorPoint = 0; // top row, left column (SLOT_OCARINA) + + // Search for slot to move to + while (true) { + // Check if current cursor has an item in its slot + if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) { + pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; + pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + pauseCtx->cursorY[PAUSE_ITEM] = cursorY; + moveCursorResult = 1; + break; + } + + // move 1 row down and retry + cursorY++; + cursorPoint += 6; + if (cursorY < 4) { + continue; + } + + // move 1 column right and retry + cursorY = 0; + cursorPoint = cursorX + 1; + cursorX = cursorPoint; + if (cursorX < 6) { + continue; + } + + // No item available + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + break; + } + } + } else { // PAUSE_CURSOR_PAGE_RIGHT + if (pauseCtx->stickRelX < -30) { + func_80821A04(play); + cursorX = 5; + cursorPoint = 5; // top row, right columne (SLOT_TRADE_DEED) + cursorY = 0; + + // Search for slot to move to + while (true) { + // Check if current cursor has an item in its slot + if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) { + pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; + pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + pauseCtx->cursorY[PAUSE_ITEM] = cursorY; + moveCursorResult = 1; + break; + } + + // move 1 row down and retry + cursorY++; + cursorPoint += 6; + if (cursorY < 4) { + continue; + } + + // move 1 column left and retry + cursorY = 0; + cursorPoint = cursorX - 1; + cursorX = cursorPoint; + if (cursorX >= 0) { + continue; + } + + // No item available + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + break; + } + } + } + + if (pauseCtx->cursorSpecialPos == 0) { + // move cursor up/down + if (ABS_ALT(pauseCtx->stickRelY) > 30) { + moveCursorResult = 0; + + cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; + cursorY = pauseCtx->cursorY[PAUSE_ITEM]; + + while (moveCursorResult == 0) { + if (pauseCtx->stickRelY > 30) { + // move cursor up + moveCursorResult = 2; + if (pauseCtx->cursorY[PAUSE_ITEM] != 0) { + pauseCtx->cursorY[PAUSE_ITEM]--; + pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorPoint[PAUSE_ITEM] -= 6; + moveCursorResult = 1; + } else { + pauseCtx->cursorY[PAUSE_ITEM] = cursorY; + pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; + } + } else if (pauseCtx->stickRelY < -30) { + // move cursor down + moveCursorResult = 2; + if (pauseCtx->cursorY[PAUSE_ITEM] < 3) { + pauseCtx->cursorY[PAUSE_ITEM]++; + pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorPoint[PAUSE_ITEM] += 6; + moveCursorResult = 1; + } else { + pauseCtx->cursorY[PAUSE_ITEM] = cursorY; + pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; + } + } + } + } + + cursorSlot = pauseCtx->cursorPoint[PAUSE_ITEM]; + pauseCtx->cursorColorSet = 2; + + if (moveCursorResult == 1) { + cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; + } else if (moveCursorResult != 2) { + cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; + } + + if (cursorItem == ITEM_NONE) { + cursorItem = PAUSE_ITEM_NONE; + pauseCtx->cursorColorSet = 0; + } + + if ((cursorItem != (u32)PAUSE_ITEM_NONE) && (msgCtx->msgLength == 0)) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + + pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem; + pauseCtx->cursorSlot[PAUSE_ITEM] = cursorSlot; + if (cursorItem != PAUSE_ITEM_NONE) { + // Equip item to the C buttons + if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && !pauseCtx->itemDescriptionOn && + (pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && + CHECK_BTN_ANY(CONTROLLER1(&play->state)->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { + + // Ensure that a transformation mask can not be unequipped while being used + if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { + if (1) {} + if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CLEFT)) { + if (sPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)) { + play_sound(NA_SE_SY_ERROR); + return; + } + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CDOWN)) { + if (sPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)) { + play_sound(NA_SE_SY_ERROR); + return; + } + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CRIGHT)) { + if (sPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { + play_sound(NA_SE_SY_ERROR); + return; + } + } + } + + // Ensure that a non-transformation mask can not be unequipped while being used + if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CLEFT)) { + if ((Player_GetCurMaskItemId(play) != ITEM_NONE) && + (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT))) { + play_sound(NA_SE_SY_ERROR); + return; + } + pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_LEFT; + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CDOWN)) { + if ((Player_GetCurMaskItemId(play) != ITEM_NONE) && + (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN))) { + play_sound(NA_SE_SY_ERROR); + return; + } + pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_DOWN; + } else if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_CRIGHT)) { + if ((Player_GetCurMaskItemId(play) != ITEM_NONE) && + (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT))) { + play_sound(NA_SE_SY_ERROR); + return; + } + pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_RIGHT; + } + + // Equip item to the C buttons + pauseCtx->equipTargetItem = cursorItem; + pauseCtx->equipTargetSlot = cursorSlot; + pauseCtx->unk_200 = 3; + vtxIndex = cursorSlot * 4; + pauseCtx->equipAnimX = pauseCtx->itemVtx[vtxIndex].v.ob[0] * 10; + pauseCtx->equipAnimY = pauseCtx->itemVtx[vtxIndex].v.ob[1] * 10; + pauseCtx->equipAnimAlpha = 255; + sEquipMagicArrowSlotHoldTimer = 0; + sEquipState = EQUIP_STATE_MOVE_TO_C_BTN; + sEquipAnimTimer = 10; + + if ((pauseCtx->equipTargetItem == ITEM_ARROW_FIRE) || + (pauseCtx->equipTargetItem == ITEM_ARROW_ICE) || + (pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT)) { + magicArrowIndex = 0; + if (pauseCtx->equipTargetItem == ITEM_ARROW_ICE) { + magicArrowIndex = 1; + } + if (pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT) { + magicArrowIndex = 2; + } + play_sound(NA_SE_SY_SET_FIRE_ARROW + magicArrowIndex); + pauseCtx->equipTargetItem = 0xB5 + magicArrowIndex; + pauseCtx->equipAnimAlpha = sEquipState = 0; // EQUIP_STATE_MAGIC_ARROW_GROW_ORB + sEquipAnimTimer = 6; + } else { + play_sound(NA_SE_SY_DECIDE); + } + } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == 6) && + (pauseCtx->unk_200 == 0) && CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && + (msgCtx->msgLength == 0)) { + // Give description on item through a message box + pauseCtx->itemDescriptionOn = true; + if (pauseCtx->cursorY[PAUSE_ITEM] < 2) { + func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_ITEM], 3); + } else { + func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_ITEM], 1); + } + } + } + } else { + pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE; + } + + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_ITEM]) { + play_sound(NA_SE_SY_CURSOR); + } + } else if ((pauseCtx->unk_200 == 3) && (pauseCtx->pageIndex == PAUSE_ITEM)) { + pauseCtx->cursorColorSet = 2; + } +} + +s16 sCButtonPosX[] = { 660, 900, 1140 }; +s16 sCButtonPosY[] = { 1100, 920, 1100 }; + +void KaleidoScope_UpdateItemEquip(PlayState* play) { + static s16 sEquipMagicArrowBowSlotHoldTimer = 0; + PauseContext* pauseCtx = &play->pauseCtx; + Vtx* bowItemVtx; + u16 offsetX; + u16 offsetY; + + // Grow glowing orb when equipping magic arrows + if (sEquipState == EQUIP_STATE_MAGIC_ARROW_GROW_ORB) { + pauseCtx->equipAnimAlpha += 14; + if (pauseCtx->equipAnimAlpha > 255) { + pauseCtx->equipAnimAlpha = 254; + sEquipState++; + } + // Hover over magic arrow slot when the next state is reached + sEquipMagicArrowSlotHoldTimer = 5; + return; + } + + if (sEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) { + sEquipMagicArrowBowSlotHoldTimer--; + + if (sEquipMagicArrowBowSlotHoldTimer == 0) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + sEquipAnimTimer = 6; + pauseCtx->equipAnimScale = 320; + pauseCtx->equipAnimShrinkRate = 40; + sEquipState++; + play_sound(NA_SE_SY_SYNTH_MAGIC_ARROW); + } + return; + } + + if (sEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) { + bowItemVtx = &pauseCtx->itemVtx[4]; + offsetX = ABS_ALT(pauseCtx->equipAnimX - bowItemVtx->v.ob[0] * 10) / sEquipAnimTimer; + offsetY = ABS_ALT(pauseCtx->equipAnimY - bowItemVtx->v.ob[1] * 10) / sEquipAnimTimer; + } else { + offsetX = ABS_ALT(pauseCtx->equipAnimX - sCButtonPosX[pauseCtx->equipTargetCBtn]) / sEquipAnimTimer; + offsetY = ABS_ALT(pauseCtx->equipAnimY - sCButtonPosY[pauseCtx->equipTargetCBtn]) / sEquipAnimTimer; + } + + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipAnimAlpha < 254)) { + pauseCtx->equipAnimAlpha += 14; + if (pauseCtx->equipAnimAlpha > 255) { + pauseCtx->equipAnimAlpha = 254; + } + sEquipMagicArrowSlotHoldTimer = 5; + return; + } + + if (sEquipMagicArrowSlotHoldTimer == 0) { + pauseCtx->equipAnimScale -= pauseCtx->equipAnimShrinkRate / sEquipAnimTimer; + pauseCtx->equipAnimShrinkRate -= pauseCtx->equipAnimShrinkRate / sEquipAnimTimer; + + // Update coordinates of item icon while being equipped + if (sEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) { + // target is the bow slot + if (pauseCtx->equipAnimX >= (pauseCtx->itemVtx[4].v.ob[0] * 10)) { + pauseCtx->equipAnimX -= offsetX; + } else { + pauseCtx->equipAnimX += offsetX; + } + + if (pauseCtx->equipAnimY >= (pauseCtx->itemVtx[4].v.ob[1] * 10)) { + pauseCtx->equipAnimY -= offsetY; + } else { + pauseCtx->equipAnimY += offsetY; + } + } else { + // target is the c button + if (pauseCtx->equipAnimX >= sCButtonPosX[pauseCtx->equipTargetCBtn]) { + pauseCtx->equipAnimX -= offsetX; + } else { + pauseCtx->equipAnimX += offsetX; + } + + if (pauseCtx->equipAnimY >= sCButtonPosY[pauseCtx->equipTargetCBtn]) { + pauseCtx->equipAnimY -= offsetY; + } else { + pauseCtx->equipAnimY += offsetY; + } + } + + sEquipAnimTimer--; + if (sEquipAnimTimer == 0) { + if (sEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) { + sEquipState++; + sEquipMagicArrowBowSlotHoldTimer = 4; + return; + } + + // Equip item onto c buttons + if (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_LEFT) { + // Swap if item is already equipped on CDown or CRight. + if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) { + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) == ITEM_BOW) || + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); + } + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = SLOT_NONE; + } + } else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) { + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) == ITEM_BOW) || + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); + } + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = SLOT_NONE; + } + } + + // Special case for magic arrows + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) == ITEM_BOW) || + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_ARROW_LIGHT))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } + } else if (pauseCtx->equipTargetItem == ITEM_BOW) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_ARROW_LIGHT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); + } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_ARROW_LIGHT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); + } + } + + // Equip item on CLeft + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = pauseCtx->equipTargetItem; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = pauseCtx->equipTargetSlot; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_LEFT); + } else if (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_DOWN) { + // Swap if item is already equipped on CLeft or CRight. + if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) { + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) == ITEM_BOW) || + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); + } + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = SLOT_NONE; + } + } else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) { + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) == ITEM_BOW) || + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); + } + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = SLOT_NONE; + } + } + + // Special case for magic arrows + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) == ITEM_BOW) || + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_ARROW_LIGHT))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } + } else if (pauseCtx->equipTargetItem == ITEM_BOW) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_ARROW_LIGHT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); + } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_ARROW_LIGHT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); + } + } + + // Equip item on CDown + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = pauseCtx->equipTargetItem; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = pauseCtx->equipTargetSlot; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_DOWN); + } else { // (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_RIGHT) + // Swap if item is already equipped on CLeft or CDown. + if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) { + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) == ITEM_BOW) || + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); + } + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = SLOT_NONE; + } + } else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) { + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8) && + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) == ITEM_BOW) || + (((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) >= ITEM_BOW_ARROW_FIRE) && + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) <= ITEM_BOW_ARROW_LIGHT)))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); + } + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = SLOT_NONE; + } + } + + // Special case for magic arrows + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipTargetItem < 0xB8)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) == ITEM_BOW) || + ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) <= ITEM_BOW_ARROW_LIGHT))) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + } + } else if (pauseCtx->equipTargetItem == ITEM_BOW) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) <= ITEM_BOW_ARROW_LIGHT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); + } else if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) >= ITEM_BOW_ARROW_FIRE) && + (BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) <= ITEM_BOW_ARROW_LIGHT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); + } + } + + // Equip item on CRight + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = pauseCtx->equipTargetItem; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = pauseCtx->equipTargetSlot; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_RIGHT); + } + + // Reset params + pauseCtx->unk_200 = 0; + sEquipAnimTimer = 10; + pauseCtx->equipAnimScale = 320; + pauseCtx->equipAnimShrinkRate = 40; + } + } else { + sEquipMagicArrowSlotHoldTimer--; + if (sEquipMagicArrowSlotHoldTimer == 0) { + pauseCtx->equipAnimAlpha = 255; + } + } +} 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 b4d2a192fe..19e3c8719c 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 @@ -3,14 +3,25 @@ #include "global.h" +#define PAUSE_ITEM_NONE 999 + +#define PAUSE_CURSOR_PAGE_LEFT 10 +#define PAUSE_CURSOR_PAGE_RIGHT 11 + typedef enum { - /* 0x00 */ PAUSE_ITEM, - /* 0x01 */ PAUSE_MAP, - /* 0x02 */ PAUSE_QUEST, - /* 0x03 */ PAUSE_MASK, - /* 0x04 */ PAUSE_WORLD_MAP + /* 0 */ PAUSE_ITEM, + /* 1 */ PAUSE_MAP, + /* 2 */ PAUSE_QUEST, + /* 3 */ PAUSE_MASK, + /* 4 */ PAUSE_WORLD_MAP } PauseMenuPage; +typedef enum { + /* 0 */ PAUSE_EQUIP_C_LEFT, + /* 1 */ PAUSE_EQUIP_C_DOWN, + /* 2 */ PAUSE_EQUIP_C_RIGHT +} PauseEquipCButton; + typedef enum { /* 0 */ DEBUG_EDITOR_NONE, /* 1 */ DEBUG_EDITOR_INVENTORY_INIT, @@ -21,6 +32,17 @@ typedef enum { #define PAUSE_PROMPT_YES 0 #define PAUSE_PROMPT_NO 4 +// NES +void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, s16 cursorSpecialPos); +void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); +void func_80821A04(PlayState* play); + +// Item +void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); +void KaleidoScope_DrawItemSelect(PlayState* play); +void KaleidoScope_UpdateItemCursor(PlayState* play); +void KaleidoScope_UpdateItemEquip(PlayState* play); + // Debug void KaleidoScope_DrawInventoryEditor(PlayState* play); void KaleidoScope_UpdateInventoryEditor(PlayState* play); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index 44575f156e..c02ebcad28 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -318,11 +318,11 @@ s32 D_8082BEB8[] = { 0, 0 }; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821958.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821984.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_MoveCursorToSpecialPos.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821A04.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821AD4.s") +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_DrawQuadTextureRGBA32.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821CC4.s") diff --git a/tools/ZAPDConfigs/MM/ObjectList_MM.txt b/tools/ZAPDConfigs/MM/ObjectList_MM.txt index c3848574c5..93c17e298e 100644 --- a/tools/ZAPDConfigs/MM/ObjectList_MM.txt +++ b/tools/ZAPDConfigs/MM/ObjectList_MM.txt @@ -393,7 +393,7 @@ OBJECT_DRIFTICE OBJECT_FALL OBJECT_HANAREYAMA_OBJ OBJECT_CRACE_OBJECT -OBJECT_DNQ +OBJECT_DNO OBJECT_OBJ_TOKEIDAI OBJECT_EG OBJECT_TRU @@ -466,7 +466,7 @@ OBJECT_GG OBJECT_MARUTA OBJECT_GHAKA OBJECT_OYU -OBJECT_DNP +OBJECT_DNQ OBJECT_DAI OBJECT_KGY OBJECT_FB @@ -497,7 +497,7 @@ OBJECT_GI_LOACH OBJECT_GI_SEAHORSE OBJECT_BIGPO OBJECT_HARIKO -OBJECT_DNO +OBJECT_DNJ OBJECT_SINKAI_KABE OBJECT_KIN2_OBJ OBJECT_ISHI diff --git a/tools/disasm/dma_filenames.txt b/tools/disasm/dma_filenames.txt index e9a743615f..aaa17ab6d8 100644 --- a/tools/disasm/dma_filenames.txt +++ b/tools/disasm/dma_filenames.txt @@ -885,7 +885,7 @@ 'object_fall', 'object_hanareyama_obj', 'object_crace_object', - 'object_dnq', + 'object_dno', 'object_obj_tokeidai', 'object_eg', 'object_tru', @@ -956,7 +956,7 @@ 'object_maruta', 'object_ghaka', 'object_oyu', - 'object_dnp', + 'object_dnq', 'object_dai', 'object_kgy', 'object_fb', @@ -977,7 +977,7 @@ 'object_gi_seahorse', 'object_bigpo', 'object_hariko', - 'object_dno', + 'object_dnj', 'object_sinkai_kabe', 'object_kin2_obj', 'object_ishi', diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 89196ea982..afd167a170 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2093,17 +2093,17 @@ 0x8010DC58:("func_8010DC58",), 0x8010DE38:("func_8010DE38",), 0x8010E028:("func_8010E028",), - 0x8010E968:("func_8010E968",), - 0x8010E9F0:("func_8010E9F0",), - 0x8010EA9C:("func_8010EA9C",), - 0x8010EB50:("func_8010EB50",), - 0x8010EBA0:("func_8010EBA0",), - 0x8010EC54:("func_8010EC54",), + 0x8010E968:("Interface_PostmanTimerCallback",), + 0x8010E9F0:("Interface_StartTimer",), + 0x8010EA9C:("Interface_StartPostmanTimer",), + 0x8010EB50:("Interface_StartGoronRaceTimer",), + 0x8010EBA0:("Interface_StartBottleTimer",), + 0x8010EC54:("Interface_GetCompressedTimerDigits",), 0x8010EE74:("func_8010EE74",), - 0x8010EF68:("Interface_ChangeAlpha",), - 0x8010EF9C:("func_8010EF9C",), - 0x8010F0D4:("func_8010F0D4",), - 0x8010F1A8:("func_8010F1A8",), + 0x8010EF68:("Interface_SetHudVisibility",), + 0x8010EF9C:("Interface_UpdateButtonAlphasByStatus",), + 0x8010F0D4:("Interface_UpdateButtonAlphas",), + 0x8010F1A8:("Interface_UpdateHudAlphas",), 0x80110038:("func_80110038",), 0x80111CB4:("func_80111CB4",), 0x801129E4:("func_801129E4",), @@ -2156,16 +2156,16 @@ 0x8011B9E0:("func_8011B9E0",), 0x8011BF70:("func_8011BF70",), 0x8011C4C4:("func_8011C4C4",), - 0x8011C808:("func_8011C808",), - 0x8011C898:("func_8011C898",), - 0x8011CA64:("func_8011CA64",), - 0x8011E3B4:("func_8011E3B4",), + 0x8011C808:("Interface_StartMoonCrash",), + 0x8011C898:("Interface_GetTimerDigits",), + 0x8011CA64:("Interface_DrawTimers",), + 0x8011E3B4:("Interface_UpdateBottleTimers",), 0x8011E730:("func_8011E730",), 0x8011F0E0:("Interface_Draw",), 0x80120F90:("func_80120F90",), 0x80121064:("func_80121064",), 0x801210E0:("Interface_Update",), - 0x80121F94:("func_80121F94",), + 0x80121F94:("Interface_Destroy",), 0x80121FC4:("func_80121FC4",), 0x801224E0:("Path_GetByIndex",), 0x80122524:("Path_OrientAndGetDistSq",), @@ -2232,7 +2232,7 @@ 0x80124258:("Player_GetExplosiveHeld",), 0x80124278:("func_80124278",), 0x801242B4:("func_801242B4",), - 0x801242DC:("func_801242DC",), + 0x801242DC:("Player_GetEnvTimerType",), 0x80124420:("func_80124420",), 0x80124618:("func_80124618",), 0x801246F4:("func_801246F4",), @@ -2495,8 +2495,8 @@ 0x80131F90:("Scene_DrawConfigMatAnimManualStep",), 0x80131FC0:("Scene_DrawConfigGreatBayTemple",), 0x801322C0:("Entrance_GetTableEntry",), - 0x8013230C:("Entrance_GetSceneNum",), - 0x80132338:("Entrance_GetSceneNumAbsolute",), + 0x8013230C:("Entrance_GetSceneId",), + 0x80132338:("Entrance_GetSceneIdAbsolute",), 0x80132374:("Entrance_GetSpawnNum",), 0x801323A0:("Entrance_GetTransitionFlags",), 0x801323D0:("Schedule_CheckFlagS",), @@ -3024,7 +3024,7 @@ 0x80169BF8:("func_80169BF8",), 0x80169C64:("Play_GetActorCsCamSetting",), 0x80169C84:("Play_GetActorCsCamFuncData",), - 0x80169CBC:("Play_GetOriginalSceneNumber",), + 0x80169CBC:("Play_GetOriginalSceneId",), 0x80169D40:("Play_SaveCycleSceneFlags",), 0x80169DCC:("Play_SetRespawnData",), 0x80169E6C:("Play_SetupRespawnPoint",), @@ -4204,11 +4204,11 @@ 0x808190C4:("KaleidoScope_DrawDigit",), 0x80819238:("KaleidoScope_DrawInventoryEditor",), 0x80819F04:("KaleidoScope_UpdateInventoryEditor",), - 0x8081B240:("func_8081B240",), - 0x8081B6BC:("func_8081B6BC",), - 0x8081B6EC:("func_8081B6EC",), - 0x8081BCA8:("func_8081BCA8",), - 0x8081C684:("func_8081C684",), + 0x8081B240:("KaleidoScope_DrawAmmoCount",), + 0x8081B6BC:("KaleidoScope_SetCursorVtx",), + 0x8081B6EC:("KaleidoScope_DrawItemSelect",), + 0x8081BCA8:("KaleidoScope_UpdateItemCursor",), + 0x8081C684:("KaleidoScope_UpdateItemEquip",), 0x8081D240:("func_8081D240",), 0x8081D6DC:("func_8081D6DC",), 0x8081E118:("func_8081E118",), @@ -4221,9 +4221,9 @@ 0x80821900:("func_80821900",), 0x8082192C:("func_8082192C",), 0x80821958:("func_80821958",), - 0x80821984:("func_80821984",), + 0x80821984:("KaleidoScope_MoveCursorToSpecialPos",), 0x80821A04:("func_80821A04",), - 0x80821AD4:("func_80821AD4",), + 0x80821AD4:("KaleidoScope_DrawQuadTextureRGBA32",), 0x80821CC4:("func_80821CC4",), 0x80821D84:("func_80821D84",), 0x80821F30:("func_80821F30",), @@ -8412,19 +8412,19 @@ 0x8098F66C:("func_8098F66C",), 0x8098F680:("func_8098F680",), 0x8098F6FC:("ObjMure3_Update",), - 0x8098F800:("func_8098F800",), - 0x8098F8A8:("func_8098F8A8",), - 0x8098F928:("func_8098F928",), + 0x8098F800:("EnTg_ChangeAnim",), + 0x8098F8A8:("EnTg_UpdateCollider",), + 0x8098F928:("EnTg_UpdateSkelAnime",), 0x8098F954:("EnTg_Init",), 0x8098FA44:("EnTg_Destroy",), - 0x8098FA70:("func_8098FA70",), + 0x8098FA70:("EnTg_Idle",), 0x8098FB28:("EnTg_Update",), - 0x8098FBB4:("func_8098FBB4",), - 0x8098FBD0:("func_8098FBD0",), + 0x8098FBB4:("EnTg_OverrideLimbDraw",), + 0x8098FBD0:("EnTg_PostLimbDraw",), 0x8098FC2C:("EnTg_Draw",), - 0x8098FD50:("func_8098FD50",), - 0x8098FEA8:("func_8098FEA8",), - 0x8099000C:("func_8099000C",), + 0x8098FD50:("EnTg_SpawnHeart",), + 0x8098FEA8:("EnTg_UpdateHearts",), + 0x8099000C:("EnTg_DrawHearts",), 0x80990310:("EnWf_Init",), 0x80990784:("EnWf_Destroy",), 0x809907D4:("func_809907D4",), @@ -8751,36 +8751,36 @@ 0x809A610C:("ObjBoyo_Draw",), 0x809A6280:("EnGrasshopper_Init",), 0x809A64E0:("EnGrasshopper_Destroy",), - 0x809A6524:("func_809A6524",), - 0x809A65D8:("func_809A65D8",), - 0x809A6628:("func_809A6628",), - 0x809A6668:("func_809A6668",), - 0x809A6754:("func_809A6754",), - 0x809A67A4:("func_809A67A4",), - 0x809A6B6C:("func_809A6B6C",), - 0x809A6E18:("func_809A6E18",), - 0x809A6E74:("func_809A6E74",), - 0x809A6F8C:("func_809A6F8C",), - 0x809A700C:("func_809A700C",), - 0x809A7134:("func_809A7134",), - 0x809A71CC:("func_809A71CC",), - 0x809A7494:("func_809A7494",), - 0x809A753C:("func_809A753C",), - 0x809A7844:("func_809A7844",), - 0x809A78EC:("func_809A78EC",), - 0x809A797C:("func_809A797C",), - 0x809A7A8C:("func_809A7A8C",), - 0x809A7AE4:("func_809A7AE4",), - 0x809A7BBC:("func_809A7BBC",), - 0x809A7C98:("func_809A7C98",), - 0x809A7CE0:("func_809A7CE0",), - 0x809A8044:("func_809A8044",), + 0x809A6524:("EnGrasshopper_ChangeAnim",), + 0x809A65D8:("EnGrasshopper_RaiseTail",), + 0x809A6628:("EnGrasshopper_LowerTail",), + 0x809A6668:("EnGrasshopper_DecideAction",), + 0x809A6754:("EnGrasshopper_SetupFly",), + 0x809A67A4:("EnGrasshopper_Fly",), + 0x809A6B6C:("EnGrasshopper_RoamInCircles",), + 0x809A6E18:("EnGrasshopper_SetupBank",), + 0x809A6E74:("EnGrasshopper_Turn",), + 0x809A6F8C:("EnGrasshopper_SetupBounced",), + 0x809A700C:("EnGrasshopper_Bounced",), + 0x809A7134:("EnGrasshopper_SetupApproachPlayer",), + 0x809A71CC:("EnGrasshopper_ApproachPlayer",), + 0x809A7494:("EnGrasshopper_SetupAttack",), + 0x809A753C:("EnGrasshopper_Attack",), + 0x809A7844:("EnGrasshopper_SetupWaitAfterAttack",), + 0x809A78EC:("EnGrasshopper_WaitAfterAttack",), + 0x809A797C:("EnGrasshopper_SetupDamaged",), + 0x809A7A8C:("EnGrasshopper_Damaged",), + 0x809A7AE4:("EnGrasshopper_SetupDead",), + 0x809A7BBC:("EnGrasshopper_Dead",), + 0x809A7C98:("EnGrasshopper_SetupFall",), + 0x809A7CE0:("EnGrasshopper_Fall",), + 0x809A8044:("EnGrasshopper_UpdateDamage",), 0x809A8224:("EnGrasshopper_Update",), - 0x809A847C:("func_809A847C",), + 0x809A847C:("EnGrasshopper_PostLimbDraw",), 0x809A8640:("EnGrasshopper_Draw",), - 0x809A8870:("func_809A8870",), - 0x809A8924:("func_809A8924",), - 0x809A8A64:("func_809A8A64",), + 0x809A8870:("EnGrasshopper_InitializeEffect",), + 0x809A8924:("EnGrasshopper_UpdateEffects",), + 0x809A8A64:("EnGrasshopper_DrawEffects",), 0x809A9110:("func_809A9110",), 0x809A91FC:("func_809A91FC",), 0x809A92D0:("func_809A92D0",), @@ -9125,14 +9125,14 @@ 0x809CA27C:("BgIcicle_Draw",), 0x809CA3F0:("EnSyatekiCrow_Init",), 0x809CA5A8:("EnSyatekiCrow_Destroy",), - 0x809CA5D4:("func_809CA5D4",), - 0x809CA67C:("func_809CA67C",), - 0x809CA71C:("func_809CA71C",), - 0x809CA840:("func_809CA840",), - 0x809CA8E4:("func_809CA8E4",), - 0x809CAAF8:("func_809CAAF8",), - 0x809CABC0:("func_809CABC0",), - 0x809CACD0:("func_809CACD0",), + 0x809CA5D4:("EnSyatekiCrow_SetupWaitForSpawn",), + 0x809CA67C:("EnSyatekiCrow_WaitForSpawn",), + 0x809CA71C:("EnSyatekiCrow_SetupWaitToMove",), + 0x809CA840:("EnSyatekiCrow_WaitToMove",), + 0x809CA8E4:("EnSyatekiCrow_Fly",), + 0x809CAAF8:("EnSyatekiCrow_SetupDead",), + 0x809CABC0:("EnSyatekiCrow_Dead",), + 0x809CACD0:("EnSyatekiCrow_UpdateDamage",), 0x809CADE8:("EnSyatekiCrow_Update",), 0x809CAE5C:("EnSyatekiCrow_OverrideLimbDraw",), 0x809CAF2C:("EnSyatekiCrow_PostLimbDraw",), @@ -10254,17 +10254,17 @@ 0x80A3862C:("DmZl_OverrideLimbDraw",), 0x80A38648:("DmZl_PostLimbDraw",), 0x80A3869C:("DmZl_Draw",), - 0x80A389A0:("func_80A389A0",), - 0x80A38A68:("func_80A38A68",), - 0x80A38B7C:("func_80A38B7C",), - 0x80A38BF0:("func_80A38BF0",), - 0x80A38C70:("func_80A38C70",), - 0x80A38DF4:("func_80A38DF4",), + 0x80A389A0:("EnRu_ChangeAnim",), + 0x80A38A68:("EnRu_PlayWalkingSound",), + 0x80A38B7C:("EnRu_UpdateEyes",), + 0x80A38BF0:("EnRu_UpdateCollider",), + 0x80A38C70:("EnRu_UpdateModel",), + 0x80A38DF4:("EnRu_DoNothing",), 0x80A38E04:("EnRu_Init",), 0x80A38F10:("EnRu_Destroy",), 0x80A38F3C:("EnRu_Update",), - 0x80A38FB4:("func_80A38FB4",), - 0x80A390F8:("func_80A390F8",), + 0x80A38FB4:("EnRu_OverrideLimbdraw",), + 0x80A390F8:("EnRu_PostLimbdraw",), 0x80A39204:("EnRu_Draw",), 0x80A396B0:("func_80A396B0",), 0x80A3970C:("EnElfgrp_Init",), @@ -15387,7 +15387,7 @@ 0x80BBA930:("func_80BBA930",), 0x80BBACA0:("EnZos_Init",), 0x80BBAE60:("EnZos_Destroy",), - 0x80BBAE84:("func_80BBAE84",), + 0x80BBAE84:("EnZos_ChangeAnim",), 0x80BBAF5C:("func_80BBAF5C",), 0x80BBAFFC:("func_80BBAFFC",), 0x80BBB0D4:("func_80BBB0D4",), @@ -16061,7 +16061,7 @@ 0x80BE16B4:("EnTab_PostLimbDraw",), 0x80BE1704:("EnTab_TransformLimbDraw",), 0x80BE1810:("EnTab_Draw",), - 0x80BE1C80:("func_80BE1C80",), + 0x80BE1C80:("EnNimotsu_UpdateCollision",), 0x80BE1CEC:("EnNimotsu_Init",), 0x80BE1D5C:("EnNimotsu_Destroy",), 0x80BE1D88:("EnNimotsu_Update",), @@ -17125,8 +17125,8 @@ 0x80C256AC:("func_80C256AC",), 0x80C25710:("func_80C25710",), 0x80C2572C:("func_80C2572C",), - 0x80C25780:("func_80C25780",), - 0x80C25794:("func_80C25794",), + 0x80C25780:("ObjSwprize_SetupDoNothing",), + 0x80C25794:("ObjSwprize_DoNothing",), 0x80C257A4:("ObjSwprize_Update",), 0x80C258A0:("func_80C258A0",), 0x80C2590C:("func_80C2590C",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 88712ed088..646977c3a8 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1074,16 +1074,16 @@ 0x801BF8A8:("sMagicMeterOutlinePrimBlue","UNK_TYPE2","",0x2), 0x801BF8AC:("sMagicBorderRatio","UNK_TYPE2","",0x2), 0x801BF8B0:("sMagicBorderStep","UNK_TYPE2","",0x2), - 0x801BF8DC:("D_801BF8DC","UNK_TYPE2","",0x2), - 0x801BF8E0:("D_801BF8E0","UNK_TYPE2","",0x2), - 0x801BF8E4:("D_801BF8E4","UNK_TYPE2","",0x2), - 0x801BF8E8:("D_801BF8E8","UNK_TYPE4","",0x4), - 0x801BF8F0:("D_801BF8F0","u64","",0x8), + 0x801BF8DC:("sEnvTimerType","UNK_TYPE2","",0x2), + 0x801BF8E0:("sEnvTimerActive","UNK_TYPE2","",0x2), + 0x801BF8E4:("sPostmanBunnyHoodState","UNK_TYPE2","",0x2), + 0x801BF8E8:("sTimerPausedOsTime","UNK_TYPE4","",0x4), + 0x801BF8F0:("sBottleTimerPausedOsTime","u64","",0x8), 0x801BF8F8:("D_801BF8F8","u64","[7]",0x38), 0x801BF930:("D_801BF930","u64","[7]",0x38), - 0x801BF968:("D_801BF968","UNK_TYPE4","",0x4), - 0x801BF96C:("D_801BF96C","UNK_TYPE4","",0x4), - 0x801BF970:("D_801BF970","UNK_TYPE4","",0x4), + 0x801BF968:("sIsTimerPaused","UNK_TYPE4","",0x4), + 0x801BF96C:("sIsBottleTimerPaused","UNK_TYPE4","",0x4), + 0x801BF970:("sTimerId","UNK_TYPE4","",0x4), 0x801BF974:("D_801BF974","UNK_TYPE4","",0x4), 0x801BF978:("D_801BF978","UNK_TYPE4","",0x4), 0x801BF97C:("D_801BF97C","UNK_TYPE4","",0x4), @@ -1113,7 +1113,7 @@ 0x801BFA4C:("D_801BFA4C","UNK_TYPE2","",0x2), 0x801BFA64:("D_801BFA64","UNK_TYPE2","",0x2), 0x801BFA74:("D_801BFA74","UNK_TYPE2","",0x2), - 0x801BFA84:("D_801BFA84","UNK_TYPE4","",0x4), + 0x801BFA84:("sPostmanTimerInputBtnAPressed","UNK_TYPE4","",0x4), 0x801BFAB0:("sDoActionTextures","UNK_TYPE1","",0x1), 0x801BFAB8:("magicBorderColors","UNK_TYPE1","",0x1), 0x801BFAC4:("magicBorderIndices","UNK_TYPE1","",0x1), @@ -1161,9 +1161,9 @@ 0x801BFCA8:("D_801BFCA8","UNK_TYPE2","",0x2), 0x801BFCB8:("D_801BFCB8","UNK_TYPE1","",0x1), 0x801BFCC4:("D_801BFCC4","UNK_TYPE4","",0x4), - 0x801BFCE4:("D_801BFCE4","UNK_TYPE4","",0x4), - 0x801BFCE8:("D_801BFCE8","u16","[8]",0x10), - 0x801BFCF8:("D_801BFCF8","UNK_TYPE4","",0x4), + 0x801BFCE4:("sTimerStateTimer","UNK_TYPE4","",0x4), + 0x801BFCE8:("sTimerDigits","u16","[8]",0x10), + 0x801BFCF8:("sTimerBeepSfxSeconds","UNK_TYPE4","",0x4), 0x801BFCFC:("D_801BFCFC","UNK_TYPE4","",0x4), 0x801BFD0C:("D_801BFD0C","UNK_TYPE4","",0x4), 0x801BFD1C:("D_801BFD1C","UNK_TYPE1","",0x1), @@ -1342,8 +1342,8 @@ 0x801C1E6C:("gItemIcons","UNK_PTR","[131]",0x20C), 0x801C2078:("gItemSlots","u8","[80]",0x50), 0x801C20C8:("gItemPrices","UNK_TYPE1","",0x1), - 0x801C212C:("gScenesPerRegion","SceneIdList","[]",0x252), - 0x801C2380:("sScenesPerTingleMap","u16","[]",0x90), + 0x801C212C:("gSceneIdsPerRegion","SceneIdList","[]",0x252), + 0x801C2380:("sSceneIdsPerTingleMap","u16","[]",0x90), 0x801C2410:("D_801C2410","UNK_TYPE1","",0x1), 0x801C2650:("tatlMessageFiles","RomFile","[2]",0x10), 0x801C2660:("sceneTextureFiles","RomFile","[9]",0x48), @@ -4002,7 +4002,7 @@ 0x801F57B4:("D_801F57B4","UNK_TYPE1","",0x1), 0x801F5834:("D_801F5834","UNK_TYPE1","",0x1), 0x801F5840:("gNMIBuffer","s32*","",0x4), - 0x801F5850:("D_801F5850","UNK_TYPE1","",0x1), + 0x801F5850:("sPostmanTimerInput","UNK_TYPE1","",0x1), 0x801F58B0:("D_801F58B0","UNK_TYPE1","",0x1), 0x801F59AC:("D_801F59AC","UNK_TYPE1","",0x1), 0x801F59B0:("D_801F59B0","UNK_TYPE1","",0x1), @@ -4693,16 +4693,16 @@ 0x8082B388:("sRowFirstSections","UNK_TYPE2","",0x2), 0x8082B3AC:("sPrevDBtnInput","UNK_TYPE4","",0x4), 0x8082B3B0:("sHeldDBtnTimer","UNK_TYPE4","",0x4), - 0x8082B3C0:("D_8082B3C0","UNK_TYPE2","",0x2), - 0x8082B3C4:("D_8082B3C4","UNK_TYPE2","",0x2), - 0x8082B3C8:("D_8082B3C8","UNK_TYPE2","",0x2), - 0x8082B3CC:("D_8082B3CC","UNK_TYPE1","",0x1), - 0x8082B444:("D_8082B444","UNK_TYPE1","",0x1), - 0x8082B454:("D_8082B454","UNK_TYPE1","",0x1), - 0x8082B47C:("D_8082B47C","UNK_TYPE1","",0x1), - 0x8082B484:("D_8082B484","UNK_TYPE1","",0x1), - 0x8082B48C:("D_8082B48C","UNK_TYPE1","",0x1), - 0x8082B494:("D_8082B494","UNK_TYPE2","",0x2), + 0x8082B3C0:("sEquipState","UNK_TYPE2","",0x2), + 0x8082B3C4:("sEquipMagicArrowSlotHoldTimer","UNK_TYPE2","",0x2), + 0x8082B3C8:("sEquipAnimTimer","UNK_TYPE2","",0x2), + 0x8082B3CC:("gPlayerFormSlotRestrictions","UNK_TYPE1","",0x1), + 0x8082B444:("sAmmoRectLeft","UNK_TYPE1","",0x1), + 0x8082B454:("sAmmoRectHeight","UNK_TYPE1","",0x1), + 0x8082B47C:("sPlayerFormItems","UNK_TYPE1","",0x1), + 0x8082B484:("sCButtonPosX","UNK_TYPE1","",0x1), + 0x8082B48C:("sCButtonPosY","UNK_TYPE1","",0x1), + 0x8082B494:("sEquipMagicArrowBowSlotHoldTimer","UNK_TYPE2","",0x2), 0x8082B4A0:("D_8082B4A0","UNK_TYPE4","",0x4), 0x8082B4AC:("D_8082B4AC","UNK_TYPE1","",0x1), 0x8082B4BC:("D_8082B4BC","UNK_TYPE1","",0x1), @@ -9525,20 +9525,20 @@ 0x809A61E0:("D_809A61E0","f32","",0x4), 0x809A61E4:("D_809A61E4","f32","",0x4), 0x809A61E8:("D_809A61E8","f32","",0x4), - 0x809A8C80:("D_809A8C80","UNK_TYPE4","",0x4), - 0x809A8C94:("D_809A8C94","UNK_TYPE1","",0x1), - 0x809A8CAC:("D_809A8CAC","UNK_TYPE1","",0x1), - 0x809A8CC4:("D_809A8CC4","UNK_TYPE1","",0x1), - 0x809A8CDC:("D_809A8CDC","UNK_TYPE1","",0x1), + 0x809A8C80:("sOccupiedIndices","UNK_TYPE4","",0x4), + 0x809A8C94:("sLimbIndexToShadowBodyPartsIndex","UNK_TYPE1","",0x1), + 0x809A8CAC:("sParentBodyParts","UNK_TYPE1","",0x1), + 0x809A8CC4:("sShadowSizes","UNK_TYPE1","",0x1), + 0x809A8CDC:("sDamageTable","UNK_TYPE1","",0x1), 0x809A8CFC:("En_Grasshopper_InitVars","UNK_TYPE1","",0x1), - 0x809A8D1C:("D_809A8D1C","UNK_TYPE1","",0x1), - 0x809A8D64:("D_809A8D64","UNK_TYPE1","",0x1), - 0x809A8D74:("D_809A8D74","UNK_TYPE1","",0x1), - 0x809A8D94:("D_809A8D94","UNK_TYPE1","",0x1), - 0x809A8D9C:("D_809A8D9C","UNK_TYPE4","",0x4), - 0x809A8E08:("D_809A8E08","UNK_TYPE4","",0x4), - 0x809A8E14:("D_809A8E14","UNK_TYPE4","",0x4), - 0x809A8E20:("D_809A8E20","UNK_TYPE1","",0x1), + 0x809A8D1C:("sJntSphElementsInit","UNK_TYPE1","",0x1), + 0x809A8D64:("sJntSphInit","UNK_TYPE1","",0x1), + 0x809A8D74:("sAnimations","UNK_TYPE1","",0x1), + 0x809A8D94:("sAnimationModes","UNK_TYPE1","",0x1), + 0x809A8D9C:("sFireVelocityAndAccel","UNK_TYPE4","",0x4), + 0x809A8E08:("sEffectOffsetFromTailTop","UNK_TYPE4","",0x4), + 0x809A8E14:("sZeroVec3f","UNK_TYPE4","",0x4), + 0x809A8E20:("sLightningTextures","UNK_TYPE1","",0x1), 0x809A8E40:("D_809A8E40","f32","",0x4), 0x809A8E44:("D_809A8E44","f32","",0x4), 0x809A8E48:("D_809A8E48","f32","",0x4), @@ -9920,7 +9920,7 @@ 0x809C9464:("sSwampTargetActorLists","UNK_PTR","",0x4), 0x809C946C:("sSwampTargetActorListLengths","UNK_TYPE1","",0x1), 0x809C9474:("sSwampPlayerPos","UNK_TYPE4","",0x4), - 0x809C9480:("sTownFierceDietyPlayerPos","UNK_TYPE4","",0x4), + 0x809C9480:("sTownFierceDeityPlayerPos","UNK_TYPE4","",0x4), 0x809C948C:("sTownPlayerPos","UNK_TYPE4","",0x4), 0x809C9498:("sGameStartTimer","s16","",0x2), 0x809C949C:("sHasSpawnedGuaysForThisWave","UNK_TYPE2","",0x2), @@ -9945,15 +9945,15 @@ 0x809CA31C:("D_809CA31C","UNK_TYPE1","",0x1), 0x809CA320:("D_809CA320","f32","",0x4), 0x809CA324:("D_809CA324","f32","",0x4), - 0x809CB050:("D_809CB050","UNK_TYPE1","",0x1), + 0x809CB050:("sZeroVec","UNK_TYPE1","",0x1), 0x809CB05C:("En_Syateki_Crow_InitVars","UNK_TYPE1","",0x1), 0x809CB07C:("D_809CB07C","UNK_TYPE1","",0x1), 0x809CB0A0:("D_809CB0A0","UNK_TYPE1","",0x1), 0x809CB0AC:("D_809CB0AC","UNK_PTR","",0x4), 0x809CB0B0:("D_809CB0B0","UNK_TYPE1","",0x1), - 0x809CB0C0:("D_809CB0C0","UNK_TYPE1","",0x1), - 0x809CB0CC:("D_809CB0CC","UNK_TYPE1","",0x1), - 0x809CB0D8:("D_809CB0D8","UNK_TYPE1","",0x1), + 0x809CB0C0:("sVelocity","UNK_TYPE1","",0x1), + 0x809CB0CC:("sAccel","UNK_TYPE1","",0x1), + 0x809CB0D8:("sBodyOffset","UNK_TYPE1","",0x1), 0x809CB0F0:("D_809CB0F0","f32","",0x4), 0x809CB0F4:("D_809CB0F4","f32","",0x4), 0x809CB0F8:("D_809CB0F8","f32","",0x4), @@ -15606,7 +15606,7 @@ 0x80BBC6F0:("D_80BBC6F0","UNK_TYPE1","",0x1), 0x80BBC71C:("D_80BBC71C","UNK_TYPE1","",0x1), 0x80BBC750:("D_80BBC750","UNK_TYPE1","",0x1), - 0x80BBC75C:("D_80BBC75C","UNK_TYPE1","",0x1), + 0x80BBC75C:("sEyeTextures","UNK_TYPE1","",0x1), 0x80BBC770:("D_80BBC770","f32","",0x4), 0x80BBC774:("jtbl_80BBC774","UNK_PTR","",0x4), 0x80BBF800:("En_S_Goro_InitVars","ActorInit","",0x20), diff --git a/tools/extract_baserom.py b/tools/extract_baserom.py index bf9829bcb3..03d230e80a 100755 --- a/tools/extract_baserom.py +++ b/tools/extract_baserom.py @@ -892,7 +892,7 @@ FILE_NAMES = [ 'object_fall', 'object_hanareyama_obj', 'object_crace_object', - 'object_dnq', + 'object_dno', 'object_obj_tokeidai', 'object_eg', 'object_tru', @@ -963,7 +963,7 @@ FILE_NAMES = [ 'object_maruta', 'object_ghaka', 'object_oyu', - 'object_dnp', + 'object_dnq', 'object_dai', 'object_kgy', 'object_fb', @@ -984,7 +984,7 @@ FILE_NAMES = [ 'object_gi_seahorse', 'object_bigpo', 'object_hariko', - 'object_dno', + 'object_dnj', 'object_sinkai_kabe', 'object_kin2_obj', 'object_ishi', diff --git a/tools/filelists/mm.us.rev1/all.csv b/tools/filelists/mm.us.rev1/all.csv index b76d241e19..c23622330c 100644 --- a/tools/filelists/mm.us.rev1/all.csv +++ b/tools/filelists/mm.us.rev1/all.csv @@ -883,7 +883,7 @@ 882,object_fall 883,object_hanareyama_obj 884,object_crace_object -885,object_dnq +885,object_dno 886,object_obj_tokeidai 887,object_eg 888,object_tru @@ -954,7 +954,7 @@ 953,object_maruta 954,object_ghaka 955,object_oyu -956,object_dnp +956,object_dnq 957,object_dai 958,object_kgy 959,object_fb @@ -975,7 +975,7 @@ 974,object_gi_seahorse 975,object_bigpo 976,object_hariko -977,object_dno +977,object_dnj 978,object_sinkai_kabe 979,object_kin2_obj 980,object_ishi diff --git a/tools/filelists/mm.us.rev1/objects.csv b/tools/filelists/mm.us.rev1/objects.csv index 187ec1c11a..2e572503ef 100644 --- a/tools/filelists/mm.us.rev1/objects.csv +++ b/tools/filelists/mm.us.rev1/objects.csv @@ -233,7 +233,7 @@ 882,object_fall 883,object_hanareyama_obj 884,object_crace_object -885,object_dnq +885,object_dno 886,object_obj_tokeidai 887,object_eg 888,object_tru @@ -304,7 +304,7 @@ 953,object_maruta 954,object_ghaka 955,object_oyu -956,object_dnp +956,object_dnq 957,object_dai 958,object_kgy 959,object_fb @@ -325,7 +325,7 @@ 974,object_gi_seahorse 975,object_bigpo 976,object_hariko -977,object_dno +977,object_dnj 978,object_sinkai_kabe 979,object_kin2_obj 980,object_ishi diff --git a/tools/namefixer.py b/tools/namefixer.py index af17edc3c7..eab13f0b95 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -483,6 +483,10 @@ wordReplace = { "func_80169E6C": "Play_SetupRespawnPoint", "func_8016A0AC": "Play_IsUnderwater", "func_801690CC": "Play_InCsMode", + "func_8010E9F0": "Interface_StartTimer", + "func_8010EA9C": "Interface_StartPostmanTimer", + "func_80121F94": "Interface_Destroy", + "Interface_ChangeAlpha": "Interface_SetHudVisibility", "func_80112B40": "Interface_LoadItemIconImpl", "func_80112BE4": "Interface_LoadItemIcon", "func_80114978": "Item_CheckObtainability", @@ -644,6 +648,11 @@ wordReplace = { "actor.yDistToWater": "actor.depthInWater", "actor.yDistToPlayer": "actor.playerHeightRel", + "gSaveContext.unk_3F1E": "gSaveContext.hudVisibilityForceButtonAlphasByStatus", + "gSaveContext.unk_3F20": "gSaveContext.nextHudVisibility", + "gSaveContext.unk_3F22": "gSaveContext.hudVisibility", + "gSaveContext.unk_3F24": "gSaveContext.hudVisibilityTimer", + "gSaveContext.unk_3F26": "gSaveContext.prevHudVisibility", "gSaveContext.weekEventReg": "gSaveContext.save.weekEventReg", "gSaveContext.playerForm": "gSaveContext.save.playerForm", "gSaveContext.day": "gSaveContext.save.day", @@ -691,6 +700,7 @@ wordReplace = { "player->unk_394": "player->csMode", "player->swordQuads": "player->meleeWeaponQuads", "player->blureEffectIndex": "player->meleeWeaponEffectIndex", + "player->unk_AD8": "player->underwaterTimer", "player->swordAnimation": "player->meleeWeaponAnimation", "player->swordState": "player->meleeWeaponState", "player->swordInfo": "player->meleeWeaponInfo", @@ -719,6 +729,16 @@ wordReplace = { "play->actorCtx.unk3": "play->actorCtx.lensActive", "play->actorCtx.unk4": "play->actorCtx.lensMaskSize", "play->nextEntranceIndex": "play->nextEntrance", + "play->sceneNum": "play->sceneId", + + "gSaveContext.unk_3DC8": "gSaveContext.timerOsTime", + "gSaveContext.unk_3DD0": "gSaveContext.timerStates", + "gSaveContext.unk_3DD7": "gSaveContext.timerDirections", + "gSaveContext.unk_3DE0": "gSaveContext.timerCurTimes", + "gSaveContext.unk_3E18": "gSaveContext.timerTimeLimits", + "gSaveContext.unk_3E50": "gSaveContext.timerStartOsTimes", + "gSaveContext.unk_3E88": "gSaveContext.timerStopTimes", + "gSaveContext.unk_3EC0": "gSaveContext.timerPausedOsTimes", "play->sceneLoadFlag": "play->transitionTrigger", "play->unk_18B4A": "play->transitionMode", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index ac48760a54..7ed67b5c40 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1607,17 +1607,17 @@ asm/non_matchings/code/z_parameter/func_8010D9F4.s,func_8010D9F4,0x8010D9F4,0x99 asm/non_matchings/code/z_parameter/func_8010DC58.s,func_8010DC58,0x8010DC58,0x78 asm/non_matchings/code/z_parameter/func_8010DE38.s,func_8010DE38,0x8010DE38,0x7C asm/non_matchings/code/z_parameter/func_8010E028.s,func_8010E028,0x8010E028,0x250 -asm/non_matchings/code/z_parameter/func_8010E968.s,func_8010E968,0x8010E968,0x22 -asm/non_matchings/code/z_parameter/func_8010E9F0.s,func_8010E9F0,0x8010E9F0,0x2B -asm/non_matchings/code/z_parameter/func_8010EA9C.s,func_8010EA9C,0x8010EA9C,0x2D -asm/non_matchings/code/z_parameter/func_8010EB50.s,func_8010EB50,0x8010EB50,0x14 -asm/non_matchings/code/z_parameter/func_8010EBA0.s,func_8010EBA0,0x8010EBA0,0x2D -asm/non_matchings/code/z_parameter/func_8010EC54.s,func_8010EC54,0x8010EC54,0x88 +asm/non_matchings/code/z_parameter/Interface_PostmanTimerCallback.s,Interface_PostmanTimerCallback,0x8010E968,0x22 +asm/non_matchings/code/z_parameter/Interface_StartTimer.s,Interface_StartTimer,0x8010E9F0,0x2B +asm/non_matchings/code/z_parameter/Interface_StartPostmanTimer.s,Interface_StartPostmanTimer,0x8010EA9C,0x2D +asm/non_matchings/code/z_parameter/Interface_StartGoronRaceTimer.s,Interface_StartGoronRaceTimer,0x8010EB50,0x14 +asm/non_matchings/code/z_parameter/Interface_StartBottleTimer.s,Interface_StartBottleTimer,0x8010EBA0,0x2D +asm/non_matchings/code/z_parameter/Interface_GetCompressedTimerDigits.s,Interface_GetCompressedTimerDigits,0x8010EC54,0x88 asm/non_matchings/code/z_parameter/func_8010EE74.s,func_8010EE74,0x8010EE74,0x3D -asm/non_matchings/code/z_parameter/Interface_ChangeAlpha.s,Interface_ChangeAlpha,0x8010EF68,0xD -asm/non_matchings/code/z_parameter/func_8010EF9C.s,func_8010EF9C,0x8010EF9C,0x4E -asm/non_matchings/code/z_parameter/func_8010F0D4.s,func_8010F0D4,0x8010F0D4,0x35 -asm/non_matchings/code/z_parameter/func_8010F1A8.s,func_8010F1A8,0x8010F1A8,0x3A4 +asm/non_matchings/code/z_parameter/Interface_SetHudVisibility.s,Interface_SetHudVisibility,0x8010EF68,0xD +asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphasByStatus.s,Interface_UpdateButtonAlphasByStatus,0x8010EF9C,0x4E +asm/non_matchings/code/z_parameter/Interface_UpdateButtonAlphas.s,Interface_UpdateButtonAlphas,0x8010F0D4,0x35 +asm/non_matchings/code/z_parameter/Interface_UpdateHudAlphas.s,Interface_UpdateHudAlphas,0x8010F1A8,0x3A4 asm/non_matchings/code/z_parameter/func_80110038.s,func_80110038,0x80110038,0x71F asm/non_matchings/code/z_parameter/func_80111CB4.s,func_80111CB4,0x80111CB4,0x34C asm/non_matchings/code/z_parameter/func_801129E4.s,func_801129E4,0x801129E4,0x44 @@ -1670,16 +1670,16 @@ asm/non_matchings/code/z_parameter/func_8011B5C0.s,func_8011B5C0,0x8011B5C0,0x10 asm/non_matchings/code/z_parameter/func_8011B9E0.s,func_8011B9E0,0x8011B9E0,0x164 asm/non_matchings/code/z_parameter/func_8011BF70.s,func_8011BF70,0x8011BF70,0x155 asm/non_matchings/code/z_parameter/func_8011C4C4.s,func_8011C4C4,0x8011C4C4,0xD1 -asm/non_matchings/code/z_parameter/func_8011C808.s,func_8011C808,0x8011C808,0x24 -asm/non_matchings/code/z_parameter/func_8011C898.s,func_8011C898,0x8011C898,0x73 -asm/non_matchings/code/z_parameter/func_8011CA64.s,func_8011CA64,0x8011CA64,0x654 -asm/non_matchings/code/z_parameter/func_8011E3B4.s,func_8011E3B4,0x8011E3B4,0xDF +asm/non_matchings/code/z_parameter/Interface_StartMoonCrash.s,Interface_StartMoonCrash,0x8011C808,0x24 +asm/non_matchings/code/z_parameter/Interface_GetTimerDigits.s,Interface_GetTimerDigits,0x8011C898,0x73 +asm/non_matchings/code/z_parameter/Interface_DrawTimers.s,Interface_DrawTimers,0x8011CA64,0x654 +asm/non_matchings/code/z_parameter/Interface_UpdateBottleTimers.s,Interface_UpdateBottleTimers,0x8011E3B4,0xDF asm/non_matchings/code/z_parameter/func_8011E730.s,func_8011E730,0x8011E730,0x26C asm/non_matchings/code/z_parameter/Interface_Draw.s,Interface_Draw,0x8011F0E0,0x7AC asm/non_matchings/code/z_parameter/func_80120F90.s,func_80120F90,0x80120F90,0x35 asm/non_matchings/code/z_parameter/func_80121064.s,func_80121064,0x80121064,0x1F asm/non_matchings/code/z_parameter/Interface_Update.s,Interface_Update,0x801210E0,0x3AD -asm/non_matchings/code/z_parameter/func_80121F94.s,func_80121F94,0x80121F94,0xC +asm/non_matchings/code/z_parameter/Interface_Destroy.s,Interface_Destroy,0x80121F94,0xC asm/non_matchings/code/z_parameter/func_80121FC4.s,func_80121FC4,0x80121FC4,0x147 asm/non_matchings/code/z_path/func_801224E0.s,func_801224E0,0x801224E0,0x11 asm/non_matchings/code/z_path/func_80122524.s,func_80122524,0x80122524,0x2A @@ -1746,7 +1746,7 @@ asm/non_matchings/code/z_player_lib/Player_ActionToExplosive.s,Player_ActionToEx asm/non_matchings/code/z_player_lib/Player_GetExplosiveHeld.s,Player_GetExplosiveHeld,0x80124258,0x8 asm/non_matchings/code/z_player_lib/func_80124278.s,func_80124278,0x80124278,0xF asm/non_matchings/code/z_player_lib/func_801242B4.s,func_801242B4,0x801242B4,0xA -asm/non_matchings/code/z_player_lib/func_801242DC.s,func_801242DC,0x801242DC,0x51 +asm/non_matchings/code/z_player_lib/Player_GetEnvTimerType.s,Player_GetEnvTimerType,0x801242DC,0x51 asm/non_matchings/code/z_player_lib/func_80124420.s,func_80124420,0x80124420,0x7E asm/non_matchings/code/z_player_lib/func_80124618.s,func_80124618,0x80124618,0x37 asm/non_matchings/code/z_player_lib/func_801246F4.s,func_801246F4,0x801246F4,0x5F @@ -2009,8 +2009,8 @@ asm/non_matchings/code/z_scene_proc/Scene_DrawConfig5.s,Scene_DrawConfig5,0x8013 asm/non_matchings/code/z_scene_proc/Scene_DrawConfigMatAnimManualStep.s,Scene_DrawConfigMatAnimManualStep,0x80131F90,0xC asm/non_matchings/code/z_scene_proc/Scene_DrawConfigGreatBayTemple.s,Scene_DrawConfigGreatBayTemple,0x80131FC0,0xC0 asm/non_matchings/code/z_scene_table/Entrance_GetTableEntry.s,Entrance_GetTableEntry,0x801322C0,0x13 -asm/non_matchings/code/z_scene_table/Entrance_GetSceneNum.s,Entrance_GetSceneNum,0x8013230C,0xB -asm/non_matchings/code/z_scene_table/Entrance_GetSceneNumAbsolute.s,Entrance_GetSceneNumAbsolute,0x80132338,0xF +asm/non_matchings/code/z_scene_table/Entrance_GetSceneId.s,Entrance_GetSceneId,0x8013230C,0xB +asm/non_matchings/code/z_scene_table/Entrance_GetSceneIdAbsolute.s,Entrance_GetSceneIdAbsolute,0x80132338,0xF asm/non_matchings/code/z_scene_table/Entrance_GetSpawnNum.s,Entrance_GetSpawnNum,0x80132374,0xB asm/non_matchings/code/z_scene_table/Entrance_GetTransitionFlags.s,Entrance_GetTransitionFlags,0x801323A0,0xC asm/non_matchings/code/code_801323D0/func_801323D0.s,func_801323D0,0x801323D0,0x16 @@ -2538,7 +2538,7 @@ asm/non_matchings/code/z_play/Play_GetCameraUID.s,Play_GetCameraUID,0x80169BC4,0 asm/non_matchings/code/z_play/func_80169BF8.s,func_80169BF8,0x80169BF8,0x1B asm/non_matchings/code/z_play/Play_GetActorCsCamSetting.s,Play_GetActorCsCamSetting,0x80169C64,0x8 asm/non_matchings/code/z_play/Play_GetActorCsCamFuncData.s,Play_GetActorCsCamFuncData,0x80169C84,0xE -asm/non_matchings/code/z_play/Play_GetOriginalSceneNumber.s,Play_GetOriginalSceneNumber,0x80169CBC,0x21 +asm/non_matchings/code/z_play/Play_GetOriginalSceneId.s,Play_GetOriginalSceneId,0x80169CBC,0x21 asm/non_matchings/code/z_play/Play_SaveCycleSceneFlags.s,Play_SaveCycleSceneFlags,0x80169D40,0x23 asm/non_matchings/code/z_play/Play_SetRespawnData.s,Play_SetRespawnData,0x80169DCC,0x28 asm/non_matchings/code/z_play/Play_SetupRespawnPoint.s,Play_SetupRespawnPoint,0x80169E6C,0x18 diff --git a/undefined_syms.txt b/undefined_syms.txt index 5cb5cdf0b6..aae06790f4 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1069,11 +1069,6 @@ D_0600A344 = 0x0600A344; D_06001EFC = 0x06001EFC; D_0600A808 = 0x0600A808; -// ovl_En_Grasshopper - -D_06000F9C = 0x06000F9C; -D_06003F00 = 0x06003F00; - // ovl_En_Hgo D_0600B644 = 0x0600B644; @@ -1228,10 +1223,6 @@ D_06008C40 = 0x06008C40; D_060001E4 = 0x060001E4; D_06001EE8 = 0x06001EE8; -// ovl_En_Nimotsu - -D_06013380 = 0x06013380; - // ovl_En_Nwc D_060000E8 = 0x060000E8;