Prev: EB18 Up: Map Next: EB72
EB39: Handle Coloured Decoration
Handler for the object types 79 to 7E: the two pictures, the bookshelf, the hanging bowl, the bowl of flowers and the torch (see Sprite_Picture_1). They are coloured by copying the attributes from the colour data (see Colour_Data) rather than from the single attribute of the record, so that they are not drawn in one colour only. The other decorations are handled by Handle_Plain_Decoration.
A decoration is removed (see Handle_Collectable_Remove) when Sabreman is not in its room. The first time that it is handled Set_Decoration_Size gives it the size of its obstacle and it is drawn. It is then coloured every time that it is handled, by Handle_Stalactite_Colour_Copy.
Input
IX Object record of the decoration
Handle_Coloured_Decoration EB39 LD A,($8F1C) Fetch the room x of Sabreman.
EB3C CP (IX+$02) Jump to Handle_Collectable_Remove to remove the decoration if it is in a different room x.
EB3F JP NZ,Handle_Collectable_Remove
EB42 LD A,($8F1E) Fetch the room y of Sabreman.
EB45 CP (IX+$04) Jump to Handle_Collectable_Remove to remove the decoration if it is in a different room y.
EB48 JP NZ,Handle_Collectable_Remove
EB4B CALL PrepDraw2 Prepare the sprite of the decoration.
EB4E BIT 0,(IX+$0F) Jump to Handle_Coloured_Decoration_Colour if the decoration has been drawn already (bit 0 of the redraw flags is clear).
EB52 JR Z,Handle_Coloured_Decoration_Colour
EB54 RES 0,(IX+$0F) Reset bit 0 of the redraw flags.
EB58 CALL Set_Decoration_Size Copy the size of the obstacle to the object record.
EB5B CALL DrawEntity Draw the decoration.
Handle_Coloured_Decoration_Colour EB5E LD A,(IX+$00) Fetch the type of the decoration.
EB61 SUB $79 Subtract 79 to make the number of the decoration.
EB63 SLA A Double it, as the pointers are two bytes long.
EB65 LD E,A Store the result in E.
EB66 LD D,$00 Clear the high byte of the offset.
EB68 LD HL,$EB72 Point HL at Decoration_Colour_Pointers.
EB6B ADD HL,DE Make HL point at the pointer for the decoration.
EB6C LD E,(HL) Fetch the low byte of the pointer.
EB6D INC HL Move on to the high byte.
EB6E LD D,(HL) Fetch the high byte, which makes DE point at the colour data.
EB6F JP Handle_Stalactite_Colour_Copy Jump to Handle_Stalactite_Colour_Copy to colour the decoration.
Prev: EB18 Up: Map Next: EB72