mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 19:02:19 -05:00
Hurt Container Mode (#3336)
* Each Heart Container or full Heart Piece reduces Links hearts by 1 * Based on Briaguya's suggested Code but modified slightly as some parts were missing. * Static Bool * The episode without Captain Hook's Hook --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
This commit is contained in:
parent
be948339b9
commit
695ab6c6ee
@ -1090,6 +1090,29 @@ void RegisterRandomizerSheikSpawn() {
|
||||
});
|
||||
}
|
||||
|
||||
void UpdateHurtContainerModeState(bool newState) {
|
||||
static bool hurtEnabled = false;
|
||||
if (hurtEnabled == newState) {
|
||||
return;
|
||||
}
|
||||
|
||||
hurtEnabled = newState;
|
||||
uint16_t getHeartPieces = gSaveContext.sohStats.heartPieces / 4;
|
||||
uint16_t getHeartContainers = gSaveContext.sohStats.heartContainers;
|
||||
|
||||
if (hurtEnabled) {
|
||||
gSaveContext.healthCapacity = 320 - ((getHeartPieces + getHeartContainers) * 16);
|
||||
} else {
|
||||
gSaveContext.healthCapacity = 48 + ((getHeartPieces + getHeartContainers) * 16);
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterHurtContainerModeHandler() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnLoadGame>([](int32_t fileNum) {
|
||||
UpdateHurtContainerModeState(CVarGetInteger("gHurtContainer", 0));
|
||||
});
|
||||
}
|
||||
|
||||
void RegisterRandomizedEnemySizes() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) {
|
||||
// Randomized Enemy Sizes
|
||||
@ -1256,4 +1279,5 @@ void InitMods() {
|
||||
RegisterRandomizedEnemySizes();
|
||||
RegisterToTMedallions();
|
||||
NameTag_RegisterHooks();
|
||||
RegisterHurtContainerModeHandler();
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ extern "C" {
|
||||
|
||||
void UpdateDirtPathFixState(int32_t sceneNum);
|
||||
void UpdateMirrorModeState(int32_t sceneNum);
|
||||
void UpdateHurtContainerModeState(bool newState);
|
||||
void PatchToTMedallions();
|
||||
void UpdatePermanentHeartLossState();
|
||||
void InitMods();
|
||||
|
@ -1294,6 +1294,14 @@ void DrawEnhancementsMenu() {
|
||||
}
|
||||
}
|
||||
|
||||
UIWidgets::Spacer(0);
|
||||
if (UIWidgets::PaddedEnhancementCheckbox("Hurt Container Mode", "gHurtContainer", true, false)) {
|
||||
UpdateHurtContainerModeState(CVarGetInteger("gHurtContainer", 0));
|
||||
}
|
||||
UIWidgets::Tooltip("Changes Heart Piece and Heart Container functionality.\n\n"
|
||||
"- Each Heart Container or full Heart Piece reduces Links hearts by 1.\n"
|
||||
"- Can be enabled retroactively after a File has already started.");
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
@ -3361,8 +3361,13 @@ void Message_Update(PlayState* play) {
|
||||
}
|
||||
if ((s32)(gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000) {
|
||||
gSaveContext.inventory.questItems ^= 0x40000000;
|
||||
if (!CVarGetInteger("gHurtContainer", 0)) {
|
||||
gSaveContext.healthCapacity += 0x10;
|
||||
gSaveContext.health += 0x10;
|
||||
} else {
|
||||
gSaveContext.healthCapacity -= 0x10;
|
||||
gSaveContext.health -= 0x10;
|
||||
}
|
||||
}
|
||||
if (msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE) {
|
||||
if (sLastPlayedSong == OCARINA_SONG_SARIAS) {
|
||||
|
@ -2278,8 +2278,13 @@ u8 Item_Give(PlayState* play, u8 item) {
|
||||
gSaveContext.sohStats.heartPieces++;
|
||||
return Return_Item(item, MOD_NONE, ITEM_NONE);
|
||||
} else if (item == ITEM_HEART_CONTAINER) {
|
||||
if (!CVarGetInteger("gHurtContainer", 0)) {
|
||||
gSaveContext.healthCapacity += 0x10;
|
||||
gSaveContext.health += 0x10;
|
||||
} else {
|
||||
gSaveContext.healthCapacity -= 0x10;
|
||||
gSaveContext.health -= 0x10;
|
||||
}
|
||||
gSaveContext.sohStats.heartContainers++;
|
||||
return Return_Item(item, MOD_NONE, ITEM_NONE);
|
||||
} else if (item == ITEM_HEART) {
|
||||
|
Loading…
Reference in New Issue
Block a user