diff --git a/constants/script_constants.asm b/constants/script_constants.asm index bd03be5b9..fe5d2d7c4 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -9,6 +9,8 @@ LAST_TALKED EQU -2 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 diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 9c93eb8fc..9b50f2a7e 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -1750,7 +1750,7 @@ The exact cause of this bug is unknown. ld de, wStringBuffer1 ld a, BANK("Evolutions and Attacks") - ld bc, 10 -+ ld bc, wStringBuffer2 - wStringBuffer1 ++ ld bc, STRING_BUFFER_LENGTH call FarCopyBytes ``` diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index b1070e8d9..7876fb90e 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -4711,7 +4711,7 @@ GetStatName: .Copy: ld de, wStringBuffer2 - ld bc, wStringBuffer3 - wStringBuffer2 + ld bc, STRING_BUFFER_LENGTH jp CopyBytes INCLUDE "data/battle/stat_names.asm" diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index ea990d849..2e0cde341 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -73,7 +73,7 @@ AskTeachTMHM: 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 @@ ChooseMonToLearnTMHM_NoRefresh: 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 diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index a8b95d3b2..370edb5a2 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -1590,7 +1590,7 @@ GetStringBuffer: CopyConvertedText: ld hl, wStringBuffer3 - ld bc, wStringBuffer4 - wStringBuffer3 + ld bc, STRING_BUFFER_LENGTH call AddNTimes call CopyName2 ret diff --git a/wram.asm b/wram.asm index 121eb0bc7..64fcd5273 100644 --- a/wram.asm +++ b/wram.asm @@ -1675,7 +1675,8 @@ wBufferMonNick:: ds MON_NAME_LENGTH 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 @@ ENDU 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