Prev: C25E Up: Map Next: C2EE
C296: Move Player
Used by the routine at HandlePlayerLegs.
Moves the player by one frame. The speeds along x and y are only set up while the player walks, is jumping or is entering the room, and they are cleared again afterwards. The speed along z has gravity taken off it, which is more if the player is not rising with the jump control held down. If the player lands the jump is over.
Input
C The controls
IX The address of the object
Drop if the game is over.
MovePlayer C296 LD A,($5B24) Fetch GameOverFlag.
C299 AND A Jump to MovePlayer_Speed if the game is not over.
C29A JR Z,MovePlayer_Speed
C29C LD (IX+$0B),$02 Set the speed along the z axis to 02.
Set the walk speeds unless the player is turning.
MovePlayer_Speed C2A0 BIT 3,(IX+$0C) Jump to MovePlayer_Forward if the player is jumping.
C2A4 JR NZ,MovePlayer_Forward
C2A6 LD A,(IX+$0C) Fetch the collision flags.
C2A9 AND %11110000 Keep only bits 4-7.
C2AB JR NZ,MovePlayer_Forward Jump to MovePlayer_Forward if the player is entering the room.
C2AD BIT 3,(IX+$00) Jump to MovePlayer_Gravity if bit 3 of the sprite number is set.
C2B1 JR NZ,MovePlayer_Gravity
This entry point is used by the routine at HandleTurningLegs.
MovePlayer_WalkControl C2B3 BIT 2,C Jump to MovePlayer_Gravity if bit 2 of C is clear.
C2B5 JR Z,MovePlayer_Gravity
MovePlayer_Forward C2B7 PUSH BC Stash BC on the stack.
C2B8 CALL SetPlayerSpeed Call SetPlayerSpeed.
C2BB POP BC Restore BC from the stack.
This entry point is used by the routine at HandleTurningLegs.
Gravity takes one off the speed along z when the player is rising with the jump control held down, and two otherwise.
MovePlayer_Gravity C2BC LD A,(IX+$0B) Fetch the speed along the z axis.
C2BF AND A Jump to MovePlayer_Fall if the player is falling.
C2C0 JP M,MovePlayer_Fall
C2C3 BIT 3,C Jump to MovePlayer_Store if bit 3 of C is set.
C2C5 JR NZ,MovePlayer_Store
MovePlayer_Fall C2C7 DEC A Decrement A.
MovePlayer_Store C2C8 DEC A Decrement A.
C2C9 LD (IX+$0B),A Store the speed along the z axis.
C2CC LD ($5B21),A Set PreviousVerticalSpeed.
C2CF ADD A,$02 Add 02.
C2D1 CALL M,PlaySoundFromHeight Call PlaySoundFromHeight if the sign flag is set.
C2D4 CALL BlockMovement Call BlockMovement.
C2D7 CALL HandleRoomExit Call HandleRoomExit.
C2DA CALL MoveObject Call MoveObject.
C2DD BIT 2,(IX+$0C) Jump to ClearSpeed if the player is in the air.
C2E1 JR Z,ClearSpeed
C2E3 LD A,($5B21) Fetch PreviousVerticalSpeed.
C2E6 AND A Jump to ClearSpeed if the player was rising.
C2E7 JP P,ClearSpeed
C2EA RES 3,(IX+$0C) Clear the jumping flag.
Continue on to ClearSpeed.
View the equivalent code in;
Prev: C25E Up: Map Next: C2EE