ref: b006415371330881ed50aadbe62aa4675c92f9b4
parent: 047c8e4bc079140b2e88b27e4ed8a6ca2ae9533d
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Tue Dec 12 11:15:58 EST 2017
Define constants for collision types
--- a/constants.asm
+++ b/constants.asm
@@ -35,6 +35,7 @@
INCLUDE "constants/sprite_constants.asm"
INCLUDE "constants/sprite_data_constants.asm"
INCLUDE "constants/tileset_constants.asm"
+INCLUDE "constants/collision_constants.asm"
INCLUDE "constants/cgb_constants.asm"
INCLUDE "constants/battle_tower_constants.asm"
INCLUDE "constants/cry_constants.asm"
--- /dev/null
+++ b/constants/collision_constants.asm
@@ -1,0 +1,115 @@
+; collision permissions (see tilesets/collision_permissions.asm)
+LANDTILE EQU $00
+WATERTILE EQU $01
+WALLTILE EQU $0f
+TALK EQU $10
+
+; collision data types (see tilesets/*_collision.asm)
+; TileCollisionTable indexes (see data/collision_permissions.asm)
+COLL_FLOOR EQU $00
+COLL_01 EQU $01 ; garbage
+COLL_03 EQU $03 ; garbage
+COLL_04 EQU $04 ; garbage
+COLL_WALL EQU $07
+COLL_CUT_08 EQU $08 ; unused
+COLL_TALL_GRASS_10 EQU $10 ; unused
+COLL_CUT_TREE EQU $12
+COLL_LONG_GRASS EQU $14
+COLL_HEADBUTT_TREE EQU $15
+COLL_TALL_GRASS EQU $18
+COLL_CUT_TREE_1A EQU $1a ; unused
+COLL_LONG_GRASS_1C EQU $1c ; unused
+COLL_HEADBUTT_TREE_1D EQU $1d ; unused
+COLL_WATER_21 EQU $21 ; ???
+COLL_ICE EQU $23
+COLL_WHIRLPOOL EQU $24
+COLL_BUOY EQU $27
+COLL_CUT_28 EQU $28 ; garbage
+COLL_WATER EQU $29
+COLL_ICE_2B EQU $2b ; unused
+COLL_WHIRLPOOL_2C EQU $2c ; unused
+COLL_WATERFALL_RIGHT EQU $30 ; unused !!!
+COLL_WATERFALL_LEFT EQU $31 ; unused !!!
+COLL_WATERFALL_UP EQU $32 ; unused !!!
+COLL_WATERFALL EQU $33
+COLL_CURRENT_RIGHT EQU $38 ; unused !!!
+COLL_CURRENT_LEFT EQU $39 ; unused !!!
+COLL_CURRENT_UP EQU $3a ; unused !!!
+COLL_CURRENT_DOWN EQU $3b ; unused !!!
+COLL_BRAKE EQU $40 ; unused !!!
+COLL_WALK_RIGHT EQU $41 ; unused !!!
+COLL_WALK_LEFT EQU $42 ; unused !!!
+COLL_WALK_UP EQU $43 ; unused !!!
+COLL_WALK_DOWN EQU $44 ; unused !!!
+COLL_BRAKE_45 EQU $45 ; garbage
+COLL_BRAKE_46 EQU $46 ; unused
+COLL_BRAKE_47 EQU $47 ; unused
+COLL_GRASS_48 EQU $48 ; unused
+COLL_GRASS_49 EQU $49 ; unused
+COLL_GRASS_4A EQU $4a ; garbage
+COLL_GRASS_4B EQU $4b ; garbage
+COLL_GRASS_4C EQU $4c ; unused
+COLL_WALK_RIGHT_ALT EQU $50 ; unused
+COLL_WALK_LEFT_ALT EQU $51 ; unused
+COLL_WALK_UP_ALT EQU $52 ; unused
+COLL_WALK_DOWN_ALT EQU $53 ; unused
+COLL_BRAKE_ALT EQU $54 ; unused
+COLL_BRAKE_55 EQU $55 ; unused
+COLL_BRAKE_56 EQU $56 ; unused
+COLL_BRAKE_57 EQU $57 ; unused
+COLL_5B EQU $5b ; garbage
+COLL_PIT EQU $60
+COLL_VIRTUAL_BOY EQU $61 ; garbage
+COLL_64 EQU $64 ; garbage
+COLL_65 EQU $65 ; garbage
+COLL_PIT_68 EQU $68 ; unused
+COLL_WARP_CARPET_DOWN EQU $70
+COLL_DOOR EQU $71
+COLL_LADDER EQU $72
+COLL_STAIRCASE_73 EQU $73 ; unused
+COLL_CAVE_74 EQU $74 ; unused
+COLL_DOOR_75 EQU $75 ; unused
+COLL_WARP_CARPET_LEFT EQU $76
+COLL_WARP_77 EQU $77 ; unused
+COLL_WARP_CARPET_UP EQU $78
+COLL_DOOR_79 EQU $79 ; unused
+COLL_STAIRCASE EQU $7a
+COLL_CAVE EQU $7b
+COLL_WARP_PANEL EQU $7c
+COLL_DOOR_7D EQU $7d ; unused
+COLL_WARP_CARPET_RIGHT EQU $7e
+COLL_WARP_7F EQU $7f ; unused
+COLL_COUNTER EQU $90
+COLL_BOOKSHELF EQU $91
+COLL_PC EQU $93
+COLL_RADIO EQU $94
+COLL_TOWN_MAP EQU $95
+COLL_MART_SHELF EQU $96
+COLL_TV EQU $97
+COLL_COUNTER_98 EQU $98 ; unused
+COLL_9C EQU $9c ; garbage
+COLL_WINDOW EQU $9d
+COLL_INCENSE_BURNER EQU $9f
+COLL_HOP_RIGHT EQU $a0
+COLL_HOP_LEFT EQU $a1
+COLL_HOP_UP EQU $a2 ; unused !!!
+COLL_HOP_DOWN EQU $a3
+COLL_HOP_DOWN_RIGHT EQU $a4
+COLL_HOP_DOWN_LEFT EQU $a5
+COLL_HOP_UP_RIGHT EQU $a6 ; unused !!!
+COLL_HOP_UP_LEFT EQU $a7 ; unused !!!
+COLL_RIGHT_WALL EQU $b0
+COLL_LEFT_WALL EQU $b1
+COLL_UP_WALL EQU $b2
+COLL_DOWN_WALL EQU $b3 ; unused !!!
+COLL_FF EQU $ff ; garbage
+
+; collision data type nybbles
+LO_NYBBLE_GRASS EQU $07
+HI_NYBBLE_TALL_GRASS EQU $10
+HI_NYBBLE_WATER EQU $20
+HI_NYBBLE_CURRENT EQU $30
+HI_NYBBLE_WALK EQU $40
+HI_NYBBLE_WALK_ALT EQU $50
+HI_NYBBLE_WARPS EQU $70
+HI_NYBBLE_LEDGES EQU $a0
--- a/constants/tileset_constants.asm
+++ b/constants/tileset_constants.asm
@@ -1,9 +1,3 @@
-; collision values (see tilesets/collision.asm)
-LANDTILE EQU $0
-WATERTILE EQU $1
-WALLTILE EQU $f
-TALK EQU $10
-
; Tilesets indexes (see tilesets/tileset_headers.asm)
const_value SET 1
const TILESET_JOHTO_1 ; 01
--- /dev/null
+++ b/data/collision_permissions.asm
@@ -1,0 +1,262 @@
+NONTALKABLE EQUS "db"
+TALKABLE EQUS "db TALK +"
+
+TileCollisionTable:: ; 4ce1f
+; entries correspond to COLL_* constants
+ NONTALKABLE LANDTILE ; COLL_FLOOR
+ NONTALKABLE LANDTILE ; COLL_01
+ NONTALKABLE LANDTILE ; 02
+ NONTALKABLE LANDTILE ; COLL_03
+ NONTALKABLE LANDTILE ; COLL_04
+ NONTALKABLE LANDTILE ; 05
+ NONTALKABLE LANDTILE ; 06
+ NONTALKABLE WALLTILE ; COLL_WALL
+ NONTALKABLE LANDTILE ; COLL_CUT_08
+ NONTALKABLE LANDTILE ; 09
+ NONTALKABLE LANDTILE ; 0a
+ NONTALKABLE LANDTILE ; 0b
+ NONTALKABLE LANDTILE ; 0c
+ NONTALKABLE LANDTILE ; 0d
+ NONTALKABLE LANDTILE ; 0e
+ NONTALKABLE WALLTILE ; 0f
+ NONTALKABLE LANDTILE ; COLL_TALL_GRASS_10
+ NONTALKABLE LANDTILE ; 11
+ TALKABLE WALLTILE ; COLL_CUT_TREE
+ NONTALKABLE LANDTILE ; 13
+ NONTALKABLE LANDTILE ; COLL_LONG_GRASS
+ TALKABLE WALLTILE ; COLL_HEADBUTT_TREE
+ NONTALKABLE LANDTILE ; 16
+ NONTALKABLE LANDTILE ; 17
+ NONTALKABLE LANDTILE ; COLL_TALL_GRASS
+ NONTALKABLE LANDTILE ; 19
+ TALKABLE WALLTILE ; COLL_CUT_TREE_1A
+ NONTALKABLE LANDTILE ; 1b
+ NONTALKABLE LANDTILE ; COLL_LONG_GRASS_1C
+ TALKABLE WALLTILE ; COLL_HEADBUTT_TREE_1D
+ NONTALKABLE LANDTILE ; 1e
+ NONTALKABLE LANDTILE ; 1f
+ NONTALKABLE WATERTILE ; 20
+ NONTALKABLE WATERTILE ; COLL_WATER_21
+ TALKABLE WATERTILE ; 22
+ NONTALKABLE LANDTILE ; COLL_ICE
+ TALKABLE WATERTILE ; COLL_WHIRLPOOL
+ NONTALKABLE WATERTILE ; 25
+ NONTALKABLE WATERTILE ; 26
+ NONTALKABLE WALLTILE ; COLL_BUOY
+ NONTALKABLE WATERTILE ; COLL_CUT_28
+ NONTALKABLE WATERTILE ; COLL_WATER
+ TALKABLE WATERTILE ; 2a
+ NONTALKABLE LANDTILE ; COLL_ICE_2B
+ TALKABLE WATERTILE ; COLL_WHIRLPOOL_2C
+ NONTALKABLE WATERTILE ; 2d
+ NONTALKABLE WATERTILE ; 2e
+ NONTALKABLE WALLTILE ; 2f
+ NONTALKABLE WATERTILE ; COLL_WATERFALL_RIGHT
+ NONTALKABLE WATERTILE ; COLL_WATERFALL_LEFT
+ NONTALKABLE WATERTILE ; COLL_WATERFALL_UP
+ NONTALKABLE WATERTILE ; COLL_WATERFALL
+ NONTALKABLE WATERTILE ; 34
+ NONTALKABLE WATERTILE ; 35
+ NONTALKABLE WATERTILE ; 36
+ NONTALKABLE WATERTILE ; 37
+ NONTALKABLE WATERTILE ; COLL_CURRENT_RIGHT
+ NONTALKABLE WATERTILE ; COLL_CURRENT_LEFT
+ NONTALKABLE WATERTILE ; COLL_CURRENT_UP
+ NONTALKABLE WATERTILE ; COLL_CURRENT_DOWN
+ NONTALKABLE WATERTILE ; 3c
+ NONTALKABLE WATERTILE ; 3d
+ NONTALKABLE WATERTILE ; 3e
+ NONTALKABLE WATERTILE ; 3f
+ NONTALKABLE LANDTILE ; COLL_BRAKE
+ NONTALKABLE LANDTILE ; COLL_WALK_RIGHT
+ NONTALKABLE LANDTILE ; COLL_WALK_LEFT
+ NONTALKABLE LANDTILE ; COLL_WALK_UP
+ NONTALKABLE LANDTILE ; COLL_WALK_DOWN
+ NONTALKABLE LANDTILE ; COLL_BRAKE_45
+ NONTALKABLE LANDTILE ; COLL_BRAKE_46
+ NONTALKABLE LANDTILE ; COLL_BRAKE_47
+ NONTALKABLE LANDTILE ; COLL_GRASS_48
+ NONTALKABLE LANDTILE ; COLL_GRASS_49
+ NONTALKABLE LANDTILE ; COLL_GRASS_4A
+ NONTALKABLE LANDTILE ; COLL_GRASS_4B
+ NONTALKABLE LANDTILE ; COLL_GRASS_4C
+ NONTALKABLE LANDTILE ; 4d
+ NONTALKABLE LANDTILE ; 4e
+ NONTALKABLE LANDTILE ; 4f
+ NONTALKABLE LANDTILE ; COLL_WALK_RIGHT_ALT
+ NONTALKABLE LANDTILE ; COLL_WALK_LEFT_ALT
+ NONTALKABLE LANDTILE ; COLL_WALK_UP_ALT
+ NONTALKABLE LANDTILE ; COLL_WALK_DOWN_ALT
+ NONTALKABLE LANDTILE ; COLL_BRAKE_ALT
+ NONTALKABLE LANDTILE ; COLL_BRAKE_55
+ NONTALKABLE LANDTILE ; COLL_BRAKE_56
+ NONTALKABLE LANDTILE ; COLL_BRAKE_57
+ NONTALKABLE LANDTILE ; 58
+ NONTALKABLE LANDTILE ; 59
+ NONTALKABLE LANDTILE ; 5a
+ NONTALKABLE LANDTILE ; COLL_5B
+ NONTALKABLE LANDTILE ; 5c
+ NONTALKABLE LANDTILE ; 5d
+ NONTALKABLE LANDTILE ; 5e
+ NONTALKABLE LANDTILE ; 5f
+ NONTALKABLE LANDTILE ; COLL_PIT
+ NONTALKABLE LANDTILE ; COLL_VIRTUAL_BOY
+ NONTALKABLE WALLTILE ; 62
+ NONTALKABLE LANDTILE ; 63
+ NONTALKABLE LANDTILE ; COLL_64
+ NONTALKABLE LANDTILE ; COLL_65
+ NONTALKABLE LANDTILE ; 66
+ NONTALKABLE LANDTILE ; 67
+ NONTALKABLE LANDTILE ; COLL_PIT_68
+ NONTALKABLE LANDTILE ; 69
+ NONTALKABLE WALLTILE ; 6a
+ NONTALKABLE LANDTILE ; 6b
+ NONTALKABLE LANDTILE ; 6c
+ NONTALKABLE LANDTILE ; 6d
+ NONTALKABLE LANDTILE ; 6e
+ NONTALKABLE LANDTILE ; 6f
+ NONTALKABLE LANDTILE ; COLL_WARP_CARPET_DOWN
+ NONTALKABLE LANDTILE ; COLL_DOOR
+ NONTALKABLE LANDTILE ; COLL_LADDER
+ NONTALKABLE LANDTILE ; COLL_STAIRCASE_73
+ NONTALKABLE LANDTILE ; COLL_CAVE_74
+ NONTALKABLE LANDTILE ; COLL_DOOR_75
+ NONTALKABLE LANDTILE ; COLL_WARP_CARPET_LEFT
+ NONTALKABLE LANDTILE ; COLL_WARP_77
+ NONTALKABLE LANDTILE ; COLL_WARP_CARPET_UP
+ NONTALKABLE LANDTILE ; COLL_DOOR_79
+ NONTALKABLE LANDTILE ; COLL_STAIRCASE
+ NONTALKABLE LANDTILE ; COLL_CAVE
+ NONTALKABLE LANDTILE ; COLL_WARP_PANEL
+ NONTALKABLE LANDTILE ; COLL_DOOR_7D
+ NONTALKABLE LANDTILE ; COLL_WARP_CARPET_RIGHT
+ NONTALKABLE LANDTILE ; COLL_WARP_7F
+ NONTALKABLE WALLTILE ; 80
+ NONTALKABLE WALLTILE ; 81
+ NONTALKABLE WALLTILE ; 82
+ NONTALKABLE WALLTILE ; 83
+ NONTALKABLE WALLTILE ; 84
+ NONTALKABLE LANDTILE ; 85
+ NONTALKABLE LANDTILE ; 86
+ NONTALKABLE LANDTILE ; 87
+ NONTALKABLE WALLTILE ; 88
+ NONTALKABLE WALLTILE ; 89
+ NONTALKABLE WALLTILE ; 8a
+ NONTALKABLE WALLTILE ; 8b
+ NONTALKABLE WALLTILE ; 8c
+ NONTALKABLE LANDTILE ; 8d
+ NONTALKABLE LANDTILE ; 8e
+ NONTALKABLE LANDTILE ; 8f
+ NONTALKABLE WALLTILE ; COLL_COUNTER
+ NONTALKABLE WALLTILE ; COLL_BOOKSHELF
+ NONTALKABLE WALLTILE ; 92
+ NONTALKABLE WALLTILE ; COLL_PC
+ NONTALKABLE WALLTILE ; COLL_RADIO
+ NONTALKABLE WALLTILE ; COLL_TOWN_MAP
+ NONTALKABLE WALLTILE ; COLL_MART_SHELF
+ NONTALKABLE WALLTILE ; COLL_TV
+ NONTALKABLE WALLTILE ; COLL_COUNTER_98
+ NONTALKABLE WALLTILE ; 99
+ NONTALKABLE WALLTILE ; 9a
+ NONTALKABLE WALLTILE ; 9b
+ NONTALKABLE WALLTILE ; COLL_9C
+ NONTALKABLE WALLTILE ; COLL_WINDOW
+ NONTALKABLE WALLTILE ; 9e
+ NONTALKABLE WALLTILE ; COLL_INCENSE_BURNER
+ NONTALKABLE LANDTILE ; COLL_HOP_RIGHT
+ NONTALKABLE LANDTILE ; COLL_HOP_LEFT
+ NONTALKABLE LANDTILE ; COLL_HOP_UP
+ NONTALKABLE LANDTILE ; COLL_HOP_DOWN
+ NONTALKABLE LANDTILE ; COLL_HOP_DOWN_RIGHT
+ NONTALKABLE LANDTILE ; COLL_HOP_DOWN_LEFT
+ NONTALKABLE LANDTILE ; COLL_HOP_UP_RIGHT
+ NONTALKABLE LANDTILE ; COLL_HOP_UP_LEFT
+ NONTALKABLE LANDTILE ; a8
+ NONTALKABLE LANDTILE ; a9
+ NONTALKABLE LANDTILE ; aa
+ NONTALKABLE LANDTILE ; ab
+ NONTALKABLE LANDTILE ; ac
+ NONTALKABLE LANDTILE ; ad
+ NONTALKABLE LANDTILE ; ae
+ NONTALKABLE LANDTILE ; af
+ NONTALKABLE LANDTILE ; COLL_RIGHT_WALL
+ NONTALKABLE LANDTILE ; COLL_LEFT_WALL
+ NONTALKABLE LANDTILE ; COLL_UP_WALL
+ NONTALKABLE LANDTILE ; COLL_DOWN_WALL
+ NONTALKABLE LANDTILE ; b4
+ NONTALKABLE LANDTILE ; b5
+ NONTALKABLE LANDTILE ; b6
+ NONTALKABLE LANDTILE ; b7
+ NONTALKABLE LANDTILE ; b8
+ NONTALKABLE LANDTILE ; b9
+ NONTALKABLE LANDTILE ; ba
+ NONTALKABLE LANDTILE ; bb
+ NONTALKABLE LANDTILE ; bc
+ NONTALKABLE LANDTILE ; bd
+ NONTALKABLE LANDTILE ; be
+ NONTALKABLE LANDTILE ; bf
+ NONTALKABLE WATERTILE ; c0
+ NONTALKABLE WATERTILE ; c1
+ NONTALKABLE WATERTILE ; c2
+ NONTALKABLE WATERTILE ; c3
+ NONTALKABLE WATERTILE ; c4
+ NONTALKABLE WATERTILE ; c5
+ NONTALKABLE WATERTILE ; c6
+ NONTALKABLE WATERTILE ; c7
+ NONTALKABLE WATERTILE ; c8
+ NONTALKABLE WATERTILE ; c9
+ NONTALKABLE WATERTILE ; ca
+ NONTALKABLE WATERTILE ; cb
+ NONTALKABLE WATERTILE ; cc
+ NONTALKABLE WATERTILE ; cd
+ NONTALKABLE WATERTILE ; ce
+ NONTALKABLE WATERTILE ; cf
+ NONTALKABLE LANDTILE ; d0
+ NONTALKABLE LANDTILE ; d1
+ NONTALKABLE LANDTILE ; d2
+ NONTALKABLE LANDTILE ; d3
+ NONTALKABLE LANDTILE ; d4
+ NONTALKABLE LANDTILE ; d5
+ NONTALKABLE LANDTILE ; d6
+ NONTALKABLE LANDTILE ; d7
+ NONTALKABLE LANDTILE ; d8
+ NONTALKABLE LANDTILE ; d9
+ NONTALKABLE LANDTILE ; da
+ NONTALKABLE LANDTILE ; db
+ NONTALKABLE LANDTILE ; dc
+ NONTALKABLE LANDTILE ; dd
+ NONTALKABLE LANDTILE ; de
+ NONTALKABLE LANDTILE ; df
+ NONTALKABLE LANDTILE ; e0
+ NONTALKABLE LANDTILE ; e1
+ NONTALKABLE LANDTILE ; e2
+ NONTALKABLE LANDTILE ; e3
+ NONTALKABLE LANDTILE ; e4
+ NONTALKABLE LANDTILE ; e5
+ NONTALKABLE LANDTILE ; e6
+ NONTALKABLE LANDTILE ; e7
+ NONTALKABLE LANDTILE ; e8
+ NONTALKABLE LANDTILE ; e9
+ NONTALKABLE LANDTILE ; ea
+ NONTALKABLE LANDTILE ; eb
+ NONTALKABLE LANDTILE ; ec
+ NONTALKABLE LANDTILE ; ed
+ NONTALKABLE LANDTILE ; ee
+ NONTALKABLE LANDTILE ; ef
+ NONTALKABLE LANDTILE ; f0
+ NONTALKABLE LANDTILE ; f1
+ NONTALKABLE LANDTILE ; f2
+ NONTALKABLE LANDTILE ; f3
+ NONTALKABLE LANDTILE ; f4
+ NONTALKABLE LANDTILE ; f5
+ NONTALKABLE LANDTILE ; f6
+ NONTALKABLE LANDTILE ; f7
+ NONTALKABLE LANDTILE ; f8
+ NONTALKABLE LANDTILE ; f9
+ NONTALKABLE LANDTILE ; fa
+ NONTALKABLE LANDTILE ; fb
+ NONTALKABLE LANDTILE ; fc
+ NONTALKABLE LANDTILE ; fd
+ NONTALKABLE LANDTILE ; fe
+ NONTALKABLE WALLTILE ; COLL_FF
+; 4cf1f
--- /dev/null
+++ b/data/collision_stdscripts.asm
@@ -1,0 +1,13 @@
+; stdscripts associated with tile collisions
+
+TileCollisionStdScripts:
+ ; collision type, stdscript
+ dbw COLL_BOOKSHELF, magazinebookshelf
+ dbw COLL_PC, pcscript
+ dbw COLL_RADIO, radio1
+ dbw COLL_TOWN_MAP, townmap
+ dbw COLL_MART_SHELF, merchandiseshelf
+ dbw COLL_TV, tv
+ dbw COLL_WINDOW, window
+ dbw COLL_INCENSE_BURNER, incenseburner
+ db -1 ; end
--- a/engine/player_movement.asm
+++ b/engine/player_movement.asm
@@ -128,13 +128,13 @@
.not_whirlpool
and $f0
- cp $30 ; moving water
+ cp HI_NYBBLE_CURRENT
jr z, .water
- cp $40 ; moving land 1
+ cp HI_NYBBLE_WALK
jr z, .land1
- cp $50 ; moving land 2
+ cp HI_NYBBLE_WALK_ALT
jr z, .land2
- cp $70 ; warps
+ cp HI_NYBBLE_WARPS
jr z, .warps
jr .no_walk
@@ -150,10 +150,10 @@
jr .continue_walk
.water_table
- db RIGHT
- db LEFT
- db UP
- db DOWN
+ db RIGHT ; COLL_WATERFALL_RIGHT
+ db LEFT ; COLL_WATERFALL_LEFT
+ db UP ; COLL_WATERFALL_UP
+ db DOWN ; COLL_WATERFALL
.land1
ld a, c
@@ -169,14 +169,14 @@
jr .continue_walk
.land1_table
- db STANDING
- db RIGHT
- db LEFT
- db UP
- db DOWN
- db STANDING
- db STANDING
- db STANDING
+ db STANDING ; COLL_BRAKE
+ db RIGHT ; COLL_WALK_RIGHT
+ db LEFT ; COLL_WALK_LEFT
+ db UP ; COLL_WALK_UP
+ db DOWN ; COLL_WALK_DOWN
+ db STANDING ; COLL_BRAKE_45
+ db STANDING ; COLL_BRAKE_46
+ db STANDING ; COLL_BRAKE_47
.land2
ld a, c
@@ -192,24 +192,24 @@
jr .continue_walk
.land2_table
- db RIGHT
- db LEFT
- db UP
- db DOWN
- db STANDING
- db STANDING
- db STANDING
- db STANDING
+ db RIGHT ; COLL_WALK_RIGHT_ALT
+ db LEFT ; COLL_WALK_LEFT_ALT
+ db UP ; COLL_WALK_UP_ALT
+ db DOWN ; COLL_WALK_DOWN_ALT
+ db STANDING ; COLL_BRAKE_ALT
+ db STANDING ; COLL_BRAKE_55
+ db STANDING ; COLL_BRAKE_56
+ db STANDING ; COLL_BRAKE_57
.warps
ld a, c
- cp $71 ; door
+ cp COLL_DOOR
jr z, .down
- cp $79
+ cp COLL_DOOR_79
jr z, .down
- cp $7a ; stairs
+ cp COLL_STAIRCASE
jr z, .down
- cp $7b ; cave
+ cp COLL_CAVE
jr nz, .no_walk
.down
@@ -365,7 +365,7 @@
ld a, [PlayerStandingTile]
ld e, a
and $f0
- cp $a0 ; ledge
+ cp HI_NYBBLE_LEDGES
jr nz, .DontJump
ld a, e
@@ -391,14 +391,14 @@
ret
.data_8021e
- db FACE_RIGHT
- db FACE_LEFT
- db FACE_UP
- db FACE_DOWN
- db FACE_RIGHT | FACE_DOWN
- db FACE_DOWN | FACE_LEFT
- db FACE_UP | FACE_RIGHT
- db FACE_UP | FACE_LEFT
+ db FACE_RIGHT ; COLL_HOP_RIGHT
+ db FACE_LEFT ; COLL_HOP_LEFT
+ db FACE_UP ; COLL_HOP_UP
+ db FACE_DOWN ; COLL_HOP_DOWN
+ db FACE_RIGHT | FACE_DOWN ; COLL_HOP_DOWN_RIGHT
+ db FACE_DOWN | FACE_LEFT ; COLL_HOP_DOWN_LEFT
+ db FACE_UP | FACE_RIGHT ; COLL_HOP_UP_RIGHT
+ db FACE_UP | FACE_LEFT ; COLL_HOP_UP_LEFT
; 80226
.CheckWarp: ; 80226
@@ -443,7 +443,10 @@
ret
.EdgeWarps:
- db $70, $78, $76, $7e
+ db COLL_WARP_CARPET_DOWN
+ db COLL_WARP_CARPET_UP
+ db COLL_WARP_CARPET_LEFT
+ db COLL_WARP_CARPET_RIGHT
; 8025f
.DoStep:
@@ -759,7 +762,7 @@
; Return 0 if tile a is land. Otherwise, return carry.
call GetTileCollision
- and a ; land
+ and a ; LANDTILE?
ret z
scf
ret
@@ -774,7 +777,7 @@
jr z, .Water
; Can walk back onto land from water.
- and a
+ and a ; LANDTILE?
jr z, .Land
jr .Neither
--- a/engine/tile_events.asm
+++ b/engine/tile_events.asm
@@ -1,12 +1,12 @@
CheckWarpCollision:: ; 1499a
; Is this tile a warp?
ld a, [PlayerStandingTile]
- cp $60
+ cp COLL_PIT
jr z, .warp
- cp $68
+ cp COLL_PIT_68
jr z, .warp
and $f0
- cp $70
+ cp HI_NYBBLE_WARPS
jr z, .warp
and a
ret
@@ -20,13 +20,13 @@
; If this is a directional warp, clear carry (press the designated button to warp).
; Else, set carry (immediate warp).
ld a, [PlayerStandingTile]
- cp $70 ; Warp on down
+ cp COLL_WARP_CARPET_DOWN
jr z, .directional
- cp $76 ; Warp on left
+ cp COLL_WARP_CARPET_LEFT
jr z, .directional
- cp $78 ; Warp on up
+ cp COLL_WARP_CARPET_UP
jr z, .directional
- cp $7e ; Warp on right
+ cp COLL_WARP_CARPET_RIGHT
jr z, .directional
scf
ret
@@ -45,15 +45,15 @@
; 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 COLL_DOOR
+ db COLL_DOOR_79
+ db COLL_STAIRCASE
+ db COLL_STAIRCASE_73
+ db COLL_CAVE
+ db COLL_CAVE_74
+ db COLL_WARP_PANEL
+ db COLL_DOOR_75
+ db COLL_DOOR_7D
db -1
; 149dd
@@ -66,16 +66,16 @@
; 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 COLL_CUT_08
+ db COLL_TALL_GRASS
+ db COLL_LONG_GRASS
+ db COLL_CUT_28
+ db COLL_WATER
+ db COLL_GRASS_48
+ db COLL_GRASS_49
+ db COLL_GRASS_4A
+ db COLL_GRASS_4B
+ db COLL_GRASS_4C
db -1
; 149f5
@@ -88,12 +88,12 @@
; 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 COLL_CUT_TREE
+ db COLL_CUT_TREE_1A
+ db COLL_TALL_GRASS_10
+ db COLL_TALL_GRASS
+ db COLL_LONG_GRASS
+ db COLL_LONG_GRASS_1C
db -1
; 14a07
@@ -100,10 +100,10 @@
GetWarpSFX:: ; 14a07
ld a, [PlayerStandingTile]
ld de, SFX_ENTER_DOOR
- cp $71 ; door
+ cp COLL_DOOR
ret z
ld de, SFX_WARP_TO
- cp $7c ; warp pad
+ cp COLL_WARP_PANEL
ret z
ld de, SFX_EXIT_BUILDING
ret
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -120,23 +120,23 @@
CheckGrassTile:: ; 1875
ld d, a
and $f0
- cp $10
- jr z, .ok_10
- cp $20
- jr z, .ok_20
+ cp HI_NYBBLE_TALL_GRASS
+ jr z, .grass
+ cp HI_NYBBLE_WATER
+ jr z, .water
scf
ret
-.ok_10
+.grass
ld a, d
- and 7
+ and LO_NYBBLE_GRASS
ret z
scf
ret
; For some reason, the above code is duplicated down here.
-.ok_20
+.water
ld a, d
- and 7
+ and LO_NYBBLE_GRASS
ret z
scf
ret
@@ -143,44 +143,44 @@
; 188e
CheckSuperTallGrassTile:: ; 188e
- cp $14
+ cp COLL_LONG_GRASS
ret z
- cp $1c
+ cp COLL_LONG_GRASS_1C
ret
; 1894
CheckCutTreeTile:: ; 1894
- cp $12
+ cp COLL_CUT_TREE
ret z
- cp $1a
+ cp COLL_CUT_TREE_1A
ret
; 189a
CheckHeadbuttTreeTile:: ; 189a
- cp $15
+ cp COLL_HEADBUTT_TREE
ret z
- cp $1d
+ cp COLL_HEADBUTT_TREE_1D
ret
; 18a0
CheckCounterTile:: ; 18a0
- cp $90
+ cp COLL_COUNTER
ret z
- cp $98
+ cp COLL_COUNTER_98
ret
; 18a6
CheckPitTile:: ; 18a6
- cp $60
+ cp COLL_PIT
ret z
- cp $68
+ cp COLL_PIT_68
ret
; 18ac
CheckIceTile:: ; 18ac
- cp $23
+ cp COLL_ICE
ret z
- cp $2b
+ cp COLL_ICE_2B
ret z
scf
ret
@@ -188,9 +188,9 @@
CheckWhirlpoolTile:: ; 18b4
nop
- cp $24
+ cp COLL_WHIRLPOOL
ret z
- cp $2c
+ cp COLL_WHIRLPOOL_2C
ret z
scf
ret
@@ -197,21 +197,21 @@
; 18bd
CheckWaterfallTile:: ; 18bd
- cp $33
+ cp COLL_WATERFALL
ret z
- cp $3b
+ cp COLL_CURRENT_DOWN
ret
; 18c3
CheckStandingOnEntrance:: ; 18c3
ld a, [PlayerStandingTile]
- cp $71 ; door
+ cp COLL_DOOR
ret z
- cp $79
+ cp COLL_DOOR_79
ret z
- cp $7a ; stairs
+ cp COLL_STAIRCASE
ret z
- cp $7b ; cave
+ cp COLL_CAVE
ret
; 18d2
--- a/main.asm
+++ b/main.asm
@@ -508,7 +508,7 @@
; Checks to see if the tile you're facing has a std script associated with it. If so, executes the script and returns carry.
ld a, c
ld de, 3
- ld hl, .table1
+ ld hl, TileCollisionStdScripts
call IsInArray
jr nc, .notintable
@@ -529,16 +529,7 @@
xor a
ret
-.table1
- dbw $91, magazinebookshelf
- dbw $93, pcscript
- dbw $94, radio1
- dbw $95, townmap
- dbw $96, merchandiseshelf
- dbw $97, tv
- dbw $9d, window
- dbw $9f, incenseburner
- db -1 ; end
+INCLUDE "data/collision_stdscripts.asm"
Script_JumpStdFromRAM: ; 0x1369a
jump wJumpStdScriptBuffer
@@ -1952,7 +1943,7 @@
INCLUDE "tilesets/palette_maps.asm"
-INCLUDE "tilesets/collision.asm"
+INCLUDE "data/collision_permissions.asm"
EmptyAllSRAMBanks: ; 4cf1f
ld a, $0
--- a/tilesets/collision.asm
+++ /dev/null
@@ -1,262 +1,0 @@
-NONTALKABLE EQUS "db"
-TALKABLE EQUS "db TALK +"
-
-TileCollisionTable:: ; 4ce1f
-; entries correspond to collision ids
- NONTALKABLE LANDTILE ; 00
- NONTALKABLE LANDTILE ; 01
- NONTALKABLE LANDTILE ; 02
- NONTALKABLE LANDTILE ; 03
- NONTALKABLE LANDTILE ; 04
- NONTALKABLE LANDTILE ; 05
- NONTALKABLE LANDTILE ; 06
- NONTALKABLE WALLTILE ; 07
- NONTALKABLE LANDTILE ; 08
- NONTALKABLE LANDTILE ; 09
- NONTALKABLE LANDTILE ; 0a
- NONTALKABLE LANDTILE ; 0b
- NONTALKABLE LANDTILE ; 0c
- NONTALKABLE LANDTILE ; 0d
- NONTALKABLE LANDTILE ; 0e
- NONTALKABLE WALLTILE ; 0f
- NONTALKABLE LANDTILE ; 10
- NONTALKABLE LANDTILE ; 11
- TALKABLE WALLTILE ; 12
- NONTALKABLE LANDTILE ; 13
- NONTALKABLE LANDTILE ; 14
- TALKABLE WALLTILE ; 15
- NONTALKABLE LANDTILE ; 16
- NONTALKABLE LANDTILE ; 17
- NONTALKABLE LANDTILE ; 18
- NONTALKABLE LANDTILE ; 19
- TALKABLE WALLTILE ; 1a
- NONTALKABLE LANDTILE ; 1b
- NONTALKABLE LANDTILE ; 1c
- TALKABLE WALLTILE ; 1d
- NONTALKABLE LANDTILE ; 1e
- NONTALKABLE LANDTILE ; 1f
- NONTALKABLE WATERTILE ; 20
- NONTALKABLE WATERTILE ; 21
- TALKABLE WATERTILE ; 22
- NONTALKABLE LANDTILE ; 23
- TALKABLE WATERTILE ; 24
- NONTALKABLE WATERTILE ; 25
- NONTALKABLE WATERTILE ; 26
- NONTALKABLE WALLTILE ; 27
- NONTALKABLE WATERTILE ; 28
- NONTALKABLE WATERTILE ; 29
- TALKABLE WATERTILE ; 2a
- NONTALKABLE LANDTILE ; 2b
- TALKABLE WATERTILE ; 2c
- NONTALKABLE WATERTILE ; 2d
- NONTALKABLE WATERTILE ; 2e
- NONTALKABLE WALLTILE ; 2f
- NONTALKABLE WATERTILE ; 30
- NONTALKABLE WATERTILE ; 31
- NONTALKABLE WATERTILE ; 32
- NONTALKABLE WATERTILE ; 33
- NONTALKABLE WATERTILE ; 34
- NONTALKABLE WATERTILE ; 35
- NONTALKABLE WATERTILE ; 36
- NONTALKABLE WATERTILE ; 37
- NONTALKABLE WATERTILE ; 38
- NONTALKABLE WATERTILE ; 39
- NONTALKABLE WATERTILE ; 3a
- NONTALKABLE WATERTILE ; 3b
- NONTALKABLE WATERTILE ; 3c
- NONTALKABLE WATERTILE ; 3d
- NONTALKABLE WATERTILE ; 3e
- NONTALKABLE WATERTILE ; 3f
- NONTALKABLE LANDTILE ; 40
- NONTALKABLE LANDTILE ; 41
- NONTALKABLE LANDTILE ; 42
- NONTALKABLE LANDTILE ; 43
- NONTALKABLE LANDTILE ; 44
- NONTALKABLE LANDTILE ; 45
- NONTALKABLE LANDTILE ; 46
- NONTALKABLE LANDTILE ; 47
- NONTALKABLE LANDTILE ; 48
- NONTALKABLE LANDTILE ; 49
- NONTALKABLE LANDTILE ; 4a
- NONTALKABLE LANDTILE ; 4b
- NONTALKABLE LANDTILE ; 4c
- NONTALKABLE LANDTILE ; 4d
- NONTALKABLE LANDTILE ; 4e
- NONTALKABLE LANDTILE ; 4f
- NONTALKABLE LANDTILE ; 50
- NONTALKABLE LANDTILE ; 51
- NONTALKABLE LANDTILE ; 52
- NONTALKABLE LANDTILE ; 53
- NONTALKABLE LANDTILE ; 54
- NONTALKABLE LANDTILE ; 55
- NONTALKABLE LANDTILE ; 56
- NONTALKABLE LANDTILE ; 57
- NONTALKABLE LANDTILE ; 58
- NONTALKABLE LANDTILE ; 59
- NONTALKABLE LANDTILE ; 5a
- NONTALKABLE LANDTILE ; 5b
- NONTALKABLE LANDTILE ; 5c
- NONTALKABLE LANDTILE ; 5d
- NONTALKABLE LANDTILE ; 5e
- NONTALKABLE LANDTILE ; 5f
- NONTALKABLE LANDTILE ; 60
- NONTALKABLE LANDTILE ; 61
- NONTALKABLE WALLTILE ; 62
- NONTALKABLE LANDTILE ; 63
- NONTALKABLE LANDTILE ; 64
- NONTALKABLE LANDTILE ; 65
- NONTALKABLE LANDTILE ; 66
- NONTALKABLE LANDTILE ; 67
- NONTALKABLE LANDTILE ; 68
- NONTALKABLE LANDTILE ; 69
- NONTALKABLE WALLTILE ; 6a
- NONTALKABLE LANDTILE ; 6b
- NONTALKABLE LANDTILE ; 6c
- NONTALKABLE LANDTILE ; 6d
- NONTALKABLE LANDTILE ; 6e
- NONTALKABLE LANDTILE ; 6f
- NONTALKABLE LANDTILE ; 70
- NONTALKABLE LANDTILE ; 71
- NONTALKABLE LANDTILE ; 72
- NONTALKABLE LANDTILE ; 73
- NONTALKABLE LANDTILE ; 74
- NONTALKABLE LANDTILE ; 75
- NONTALKABLE LANDTILE ; 76
- NONTALKABLE LANDTILE ; 77
- NONTALKABLE LANDTILE ; 78
- NONTALKABLE LANDTILE ; 79
- NONTALKABLE LANDTILE ; 7a
- NONTALKABLE LANDTILE ; 7b
- NONTALKABLE LANDTILE ; 7c
- NONTALKABLE LANDTILE ; 7d
- NONTALKABLE LANDTILE ; 7e
- NONTALKABLE LANDTILE ; 7f
- NONTALKABLE WALLTILE ; 80
- NONTALKABLE WALLTILE ; 81
- NONTALKABLE WALLTILE ; 82
- NONTALKABLE WALLTILE ; 83
- NONTALKABLE WALLTILE ; 84
- NONTALKABLE LANDTILE ; 85
- NONTALKABLE LANDTILE ; 86
- NONTALKABLE LANDTILE ; 87
- NONTALKABLE WALLTILE ; 88
- NONTALKABLE WALLTILE ; 89
- NONTALKABLE WALLTILE ; 8a
- NONTALKABLE WALLTILE ; 8b
- NONTALKABLE WALLTILE ; 8c
- NONTALKABLE LANDTILE ; 8d
- NONTALKABLE LANDTILE ; 8e
- NONTALKABLE LANDTILE ; 8f
- NONTALKABLE WALLTILE ; 90
- NONTALKABLE WALLTILE ; 91
- NONTALKABLE WALLTILE ; 92
- NONTALKABLE WALLTILE ; 93
- NONTALKABLE WALLTILE ; 94
- NONTALKABLE WALLTILE ; 95
- NONTALKABLE WALLTILE ; 96
- NONTALKABLE WALLTILE ; 97
- NONTALKABLE WALLTILE ; 98
- NONTALKABLE WALLTILE ; 99
- NONTALKABLE WALLTILE ; 9a
- NONTALKABLE WALLTILE ; 9b
- NONTALKABLE WALLTILE ; 9c
- NONTALKABLE WALLTILE ; 9d
- NONTALKABLE WALLTILE ; 9e
- NONTALKABLE WALLTILE ; 9f
- NONTALKABLE LANDTILE ; a0
- NONTALKABLE LANDTILE ; a1
- NONTALKABLE LANDTILE ; a2
- NONTALKABLE LANDTILE ; a3
- NONTALKABLE LANDTILE ; a4
- NONTALKABLE LANDTILE ; a5
- NONTALKABLE LANDTILE ; a6
- NONTALKABLE LANDTILE ; a7
- NONTALKABLE LANDTILE ; a8
- NONTALKABLE LANDTILE ; a9
- NONTALKABLE LANDTILE ; aa
- NONTALKABLE LANDTILE ; ab
- NONTALKABLE LANDTILE ; ac
- NONTALKABLE LANDTILE ; ad
- NONTALKABLE LANDTILE ; ae
- NONTALKABLE LANDTILE ; af
- NONTALKABLE LANDTILE ; b0
- NONTALKABLE LANDTILE ; b1
- NONTALKABLE LANDTILE ; b2
- NONTALKABLE LANDTILE ; b3
- NONTALKABLE LANDTILE ; b4
- NONTALKABLE LANDTILE ; b5
- NONTALKABLE LANDTILE ; b6
- NONTALKABLE LANDTILE ; b7
- NONTALKABLE LANDTILE ; b8
- NONTALKABLE LANDTILE ; b9
- NONTALKABLE LANDTILE ; ba
- NONTALKABLE LANDTILE ; bb
- NONTALKABLE LANDTILE ; bc
- NONTALKABLE LANDTILE ; bd
- NONTALKABLE LANDTILE ; be
- NONTALKABLE LANDTILE ; bf
- NONTALKABLE WATERTILE ; c0
- NONTALKABLE WATERTILE ; c1
- NONTALKABLE WATERTILE ; c2
- NONTALKABLE WATERTILE ; c3
- NONTALKABLE WATERTILE ; c4
- NONTALKABLE WATERTILE ; c5
- NONTALKABLE WATERTILE ; c6
- NONTALKABLE WATERTILE ; c7
- NONTALKABLE WATERTILE ; c8
- NONTALKABLE WATERTILE ; c9
- NONTALKABLE WATERTILE ; ca
- NONTALKABLE WATERTILE ; cb
- NONTALKABLE WATERTILE ; cc
- NONTALKABLE WATERTILE ; cd
- NONTALKABLE WATERTILE ; ce
- NONTALKABLE WATERTILE ; cf
- NONTALKABLE LANDTILE ; d0
- NONTALKABLE LANDTILE ; d1
- NONTALKABLE LANDTILE ; d2
- NONTALKABLE LANDTILE ; d3
- NONTALKABLE LANDTILE ; d4
- NONTALKABLE LANDTILE ; d5
- NONTALKABLE LANDTILE ; d6
- NONTALKABLE LANDTILE ; d7
- NONTALKABLE LANDTILE ; d8
- NONTALKABLE LANDTILE ; d9
- NONTALKABLE LANDTILE ; da
- NONTALKABLE LANDTILE ; db
- NONTALKABLE LANDTILE ; dc
- NONTALKABLE LANDTILE ; dd
- NONTALKABLE LANDTILE ; de
- NONTALKABLE LANDTILE ; df
- NONTALKABLE LANDTILE ; e0
- NONTALKABLE LANDTILE ; e1
- NONTALKABLE LANDTILE ; e2
- NONTALKABLE LANDTILE ; e3
- NONTALKABLE LANDTILE ; e4
- NONTALKABLE LANDTILE ; e5
- NONTALKABLE LANDTILE ; e6
- NONTALKABLE LANDTILE ; e7
- NONTALKABLE LANDTILE ; e8
- NONTALKABLE LANDTILE ; e9
- NONTALKABLE LANDTILE ; ea
- NONTALKABLE LANDTILE ; eb
- NONTALKABLE LANDTILE ; ec
- NONTALKABLE LANDTILE ; ed
- NONTALKABLE LANDTILE ; ee
- NONTALKABLE LANDTILE ; ef
- NONTALKABLE LANDTILE ; f0
- NONTALKABLE LANDTILE ; f1
- NONTALKABLE LANDTILE ; f2
- NONTALKABLE LANDTILE ; f3
- NONTALKABLE LANDTILE ; f4
- NONTALKABLE LANDTILE ; f5
- NONTALKABLE LANDTILE ; f6
- NONTALKABLE LANDTILE ; f7
- NONTALKABLE LANDTILE ; f8
- NONTALKABLE LANDTILE ; f9
- NONTALKABLE LANDTILE ; fa
- NONTALKABLE LANDTILE ; fb
- NONTALKABLE LANDTILE ; fc
- NONTALKABLE LANDTILE ; fd
- NONTALKABLE LANDTILE ; fe
- NONTALKABLE WALLTILE ; ff
-; 4cf1f