Prev: CA82 Up: Map Next: CB15
CAEE: Line the player up with the arch he comes in by
Used by the routine at ADJUST_PLYR_UVZ_FOR_ROOM_SIZE.
The code takes the room's doorways to be its first scenery entries, two pieces each, and each entry's second piece -- the first pillar, graphic 6 or 8, at the second record from the top and every other record down from there -- is what this looks at, until one is not an arch piece (graphics 6 to 9) or four have been tried. The one in the wall he comes in by (U or V at least 192 for a wall at the high end, below 64 for the low) gives him the middle of the arch along the wall and its Z; the body goes 12 above.
Input
C The wall: 0 high U, 1 low U, 2 high V, 3 low V
IX The player's legs
FIND_ENTRY_ARCH CAEE LD IY,ROOM_SECOND Four doorways at most, two records apart
CAF2 LD DE,$FFC0
CAF5 LD B,$04
FIND_ENTRY_ARCH_0 CAF7 LD A,(IY+$00) Not an arch piece: no more doorways
CAFA SUB $06
CAFC CP $04
CAFE RET NC
CAFF LD A,C Which wall
CB00 AND A
CB01 JR Z,ARCH_AT_HIGH_U
CB03 DEC A
CB04 JR Z,ARCH_AT_LOW_U
CB06 DEC A
CB07 JR Z,ARCH_AT_HIGH_V
ARCH_AT_LOW_V CB09 LD A,(IY+$02) Low V: an arch with V below 64
CB0C CP $40
CB0E JR C,ALIGN_U_TO_ARCH
This entry point is used by the routines at ARCH_AT_HIGH_U, ARCH_AT_LOW_U and ARCH_AT_HIGH_V.
NEXT_ARCH CB10 ADD IY,DE The next doorway
CB12 DJNZ FIND_ENTRY_ARCH_0
CB14 RET None in that wall: he keeps the U or V he left with
Prev: CA82 Up: Map Next: CB15