From b433be4107a7c0998277ee3701f41c7b43bd9db3 Mon Sep 17 00:00:00 2001 From: Caladius Date: Fri, 15 Mar 2024 12:17:53 -0400 Subject: [PATCH] Added in JOTWAD Death Trigger. --- soh/soh/Enhancements/timesplits/TimeSplits.cpp | 9 +++++++-- soh/soh/Enhancements/timesplits/TimeSplits.h | 4 +++- soh/src/overlays/actors/ovl_player_actor/z_player.c | 7 +++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/timesplits/TimeSplits.cpp b/soh/soh/Enhancements/timesplits/TimeSplits.cpp index 2035e4d1a..6d4b6589f 100644 --- a/soh/soh/Enhancements/timesplits/TimeSplits.cpp +++ b/soh/soh/Enhancements/timesplits/TimeSplits.cpp @@ -201,6 +201,7 @@ std::vector splitObjects = { { ENTER_INSIDE_GANONS_CASTLE_COLLAPSE, "Enter Ganons Castle Collapse", "SPECIAL_SPLIT_ENTRANCE"}, { ESCAPE_LOST_WOODS, "Lost Woods Escape", "SPECIAL_SPLIT_ENTRANCE"}, { ESCAPE_KOKIRI_FOREST, "Forest Escape", "SPECIAL_SPLIT_ENTRANCE"}, + { WATCHTOWER_DEATH, "Watchtower Death", "SPECIAL_SPLIT_ENTRANCE"}, }; std::vector equipmentObjects = { @@ -304,6 +305,7 @@ std::vector sceneObjects = { { ENTER_INSIDE_GANONS_CASTLE_COLLAPSE, "Enter Ganons Castle Collapse", "SPECIAL_SPLIT_ENTRANCE"}, { ESCAPE_LOST_WOODS, "Lost Woods Escape", "SPECIAL_SPLIT_ENTRANCE"}, { ESCAPE_KOKIRI_FOREST, "Forest Escape", "SPECIAL_SPLIT_ENTRANCE"}, + { WATCHTOWER_DEATH, "Watchtower Death", "SPECIAL_SPLIT_ENTRANCE"}, }; std::string formatTimestampTimeSplit(uint32_t value) { @@ -365,9 +367,12 @@ void TimeSplitSceneSplitHandler(uint32_t entrance) { if (entrance == ESCAPE_KOKIRI_FOREST && gSaveContext.cutsceneIndex != 0xfff0) { return; } - if (entrance != ESCAPE_LOST_WOODS && entrance != ESCAPE_KOKIRI_FOREST) { + if (entrance != ESCAPE_LOST_WOODS && entrance != ESCAPE_KOKIRI_FOREST && entrance != WATCHTOWER_DEATH) { entrance = gPlayState->sceneNum + ENTER_DEKU_TREE; } + if (entrance == WATCHTOWER_DEATH && gSaveContext.health != 0) { + return; + } for (auto& str : splitItem) { if (entrance == splitItem[loopCounter]) { if (splitStatus[loopCounter] == 2) { @@ -1370,7 +1375,7 @@ void DrawTimeSplitListManager() { ImGui::BeginTable("Overworld", 1); ImGui::TableSetupColumn("Overworld1", ImGuiTableColumnFlags_WidthFixed, (220.0f * uiScale)); ImGui::TableNextColumn(); - for (int i = 16; i <= 17; i++) { + for (int i = 16; i <= 18; i++) { //itemNum = obj.itemID; //TimeSplitColorTint(); if (ImGui::ImageButton(std::to_string(i).c_str(), LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(sceneObjects[i].itemImage), diff --git a/soh/soh/Enhancements/timesplits/TimeSplits.h b/soh/soh/Enhancements/timesplits/TimeSplits.h index 88e916156..d1a5df975 100644 --- a/soh/soh/Enhancements/timesplits/TimeSplits.h +++ b/soh/soh/Enhancements/timesplits/TimeSplits.h @@ -9,6 +9,7 @@ extern "C" { #endif void TimeSplitSplitsHandlerS(uint32_t itemID); +void TimeSplitSceneSplitHandler(uint32_t entrance); #ifdef __cplusplus } @@ -66,5 +67,6 @@ typedef enum { ENTER_GANONS_TOWER_COLLAPSE_INTERIOR, ENTER_INSIDE_GANONS_CASTLE_COLLAPSE, ESCAPE_KOKIRI_FOREST = 286, - ESCAPE_LOST_WOODS = 477 + ESCAPE_LOST_WOODS = 477, + WATCHTOWER_DEATH = 513 }; \ No newline at end of file diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index d1c224088..aad3e641a 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -30,6 +30,7 @@ #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/randomizer/randomizer_grotto.h" #include "soh/frame_interpolation.h" +#include "soh/Enhancements/timesplits/TimeSplits.h" #include #include @@ -9023,7 +9024,7 @@ s32 func_80843E64(PlayState* play, Player* this) { Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration, impactInfo->rumbleDecreaseRate, 0); Player_PlaySfx(this, NA_SE_PL_BODY_HIT); func_80832698(this, impactInfo->sfxId); - + return impactIndex + 1; } @@ -11449,6 +11450,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { : (this->bodyShockTimer != 0) ? &gPlayerAnim_link_normal_electric_shock_end : &gPlayerAnim_link_derth_rebirth); } + TimeSplitSceneSplitHandler(gSaveContext.entranceIndex); + } else { if ((this->actor.parent == NULL) && ((play->transitionTrigger == TRANS_TRIGGER_START) || (this->unk_A87 != 0) || !func_808382DC(this, play))) { @@ -15978,7 +15981,7 @@ s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified) { this->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; return 1; } - + return 0; }