![]() |
Routines |
| Prev: A30D | Up: Map | Next: A3DB |
|
Used by the routine at RunGame.
Copies the saved state of each bottle in the level (see BottleStates) back into the objects of the level. Each entry in the list of the level selects a group of objects, and the objects with the type 01 or 02 in bits 0-3 (and bit 7 set) are the bottles.
|
||||
| RestoreBottles | A39B | CALL StartLevel | Call StartLevel to find the data of the level and place the player. | |
| A39E | LD IY,$DEE1 | Point IY at BottleStates. | ||
| A3A2 | LD B,(IX-$01) | Fetch the number of entries in the list of the level. | ||
| RestoreBottles_NextEntry | A3A5 | PUSH BC | Save the count of entries. | |
| A3A6 | PUSH IX | Save the address of the entry. | ||
| A3A8 | CALL FindGroupObjects | Call FindGroupObjects to find the objects in the group of the entry. | ||
| A3AB | LD A,B | Fetch the number of objects. | ||
| A3AC | AND A | Test it. | ||
| A3AD | JR Z,RestoreBottles_NextGroup | Jump to RestoreBottles_NextGroup if there are no objects. | ||
| RestoreBottles_NextObject | A3AF | LD A,(IX+$01) | Fetch the type of the next object. | |
| A3B2 | AND %10001111 | Keep bit 7 and bits 0-3. | ||
| A3B4 | CP $81 | Jump to RestoreBottles_Restore if it is a bottle of type 01. | ||
| A3B6 | JR Z,RestoreBottles_Restore | |||
| A3B8 | CP $82 | Jump to RestoreBottles_Skip unless it is a bottle of type 02. | ||
| A3BA | JR NZ,RestoreBottles_Skip | |||
| RestoreBottles_Restore | A3BC | LD A,(IX+$01) | Fetch the type of the object again. | |
| A3BF | AND %01110000 | Use bits 4-6. | ||
| A3C1 | OR (IY+$00) | Combine them with the saved state of the bottle. | ||
| A3C4 | LD (IX+$01),A | Store the new type of the object. | ||
| A3C7 | INC IY | Move onto the saved state of the next bottle. | ||
| RestoreBottles_Skip | A3C9 | INC IX | Move onto the next object... | |
| A3CB | INC IX | ...which is three bytes... | ||
| A3CD | INC IX | ...along. | ||
| A3CF | DJNZ RestoreBottles_NextObject | Jump back until all of the objects have been looked at. | ||
| RestoreBottles_NextGroup | A3D1 | POP IX | Restore the address of the entry. | |
| A3D3 | INC IX | Move onto the next entry... | ||
| A3D5 | INC IX | ...which is two bytes along. | ||
| A3D7 | POP BC | Restore the count of entries. | ||
| A3D8 | DJNZ RestoreBottles_NextEntry | Jump back until all of the entries have been looked at. | ||
| A3DA | RET | Return. | ||
| Prev: A30D | Up: Map | Next: A3DB |