Routines |
Prev: D260 | Up: Map | Next: D33E |
Used by the routine at GoldfishGame.
|
||||
Only remove air every 16th frame.
|
||||
GoldfishGame_AirBar | D2F2 | LD A,($D93D) | A=*GoldfishGame_BuoyancyCounter. | |
D2F5 | AND %00001111 | Only proceed every 16th frame, otherwise return. | ||
D2F7 | RET NZ | |||
This entry point is used by the routines at GoldfishGame and GoldfishGame_RefillOxygen.
|
||||
GoldfishGame_PrintAirBar | D2F8 | LD HL,$D22E | Write D22E (UDG_AirBar) to *CHARS. | |
D2FB | LD ($5C36),HL | |||
Set the co-ordinates of where we're going to PRINT AT.
|
||||
D2FE | LD B,$02 | Set up the screen buffer location 15/02 using CL_SET. | ||
D300 | LD C,$15 | |||
D302 | CALL $0DD9 | |||
Set the attributes.
|
||||
D305 | LD A,$10 | Set INK: RED (02). | ||
D307 | RST $10 | |||
D308 | LD A,$02 | |||
D30A | RST $10 | |||
D30B | LD A,$11 | Set PAPER: CYAN (05). | ||
D30D | RST $10 | |||
D30E | LD A,$05 | |||
D310 | RST $10 | |||
D311 | LD A,($D33E) | Is *GoldfishGame_OxygenLevel zero? | ||
D314 | CP $00 | |||
D316 | PUSH AF | Stash the current oxygen level on the stack. | ||
D317 | CALL Z,GoldfishGame_DropFish | Call GoldfishGame_DropFish if the current oxygen level is zero. | ||
D31A | POP AF | Restore the current oxygen level from the stack. | ||
D31B | JR Z,GoldfishGame_PrintNoAirBar | Jump to GoldfishGame_PrintNoAirBar if the current oxygen level is zero. | ||
The player has air, so deplete it here.
|
||||
D31D | DEC A | Decrease the current oxygen level by one, and write it back to *GoldfishGame_OxygenLevel. | ||
D31E | LD ($D33E),A | |||
Now draw a visual representation of the air level to the screen.
|
||||
D321 | LD B,A | B=the current oxygen level+01 (as a counter for drawing the air bar). | ||
D322 | INC B | |||
D323 | LD A,$20 | A=UDG_AirBar (20). | ||
GoldfishGame_PrintAirBar_Loop | D325 | PUSH AF | Stash the air bar UDG reference on the stack. | |
D326 | RST $10 | Print to the screen using RST 10. | ||
D327 | POP AF | Restore the air bar UDG reference from the stack. | ||
D328 | DJNZ GoldfishGame_PrintAirBar_Loop | Decrease the air bar counter by one and loop back to GoldfishGame_PrintAirBar_Loop until the counter is zero. | ||
Print some empty space to mask off the end of the air bar.
|
||||
GoldfishGame_PrintNoAirBar | D32A | LD A,$21 | A=UDG_NoAirBar (21). | |
D32C | RST $10 | Print to the screen using RST 10. | ||
D32D | RET | Return. | ||
UDG_AirBar | D32E | DEFB $00,$00,$FF,$FF,$FF,$FF,$00,$00 | ||
UDG_NoAirBar | D336 | DEFB $00,$00,$00,$00,$00,$00,$00,$00 |
Prev: D260 | Up: Map | Next: D33E |