ref: 4613bcfadf2df5da711646f1ee54e2e4982309c7
parent: 4ca9f45db702fe7104ef1c4d0a381f9fa9292f8f
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Tue Nov 24 15:11:17 EST 2020
Use STRING_BUFFER_LENGTH for the wStringBuffers
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -9,6 +9,8 @@
const STRING_BUFFER_5 ; use wStringBuffer5
NUM_STRING_BUFFERS EQU const_value
+STRING_BUFFER_LENGTH EQU 19
+
; checkmoney/takemoney accounts
const_def
const YOUR_MONEY ; 0
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -1750,7 +1750,7 @@
ld de, wStringBuffer1
ld a, BANK("Evolutions and Attacks")
- ld bc, 10
-+ ld bc, wStringBuffer2 - wStringBuffer1
++ ld bc, STRING_BUFFER_LENGTH
call FarCopyBytes
```
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -4711,7 +4711,7 @@
.Copy:
ld de, wStringBuffer2
- ld bc, wStringBuffer3 - wStringBuffer2
+ ld bc, STRING_BUFFER_LENGTH
jp CopyBytes
INCLUDE "data/battle/stat_names.asm"
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -73,7 +73,7 @@
ChooseMonToLearnTMHM:
ld hl, wStringBuffer2
ld de, wTMHMMoveNameBackup
- ld bc, 12
+ ld bc, MOVE_NAME_LENGTH - 1
call CopyBytes
call ClearBGPalettes
ChooseMonToLearnTMHM_NoRefresh:
@@ -97,7 +97,7 @@
push bc
ld hl, wTMHMMoveNameBackup
ld de, wStringBuffer2
- ld bc, 12
+ ld bc, MOVE_NAME_LENGTH - 1
call CopyBytes
pop af ; now contains the original contents of af
ret
--- a/engine/overworld/scripting.asm
+++ b/engine/overworld/scripting.asm
@@ -1590,7 +1590,7 @@
CopyConvertedText:
ld hl, wStringBuffer3
- ld bc, wStringBuffer4 - wStringBuffer3
+ ld bc, STRING_BUFFER_LENGTH
call AddNTimes
call CopyName2
ret
--- a/wram.asm
+++ b/wram.asm
@@ -1675,7 +1675,8 @@
wBufferMonOT:: ds NAME_LENGTH
wBufferMon:: party_struct wBufferMon
ds 8
-wMonOrItemNameBuffer:: ds 22
+wMonOrItemNameBuffer:: ds NAME_LENGTH
+ ds NAME_LENGTH
NEXTU
; poke seer
@@ -2019,11 +2020,11 @@
wTMHMMoveNameBackup:: ds MOVE_NAME_LENGTH
-wStringBuffer1:: ds 19
-wStringBuffer2:: ds 19
-wStringBuffer3:: ds 19
-wStringBuffer4:: ds 19
-wStringBuffer5:: ds 19
+wStringBuffer1:: ds STRING_BUFFER_LENGTH
+wStringBuffer2:: ds STRING_BUFFER_LENGTH
+wStringBuffer3:: ds STRING_BUFFER_LENGTH
+wStringBuffer4:: ds STRING_BUFFER_LENGTH
+wStringBuffer5:: ds STRING_BUFFER_LENGTH
wBattleMenuCursorBuffer:: dw