![]() |
Routines |
Prev: 53849 | Up: Map | Next: 54002 |
Used by the routine at GoldfishGame.
|
||||
GoldfishGame_Handler_Bubbles | 53856 | LD IX,56618 | IX=Data_Bubbles. | |
53860 | LD B,5 | B=5 (counter; 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 the bubble state (*IX+10) is inactive (0). | ||
53866 | CP 0 | |||
53868 | JP Z,Handler_Bubbles_Generate | |||
A bubble exists, so we need to redraw it in a new position. Hence, we erase it first here.
|
||||
53871 | LD A,20 | Set INVERSE: ON | ||
53873 | RST 16 | |||
53874 | LD A,1 | |||
53876 | RST 16 | |||
Fetch the current co-ordinates.
|
||||
53877 | LD C,(IX+0) | C=Horizontal position (*IX+0). | ||
53880 | LD B,(IX+1) | B=Vertical position (*IX+1). | ||
Plot while using inverse will erase the bubble (it's only a single pixel).
|
||||
53883 | CALL 8933 | Call PLOT_SUB. | ||
Prepare for drawing the new bubble.
|
||||
53886 | LD A,20 | Set INVERSE: OFF | ||
53888 | RST 16 | |||
53889 | LD A,0 | |||
53891 | RST 16 | |||
Fetch the current co-ordinates.
|
||||
53892 | LD C,(IX+0) | C=Horizontal position (*IX+0). | ||
53895 | LD B,(IX+1) | B=Vertical position (*IX+1). | ||
Move the bubble to the new position.
The bubble always moves "up" three pixels and accelerates to the right exponentially.
|
||||
53898 | INC C | Increment C by three. | ||
53899 | INC C | |||
53900 | INC C | |||
53901 | LD A,(IX+5) | A=horizontal velocity (*IX+5). | ||
53904 | INC (IX+5) | Increment the horizontal velocity (*IX+5) by one to simulate acceleration. | ||
53907 | ADD A,B | B+=the velocity value. | ||
53908 | LD B,A | |||
53909 | CP 112 | Jump to Handler_Bubbles_Deactivate if A is higher than 112. | ||
53911 | JR NC,Handler_Bubbles_Deactivate | |||
Update the data table with the new co-ordinates.
|
||||
53913 | LD (IX+0),C | Write C to horizontal position (*IX+0). | ||
53916 | LD (IX+1),B | Write B to vertical position (*IX+1). | ||
Draw the bubble to the screen buffer.
|
||||
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 | IX+=0011. | ||
53926 | ADD IX,DE | |||
53928 | DJNZ Handler_Bubbles_Loop | Decrease the bubble counter by one and loop back to Handler_Bubbles_Loop until all bubbles have been evaluated. | ||
53930 | RET | Return. | ||
The bubble has finished its cycle so deactivate it.
|
||||
Handler_Bubbles_Deactivate | 53931 | LD (IX+10),0 | Write inactive (0) to bubble state (*IX+10). | |
53935 | JR Handler_Bubbles_Next | Jump to Handler_Bubbles_Next. | ||
Decide if a new bubble should be created.
|
||||
Handler_Bubbles_Generate | 53937 | CALL UpdateAnimationCounter | Call UpdateAnimationCounter. | |
53940 | CP 3 | Jump to Handler_Bubbles_Next if A is lower than 3. | ||
53942 | JR C,Handler_Bubbles_Next | |||
No bubbles if the players oxygen has run out.
|
||||
53944 | LD A,(54078) | Jump to Handler_Bubbles_Next if *GoldfishGame_OxygenLevel is equal to 0. | ||
53947 | CP 0 | |||
53949 | JR Z,Handler_Bubbles_Next | |||
Generate a new bubble.
Fetch the player co-ordinates to determine the bubbles starting position.
|
||||
53951 | LD BC,(56334) | BC=*GoldfishGame_PlayerAttributes. | ||
53955 | LD A,33 | A=33. | ||
53957 | SUB C | A-=C. | ||
53958 | SLA A | Shift A left (with carry). | ||
53960 | SLA A | Shift A left (with carry). | ||
53962 | SLA A | Shift A left (with carry). | ||
53964 | ADD A,6 | A+=6. | ||
53966 | LD (IX+0),A | Write A to horizontal position (*IX+0). | ||
53969 | LD A,B | A=B. | ||
53970 | DEC A | Decrease A by two. | ||
53971 | DEC A | |||
53972 | SLA A | Shift A left three positions (with carry). | ||
53974 | SLA A | |||
53976 | SLA A | |||
53978 | CP 112 | Jump to Handler_Bubbles_Next if A is higher than 112. | ||
53980 | JR NC,Handler_Bubbles_Next | |||
Active the bubble.
|
||||
53982 | LD (IX+1),A | Write A to horizontal position (*IX+1). | ||
53985 | LD (IX+10),1 | Write "active" (1) to bubble state (*IX+10). | ||
53989 | LD (IX+5),1 | Write 1 to the horizontal velocity (*IX+5). | ||
Fetch the current co-ordinates, and jump to plot the new bubble on the screen.
|
||||
53993 | LD C,(IX+0) | C=Horizontal position (*IX+0). | ||
53996 | LD B,(IX+1) | B=Vertical position (*IX+1). | ||
53999 | JP Handler_Bubbles_Plot | Jump to Handler_Bubbles_Plot. |
Prev: 53849 | Up: Map | Next: 54002 |