Prev: 53856 Up: Map Next: 54078
54002: Goldfish Game: Air Bar
Used by the routine at GoldfishGame.
Only remove air every 16th frame.
GoldfishGame_AirBar 54002 LD A,(55613) A=*GoldfishGame_BuoyancyCounter.
54005 AND %00001111 Only proceed every 16th frame, otherwise return.
54007 RET NZ
This entry point is used by the routines at GoldfishGame and GoldfishGame_RefillOxygen.
GoldfishGame_PrintAirBar 54008 LD HL,53806 Write 53806 to *CHARS.
54011 LD (23606),HL
Set the co-ordinates of where we're going to PRINT AT.
54014 LD B,2 Set up the screen buffer location 21/2 using CL_SET.
54016 LD C,21
54018 CALL 3545
Set the attributes.
54021 LD A,16 Set INK: RED (2).
54023 RST 16
54024 LD A,2
54026 RST 16
54027 LD A,17 Set PAPER: CYAN (5).
54029 RST 16
54030 LD A,5
54032 RST 16
54033 LD A,(54078) Is *GoldfishGame_OxygenLevel zero?
54036 CP 0
54038 PUSH AF Stash the current oxygen level on the stack.
54039 CALL Z,GoldfishGame_DropFish Call GoldfishGame_DropFish if the current oxygen level is zero.
54042 POP AF Restore the current oxygen level from the stack.
54043 JR Z,GoldfishGame_PrintNoAirBar Jump to GoldfishGame_PrintNoAirBar if the current oxygen level is zero.
The player has air, so deplete it here.
54045 DEC A Decrease the current oxygen level by one, and write it back to *GoldfishGame_OxygenLevel.
54046 LD (54078),A
Now draw a visual representation of the air level to the screen.
54049 LD B,A B=the current oxygen level+1 (as a counter for drawing the air bar).
54050 INC B
54051 LD A,32 A=UDG_AirBar (32).
GoldfishGame_PrintAirBar_Loop 54053 PUSH AF Stash the air bar UDG reference on the stack.
54054 RST 16 Print to the screen using RST PRINT_A_1.
54055 POP AF Restore the air bar UDG reference from the stack.
54056 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 54058 LD A,33 A=UDG_NoAirBar (33).
54060 RST 16 Print to the screen using RST PRINT_A_1.
54061 RET Return.
UDG_AirBar 54062 DEFB 0,0,255,255,255,255,0,0
udg54062_42x4
UDG_NoAirBar 54070 DEFB 0,0,0,0,0,0,0,0
udg54070_42x4
Prev: 53856 Up: Map Next: 54078