Prev: 49758 Up: Map Next: 49902
49814: 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 49814 LD A,(23332) Fetch GameOverFlag.
49817 AND A Jump to MovePlayer_Speed if the game is not over.
49818 JR Z,MovePlayer_Speed
49820 LD (IX+11),2 Set the speed along the z axis to 2.
Set the walk speeds unless the player is turning.
MovePlayer_Speed 49824 BIT 3,(IX+12) Jump to MovePlayer_Forward if the player is jumping.
49828 JR NZ,MovePlayer_Forward
49830 LD A,(IX+12) Fetch the collision flags.
49833 AND %11110000 Keep only bits 4-7.
49835 JR NZ,MovePlayer_Forward Jump to MovePlayer_Forward if the player is entering the room.
49837 BIT 3,(IX+0) Jump to MovePlayer_Gravity if bit 3 of the sprite number is set.
49841 JR NZ,MovePlayer_Gravity
This entry point is used by the routine at HandleTurningLegs.
MovePlayer_WalkControl 49843 BIT 2,C Jump to MovePlayer_Gravity if bit 2 of C is clear.
49845 JR Z,MovePlayer_Gravity
MovePlayer_Forward 49847 PUSH BC Stash BC on the stack.
49848 CALL SetPlayerSpeed Call SetPlayerSpeed.
49851 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 49852 LD A,(IX+11) Fetch the speed along the z axis.
49855 AND A Jump to MovePlayer_Fall if the player is falling.
49856 JP M,MovePlayer_Fall
49859 BIT 3,C Jump to MovePlayer_Store if bit 3 of C is set.
49861 JR NZ,MovePlayer_Store
MovePlayer_Fall 49863 DEC A Decrement A.
MovePlayer_Store 49864 DEC A Decrement A.
49865 LD (IX+11),A Store the speed along the z axis.
49868 LD (23329),A Set PreviousVerticalSpeed.
49871 ADD A,2 Add 2.
49873 CALL M,PlaySoundFromHeight Call PlaySoundFromHeight if the sign flag is set.
49876 CALL BlockMovement Call BlockMovement.
49879 CALL HandleRoomExit Call HandleRoomExit.
49882 CALL MoveObject Call MoveObject.
49885 BIT 2,(IX+12) Jump to ClearSpeed if the player is in the air.
49889 JR Z,ClearSpeed
49891 LD A,(23329) Fetch PreviousVerticalSpeed.
49894 AND A Jump to ClearSpeed if the player was rising.
49895 JP P,ClearSpeed
49898 RES 3,(IX+12) Clear the jumping flag.
Continue on to ClearSpeed.
View the equivalent code in;
Prev: 49758 Up: Map Next: 49902