You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Add anchor points to support manual movement between spaces (#26)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
StepTowardsNextSpace::
|
||||
ld a, [wCurSpaceNextSpace]
|
||||
cp NEXT_SPACE_IS_ANCHOR_POINT
|
||||
jr nc, .move_towards_anchor_point
|
||||
call LoadTempSpaceData
|
||||
ld a, [wTempSpaceXCoord]
|
||||
ld c, a
|
||||
@@ -27,3 +29,19 @@ StepTowardsNextSpace::
|
||||
.done
|
||||
ld [wCurInput], a
|
||||
ret
|
||||
|
||||
.move_towards_anchor_point
|
||||
ld c, D_DOWN
|
||||
cp GO_DOWN
|
||||
jr z, .done2
|
||||
ld c, D_UP
|
||||
cp GO_UP
|
||||
jr z, .done2
|
||||
ld c, D_LEFT
|
||||
cp GO_LEFT
|
||||
jr z, .done2
|
||||
ld c, D_RIGHT
|
||||
.done2
|
||||
ld a, c
|
||||
ld [wCurInput], a
|
||||
ret
|
||||
|
@@ -357,6 +357,32 @@ CheckBoardEvent:
|
||||
.board
|
||||
call CheckSpaceEffectsScriptFlag
|
||||
jr z, .no_space_effect
|
||||
|
||||
; anchor point handler
|
||||
; if wCurSpaceNextSpace is not an anchor point, override any anchor point we pass though
|
||||
ld a, [wCurSpaceNextSpace]
|
||||
cp NEXT_SPACE_IS_ANCHOR_POINT
|
||||
jr c, .next
|
||||
ld a, [wCurMapAnchorEventCount]
|
||||
and a
|
||||
jr z, .next
|
||||
; if we have arrived to an anchor point, load its associated next space to wCurSpaceNextSpace right now.
|
||||
; don't queue a script so that it happens transparently from the point of view of the player's movement.
|
||||
; note that the next space of an anchor point could be another anchor point.
|
||||
ld c, a
|
||||
ld hl, wCurMapAnchorEventsPointer
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld a, [wXCoord]
|
||||
ld d, a
|
||||
ld a, [wYCoord]
|
||||
ld e, a
|
||||
call CheckAndApplyAnchorPoint
|
||||
ret nc ; if we applied an anchor point, we're done here (we're not in a space)
|
||||
|
||||
.next
|
||||
; space handler
|
||||
ld a, [wPlayerTile]
|
||||
and $f0
|
||||
cp HI_NYBBLE_SPACES
|
||||
|
Reference in New Issue
Block a user