From fee26e29f5f1b513ea887a0de390ad5c3dad6fe2 Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Thu, 19 Sep 2024 03:01:12 -0700 Subject: [PATCH] Add AUTO_SCROLL_TEXT and NUM_FRAMES_AUTO_SCROLL_DELAY (#5054) * Added AUTO_SCROLL_TEXT * Moved NUM_FRAMES_AUTO_SCROLL_DELAY * Moved NUM_FRAMES_AUTO_SCROLL_DELAY per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054/files#r1698268265 * Apply suggestions from https://github.com/rh-hideout/pokeemerald-expansion/pull/5054/files#r1698268524 Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Added ability to skip text with button press per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054\#issuecomment-2267100771 * Update gflib/text.h per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054#issuecomment-2274402891 * Update text.h * Fixed alignment per https://github.com/rh-hideout/pokeemerald-expansion/pull/5054/files\#r1711780606 * Moved NUM_FRAMES_AUTO_SCROLL_DELAY * Update gflib/text.c Co-authored-by: Bassoonian --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian --- gflib/text.c | 34 +++++++++++++++++++++------------- include/config/general.h | 3 +++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gflib/text.c b/gflib/text.c index 59c6e3f4e8..e2adba1cdb 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -932,8 +932,9 @@ bool32 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->autoScrollDelay == 49) + if (subStruct->autoScrollDelay == NUM_FRAMES_AUTO_SCROLL_DELAY) { + subStruct->autoScrollDelay = 0; return TRUE; } else @@ -943,21 +944,29 @@ bool32 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) } } +void SetResultWithButtonPress(bool32 *result) +{ + if (JOY_NEW(A_BUTTON | B_BUTTON)) + { + *result = TRUE; + PlaySE(SE_SELECT); + } +} + bool32 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) { bool32 result = FALSE; - if (gTextFlags.autoScroll != 0) + if (gTextFlags.autoScroll != 0 || AUTO_SCROLL_TEXT) { result = TextPrinterWaitAutoMode(textPrinter); + + if (AUTO_SCROLL_TEXT) + SetResultWithButtonPress(&result); } else { TextPrinterDrawDownArrow(textPrinter); - if (JOY_NEW(A_BUTTON | B_BUTTON)) - { - result = TRUE; - PlaySE(SE_SELECT); - } + SetResultWithButtonPress(&result); } return result; } @@ -965,17 +974,16 @@ bool32 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) bool32 TextPrinterWait(struct TextPrinter *textPrinter) { bool32 result = FALSE; - if (gTextFlags.autoScroll != 0) + if (gTextFlags.autoScroll != 0 || AUTO_SCROLL_TEXT) { result = TextPrinterWaitAutoMode(textPrinter); + + if (AUTO_SCROLL_TEXT) + SetResultWithButtonPress(&result); } else { - if (JOY_NEW(A_BUTTON | B_BUTTON)) - { - result = TRUE; - PlaySE(SE_SELECT); - } + SetResultWithButtonPress(&result); } return result; } diff --git a/include/config/general.h b/include/config/general.h index dc39f4919a..ac338a1f50 100644 --- a/include/config/general.h +++ b/include/config/general.h @@ -72,6 +72,9 @@ #define SUMMARY_SCREEN_NATURE_COLORS TRUE // If TRUE, nature-based stat boosts and reductions will be red and blue in the summary screen. #define HQ_RANDOM TRUE // If TRUE, replaces the default RNG with an implementation of SFC32 RNG. May break code that relies on RNG. #define COMPETITIVE_PARTY_SYNTAX TRUE // If TRUE, parties are defined in "competitive syntax". +#define AUTO_SCROLL_TEXT FALSE // If TRUE, text will automatically scroll to the next line after NUM_FRAMES_AUTO_SCROLL_DELAY. Players can still press A_BUTTON or B_BUTTON to scroll on their own. +#define NUM_FRAMES_AUTO_SCROLL_DELAY 49 + // Measurement system constants to be used for UNITS #define UNITS_IMPERIAL 0 // Inches, feet, pounds