From aa85c0046d06b306d99e3b48460782ac04814975 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Wed, 2 Jul 2025 17:25:03 -0400 Subject: Define `MAX_WARP_EVENTS` --- constants/map_data_constants.asm | 3 +++ macros/scripts/maps.asm | 2 ++ ram/wram.asm | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index b28b3d79..9d816a6a 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -16,6 +16,9 @@ DEF MAP_BORDER EQU 3 shift_const SOUTH ; 4 shift_const NORTH ; 8 +; wWarpEntries +DEF MAX_WARP_EVENTS EQU 32 + ; flower and water tile animations const_def const TILEANIM_NONE ; 0 diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index 2837d0c0..63b41424 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -84,6 +84,8 @@ MACRO def_warps_to FOR n, {_NUM_WARP_EVENTS} warp_to _WARP_{d:n}_X, _WARP_{d:n}_Y, \1_WIDTH ENDR + ASSERT {_NUM_WARP_EVENTS} <= MAX_WARP_EVENTS, \ + "Too many warp_events (above {d:MAX_WARP_EVENTS})!" ENDM ;\1 x position diff --git a/ram/wram.asm b/ram/wram.asm index f93d37d7..4e3e6411 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1815,11 +1815,11 @@ wObjectDataPointerTemp:: dw ; the tile shown outside the boundaries of the map wMapBackgroundTile:: db -; number of warps in current map (up to 32) +; number of warps in current map (up to MAX_WARP_EVENTS) wNumberOfWarps:: db ; current map warp entries -wWarpEntries:: ds 32 * 4 ; Y, X, warp ID, map ID +wWarpEntries:: ds MAX_WARP_EVENTS * 4 ; Y, X, warp ID, map ID ; if $ff, the player's coordinates are not updated when entering the map wDestinationWarpID:: db -- cgit v1.3.1-sl0p