Prev: F4E6 Up: Map Next: F52A
F4F4: Pick up whatever the knight is standing at
Used by the routine at CREATURE_UPDATE.
X, C or V (CREATURE_UPDATE). Only into an empty place: if the place in use (1 to 5, SELECTED) holds something, nothing happens. Otherwise he stoops (SPRITE956C facing the viewer, SPRITE9626 facing away) and the game looks for things in a box the size of his own, four units on the way he faces (measured facing up x, with a thing 8 wide: it was found with its corner anywhere from 2 behind his to 10 ahead). FIND_OBSTACLE finds the first record whose box meets it; PICK_UP_LOOK_ON goes on through the rest until one can be carried.
PICK_UP F4F4 LD H,$FF The place in use already holds something: do nothing but redraw him
F4F6 LD L,(IY+SELECTED-V)
F4F9 LD A,(HL)
F4FA INC HL
F4FB OR (HL)
F4FC JR NZ,KNIGHT_DONE
F4FE LD HL,$00BA The stooping frames: SPRITE956C, and 186 bytes on (SPRITE9626) facing away
F501 LD (AWAY_FRAMES),HL
F504 LD HL,SPRITE956C
F507 CALL FACING Choose by which way he faces; C = that way; it becomes his sprite
F50A LD (IY+WORK_DIRECTION-V),C
F50D LD (KNIGHT_SPRITE),HL
F510 CALL WORKING_POSITION B, D, H = where he is
F513 LD A,C Move along x (bit 0), or along y (bit 2) if he faces along y
F514 LD C,$01
F516 AND $C0
F518 JR Z,PICK_UP_0
F51A LD C,$04
PICK_UP_0 F51C CALL STEP_ALL_AXES Two steps of two: four units on
F51F CALL STEP_ALL_AXES
F522 CALL WORKING_SIZES His sizes; what does a box there meet?
F525 CALL FIND_OBSTACLE
F528 JR PICK_UP_LOOK_ON_0
Prev: F4E6 Up: Map Next: F52A