2023-10-18 08:46:57 -07:00
|
|
|
StepTowardsNextSpace::
|
|
|
|
ld a, [wCurSpaceNextSpace]
|
2023-11-16 08:20:13 -08:00
|
|
|
cp NEXT_SPACE_IS_ANCHOR_POINT
|
|
|
|
jr nc, .move_towards_anchor_point
|
2023-10-18 08:46:57 -07:00
|
|
|
call LoadTempSpaceData
|
|
|
|
ld a, [wTempSpaceXCoord]
|
|
|
|
ld c, a
|
|
|
|
ld a, [wXCoord]
|
|
|
|
cp c
|
|
|
|
jr z, .check_y
|
|
|
|
ld a, D_RIGHT
|
|
|
|
jr c, .done
|
|
|
|
ld a, D_LEFT
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.check_y
|
|
|
|
ld a, [wTempSpaceYCoord]
|
|
|
|
ld c, a
|
|
|
|
ld a, [wYCoord]
|
|
|
|
cp c
|
|
|
|
jr z, .arrived
|
|
|
|
ld a, D_DOWN
|
|
|
|
jr c, .done
|
|
|
|
ld a, D_UP
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.arrived
|
|
|
|
xor a
|
|
|
|
.done
|
|
|
|
ld [wCurInput], a
|
|
|
|
ret
|
2023-11-16 08:20:13 -08:00
|
|
|
|
|
|
|
.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
|