Prev: CC01 Up: Map Next: CC96
CC6D: Stand the robot on the floor of the arch he comes in by
Used by the routine at ADJUST_PLYR_UVZ_FOR_ROOM_SIZE.
The code takes a room's doorways to be its first backgrounds, two pieces each, a pillar of graphic 2 and one of graphic 3 (BACKGROUND0 and the three after it). The first pillars are then records 4, 6, 8 and 10, and the wall an arch is in is told by its first pillar's U + V (mod 256): $52 at high V, $38 at high U, $C8 at low V, $AE at low U. The one wanted gives the legs its Z, and the top goes 12 above; that is what puts him at the right height in a raised doorway.
The search stops at the first record that is not an arch pillar (graphic 4 or more) or after four; with no match Z is left alone. The RET after the fourth was never reached in the build's sessions. As Knight Lore's adjust_plyr_Z_for_arch, whose pillars are graphics 2 to 5.
Input
C the U + V of the arch wanted
IX the robot's legs
ADJUST_PLYR_Z_FOR_ARCH CC6D LD IY,ROOM_OBJECTS Record 4, and every other record from there: four doorways at most
CC71 LD DE,$0040
CC74 LD B,$04
ADJUST_PLYR_Z_FOR_ARCH_0 CC76 LD A,(IY+$00) Not an arch pillar: no more doorways
CC79 CP $04
CC7B RET NC
CC7C LD A,(IY+$01) This arch?
CC7F ADD A,(IY+$02)
CC82 CP C
CC83 JR Z,ADJUST_PLYR_Z_FOR_ARCH_1
CC85 ADD IY,DE The next; none matched
CC87 DJNZ ADJUST_PLYR_Z_FOR_ARCH_0
CC89 RET
ADJUST_PLYR_Z_FOR_ARCH_1 CC8A LD A,(IY+$03) The legs' Z = the pillar's; the top 12 above
CC8D LD (IX+$03),A
CC90 ADD A,$0C
CC92 LD (IX+$23),A
CC95 RET
Prev: CC01 Up: Map Next: CC96