![]() |
Routines |
| Prev: D259 | Up: Map | Next: D2F2 |
|
Used by the routine at GoldfishGame.
|
||||
| GoldfishGame_Handler_Bubbles | D260 | LD IX,$DD2A | IX=Data_Bubbles. | |
| D264 | LD B,$05 | B=05 (counter; maximum number of bubbles). | ||
| Handler_Bubbles_Loop | D266 | PUSH BC | Stash the bubble counter on the stack. | |
| D267 | LD A,(IX+$0A) | Jump to Handler_Bubbles_Generate if the bubble state (*IX+0A) is inactive (00). | ||
| D26A | CP $00 | |||
| D26C | JP Z,Handler_Bubbles_Generate | |||
|
A bubble exists, so we need to redraw it in a new position. Hence, we erase it first here.
|
||||
| D26F | LD A,$14 | Set INVERSE: ON | ||
| D271 | RST $10 | |||
| D272 | LD A,$01 | |||
| D274 | RST $10 | |||
|
Fetch the current co-ordinates.
|
||||
| D275 | LD C,(IX+$00) | C=Horizontal position (*IX+00). | ||
| D278 | LD B,(IX+$01) | B=Vertical position (*IX+01). | ||
|
Plot while using inverse will erase the bubble (it's only a single pixel).
|
||||
| D27B | CALL $22E5 | Call PLOT_SUB. | ||
|
Prepare for drawing the new bubble.
|
||||
| D27E | LD A,$14 | Set INVERSE: OFF | ||
| D280 | RST $10 | |||
| D281 | LD A,$00 | |||
| D283 | RST $10 | |||
|
Fetch the current co-ordinates.
|
||||
| D284 | LD C,(IX+$00) | C=Horizontal position (*IX+00). | ||
| D287 | LD B,(IX+$01) | B=Vertical position (*IX+01). | ||
|
Move the bubble to the new position.
The bubble always moves "up" three pixels and accelerates to the right exponentially.
|
||||
| D28A | INC C | Increment C by three. | ||
| D28B | INC C | |||
| D28C | INC C | |||
| D28D | LD A,(IX+$05) | A=horizontal velocity (*IX+05). | ||
| D290 | INC (IX+$05) | Increment the horizontal velocity (*IX+05) by one to simulate acceleration. | ||
| D293 | ADD A,B | B+=the velocity value. | ||
| D294 | LD B,A | |||
| D295 | CP $70 | Jump to Handler_Bubbles_Deactivate if A is higher than 70. | ||
| D297 | JR NC,Handler_Bubbles_Deactivate | |||
|
Update the data table with the new co-ordinates.
|
||||
| D299 | LD (IX+$00),C | Write C to horizontal position (*IX+00). | ||
| D29C | LD (IX+$01),B | Write B to vertical position (*IX+01). | ||
|
Draw the bubble to the screen buffer.
|
||||
| Handler_Bubbles_Plot | D29F | CALL $22E5 | Call PLOT_SUB. | |
|
Move onto the next bubble.
|
||||
| Handler_Bubbles_Next | D2A2 | POP BC | Restore the bubble counter from the stack. | |
| D2A3 | LD DE,$000B | IX+=000B. | ||
| D2A6 | ADD IX,DE | |||
| D2A8 | DJNZ Handler_Bubbles_Loop | Decrease the bubble counter by one and loop back to Handler_Bubbles_Loop until all bubbles have been evaluated. | ||
| D2AA | RET | Return. | ||
|
The bubble has finished its cycle so deactivate it.
|
||||
| Handler_Bubbles_Deactivate | D2AB | LD (IX+$0A),$00 | Write inactive (00) to bubble state (*IX+0A). | |
| D2AF | JR Handler_Bubbles_Next | Jump to Handler_Bubbles_Next. | ||
|
Decide if a new bubble should be created.
|
||||
| Handler_Bubbles_Generate | D2B1 | CALL UpdateAnimationCounter | Call UpdateAnimationCounter. | |
| D2B4 | CP $03 | Jump to Handler_Bubbles_Next if A is lower than 03. | ||
| D2B6 | JR C,Handler_Bubbles_Next | |||
|
No bubbles if the players oxygen has run out.
|
||||
| D2B8 | LD A,($D33E) | Jump to Handler_Bubbles_Next if *GoldfishGame_OxygenLevel is equal to 00. | ||
| D2BB | CP $00 | |||
| D2BD | JR Z,Handler_Bubbles_Next | |||
|
Generate a new bubble.
Fetch the player co-ordinates to determine the bubbles starting position.
|
||||
| D2BF | LD BC,($DC0E) | BC=*GoldfishGame_PlayerAttributes. | ||
| D2C3 | LD A,$21 | A=21. | ||
| D2C5 | SUB C | A-=C. | ||
| D2C6 | SLA A | Shift A left (with carry). | ||
| D2C8 | SLA A | Shift A left (with carry). | ||
| D2CA | SLA A | Shift A left (with carry). | ||
| D2CC | ADD A,$06 | A+=06. | ||
| D2CE | LD (IX+$00),A | Write A to horizontal position (*IX+00). | ||
| D2D1 | LD A,B | A=B. | ||
| D2D2 | DEC A | Decrease A by two. | ||
| D2D3 | DEC A | |||
| D2D4 | SLA A | Shift A left three positions (with carry). | ||
| D2D6 | SLA A | |||
| D2D8 | SLA A | |||
| D2DA | CP $70 | Jump to Handler_Bubbles_Next if A is higher than 70. | ||
| D2DC | JR NC,Handler_Bubbles_Next | |||
|
Active the bubble.
|
||||
| D2DE | LD (IX+$01),A | Write A to horizontal position (*IX+01). | ||
| D2E1 | LD (IX+$0A),$01 | Write "active" (01) to bubble state (*IX+0A). | ||
| D2E5 | LD (IX+$05),$01 | Write 01 to the horizontal velocity (*IX+05). | ||
|
Fetch the current co-ordinates, and jump to plot the new bubble on the screen.
|
||||
| D2E9 | LD C,(IX+$00) | C=Horizontal position (*IX+00). | ||
| D2EC | LD B,(IX+$01) | B=Vertical position (*IX+01). | ||
| D2EF | JP Handler_Bubbles_Plot | Jump to Handler_Bubbles_Plot. | ||
| Prev: D259 | Up: Map | Next: D2F2 |