![]() |
Routines |
| Prev: 53849 | Up: Map | Next: 54002 |
|
Used by the routine at GoldfishGame.
|
||||
| GoldfishGame_Handler_Bubbles | 53856 | LD IX,56618 | Point IX at Data_Bubbles. | |
| 53860 | LD B,5 | B=5 (maximum number of bubbles). | ||
| Handler_Bubbles_Loop | 53862 | PUSH BC | Stash the bubble counter on the stack. | |
| 53863 | LD A,(IX+10) | Jump to Handler_Bubbles_Generate if this bubble is inactive. | ||
| 53866 | CP 0 | |||
| 53868 | JP Z,Handler_Bubbles_Generate | |||
|
Erase the bubble before plotting it in its new position.
|
||||
| 53871 | LD A,20 | Set INVERSE: ON | ||
| 53873 | RST 16 | |||
| 53874 | LD A,1 | |||
| 53876 | RST 16 | |||
|
Fetch the current pixel co-ordinates.
|
||||
| 53877 | LD C,(IX+0) | C=this bubble's horizontal pixel. | ||
| 53880 | LD B,(IX+1) | B=this bubble's vertical pixel. | ||
|
Inverse PLOT erases the single-pixel bubble.
|
||||
| 53883 | CALL 8933 | Call PLOT_SUB. | ||
|
Prepare to draw the moved bubble.
|
||||
| 53886 | LD A,20 | Set INVERSE: OFF | ||
| 53888 | RST 16 | |||
| 53889 | LD A,0 | |||
| 53891 | RST 16 | |||
| 53892 | LD C,(IX+0) | C=this bubble's horizontal pixel. | ||
| 53895 | LD B,(IX+1) | B=this bubble's vertical pixel. | ||
|
The bubble always rises and accelerates as it drifts.
|
||||
| 53898 | INC C | Move the bubble three pixels. | ||
| 53899 | INC C | |||
| 53900 | INC C | |||
| 53901 | LD A,(IX+5) | A=this bubble's drift velocity. | ||
| 53904 | INC (IX+5) | Increase the velocity so the bubble accelerates. | ||
| 53907 | ADD A,B | Add the velocity to the other axis. | ||
| 53908 | LD B,A | |||
| 53909 | CP 112 | Jump to Handler_Bubbles_Deactivate if the bubble has left the play area. | ||
| 53911 | JR NC,Handler_Bubbles_Deactivate | |||
|
Store the new pixel co-ordinates.
|
||||
| 53913 | LD (IX+0),C | Write the new horizontal pixel back to the bubble. | ||
| 53916 | LD (IX+1),B | Write the new vertical pixel back to the bubble. | ||
|
Draw the bubble.
|
||||
| Handler_Bubbles_Plot | 53919 | CALL 8933 | Call PLOT_SUB. | |
|
Move onto the next bubble.
|
||||
| Handler_Bubbles_Next | 53922 | POP BC | Restore the bubble counter from the stack. | |
| 53923 | LD DE,11 | Move IX on to the next eleven-byte bubble entry. | ||
| 53926 | ADD IX,DE | |||
| 53928 | DJNZ Handler_Bubbles_Loop | Decrease the bubble counter by one and loop back to Handler_Bubbles_Loop until every bubble has been processed. | ||
| 53930 | RET | Return. | ||
|
The bubble has finished its cycle, so deactivate it.
|
||||
| Handler_Bubbles_Deactivate | 53931 | LD (IX+10),0 | Mark this bubble inactive. | |
| 53935 | JR Handler_Bubbles_Next | Jump to Handler_Bubbles_Next. | ||
|
Maybe spawn a new bubble from the player.
|
||||
| Handler_Bubbles_Generate | 53937 | CALL UpdateAnimationCounter | Call UpdateAnimationCounter. | |
| 53940 | CP 3 | Jump to Handler_Bubbles_Next if the random roll is too low. | ||
| 53942 | JR C,Handler_Bubbles_Next | |||
|
No bubbles once the player is out of air.
|
||||
| 53944 | LD A,(54078) | Jump to Handler_Bubbles_Next if *GoldfishGame_OxygenLevel shows no air left. | ||
| 53947 | CP 0 | |||
| 53949 | JR Z,Handler_Bubbles_Next | |||
|
Start the bubble from *GoldfishGame_PlayerAttributes.
|
||||
| 53951 | LD BC,(56334) | BC=*GoldfishGame_PlayerAttributes. | ||
| 53955 | LD A,33 | A=33. | ||
| 53957 | SUB C | Invert the player column. | ||
| 53958 | SLA A | Convert it to a pixel column (*8). | ||
| 53960 | SLA A | |||
| 53962 | SLA A | |||
| 53964 | ADD A,6 | A+=6. | ||
| 53966 | LD (IX+0),A | Write the pixel column to the new bubble. | ||
| 53969 | LD A,B | A=the player row. | ||
| 53970 | DEC A | Move two rows up from the player. | ||
| 53971 | DEC A | |||
| 53972 | SLA A | Convert that row into a pixel position. | ||
| 53974 | SLA A | |||
| 53976 | SLA A | |||
| 53978 | CP 112 | Jump to Handler_Bubbles_Next if that pixel is off the top. | ||
| 53980 | JR NC,Handler_Bubbles_Next | |||
|
Activate the bubble.
|
||||
| 53982 | LD (IX+1),A | Write the pixel row to the new bubble. | ||
| 53985 | LD (IX+10),1 | Mark this bubble active. | ||
| 53989 | LD (IX+5),1 | Start the bubble with a small rightward velocity. | ||
|
Plot the newly spawned bubble.
|
||||
| 53993 | LD C,(IX+0) | C=the new bubble's horizontal pixel. | ||
| 53996 | LD B,(IX+1) | B=the new bubble's vertical pixel. | ||
| 53999 | JP Handler_Bubbles_Plot | Jump to Handler_Bubbles_Plot. | ||
| Prev: 53849 | Up: Map | Next: 54002 |