Prev: DF1C Up: Map Next: DFA3
DF1F: 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 DF1F LD HL,$BF00 Colour the area that is described by the rectangle at PanelFillRectangle, starting at the position BF00.
DF22 LD DE,$DF1C
DF25 CALL FillRectangle
Give the first player five lives.
DF28 LD A,$05 Set the number of lives to 05.
DF2A LD ($DEDE),A
Clear the score of the first player and the digits of the scores of both players.
DF2D LD HL,$DEF9 Clear the three bytes of the score of the first player.
DF30 LD B,$03
DF32 CALL ClearBytes
DF35 LD HL,$E132 Clear the five digits of the score of the first player in the panel text.
DF38 LD B,$05
DF3A CALL ClearBytes
DF3D LD HL,$E144 Clear the five digits of the score of the second player in the panel text.
DF40 LD B,$05
DF42 CALL ClearBytes
Set up the two gauges.
DF45 LD DE,$A59D Copy the starting values of the gauges, which empty the bars and set the targets to full.
DF48 LD HL,$DFA3
DF4B LD BC,$0008
DF4E LDIR
Mark all of the bottles of the level as not yet collected.
DF50 LD HL,$DEE1 Point HL at BottleStates.
DF53 LD A,$81 Set the state of an uncollected bottle.
DF55 LD B,$14 Set the number of bottles to 14.
StartGame_Loop DF57 LD (HL),A Set the state of a bottle.
DF58 INC HL Move on to the next bottle.
DF59 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.
DF5B XOR A Clear the restart position.
DF5C LD ($DEF7),A
DF5F LD ($DEDD),A Make the first player the current player.
DF62 LD ($DEFC),A Clear the bottle flag of the player.
DF65 LD A,$00 Set the number of the level to zero.
DF67 LD ($DEDF),A
Copy the details of the first player to the second player.
DF6A LD HL,$DEDE Copy the details of the first player, which are 1F bytes, to those of the second player.
DF6D LD DE,$DEFD
DF70 LD BC,$001F
DF73 LDIR
Take the lives and the bottles away from the second player if there is only one player.
DF75 LD A,($60FD) Fetch the number of players.
DF78 AND A Test it.
DF79 JR NZ,StartGame_Life Jump to StartGame_Life if there are two players.
DF7B LD ($DEFD),A Clear the lives of the second player.
DF7E LD ($DEFF),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 DF81 XOR A Clear the heading of the player.
DF82 LD ($B551),A
DF85 LD ($CE59),A Clear the state of the message.
DF88 LD ($5D00),A Clear the counter of the player.
DF8B LD A,$28 Start the countdown timer at 28.
DF8D LD ($A2DF),A
DF90 LD A,$04 Set the byte that is patched into the controls at AB7D to 04.
DF92 LD ($AB7D),A
Fill the first gauge, and draw the direction gauge with the needle at its start.
DF95 LD HL,$6000 Set the first gauge to full.
DF98 LD ($A59F),HL
DF9B LD A,$08 Set the heading of the needle to 08.
DF9D LD ($5CD8),A
DFA0 JP DrawDirectionGauge Draw the direction gauge.
Prev: DF1C Up: Map Next: DFA3