summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortustin2121 <tustin2121@gmail.com>2020-10-13 21:31:59 -0400
committertustin2121 <tustin2121@gmail.com>2020-10-13 21:31:59 -0400
commit5511f5df53b579725055f6e1d853f65a74c2f1b6 (patch)
tree00cb1e2eae638259d0903a8c7b24de00c93ce21b
parent4c68afb32a186e096e94b1a553d3bf6c7f9c604b (diff)
Created Implement Missing Text Function RESET_SIZE (markdown)
-rw-r--r--Implement-Missing-Text-Function-RESET_SIZE.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/Implement-Missing-Text-Function-RESET_SIZE.md b/Implement-Missing-Text-Function-RESET_SIZE.md
new file mode 100644
index 0000000..205036a
--- /dev/null
+++ b/Implement-Missing-Text-Function-RESET_SIZE.md
@@ -0,0 +1,28 @@
+The text printer in Emerald is very versatile and has a lot of control codes. But it seems Game Freak skipped implementing one of the control codes in the release of the game, since it was likely never used. There's a control code that pokeemerald calls the `SIZE` control code, allowing you to change fonts (and thus font size) mid-text. But there's another control code right after that called the `RESET_SIZE` control code that does nothing. Here's how to implement it:
+
+In the text.c, find the function `RenderText` and add the following:
+```diff
+ case EXT_CTRL_CODE_SIZE:
+ subStruct->glyphId = *textPrinter->printerTemplate.currentChar;
+ textPrinter->printerTemplate.currentChar++;
+ return 2;
+ case EXT_CTRL_CODE_RESET_SIZE:
++ subStruct->glyphId = textPrinter->printerTemplate.fontId;
+ return 2;
+```
+
+Further down the same file, find the function `GetStringWidth` and add the following as well:
+```diff
+ case EXT_CTRL_CODE_ENG:
+ isJapanese = 0;
+ break;
+ case EXT_CTRL_CODE_RESET_SIZE:
++ if (letterSpacing == -1)
++ localLetterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
++ else
++ localLetterSpacing = letterSpacing;
++ break;
+ case EXT_CTRL_CODE_PAUSE_UNTIL_PRESS:
+```
+
+Both of these will reset the font to whatever the previous font was when the text printer comes across a `RESET_SIZE` control code. \ No newline at end of file