Prev: 57116 Up: Map Next: 57251
57119: Start Game
Used by the routine at RunGame.
Sets up everything for a new game: the lives, the scores, the gauges, the bottles and the details of the second player if there is one. The entry point at StartGame_Life is also used to start each life, and resets the player state.
Colour the area at the bottom of the screen.
StartGame 57119 LD HL,48896 Colour the area that is described by the rectangle at PanelFillRectangle, starting at the position 48896.
57122 LD DE,57116
57125 CALL FillRectangle
Give the first player five lives.
57128 LD A,5 Set the number of lives to 5.
57130 LD (57054),A
Clear the score of the first player and the digits of the scores of both players.
57133 LD HL,57081 Clear the three bytes of the score of the first player.
57136 LD B,3
57138 CALL ClearBytes
57141 LD HL,57650 Clear the five digits of the score of the first player in the panel text.
57144 LD B,5
57146 CALL ClearBytes
57149 LD HL,57668 Clear the five digits of the score of the second player in the panel text.
57152 LD B,5
57154 CALL ClearBytes
Set up the two gauges.
57157 LD DE,42397 Copy the starting values of the gauges, which empty the bars and set the targets to full.
57160 LD HL,57251
57163 LD BC,8
57166 LDIR
Mark all of the bottles of the level as not yet collected.
57168 LD HL,57057 Point HL at BottleStates.
57171 LD A,129 Set the state of an uncollected bottle.
57173 LD B,20 Set the number of bottles to 20.
StartGame_Loop 57175 LD (HL),A Set the state of a bottle.
57176 INC HL Move on to the next bottle.
57177 DJNZ StartGame_Loop Loop back to StartGame_Loop until all of the bottles have been done.
Clear the restart position, the current player and the bottle flag, and go to the first level.
57179 XOR A Clear the restart position.
57180 LD (57079),A
57183 LD (57053),A Make the first player the current player.
57186 LD (57084),A Clear the bottle flag of the player.
57189 LD A,0 Set the number of the level to zero.
57191 LD (57055),A
Copy the details of the first player to the second player.
57194 LD HL,57054 Copy the details of the first player, which are 31 bytes, to those of the second player.
57197 LD DE,57085
57200 LD BC,31
57203 LDIR
Take the lives and the bottles away from the second player if there is only one player.
57205 LD A,(24829) Fetch the number of players.
57208 AND A Test it.
57209 JR NZ,StartGame_Life Jump to StartGame_Life if there are two players.
57211 LD (57085),A Clear the lives of the second player.
57214 LD (57087),A Clear the bottles of the second player.
This entry point is used by the routine at RunGame.
Start a life. Reset the heading of the player, the message, the counter of the player and the countdown timer.
StartGame_Life 57217 XOR A Clear the heading of the player.
57218 LD (46417),A
57221 LD (52825),A Clear the state of the message.
57224 LD (23808),A Clear the counter of the player.
57227 LD A,40 Start the countdown timer at 40.
57229 LD (41695),A
57232 LD A,4 Set the byte that is patched into the controls at 43901 to 4.
57234 LD (43901),A
Fill the first gauge, and draw the direction gauge with the needle at its start.
57237 LD HL,24576 Set the first gauge to full.
57240 LD (42399),HL
57243 LD A,8 Set the heading of the needle to 8.
57245 LD (23768),A
57248 JP DrawDirectionGauge Draw the direction gauge.
Prev: 57116 Up: Map Next: 57251