![]() |
Routines |
| Prev: 54182 | Up: Map | Next: 54368 |
|
Used by the routines at GoldfishGame_UpdatePlayer and Handler_SeaCreatures.
Erases the previous creature tiles when the slot has moved a column or row.
|
||||||||||||||||
|
Has the creature moved horizontally?
|
||||||||||||||||
| Handler_SeaCreatureAnimation | 54191 | LD A,C | A=the new column. | |||||||||||||
| 54192 | SUB (IX+13) | Subtract the previous column. | ||||||||||||||
| 54195 | JR Z,Handler_SeaCreatureAnimation_TestHorizontal | Jump to Handler_SeaCreatureAnimation_TestHorizontal if the column has not changed. | ||||||||||||||
| 54197 | CP 255 | Test whether the creature stepped left. | ||||||||||||||
| 54199 | PUSH AF | Stash that result on the stack. | ||||||||||||||
| 54200 | CALL Z,Handler_SeaCreatureAnimation_EraseLeftColumn | Erase the right-hand trail if it stepped left. | ||||||||||||||
| 54203 | POP AF | Restore the result from the stack. | ||||||||||||||
| 54204 | CALL NZ,Handler_SeaCreatureAnimation_EraseRightColumn | Erase the left-hand trail if it stepped right. | ||||||||||||||
| 54207 | JR Handler_SeaCreatureAnimation_TestVertical | Jump to Handler_SeaCreatureAnimation_TestVertical. | ||||||||||||||
| Handler_SeaCreatureAnimation_TestHorizontal | 54209 | LD A,E | Jump to Handler_SeaCreatureAnimation_TestVertical if the horizontal offset has not changed. | |||||||||||||
| 54210 | CP (IX+11) | |||||||||||||||
| 54213 | JR Z,Handler_SeaCreatureAnimation_TestVertical | |||||||||||||||
| 54215 | CP 3 | Erase the left-hand trail if the offset wrapped. | ||||||||||||||
| 54217 | CALL Z,Handler_SeaCreatureAnimation_EraseRightColumn | |||||||||||||||
|
Has the creature moved vertically?
|
||||||||||||||||
| Handler_SeaCreatureAnimation_TestVertical | 54220 | LD A,B | A=the new row. | |||||||||||||
| 54221 | SUB (IX+14) | Subtract the previous row. | ||||||||||||||
| 54224 | JR Z,Handler_SeaCreatureAnimation_TestVerticalOffset | Jump to Handler_SeaCreatureAnimation_TestVerticalOffset if the row has not changed. | ||||||||||||||
| 54226 | CP 255 | Test whether the creature stepped up. | ||||||||||||||
| 54228 | PUSH AF | Stash that result on the stack. | ||||||||||||||
| 54229 | CALL Z,Handler_SeaCreatureAnimation_EraseUpRow | Erase the lower trail if it stepped up. | ||||||||||||||
| 54232 | POP AF | Restore the result from the stack. | ||||||||||||||
| 54233 | CALL NZ,Handler_SeaCreatureAnimation_EraseDownRow | Erase the upper trail if it stepped down. | ||||||||||||||
| 54236 | JR Handler_SeaCreatureAnimation_Return | Jump to Handler_SeaCreatureAnimation_Return. | ||||||||||||||
| Handler_SeaCreatureAnimation_TestVerticalOffset | 54238 | LD A,D | Jump to Handler_SeaCreatureAnimation_Return if the vertical offset has not changed. | |||||||||||||
| 54239 | CP (IX+15) | |||||||||||||||
| 54242 | JR Z,Handler_SeaCreatureAnimation_Return | |||||||||||||||
| 54244 | CP 3 | Erase the upper trail if the offset wrapped. | ||||||||||||||
| 54246 | CALL Z,Handler_SeaCreatureAnimation_EraseDownRow | |||||||||||||||
| Handler_SeaCreatureAnimation_Return | 54249 | RET | Return. | |||||||||||||
|
Erase the column the creature just left (stepped left).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseLeftColumn | 54250 | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| 54251 | PUSH DE | |||||||||||||||
| 54252 | LD C,(IX+13) | C=the previous column. | ||||||||||||||
| 54255 | LD B,(IX+14) | B=the previous row. | ||||||||||||||
| 54258 | LD D,(IX+8) | D=the sprite height. | ||||||||||||||
| 54261 | LD E,1 | E=1 (one column). | ||||||||||||||
| 54263 | LD A,(IX+3) | Jump to Handler_SeaCreatureAnimation_EraseLeftTiles if the vertical offset is 3. | ||||||||||||||
| 54266 | CP 3 | |||||||||||||||
| 54268 | JR Z,Handler_SeaCreatureAnimation_EraseLeftTiles | |||||||||||||||
| 54270 | INC D | Widen the erase by one row. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseLeftTiles | 54271 | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| 54274 | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| 54275 | POP BC | |||||||||||||||
| 54276 | RET | Return. | ||||||||||||||
|
Erase the column the creature just left (stepped right).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseRightColumn | 54277 | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| 54278 | PUSH DE | |||||||||||||||
| 54279 | LD A,(IX+13) | A=the previous column. | ||||||||||||||
| 54282 | LD C,(IX+7) | C=the sprite width. | ||||||||||||||
| 54285 | SUB C | Subtract the width to find the trailing column. | ||||||||||||||
| 54286 | LD C,A | C=that trailing column. | ||||||||||||||
| 54287 | LD B,(IX+14) | B=the previous row. | ||||||||||||||
| 54290 | LD D,(IX+8) | D=the sprite height. | ||||||||||||||
| 54293 | LD E,1 | E=1 (one column). | ||||||||||||||
| 54295 | LD A,(IX+3) | Jump to Handler_SeaCreatureAnimation_EraseRightTiles if the vertical offset is 3. | ||||||||||||||
| 54298 | CP 3 | |||||||||||||||
| 54300 | JR Z,Handler_SeaCreatureAnimation_EraseRightTiles | |||||||||||||||
| 54302 | INC D | Widen the erase by one row. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseRightTiles | 54303 | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| 54306 | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| 54307 | POP BC | |||||||||||||||
| 54308 | RET | Return. | ||||||||||||||
|
Erase the row the creature just left (stepped down).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseDownRow | 54309 | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| 54310 | PUSH DE | |||||||||||||||
| 54311 | LD A,(IX+14) | A=the previous row. | ||||||||||||||
| 54314 | LD D,(IX+8) | D=the sprite height. | ||||||||||||||
| 54317 | SUB D | Subtract the height to find the trailing row. | ||||||||||||||
| 54318 | LD B,A | B=that trailing row. | ||||||||||||||
| 54319 | LD E,(IX+7) | E=the sprite width. | ||||||||||||||
| 54322 | LD C,(IX+13) | C=the previous column. | ||||||||||||||
| 54325 | LD D,1 | D=1 (one row). | ||||||||||||||
| 54327 | LD A,(IX+2) | Jump to Handler_SeaCreatureAnimation_EraseDownTiles if the horizontal offset is 3. | ||||||||||||||
| 54330 | CP 3 | |||||||||||||||
| 54332 | JR Z,Handler_SeaCreatureAnimation_EraseDownTiles | |||||||||||||||
| 54334 | INC E | Widen the erase by one column. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseDownTiles | 54335 | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| 54338 | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| 54339 | POP BC | |||||||||||||||
| 54340 | RET | Return. | ||||||||||||||
|
Erase the row the creature just left (stepped up).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseUpRow | 54341 | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| 54342 | PUSH DE | |||||||||||||||
| 54343 | LD C,(IX+13) | C=the previous column. | ||||||||||||||
| 54346 | LD B,(IX+14) | B=the previous row. | ||||||||||||||
| 54349 | LD D,1 | D=1 (one row). | ||||||||||||||
| 54351 | LD E,(IX+7) | E=the sprite width. | ||||||||||||||
| 54354 | LD A,(IX+2) | Jump to Handler_SeaCreatureAnimation_EraseUpTiles if the horizontal offset is 3. | ||||||||||||||
| 54357 | CP 3 | |||||||||||||||
| 54359 | JR Z,Handler_SeaCreatureAnimation_EraseUpTiles | |||||||||||||||
| 54361 | INC E | Widen the erase by one column. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseUpTiles | 54362 | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| 54365 | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| 54366 | POP BC | |||||||||||||||
| 54367 | RET | Return. | ||||||||||||||
| Prev: 54182 | Up: Map | Next: 54368 |