shithub: pokecrystal

Download patch

ref: 717cf3f45873a759bce6530692950de84ea37a4d
parent: d5e1b5a62805f855bb5296bd674c0a9aa47f3eb3
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Nov 3 09:30:33 EST 2019

Identify PLAYERMOVEMENT_* constants

--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -92,6 +92,17 @@
 	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
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -759,40 +759,41 @@
 	ret
 
 .pointers
-	dw .zero
-	dw .one
-	dw .two
-	dw .three
-	dw .four
-	dw .five
-	dw .six
-	dw .seven
+; entries correspond to PLAYERMOVEMENT_* constants
+	dw .normal
+	dw .warp
+	dw .turn
+	dw .force_turn
+	dw .finish
+	dw .continue
+	dw .exit_water
+	dw .jump
 
-.zero
-.four
+.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 @@
 	scf
 	ret
 
-.five
-.six
+.continue:
+.exit_water:
 	ld a, -1
 	ld c, a
 	and a
@@ -923,13 +924,13 @@
 	ret
 
 .hatch
-	ld a, 8
+	ld a, PLAYEREVENT_HATCH
 	scf
 	ret
 
 ; unused
 .unreferenced
-	ld a, 7
+	ld a, PLAYEREVENT_WHITEOUT
 	scf
 	ret
 
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -120,7 +120,7 @@
 	ld c, a
 	call CheckWhirlpoolTile
 	jr c, .not_whirlpool
-	ld a, 3
+	ld a, PLAYERMOVEMENT_FORCE_TURN
 	scf
 	ret
 
@@ -222,7 +222,7 @@
 .continue_walk
 	ld a, STEP_WALK
 	call .DoStep
-	ld a, 5
+	ld a, PLAYERMOVEMENT_CONTINUE
 	scf
 	ret
 
@@ -247,7 +247,7 @@
 
 	ld a, STEP_TURN
 	call .DoStep
-	ld a, 2
+	ld a, PLAYERMOVEMENT_TURN
 	scf
 	ret
 
@@ -345,7 +345,7 @@
 	call PlayMapMusic
 	ld a, STEP_WALK
 	call .DoStep
-	ld a, 6
+	ld a, PLAYERMOVEMENT_EXIT_WATER
 	scf
 	ret
 
@@ -374,7 +374,7 @@
 	call PlaySFX
 	ld a, STEP_LEDGE
 	call .DoStep
-	ld a, 7
+	ld a, PLAYERMOVEMENT_JUMP
 	scf
 	ret
 
@@ -428,11 +428,11 @@
 
 	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 @@
 	ld a, [hl]
 	ld [wPlayerTurningDirection], a
 
-	ld a, 4
+	ld a, PLAYERMOVEMENT_FINISH
 	ret
 
 .Steps: