Identify PLAYERMOVEMENT_* constants

This commit is contained in:
Rangi
2019-11-03 14:30:33 -05:00
parent d5e1b5a628
commit 717cf3f458
3 changed files with 40 additions and 28 deletions

View File

@@ -92,6 +92,17 @@ RETVAR_EXECUTE EQU (2 << 6)
const PLAYEREVENT_JOYCHANGEFACING const PLAYEREVENT_JOYCHANGEFACING
NUM_PLAYER_EVENTS EQU const_value NUM_PLAYER_EVENTS EQU const_value
; PlayerMovement.pointers indexes (see engine/overworld/events.asm)
const_def
const PLAYERMOVEMENT_NORMAL
const PLAYERMOVEMENT_WARP
const PLAYERMOVEMENT_TURN
const PLAYERMOVEMENT_FORCE_TURN
const PLAYERMOVEMENT_FINISH
const PLAYERMOVEMENT_CONTINUE
const PLAYERMOVEMENT_EXIT_WATER
const PLAYERMOVEMENT_JUMP
; script data sizes (see macros/scripts/maps.asm) ; script data sizes (see macros/scripts/maps.asm)
SCENE_SCRIPT_SIZE EQU 4 ; scene_script SCENE_SCRIPT_SIZE EQU 4 ; scene_script
CALLBACK_SIZE EQU 3 ; callback CALLBACK_SIZE EQU 3 ; callback

View File

@@ -759,40 +759,41 @@ PlayerMovement:
ret ret
.pointers .pointers
dw .zero ; entries correspond to PLAYERMOVEMENT_* constants
dw .one dw .normal
dw .two dw .warp
dw .three dw .turn
dw .four dw .force_turn
dw .five dw .finish
dw .six dw .continue
dw .seven dw .exit_water
dw .jump
.zero .normal:
.four .finish:
xor a xor a
ld c, a ld c, a
ret ret
.seven .jump:
call ret_968d7 ; mobile call ret_968d7 ; mobile
xor a xor a
ld c, a ld c, a
ret ret
.one .warp:
ld a, 5 ld a, PLAYEREVENT_WARP
ld c, a ld c, a
scf scf
ret ret
.two .turn:
ld a, 9 ld a, PLAYEREVENT_JOYCHANGEFACING
ld c, a ld c, a
scf scf
ret ret
.three .force_turn:
; force the player to move in some direction ; force the player to move in some direction
ld a, BANK(Script_ForcedMovement) ld a, BANK(Script_ForcedMovement)
ld hl, Script_ForcedMovement ld hl, Script_ForcedMovement
@@ -802,8 +803,8 @@ PlayerMovement:
scf scf
ret ret
.five .continue:
.six .exit_water:
ld a, -1 ld a, -1
ld c, a ld c, a
and a and a
@@ -923,13 +924,13 @@ CountStep:
ret ret
.hatch .hatch
ld a, 8 ld a, PLAYEREVENT_HATCH
scf scf
ret ret
; unused ; unused
.unreferenced .unreferenced
ld a, 7 ld a, PLAYEREVENT_WHITEOUT
scf scf
ret ret

View File

@@ -120,7 +120,7 @@ DoPlayerMovement::
ld c, a ld c, a
call CheckWhirlpoolTile call CheckWhirlpoolTile
jr c, .not_whirlpool jr c, .not_whirlpool
ld a, 3 ld a, PLAYERMOVEMENT_FORCE_TURN
scf scf
ret ret
@@ -222,7 +222,7 @@ DoPlayerMovement::
.continue_walk .continue_walk
ld a, STEP_WALK ld a, STEP_WALK
call .DoStep call .DoStep
ld a, 5 ld a, PLAYERMOVEMENT_CONTINUE
scf scf
ret ret
@@ -247,7 +247,7 @@ DoPlayerMovement::
ld a, STEP_TURN ld a, STEP_TURN
call .DoStep call .DoStep
ld a, 2 ld a, PLAYERMOVEMENT_TURN
scf scf
ret ret
@@ -345,7 +345,7 @@ DoPlayerMovement::
call PlayMapMusic call PlayMapMusic
ld a, STEP_WALK ld a, STEP_WALK
call .DoStep call .DoStep
ld a, 6 ld a, PLAYERMOVEMENT_EXIT_WATER
scf scf
ret ret
@@ -374,7 +374,7 @@ DoPlayerMovement::
call PlaySFX call PlaySFX
ld a, STEP_LEDGE ld a, STEP_LEDGE
call .DoStep call .DoStep
ld a, 7 ld a, PLAYERMOVEMENT_JUMP
scf scf
ret ret
@@ -428,11 +428,11 @@ DoPlayerMovement::
call .StandInPlace call .StandInPlace
scf scf
ld a, 1 ld a, PLAYERMOVEMENT_WARP
ret ret
.not_warp .not_warp
xor a xor a ; PLAYERMOVEMENT_NORMAL
ret ret
.EdgeWarps: .EdgeWarps:
@@ -465,7 +465,7 @@ DoPlayerMovement::
ld a, [hl] ld a, [hl]
ld [wPlayerTurningDirection], a ld [wPlayerTurningDirection], a
ld a, 4 ld a, PLAYERMOVEMENT_FINISH
ret ret
.Steps: .Steps: