From ff8082e13300e06726d38d4de78098634ac50102 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 May 2024 12:56:46 -0700 Subject: [PATCH 1/9] initial commit of relevant files --- mm/2s2h/BenGui/BenMenuBar.cpp | 7 +++++++ mm/2s2h/Enhancements/Enhancements.cpp | 1 + mm/2s2h/Enhancements/Enhancements.h | 1 + .../Enhancements/GameInteractor/GameInteractor.h | 1 + mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp | 14 ++++++++++++++ mm/2s2h/Enhancements/Songs/ZoraEggCount.h | 6 ++++++ mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c | 9 ++++++++- .../overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c | 9 +++++++++ 8 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp create mode 100644 mm/2s2h/Enhancements/Songs/ZoraEggCount.h diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp index 1807a9a56f..3e24d5b4f6 100644 --- a/mm/2s2h/BenGui/BenMenuBar.cpp +++ b/mm/2s2h/BenGui/BenMenuBar.cpp @@ -578,6 +578,13 @@ void DrawEnhancementsMenu() { ImGui::EndMenu(); } + if (UIWidgets::BeginMenu("Songs/Playback")) { + UIWidgets::CVarSliderInt("Zora Eggs For Bossa Nova", "gEnhancements.Songs.ZoraEggCount", 1, 7, 7, + { .tooltip = "The number of eggs required to unlock new wave bossa nova." }); + + ImGui::EndMenu(); + } + if (mHudEditorWindow) { UIWidgets::WindowButton("Hud Editor", "gWindows.HudEditor", mHudEditorWindow, { .tooltip = "Enables the Hud Editor window, allowing you to edit your hud" }); diff --git a/mm/2s2h/Enhancements/Enhancements.cpp b/mm/2s2h/Enhancements/Enhancements.cpp index c71ab37af6..5e40c876a5 100644 --- a/mm/2s2h/Enhancements/Enhancements.cpp +++ b/mm/2s2h/Enhancements/Enhancements.cpp @@ -30,6 +30,7 @@ void InitEnhancements() { // Songs RegisterEnableSunsSong(); + RegisterZoraEggCount(); // Restorations RegisterPowerCrouchStab(); diff --git a/mm/2s2h/Enhancements/Enhancements.h b/mm/2s2h/Enhancements/Enhancements.h index 3a6a303b6f..7fbd4fe8b9 100644 --- a/mm/2s2h/Enhancements/Enhancements.h +++ b/mm/2s2h/Enhancements/Enhancements.h @@ -22,6 +22,7 @@ #include "Graphics/PlayAsKafei.h" #include "PlayerMovement/ClimbSpeed.h" #include "Songs/EnableSunsSong.h" +#include "Songs/ZoraEggCount.h" #include "Saving/SavingEnhancements.h" enum AlwaysWinDoggyRaceOptions { diff --git a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h index 8359f3003a..767192ea60 100644 --- a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h +++ b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h @@ -51,6 +51,7 @@ typedef enum { GI_VB_TATL_INTERUPT_MSG6, GI_VB_ITEM_BE_RESTRICTED, GI_VB_FLIP_HOP_VARIABLE, + GI_VB_SET_ZORA_EGG_COUNT, } GIVanillaBehavior; typedef enum { diff --git a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp new file mode 100644 index 0000000000..3e6d4cbb24 --- /dev/null +++ b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp @@ -0,0 +1,14 @@ +#include "ZoraEggCount.h" +#include +#include "Enhancements/GameInteractor/GameInteractor.h" + +void RegisterZoraEggCount() { + REGISTER_VB_SHOULD(GI_VB_SET_ZORA_EGG_COUNT, { + if (CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7) > 7 || + CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7) < 1) { + CVarSetInteger("gEnhancements.Songs.ZoraEggCount", 7); + } + s32* count = static_cast(opt); + *count = CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7); + }); +} \ No newline at end of file diff --git a/mm/2s2h/Enhancements/Songs/ZoraEggCount.h b/mm/2s2h/Enhancements/Songs/ZoraEggCount.h new file mode 100644 index 0000000000..35ac5ed604 --- /dev/null +++ b/mm/2s2h/Enhancements/Songs/ZoraEggCount.h @@ -0,0 +1,6 @@ +#ifndef VARIABLE_ZORA_EGG_COUNT_H +#define VARIABLE_ZORA_EGG_COUNT_H + +void RegisterZoraEggCount(); + +#endif // VARIABLE_ZORA_EGG_COUNT_H \ No newline at end of file diff --git a/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c index d24396dc89..c2da3d2ffb 100644 --- a/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -6,6 +6,8 @@ #include "z_en_mk.h" +#include "2s2h/Enhancements/GameInteractor/GameInteractor.h" + #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnMk*)thisx) @@ -120,7 +122,12 @@ void EnMk_Destroy(Actor* thisx, PlayState* play) { } s32 func_80959524(PlayState* play) { - return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7; + s32 eggcount; + if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount)) { + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 + (7 - eggcount) & 7; + } else { + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7; + } } void func_8095954C(EnMk* this, PlayState* play) { diff --git a/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index ac50731cae..65228fd81f 100644 --- a/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -7,6 +7,8 @@ #include "z_en_zoraegg.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "2s2h/Enhancements/GameInteractor/GameInteractor.h" + #define FLAGS (ACTOR_FLAG_10) #define THIS ((EnZoraegg*)thisx) @@ -400,6 +402,7 @@ void func_80B322BC(EnZoraegg* this, PlayState* play) { void func_80B32390(EnZoraegg* this, PlayState* play) { s32 pad; + s32 eggcount; Player* player = GET_PLAYER(play); if (CutsceneManager_IsNext(this->actor.csId)) { @@ -410,6 +413,12 @@ void func_80B32390(EnZoraegg* this, PlayState* play) { SET_EVENTINF(EVENTINF_33); Actor_Kill(&this->actor); } + } else if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount) && + (func_80B319A8(play) >= eggcount) && + (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && + (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) && + (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 30.0f)) { + CutsceneManager_Queue(this->actor.csId); } else if ((func_80B319A8(play) >= 7) && (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) && From dcb2ccc76b1a5d757d45e02f8941e4148f8cd99d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 May 2024 13:49:13 -0700 Subject: [PATCH 2/9] attempt to appease clang formatting --- mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index 65228fd81f..b380c4153d 100644 --- a/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -413,8 +413,7 @@ void func_80B32390(EnZoraegg* this, PlayState* play) { SET_EVENTINF(EVENTINF_33); Actor_Kill(&this->actor); } - } else if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount) && - (func_80B319A8(play) >= eggcount) && + } else if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount) && (func_80B319A8(play) >= eggcount) && (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 30.0f)) { From 57d6e2125204a0b606e34c66195b2c964dde3dc0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 31 May 2024 17:04:30 -0700 Subject: [PATCH 3/9] fix edge case of marine researcher dialogue being wrong with low egg counts --- mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp index 3e6d4cbb24..96ab3c7a6e 100644 --- a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp +++ b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp @@ -1,6 +1,7 @@ #include "ZoraEggCount.h" #include #include "Enhancements/GameInteractor/GameInteractor.h" +#include "global.h" void RegisterZoraEggCount() { REGISTER_VB_SHOULD(GI_VB_SET_ZORA_EGG_COUNT, { @@ -9,6 +10,11 @@ void RegisterZoraEggCount() { CVarSetInteger("gEnhancements.Songs.ZoraEggCount", 7); } s32* count = static_cast(opt); - *count = CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7); + // Ignore variable count if you have no eggs, fixes dialogue with marine researcher. + if ((gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_LABO].unk_14 & 7) <= 0) { + *count = 7; + } else { + *count = CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7); + } }); } \ No newline at end of file From 4ded1c7ff774c790fd5300b2796b130d5d237e76 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Jun 2024 19:26:58 -0700 Subject: [PATCH 4/9] refactored to better use hooks and no longer touch main mm code directly --- .../GameInteractor/GameInteractor.h | 14 +++- mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp | 83 ++++++++++++++++--- mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c | 9 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 8 -- 4 files changed, 85 insertions(+), 29 deletions(-) diff --git a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h index 767192ea60..fe10c1f29b 100644 --- a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h +++ b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h @@ -7,6 +7,7 @@ extern "C" { #endif #include "z64actor.h" #include "z64camera.h" +#include "z64.h" #ifdef __cplusplus } #endif @@ -51,7 +52,8 @@ typedef enum { GI_VB_TATL_INTERUPT_MSG6, GI_VB_ITEM_BE_RESTRICTED, GI_VB_FLIP_HOP_VARIABLE, - GI_VB_SET_ZORA_EGG_COUNT, + GI_VB_DISABLE_LETTERBOX, + GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE, } GIVanillaBehavior; typedef enum { @@ -59,6 +61,11 @@ typedef enum { GI_INVERT_CAMERA_RIGHT_STICK_Y, } GIInvertType; +typedef enum { + GI_DPAD_OCARINA, + GI_DPAD_EQUIP, +} GIDpadType; + #ifdef __cplusplus #include @@ -249,6 +256,7 @@ class GameInteractor { DEFINE_HOOK(OnGameStateMainFinish, ()); DEFINE_HOOK(OnGameStateDrawFinish, ()); DEFINE_HOOK(OnGameStateUpdate, ()); + DEFINE_HOOK(OnKaleidoUpdate, (PauseContext * pauseCtx)); DEFINE_HOOK(OnSaveInit, (s16 fileNum)); DEFINE_HOOK(BeforeEndOfCycleSave, ()); DEFINE_HOOK(AfterEndOfCycleSave, ()); @@ -256,6 +264,7 @@ class GameInteractor { DEFINE_HOOK(OnSceneInit, (s8 sceneId, s8 spawnNum)); DEFINE_HOOK(OnRoomInit, (s8 sceneId, s8 roomNum)); + DEFINE_HOOK(OnPlayDestroy, ()); DEFINE_HOOK(ShouldActorInit, (Actor * actor, bool* should)); DEFINE_HOOK(OnActorInit, (Actor * actor)); @@ -290,6 +299,7 @@ extern "C" { void GameInteractor_ExecuteOnGameStateMainFinish(); void GameInteractor_ExecuteOnGameStateDrawFinish(); void GameInteractor_ExecuteOnGameStateUpdate(); +void GameInteractor_ExecuteOnKaleidoUpdate(PauseContext* pauseCtx); void GameInteractor_ExecuteOnSaveInit(s16 fileNum); void GameInteractor_ExecuteBeforeEndOfCycleSave(); void GameInteractor_ExecuteAfterEndOfCycleSave(); @@ -297,6 +307,7 @@ void GameInteractor_ExecuteBeforeMoonCrashSaveReset(); void GameInteractor_ExecuteOnSceneInit(s16 sceneId, s8 spawnNum); void GameInteractor_ExecuteOnRoomInit(s16 sceneId, s8 roomNum); +void GameInteractor_ExecuteOnPlayDestroy(); bool GameInteractor_ShouldActorInit(Actor* actor); void GameInteractor_ExecuteOnActorInit(Actor* actor); @@ -328,6 +339,7 @@ bool GameInteractor_Should(GIVanillaBehavior flag, bool result, void* optionalAr flag, [](GIVanillaBehavior _, bool* should, void* opt) body) int GameInteractor_InvertControl(GIInvertType type); +uint32_t GameInteractor_Dpad(GIDpadType type, uint32_t buttonCombo); #ifdef __cplusplus } diff --git a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp index 96ab3c7a6e..f668df8d56 100644 --- a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp +++ b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp @@ -3,18 +3,77 @@ #include "Enhancements/GameInteractor/GameInteractor.h" #include "global.h" +extern "C" { +extern PlayState* gPlayState; +#include "z64.h" +#include "src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h" +#include "src/overlays/actors/ovl_En_Mk/z_en_mk.h" +} + +const uint32_t MAX_EGGS = 7; + +// every egg is active in marine lab regardless of progress, this tracks only the visible ones in tank +static uint32_t visibleEggCount = 0; + +void ResetStatics() { + visibleEggCount = 0; +} + void RegisterZoraEggCount() { - REGISTER_VB_SHOULD(GI_VB_SET_ZORA_EGG_COUNT, { - if (CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7) > 7 || - CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7) < 1) { - CVarSetInteger("gEnhancements.Songs.ZoraEggCount", 7); - } - s32* count = static_cast(opt); - // Ignore variable count if you have no eggs, fixes dialogue with marine researcher. - if ((gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_LABO].unk_14 & 7) <= 0) { - *count = 7; - } else { - *count = CVarGetInteger("gEnhancements.Songs.ZoraEggCount", 7); - } + GameInteractor::Instance->RegisterGameHook([]() { ResetStatics(); }); + GameInteractor::Instance->RegisterGameHook([]() { ResetStatics(); }); + + // zora egg object, figures out how many eggs are being drawn + GameInteractor::Instance->RegisterGameHookForID( + ACTOR_EN_ZORAEGG, [](Actor* outerActor) { + static uint32_t enEggUpdateHook = 0; + static uint32_t enEggKillHook = 0; + GameInteractor::Instance->UnregisterGameHookForPtr(enEggUpdateHook); + GameInteractor::Instance->UnregisterGameHook(enEggKillHook); + enEggUpdateHook = 0; + enEggKillHook = 0; + + EnZoraegg* enZoraEgg = (EnZoraegg*)outerActor; + if (enZoraEgg->actor.draw != nullptr && gPlayState->sceneId == SCENE_LABO) { + visibleEggCount++; + } + + enEggKillHook = + GameInteractor::Instance->RegisterGameHook([](s8 sceneId, s8 spawnNum) { + if (sceneId != SCENE_LABO) { + visibleEggCount = 0; + } + GameInteractor::Instance->UnregisterGameHook(enEggUpdateHook); + GameInteractor::Instance->UnregisterGameHook(enEggKillHook); + enEggUpdateHook = 0; + enEggKillHook = 0; + }); + }); + + // marine researcher, his actor update call is more consistent than the eggs + GameInteractor::Instance->RegisterGameHookForID(ACTOR_EN_MK, [](Actor* outerActor) { + static uint32_t enMkUpdateHook = 0; + static uint32_t enMkKillHook = 0; + GameInteractor::Instance->UnregisterGameHookForPtr(enMkUpdateHook); + GameInteractor::Instance->UnregisterGameHook(enMkKillHook); + enMkUpdateHook = 0; + enMkKillHook = 0; + + enMkUpdateHook = GameInteractor::Instance->RegisterGameHookForPtr( + (uintptr_t)outerActor, [](Actor* actor) { + // complete quest if you have enough eggs + if (gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_LABO].unk_14 != MAX_EGGS && + CVarGetInteger("gEnhancements.Songs.ZoraEggCount", MAX_EGGS) <= + gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_LABO].unk_14) { + gSaveContext.save.saveInfo.permanentSceneFlags[SCENE_LABO].unk_14 = MAX_EGGS; + } + }); + enMkKillHook = + GameInteractor::Instance->RegisterGameHook([](s8 sceneId, s8 spawnNum) { + GameInteractor::Instance->UnregisterGameHook(enMkUpdateHook); + GameInteractor::Instance->UnregisterGameHook(enMkKillHook); + enMkUpdateHook = 0; + enMkKillHook = 0; + }); }); } \ No newline at end of file diff --git a/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c index c2da3d2ffb..d24396dc89 100644 --- a/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/mm/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -6,8 +6,6 @@ #include "z_en_mk.h" -#include "2s2h/Enhancements/GameInteractor/GameInteractor.h" - #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define THIS ((EnMk*)thisx) @@ -122,12 +120,7 @@ void EnMk_Destroy(Actor* thisx, PlayState* play) { } s32 func_80959524(PlayState* play) { - s32 eggcount; - if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount)) { - return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 + (7 - eggcount) & 7; - } else { - return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7; - } + return gSaveContext.save.saveInfo.permanentSceneFlags[play->sceneId].unk_14 & 7; } void func_8095954C(EnMk* this, PlayState* play) { diff --git a/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index b380c4153d..ac50731cae 100644 --- a/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/mm/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -7,8 +7,6 @@ #include "z_en_zoraegg.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "2s2h/Enhancements/GameInteractor/GameInteractor.h" - #define FLAGS (ACTOR_FLAG_10) #define THIS ((EnZoraegg*)thisx) @@ -402,7 +400,6 @@ void func_80B322BC(EnZoraegg* this, PlayState* play) { void func_80B32390(EnZoraegg* this, PlayState* play) { s32 pad; - s32 eggcount; Player* player = GET_PLAYER(play); if (CutsceneManager_IsNext(this->actor.csId)) { @@ -413,11 +410,6 @@ void func_80B32390(EnZoraegg* this, PlayState* play) { SET_EVENTINF(EVENTINF_33); Actor_Kill(&this->actor); } - } else if (GameInteractor_Should(GI_VB_SET_ZORA_EGG_COUNT, true, &eggcount) && (func_80B319A8(play) >= eggcount) && - (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && - (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) && - (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 30.0f)) { - CutsceneManager_Queue(this->actor.csId); } else if ((func_80B319A8(play) >= 7) && (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && (fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z)) && From fc434083041195b61fcfd336e54b112d7ab0da24 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Jun 2024 13:06:25 -0700 Subject: [PATCH 5/9] undo GameInteractor.h changes --- .../Enhancements/GameInteractor/GameInteractor.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h index fe10c1f29b..8359f3003a 100644 --- a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h +++ b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h @@ -7,7 +7,6 @@ extern "C" { #endif #include "z64actor.h" #include "z64camera.h" -#include "z64.h" #ifdef __cplusplus } #endif @@ -52,8 +51,6 @@ typedef enum { GI_VB_TATL_INTERUPT_MSG6, GI_VB_ITEM_BE_RESTRICTED, GI_VB_FLIP_HOP_VARIABLE, - GI_VB_DISABLE_LETTERBOX, - GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE, } GIVanillaBehavior; typedef enum { @@ -61,11 +58,6 @@ typedef enum { GI_INVERT_CAMERA_RIGHT_STICK_Y, } GIInvertType; -typedef enum { - GI_DPAD_OCARINA, - GI_DPAD_EQUIP, -} GIDpadType; - #ifdef __cplusplus #include @@ -256,7 +248,6 @@ class GameInteractor { DEFINE_HOOK(OnGameStateMainFinish, ()); DEFINE_HOOK(OnGameStateDrawFinish, ()); DEFINE_HOOK(OnGameStateUpdate, ()); - DEFINE_HOOK(OnKaleidoUpdate, (PauseContext * pauseCtx)); DEFINE_HOOK(OnSaveInit, (s16 fileNum)); DEFINE_HOOK(BeforeEndOfCycleSave, ()); DEFINE_HOOK(AfterEndOfCycleSave, ()); @@ -264,7 +255,6 @@ class GameInteractor { DEFINE_HOOK(OnSceneInit, (s8 sceneId, s8 spawnNum)); DEFINE_HOOK(OnRoomInit, (s8 sceneId, s8 roomNum)); - DEFINE_HOOK(OnPlayDestroy, ()); DEFINE_HOOK(ShouldActorInit, (Actor * actor, bool* should)); DEFINE_HOOK(OnActorInit, (Actor * actor)); @@ -299,7 +289,6 @@ extern "C" { void GameInteractor_ExecuteOnGameStateMainFinish(); void GameInteractor_ExecuteOnGameStateDrawFinish(); void GameInteractor_ExecuteOnGameStateUpdate(); -void GameInteractor_ExecuteOnKaleidoUpdate(PauseContext* pauseCtx); void GameInteractor_ExecuteOnSaveInit(s16 fileNum); void GameInteractor_ExecuteBeforeEndOfCycleSave(); void GameInteractor_ExecuteAfterEndOfCycleSave(); @@ -307,7 +296,6 @@ void GameInteractor_ExecuteBeforeMoonCrashSaveReset(); void GameInteractor_ExecuteOnSceneInit(s16 sceneId, s8 spawnNum); void GameInteractor_ExecuteOnRoomInit(s16 sceneId, s8 roomNum); -void GameInteractor_ExecuteOnPlayDestroy(); bool GameInteractor_ShouldActorInit(Actor* actor); void GameInteractor_ExecuteOnActorInit(Actor* actor); @@ -339,7 +327,6 @@ bool GameInteractor_Should(GIVanillaBehavior flag, bool result, void* optionalAr flag, [](GIVanillaBehavior _, bool* should, void* opt) body) int GameInteractor_InvertControl(GIInvertType type); -uint32_t GameInteractor_Dpad(GIDpadType type, uint32_t buttonCombo); #ifdef __cplusplus } From 60782b402e1131e614582aa6fc2774aa450a372e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Jun 2024 16:57:09 -0700 Subject: [PATCH 6/9] removed useless egg checks, only need the researcher --- mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp | 37 --------------------- 1 file changed, 37 deletions(-) diff --git a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp index f668df8d56..5feb944a00 100644 --- a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp +++ b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp @@ -12,44 +12,7 @@ extern PlayState* gPlayState; const uint32_t MAX_EGGS = 7; -// every egg is active in marine lab regardless of progress, this tracks only the visible ones in tank -static uint32_t visibleEggCount = 0; - -void ResetStatics() { - visibleEggCount = 0; -} - void RegisterZoraEggCount() { - GameInteractor::Instance->RegisterGameHook([]() { ResetStatics(); }); - GameInteractor::Instance->RegisterGameHook([]() { ResetStatics(); }); - - // zora egg object, figures out how many eggs are being drawn - GameInteractor::Instance->RegisterGameHookForID( - ACTOR_EN_ZORAEGG, [](Actor* outerActor) { - static uint32_t enEggUpdateHook = 0; - static uint32_t enEggKillHook = 0; - GameInteractor::Instance->UnregisterGameHookForPtr(enEggUpdateHook); - GameInteractor::Instance->UnregisterGameHook(enEggKillHook); - enEggUpdateHook = 0; - enEggKillHook = 0; - - EnZoraegg* enZoraEgg = (EnZoraegg*)outerActor; - if (enZoraEgg->actor.draw != nullptr && gPlayState->sceneId == SCENE_LABO) { - visibleEggCount++; - } - - enEggKillHook = - GameInteractor::Instance->RegisterGameHook([](s8 sceneId, s8 spawnNum) { - if (sceneId != SCENE_LABO) { - visibleEggCount = 0; - } - GameInteractor::Instance->UnregisterGameHook(enEggUpdateHook); - GameInteractor::Instance->UnregisterGameHook(enEggKillHook); - enEggUpdateHook = 0; - enEggKillHook = 0; - }); - }); - // marine researcher, his actor update call is more consistent than the eggs GameInteractor::Instance->RegisterGameHookForID(ACTOR_EN_MK, [](Actor* outerActor) { static uint32_t enMkUpdateHook = 0; From e0a94c93529aacea2e388b47d482e80220147cce Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Jun 2024 14:46:17 -0700 Subject: [PATCH 7/9] trigger remote build From 06b53e0ffb5659210fe6d77b3f7165f1f1cba5e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Jun 2024 18:51:44 -0700 Subject: [PATCH 8/9] removing useless includes leftover from the old approach. --- mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp index 5feb944a00..af03c56fe6 100644 --- a/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp +++ b/mm/2s2h/Enhancements/Songs/ZoraEggCount.cpp @@ -1,12 +1,8 @@ #include "ZoraEggCount.h" #include #include "Enhancements/GameInteractor/GameInteractor.h" -#include "global.h" extern "C" { -extern PlayState* gPlayState; -#include "z64.h" -#include "src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h" #include "src/overlays/actors/ovl_En_Mk/z_en_mk.h" } From c14812bbd66d921072982abdd7b13116e58fab02 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 20 Aug 2024 13:39:57 -0700 Subject: [PATCH 9/9] move UIWidgets for egg into existing section --- mm/2s2h/BenGui/BenMenuBar.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp index 3e24d5b4f6..2b0612a497 100644 --- a/mm/2s2h/BenGui/BenMenuBar.cpp +++ b/mm/2s2h/BenGui/BenMenuBar.cpp @@ -574,11 +574,6 @@ void DrawEnhancementsMenu() { { .tooltip = "Enables using the Dpad for Ocarina playback." }); UIWidgets::CVarCheckbox("Prevent Dropped Ocarina Inputs", "gEnhancements.Playback.NoDropOcarinaInput", { .tooltip = "Prevent dropping inputs when playing the ocarina quickly" }); - - ImGui::EndMenu(); - } - - if (UIWidgets::BeginMenu("Songs/Playback")) { UIWidgets::CVarSliderInt("Zora Eggs For Bossa Nova", "gEnhancements.Songs.ZoraEggCount", 1, 7, 7, { .tooltip = "The number of eggs required to unlock new wave bossa nova." });