Prev: 9FFB Up: Map Next: A064
A00E: Set Entity Attributes
Used by the routines at DrawInventory and MenuIcons.
Input
IX The entity to colour
SetEntityAttributes A00E LD A,(IX+$03) Write the entity X position to Saved_X.
A011 LD ($5E16),A
A014 LD A,(IX+$04) Write the entity X position to Saved_Y.
A017 LD ($5E17),A
This entry point is used by the routines at HandlerWeapon, HandlerBatlet, HandlerKnight and HandlerCaveDoorLocked.
SetEntityAttributes_0 A01A LD L,(IX+$03) HL=Entity screen position.
A01D LD H,(IX+$04)
A020 LD D,(IX+$05) D=Entity attribute.
A023 LD A,($5E1A) E=Room attribute.
A026 LD E,A
A027 LD A,($5E10) B=Entity width in bytes.
A02A LD B,A
A02B LD A,($5E11) A=Entity height in pixels.
A02E RRCA Divide by 04.
A02F RRCA
A030 INC A Increment A by one.
A031 RRCA Divide by 02.
A032 AND %00011111 Keep only bits 0-4.
A034 INC A Increment A by one.
A035 LD C,A Store the result in C.
A036 PUSH BC Stash BC on the stack.
A037 LD B,$00 B=00.
A039 LD A,($5E16) Compare Saved_X against L to see if the X position is unchanged.
A03C CP L
A03D JR Z,SetEntityAttributes_2 If it hasn't changed then jump to SetEntityAttributes_2.
A03F JR C,SetEntityAttributes_1 If the entity has moved left then jump to SetEntityAttributes_1.
A041 INC B B=B + 01.
SetEntityAttributes_1 A042 INC B B=B + 01.
SetEntityAttributes_2 A043 LD A,($5E17) Compare Saved_Y against H to see if the Y position is unchanged.
A046 CP H
A047 LD A,B A=B.
A048 JR Z,SetEntityAttributes_4 If it hasn't changed then jump to SetEntityAttributes_4.
A04A JR C,SetEntityAttributes_3 If the entity has moved up then jump to SetEntityAttributes_3.
A04C ADD A,$04 A=A + 04.
SetEntityAttributes_3 A04E ADD A,$04 A=A + 04.
SetEntityAttributes_4 A050 LD B,A Stash the result in B.
A051 CALL AttributeAddress Call AttributeAddress.
A054 LD A,B Restore the result back into A.
A055 POP BC
A056 PUSH HL
A057 LD HL,$A064 HL=AttributeJumpTable.
A05A SLA A A=A * 02.
A05C CALL HandlerCaveDoorLocked_1 Call HandlerCaveDoorLocked_1.
A05F LD A,(HL) HL=attribute routine selected from AttributeJumpTable.
A060 INC HL
A061 LD H,(HL)
A062 LD L,A
A063 JP (HL) Indirect jump to the address held in HL.
Prev: 9FFB Up: Map Next: A064