![]() |
Routines |
| Prev: D3A6 | Up: Map | Next: D460 |
|
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 | D3AF | LD A,C | A=the new column. | |||||||||||||
| D3B0 | SUB (IX+$0D) | Subtract the previous column. | ||||||||||||||
| D3B3 | JR Z,Handler_SeaCreatureAnimation_TestHorizontal | Jump to Handler_SeaCreatureAnimation_TestHorizontal if the column has not changed. | ||||||||||||||
| D3B5 | CP $FF | Test whether the creature stepped left. | ||||||||||||||
| D3B7 | PUSH AF | Stash that result on the stack. | ||||||||||||||
| D3B8 | CALL Z,Handler_SeaCreatureAnimation_EraseLeftColumn | Erase the right-hand trail if it stepped left. | ||||||||||||||
| D3BB | POP AF | Restore the result from the stack. | ||||||||||||||
| D3BC | CALL NZ,Handler_SeaCreatureAnimation_EraseRightColumn | Erase the left-hand trail if it stepped right. | ||||||||||||||
| D3BF | JR Handler_SeaCreatureAnimation_TestVertical | Jump to Handler_SeaCreatureAnimation_TestVertical. | ||||||||||||||
| Handler_SeaCreatureAnimation_TestHorizontal | D3C1 | LD A,E | Jump to Handler_SeaCreatureAnimation_TestVertical if the horizontal offset has not changed. | |||||||||||||
| D3C2 | CP (IX+$0B) | |||||||||||||||
| D3C5 | JR Z,Handler_SeaCreatureAnimation_TestVertical | |||||||||||||||
| D3C7 | CP $03 | Erase the left-hand trail if the offset wrapped. | ||||||||||||||
| D3C9 | CALL Z,Handler_SeaCreatureAnimation_EraseRightColumn | |||||||||||||||
|
Has the creature moved vertically?
|
||||||||||||||||
| Handler_SeaCreatureAnimation_TestVertical | D3CC | LD A,B | A=the new row. | |||||||||||||
| D3CD | SUB (IX+$0E) | Subtract the previous row. | ||||||||||||||
| D3D0 | JR Z,Handler_SeaCreatureAnimation_TestVerticalOffset | Jump to Handler_SeaCreatureAnimation_TestVerticalOffset if the row has not changed. | ||||||||||||||
| D3D2 | CP $FF | Test whether the creature stepped up. | ||||||||||||||
| D3D4 | PUSH AF | Stash that result on the stack. | ||||||||||||||
| D3D5 | CALL Z,Handler_SeaCreatureAnimation_EraseUpRow | Erase the lower trail if it stepped up. | ||||||||||||||
| D3D8 | POP AF | Restore the result from the stack. | ||||||||||||||
| D3D9 | CALL NZ,Handler_SeaCreatureAnimation_EraseDownRow | Erase the upper trail if it stepped down. | ||||||||||||||
| D3DC | JR Handler_SeaCreatureAnimation_Return | Jump to Handler_SeaCreatureAnimation_Return. | ||||||||||||||
| Handler_SeaCreatureAnimation_TestVerticalOffset | D3DE | LD A,D | Jump to Handler_SeaCreatureAnimation_Return if the vertical offset has not changed. | |||||||||||||
| D3DF | CP (IX+$0F) | |||||||||||||||
| D3E2 | JR Z,Handler_SeaCreatureAnimation_Return | |||||||||||||||
| D3E4 | CP $03 | Erase the upper trail if the offset wrapped. | ||||||||||||||
| D3E6 | CALL Z,Handler_SeaCreatureAnimation_EraseDownRow | |||||||||||||||
| Handler_SeaCreatureAnimation_Return | D3E9 | RET | Return. | |||||||||||||
|
Erase the column the creature just left (stepped left).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseLeftColumn | D3EA | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| D3EB | PUSH DE | |||||||||||||||
| D3EC | LD C,(IX+$0D) | C=the previous column. | ||||||||||||||
| D3EF | LD B,(IX+$0E) | B=the previous row. | ||||||||||||||
| D3F2 | LD D,(IX+$08) | D=the sprite height. | ||||||||||||||
| D3F5 | LD E,$01 | E=01 (one column). | ||||||||||||||
| D3F7 | LD A,(IX+$03) | Jump to Handler_SeaCreatureAnimation_EraseLeftTiles if the vertical offset is 03. | ||||||||||||||
| D3FA | CP $03 | |||||||||||||||
| D3FC | JR Z,Handler_SeaCreatureAnimation_EraseLeftTiles | |||||||||||||||
| D3FE | INC D | Widen the erase by one row. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseLeftTiles | D3FF | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| D402 | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| D403 | POP BC | |||||||||||||||
| D404 | RET | Return. | ||||||||||||||
|
Erase the column the creature just left (stepped right).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseRightColumn | D405 | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| D406 | PUSH DE | |||||||||||||||
| D407 | LD A,(IX+$0D) | A=the previous column. | ||||||||||||||
| D40A | LD C,(IX+$07) | C=the sprite width. | ||||||||||||||
| D40D | SUB C | Subtract the width to find the trailing column. | ||||||||||||||
| D40E | LD C,A | C=that trailing column. | ||||||||||||||
| D40F | LD B,(IX+$0E) | B=the previous row. | ||||||||||||||
| D412 | LD D,(IX+$08) | D=the sprite height. | ||||||||||||||
| D415 | LD E,$01 | E=01 (one column). | ||||||||||||||
| D417 | LD A,(IX+$03) | Jump to Handler_SeaCreatureAnimation_EraseRightTiles if the vertical offset is 03. | ||||||||||||||
| D41A | CP $03 | |||||||||||||||
| D41C | JR Z,Handler_SeaCreatureAnimation_EraseRightTiles | |||||||||||||||
| D41E | INC D | Widen the erase by one row. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseRightTiles | D41F | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| D422 | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| D423 | POP BC | |||||||||||||||
| D424 | RET | Return. | ||||||||||||||
|
Erase the row the creature just left (stepped down).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseDownRow | D425 | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| D426 | PUSH DE | |||||||||||||||
| D427 | LD A,(IX+$0E) | A=the previous row. | ||||||||||||||
| D42A | LD D,(IX+$08) | D=the sprite height. | ||||||||||||||
| D42D | SUB D | Subtract the height to find the trailing row. | ||||||||||||||
| D42E | LD B,A | B=that trailing row. | ||||||||||||||
| D42F | LD E,(IX+$07) | E=the sprite width. | ||||||||||||||
| D432 | LD C,(IX+$0D) | C=the previous column. | ||||||||||||||
| D435 | LD D,$01 | D=01 (one row). | ||||||||||||||
| D437 | LD A,(IX+$02) | Jump to Handler_SeaCreatureAnimation_EraseDownTiles if the horizontal offset is 03. | ||||||||||||||
| D43A | CP $03 | |||||||||||||||
| D43C | JR Z,Handler_SeaCreatureAnimation_EraseDownTiles | |||||||||||||||
| D43E | INC E | Widen the erase by one column. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseDownTiles | D43F | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| D442 | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| D443 | POP BC | |||||||||||||||
| D444 | RET | Return. | ||||||||||||||
|
Erase the row the creature just left (stepped up).
|
||||||||||||||||
| Handler_SeaCreatureAnimation_EraseUpRow | D445 | PUSH BC | Stash the new position and offsets on the stack. | |||||||||||||
| D446 | PUSH DE | |||||||||||||||
| D447 | LD C,(IX+$0D) | C=the previous column. | ||||||||||||||
| D44A | LD B,(IX+$0E) | B=the previous row. | ||||||||||||||
| D44D | LD D,$01 | D=01 (one row). | ||||||||||||||
| D44F | LD E,(IX+$07) | E=the sprite width. | ||||||||||||||
| D452 | LD A,(IX+$02) | Jump to Handler_SeaCreatureAnimation_EraseUpTiles if the horizontal offset is 03. | ||||||||||||||
| D455 | CP $03 | |||||||||||||||
| D457 | JR Z,Handler_SeaCreatureAnimation_EraseUpTiles | |||||||||||||||
| D459 | INC E | Widen the erase by one column. | ||||||||||||||
| Handler_SeaCreatureAnimation_EraseUpTiles | D45A | CALL GoldfishGame_EraseSprite | Erase those tiles. | |||||||||||||
| D45D | POP DE | Restore the new position and offsets from the stack. | ||||||||||||||
| D45E | POP BC | |||||||||||||||
| D45F | RET | Return. | ||||||||||||||
| Prev: D3A6 | Up: Map | Next: D460 |