From fc7b65347f38bd24d3666a3d68d8923b37432f6e Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 20 Oct 2023 20:07:56 +0200 Subject: [PATCH] Disable space upon landing (#21) --- constants/tileset_constants.asm | 5 +++++ engine/board/spaces.asm | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/constants/tileset_constants.asm b/constants/tileset_constants.asm index 94ccd1f19..fb9db00d9 100644 --- a/constants/tileset_constants.asm +++ b/constants/tileset_constants.asm @@ -68,3 +68,8 @@ DEF NUM_VARIABLE_SPACES_SETS EQU const_value ; number of tiles of the tileset occupied by space tiles (see LoadTilesetGFX) DEF TILESET_FIXED_SPACES_NUM_TILES EQU $20 DEF TILESET_VARIABLE_SPACES_NUM_TILES EQU $20 + +; metatile layout constants +DEF FIRST_SPACE_METATILE EQU $80 +DEF FIRST_GREY_SPACE_METATILE EQU $e0 +DEF UNIQUE_SPACE_METATILES_MASK EQU %11111 diff --git a/engine/board/spaces.asm b/engine/board/spaces.asm index dd6db1dbc..84707e86b 100755 --- a/engine/board/spaces.asm +++ b/engine/board/spaces.asm @@ -79,6 +79,19 @@ LandedInRegularSpaceScript: end LandedInRegularSpace: +; disable the space effect (turn the space into a grey space) + ld a, [wCurSpaceXCoord] + add 4 + ld d, a + ld a, [wCurSpaceYCoord] + add 4 + ld e, a + call GetBlockLocation + ld a, [hl] + and UNIQUE_SPACE_METATILES_MASK + add FIRST_GREY_SPACE_METATILE + ld [hl], a +; trigger end of turn ld a, BOARDEVENT_END_TURN ldh [hCurBoardEvent], a ret