Add fast text enhancement (#150)

Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com>
This commit is contained in:
Garrett Cox
2024-05-22 09:05:00 -05:00
co-authored by louist103
parent 57a5ac8894
commit 9da273a8ea
4 changed files with 18 additions and 2 deletions
+4
View File
@@ -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"
+1
View File
@@ -9,6 +9,7 @@ extern "C" {
#include "z64.h"
#include "BenPort.h"
#include "libultraship/luslog.h"
#include <public/bridge/consolevariablebridge.h>
void bootproc(void);
+9 -1
View File
@@ -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) {
+4 -1
View File
@@ -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;