summaryrefslogtreecommitdiff
path: root/engine/tile_events.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/tile_events.asm')
-rwxr-xr-xengine/tile_events.asm110
1 files changed, 110 insertions, 0 deletions
diff --git a/engine/tile_events.asm b/engine/tile_events.asm
new file mode 100755
index 000000000..8a6f2bc66
--- /dev/null
+++ b/engine/tile_events.asm
@@ -0,0 +1,110 @@
+CheckWarpCollision:: ; 1499a
+; Is this tile a warp?
+ ld a, [PlayerNextTile]
+ cp $60
+ jr z, .warp
+ cp $68
+ jr z, .warp
+ and $f0
+ cp $70
+ jr z, .warp
+ and a
+ ret
+
+.warp
+ scf
+ ret
+; 149af
+
+CheckDirectionalWarp:: ; 149af
+; If this is a directional warp, clear carry (press the designated button to warp).
+; Else, set carry (immediate warp).
+ ld a, [PlayerNextTile]
+ cp $70 ; Warp on down
+ jr z, .not_warp
+ cp $76 ; Warp on left
+ jr z, .not_warp
+ cp $78 ; Warp on up
+ jr z, .not_warp
+ cp $7e ; Warp on right
+ jr z, .not_warp
+ scf
+ ret
+
+.not_warp
+ xor a
+ ret
+; 149c6
+
+CheckWarpFacingDown: ; 149c6
+ ld de, 1
+ ld hl, .blocks
+ ld a, [PlayerNextTile]
+ call IsInArray
+ ret
+; 149d3
+
+.blocks: ; 149d3
+ db $71 ; door
+ db $79
+ db $7a ; stairs
+ db $73
+ db $7b ; cave entrance
+ db $74
+ db $7c ; warp pad
+ db $75
+ db $7d
+ db -1
+; 149dd
+
+CheckGrassCollision:: ; 149dd
+ ld a, [PlayerNextTile]
+ ld hl, .blocks
+ ld de, 1
+ call IsInArray
+ ret
+; 149ea
+
+.blocks: ; 149ea
+ db $08
+ db $18 ; tall grass
+ db $14 ; tall grass
+ db $28
+ db $29
+ db $48
+ db $49
+ db $4a
+ db $4b
+ db $4c
+ db -1
+; 149f5
+
+CheckCutCollision: ; 149f5
+ ld a, c
+ ld hl, .blocks
+ ld de, 1
+ call IsInArray
+ ret
+; 14a00
+
+.blocks: ; 14a00
+ db $12 ; cut tree
+ db $1a ; cut tree
+ db $10 ; tall grass
+ db $18 ; tall grass
+ db $14 ; tall grass
+ db $1c ; tall grass
+ db -1
+; 14a07
+
+Function14a07:: ; 14a07
+ ld a, [PlayerNextTile]
+ ld de, $1f
+ cp $71 ; door
+ ret z
+ ld de, $13
+ cp $7c ; warp pad
+ ret z
+ ld de, $23
+ ret
+; 14a1a