Prev: 42749 Up: Map Next: 42807
42765: Grow Orchid
Used by the routine at ChangeOrchidStage.
Moves a growing orchid on to the next stage. When it is fully grown (the lowest three bits of the sprite ID are all set) the direction of growth is changed (see GrowOrchid_Swap). Otherwise the orchid is just drawn.
Input
IX Actor record of the orchid
GrowOrchid 42765 INC (IX+0) Move the orchid on to the next stage of growth.
42768 LD A,(IX+0) Fetch the sprite ID of the orchid.
42771 CPL Flip the bits, so that a fully grown orchid gives zero.
42772 AND %00000111 Keep only bits 0-2.
42774 JR Z,GrowOrchid_Swap Jump to GrowOrchid_Swap if the orchid is fully grown.
42776 JR HandlerOrchid_Draw Jump to HandlerOrchid_Draw to display the orchid.
This entry point is used by the routine at ChangeOrchidStage.
Swap between growing and shrinking and set the timer.
GrowOrchid_Swap 42778 LD A,(IX+2) Fetch the direction of growth of the orchid.
42781 XOR %00001000 Flip bit 3 to swap between growing and shrinking.
42783 LD (IX+2),A Set the new direction of growth of the orchid.
42786 JR NZ,GrowOrchid_Bloom Jump to GrowOrchid_Bloom if the orchid is now shrinking.
The orchid has finished shrinking, so it stays hidden for 128 to 191 frames.
42788 LD A,(23672) Fetch the low byte of FRAMES.
42791 AND %00111111 Keep only bits 0-5.
42793 ADD A,128 Add 128.
42795 LD L,A Stash the hidden time in L.
42796 LD H,0 Clear H.
42798 JP HandlerOrchid_StoreTimer Jump to HandlerOrchid_StoreTimer to store the hidden time as the timer.
The orchid has finished growing, so it stays in bloom for 16 frames.
GrowOrchid_Bloom 42801 LD HL,16 Set the time the orchid stays in bloom in HL to 16.
42804 JP HandlerOrchid_StoreTimer Jump to HandlerOrchid_StoreTimer to store the bloom time as the timer.
Prev: 42749 Up: Map Next: 42807