![]() |
Routines |
| Prev: 52811 | Up: Map | Next: 53022 |
|
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 | 52961 | PUSH DE | Stash DE on the stack. | |||||||
| 52962 | LD IY,36683 | Point IY at the first collectible-eye slot (StateData_Complex_07). | ||||||||
| 52966 | LD DE,14 | Each entity record is 0014 bytes long, then load that length into DE. | ||||||||
|
Find the first free collectible-eye slot.
|
||||||||||
| Update_Plant_Pots_FindFreeSlot | 52969 | LD A,(IY+0) | Fetch this eye slot's entity type, then is the slot empty (type 0)?. | |||||||
| 52972 | OR A | |||||||||
| 52973 | JR Z,Update_Plant_Pots_PlaceShoot | If so, plant the shoot here at Update_Plant_Pots_PlaceShoot. | ||||||||
| 52975 | ADD IY,DE | Otherwise advance IY to the next entity record. | ||||||||
| 52977 | 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 | 52979 | LD (IY+0),14 | Mark the free slot as a plant shoot (type 14). | |||||||
| 52983 | LD A,(IX+5) | Load the pot's y-coordinate. | ||||||||
| 52986 | SUB C | Raise the shoot by the caller's offset in C. | ||||||||
| 52987 | LD (IY+5),A | Write that as the shoot's y-coordinate. | ||||||||
| 52990 | ADD A,2 | Make the shoot two characters tall. | ||||||||
| 52992 | LD (IY+6),A | Write the shoot's y-extent. | ||||||||
| 52995 | LD A,(IX+7) | Fetch the pot's x-coordinate. | ||||||||
| 52998 | LD (IY+7),A | Place the shoot on the same x. | ||||||||
| 53001 | ADD A,2 | Make the shoot two characters wide. | ||||||||
| 53003 | LD (IY+8),A | Write the shoot's x-extent. | ||||||||
| 53006 | LD A,(IX+4) | Fetch the pot's room index. | ||||||||
| 53009 | LD (IY+4),A | Keep the shoot in the same room as the pot. | ||||||||
| 53012 | LD (IY+10),27 | Set the shoot's graphic layout to GraphicLayout_CollectibleEyeballFrame2. | ||||||||
| 53016 | LD (IY+11),161 | |||||||||
| 53020 | POP DE | Restore DE from the stack. | ||||||||
| 53021 | RET | Return. | ||||||||
| Prev: 52811 | Up: Map | Next: 53022 |