Prev: 55631 Up: Map Next: 55715
55672: Set Sprite From Direction
Used by the routines at UpdateCreature and UpdateMonster.
Sets the sprite of an object from the direction that it is facing. Bit 1 of the type is set from the direction, bit 0 is flipped, and the flip flag is set from the direction, with both the sprite and the flip changed when the view is rotated.
Input
IX Object
SetSpriteFromDirection 55672 LD A,(48058) Fetch whether the view is turned round, and double it.
55675 ADD A,A
55676 LD B,A
55677 LD A,(IX+6) Work out bit 1 of the type from the direction.
55680 SUB 64
55682 RLCA
55683 RLCA
55684 AND 2
55686 LD C,A
55687 LD A,(IX+0) Set bit 1 of the type from the direction, flip bit 0 to change the frame, and flip bit 1 as well if the view is rotated.
55690 AND 253
55692 OR C
55693 XOR 1
55695 XOR B
55696 LD (IX+0),A
55699 LD A,(IX+6) Fetch the direction of the object, and keep bit 6.
55702 AND 64
55704 LD C,A
55705 LD A,(IX+7) Set the flip flag of the object from it.
55708 AND 191
55710 OR C
55711 LD (IX+7),A
55714 RET Return.
Prev: 55631 Up: Map Next: 55715