Skip to content

Commit 15ae47a

Browse files
committed
Separate constants for name types and naming screen types
1 parent 3e2121b commit 15ae47a

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

constants/menu_constants.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ DEF NUM_PARTYMENUACTIONS EQU const_value
126126
const NAME_FRIEND
127127
const NAME_6 ; duplicate of NAME_MON
128128
const NAME_7 ; duplicate of NAME_MON
129-
DEF NUM_NAME_TYPES EQU const_value
129+
DEF NUM_NAMING_SCREEN_TYPES EQU const_value

constants/text_constants.asm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ DEF NAME_LENGTH_JAPANESE EQU 6
1818
const ENEMY_OT_NAME ; 6
1919
const TRAINER_NAME ; 7
2020
const MOVE_DESC_NAME_BROKEN ; 8
21+
DEF NUM_NAME_TYPES EQU const_value - 1
2122

2223
; see home/text.asm
2324
DEF BORDER_WIDTH EQU 2

engine/menus/naming_screen.asm

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,29 @@ NamingScreen:
6161

6262
.GetNamingScreenSetup:
6363
ld a, [wNamingScreenType]
64-
maskbits NUM_NAME_TYPES
64+
maskbits NUM_NAMING_SCREEN_TYPES
6565
ld e, a
6666
ld d, 0
67-
ld hl, .Jumptable
67+
ld hl, NamingScreenJumptable
6868
add hl, de
6969
add hl, de
7070
ld a, [hli]
7171
ld h, [hl]
7272
ld l, a
7373
jp hl
7474

75-
.Jumptable:
76-
; entries correspond to NAME_* constants
75+
NamingScreenJumptable:
76+
; entries correspond to NAME_* constants (see constants/menu_constants.asm)
77+
table_width 2
7778
dw .Pokemon
7879
dw .Player
7980
dw .Rival
8081
dw .Mom
8182
dw .Box
82-
dw .Tomodachi
83+
dw .Friend
8384
dw .Pokemon
8485
dw .Pokemon
86+
assert_table_length NUM_NAMING_SCREEN_TYPES
8587

8688
.Pokemon:
8789
ld a, [wCurPartySpecies]
@@ -180,14 +182,14 @@ NamingScreen:
180182
.BoxNameString:
181183
db "BOX NAME?@"
182184

183-
.Tomodachi:
185+
.Friend:
184186
hlcoord 3, 2
185-
ld de, .oTomodachi_no_namae_sutoringu
187+
ld de, .FriendsNameString
186188
call PlaceString
187189
call .StoreSpriteIconParams
188190
ret
189191

190-
.oTomodachi_no_namae_sutoringu
192+
.FriendsNameString:
191193
db "おともだち の なまえは?@"
192194

193195
.LoadSprite:

home/names.asm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
NamesPointers::
22
; entries correspond to GetName constants (see constants/text_constants.asm)
3+
table_width 3
34
dba PokemonNames ; MON_NAME (not used; jumps to GetPokemonName)
45
dba MoveNames ; MOVE_NAME
56
dba NULL ; DUMMY_NAME
@@ -8,6 +9,7 @@ NamesPointers::
89
dbw 0, wOTPartyMonOTs ; ENEMY_OT_NAME
910
dba TrainerClassNames ; TRAINER_NAME
1011
dbw 4, MoveDescriptions ; MOVE_DESC_NAME_BROKEN (wrong bank)
12+
assert_table_length NUM_NAME_TYPES
1113

1214
GetName::
1315
; Return name wCurSpecies from name list wNamedObjectType in wStringBuffer1.

0 commit comments

Comments
 (0)