Skip to content

Commit 628797b

Browse files
committed
Revise some RAM buffer constants
1 parent 59da8c8 commit 628797b

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

constants/pokemon_data_constants.asm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ DEF HOF_MON EQU $10
6464
DEF HOF_TEAM EQU PARTY_LENGTH * HOF_MON
6565
DEF HOF_TEAM_CAPACITY EQU 50
6666

67-
6867
; mon data locations
6968
; Note that some values are not supported by all functions that use these values.
7069
const_def
@@ -74,15 +73,14 @@ DEF HOF_TEAM_CAPACITY EQU 50
7473
const DAYCARE_DATA ; 3
7574
const BATTLE_MON_DATA ; 4
7675

77-
78-
; See data/pokemon/evos_moves.asm
79-
8076
; Evolution types
8177
const_def 1
8278
const EVOLVE_LEVEL ; 1
8379
const EVOLVE_ITEM ; 2
8480
const EVOLVE_TRADE ; 3
8581

82+
; evolution data (see data/pokemon/evos_moves.asm)
83+
DEF NUM_EVOS_IN_BUFFER EQU 3
8684

8785
; wMonHGrowthRate values
8886
; GrowthRateTable indexes (see data/growth_rates.asm)

constants/text_constants.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
DEF NAME_LENGTH EQU 11
2-
DEF ITEM_NAME_LENGTH EQU 13
1+
DEF NAME_LENGTH EQU 11
2+
DEF ITEM_NAME_LENGTH EQU 13
33
DEF NAME_BUFFER_LENGTH EQU 20
44

55
; PrintNumber, PrintBCDNumber
@@ -8,9 +8,9 @@ DEF NAME_BUFFER_LENGTH EQU 20
88
const BIT_LEFT_ALIGN ; 6
99
const BIT_LEADING_ZEROES ; 7
1010

11-
DEF MONEY_SIGN EQU (1 << BIT_MONEY_SIGN)
12-
DEF LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN)
13-
DEF LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES)
11+
DEF MONEY_SIGN EQU 1 << BIT_MONEY_SIGN
12+
DEF LEFT_ALIGN EQU 1 << BIT_LEFT_ALIGN
13+
DEF LEADING_ZEROES EQU 1 << BIT_LEADING_ZEROES
1414

1515
; special text IDs (see home/text_script.asm)
1616
const_def $d0

engine/items/item_effects.asm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ ItemUseTMHM:
21952195
.chooseMon
21962196
ld hl, wStringBuffer
21972197
ld de, wTempMoveNameBuffer
2198-
ld bc, 14
2198+
ld bc, ITEM_NAME_LENGTH + 1
21992199
call CopyData ; save the move name because DisplayPartyMenu will overwrite it
22002200
ld a, $ff
22012201
ld [wUpdateSpritesEnabled], a
@@ -2205,7 +2205,7 @@ ItemUseTMHM:
22052205
push af
22062206
ld hl, wTempMoveNameBuffer
22072207
ld de, wStringBuffer
2208-
ld bc, 14
2208+
ld bc, ITEM_NAME_LENGTH + 1
22092209
call CopyData
22102210
pop af
22112211
jr nc, .checkIfAbleToLearnMove

engine/menus/party_menu.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ RedrawPartyMenu_::
131131
ld l, a
132132
ld de, wEvoDataBuffer
133133
ld a, BANK(EvosMovesPointerTable)
134-
ld bc, 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator
134+
ld bc, wEvoDataBufferEnd - wEvoDataBuffer
135135
call FarCopyData
136136
ld hl, wEvoDataBuffer
137137
ld de, .notAbleToEvolveText

engine/overworld/wild_mons.asm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ LoadWildData::
1616
jr z, .NoGrassData ; if no grass data, skip to surfing data
1717
push hl
1818
ld de, wGrassMons ; otherwise, load grass data
19-
ld bc, $14
19+
ld bc, WILDDATA_LENGTH - 1
2020
call CopyData
2121
pop hl
22-
ld bc, $14
22+
ld bc, WILDDATA_LENGTH - 1
2323
add hl, bc
2424
.NoGrassData
2525
ld a, [hli]
2626
ld [wWaterRate], a
2727
and a
2828
ret z ; if no water data, we're done
2929
ld de, wWaterMons ; otherwise, load surfing data
30-
ld bc, $14
30+
ld bc, WILDDATA_LENGTH - 1
3131
jp CopyData
3232

3333
INCLUDE "data/wild/grass_water.asm"

ram/wram.asm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ wDownscaledMonSize::
890890
; FormatMovesString stores the number of moves minus one here
891891
wNumMovesMinusOne:: db
892892

893+
; This union spans 20 bytes.
893894
UNION
894895
; storage buffer for various name strings
895896
wNameBuffer:: ds NAME_BUFFER_LENGTH
@@ -905,7 +906,8 @@ wPayDayMoney:: ds 3
905906

906907
NEXTU
907908
; evolution data for one mon
908-
wEvoDataBuffer:: ds 4 * 3 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator
909+
wEvoDataBuffer:: ds NUM_EVOS_IN_BUFFER * 4 + 1 ; enough for Eevee's three 4-byte evolutions and 0 terminator
910+
wEvoDataBufferEnd::
909911

910912
NEXTU
911913
wBattleMenuCurrentPP:: db
@@ -1068,7 +1070,7 @@ wPartyMenuBlkPacket:: ds $30
10681070
NEXTU
10691071
ds 29
10701072
; storage buffer for various strings
1071-
wStringBuffer:: ds 20
1073+
wStringBuffer:: ds NAME_BUFFER_LENGTH
10721074

10731075
NEXTU
10741076
ds 29
@@ -1206,7 +1208,7 @@ wTrainerPicPointer:: dw
12061208
ds 1
12071209

12081210
UNION
1209-
wTempMoveNameBuffer:: ds 14
1211+
wTempMoveNameBuffer:: ds ITEM_NAME_LENGTH + 1
12101212

12111213
NEXTU
12121214
; The name of the mon that is learning a move.
@@ -2136,12 +2138,12 @@ wEventFlags:: flag_array NUM_EVENTS
21362138

21372139
UNION
21382140
wGrassRate:: db
2139-
wGrassMons:: ds 10 * 2
2141+
wGrassMons:: ds WILDDATA_LENGTH - 1
21402142

21412143
ds 8
21422144

21432145
wWaterRate:: db
2144-
wWaterMons:: ds 10 * 2
2146+
wWaterMons:: ds WILDDATA_LENGTH - 1
21452147

21462148
NEXTU
21472149
; linked game's trainer name

0 commit comments

Comments
 (0)