From 90bb87d74e6decf8470a255931e7248935f4e2c7 Mon Sep 17 00:00:00 2001 From: Caladius Date: Thu, 26 Oct 2023 18:54:06 -0400 Subject: [PATCH 1/2] Redead Trap with Enemy Rando enablement. --- soh/soh/Enhancements/mods.cpp | 8 +++++++- soh/soh/SohMenuBar.cpp | 5 +++++ soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index d23c5609e8e..184d61339cb 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -859,6 +859,7 @@ typedef enum { ADD_AMMO_TRAP, ADD_KILL_TRAP, ADD_TELEPORT_TRAP, + ADD_REDEAD_TRAP, ADD_TRAP_MAX } AltTrapType; @@ -872,7 +873,8 @@ const char* altTrapTypeCvars[] = { "gAddTraps.Void", "gAddTraps.Ammo", "gAddTraps.Kill", - "gAddTraps.Tele" + "gAddTraps.Tele", + "gAddTraps.Redead" }; std::vector getEnabledAddTraps () { @@ -897,6 +899,7 @@ void RegisterAltTrapTypes() { if (!CVarGetInteger("gAddTraps.enabled", 0) || itemEntry.modIndex != MOD_RANDOMIZER || itemEntry.getItemId != RG_ICE_TRAP) { return; } + Player* player = GET_PLAYER(gPlayState); roll = RandomElement(getEnabledAddTraps()); switch (roll) { case ADD_ICE_TRAP: @@ -934,6 +937,9 @@ void RegisterAltTrapTypes() { case ADD_TELEPORT_TRAP: eventTimer = 3; break; + case ADD_REDEAD_TRAP: + Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_RD, player->actor.world.pos.x, + player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, 22, true); } }); GameInteractor::Instance->RegisterGameHook([]() { diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 04f25d2e882..3c75c21adf8 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1159,6 +1159,11 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Death Traps", "gAddTraps.Kill", true, false); UIWidgets::PaddedEnhancementCheckbox("Teleport Traps", "gAddTraps.Tele", true, false); + UIWidgets::PaddedSeparator(); + ImGui::Text("Nightmare Traps:"); + UIWidgets::Spacer(0); + UIWidgets::PaddedEnhancementCheckbox("Redead Traps", "gAddTraps.Redead", true, false); + ImGui::EndMenu(); } } diff --git a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 6f36bea369b..496354a1335 100644 --- a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -167,6 +167,10 @@ void EnRd_Init(Actor* thisx, PlayState* play) { if (thisx->params == 3) { thisx->flags |= ACTOR_FLAG_LENS; } + + if (thisx->params == 22) { + func_80AE3260(this, play); + } } void EnRd_Destroy(Actor* thisx, PlayState* play) { From a8cea3409657bee46af9ebab1a01d6561e8b473c Mon Sep 17 00:00:00 2001 From: Caladius Date: Thu, 26 Oct 2023 19:27:36 -0400 Subject: [PATCH 2/2] Mirror Traps, mirrors the game for 30 seconds. --- soh/soh/Enhancements/mods.cpp | 24 +++++++++++++++++++----- soh/soh/SohMenuBar.cpp | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 184d61339cb..4c4ea1c86f9 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -860,6 +860,7 @@ typedef enum { ADD_KILL_TRAP, ADD_TELEPORT_TRAP, ADD_REDEAD_TRAP, + ADD_MIRROR_TRAP, ADD_TRAP_MAX } AltTrapType; @@ -874,7 +875,8 @@ const char* altTrapTypeCvars[] = { "gAddTraps.Ammo", "gAddTraps.Kill", "gAddTraps.Tele", - "gAddTraps.Redead" + "gAddTraps.Redead", + "gAddTraps.Mirror" }; std::vector getEnabledAddTraps () { @@ -892,7 +894,8 @@ std::vector getEnabledAddTraps () { void RegisterAltTrapTypes() { static AltTrapType roll = ADD_TRAP_MAX; - static int statusTimer = -1; + static int speedTimer = -1; + static int mirrorTimer = -1; static int eventTimer = -1; GameInteractor::Instance->RegisterGameHook([](GetItemEntry itemEntry) { @@ -917,7 +920,7 @@ void RegisterAltTrapTypes() { case ADD_SPEED_TRAP: Audio_PlaySoundGeneral(NA_SE_VO_KZ_MOVE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); GameInteractor::State::RunSpeedModifier = -2; - statusTimer = 200; + speedTimer = 200; Overlay_DisplayText(10, "Speed Decreased!"); break; case ADD_BOMB_TRAP: @@ -940,13 +943,23 @@ void RegisterAltTrapTypes() { case ADD_REDEAD_TRAP: Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_RD, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, 0, 0, 0, 22, true); + break; + case ADD_MIRROR_TRAP: + mirrorTimer = 600; + CVarSetInteger("gMirroredWorldMode", 1); + UpdateMirrorModeState(gPlayState->sceneNum); + break; } }); GameInteractor::Instance->RegisterGameHook([]() { Player* player = GET_PLAYER(gPlayState); - if (statusTimer == 0) { + if (speedTimer == 0) { GameInteractor::State::RunSpeedModifier = 0; } + if (mirrorTimer == 0) { + CVarSetInteger("gMirroredWorldMode", 0); + UpdateMirrorModeState(gPlayState->sceneNum); + } if (eventTimer == 0) { switch (roll) { case ADD_KNOCK_TRAP: @@ -997,8 +1010,9 @@ void RegisterAltTrapTypes() { break; } } - statusTimer--; + speedTimer--; eventTimer--; + mirrorTimer--; }); } diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 3c75c21adf8..2ed341c061c 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1163,6 +1163,7 @@ void DrawEnhancementsMenu() { ImGui::Text("Nightmare Traps:"); UIWidgets::Spacer(0); UIWidgets::PaddedEnhancementCheckbox("Redead Traps", "gAddTraps.Redead", true, false); + UIWidgets::PaddedEnhancementCheckbox("Mirror Traps", "gAddTraps.Mirror", true, false); ImGui::EndMenu(); }