Prev: DB89 Up: Map Next: DC43
DC14: Set Facing Flags
Used by the routines at UpdatePlayerLegs and ChooseDirection.
Sets the sprite of the legs of the player from the direction. Bits 6 and 7 of the flags (to flip the sprite) and bit 3 of the type (to choose between the two sets of sprites) are taken from the table at PlayerSpriteTable, which is turned around by two places when the view is rotated.
Input
IX Player
Look up the flags and the sprite set for the direction.
SetFacingFlags DC14 LD A,(IX+$06) Fetch the direction of the player.
DC17 RLCA
DC18 RLCA
DC19 AND $03
DC1B LD L,A
DC1C LD A,($BBBA) Turn it around if the view is rotated.
DC1F ADD A,A
DC20 XOR L
DC21 LD L,A
DC22 LD H,$00 Clear the high byte.
DC24 LD BC,$DCDC Find the entry in the table.
DC27 ADD HL,BC
Set the flip flags and the sprite set of the legs.
DC28 LD A,(HL) Fetch the flags from the table.
DC29 AND $C0
DC2B LD C,A
DC2C LD A,(IX+$07) Set the flip flags of the legs.
DC2F AND $3F
DC31 OR C
DC32 LD (IX+$07),A
DC35 LD A,(HL) Fetch the sprite set from the table.
DC36 AND $08
DC38 LD C,A
DC39 LD A,(IX+$00) Set the sprite set of the legs.
DC3C AND $F7
DC3E OR C
DC3F LD (IX+$00),A
DC42 RET Return.
View the equivalent code in;
Prev: DB89 Up: Map Next: DC43