[Fixes] Fix Raised Floor Switches (#3851)

* Lower by 1

* gEnhancements.

* Update z_obj_switch.c

Co-authored-by: Archez <Archez@users.noreply.github.com>

* Moved to Hook

* Properly this time

* Added to presets

* Added a Return;

* Use Hex

Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>

---------

Co-authored-by: Archez <Archez@users.noreply.github.com>
Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
This commit is contained in:
Patrick12115 2024-02-15 23:02:58 -05:00 committed by GitHub
parent a8d3724a53
commit 4599212546
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "src/overlays/actors/ovl_En_Tp/z_en_tp.h" #include "src/overlays/actors/ovl_En_Tp/z_en_tp.h"
#include "src/overlays/actors/ovl_En_Firefly/z_en_firefly.h" #include "src/overlays/actors/ovl_En_Firefly/z_en_firefly.h"
#include "src/overlays/actors/ovl_En_Xc/z_en_xc.h" #include "src/overlays/actors/ovl_En_Xc/z_en_xc.h"
#include "src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h"
#include "objects/object_link_boy/object_link_boy.h" #include "objects/object_link_boy/object_link_boy.h"
#include "objects/object_link_child/object_link_child.h" #include "objects/object_link_child/object_link_child.h"
@ -1359,6 +1360,23 @@ void RegisterToTMedallions() {
}); });
} }
void RegisterFloorSwitchesHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor);
if (actor->id != ACTOR_OBJ_SWITCH || !CVarGetInteger("gEnhancements.FixFloorSwitches", 0)) {
return;
}
ObjSwitch* switchActor = reinterpret_cast<ObjSwitch*>(actor);
s32 type = (switchActor->dyna.actor.params & 7);
if (switchActor->dyna.actor.params == 0x1200 || switchActor->dyna.actor.params == 0x3A00) {
switchActor->dyna.actor.world.pos.y -= 1;
}
});
}
void RegisterPauseMenuHooks() { void RegisterPauseMenuHooks() {
static bool pauseWarpHooksRegistered = false; static bool pauseWarpHooksRegistered = false;
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([&]() { GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGameFrameUpdate>([&]() {
@ -1411,6 +1429,7 @@ void InitMods() {
RegisterOpenAllHours(); RegisterOpenAllHours();
RegisterToTMedallions(); RegisterToTMedallions();
NameTag_RegisterHooks(); NameTag_RegisterHooks();
RegisterFloorSwitchesHook();
RegisterPatchHandHandler(); RegisterPatchHandHandler();
RegisterHurtContainerModeHandler(); RegisterHurtContainerModeHandler();
RegisterPauseMenuHooks(); RegisterPauseMenuHooks();

View File

@ -270,6 +270,7 @@ const std::vector<const char*> enhancementsCvars = {
"gEnhancements.ResetNaviTimer", "gEnhancements.ResetNaviTimer",
"gEnhancements.ScaleAdultEquimentAsChild", "gEnhancements.ScaleAdultEquimentAsChild",
"gEnhancements.SwordToggle", "gEnhancements.SwordToggle",
"gEnhancements.FixFloorSwitches",
"gFixZoraHintDialogue", "gFixZoraHintDialogue",
"gHurtContainer", "gHurtContainer",
"gPauseWarp", "gPauseWarp",
@ -543,6 +544,8 @@ const std::vector<PresetEntry> vanillaPlusPresetEntries = {
PRESET_ENTRY_S32("gNaviTextFix", 1), PRESET_ENTRY_S32("gNaviTextFix", 1),
// Extend Silver Rupee Jingle // Extend Silver Rupee Jingle
PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1),
// Fix some Floor Switches
PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1),
// Red Ganon blood // Red Ganon blood
PRESET_ENTRY_S32("gRedGanonBlood", 1), PRESET_ENTRY_S32("gRedGanonBlood", 1),
@ -614,6 +617,8 @@ const std::vector<PresetEntry> enhancedPresetEntries = {
PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1),
// Fix enemies not spawning on ground over water // Fix enemies not spawning on ground over water
PRESET_ENTRY_S32("gEnemySpawnsOverWaterboxes", 1), PRESET_ENTRY_S32("gEnemySpawnsOverWaterboxes", 1),
// Fix some Floor Switches
PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1),
// Red Ganon blood // Red Ganon blood
PRESET_ENTRY_S32("gRedGanonBlood", 1), PRESET_ENTRY_S32("gRedGanonBlood", 1),
@ -736,6 +741,8 @@ const std::vector<PresetEntry> randomizerPresetEntries = {
PRESET_ENTRY_S32("gNaviTextFix", 1), PRESET_ENTRY_S32("gNaviTextFix", 1),
// Extend Silver Rupee Jingle // Extend Silver Rupee Jingle
PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1),
// Fix some Floor Switches
PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1),
// Red Ganon blood // Red Ganon blood
PRESET_ENTRY_S32("gRedGanonBlood", 1), PRESET_ENTRY_S32("gRedGanonBlood", 1),

View File

@ -1252,6 +1252,9 @@ void DrawEnhancementsMenu() {
UIWidgets::PaddedEnhancementCheckbox("Fix Darunia dancing too fast", "gEnhancements.FixDaruniaDanceSpeed", UIWidgets::PaddedEnhancementCheckbox("Fix Darunia dancing too fast", "gEnhancements.FixDaruniaDanceSpeed",
true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true);
UIWidgets::Tooltip("Fixes Darunia's dancing speed so he dances to the beat of Saria's Song, like in vanilla."); UIWidgets::Tooltip("Fixes Darunia's dancing speed so he dances to the beat of Saria's Song, like in vanilla.");
UIWidgets::PaddedEnhancementCheckbox("Fix raised Floor Switches", "gEnhancements.FixFloorSwitches", true, false);
UIWidgets::Tooltip("Fixes the two raised floor switches, the one in Forest Temple Basement and the one at the top of Fire Temple. \n"
"This will lower them, making activating them easier");
UIWidgets::PaddedEnhancementCheckbox("Fix Zora hint dialogue", "gFixZoraHintDialogue", true, false); UIWidgets::PaddedEnhancementCheckbox("Fix Zora hint dialogue", "gFixZoraHintDialogue", true, false);
UIWidgets::Tooltip("Fixes one Zora's dialogue giving a hint about bringing Ruto's Letter to King Zora to properly occur before moving King Zora rather than after"); UIWidgets::Tooltip("Fixes one Zora's dialogue giving a hint about bringing Ruto's Letter to King Zora to properly occur before moving King Zora rather than after");