Prev: 56201 Up: Map Next: 56387
56340: 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 56340 LD A,(IX+6) Fetch the direction of the player.
56343 RLCA
56344 RLCA
56345 AND 3
56347 LD L,A
56348 LD A,(48058) Turn it around if the view is rotated.
56351 ADD A,A
56352 XOR L
56353 LD L,A
56354 LD H,0 Clear the high byte.
56356 LD BC,56540 Find the entry in the table.
56359 ADD HL,BC
Set the flip flags and the sprite set of the legs.
56360 LD A,(HL) Fetch the flags from the table.
56361 AND 192
56363 LD C,A
56364 LD A,(IX+7) Set the flip flags of the legs.
56367 AND 63
56369 OR C
56370 LD (IX+7),A
56373 LD A,(HL) Fetch the sprite set from the table.
56374 AND 8
56376 LD C,A
56377 LD A,(IX+0) Set the sprite set of the legs.
56380 AND 247
56382 OR C
56383 LD (IX+0),A
56386 RET Return.
View the equivalent code in;
Prev: 56201 Up: Map Next: 56387