summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAda <60364512+GreatArgorath@users.noreply.github.com>2022-04-21 23:38:56 +0100
committerGitHub <noreply@github.com>2022-04-21 18:38:56 -0400
commitffeb2afcb758ecb024dc4af2ebcb6ac528ae3bdb (patch)
treec67b258b3cea65d53d72df2d3a4f464ae6b33e2c
parentf5a3d3c4bf2523ddf46a9895aab49b225a2b0784 (diff)
Changes fast text option to skip text, and makes text speed adjustable via a slider (#173)
* 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. * Fixes magic numbers * Changes text speed to a slider (unfinished) Got most of the code working, but only works upon reloading the game, unsure of how to fix this. * Makes text speed adjustable via a slider * Cleans up changes to z_message_PAL.c
-rw-r--r--libultraship/libultraship/GameSettings.cpp10
-rw-r--r--libultraship/libultraship/GameSettings.h3
-rw-r--r--libultraship/libultraship/SohImGuiImpl.cpp10
-rw-r--r--soh/src/code/z_message_PAL.c14
4 files changed, 24 insertions, 13 deletions
diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp
index 1d510c7cd..f396b8f36 100644
--- a/libultraship/libultraship/GameSettings.cpp
+++ b/libultraship/libultraship/GameSettings.cpp
@@ -49,8 +49,11 @@ namespace Game {
Settings.debug.n64mode = stob(Conf[ConfSection]["n64_mode"]);
// Enhancements
- Settings.enhancements.fast_text = stob(Conf[EnhancementSection]["fast_text"]);
- CVar_SetS32("gFastText", Settings.enhancements.fast_text);
+ Settings.enhancements.skip_text = stob(Conf[EnhancementSection]["skip_text"]);
+ CVar_SetS32("gSkipText", Settings.enhancements.skip_text);
+
+ Settings.enhancements.text_speed = Ship::stoi(Conf[EnhancementSection]["text_speed"]);
+ CVar_SetS32("gTextSpeed", Settings.enhancements.text_speed);
Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]);
CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod);
@@ -154,7 +157,8 @@ namespace Game {
Conf[AudioSection]["fanfare"] = std::to_string(Settings.audio.fanfare);
// Enhancements
- Conf[EnhancementSection]["fast_text"] = std::to_string(Settings.enhancements.fast_text);
+ Conf[EnhancementSection]["skip_text"] = std::to_string(Settings.enhancements.skip_text);
+ Conf[EnhancementSection]["text_speed"] = std::to_string(Settings.enhancements.text_speed);
Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu);
Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon);
diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h
index 18f978386..1b371fa7e 100644
--- a/libultraship/libultraship/GameSettings.h
+++ b/libultraship/libultraship/GameSettings.h
@@ -20,7 +20,8 @@ struct SoHConfigType {
// Enhancements
struct {
- bool fast_text = false;
+ int text_speed = 1;
+ bool skip_text = false;
bool disable_lod = false;
bool animated_pause_menu = false;
bool dynamic_wallet_icon = false;
diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp
index 93343b8dd..7eca28ede 100644
--- a/libultraship/libultraship/SohImGuiImpl.cpp
+++ b/libultraship/libultraship/SohImGuiImpl.cpp
@@ -395,8 +395,14 @@ namespace SohImGui {
ImGui::Text("Gameplay");
ImGui::Separator();
- if (ImGui::Checkbox("Fast Text", &Game::Settings.enhancements.fast_text)) {
- CVar_SetS32("gFastText", Game::Settings.enhancements.fast_text);
+ ImGui::Text("Text Speed", Game::Settings.enhancements.text_speed);
+ if (ImGui::SliderInt("##TEXTSPEED", &Game::Settings.enhancements.text_speed, 1, 5)) {
+ CVar_SetS32("gTextSpeed", Game::Settings.enhancements.text_speed);
+ needs_save = true;
+ }
+
+ if (ImGui::Checkbox("Skip Text", &Game::Settings.enhancements.skip_text)) {
+ CVar_SetS32("gSkipText", Game::Settings.enhancements.skip_text);
needs_save = true;
}
diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c
index 43b0fcc12..a767ede79 100644
--- a/soh/src/code/z_message_PAL.c
+++ b/soh/src/code/z_message_PAL.c
@@ -166,7 +166,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 +178,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 +951,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
}
}
i = j - 1;
- msgCtx->textDrawPos = i + 1;
+ msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
if (character) {}
}
@@ -1061,7 +1061,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 +1144,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
}
}
if (msgCtx->textDelayTimer == 0) {
- msgCtx->textDrawPos = i + 1;
+ msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
msgCtx->textDelayTimer = msgCtx->textDelay;
} else {
msgCtx->textDelayTimer--;
@@ -2026,7 +2026,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 +3067,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) {