You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Verify data table sizes with table_width and assert_table_length macros
This was discussed in #706 It also uncovered some off-by-one issues with defining some constants. A few structs now use rsreset/_RS to define their offset constants, as discussed in #739
This commit is contained in:
@@ -27,7 +27,7 @@ BattleCommand_Conversion2:
|
||||
|
||||
.loop
|
||||
call BattleRandom
|
||||
maskbits NUM_TYPES
|
||||
maskbits TYPES_END
|
||||
cp UNUSED_TYPES
|
||||
jr c, .okay
|
||||
cp UNUSED_TYPES_END
|
||||
|
||||
@@ -31,7 +31,7 @@ InitBattleAnimation:
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, BattleAnimObjects
|
||||
rept 6
|
||||
rept BATTLEANIMOBJ_LENGTH
|
||||
add hl, de
|
||||
endr
|
||||
ld e, l
|
||||
|
||||
@@ -99,7 +99,7 @@ DebugColor_InitMonColor:
|
||||
DebugColor_InitTrainerColor:
|
||||
ld hl, TrainerPalettes
|
||||
ld de, wDebugOriginalColors
|
||||
ld c, NUM_TRAINER_CLASSES
|
||||
ld c, NUM_TRAINER_CLASSES + 1
|
||||
.loop
|
||||
push bc
|
||||
push hl
|
||||
@@ -284,7 +284,7 @@ DebugColorMain:
|
||||
ld a, NUM_POKEMON ; CELEBI
|
||||
ret
|
||||
.trainer
|
||||
ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN
|
||||
ld a, NUM_TRAINER_CLASSES ; MYSTICALMAN
|
||||
ret
|
||||
|
||||
.Jumptable:
|
||||
|
||||
@@ -1305,7 +1305,9 @@ MapObjectPals::
|
||||
INCLUDE "gfx/overworld/npc_sprites.pal"
|
||||
|
||||
RoofPals:
|
||||
table_width PAL_COLOR_SIZE * 2 * 2, RoofPals
|
||||
INCLUDE "gfx/tilesets/roofs.pal"
|
||||
assert_table_length NUM_MAP_GROUPS + 1
|
||||
|
||||
DiplomaPalettes:
|
||||
INCLUDE "gfx/diploma/diploma.pal"
|
||||
|
||||
@@ -311,7 +311,7 @@ GetTrainerPic:
|
||||
ld a, [wTrainerClass]
|
||||
and a
|
||||
ret z
|
||||
cp NUM_TRAINER_CLASSES
|
||||
cp NUM_TRAINER_CLASSES + 1
|
||||
ret nc
|
||||
call WaitBGMap
|
||||
xor a
|
||||
|
||||
@@ -12,7 +12,8 @@ DoAnimFrame:
|
||||
jp hl
|
||||
|
||||
.Jumptable:
|
||||
; entries correspond to SPRITE_ANIM_SEQ_* constants
|
||||
; entries correspond to SPRITE_ANIM_SEQ_* constants (see constants/sprite_anim_constants.asm)
|
||||
table_width 2, DoAnimFrame.Jumptable
|
||||
dw AnimSeq_Null
|
||||
dw AnimSeq_PartyMon
|
||||
dw AnimSeq_PartyMonSwitch
|
||||
@@ -48,6 +49,7 @@ DoAnimFrame:
|
||||
dw AnimSeq_IntroUnown
|
||||
dw AnimSeq_IntroUnownF
|
||||
dw AnimSeq_IntroSuicuneAway
|
||||
assert_table_length NUM_SPRITE_ANIM_SEQS
|
||||
|
||||
AnimSeq_Null:
|
||||
ret
|
||||
|
||||
@@ -12,7 +12,8 @@ _DoItemEffect::
|
||||
ret
|
||||
|
||||
ItemEffects:
|
||||
; entries correspond to item ids
|
||||
; entries correspond to item ids (see constants/item_constants.asm)
|
||||
table_width 2, ItemEffects
|
||||
dw PokeBallEffect ; MASTER_BALL
|
||||
dw PokeBallEffect ; ULTRA_BALL
|
||||
dw NoEffect ; BRIGHTPOWDER
|
||||
@@ -192,6 +193,21 @@ ItemEffects:
|
||||
dw PokeBallEffect ; PARK_BALL
|
||||
dw NoEffect ; RAINBOW_WING
|
||||
dw NoEffect ; ITEM_B3
|
||||
assert_table_length ITEM_B3
|
||||
; The items past ITEM_B3 do not have effect entries:
|
||||
; BRICK_PIECE
|
||||
; SURF_MAIL
|
||||
; LITEBLUEMAIL
|
||||
; PORTRAITMAIL
|
||||
; LOVELY_MAIL
|
||||
; EON_MAIL
|
||||
; MORPH_MAIL
|
||||
; BLUESKY_MAIL
|
||||
; MUSIC_MAIL
|
||||
; MIRAGE_MAIL
|
||||
; ITEM_BE
|
||||
; They all have the ITEMMENU_NOUSE attribute so they can't be used anyway.
|
||||
; NoEffect would be appropriate, with the table then being NUM_ITEMS long.
|
||||
|
||||
PokeBallEffect:
|
||||
ld a, [wBattleMode]
|
||||
|
||||
@@ -23,7 +23,7 @@ _PlayerDecorationMenu:
|
||||
ld [wCurDecorationCategory], a
|
||||
jr c, .exit_menu
|
||||
ld a, [wMenuSelection]
|
||||
ld hl, .pointers
|
||||
ld hl, .category_pointers
|
||||
call MenuJumptable
|
||||
jr nc, .top_loop
|
||||
|
||||
@@ -46,26 +46,28 @@ _PlayerDecorationMenu:
|
||||
db 0 ; items
|
||||
dw wNumOwnedDecoCategories
|
||||
dw PlaceNthMenuStrings
|
||||
dw .pointers
|
||||
dw .category_pointers
|
||||
|
||||
.pointers
|
||||
dw DecoBedMenu, .bed
|
||||
dw DecoCarpetMenu, .carpet
|
||||
dw DecoPlantMenu, .plant
|
||||
dw DecoPosterMenu, .poster
|
||||
dw DecoConsoleMenu, .game
|
||||
.category_pointers:
|
||||
table_width 2 + 2, _PlayerDecorationMenu.category_pointers
|
||||
dw DecoBedMenu, .bed
|
||||
dw DecoCarpetMenu, .carpet
|
||||
dw DecoPlantMenu, .plant
|
||||
dw DecoPosterMenu, .poster
|
||||
dw DecoConsoleMenu, .game
|
||||
dw DecoOrnamentMenu, .ornament
|
||||
dw DecoBigDollMenu, .big_doll
|
||||
dw DecoExitMenu, .exit
|
||||
dw DecoBigDollMenu, .big_doll
|
||||
dw DecoExitMenu, .exit
|
||||
assert_table_length NUM_DECO_CATEGORIES + 1
|
||||
|
||||
.bed db "BED@"
|
||||
.carpet db "CARPET@"
|
||||
.plant db "PLANT@"
|
||||
.poster db "POSTER@"
|
||||
.game db "GAME CONSOLE@"
|
||||
.ornament db "ORNAMENT@"
|
||||
.big_doll db "BIG DOLL@"
|
||||
.exit db "EXIT@"
|
||||
.bed: db "BED@"
|
||||
.carpet: db "CARPET@"
|
||||
.plant: db "PLANT@"
|
||||
.poster: db "POSTER@"
|
||||
.game: db "GAME CONSOLE@"
|
||||
.ornament: db "ORNAMENT@"
|
||||
.big_doll: db "BIG DOLL@"
|
||||
.exit: db "EXIT@"
|
||||
|
||||
.FindCategoriesWithOwnedDecos:
|
||||
xor a
|
||||
@@ -99,7 +101,7 @@ _PlayerDecorationMenu:
|
||||
ret
|
||||
|
||||
.FindOwnedDecos:
|
||||
ld hl, .dw
|
||||
ld hl, .owned_pointers
|
||||
.loop
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
@@ -121,14 +123,16 @@ _PlayerDecorationMenu:
|
||||
.done
|
||||
ret
|
||||
|
||||
.dw
|
||||
dwb FindOwnedBeds, 0 ; bed
|
||||
dwb FindOwnedCarpets, 1 ; carpet
|
||||
dwb FindOwnedPlants, 2 ; plant
|
||||
dwb FindOwnedPosters, 3 ; poster
|
||||
dwb FindOwnedConsoles, 4 ; game console
|
||||
.owned_pointers:
|
||||
table_width 3, _PlayerDecorationMenu.owned_pointers
|
||||
dwb FindOwnedBeds, 0 ; bed
|
||||
dwb FindOwnedCarpets, 1 ; carpet
|
||||
dwb FindOwnedPlants, 2 ; plant
|
||||
dwb FindOwnedPosters, 3 ; poster
|
||||
dwb FindOwnedConsoles, 4 ; game console
|
||||
dwb FindOwnedOrnaments, 5 ; ornament
|
||||
dwb FindOwnedBigDolls, 6 ; big doll
|
||||
dwb FindOwnedBigDolls, 6 ; big doll
|
||||
assert_table_length NUM_DECO_CATEGORIES
|
||||
dw 0 ; end
|
||||
|
||||
Deco_FillTempWithMinusOne:
|
||||
@@ -200,7 +204,7 @@ FindOwnedBeds:
|
||||
ld c, BEDS
|
||||
jp FindOwnedDecosInCategory
|
||||
|
||||
.beds
|
||||
.beds:
|
||||
db DECO_FEATHERY_BED ; 2
|
||||
db DECO_PINK_BED ; 3
|
||||
db DECO_POLKADOT_BED ; 4
|
||||
@@ -218,7 +222,7 @@ FindOwnedCarpets:
|
||||
ld c, CARPETS
|
||||
jp FindOwnedDecosInCategory
|
||||
|
||||
.carpets
|
||||
.carpets:
|
||||
db DECO_RED_CARPET ; 7
|
||||
db DECO_BLUE_CARPET ; 8
|
||||
db DECO_YELLOW_CARPET ; 9
|
||||
@@ -236,7 +240,7 @@ FindOwnedPlants:
|
||||
ld c, PLANTS
|
||||
jp FindOwnedDecosInCategory
|
||||
|
||||
.plants
|
||||
.plants:
|
||||
db DECO_MAGNAPLANT ; c
|
||||
db DECO_TROPICPLANT ; d
|
||||
db DECO_JUMBOPLANT ; e
|
||||
@@ -253,7 +257,7 @@ FindOwnedPosters:
|
||||
ld c, POSTERS
|
||||
jp FindOwnedDecosInCategory
|
||||
|
||||
.posters
|
||||
.posters:
|
||||
db DECO_TOWN_MAP ; 10
|
||||
db DECO_PIKACHU_POSTER ; 11
|
||||
db DECO_CLEFAIRY_POSTER ; 12
|
||||
@@ -271,7 +275,7 @@ FindOwnedConsoles:
|
||||
ld c, CONSOLES
|
||||
jp FindOwnedDecosInCategory
|
||||
|
||||
.consoles
|
||||
.consoles:
|
||||
db DECO_FAMICOM ; 15
|
||||
db DECO_SNES ; 16
|
||||
db DECO_N64 ; 17
|
||||
@@ -289,7 +293,7 @@ FindOwnedOrnaments:
|
||||
ld c, DOLLS
|
||||
jp FindOwnedDecosInCategory
|
||||
|
||||
.ornaments
|
||||
.ornaments:
|
||||
db DECO_PIKACHU_DOLL ; 1e
|
||||
db DECO_SURF_PIKACHU_DOLL ; 1f
|
||||
db DECO_CLEFAIRY_DOLL ; 20
|
||||
@@ -326,7 +330,7 @@ FindOwnedBigDolls:
|
||||
ld c, BIG_DOLLS
|
||||
jp FindOwnedDecosInCategory
|
||||
|
||||
.big_dolls
|
||||
.big_dolls:
|
||||
db DECO_BIG_SNORLAX_DOLL ; 1a
|
||||
db DECO_BIG_ONIX_DOLL ; 1b
|
||||
db DECO_BIG_LAPRAS_DOLL ; 1c
|
||||
@@ -419,7 +423,7 @@ PopulateDecoCategoryMenu:
|
||||
|
||||
GetDecorationData:
|
||||
ld hl, DecorationAttributes
|
||||
ld bc, 6
|
||||
ld bc, DECOATTR_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ret
|
||||
|
||||
@@ -443,7 +447,7 @@ DecorationMenuFunction:
|
||||
DoDecorationAction2:
|
||||
ld a, [wMenuSelection]
|
||||
call GetDecorationData
|
||||
ld de, 2 ; function 2
|
||||
ld de, DECOATTR_ACTION
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
ld hl, .DecoActions
|
||||
@@ -451,6 +455,7 @@ DoDecorationAction2:
|
||||
ret
|
||||
|
||||
.DecoActions:
|
||||
table_width 2, DoDecorationAction2.DecoActions
|
||||
dw DecoAction_nothing
|
||||
dw DecoAction_setupbed
|
||||
dw DecoAction_putawaybed
|
||||
@@ -466,10 +471,11 @@ DoDecorationAction2:
|
||||
dw DecoAction_putawaybigdoll
|
||||
dw DecoAction_setupornament
|
||||
dw DecoAction_putawayornament
|
||||
assert_table_length NUM_DECO_ACTIONS + 1
|
||||
|
||||
GetDecorationFlag:
|
||||
call GetDecorationData
|
||||
ld de, 3 ; event flag
|
||||
ld de, DECOATTR_EVENT_FLAG
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld d, [hl]
|
||||
@@ -486,7 +492,7 @@ DecorationFlagAction:
|
||||
GetDecorationSprite:
|
||||
ld a, c
|
||||
call GetDecorationData
|
||||
ld de, 5 ; sprite
|
||||
ld de, DECOATTR_SPRITE
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
ld c, a
|
||||
@@ -497,8 +503,8 @@ INCLUDE "data/decorations/attributes.asm"
|
||||
INCLUDE "data/decorations/names.asm"
|
||||
|
||||
GetDecoName:
|
||||
ld a, [hli]
|
||||
ld e, [hl]
|
||||
ld a, [hli] ; DECOATTR_TYPE
|
||||
ld e, [hl] ; DECOATTR_NAME
|
||||
ld bc, wStringBuffer2
|
||||
push bc
|
||||
ld hl, .NameFunctions
|
||||
@@ -507,6 +513,7 @@ GetDecoName:
|
||||
ret
|
||||
|
||||
.NameFunctions:
|
||||
table_width 2, GetDecoName.NameFunctions
|
||||
dw .invalid
|
||||
dw .plant
|
||||
dw .bed
|
||||
@@ -514,37 +521,38 @@ GetDecoName:
|
||||
dw .poster
|
||||
dw .doll
|
||||
dw .bigdoll
|
||||
assert_table_length NUM_DECO_TYPES + 1
|
||||
|
||||
.invalid
|
||||
.invalid:
|
||||
ret
|
||||
|
||||
.plant
|
||||
.plant:
|
||||
ld a, e
|
||||
jr .getdeconame
|
||||
|
||||
.bed
|
||||
.bed:
|
||||
call .plant
|
||||
ld a, _BED
|
||||
jr .getdeconame
|
||||
|
||||
.carpet
|
||||
.carpet:
|
||||
call .plant
|
||||
ld a, _CARPET
|
||||
jr .getdeconame
|
||||
|
||||
.poster
|
||||
.poster:
|
||||
ld a, e
|
||||
call .getpokename
|
||||
ld a, _POSTER
|
||||
jr .getdeconame
|
||||
|
||||
.doll
|
||||
.doll:
|
||||
ld a, e
|
||||
call .getpokename
|
||||
ld a, _DOLL
|
||||
jr .getdeconame
|
||||
|
||||
.bigdoll
|
||||
.bigdoll:
|
||||
push de
|
||||
ld a, BIG_
|
||||
call .getdeconame
|
||||
@@ -552,25 +560,25 @@ GetDecoName:
|
||||
ld a, e
|
||||
jr .getpokename
|
||||
|
||||
.unused ; unreferenced
|
||||
.unused: ; unreferenced
|
||||
push de
|
||||
call .getdeconame
|
||||
pop de
|
||||
ld a, e
|
||||
jr .getdeconame
|
||||
|
||||
.getpokename
|
||||
.getpokename:
|
||||
push bc
|
||||
ld [wNamedObjectIndex], a
|
||||
call GetPokemonName
|
||||
pop bc
|
||||
jr .copy
|
||||
|
||||
.getdeconame
|
||||
.getdeconame:
|
||||
call ._getdeconame
|
||||
jr .copy
|
||||
|
||||
._getdeconame
|
||||
._getdeconame:
|
||||
push bc
|
||||
ld hl, DecorationNames
|
||||
call GetNthString
|
||||
@@ -579,7 +587,7 @@ GetDecoName:
|
||||
pop bc
|
||||
ret
|
||||
|
||||
.copy
|
||||
.copy:
|
||||
ld h, b
|
||||
ld l, c
|
||||
call CopyName2
|
||||
@@ -968,11 +976,13 @@ DescribeDecoration::
|
||||
|
||||
.JumpTable:
|
||||
; entries correspond to DECODESC_* constants
|
||||
table_width 2, DescribeDecoration.JumpTable
|
||||
dw DecorationDesc_Poster
|
||||
dw DecorationDesc_LeftOrnament
|
||||
dw DecorationDesc_RightOrnament
|
||||
dw DecorationDesc_GiantOrnament
|
||||
dw DecorationDesc_Console
|
||||
assert_table_length NUM_DECODESCS
|
||||
|
||||
DecorationDesc_Poster:
|
||||
ld a, [wDecoPoster]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
ObjectActionPairPointers:
|
||||
; entries correspond to OBJECT_ACTION_* constants
|
||||
; entries correspond to OBJECT_ACTION_* constants (see constants/map_object_constants.asm)
|
||||
; normal action, frozen action
|
||||
table_width 2 + 2, ObjectActionPairPointers
|
||||
dw SetFacingStanding, SetFacingStanding
|
||||
dw SetFacingStandAction, SetFacingCurrent
|
||||
dw SetFacingStepAction, SetFacingCurrent
|
||||
@@ -18,6 +19,7 @@ ObjectActionPairPointers:
|
||||
dw SetFacingBoulderDust, SetFacingStanding
|
||||
dw SetFacingGrassShake, SetFacingStanding
|
||||
dw SetFacingSkyfall, SetFacingCurrent
|
||||
assert_table_length NUM_OBJECT_ACTIONS
|
||||
|
||||
SetFacingStanding:
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
|
||||
@@ -523,7 +523,8 @@ StepFunction_FromMovement:
|
||||
ret
|
||||
|
||||
.Pointers:
|
||||
; entries correspond to SPRITEMOVEFN_* constants
|
||||
; entries correspond to SPRITEMOVEFN_* constants (see constants/map_object_constants.asm)
|
||||
table_width 2, StepFunction_FromMovement.Pointers
|
||||
dw MovementFunction_Null ; 00
|
||||
dw MovementFunction_RandomWalkY ; 01
|
||||
dw MovementFunction_RandomWalkX ; 02
|
||||
@@ -552,6 +553,7 @@ StepFunction_FromMovement:
|
||||
dw MovementFunction_SpinCounterclockwise ; 19
|
||||
dw MovementFunction_BoulderDust ; 1a
|
||||
dw MovementFunction_ShakingGrass ; 1b
|
||||
assert_table_length NUM_SPRITEMOVEFN
|
||||
|
||||
MovementFunction_Null:
|
||||
ret
|
||||
@@ -1085,7 +1087,8 @@ _SetRandomStepDuration:
|
||||
ret
|
||||
|
||||
StepTypesJumptable:
|
||||
; entries correspond to STEP_TYPE_* constants
|
||||
; entries correspond to STEP_TYPE_* constants (see constants/map_object_constants.asm)
|
||||
table_width 2, StepTypesJumptable
|
||||
dw StepFunction_Reset ; 00
|
||||
dw StepFunction_FromMovement ; 01
|
||||
dw StepFunction_NPCWalk ; 02
|
||||
@@ -1112,6 +1115,7 @@ StepTypesJumptable:
|
||||
dw StepFunction_17 ; 17
|
||||
dw StepFunction_Delete ; 18
|
||||
dw StepFunction_SkyfallTop ; 19
|
||||
assert_table_length NUM_STEP_TYPES
|
||||
|
||||
WaitStep_InPlace:
|
||||
ld hl, OBJECT_STEP_DURATION
|
||||
|
||||
@@ -636,7 +636,7 @@ endr
|
||||
LoadEmote::
|
||||
; Get the address of the pointer to emote c.
|
||||
ld a, c
|
||||
ld bc, 6 ; sizeof(emote)
|
||||
ld bc, EMOTE_LENGTH
|
||||
ld hl, Emotes
|
||||
call AddNTimes
|
||||
; Load the emote address into de
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
DoPlayerMovement::
|
||||
|
||||
call .GetDPad
|
||||
ld a, movement_step_sleep
|
||||
ld [wMovementAnimation], a
|
||||
@@ -12,7 +11,6 @@ DoPlayerMovement::
|
||||
ret
|
||||
|
||||
.GetDPad:
|
||||
|
||||
ldh a, [hJoyDown]
|
||||
ld [wCurInput], a
|
||||
|
||||
@@ -469,7 +467,8 @@ DoPlayerMovement::
|
||||
ret
|
||||
|
||||
.Steps:
|
||||
; entries correspond to STEP_* constants
|
||||
; entries correspond to STEP_* constants (see constants/map_object_constants.asm)
|
||||
table_width 2, DoPlayerMovement.Steps
|
||||
dw .SlowStep
|
||||
dw .NormalStep
|
||||
dw .FastStep
|
||||
@@ -478,6 +477,7 @@ DoPlayerMovement::
|
||||
dw .TurningStep
|
||||
dw .BackJumpStep
|
||||
dw .FinishFacing
|
||||
assert_table_length NUM_STEPS
|
||||
|
||||
.SlowStep:
|
||||
slow_step DOWN
|
||||
|
||||
@@ -247,7 +247,7 @@ CheckSpecialPhoneCall::
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, SpecialPhoneCallList
|
||||
ld a, 6
|
||||
ld a, SPECIALCALL_SIZE
|
||||
call AddNTimes
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
@@ -291,7 +291,7 @@ CheckSpecialPhoneCall::
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, SpecialPhoneCallList
|
||||
ld a, 6
|
||||
ld a, SPECIALCALL_SIZE
|
||||
call AddNTimes
|
||||
ret
|
||||
|
||||
|
||||
@@ -1805,7 +1805,7 @@ Pokedex_PrevSearchMonType:
|
||||
jr .done
|
||||
|
||||
.wrap_around
|
||||
ld [hl], NUM_TYPES - 1
|
||||
ld [hl], NUM_TYPES
|
||||
|
||||
.done
|
||||
scf
|
||||
@@ -1818,7 +1818,7 @@ Pokedex_NextSearchMonType:
|
||||
|
||||
ld hl, wDexSearchMonType1
|
||||
ld a, [hl]
|
||||
cp NUM_TYPES - 1
|
||||
cp NUM_TYPES
|
||||
jr nc, .type1_wrap_around
|
||||
inc [hl]
|
||||
jr .done
|
||||
@@ -1829,7 +1829,7 @@ Pokedex_NextSearchMonType:
|
||||
.type2
|
||||
ld hl, wDexSearchMonType2
|
||||
ld a, [hl]
|
||||
cp NUM_TYPES - 1
|
||||
cp NUM_TYPES
|
||||
jr nc, .type2_wrap_around
|
||||
inc [hl]
|
||||
jr .done
|
||||
@@ -1862,7 +1862,7 @@ Pokedex_PlaceTypeString:
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, PokedexTypeSearchStrings
|
||||
rept 9
|
||||
rept POKEDEX_TYPE_STRING_LENGTH
|
||||
add hl, de
|
||||
endr
|
||||
ld e, l
|
||||
|
||||
@@ -20,6 +20,7 @@ PlayRadioShow:
|
||||
|
||||
RadioJumptable:
|
||||
; entries correspond to constants/radio_constants.asm
|
||||
table_width 2, RadioJumptable
|
||||
dw OaksPKMNTalk1 ; $00
|
||||
dw PokedexShow1 ; $01
|
||||
dw BenMonMusic1 ; $02
|
||||
@@ -31,6 +32,7 @@ RadioJumptable:
|
||||
dw PokeFluteRadio ; $08
|
||||
dw UnownRadio ; $09
|
||||
dw EvolutionRadio ; $0a
|
||||
assert_table_length NUM_RADIO_CHANNELS
|
||||
; OaksPKMNTalk
|
||||
dw OaksPKMNTalk2 ; $0b
|
||||
dw OaksPKMNTalk3 ; $0c
|
||||
@@ -116,6 +118,7 @@ RadioJumptable:
|
||||
dw PokedexShow6 ; $55
|
||||
dw PokedexShow7 ; $56
|
||||
dw PokedexShow8 ; $57
|
||||
assert_table_length NUM_RADIO_SEGMENTS
|
||||
|
||||
PrintRadioLine:
|
||||
ld [wNextRadioLine], a
|
||||
@@ -193,10 +196,9 @@ OaksPKMNTalk4:
|
||||
; Choose a random route, and a random Pokemon from that route.
|
||||
.sample
|
||||
call Random
|
||||
and %11111 ; maskbits NUM_OAKS_POKEMON_TALK_ROUTES would be more efficient
|
||||
cp NUM_OAKS_POKEMON_TALK_ROUTES
|
||||
and %11111
|
||||
cp (OaksPKMNTalkRoutes.End - OaksPKMNTalkRoutes) / 2
|
||||
jr nc, .sample
|
||||
; We now have a number between 0 and NUM_OAKS_POKEMON_TALK_ROUTES - 1.
|
||||
ld hl, OaksPKMNTalkRoutes
|
||||
ld c, a
|
||||
ld b, 0
|
||||
@@ -347,7 +349,7 @@ OaksPKMNTalk8:
|
||||
jp NextRadioLine
|
||||
|
||||
.Adverbs:
|
||||
; there are NUM_OAKS_POKEMON_TALK_ADVERBS entries
|
||||
table_width 2, OaksPKMNTalk8.Adverbs
|
||||
dw .OPT_SweetAdorablyText
|
||||
dw .OPT_WigglySlicklyText
|
||||
dw .OPT_AptlyNamedText
|
||||
@@ -364,6 +366,7 @@ OaksPKMNTalk8:
|
||||
dw .OPT_ProvocativelyText
|
||||
dw .OPT_FlippedOutText
|
||||
dw .OPT_HeartMeltinglyText
|
||||
assert_table_length NUM_OAKS_POKEMON_TALK_ADVERBS
|
||||
|
||||
.OPT_SweetAdorablyText:
|
||||
text_far _OPT_SweetAdorablyText
|
||||
@@ -455,7 +458,7 @@ OaksPKMNTalk9:
|
||||
jp NextRadioLine
|
||||
|
||||
.Adjectives:
|
||||
; there are NUM_OAKS_POKEMON_TALK_ADJECTIVES entries
|
||||
table_width 2, OaksPKMNTalk9.Adjectives
|
||||
dw .OPT_CuteText
|
||||
dw .OPT_WeirdText
|
||||
dw .OPT_PleasantText
|
||||
@@ -472,6 +475,7 @@ OaksPKMNTalk9:
|
||||
dw .OPT_GuardedText
|
||||
dw .OPT_LovelyText
|
||||
dw .OPT_SpeedyText
|
||||
assert_table_length NUM_OAKS_POKEMON_TALK_ADJECTIVES
|
||||
|
||||
.OPT_CuteText:
|
||||
text_far _OPT_CuteText
|
||||
@@ -1090,7 +1094,7 @@ PeoplePlaces4: ; People
|
||||
call Random
|
||||
maskbits NUM_TRAINER_CLASSES
|
||||
inc a
|
||||
cp NUM_TRAINER_CLASSES - 1 ; omit MYSTICALMAN
|
||||
cp NUM_TRAINER_CLASSES
|
||||
jr nc, PeoplePlaces4
|
||||
push af
|
||||
ld hl, PnP_HiddenPeople
|
||||
@@ -1154,7 +1158,7 @@ PeoplePlaces5:
|
||||
jp NextRadioLine
|
||||
|
||||
.Adjectives:
|
||||
; there are NUM_PNP_PEOPLE_ADJECTIVES entries
|
||||
table_width 2, PeoplePlaces5.Adjectives
|
||||
dw PnP_CuteText
|
||||
dw PnP_LazyText
|
||||
dw PnP_HappyText
|
||||
@@ -1171,6 +1175,7 @@ PeoplePlaces5:
|
||||
dw PnP_WeirdText
|
||||
dw PnP_RightForMeText
|
||||
dw PnP_OddText
|
||||
assert_table_length NUM_PNP_PEOPLE_ADJECTIVES
|
||||
|
||||
PnP_CuteText:
|
||||
text_far _PnP_CuteText
|
||||
@@ -1289,7 +1294,7 @@ PeoplePlaces7:
|
||||
jp PrintRadioLine
|
||||
|
||||
.Adjectives:
|
||||
; there are NUM_PNP_PLACES_ADJECTIVES entries
|
||||
table_width 2, PeoplePlaces7.Adjectives
|
||||
dw PnP_CuteText
|
||||
dw PnP_LazyText
|
||||
dw PnP_HappyText
|
||||
@@ -1306,6 +1311,7 @@ PeoplePlaces7:
|
||||
dw PnP_WeirdText
|
||||
dw PnP_RightForMeText
|
||||
dw PnP_OddText
|
||||
assert_table_length NUM_PNP_PLACES_ADJECTIVES
|
||||
|
||||
RocketRadio1:
|
||||
call StartRadioStation
|
||||
|
||||
@@ -8,10 +8,10 @@ LoadMapGroupRoof::
|
||||
cp -1
|
||||
ret z
|
||||
ld hl, Roofs
|
||||
ld bc, 9 tiles
|
||||
ld bc, ROOF_LENGTH tiles
|
||||
call AddNTimes
|
||||
ld de, vTiles2 tile $0a
|
||||
ld bc, 9 tiles
|
||||
ld bc, ROOF_LENGTH tiles
|
||||
call CopyBytes
|
||||
ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user