Prev: 49305 Up: Map Next: 49431
49342: Handle Player Legs
The handler for the lower half of the robot while it is walking (objects 16 to 23). 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 49342 CALL SetPixelAdjustments_Legs Call SetPixelAdjustments_Legs.
49345 BIT 6,(IX+13) Jump to HandlePlayerLegs_Alive if the player has not been killed.
49349 JR Z,HandlePlayerLegs_Alive
49351 SET 6,(IX+45) Set bit 6 of the top half extra flags.
49355 JP TurnIntoSparkle Jump to TurnIntoSparkle.
Make the bottom half as tall as the whole player while it moves.
HandlePlayerLegs_Alive 49358 LD (IX+6),23 Set the height of the bottom half to 23.
49362 LD (IX+38),0 Write 0 to the height of the top half.
49366 CALL ReadControls Call ReadControls.
49369 CALL HandlePickupAndDrop Call HandlePickupAndDrop.
49372 CALL HandleTurning Call HandleTurning.
49375 CALL HandleJump Call HandleJump.
49378 CALL HandleWalking Call HandleWalking.
49381 CALL TestPlayerInRoom Jump to HandlePlayerLegs_Outside if the player is not inside the room.
49384 JR NC,HandlePlayerLegs_Outside
Ignore the top half while the player moves.
HandlePlayerLegs_Move 49386 SET 1,(IX+39) Set bit 1 of the top half flags.
49390 CALL MovePlayer Call MovePlayer.
49393 RES 1,(IX+39) Reset bit 1 of the top half flags.
49397 LD A,(IX+12) Fetch the collision flags.
49400 SUB 16 Subtract 16.
49402 JR C,HandlePlayerLegs_Draw Jump to HandlePlayerLegs_Draw if carry is set.
49404 LD (IX+12),A Store the collision flags.
This entry point is used by the routine at HandleTurningLegs.
Restore the two heights and draw.
HandlePlayerLegs_Draw 49407 LD (IX+6),12 Set the height of the bottom half to 12.
49411 LD (IX+38),11 Set the height of the top half to 11.
49415 JP SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags.
The player is outside the room.
HandlePlayerLegs_Outside 49418 LD A,(IX+11) Fetch the speed along the z axis.
49421 AND A Jump to HandlePlayerLegs_Move if the player is falling.
49422 JP M,HandlePlayerLegs_Move
49425 XOR A Write 0 to the speed along the z axis.
49426 LD (IX+11),A
49429 JR HandlePlayerLegs_Move Jump to HandlePlayerLegs_Move.
View the equivalent code in;
Prev: 49305 Up: Map Next: 49431