From fa27da8437293db3d746ada76de7261173801c0c Mon Sep 17 00:00:00 2001 From: laqieer Date: Mon, 15 Aug 2022 19:21:23 +0800 Subject: [PATCH] Fix help textbox display for skills. --- linkerscript | 2 +- src/text.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/linkerscript b/linkerscript index c844eee3..0c4b173a 100644 --- a/linkerscript +++ b/linkerscript @@ -76,7 +76,7 @@ gBattleTarget = 0x203a46c; gBattleHitArray = 0x203a4ec; decodedText = 0x202A5B0; -lastTextID = 0x202B5B0; +lastText = 0x202B5B0; ReadSramFast = 0x3005d90; diff --git a/src/text.c b/src/text.c index 5765eaed..3e48406d 100644 --- a/src/text.c +++ b/src/text.c @@ -3019,7 +3019,7 @@ const char* const texts[] = { #include "texts.txt" }; -extern int lastTextID; +extern const char * lastText; extern char decodedText[]; extern const char * compressedText[]; @@ -3064,12 +3064,8 @@ void stripTextControlCode(char *textIn, char *textOut, int maxLength) char *decodeText(int textID) { - if(textID == lastTextID && textID != TEXT_SPECIAL_SKILL_HELP && textID != TEXT_ASSIST_SKILL_NAME_IN_ACTION_MENU && textID != TEXT_ASSIST_SKILL_HELP_IN_ACTION_MENU && textID != TEXT_ASSIST_SKILL_HELP_IN_STAT_SCREEN && textID != TEXT_PASSIVE_SKILL_A_HELP && textID != TEXT_PASSIVE_SKILL_B_HELP && textID != TEXT_PASSIVE_SKILL_C_HELP && textID != TEXT_PASSIVE_SKILL_S_HELP && textID != TEXT_NEW_PASSIVE_SKILL_UNLOCKED) - return decodedText; - - lastTextID = textID; - char *p = texts[textID]; + if(textID == TEXT_SPECIAL_SKILL_HELP) p = getSpecialSkillDescriptionText(); if(textID == TEXT_ASSIST_SKILL_NAME_IN_ACTION_MENU) @@ -3088,6 +3084,11 @@ char *decodeText(int textID) p = getPassiveSkillSHelpText(); if(textID == TEXT_NEW_PASSIVE_SKILL_UNLOCKED) p = getNewUnlockedPassiveSkillNameTextByCurrentAIS(); + + if(p == lastText) + return decodedText; + + lastText = p; char *p0 = p; char *q = decodedText;