aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRangi <sylvie.oukaour+rangi42@gmail.com>2025-09-26 16:55:23 -0400
committerRangi <sylvie.oukaour+rangi42@gmail.com>2025-09-26 16:55:23 -0400
commit628797baffe7ea7dd4b224116d9704c7ae1b9c29 (patch)
treec018e77ef1f05cf777f3349f04165a1c78d2dc3d
parentClean up home/copy2.asm (#531) (diff)
downloadpokeyellow-628797baffe7ea7dd4b224116d9704c7ae1b9c29.tar.gz
pokeyellow-628797baffe7ea7dd4b224116d9704c7ae1b9c29.tar.xz
pokeyellow-628797baffe7ea7dd4b224116d9704c7ae1b9c29.zip
Revise some RAM buffer constants
-rw-r--r--constants/pokemon_data_constants.asm6
-rw-r--r--constants/text_constants.asm10
-rw-r--r--engine/items/item_effects.asm4
-rw-r--r--engine/menus/party_menu.asm2
-rw-r--r--engine/overworld/wild_mons.asm6
-rw-r--r--ram/wram.asm12
6 files changed, 20 insertions, 20 deletions
diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm
index e174f78d..1234acab 100644
--- a/constants/pokemon_data_constants.asm
+++ b/constants/pokemon_data_constants.asm
@@ -64,7 +64,6 @@ DEF HOF_MON EQU $10
DEF HOF_TEAM EQU PARTY_LENGTH * HOF_MON
DEF HOF_TEAM_CAPACITY EQU 50
-
; mon data locations
; Note that some values are not supported by all functions that use these values.
const_def
@@ -74,15 +73,14 @@ DEF HOF_TEAM_CAPACITY EQU 50
const DAYCARE_DATA ; 3
const BATTLE_MON_DATA ; 4
-
-; See data/pokemon/evos_moves.asm
-
; Evolution types
const_def 1
const EVOLVE_LEVEL ; 1
const EVOLVE_ITEM ; 2
const EVOLVE_TRADE ; 3
+; evolution data (see data/pokemon/evos_moves.asm)
+DEF NUM_EVOS_IN_BUFFER EQU 3
; wMonHGrowthRate values
; GrowthRateTable indexes (see data/growth_rates.asm)
diff --git a/constants/text_constants.asm b/constants/text_constants.asm
index d4e259fe..4dbdf666 100644
--- a/constants/text_constants.asm
+++ b/constants/text_constants.asm
@@ -1,5 +1,5 @@
-DEF NAME_LENGTH EQU 11
-DEF ITEM_NAME_LENGTH EQU 13
+DEF NAME_LENGTH EQU 11
+DEF ITEM_NAME_LENGTH EQU 13
DEF NAME_BUFFER_LENGTH EQU 20
; PrintNumber, PrintBCDNumber
@@ -8,9 +8,9 @@ DEF NAME_BUFFER_LENGTH EQU 20
const BIT_LEFT_ALIGN ; 6
const BIT_LEADING_ZEROES ; 7
-DEF MONEY_SIGN EQU (1 << BIT_MONEY_SIGN)
-DEF LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN)
-DEF LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES)
+DEF MONEY_SIGN EQU 1 << BIT_MONEY_SIGN
+DEF LEFT_ALIGN EQU 1 << BIT_LEFT_ALIGN
+DEF LEADING_ZEROES EQU 1 << BIT_LEADING_ZEROES
; special text IDs (see home/text_script.asm)
const_def $d0
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index 8a96c517..1b68e47a 100644
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -2195,7 +2195,7 @@ ItemUseTMHM:
.chooseMon
ld hl, wStringBuffer
ld de, wTempMoveNameBuffer
- ld bc, 14
+ ld bc, ITEM_NAME_LENGTH + 1
call CopyData ; save the move name because DisplayPartyMenu will overwrite it
ld a, $ff
ld [wUpdateSpritesEnabled], a
@@ -2205,7 +2205,7 @@ ItemUseTMHM:
push af
ld hl, wTempMoveNameBuffer
ld de, wStringBuffer
- ld bc, 14
+ ld bc, ITEM_NAME_LENGTH + 1
call CopyData
pop af
jr nc, .checkIfAbleToLearnMove
diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm
index e6388b5f..81472c31 100644
--- a/engine/menus/party_menu.asm
+++ b/engine/menus/party_menu.asm
@@ -131,7 +131,7 @@ RedrawPartyMenu_::
ld l, a
ld de, wEvoDataBuffer
ld a, BANK(EvosMovesPointerTable)
- ld bc, 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator
+ ld bc, wEvoDataBufferEnd - wEvoDataBuffer
call FarCopyData
ld hl, wEvoDataBuffer
ld de, .notAbleToEvolveText
diff --git a/engine/overworld/wild_mons.asm b/engine/overworld/wild_mons.asm
index 2593e0ec..2b186e75 100644
--- a/engine/overworld/wild_mons.asm
+++ b/engine/overworld/wild_mons.asm
@@ -16,10 +16,10 @@ LoadWildData::
jr z, .NoGrassData ; if no grass data, skip to surfing data
push hl
ld de, wGrassMons ; otherwise, load grass data
- ld bc, $14
+ ld bc, WILDDATA_LENGTH - 1
call CopyData
pop hl
- ld bc, $14
+ ld bc, WILDDATA_LENGTH - 1
add hl, bc
.NoGrassData
ld a, [hli]
@@ -27,7 +27,7 @@ LoadWildData::
and a
ret z ; if no water data, we're done
ld de, wWaterMons ; otherwise, load surfing data
- ld bc, $14
+ ld bc, WILDDATA_LENGTH - 1
jp CopyData
INCLUDE "data/wild/grass_water.asm"
diff --git a/ram/wram.asm b/ram/wram.asm
index 504eb646..0121b065 100644
--- a/ram/wram.asm
+++ b/ram/wram.asm
@@ -890,6 +890,7 @@ wDownscaledMonSize::
; FormatMovesString stores the number of moves minus one here
wNumMovesMinusOne:: db
+; This union spans 20 bytes.
UNION
; storage buffer for various name strings
wNameBuffer:: ds NAME_BUFFER_LENGTH
@@ -905,7 +906,8 @@ wPayDayMoney:: ds 3
NEXTU
; evolution data for one mon
-wEvoDataBuffer:: ds 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator
+wEvoDataBuffer:: ds NUM_EVOS_IN_BUFFER * 4 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator
+wEvoDataBufferEnd::
NEXTU
wBattleMenuCurrentPP:: db
@@ -1068,7 +1070,7 @@ wPartyMenuBlkPacket:: ds $30
NEXTU
ds 29
; storage buffer for various strings
-wStringBuffer:: ds 20
+wStringBuffer:: ds NAME_BUFFER_LENGTH
NEXTU
ds 29
@@ -1206,7 +1208,7 @@ wTrainerPicPointer:: dw
ds 1
UNION
-wTempMoveNameBuffer:: ds 14
+wTempMoveNameBuffer:: ds ITEM_NAME_LENGTH + 1
NEXTU
; The name of the mon that is learning a move.
@@ -2136,12 +2138,12 @@ wEventFlags:: flag_array NUM_EVENTS
UNION
wGrassRate:: db
-wGrassMons:: ds 10 * 2
+wGrassMons:: ds WILDDATA_LENGTH - 1
ds 8
wWaterRate:: db
-wWaterMons:: ds 10 * 2
+wWaterMons:: ds WILDDATA_LENGTH - 1
NEXTU
; linked game's trainer name