Prev: CDE2 Up: Map Next: CE14
CDEF: The head follows the legs
Used by the routine at upd_player_top.
Copies the legs' position, size and flags into the head -- so the head inherits the legs' redraw, wipe and flip bits and is wiped and redrawn with them -- then gives the head a height of zero and sets its bit 1, which takes it out of every collision test. The legs' record carries the whole body's height, so the head never needs to collide with anything.
Then the choice of head sprite. The low nibble of +$0D is a countdown: while it is running the head keeps the sprite it has.
head_follows_legs CDEF PUSH IX DE = the head; IY = HL = the legs, one record below
CDF1 POP DE
CDF2 LD HL,$FFE0
CDF5 ADD HL,DE
CDF6 PUSH HL
CDF7 POP IY
CDF9 INC DE copy +$01 to +$07: X, Y, Z, the three half-sizes, flags
CDFA INC HL
CDFB LD BC,$0007
CDFE LDIR
CE00 LD (IX+$06),$00 height 0
CE04 SET 1,(IX+$07) bit 1: ignored by collision tests
CE08 LD A,(IX+$0D) countdown running?
CE0B AND $0F
CE0D JR Z,choose_head_sprite yes: count it down and keep the current head
CE0F DEC (IX+$0D)
CE12 JR head_on_shoulders
Prev: CDE2 Up: Map Next: CE14