Prev: 49626 Up: Map Next: 49709
49634: Handle Turning Legs
The handler for the lower half of the robot while it is turning (objects 24 to 27). The turn takes two passes: the first counts the turn down while the player is moved, and the second sets the sprite that the player ends up with (see TurnedRightSpriteTable and TurnedLeftSpriteTable) and plays a footstep.
Input
C The controls
IX The address of the object
Count the turn down and move.
HandleTurningLegs 49634 CALL SetPixelAdjustments_Legs Call SetPixelAdjustments_Legs.
49637 LD (IX+6),23 Set the height of the bottom half to 23.
49641 LD (IX+38),0 Write 0 to the height of the top half.
49645 CALL ReadControls Call ReadControls.
49648 LD A,(IX+13) Fetch the extra flags.
49651 AND %00000110 Keep only bits 1 and 2.
49653 JR Z,HandleTurningLegs_Finish Jump to HandleTurningLegs_Finish if they are zero.
49655 LD A,(IX+13) Fetch the extra flags.
49658 SUB 2 Subtract 2.
49660 LD (IX+13),A Store the extra flags.
49663 SET 1,(IX+39) Set bit 1 of the top half flags.
49667 CALL MovePlayer_Gravity Call MovePlayer_Gravity.
49670 JR HandleTurningLegs_Done Jump to HandleTurningLegs_Done.
Finish the turn with the new sprite.
HandleTurningLegs_Finish 49672 BIT 0,(IX+13) Jump to HandleTurningLegs_Left if bit 0 of the extra flags is clear.
49676 JR Z,HandleTurningLegs_Left
49678 LD HL,49709 Point HL at TurnedRightSpriteTable.
HandleTurningLegs_Set 49681 LD A,(IX+0) Fetch the sprite number of the player.
49684 CALL SetSpriteFromTable Call SetSpriteFromTable.
49687 CALL PlayFootstepsSound_EveryFrame Call PlayFootstepsSound_EveryFrame.
49690 SET 1,(IX+39) Set bit 1 of the top half flags.
49694 CALL MovePlayer_WalkControl Call MovePlayer_WalkControl.
HandleTurningLegs_Done 49697 RES 1,(IX+39) Reset bit 1 of the top half flags.
49701 JP HandlePlayerLegs_Draw Jump to HandlePlayerLegs_Draw.
HandleTurningLegs_Left 49704 LD HL,49717 Point HL at TurnedLeftSpriteTable.
49707 JR HandleTurningLegs_Set Jump to HandleTurningLegs_Set.
Prev: 49626 Up: Map Next: 49709