Prev: A6FD Up: Map Next: A737
A70D: 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 A70D INC (IX+$00) Move the orchid on to the next stage of growth.
A710 LD A,(IX+$00) Fetch the sprite ID of the orchid.
A713 CPL Flip the bits, so that a fully grown orchid gives zero.
A714 AND %00000111 Keep only bits 0-2.
A716 JR Z,GrowOrchid_Swap Jump to GrowOrchid_Swap if the orchid is fully grown.
A718 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 A71A LD A,(IX+$02) Fetch the direction of growth of the orchid.
A71D XOR %00001000 Flip bit 3 to swap between growing and shrinking.
A71F LD (IX+$02),A Set the new direction of growth of the orchid.
A722 JR NZ,GrowOrchid_Bloom Jump to GrowOrchid_Bloom if the orchid is now shrinking.
The orchid has finished shrinking, so it stays hidden for 80 to BF frames.
A724 LD A,($5C78) Fetch the low byte of FRAMES.
A727 AND %00111111 Keep only bits 0-5.
A729 ADD A,$80 Add 80.
A72B LD L,A Stash the hidden time in L.
A72C LD H,$00 Clear H.
A72E 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 10 frames.
GrowOrchid_Bloom A731 LD HL,$0010 Set the time the orchid stays in bloom in HL to 10.
A734 JP HandlerOrchid_StoreTimer Jump to HandlerOrchid_StoreTimer to store the bloom time as the timer.
Prev: A6FD Up: Map Next: A737