Prev: 42624 Up: Map Next: 42749
42708: 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+2. When it has finished growing the timer is set to 16 and when it has finished shrinking a new colour is chosen and the timer is set to a random value between 128 and 191.
Input
IX Actor record of the orchid
ChangeOrchidStage 42708 LD A,(38547) Fetch the low byte of the game timer from GameTimer.
42711 AND %00000001 Keep only bit 0.
42713 JR NZ,HandlerOrchid_Draw Jump to HandlerOrchid_Draw to just display the orchid if bit 0 is set.
42715 LD A,(IX+2) Fetch the direction of growth of the orchid.
42718 AND A Set the flags.
42719 JR Z,GrowOrchid Jump to GrowOrchid if the orchid is growing.
The orchid is shrinking.
42721 DEC (IX+0) Move the orchid back to the previous stage of growth.
42724 LD A,(IX+0) Fetch the sprite ID of the orchid.
42727 AND %00000111 Keep only bits 0-2.
42729 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.
42731 LD A,(23672) Fetch the low byte of FRAMES.
42734 AND %00001111 Keep only bits 0-3.
42736 LD L,A Stash the colour index in L.
42737 LD H,0 Clear H.
42739 LD BC,42749 Point BC at the table of orchid colours at OrchidColour.
42742 ADD HL,BC Add the table address to get the address of the colour.
42743 LD A,(HL) Fetch the colour from the table.
42744 LD (IX+5),A Set the colour of the orchid.
42747 JR GrowOrchid_Swap Jump to GrowOrchid_Swap to swap the direction of growth.
Prev: 42624 Up: Map Next: 42749