![]() |
Routines |
| Prev: 55153 | Up: Map | Next: 55271 |
|
Used by the routine at GoldfishGame.
|
||||
|
The sea is always the paper colour.
|
||||
| Handler_SeaCreatures | 55160 | LD A,17 | Set PAPER: BLUE (1). | |
| 55162 | RST 16 | |||
| 55163 | LD A,1 | |||
| 55165 | RST 16 | |||
| 55166 | LD IX,56134 | Point IX at Data_SeaCreatures. | ||
| Handler_SeaCreatures_Loop | 55170 | PUSH BC | Stash the remaining-slot count on the stack. | |
|
Use a free slot to spawn; otherwise animate the occupant.
|
||||
| 55171 | LD A,(IX+10) | Jump to Handler_SeaCreatures_Chooser if this slot is free. | ||
| 55174 | CP 0 | |||
| 55176 | JP Z,Handler_SeaCreatures_Chooser | |||
|
Animate and move the creature already in this slot.
|
||||
| 55179 | LD L,(IX+16) | Fetch this creature's UDG graphics pointer. | ||
| 55182 | LD H,(IX+17) | |||
| 55185 | LD (23606),HL | Write it to *CHARS. | ||
| 55188 | LD A,16 | Set INK from the creature attribute. | ||
| 55190 | RST 16 | |||
| 55191 | LD A,(IX+9) | |||
| 55194 | RST 16 | |||
| 55195 | LD A,(IX+6) | Fetch the current creature frame ID. | ||
|
The frame step in the slot varies with creature size.
|
||||
| 55198 | ADD A,(IX+18) | Add one animation step. | ||
| 55201 | CP (IX+19) | Jump to Handler_SeaCreatures_SetFrameId if the walk cycle has not wrapped. | ||
| 55204 | JR NZ,Handler_SeaCreatures_SetFrameId | |||
| 55206 | LD A,32 | Reset to the first creature frame. | ||
| Handler_SeaCreatures_SetFrameId | 55208 | LD (IX+6),A | Write the frame ID back to the creature. | |
| 55211 | CALL Handler_SeaCreatureMovement | Apply the creature's movement deltas. | ||
| 55214 | LD (IX+0),C | Write the new co-ordinates back to the creature. | ||
| 55217 | LD (IX+1),B | |||
| 55220 | LD (IX+2),E | Write the new offsets back to the creature. | ||
| 55223 | LD (IX+3),D | |||
| 55226 | CALL Handler_SeaCreatureAnimation | Animate the creature's extra frames. | ||
| 55229 | LD A,C | Jump to SeaCreature_FreeSlot if the creature swam off-screen. | ||
| 55230 | CP 1 | |||
| 55232 | JP Z,SeaCreature_FreeSlot | |||
| 55235 | CALL GoldfishGame_PrintShiftedSprite | Print the shifted creature sprite. | ||
| 55238 | LD A,(IX+0) | Copy the co-ordinates to the previous-position slots. | ||
| 55241 | LD (IX+13),A | |||
| 55244 | LD A,(IX+1) | |||
| 55247 | LD (IX+14),A | |||
| 55250 | LD A,(IX+2) | Copy the offsets to the previous-offset slots. | ||
| 55253 | LD (IX+11),A | |||
| 55256 | LD A,(IX+3) | |||
| 55259 | LD (IX+15),A | |||
|
This entry point is used by the routines at SeaCreature_FreeSlot and Handler_SeaCreatures_Chooser.
|
||||
| Handler_SeaCreatures_Next | 55262 | LD DE,24 | Move IX on to the next twenty-four-byte creature slot. | |
| 55265 | ADD IX,DE | |||
| 55267 | POP BC | Restore the remaining-slot count from the stack. | ||
| 55268 | DJNZ Handler_SeaCreatures_Loop | Decrease the slot count by one and loop back to Handler_SeaCreatures_Loop until every slot has been processed. | ||
| 55270 | RET | Return. | ||
| Prev: 55153 | Up: Map | Next: 55271 |