mirror of
https://github.com/pret/pokeyellow.git
synced 2026-03-21 17:34:31 -05:00
Specify a max item length for list_start (#552)
This commit is contained in:
parent
e9d3324bc0
commit
d79c578abd
|
|
@ -1,9 +1,11 @@
|
|||
DEF PLAYER_NAME_LENGTH EQU 8
|
||||
DEF NAME_LENGTH EQU 11
|
||||
DEF ITEM_NAME_LENGTH EQU 13
|
||||
DEF MOVE_NAME_LENGTH EQU 14
|
||||
DEF NAME_BUFFER_LENGTH EQU 20
|
||||
DEF GYM_CITY_LENGTH EQU 17
|
||||
DEF PLAYER_NAME_LENGTH EQU 8
|
||||
DEF STAT_NAME_LENGTH EQU 10
|
||||
DEF NAME_LENGTH EQU 11
|
||||
DEF ITEM_NAME_LENGTH EQU 13
|
||||
DEF TRAINER_NAME_LENGTH EQU 13
|
||||
DEF MOVE_NAME_LENGTH EQU 14
|
||||
DEF GYM_CITY_LENGTH EQU 17
|
||||
DEF NAME_BUFFER_LENGTH EQU 20
|
||||
|
||||
; PrintNumber, PrintBCDNumber
|
||||
const_def 5
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
; The relevant move effect IDs correspond to the stats
|
||||
|
||||
StatModTextStrings:
|
||||
list_start
|
||||
list_start STAT_NAME_LENGTH - 1
|
||||
li "ATTACK"
|
||||
li "DEFENSE"
|
||||
li "SPEED"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
; Stats that vitamins can raise or lower
|
||||
|
||||
VitaminStats:
|
||||
list_start
|
||||
list_start STAT_NAME_LENGTH - 1
|
||||
li "HEALTH"
|
||||
li "ATTACK"
|
||||
li "DEFENSE"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
ItemNames::
|
||||
list_start
|
||||
list_start ITEM_NAME_LENGTH - 1
|
||||
li "MASTER BALL"
|
||||
li "ULTRA BALL"
|
||||
li "GREAT BALL"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
MoveNames::
|
||||
list_start
|
||||
; in-battle "used <move name>!" text can only fit 12 (MOVE_NAME_LENGTH - 2) characters
|
||||
list_start MOVE_NAME_LENGTH - 2
|
||||
li "POUND"
|
||||
li "KARATE CHOP"
|
||||
li "DOUBLESLAP"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
DefaultNamesPlayerList:
|
||||
db "NEW NAME@"
|
||||
list_start
|
||||
list_start PLAYER_NAME_LENGTH - 1
|
||||
FOR n, 1, NUM_PLAYER_NAMES + 1
|
||||
li #PLAYERNAME{d:n}
|
||||
ENDR
|
||||
|
|
@ -10,7 +10,7 @@ ENDR
|
|||
|
||||
DefaultNamesRivalList:
|
||||
db "NEW NAME@"
|
||||
list_start
|
||||
list_start PLAYER_NAME_LENGTH - 1
|
||||
FOR n, 1, NUM_PLAYER_NAMES + 1
|
||||
li #RIVALNAME{d:n}
|
||||
ENDR
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
DEF __move_choices__ = 0
|
||||
|
||||
MACRO move_choices
|
||||
IF _NARG
|
||||
db \# ; all args
|
||||
ENDC
|
||||
db 0 ; end
|
||||
DEF list_index += 1
|
||||
DEF __move_choices__ += 1
|
||||
ENDM
|
||||
|
||||
; move choice modification methods that are applied for each trainer class
|
||||
TrainerClassMoveChoiceModifications:
|
||||
list_start
|
||||
move_choices ; YOUNGSTER
|
||||
move_choices 1 ; BUG CATCHER
|
||||
move_choices 1 ; LASS
|
||||
|
|
@ -56,4 +57,5 @@ TrainerClassMoveChoiceModifications:
|
|||
move_choices 1 ; CHANNELER
|
||||
move_choices 1 ; AGATHA
|
||||
move_choices 1, 3 ; LANCE
|
||||
assert_list_length NUM_TRAINERS
|
||||
assert __move_choices__ == NUM_TRAINERS, \
|
||||
"TrainerClassMoveChoiceModifications: expected {d:NUM_TRAINERS} entries, got {d:__move_choices__}"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
TrainerNames::
|
||||
list_start
|
||||
list_start TRAINER_NAME_LENGTH - 1
|
||||
li "YOUNGSTER"
|
||||
li "BUG CATCHER"
|
||||
li "LASS"
|
||||
|
|
|
|||
|
|
@ -754,7 +754,7 @@ PrintStatText:
|
|||
jr .findStatName_inner
|
||||
.foundStatName
|
||||
ld de, wStringBuffer
|
||||
ld bc, NAME_LENGTH - 1 ; all StatModTextStrings are at most 10 bytes
|
||||
ld bc, STAT_NAME_LENGTH
|
||||
jp CopyData
|
||||
|
||||
INCLUDE "data/battle/stat_mod_names.asm"
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ GetTrainerName_::
|
|||
ld hl, wNameBuffer
|
||||
.foundName
|
||||
ld de, wTrainerName
|
||||
ld bc, ITEM_NAME_LENGTH
|
||||
ld bc, TRAINER_NAME_LENGTH
|
||||
jp CopyData
|
||||
|
|
|
|||
|
|
@ -1308,7 +1308,7 @@ ItemUseMedicine:
|
|||
jr .statNameLoop
|
||||
.gotStatName
|
||||
ld de, wStringBuffer
|
||||
ld bc, NAME_LENGTH - 1 ; all VitaminStats are at most 10 bytes
|
||||
ld bc, STAT_NAME_LENGTH
|
||||
call CopyData ; copy the stat's name to wStringBuffer
|
||||
ld a, SFX_HEAL_AILMENT
|
||||
call PlaySound
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ MACRO? _redef_current_label
|
|||
IF DEF(\1)
|
||||
PURGE \1
|
||||
ENDC
|
||||
IF _NARG == 3 + (\3)
|
||||
DEF \1 EQUS "\<_NARG>"
|
||||
IF _NARG > 2
|
||||
DEF \1 EQUS "\3"
|
||||
ELIF STRLEN(#__SCOPE__)
|
||||
IF {{__SCOPE__}} - @ == 0
|
||||
DEF \1 EQUS #{__SCOPE__}
|
||||
|
|
@ -19,7 +19,8 @@ ENDM
|
|||
|
||||
MACRO? table_width
|
||||
DEF CURRENT_TABLE_WIDTH = \1
|
||||
_redef_current_label CURRENT_TABLE_START, "._table_width\@", 2, \#
|
||||
SHIFT
|
||||
_redef_current_label CURRENT_TABLE_START, "._table_width\@", \#
|
||||
ENDM
|
||||
|
||||
MACRO? assert_table_length
|
||||
|
|
@ -40,11 +41,20 @@ ENDM
|
|||
|
||||
MACRO? list_start
|
||||
DEF list_index = 0
|
||||
_redef_current_label CURRENT_LIST_START, "._list_start\@", 1, \#
|
||||
DEF list_item_length = 0
|
||||
IF _NARG > 0
|
||||
DEF list_item_length = \1
|
||||
SHIFT
|
||||
ENDC
|
||||
_redef_current_label CURRENT_LIST_START, "._list_start\@", \#
|
||||
ENDM
|
||||
|
||||
MACRO? li
|
||||
ASSERT STRFIND(\1, "@") == -1, "String terminator \"@\" in list entry: \1"
|
||||
IF list_item_length
|
||||
ASSERT CHARLEN(\1) <= list_item_length, \
|
||||
"List entry longer than {d:list_item_length} characters: \1"
|
||||
ENDC
|
||||
db \1, "@"
|
||||
DEF list_index += 1
|
||||
ENDM
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user