![]() |
Routines |
Prev: 54191 | Up: Map | Next: 54462 |
Used by the routines at GoldfishGame_Collision, GoldfishGame_EraseSprite and GoldfishGame_PrintBoats.
|
||||||||||||||
GoldfishGame_PrintSprite | 54368 | PUSH HL | Preserve HL on the stack as it's not actively used. | |||||||||||
Store the Sprite ID. Note; it is incremented on each UDG character block being printed (see GoldfishGame_PrintSprite_PrintUDG), hence why it's -1 here.
|
||||||||||||||
54369 | DEC A | Decrease the Spite ID by one and store it at *GoldfishGame_TempSpriteID. | ||||||||||||
54370 | LD (56124),A | |||||||||||||
54373 | LD A,E | Store the Sprite width at *GoldfishGame_TempSpriteWidth. | ||||||||||||
54374 | LD (56123),A | |||||||||||||
Ensure that we're printing within the screen boundaries.
|
||||||||||||||
GoldfishGame_PrintSprite_Loop | 54377 | LD A,C | Jump to GoldfishGame_PrintSprite_Return if C is lower than 2. | |||||||||||
54378 | CP 2 | |||||||||||||
54380 | JP C,GoldfishGame_PrintSprite_Return | |||||||||||||
54383 | LD A,(56123) | E=*GoldfishGame_TempSpriteWidth. | ||||||||||||
54386 | LD E,A | |||||||||||||
54387 | LD A,C | Jump to GoldfishGame_FindViewableSprite if C is higher than 34. | ||||||||||||
54388 | CP 34 | |||||||||||||
54390 | JP NC,GoldfishGame_FindViewableSprite | |||||||||||||
GoldfishGame_PrintSprite_At | 54393 | PUSH BC | Stash the print co-ordinates and the sprite height/ width on the stack. | |||||||||||
54394 | PUSH DE | |||||||||||||
Set the current printing location.
|
||||||||||||||
54395 | CALL 3545 | Call CL_SET. | ||||||||||||
54398 | POP DE | Restore the sprite height/ width from the stack, they're used here as loop counters. | ||||||||||||
Action this sprite ID (+1 and print it to the screen buffer).
|
||||||||||||||
GoldfishGame_PrintSprite_PrintUDG | 54399 | LD A,(56124) | Increment *GoldfishGame_TempSpriteID by one. | |||||||||||
54402 | INC A | |||||||||||||
54403 | LD (56124),A | |||||||||||||
54406 | CALL GoldfishGame_PrintColourUDG | Call GoldfishGame_PrintColourUDG. | ||||||||||||
54409 | LD A,C | Call GoldfishGame_PrintSprite_0 if C is equal to 2. | ||||||||||||
54410 | CP 2 | |||||||||||||
54412 | CALL Z,GoldfishGame_PrintSprite_0 | |||||||||||||
Keep track of where we're printing to on the screen.
|
||||||||||||||
54415 | DEC C | Move right one character block. | ||||||||||||
54416 | DEC E | Decrease the sprite width counter by one. | ||||||||||||
54417 | JR NZ,GoldfishGame_PrintSprite_PrintUDG | Jump to GoldfishGame_PrintSprite_PrintUDG until the sprite width counter is zero. | ||||||||||||
A row of the sprite has been printed, so restore the screen position and move onto the next line.
|
||||||||||||||
54419 | POP BC | Restore the current print co-ordinates from the stack. | ||||||||||||
54420 | DEC D | Decrease the sprite height counter by one. | ||||||||||||
54421 | JR Z,GoldfishGame_PrintSprite_Return | Jump to GoldfishGame_PrintSprite_Return if the whole sprite has now finished printing. | ||||||||||||
54423 | DEC B | Move down one row. | ||||||||||||
54424 | JR GoldfishGame_PrintSprite_Loop | Jump to GoldfishGame_PrintSprite_Loop. | ||||||||||||
Housekeeping, and return.
|
||||||||||||||
GoldfishGame_PrintSprite_Return | 54426 | POP HL | Restore HL from the stack. | |||||||||||
54427 | RET | Return. | ||||||||||||
GoldfishGame_PrintSprite_0 | 54428 | DEC E | Decrease E by one. | |||||||||||
54429 | PUSH AF | Stash AF on the stack. | ||||||||||||
54430 | INC E | Increment E by one. | ||||||||||||
54431 | LD A,(56124) | Increment *GoldfishGame_TempSpriteID by one. | ||||||||||||
54434 | INC A | |||||||||||||
54435 | LD (56124),A | |||||||||||||
54438 | POP AF | Restore AF from the stack. | ||||||||||||
54439 | RET Z | Return if A is zero. | ||||||||||||
54440 | DEC E | Decrease E by one. | ||||||||||||
54441 | JR GoldfishGame_PrintSprite_0 | Jump to GoldfishGame_PrintSprite_0. | ||||||||||||
Try to discover the printable part of the sprite.
|
||||||||||||||
GoldfishGame_FindViewableSprite | 54443 | LD A,(56124) | Increment *GoldfishGame_TempSpriteID by one. | |||||||||||
54446 | INC A | |||||||||||||
54447 | LD (56124),A | |||||||||||||
54450 | DEC E | Decrease the sprite width counter by one. | ||||||||||||
54451 | JP Z,GoldfishGame_PrintSprite_Return | Jump to GoldfishGame_PrintSprite_Return if the sprite width counter is zero. | ||||||||||||
54454 | DEC C | Move right one character block. | ||||||||||||
54455 | LD A,C | Jump to GoldfishGame_PrintSprite_At if C is higher than 34. | ||||||||||||
54456 | CP 34 | |||||||||||||
54458 | JR NC,GoldfishGame_PrintSprite_At | |||||||||||||
54460 | JR GoldfishGame_FindViewableSprite | Keep looping back to GoldfishGame_FindViewableSprite until we either return if this is invalid, or find a printable part of the sprite. |
Prev: 54191 | Up: Map | Next: 54462 |