Prev: C099 Up: Map Next: C117
C0BE: Handle Player Legs
The handler for the lower half of the robot while it is walking (objects 10 to 17). The upper half of the player is only a copy of this one placed above it (see HandlePlayerTop), so this routine does all of the work for the player. If the player has been killed it is turned into a sparkle. Otherwise the input is read, the pickup and drop, turning, jumping and walking are dealt with, and the player is moved. While the player is outside the room (walking through an exit) it can fall but is not allowed to rise.
Input
IX The address of the object
Turn into a sparkle if killed.
HandlePlayerLegs C0BE CALL SetPixelAdjustments_Legs Call SetPixelAdjustments_Legs.
C0C1 BIT 6,(IX+$0D) Jump to HandlePlayerLegs_Alive if the player has not been killed.
C0C5 JR Z,HandlePlayerLegs_Alive
C0C7 SET 6,(IX+$2D) Set bit 6 of the top half extra flags.
C0CB JP TurnIntoSparkle Jump to TurnIntoSparkle.
Make the bottom half as tall as the whole player while it moves.
HandlePlayerLegs_Alive C0CE LD (IX+$06),$17 Set the height of the bottom half to 17.
C0D2 LD (IX+$26),$00 Write 00 to the height of the top half.
C0D6 CALL ReadControls Call ReadControls.
C0D9 CALL HandlePickupAndDrop Call HandlePickupAndDrop.
C0DC CALL HandleTurning Call HandleTurning.
C0DF CALL HandleJump Call HandleJump.
C0E2 CALL HandleWalking Call HandleWalking.
C0E5 CALL TestPlayerInRoom Jump to HandlePlayerLegs_Outside if the player is not inside the room.
C0E8 JR NC,HandlePlayerLegs_Outside
Ignore the top half while the player moves.
HandlePlayerLegs_Move C0EA SET 1,(IX+$27) Set bit 1 of the top half flags.
C0EE CALL MovePlayer Call MovePlayer.
C0F1 RES 1,(IX+$27) Reset bit 1 of the top half flags.
C0F5 LD A,(IX+$0C) Fetch the collision flags.
C0F8 SUB $10 Subtract 10.
C0FA JR C,HandlePlayerLegs_Draw Jump to HandlePlayerLegs_Draw if carry is set.
C0FC LD (IX+$0C),A Store the collision flags.
This entry point is used by the routine at HandleTurningLegs.
Restore the two heights and draw.
HandlePlayerLegs_Draw C0FF LD (IX+$06),$0C Set the height of the bottom half to 0C.
C103 LD (IX+$26),$0B Set the height of the top half to 0B.
C107 JP SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags.
The player is outside the room.
HandlePlayerLegs_Outside C10A LD A,(IX+$0B) Fetch the speed along the z axis.
C10D AND A Jump to HandlePlayerLegs_Move if the player is falling.
C10E JP M,HandlePlayerLegs_Move
C111 XOR A Write 00 to the speed along the z axis.
C112 LD (IX+$0B),A
C115 JR HandlePlayerLegs_Move Jump to HandlePlayerLegs_Move.
View the equivalent code in;
Prev: C099 Up: Map Next: C117