From 8faebc8647a0dba3f5e2a6112f63b38944294126 Mon Sep 17 00:00:00 2001 From: Ada <60364512+GreatArgorath@users.noreply.github.com> Date: Thu, 14 Apr 2022 20:47:20 +0100 Subject: [PATCH] Adds fast text option Changes previous "fast text" option to "skip text", and adds a new "fast text" option, which makes text appear 5 times faster. --- libultraship/libultraship/GameSettings.cpp | 4 ++++ libultraship/libultraship/GameSettings.h | 1 + libultraship/libultraship/SohImGuiImpl.cpp | 5 +++++ soh/src/code/z_message_PAL.c | 24 +++++++++++++++------- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 678555c7d..fff182242 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -49,6 +49,9 @@ namespace Game { Settings.debug.n64mode = stob(Conf[ConfSection]["n64_mode"]); // Enhancements + Settings.enhancements.skip_text = stob(Conf[EnhancementSection]["skip_text"]); + CVar_SetS32("gSkipText", Settings.enhancements.skip_text); + Settings.enhancements.fast_text = stob(Conf[EnhancementSection]["fast_text"]); CVar_SetS32("gFastText", Settings.enhancements.fast_text); @@ -148,6 +151,7 @@ namespace Game { Conf[AudioSection]["fanfare"] = std::to_string(Settings.audio.fanfare); // Enhancements + Conf[EnhancementSection]["skip_text"] = std::to_string(Settings.enhancements.skip_text); Conf[EnhancementSection]["fast_text"] = std::to_string(Settings.enhancements.fast_text); Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod); Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 17079c9bf..a935c4ef0 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -20,6 +20,7 @@ struct SoHConfigType { // Enhancements struct { + bool skip_text = false; bool fast_text = false; bool disable_lod = false; bool animated_pause_menu = false; diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 9ba3184d8..9bbd437ca 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -378,6 +378,11 @@ namespace SohImGui { ImGui::Text("Gameplay"); ImGui::Separator(); + if (ImGui::Checkbox("Skip Text", &Game::Settings.enhancements.skip_text)) { + CVar_SetS32("gSkipText", Game::Settings.enhancements.skip_text); + needs_save = true; + } + if (ImGui::Checkbox("Fast Text", &Game::Settings.enhancements.fast_text)) { CVar_SetS32("gFastText", Game::Settings.enhancements.fast_text); needs_save = true; diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 43b0fcc12..c32e96e52 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -37,6 +37,8 @@ MessageTableEntry* sStaffMessageEntryTablePtr; char* _message_0xFFFC_nes; + + //MessageTableEntry sNesMessageEntryTable[] = { //#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \ // { textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_nes }, @@ -118,6 +120,8 @@ s16 sOcarinaNoteCEnvR; s16 sOcarinaNoteCEnvB; s16 sOcarinaNoteCEnvG; + + void Message_ResetOcarinaNoteState(void) { R_OCARINA_NOTES_YPOS(0) = 189; R_OCARINA_NOTES_YPOS(1) = 184; @@ -166,7 +170,7 @@ void Message_UpdateOcarinaGame(GlobalContext* globalCtx) { u8 Message_ShouldAdvance(GlobalContext* globalCtx) { Input* input = &globalCtx->state.input[0]; - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); if (CHECK_BTN_ALL(input->press.button, BTN_A) || isB_Held || CHECK_BTN_ALL(input->press.button, BTN_CUP)) { @@ -178,7 +182,7 @@ u8 Message_ShouldAdvance(GlobalContext* globalCtx) { u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) { Input* input = &globalCtx->state.input[0]; - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); return CHECK_BTN_ALL(input->press.button, BTN_A) || isB_Held || CHECK_BTN_ALL(input->press.button, BTN_CUP); @@ -951,7 +955,10 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { } } i = j - 1; - msgCtx->textDrawPos = i + 1; + if (CVar_GetS32("gFastText", 0) !=0) + msgCtx->textDrawPos = i + 5; + else + msgCtx->textDrawPos = i + 1; if (character) {} } @@ -1061,7 +1068,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { msgCtx->textDelay = msgCtx->msgBufDecoded[++i]; break; case MESSAGE_UNSKIPPABLE: - msgCtx->textUnskippable = CVar_GetS32("gFastText", 0) != 1; + msgCtx->textUnskippable = CVar_GetS32("gSkipText", 0) != 1; break; case MESSAGE_TWO_CHOICE: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_2_CHOICE; @@ -1144,7 +1151,10 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) { } } if (msgCtx->textDelayTimer == 0) { - msgCtx->textDrawPos = i + 1; + if (CVar_GetS32("gFastText", 0) !=0) + msgCtx->textDrawPos = i + 5; + else + msgCtx->textDrawPos = i + 1; msgCtx->textDelayTimer = msgCtx->textDelay; } else { msgCtx->textDelayTimer--; @@ -2026,7 +2036,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) { gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(globalCtx->state.input[0].cur.button, BTN_B) + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(globalCtx->state.input[0].cur.button, BTN_B) : CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B); switch (msgCtx->msgMode) { @@ -3067,7 +3077,7 @@ void Message_Update(GlobalContext* globalCtx) { return; } - bool isB_Held = CVar_GetS32("gFastText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) && !sTextboxSkipped + bool isB_Held = CVar_GetS32("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) && !sTextboxSkipped : CHECK_BTN_ALL(input->press.button, BTN_B); switch (msgCtx->msgMode) {