![]() |
Routines |
| Prev: CE4B | Up: Map | Next: CF1E |
|
Used by the routines at Update_Berk_ReadControls and Update_Ghosts.
Spawn a plant shoot into the first free collectible-eye slot when a pot germinates. IX addresses the pot; free slots are sought from StateData_Complex_07 onwards.
|
||||||||||
|
Stash DE (caller-preserved) while the free eye slot is found.
|
||||||||||
| Update_Plant_Pots | CEE1 | PUSH DE | Stash DE on the stack. | |||||||
| CEE2 | LD IY,$8F4B | Point IY at the first collectible-eye slot (StateData_Complex_07). | ||||||||
| CEE6 | LD DE,$000E | Each entity record is 000E bytes long, then load that length into DE. | ||||||||
|
Find the first free collectible-eye slot.
|
||||||||||
| Update_Plant_Pots_FindFreeSlot | CEE9 | LD A,(IY+$00) | Fetch this eye slot's entity type, then is the slot empty (type 00)?. | |||||||
| CEEC | OR A | |||||||||
| CEED | JR Z,Update_Plant_Pots_PlaceShoot | If so, plant the shoot here at Update_Plant_Pots_PlaceShoot. | ||||||||
| CEEF | ADD IY,DE | Otherwise advance IY to the next entity record. | ||||||||
| CEF1 | JR Update_Plant_Pots_FindFreeSlot | Keep scanning at Update_Plant_Pots_FindFreeSlot. | ||||||||
|
Place the shoot in that slot, matching the pot's room and position.
|
||||||||||
| Update_Plant_Pots_PlaceShoot | CEF3 | LD (IY+$00),$0E | Mark the free slot as a plant shoot (type 0E). | |||||||
| CEF7 | LD A,(IX+$05) | Load the pot's y-coordinate. | ||||||||
| CEFA | SUB C | Raise the shoot by the caller's offset in C. | ||||||||
| CEFB | LD (IY+$05),A | Write that as the shoot's y-coordinate. | ||||||||
| CEFE | ADD A,$02 | Make the shoot two characters tall. | ||||||||
| CF00 | LD (IY+$06),A | Write the shoot's y-extent. | ||||||||
| CF03 | LD A,(IX+$07) | Fetch the pot's x-coordinate. | ||||||||
| CF06 | LD (IY+$07),A | Place the shoot on the same x. | ||||||||
| CF09 | ADD A,$02 | Make the shoot two characters wide. | ||||||||
| CF0B | LD (IY+$08),A | Write the shoot's x-extent. | ||||||||
| CF0E | LD A,(IX+$04) | Fetch the pot's room index. | ||||||||
| CF11 | LD (IY+$04),A | Keep the shoot in the same room as the pot. | ||||||||
| CF14 | LD (IY+$0A),$1B | Set the shoot's graphic layout to GraphicLayout_CollectibleEyeballFrame2. | ||||||||
| CF18 | LD (IY+$0B),$A1 | |||||||||
| CF1C | POP DE | Restore DE from the stack. | ||||||||
| CF1D | RET | Return. | ||||||||
| Prev: CE4B | Up: Map | Next: CF1E |