Prev: A680 Up: Map Next: A6FD
A6D4: Change Orchid Stage
Used by the routine at HandlerOrchid.
Called when the timer of an orchid has run out. Every other frame the growth stage of the orchid (the lowest three bits of the sprite ID) is moved on by one. Whether it grows or shrinks depends on bit 3 of IX+02. When it has finished growing the timer is set to 10 and when it has finished shrinking a new colour is chosen and the timer is set to a random value between 80 and BF.
Input
IX Actor record of the orchid
ChangeOrchidStage A6D4 LD A,($9693) Fetch the low byte of the game timer from GameTimer.
A6D7 AND %00000001 Keep only bit 0.
A6D9 JR NZ,HandlerOrchid_Draw Jump to HandlerOrchid_Draw to just display the orchid if bit 0 is set.
A6DB LD A,(IX+$02) Fetch the direction of growth of the orchid.
A6DE AND A Set the flags.
A6DF JR Z,GrowOrchid Jump to GrowOrchid if the orchid is growing.
The orchid is shrinking.
A6E1 DEC (IX+$00) Move the orchid back to the previous stage of growth.
A6E4 LD A,(IX+$00) Fetch the sprite ID of the orchid.
A6E7 AND %00000111 Keep only bits 0-2.
A6E9 JR NZ,HandlerOrchid_Draw Jump to HandlerOrchid_Draw if the orchid has not finished shrinking.
The orchid has gone, so choose a new colour for the next time.
A6EB LD A,($5C78) Fetch the low byte of FRAMES.
A6EE AND %00001111 Keep only bits 0-3.
A6F0 LD L,A Stash the colour index in L.
A6F1 LD H,$00 Clear H.
A6F3 LD BC,$A6FD Point BC at the table of orchid colours at OrchidColour.
A6F6 ADD HL,BC Add the table address to get the address of the colour.
A6F7 LD A,(HL) Fetch the colour from the table.
A6F8 LD (IX+$05),A Set the colour of the orchid.
A6FB JR GrowOrchid_Swap Jump to GrowOrchid_Swap to swap the direction of growth.
Prev: A680 Up: Map Next: A6FD