From a9e7faa180db8e877e69a8b97ca37feb104b48ec Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sat, 21 Jan 2023 09:36:35 -0500 Subject: [PATCH] Full health spawn (#2377) * full health spawn Co-authored-by: MoriyaFaith <46070717+MoriyaFaith@users.noreply.github.com> * add enahancement to gamemenubar, update to use new cvar method names, simplify save loading logic so loading a save with less than 3 hearts spawns with full hearts with enhancement enabled instead of spawing with 3 * formatting Co-authored-by: MoriyaFaith <46070717+MoriyaFaith@users.noreply.github.com> --- soh/soh/Enhancements/presets.h | 1 + soh/soh/GameMenuBar.cpp | 2 ++ soh/src/code/z_sram.c | 2 +- soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index a2cc40d24..a89d14574 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -86,6 +86,7 @@ const std::vector enhancementsCvars = { "gNoHeartDrops", "gBombchuDrops", "gGoronPot", + "gFullHealthSpawn", "gDampeWin", "gRedPotionEffect", "gRedPotionHealth", diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index a1bcdbec1..07fd67440 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -443,6 +443,8 @@ namespace GameMenuBar { 32x: Can survive void damage with max health and double defense\n\ 64x: Cannot survive void damage" ); + UIWidgets::PaddedEnhancementCheckbox("Spawn with full health", "gFullHealthSpawn", true, false); + UIWidgets::Tooltip("Respawn with full health instead of 3 Hearts"); UIWidgets::PaddedEnhancementCheckbox("No Random Drops", "gNoRandomDrops", true, false); UIWidgets::Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses"); bool forceEnableBombchuDrops = gSaveContext.n64ddFlag && diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index fc2f5f561..40dcca14c 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -207,7 +207,7 @@ void Sram_OpenSave() { osSyncPrintf(VT_RST); if (gSaveContext.health < 0x30) { - gSaveContext.health = 0x30; + gSaveContext.health = CVarGetInteger("gFullHealthSpawn", 0) ? gSaveContext.healthCapacity : 0x30; } if (gSaveContext.scarecrowLongSongSet) { diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index f2e87db28..54d23405d 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -4158,7 +4158,7 @@ void KaleidoScope_Update(PlayState* play) Grotto_ForceGrottoReturn(); } gSaveContext.nextTransitionType = 2; - gSaveContext.health = 0x30; + gSaveContext.health = CVarGetInteger("gFullHealthSpawn", 0) ? gSaveContext.healthCapacity : 0x30; Audio_QueueSeqCmd(0xF << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xA); gSaveContext.healthAccumulator = 0; gSaveContext.magicState = 0;