You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Implementation of basic navigation and movement across linear spaces (#24)
This commit is contained in:
@@ -15,12 +15,13 @@ BoardMenuScript::
|
||||
; save after opentext to reanchor map first
|
||||
; save before processing variables like wCurTurn due to BoardMenuScript reentry after game reset
|
||||
farcall AutoSaveGameInOverworld
|
||||
ld hl, wCurTurn
|
||||
inc [hl]
|
||||
ld hl, wTurnData
|
||||
ld bc, wTurnDataEnd - wTurnData
|
||||
xor a
|
||||
jp ByteFill
|
||||
call ByteFill
|
||||
ld hl, wCurTurn
|
||||
inc [hl]
|
||||
jp LoadCurSpaceData
|
||||
|
||||
.Die:
|
||||
callasm BoardMenu_Die
|
||||
|
||||
29
engine/board/movement.asm
Executable file
29
engine/board/movement.asm
Executable file
@@ -0,0 +1,29 @@
|
||||
StepTowardsNextSpace::
|
||||
ld a, [wCurSpaceNextSpace]
|
||||
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
|
||||
@@ -27,12 +27,18 @@ ArriveToRegularSpaceScript:
|
||||
end
|
||||
|
||||
ArriveToRegularSpace:
|
||||
; load new space
|
||||
ld a, [wCurSpaceNextSpace]
|
||||
ld [wCurSpace], a
|
||||
call LoadCurSpaceData
|
||||
; decrease wSpacesLeft and copy to hScriptVar
|
||||
ld hl, wSpacesLeft
|
||||
dec [hl]
|
||||
ld a, [hl]
|
||||
ld [hScriptVar], a
|
||||
; if landed, clear spaces left sprites
|
||||
and a
|
||||
jp nz, UpdateSecondarySprites
|
||||
ret nz
|
||||
ld hl, wDisplaySecondarySprites
|
||||
res SECONDARYSPRITES_SPACES_LEFT_F, [hl]
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user