Prev: C099 Up: Map Next: C117
C0BE: The update routine for the robot's legs (graphics 16 to 23)
Reached through UPDATES. The robot's turn, in order: read the controls (READ_CONTROLS), pick up or put down (TAKE_OR_LEAVE), turn (HANDLE_LEFT_RIGHT), start a jump (HANDLE_JUMP), step the legs' frame (HANDLE_FORWARD). Then, if he stands in a doorway -- past the line of the room's walls (CHK_PLYR_OOB) -- he may not rise, only fall. The move is resolved and made (MOVE_PLAYER) with the top out of the collision tests; the count of turns he walks on by himself after coming through a doorway goes down, and he is marked to be redrawn.
While this runs the legs' height is 23, the whole robot's, and the top's is 0, so that the legs stand for the robot in the headroom test and in the move; at the end they are put back to 12 and 11, the top standing on the legs. The top's height of 0 is what keeps the headroom test from finding the top itself: DO_ANY_OBJS_INTERSECT takes only the legs out of its own way, and its test in Z (DO_OBJS_INTERSECT_ON_Z) never finds an overlap with a thing of no height whose base is at or below the legs'. For the move the top is taken out of the collision tests as well (bit 1 of its +7).
If he has been killed (bit 6 of +$0D), the top is killed too and the legs become the sparkle (START_SPARKLE). Graphics 24 to 27, the legs part way through a turn, have their own update routine (TURNING_LEGS), which comes back in at PLAYER_LEGS_DONE.
As Pentagram's PLAYER_LEGS and Knight Lore's player_controls, in a different order: pick-up comes before the turn here.
Input
IX the legs' record, OBJECTS
PLAYER_LEGS C0BE CALL DRAW_AT_L16_D7 the legs' drawing nudge: X -16, Y -7
C0C1 BIT 6,(IX+$0D) killed: the top too (+$0D of the next record), and the sparkle
C0C5 JR Z,PLAYER_LEGS_0
C0C7 SET 6,(IX+$2D)
C0CB JP START_SPARKLE
PLAYER_LEGS_0 C0CE LD (IX+$06),$17 the legs as high as the whole robot, the top of no height
C0D2 LD (IX+$26),$00
C0D6 CALL READ_CONTROLS the controls into C; pick up or put down, turn, jump, step
C0D9 CALL TAKE_OR_LEAVE
C0DC CALL HANDLE_LEFT_RIGHT
C0DF CALL HANDLE_JUMP
C0E2 CALL HANDLE_FORWARD
C0E5 CALL CHK_PLYR_OOB in a doorway, beyond the walls?
C0E8 JR NC,PLAYER_LEGS_IN_DOORWAY
PLAYER_LEGS_MOVE C0EA SET 1,(IX+$27) the top (+7 of the next record) out of the collision tests while the legs move
C0EE CALL MOVE_PLAYER
C0F1 RES 1,(IX+$27)
C0F5 LD A,(IX+$0C) count down the top four bits of +$0C: the turns he walks on by himself after coming through a doorway
C0F8 SUB $10
C0FA JR C,PLAYER_LEGS_DONE
C0FC LD (IX+$0C),A
This entry point is used by the routine at TURNING_LEGS.
PLAYER_LEGS_DONE C0FF LD (IX+$06),$0C the heights back: legs 12, top 11
C103 LD (IX+$26),$0B
C107 JP SET_WIPE_AND_DRAW_FLAGS mark him to be redrawn
PLAYER_LEGS_IN_DOORWAY C10A LD A,(IX+$0B) in a doorway: falling is allowed...
C10D AND A
C10E JP M,PLAYER_LEGS_MOVE
C111 XOR A ...rising is not
C112 LD (IX+$0B),A
C115 JR PLAYER_LEGS_MOVE
Prev: C099 Up: Map Next: C117