summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-03-03 22:22:41 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2021-03-05 16:10:25 -0500
commit5454e1e0deefc6b4fc8c4de0e63314052fceebc0 (patch)
tree565805b252fa596aab3f80b3128ebc91b1fae540 /engine
parentb423e94be700cc6434465cf1dcccf0b677489192 (diff)
Verify data table sizes with table_width and assert_table_length macros
It also uncovered some off-by-one issues with defining some constants. A few structs now use rsreset/_RS to define their offset constants.
Diffstat (limited to 'engine')
-rw-r--r--engine/battle/move_effects/conversion2.asm2
-rw-r--r--engine/battle_anims/core.asm2
-rw-r--r--engine/debug/color_picker.asm4
-rw-r--r--engine/gfx/color.asm2
-rw-r--r--engine/gfx/load_pics.asm2
-rw-r--r--engine/gfx/sprite_anims.asm4
-rw-r--r--engine/items/item_effects.asm18
-rw-r--r--engine/overworld/decorations.asm114
-rw-r--r--engine/overworld/map_object_action.asm4
-rw-r--r--engine/overworld/map_objects.asm8
-rw-r--r--engine/overworld/overworld.asm2
-rw-r--r--engine/overworld/player_movement.asm6
-rw-r--r--engine/phone/phone.asm4
-rw-r--r--engine/pokedex/pokedex.asm8
-rw-r--r--engine/pokegear/radio.asm22
-rw-r--r--engine/tilesets/mapgroup_roofs.asm4
16 files changed, 124 insertions, 82 deletions
diff --git a/engine/battle/move_effects/conversion2.asm b/engine/battle/move_effects/conversion2.asm
index df6d9109..32d4502e 100644
--- a/engine/battle/move_effects/conversion2.asm
+++ b/engine/battle/move_effects/conversion2.asm
@@ -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
diff --git a/engine/battle_anims/core.asm b/engine/battle_anims/core.asm
index 51916ef4..64be8839 100644
--- a/engine/battle_anims/core.asm
+++ b/engine/battle_anims/core.asm
@@ -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
diff --git a/engine/debug/color_picker.asm b/engine/debug/color_picker.asm
index 2538b749..19726e9a 100644
--- a/engine/debug/color_picker.asm
+++ b/engine/debug/color_picker.asm
@@ -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
@@ -276,7 +276,7 @@ DebugColorMain:
ld a, NUM_POKEMON ; CELEBI
ret
.trainer
- ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN
+ ld a, NUM_TRAINER_CLASSES ; GRUNTF
ret
.Jumptable:
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index d319ab0d..47f5dbf5 100644
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -1215,7 +1215,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"
diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm
index ad9c1f14..23d75e68 100644
--- a/engine/gfx/load_pics.asm
+++ b/engine/gfx/load_pics.asm
@@ -238,7 +238,7 @@ GetTrainerPic:
ld a, [wTrainerClass]
and a
ret z
- cp NUM_TRAINER_CLASSES
+ cp NUM_TRAINER_CLASSES + 1
ret nc
ld a, 0
call WaitBGMap
diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm
index 58622521..b0e5b91a 100644
--- a/engine/gfx/sprite_anims.asm
+++ b/engine/gfx/sprite_anims.asm
@@ -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
@@ -55,6 +56,7 @@ DoAnimFrame:
dw AnimSeq_FlyLeaf
dw AnimSeq_FlyTo
dw AnimSeq_GSIntroHoOhLugia
+ assert_table_length NUM_SPRITE_ANIM_SEQS
AnimSeq_Null:
ret
diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm
index 77828b60..ae169553 100644
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -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]
diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm
index e8baea19..7e861abb 100644
--- a/engine/overworld/decorations.asm
+++ b/engine/overworld/decorations.asm
@@ -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
-
-.pointers
- dw DecoBedMenu, .bed
- dw DecoCarpetMenu, .carpet
- dw DecoPlantMenu, .plant
- dw DecoPosterMenu, .poster
- dw DecoConsoleMenu, .game
+ dw .category_pointers
+
+.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
-
-.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@"
+ 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@"
.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,18 +560,18 @@ GetDecoName:
ld a, e
jr .getpokename
-.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
@@ -572,7 +580,7 @@ GetDecoName:
pop bc
ret
-.copy
+.copy:
ld h, b
ld l, c
call CopyName2
@@ -961,11 +969,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]
diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm
index 8a153f59..d055e7c3 100644
--- a/engine/overworld/map_object_action.asm
+++ b/engine/overworld/map_object_action.asm
@@ -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
@@ -17,6 +18,7 @@ ObjectActionPairPointers:
dw SetFacingBigDoll, SetFacingBigDoll
dw SetFacingBoulderDust, SetFacingStanding
dw SetFacingGrassShake, SetFacingStanding
+ assert_table_length NUM_OBJECT_ACTIONS
SetFacingStanding:
ld hl, OBJECT_FACING_STEP
diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm
index c30bc695..9da9cdb0 100644
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -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
@@ -1111,6 +1114,7 @@ StepTypesJumptable:
dw StepFunction_16 ; 16
dw StepFunction_17 ; 17
dw StepFunction_Delete ; 18
+ assert_table_length NUM_STEP_TYPES
WaitStep_InPlace:
ld hl, OBJECT_STEP_DURATION
diff --git a/engine/overworld/overworld.asm b/engine/overworld/overworld.asm
index 40157524..ebef0623 100644
--- a/engine/overworld/overworld.asm
+++ b/engine/overworld/overworld.asm
@@ -460,7 +460,7 @@ GetUsedSprite:
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
diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm
index 2f16c492..b5ece1be 100644
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -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
diff --git a/engine/phone/phone.asm b/engine/phone/phone.asm
index 796aed9b..0c0cd5bb 100644
--- a/engine/phone/phone.asm
+++ b/engine/phone/phone.asm
@@ -254,7 +254,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]
@@ -298,7 +298,7 @@ CheckSpecialPhoneCall::
ld c, a
ld b, 0
ld hl, SpecialPhoneCallList
- ld a, 6
+ ld a, SPECIALCALL_SIZE
call AddNTimes
ret
diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm
index d4933646..a895f357 100644
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -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
diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm
index 41292f6e..61ff5bb4 100644
--- a/engine/pokegear/radio.asm
+++ b/engine/pokegear/radio.asm
@@ -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
@@ -30,6 +31,7 @@ RadioJumptable:
dw PokeFluteRadio ; $07
dw UnownRadio ; $08
dw EvolutionRadio ; $09
+ assert_table_length NUM_RADIO_CHANNELS
; OaksPKMNTalk
dw OaksPKMNTalk2 ; $0a
dw OaksPKMNTalk3 ; $0b
@@ -94,6 +96,7 @@ RadioJumptable:
dw PokedexShow6 ; $40
dw PokedexShow7 ; $41
dw PokedexShow8 ; $42
+ assert_table_length NUM_RADIO_SEGMENTS
PrintRadioLine:
ld [wNextRadioLine], a
@@ -171,10 +174,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
@@ -325,7 +327,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
@@ -342,6 +344,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
@@ -433,7 +436,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
@@ -450,6 +453,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
@@ -1050,7 +1054,7 @@ PeoplePlaces4: ; People
call Random
maskbits NUM_TRAINER_CLASSES
inc a
- cp NUM_TRAINER_CLASSES
+ cp NUM_TRAINER_CLASSES + 1
jr nc, PeoplePlaces4
push af
ld hl, PnP_HiddenPeople
@@ -1114,7 +1118,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
@@ -1131,6 +1135,7 @@ PeoplePlaces5:
dw PnP_WeirdText
dw PnP_RightForMeText
dw PnP_OddText
+ assert_table_length NUM_PNP_PEOPLE_ADJECTIVES
PnP_CuteText:
text_far _PnP_CuteText
@@ -1249,7 +1254,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
@@ -1266,6 +1271,7 @@ PeoplePlaces7:
dw PnP_WeirdText
dw PnP_RightForMeText
dw PnP_OddText
+ assert_table_length NUM_PNP_PLACES_ADJECTIVES
RocketRadio1:
call StartRadioStation
diff --git a/engine/tilesets/mapgroup_roofs.asm b/engine/tilesets/mapgroup_roofs.asm
index b269e527..9db5d64d 100644
--- a/engine/tilesets/mapgroup_roofs.asm
+++ b/engine/tilesets/mapgroup_roofs.asm
@@ -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