Skip to content

Commit b4fc71c

Browse files
committed
Verify the battle BG effect pointer table length
1 parent 467ee7e commit b4fc71c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

constants/battle_anim_constants.asm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ assert NUM_BATTLE_ANIM_OAMSETS <= FIRST_OAM_CMD, \
719719
"BATTLE_ANIM_OAMSET_* constants overlap oam*_command constants"
720720

721721
; BattleBGEffects indexes (see engine/battle_anims/bg_effects.asm)
722-
const_def 1
722+
const_def
723+
const BATTLE_BG_EFFECT_END ; 00
723724
const BATTLE_BG_EFFECT_FLASH_INVERTED ; 01
724725
const BATTLE_BG_EFFECT_FLASH_WHITE ; 02
725726
const BATTLE_BG_EFFECT_WHITE_HUES ; 03
@@ -773,7 +774,7 @@ assert NUM_BATTLE_ANIM_OAMSETS <= FIRST_OAM_CMD, \
773774
const BATTLE_BG_EFFECT_VIBRATE_MON ; 33
774775
const BATTLE_BG_EFFECT_WOBBLE_PLAYER ; 34
775776
const BATTLE_BG_EFFECT_WOBBLE_SCREEN ; 35
776-
DEF NUM_BATTLE_BG_EFFECTS EQU const_value - 1
777+
DEF NUM_BATTLE_BG_EFFECTS EQU const_value
777778

778779
; wBattleAnimTileDict keys (see wram.asm)
779780
; AnimObjGFX indexes (see data/battle_anims/object_gfx.asm)

engine/battle_anims/bg_effects.asm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ DoBattleBGEffectFunction:
7979

8080
BattleBGEffects:
8181
; entries correspond to BATTLE_BG_EFFECT_* constants
82+
table_width 2
8283
dw BattleBGEffect_End
8384
dw BattleBGEffect_FlashInverted
8485
dw BattleBGEffect_FlashWhite
@@ -133,6 +134,7 @@ BattleBGEffects:
133134
dw BattleBGEffect_VibrateMon
134135
dw BattleBGEffect_WobblePlayer
135136
dw BattleBGEffect_WobbleScreen
137+
assert_table_length NUM_BATTLE_BG_EFFECTS
136138

137139
BattleBGEffect_End:
138140
call EndBattleBGEffect

0 commit comments

Comments
 (0)