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
This commit is contained in:
Ada 2022-04-21 23:38:56 +01:00 committed by GitHub
parent f5a3d3c4bf
commit ffeb2afcb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 13 deletions

View File

@ -49,8 +49,11 @@ namespace Game {
Settings.debug.n64mode = stob(Conf[ConfSection]["n64_mode"]); Settings.debug.n64mode = stob(Conf[ConfSection]["n64_mode"]);
// Enhancements // Enhancements
Settings.enhancements.fast_text = stob(Conf[EnhancementSection]["fast_text"]); Settings.enhancements.skip_text = stob(Conf[EnhancementSection]["skip_text"]);
CVar_SetS32("gFastText", Settings.enhancements.fast_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"]); Settings.enhancements.disable_lod = stob(Conf[EnhancementSection]["disable_lod"]);
CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod); CVar_SetS32("gDisableLOD", Settings.enhancements.disable_lod);
@ -154,7 +157,8 @@ namespace Game {
Conf[AudioSection]["fanfare"] = std::to_string(Settings.audio.fanfare); Conf[AudioSection]["fanfare"] = std::to_string(Settings.audio.fanfare);
// Enhancements // 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]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); 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); Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon);

View File

@ -20,7 +20,8 @@ struct SoHConfigType {
// Enhancements // Enhancements
struct { struct {
bool fast_text = false; int text_speed = 1;
bool skip_text = false;
bool disable_lod = false; bool disable_lod = false;
bool animated_pause_menu = false; bool animated_pause_menu = false;
bool dynamic_wallet_icon = false; bool dynamic_wallet_icon = false;

View File

@ -395,8 +395,14 @@ namespace SohImGui {
ImGui::Text("Gameplay"); ImGui::Text("Gameplay");
ImGui::Separator(); ImGui::Separator();
if (ImGui::Checkbox("Fast Text", &Game::Settings.enhancements.fast_text)) { ImGui::Text("Text Speed", Game::Settings.enhancements.text_speed);
CVar_SetS32("gFastText", Game::Settings.enhancements.fast_text); 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; needs_save = true;
} }

View File

@ -166,7 +166,7 @@ void Message_UpdateOcarinaGame(GlobalContext* globalCtx) {
u8 Message_ShouldAdvance(GlobalContext* globalCtx) { u8 Message_ShouldAdvance(GlobalContext* globalCtx) {
Input* input = &globalCtx->state.input[0]; 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); : 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)) { 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) { u8 Message_ShouldAdvanceSilent(GlobalContext* globalCtx) {
Input* input = &globalCtx->state.input[0]; 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); : 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); 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; i = j - 1;
msgCtx->textDrawPos = i + 1; msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
if (character) {} if (character) {}
} }
@ -1061,7 +1061,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
msgCtx->textDelay = msgCtx->msgBufDecoded[++i]; msgCtx->textDelay = msgCtx->msgBufDecoded[++i];
break; break;
case MESSAGE_UNSKIPPABLE: case MESSAGE_UNSKIPPABLE:
msgCtx->textUnskippable = CVar_GetS32("gFastText", 0) != 1; msgCtx->textUnskippable = CVar_GetS32("gSkipText", 0) != 1;
break; break;
case MESSAGE_TWO_CHOICE: case MESSAGE_TWO_CHOICE:
msgCtx->textboxEndType = TEXTBOX_ENDTYPE_2_CHOICE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_2_CHOICE;
@ -1144,7 +1144,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
} }
} }
if (msgCtx->textDelayTimer == 0) { if (msgCtx->textDelayTimer == 0) {
msgCtx->textDrawPos = i + 1; msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
msgCtx->textDelayTimer = msgCtx->textDelay; msgCtx->textDelayTimer = msgCtx->textDelay;
} else { } else {
msgCtx->textDelayTimer--; 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, gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0); 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); : CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B);
switch (msgCtx->msgMode) { switch (msgCtx->msgMode) {
@ -3067,7 +3067,7 @@ void Message_Update(GlobalContext* globalCtx) {
return; 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); : CHECK_BTN_ALL(input->press.button, BTN_B);
switch (msgCtx->msgMode) { switch (msgCtx->msgMode) {