summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--constants/script_constants.asm11
-rw-r--r--engine/overworld/events.asm43
-rw-r--r--engine/overworld/player_movement.asm16
3 files changed, 41 insertions, 29 deletions
diff --git a/constants/script_constants.asm b/constants/script_constants.asm
index 99275efe3..cfcbfbb52 100644
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -92,6 +92,17 @@ RETVAR_EXECUTE EQU (2 << 6)
const PLAYEREVENT_JOYCHANGEFACING
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)
SCENE_SCRIPT_SIZE EQU 4 ; scene_script
CALLBACK_SIZE EQU 3 ; callback
diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm
index 76f14e506..d4c6ec0bf 100644
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -759,40 +759,41 @@ PlayerMovement:
ret
.pointers
- dw .zero
- dw .one
- dw .two
- dw .three
- dw .four
- dw .five
- dw .six
- dw .seven
-
-.zero
-.four
+; entries correspond to PLAYERMOVEMENT_* constants
+ dw .normal
+ dw .warp
+ dw .turn
+ dw .force_turn
+ dw .finish
+ dw .continue
+ dw .exit_water
+ dw .jump
+
+.normal:
+.finish:
xor a
ld c, a
ret
-.seven
+.jump:
call ret_968d7 ; mobile
xor a
ld c, a
ret
-.one
- ld a, 5
+.warp:
+ ld a, PLAYEREVENT_WARP
ld c, a
scf
ret
-.two
- ld a, 9
+.turn:
+ ld a, PLAYEREVENT_JOYCHANGEFACING
ld c, a
scf
ret
-.three
+.force_turn:
; force the player to move in some direction
ld a, BANK(Script_ForcedMovement)
ld hl, Script_ForcedMovement
@@ -802,8 +803,8 @@ PlayerMovement:
scf
ret
-.five
-.six
+.continue:
+.exit_water:
ld a, -1
ld c, a
and a
@@ -923,13 +924,13 @@ CountStep:
ret
.hatch
- ld a, 8
+ ld a, PLAYEREVENT_HATCH
scf
ret
; unused
.unreferenced
- ld a, 7
+ ld a, PLAYEREVENT_WHITEOUT
scf
ret
diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm
index 09d6b47de..9f372640b 100644
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -120,7 +120,7 @@ DoPlayerMovement::
ld c, a
call CheckWhirlpoolTile
jr c, .not_whirlpool
- ld a, 3
+ ld a, PLAYERMOVEMENT_FORCE_TURN
scf
ret
@@ -222,7 +222,7 @@ DoPlayerMovement::
.continue_walk
ld a, STEP_WALK
call .DoStep
- ld a, 5
+ ld a, PLAYERMOVEMENT_CONTINUE
scf
ret
@@ -247,7 +247,7 @@ DoPlayerMovement::
ld a, STEP_TURN
call .DoStep
- ld a, 2
+ ld a, PLAYERMOVEMENT_TURN
scf
ret
@@ -345,7 +345,7 @@ DoPlayerMovement::
call PlayMapMusic
ld a, STEP_WALK
call .DoStep
- ld a, 6
+ ld a, PLAYERMOVEMENT_EXIT_WATER
scf
ret
@@ -374,7 +374,7 @@ DoPlayerMovement::
call PlaySFX
ld a, STEP_LEDGE
call .DoStep
- ld a, 7
+ ld a, PLAYERMOVEMENT_JUMP
scf
ret
@@ -428,11 +428,11 @@ DoPlayerMovement::
call .StandInPlace
scf
- ld a, 1
+ ld a, PLAYERMOVEMENT_WARP
ret
.not_warp
- xor a
+ xor a ; PLAYERMOVEMENT_NORMAL
ret
.EdgeWarps:
@@ -465,7 +465,7 @@ DoPlayerMovement::
ld a, [hl]
ld [wPlayerTurningDirection], a
- ld a, 4
+ ld a, PLAYERMOVEMENT_FINISH
ret
.Steps: