Prev: CB86 Up: Map Next: CC42
CC13: Set Facing Flags
Used by the routines at HandleOutlaw and TurnSheriff.
Sets the flip bit and the walking-frame set from FacingFlags. When ViewRotation is set, the heading is XORed with two so opposite headings swap.
Input
IX The address of the object
Keep the heading in the lowest two bits.
SetFacingFlags CC13 LD A,(IX+$06) Fetch the heading.
CC16 RLCA Move the heading into the lowest two bits.
CC17 RLCA
CC18 AND %00000011 Keep only the heading.
CC1A LD L,A Keep it in L.
XOR the heading with two if ViewRotation is set.
CC1B LD A,($A268) Fetch ViewRotation.
CC1E ADD A,A Double it.
CC1F XOR L XOR it with the heading.
CC20 LD L,A Keep the index in L.
CC21 LD H,$00 Clear H.
CC23 LD BC,$CCBE Point BC at FacingFlags.
CC26 ADD HL,BC Find the entry.
Set bits 6 and 7 of the flags.
CC27 LD A,(HL) Fetch the entry.
CC28 AND %11000000 Keep bits 6 and 7.
CC2A LD C,A Keep them in C.
CC2B LD A,(IX+$07) Fetch the flags.
CC2E AND %00111111 Clear bits 6 and 7.
CC30 OR C Set them from the table.
CC31 LD (IX+$07),A Set the flags.
Set bit 2 of the walking frame.
CC34 LD A,(HL) Fetch the entry again.
CC35 AND %00000100 Keep bit 2.
CC37 LD C,A Keep it in C.
CC38 LD A,(IX+$0C) Fetch the walking frame.
CC3B AND %11111011 Clear bit 2.
CC3D OR C Set it from the table.
CC3E LD (IX+$0C),A Set the walking frame and return.
CC41 RET
View the equivalent code in;
Prev: CB86 Up: Map Next: CC42