From 897dda77bd26c3511f74e0270eeaa239c6b653bc Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Sat, 15 Mar 2025 01:22:56 -0400 Subject: [PATCH] Verify the battle BG effect pointer table length --- constants/battle_anim_constants.asm | 5 +++-- engine/battle_anims/bg_effects.asm | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/constants/battle_anim_constants.asm b/constants/battle_anim_constants.asm index b438ebea..40042af4 100644 --- a/constants/battle_anim_constants.asm +++ b/constants/battle_anim_constants.asm @@ -719,7 +719,8 @@ assert NUM_BATTLE_ANIM_OAMSETS <= FIRST_OAM_CMD, \ "BATTLE_ANIM_OAMSET_* constants overlap oam*_command constants" ; BattleBGEffects indexes (see engine/battle_anims/bg_effects.asm) - const_def 1 + const_def + const BATTLE_BG_EFFECT_END ; 00 const BATTLE_BG_EFFECT_FLASH_INVERTED ; 01 const BATTLE_BG_EFFECT_FLASH_WHITE ; 02 const BATTLE_BG_EFFECT_WHITE_HUES ; 03 @@ -772,7 +773,7 @@ assert NUM_BATTLE_ANIM_OAMSETS <= FIRST_OAM_CMD, \ const BATTLE_BG_EFFECT_VIBRATE_MON ; 32 const BATTLE_BG_EFFECT_WOBBLE_PLAYER ; 33 const BATTLE_BG_EFFECT_WOBBLE_SCREEN ; 34 -DEF NUM_BATTLE_BG_EFFECTS EQU const_value - 1 +DEF NUM_BATTLE_BG_EFFECTS EQU const_value ; wBattleAnimTileDict keys (see wram.asm) ; AnimObjGFX indexes (see data/battle_anims/object_gfx.asm) diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index ffae49b6..60f4e815 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -79,6 +79,7 @@ DoBattleBGEffectFunction: BattleBGEffects: ; entries correspond to BATTLE_BG_EFFECT_* constants + table_width 2 dw BattleBGEffect_End dw BattleBGEffect_FlashInverted dw BattleBGEffect_FlashWhite @@ -132,6 +133,7 @@ BattleBGEffects: dw BattleBGEffect_VibrateMon dw BattleBGEffect_WobblePlayer dw BattleBGEffect_WobbleScreen + assert_table_length NUM_BATTLE_BG_EFFECTS BattleBGEffect_End: call EndBattleBGEffect