From cb232b87c7a180025492cf6b378a49282b3bb215 Mon Sep 17 00:00:00 2001 From: Ralphie Morell Date: Sat, 10 Dec 2022 23:28:22 -0500 Subject: [PATCH] Add QoL sneak option (#2128) * Added sneak option * fix french/german choices * market sneak uses cvar instead of n64dd; added toggle in gamebar * whoops * move enhancement from rando to regular * address feedback * accounted for entrance rando * damn it archez * added TODO about AI translated messages * fix variable names --- .../custom-message/CustomMessageTypes.h | 1 + soh/soh/GameMenuBar.cpp | 3 ++ soh/soh/OTRGlobals.cpp | 3 ++ soh/soh/z_message_OTR.cpp | 9 +++++ .../actors/ovl_En_Heishi4/z_en_heishi4.c | 33 +++++++++++++++++-- 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h index 6c736f8b0..894dcb91f 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h +++ b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h @@ -24,6 +24,7 @@ typedef enum { TEXT_MEDIGORON = 0x304C, TEXT_CARPET_SALESMAN_1 = 0x6077, TEXT_CARPET_SALESMAN_2 = 0x6078, + TEXT_MARKET_GUARD_NIGHT = 0x7003, TEXT_SCRUB_RANDOM = 0x9000, TEXT_SCRUB_RANDOM_FREE = 0x9001, TEXT_SHOP_ITEM_RANDOM = 0x9100, diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index f53625203..335c3c2d6 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -367,6 +367,9 @@ namespace GameMenuBar { UIWidgets::PaddedEnhancementCheckbox("Skip Magic Arrow Equip Animation", "gSkipArrowAnimation", true, false); UIWidgets::PaddedEnhancementCheckbox("Skip save confirmation", "gSkipSaveConfirmation", true, false); UIWidgets::Tooltip("Skip the \"Game saved.\" confirmation screen"); + UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false); + UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking " + "to the guard next to the gate."); ImGui::EndMenu(); } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index ea633111f..b9ee30e92 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2045,6 +2045,9 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_PIECE); CustomMessageManager::ReplaceStringInMessage(messageEntry, "{{heartPieceCount}}", std::to_string(gSaveContext.sohStats.heartPieces + 1)); } + if (textId == TEXT_MARKET_GUARD_NIGHT && CVar_GetS32("gMarketSneak", 0) && play->sceneNum == SCENE_ENTRA_N) { + messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT); + } if (messageEntry.textBoxType != -1) { font->charTexBuf[0] = (messageEntry.textBoxType << 4) | messageEntry.textBoxPos; switch (gSaveContext.language) { diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index 064b3059d..e65d12bba 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -144,4 +144,13 @@ extern "C" void OTRMessage_Init() "Vous obtenez un %rQuart de&Coeur%w! Vous en avez collecté&%r{{heartPieceCount}}%w en tout!" } ); + CustomMessageManager::Instance->CreateMessage( + customMessageTableID, TEXT_MARKET_GUARD_NIGHT, + { + TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM, + "You look bored. Wanna go out for a&walk?\x1B&%gYes&No%w", + "Du siehst gelangweilt aus.&Willst du einen Spaziergang machen?\x1B&%gJa&Nein%w", //TODO: AI translated, replace with actual translation + "Tu as l'air de t'ennuyer. Tu veux&aller faire une promenade?\x1B&%gOui&Non%w", //TODO: AI translated, replace with actual translation + } + ); } diff --git a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 379281148..6cd8936fa 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -20,6 +20,7 @@ void func_80A56900(EnHeishi4* this, PlayState* play); void func_80A56994(EnHeishi4* this, PlayState* play); void func_80A56A50(EnHeishi4* this, PlayState* play); void func_80A56ACC(EnHeishi4* this, PlayState* play); +void EnHeishi4_MarketSneak(EnHeishi4* this, PlayState* play); const ActorInit En_Heishi4_InitVars = { ACTOR_EN_HEISHI4, @@ -331,13 +332,41 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) { return; } if (this->type == HEISHI4_AT_MARKET_NIGHT) { - this->actionFunc = func_80A56614; - return; + if (CVar_GetS32("gMarketSneak", 0)) { + this->actionFunc = EnHeishi4_MarketSneak; + } else { + this->actionFunc = func_80A56614; + return; + } } } func_8002F2F4(&this->actor, play); } +/*Function that allows child Link to exit from Market entrance to Hyrule Field +at night. +*/ +void EnHeishi4_MarketSneak(EnHeishi4* this, PlayState* play) { + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { + case 0: //yes + if (gSaveContext.n64ddFlag){ + play->nextEntranceIndex = Entrance_OverrideNextIndex(0xCD); + } else { + play->nextEntranceIndex = 0xCD; + } + play->sceneLoadFlag = 0x14; + play->fadeTransition = 0x2E; + gSaveContext.nextTransitionType = 0x2E; + this->actionFunc = func_80A56614; + break; + case 1: //no + this->actionFunc = func_80A56614; + break; + } + } +} + void EnHeishi4_Update(Actor* thisx, PlayState* play) { EnHeishi4* this = (EnHeishi4*)thisx; s32 pad;