summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Cox <garrettjcox@gmail.com>2024-03-27 01:02:28 +0000
committerGarrett Cox <garrettjcox@gmail.com>2024-05-22 09:05:00 -0500
commit9da273a8ead5ff6557b36a1d792ccc8cd6538c82 (patch)
tree522b28e362f91e1fd44b0fe2c8f5945bfbb94339
parent57a5ac889418d5f3ba3da043064aa5466f8900e6 (diff)
Add fast text enhancement (#150)
Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com>
-rw-r--r--mm/2s2h/BenGui/BenMenuBar.cpp4
-rw-r--r--mm/include/functions.h1
-rw-r--r--mm/src/code/z_message.c10
-rw-r--r--mm/src/code/z_message_nes.c5
4 files changed, 18 insertions, 2 deletions
diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp
index a8b6ad06e..24f4372fc 100644
--- a/mm/2s2h/BenGui/BenMenuBar.cpp
+++ b/mm/2s2h/BenGui/BenMenuBar.cpp
@@ -265,6 +265,10 @@ extern std::shared_ptr<HudEditorWindow> mHudEditorWindow;
void DrawEnhancementsMenu() {
if (UIWidgets::BeginMenu("Enhancements")) {
+ UIWidgets::CVarCheckbox("Fast Text", "gEnhancements.TimeSavers.FastText", {
+ .tooltip = "Speeds up text rendering, and enables holding of B progress to next message"
+ });
+
if (mHudEditorWindow) {
UIWidgets::WindowButton("Hud Editor", "gWindows.HudEditor", mHudEditorWindow, {
.tooltip = "Enables the Hud Editor window, allowing you to edit your hud"
diff --git a/mm/include/functions.h b/mm/include/functions.h
index e9e64ec5e..2ab5b51e7 100644
--- a/mm/include/functions.h
+++ b/mm/include/functions.h
@@ -9,6 +9,7 @@ extern "C" {
#include "z64.h"
#include "BenPort.h"
#include "libultraship/luslog.h"
+
#include <public/bridge/consolevariablebridge.h>
void bootproc(void);
diff --git a/mm/src/code/z_message.c b/mm/src/code/z_message.c
index 4e5f35189..edad4f499 100644
--- a/mm/src/code/z_message.c
+++ b/mm/src/code/z_message.c
@@ -317,6 +317,8 @@ s32 Message_ShouldAdvance(PlayState* play) {
Audio_PlaySfx(NA_SE_SY_MESSAGE_PASS);
}
return CHECK_BTN_ALL(controller->press.button, BTN_A) || CHECK_BTN_ALL(controller->press.button, BTN_B) ||
+ // 2S2H [Enhancement] When fast text is on, we want to check if B is held instead of only if it was just pressed
+ (CVarGetInteger("gEnhancements.TimeSavers.FastText", 0) && CHECK_BTN_ALL(controller->cur.button, BTN_B)) ||
CHECK_BTN_ALL(controller->press.button, BTN_CUP);
}
}
@@ -329,6 +331,8 @@ s32 Message_ShouldAdvanceSilent(PlayState* play) {
return CHECK_BTN_ALL(controller->press.button, BTN_A);
} else {
return CHECK_BTN_ALL(controller->press.button, BTN_A) || CHECK_BTN_ALL(controller->press.button, BTN_B) ||
+ // 2S2H [Enhancement] When fast text is on, we want to check if B is held instead of only if it was just pressed
+ (CVarGetInteger("gEnhancements.TimeSavers.FastText", 0) && CHECK_BTN_ALL(controller->cur.button, BTN_B)) ||
CHECK_BTN_ALL(controller->press.button, BTN_CUP);
}
}
@@ -5628,7 +5632,11 @@ void Message_Update(PlayState* play) {
case MSGMODE_TEXT_DISPLAYING:
if (msgCtx->textBoxType != TEXTBOX_TYPE_4) {
- if (CHECK_BTN_ALL(input->press.button, BTN_B) && !msgCtx->textUnskippable) {
+ if ((
+ CHECK_BTN_ALL(input->press.button, BTN_B) ||
+ // 2S2H [Enhancement] When fast text is on, we want to check if B is held instead of only if it was just pressed
+ (CVarGetInteger("gEnhancements.TimeSavers.FastText", 0) && CHECK_BTN_ALL(input->cur.button, BTN_B))
+ ) && !msgCtx->textUnskippable) {
msgCtx->textboxSkipped = true;
msgCtx->textDrawPos = msgCtx->decodedTextLen;
} else if (CHECK_BTN_ALL(input->press.button, BTN_A) && !msgCtx->textUnskippable) {
diff --git a/mm/src/code/z_message_nes.c b/mm/src/code/z_message_nes.c
index 8187880d3..c4839d126 100644
--- a/mm/src/code/z_message_nes.c
+++ b/mm/src/code/z_message_nes.c
@@ -920,13 +920,16 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) {
}
if (msgCtx->textDelayTimer == 0) {
- msgCtx->textDrawPos = i + 1;
+ msgCtx->textDrawPos = i + (CVarGetInteger("gEnhancements.TimeSavers.FastText", 0) ? 10 : 1);
msgCtx->textDelayTimer = 0;
if (msgCtx->msgMode == MSGMODE_9) {
msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING;
}
} else {
msgCtx->textDelayTimer--;
+ if (CVarGetInteger("gEnhancements.TimeSavers.FastText", 0)) {
+ msgCtx->textDelayTimer = 0;
+ }
}
*gfxP = gfx;