mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Create COLL_OUT_OF_BOUNDS to handle isolated areas within the same map that should not be visible in View Map mode (#29)
This commit is contained in:
parent
78b8f05fb7
commit
7ede3d1357
@ -126,7 +126,7 @@ DEF COLL_UP_LEFT_BUOY EQU $c7 ; unused
|
|||||||
const COLL_BRANCH_SPACE ; $d8
|
const COLL_BRANCH_SPACE ; $d8
|
||||||
const COLL_UNION_SPACE ; $d9
|
const COLL_UNION_SPACE ; $d9
|
||||||
DEF NUM_COLL_SPACES EQU const_value - $d0
|
DEF NUM_COLL_SPACES EQU const_value - $d0
|
||||||
DEF COLL_FF EQU $ff ; garbage
|
DEF COLL_OUT_OF_BOUNDS EQU $ff
|
||||||
|
|
||||||
; collision data type nybbles
|
; collision data type nybbles
|
||||||
DEF LO_NYBBLE_GRASS EQU $07
|
DEF LO_NYBBLE_GRASS EQU $07
|
||||||
|
@ -256,5 +256,5 @@ TileCollisionTable::
|
|||||||
db LAND_TILE ; fc
|
db LAND_TILE ; fc
|
||||||
db LAND_TILE ; fd
|
db LAND_TILE ; fd
|
||||||
db LAND_TILE ; fe
|
db LAND_TILE ; fe
|
||||||
db WALL_TILE ; COLL_FF
|
db WALL_TILE ; COLL_OUT_OF_BOUNDS
|
||||||
assert_table_length $100
|
assert_table_length $100
|
||||||
|
@ -114,9 +114,9 @@ if DEF(_DEBUG)
|
|||||||
|
|
||||||
map_attributes DebugLevel3_Map1, DEBUGLEVEL_3_MAP_1, $00, 0
|
map_attributes DebugLevel3_Map1, DEBUGLEVEL_3_MAP_1, $00, 0
|
||||||
|
|
||||||
map_attributes DebugLevel4_Map1, DEBUGLEVEL_4_MAP_1, $05, SOUTH
|
map_attributes DebugLevel4_Map1, DEBUGLEVEL_4_MAP_1, $00, SOUTH
|
||||||
connection south, DebugLevel5_Map1, DEBUGLEVEL_5_MAP_1, -1
|
connection south, DebugLevel5_Map1, DEBUGLEVEL_5_MAP_1, -1
|
||||||
|
|
||||||
map_attributes DebugLevel5_Map1, DEBUGLEVEL_5_MAP_1, $05, NORTH
|
map_attributes DebugLevel5_Map1, DEBUGLEVEL_5_MAP_1, $00, NORTH
|
||||||
connection north, DebugLevel4_Map1, DEBUGLEVEL_4_MAP_1, 1
|
connection north, DebugLevel4_Map1, DEBUGLEVEL_4_MAP_1, 1
|
||||||
endc
|
endc
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
tilecoll 01, 01, 01, 01 ; 00
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 00
|
||||||
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 01
|
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 01
|
||||||
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 02
|
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 02
|
||||||
tilecoll TALL_GRASS, TALL_GRASS, TALL_GRASS, TALL_GRASS ; 03
|
tilecoll TALL_GRASS, TALL_GRASS, TALL_GRASS, TALL_GRASS ; 03
|
||||||
|
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
tilecoll WALL, WALL, WALL, WALL ; 00
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 00
|
||||||
tilecoll WALL, WALL, WALL, WALL ; 01
|
tilecoll WALL, WALL, WALL, WALL ; 01
|
||||||
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 02
|
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 02
|
||||||
tilecoll TALL_GRASS, TALL_GRASS, TALL_GRASS, TALL_GRASS ; 03
|
tilecoll TALL_GRASS, TALL_GRASS, TALL_GRASS, TALL_GRASS ; 03
|
||||||
|
@ -36,29 +36,29 @@
|
|||||||
tilecoll WALL, STAIRCASE, FLOOR, FLOOR ; 23
|
tilecoll WALL, STAIRCASE, FLOOR, FLOOR ; 23
|
||||||
tilecoll WALL, STAIRCASE, FLOOR, FLOOR ; 24
|
tilecoll WALL, STAIRCASE, FLOOR, FLOOR ; 24
|
||||||
tilecoll WALL, STAIRCASE, FLOOR, FLOOR ; 25
|
tilecoll WALL, STAIRCASE, FLOOR, FLOOR ; 25
|
||||||
tilecoll FF, FF, FF, FF ; 26
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 26
|
||||||
tilecoll FF, FF, FF, FF ; 27
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 27
|
||||||
tilecoll FF, FF, FF, FF ; 28
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 28
|
||||||
tilecoll FF, FF, FF, FF ; 29
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 29
|
||||||
tilecoll FF, FF, FF, FF ; 2a
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 2a
|
||||||
tilecoll FF, FF, FF, FF ; 2b
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 2b
|
||||||
tilecoll FF, FF, FF, FF ; 2c
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 2c
|
||||||
tilecoll FF, FF, FF, FF ; 2d
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 2d
|
||||||
tilecoll FF, FF, FF, FF ; 2e
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 2e
|
||||||
tilecoll FF, FF, FF, FF ; 2f
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 2f
|
||||||
tilecoll FF, FF, FF, FF ; 30
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 30
|
||||||
tilecoll FF, FF, FF, FF ; 31
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 31
|
||||||
tilecoll FF, FF, FF, FF ; 32
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 32
|
||||||
tilecoll FF, FF, FF, FF ; 33
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 33
|
||||||
tilecoll FF, FF, FF, FF ; 34
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 34
|
||||||
tilecoll FF, FF, FF, FF ; 35
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 35
|
||||||
tilecoll FF, FF, FF, FF ; 36
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 36
|
||||||
tilecoll FF, FF, FF, FF ; 37
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 37
|
||||||
tilecoll FF, FF, FF, FF ; 38
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 38
|
||||||
tilecoll FF, FF, FF, FF ; 39
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 39
|
||||||
tilecoll FF, FF, FF, FF ; 3a
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 3a
|
||||||
tilecoll FF, FF, FF, FF ; 3b
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 3b
|
||||||
tilecoll FF, FF, FF, FF ; 3c
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 3c
|
||||||
tilecoll FF, FF, FF, FF ; 3d
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 3d
|
||||||
tilecoll FF, FF, FF, FF ; 3e
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 3e
|
||||||
tilecoll FF, FF, FF, FF ; 3f
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 3f
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
tilecoll FF, FF, FF, FF ; 00
|
tilecoll OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS, OUT_OF_BOUNDS ; 00
|
||||||
tilecoll UP_WALL, UP_WALL, FLOOR, FLOOR ; 01
|
tilecoll UP_WALL, UP_WALL, FLOOR, FLOOR ; 01
|
||||||
tilecoll UP_WALL, FLOOR, UP_WALL, FLOOR ; 02
|
tilecoll UP_WALL, FLOOR, UP_WALL, FLOOR ; 02
|
||||||
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 03
|
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 03
|
||||||
|
@ -131,8 +131,8 @@
|
|||||||
a) If View Map mode was entered from the board menu, ``BOARDEVENT_REDISPLAY_MENU`` is loaded. It is the same as ``BOARDEVENT_DISPLAY_MENU`` but skips ``BoardMenuScript.Upkeep``.
|
a) If View Map mode was entered from the board menu, ``BOARDEVENT_REDISPLAY_MENU`` is loaded. It is the same as ``BOARDEVENT_DISPLAY_MENU`` but skips ``BoardMenuScript.Upkeep``.
|
||||||
b) If View Map mode was entered from the branch menu, instead ``BOARDEVENT_RESUME_BRANCH`` is loaded, using ``wPlayerSpriteSetupFlags[PLAYERSPRITESETUP_CUSTOM_FACING_F]`` to maintain the facing direction according to the direction (``SPRITEMOVEDATA_*``) of the mocked player object. ``BOARDEVENT_RESUME_BRANCH`` makes sure to shortcut the branch space script by calling ``BranchSpaceScript_PromptPlayer`` directly and avoiding the recomputation of the branch struct that would cause corruption. ``BOARDEVENT_HANDLE_BOARD`` is loaded immediately by ``BOARDEVENT_RESUME_BRANCH``.
|
b) If View Map mode was entered from the branch menu, instead ``BOARDEVENT_RESUME_BRANCH`` is loaded, using ``wPlayerSpriteSetupFlags[PLAYERSPRITESETUP_CUSTOM_FACING_F]`` to maintain the facing direction according to the direction (``SPRITEMOVEDATA_*``) of the mocked player object. ``BOARDEVENT_RESUME_BRANCH`` makes sure to shortcut the branch space script by calling ``BranchSpaceScript_PromptPlayer`` directly and avoiding the recomputation of the branch struct that would cause corruption. ``BOARDEVENT_HANDLE_BOARD`` is loaded immediately by ``BOARDEVENT_RESUME_BRANCH``.
|
||||||
|
|
||||||
- In View Map mode, regular collisions are ignored whereas going off-limits (based on map dimensions and connected maps) or off-range is accounted for.
|
- In View Map mode, regular collisions except for ``COLL_OUT_OF_BOUNDS`` are ignored whereas going off-limits (i.e. outside of the map limits in a direction where there is no connected map) or off-range is accounted for.
|
||||||
- Events other than warpless connections are ignored in View Map mode (as well as button actions, like while in ``BOARDEVENT_HANDLE_BOARD``).
|
- Events other than warpless connections are ignored in View Map mode (as well as button actions, like while in ``BOARDEVENT_HANDLE_BOARD``).
|
||||||
- ``wTileDown``, ``wTileUp``, etc., otherwise unused, are borrowed by in order to signal valid directions to ``InitSecondarySprites`` (e.g. ``wTileDown=$ff`` means that DOWN direction is not valid).
|
- ``wTileDown``, ``wTileUp``, etc., otherwise unused, are borrowed by in order to signal valid directions to ``InitSecondarySprites`` (e.g. ``wTileDown=COLL_OUT_OF_BOUNDS`` means that DOWN direction is not valid).
|
||||||
- In View Map mode, the overworld delay is 1 rather than 2.
|
- In View Map mode, the overworld delay is 1 rather than 2.
|
||||||
- ``UpdatePlayerCoords`` tracks the displacement during View Map mode in the X and Y axes in order to monitor the allowed range.
|
- ``UpdatePlayerCoords`` tracks the displacement during View Map mode in the X and Y axes in order to monitor the allowed range.
|
@ -141,18 +141,60 @@ DoPlayerMovement::
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.ViewMapMode_CheckCollision:
|
.ViewMapMode_CheckCollision:
|
||||||
; return STANDING into wWalkingDirection if trying to walk
|
; return STANDING into wWalkingDirection if trying to walk off-limits or off-range
|
||||||
; off-limits (unless there is a connected map) or off-range
|
|
||||||
|
|
||||||
; as wTileDown, wTileUp, wTileLeft, and wTileRight are not used in this mode,
|
; wTileDown, wTileUp, wTileLeft, and wTileRight are borrowed in this mode
|
||||||
; they are borrowed in order to signal valid directions to InitSecondarySprites
|
; to signal valid directions to InitSecondarySprites.
|
||||||
xor a
|
xor a
|
||||||
ld hl, wTileDown
|
ld hl, wTileDown
|
||||||
ld [hli], a
|
ld [hli], a ; wTileDown
|
||||||
ld [hli], a ; wTileUp
|
ld [hli], a ; wTileUp
|
||||||
ld [hli], a ; wTileLeft
|
ld [hli], a ; wTileLeft
|
||||||
ld [hl], a ; wTileRight
|
ld [hl], a ; wTileRight
|
||||||
|
|
||||||
|
; for each direction, check if next tile is COLL_OUT_OF_BOUNDS, which is the only impassable collision in View Map mode
|
||||||
|
xor a
|
||||||
|
ld [wTilePermissions], a
|
||||||
|
|
||||||
|
ld a, [wPlayerMapX]
|
||||||
|
ld d, a
|
||||||
|
ld a, [wPlayerMapY]
|
||||||
|
ld e, a
|
||||||
|
push de
|
||||||
|
inc e
|
||||||
|
call GetCoordTile
|
||||||
|
cp COLL_OUT_OF_BOUNDS
|
||||||
|
jr nz, .next1
|
||||||
|
ld [wTileDown], a
|
||||||
|
.next1
|
||||||
|
pop de
|
||||||
|
dec e
|
||||||
|
call GetCoordTile
|
||||||
|
cp COLL_OUT_OF_BOUNDS
|
||||||
|
jr nz, .next2
|
||||||
|
ld [wTileUp], a
|
||||||
|
.next2
|
||||||
|
|
||||||
|
ld a, [wPlayerMapX]
|
||||||
|
ld d, a
|
||||||
|
ld a, [wPlayerMapY]
|
||||||
|
ld e, a
|
||||||
|
push de
|
||||||
|
dec d
|
||||||
|
call GetCoordTile
|
||||||
|
cp COLL_OUT_OF_BOUNDS
|
||||||
|
jr nz, .next3
|
||||||
|
ld [wTileLeft], a
|
||||||
|
.next3
|
||||||
|
pop de
|
||||||
|
inc d
|
||||||
|
call GetCoordTile
|
||||||
|
cp COLL_OUT_OF_BOUNDS
|
||||||
|
jr nz, .next4
|
||||||
|
ld [wTileRight], a
|
||||||
|
.next4
|
||||||
|
|
||||||
|
; for each direction, check if trying to go off-limits
|
||||||
ld hl, wYCoord
|
ld hl, wYCoord
|
||||||
ld de, wMapHeight
|
ld de, wMapHeight
|
||||||
ld bc, wSouthConnectedMapGroup
|
ld bc, wSouthConnectedMapGroup
|
||||||
@ -174,42 +216,42 @@ DoPlayerMovement::
|
|||||||
ld a, LEFT
|
ld a, LEFT
|
||||||
call .ViewMapMode_CheckDirectionOffLimits
|
call .ViewMapMode_CheckDirectionOffLimits
|
||||||
|
|
||||||
; now check in which directions the player would be walking off-range
|
; for each direction, check if trying to go off-range
|
||||||
ld hl, wViewMapModeRange
|
ld hl, wViewMapModeRange
|
||||||
ld de, wViewMapModeDisplacementY
|
ld de, wViewMapModeDisplacementY
|
||||||
ld bc, wTileDown
|
ld bc, wTileDown
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nz, .next1
|
jr nz, .next5
|
||||||
ld a, $ff
|
ld a, COLL_OUT_OF_BOUNDS
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
.next1
|
.next5
|
||||||
inc bc ; wTileUp
|
inc bc ; wTileUp
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
xor $ff
|
xor $ff
|
||||||
inc a
|
inc a
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nz, .next2
|
jr nz, .next6
|
||||||
ld a, $ff
|
ld a, COLL_OUT_OF_BOUNDS
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
.next2
|
.next6
|
||||||
ld de, wViewMapModeDisplacementX
|
ld de, wViewMapModeDisplacementX
|
||||||
inc bc ; wTileLeft
|
inc bc ; wTileLeft
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
xor $ff
|
xor $ff
|
||||||
inc a
|
inc a
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nz, .next3
|
jr nz, .next7
|
||||||
ld a, $ff
|
ld a, COLL_OUT_OF_BOUNDS
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
.next3
|
.next7
|
||||||
inc bc ; wTileRight
|
inc bc ; wTileRight
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nz, .next4
|
jr nz, .next8
|
||||||
ld a, $ff
|
ld a, COLL_OUT_OF_BOUNDS
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
.next4
|
.next8
|
||||||
|
|
||||||
; finally return STANDING into wWalkingDirection in the current direction at
|
; finally return STANDING into wWalkingDirection in the current direction at
|
||||||
; wWalkingDirection has had its corresponding wTile* address set to $ff.
|
; wWalkingDirection has had its corresponding wTile* address set to $ff.
|
||||||
@ -221,8 +263,9 @@ DoPlayerMovement::
|
|||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
inc a ; cp $ff
|
cp COLL_OUT_OF_BOUNDS
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
ld a, STANDING
|
ld a, STANDING
|
||||||
ld [wWalkingDirection], a
|
ld [wWalkingDirection], a
|
||||||
ret
|
ret
|
||||||
@ -235,6 +278,9 @@ DoPlayerMovement::
|
|||||||
.ViewMapMode_CheckDirectionOffLimits:
|
.ViewMapMode_CheckDirectionOffLimits:
|
||||||
push af
|
push af
|
||||||
|
|
||||||
|
; connection strips that aren't as large as the map height/width are not accounted for.
|
||||||
|
; to avoid viewing map off-limits when there is a partial map connection,
|
||||||
|
; use COLL_OUT_OF_BOUNDS in out of bound tiles.
|
||||||
ld a, [bc] ; connected map group
|
ld a, [bc] ; connected map group
|
||||||
inc a
|
inc a
|
||||||
jr nz, .valid ; it's ok if there's any connected map in this direction
|
jr nz, .valid ; it's ok if there's any connected map in this direction
|
||||||
|
@ -1769,7 +1769,7 @@ GetCoordTile::
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
.nope
|
.nope
|
||||||
ld a, -1
|
ld a, COLL_OUT_OF_BOUNDS
|
||||||
ret
|
ret
|
||||||
|
|
||||||
GetBlockLocation::
|
GetBlockLocation::
|
||||||
|
Loading…
Reference in New Issue
Block a user