From 02ebf0962d4290fb991b14b8de2744132319b2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Andr=C3=A9asson?= Date: Thu, 9 Jan 2025 03:28:57 +0100 Subject: [PATCH 1/2] * Prevent low HP alarm when at full HP for 1 heart start --- soh/soh/Enhancements/game-interactor/GameInteractor.h | 2 ++ soh/soh/Enhancements/randomizer/hook_handlers.cpp | 6 ++++++ soh/src/code/z_lifemeter.c | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index a6aa85a617d..6985d87b858 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -302,6 +302,8 @@ typedef enum { // Opt: *EnFr // Vanilla condition: this->reward == GI_NONE VB_FROGS_GO_TO_IDLE, + // Vanilla condition: var >= gSaveContext.health) && (gSaveContext.health > 0 + VB_PREVENT_ALARM_AT_FULL_HEALTH, /*** Play Cutscenes ***/ diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 409fa45d19d..cb3e598fe17 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -1631,6 +1631,12 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } break; } + case VB_PREVENT_ALARM_AT_FULL_HEALTH: { + if (gSaveContext.health == gSaveContext.healthCapacity) { + *should = false; + } + break; + } case VB_FREEZE_ON_SKULL_TOKEN: case VB_TRADE_TIMER_ODD_MUSHROOM: case VB_TRADE_TIMER_FROG: diff --git a/soh/src/code/z_lifemeter.c b/soh/src/code/z_lifemeter.c index 52742bc627c..7fed3f7458d 100644 --- a/soh/src/code/z_lifemeter.c +++ b/soh/src/code/z_lifemeter.c @@ -2,6 +2,7 @@ #include "textures/parameter_static/parameter_static.h" #include "soh/frame_interpolation.h" #include "soh/OTRGlobals.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" s16 Top_LM_Margin = 0; s16 Left_LM_Margin = 0; @@ -674,7 +675,7 @@ u32 HealthMeter_IsCritical(void) { var = 0x2C; } - if ((var >= gSaveContext.health) && (gSaveContext.health > 0)) { + if (GameInteractor_Should(VB_PREVENT_ALARM_AT_FULL_HEALTH, var >= gSaveContext.health && gSaveContext.health > 0)) { return true; } else { return false; From e38fe9256d934d24aa3a5245fd221b304657ac1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Andr=C3=A9asson?= Date: Thu, 9 Jan 2025 05:01:40 +0100 Subject: [PATCH 2/2] * updated name --- soh/soh/Enhancements/game-interactor/GameInteractor.h | 2 +- soh/soh/Enhancements/randomizer/hook_handlers.cpp | 2 +- soh/src/code/z_lifemeter.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 6985d87b858..3b263911186 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -303,7 +303,7 @@ typedef enum { // Vanilla condition: this->reward == GI_NONE VB_FROGS_GO_TO_IDLE, // Vanilla condition: var >= gSaveContext.health) && (gSaveContext.health > 0 - VB_PREVENT_ALARM_AT_FULL_HEALTH, + VB_HEALTH_METER_BE_CRITICAL, /*** Play Cutscenes ***/ diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index cb3e598fe17..28f7e8040e6 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -1631,7 +1631,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } break; } - case VB_PREVENT_ALARM_AT_FULL_HEALTH: { + case VB_HEALTH_METER_BE_CRITICAL: { if (gSaveContext.health == gSaveContext.healthCapacity) { *should = false; } diff --git a/soh/src/code/z_lifemeter.c b/soh/src/code/z_lifemeter.c index 7fed3f7458d..5f09e6b3f8d 100644 --- a/soh/src/code/z_lifemeter.c +++ b/soh/src/code/z_lifemeter.c @@ -675,7 +675,7 @@ u32 HealthMeter_IsCritical(void) { var = 0x2C; } - if (GameInteractor_Should(VB_PREVENT_ALARM_AT_FULL_HEALTH, var >= gSaveContext.health && gSaveContext.health > 0)) { + if (GameInteractor_Should(VB_HEALTH_METER_BE_CRITICAL, var >= gSaveContext.health && gSaveContext.health > 0)) { return true; } else { return false;