Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rando] Prevent alarm when at full HP #4831

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Varuuna marked this conversation as resolved.
Show resolved Hide resolved

/*** Play Cutscenes ***/

Expand Down
6 changes: 6 additions & 0 deletions soh/soh/Enhancements/randomizer/hook_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion soh/src/code/z_lifemeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down