Prev: AF7F Up: Map Next: AFB7
AF88: Initialise Game
Used by the routine at StartGame.
Sets up everything needed to start a new game: builds the lookup tables, gives the player five lives, lets the player choose the control method on the menu, plays the start tune and then picks the random start location of the player and of the special objects.
Build the tables and set the starting state.
InitialiseGame AF88 CALL BuildLookupTables Call BuildLookupTables.
AF8B XOR A Write 00 to NotFirstRoomFlag.
AF8C LD ($5BB2),A
AF8F LD ($D16D),A Write 00 to the counter and flags byte of the player copy at D16D.
AF92 LD A,$05 Set Lives to 05.
AF94 LD ($5BBA),A
AF97 LD HL,$5BA0 Point HL at RandomSeed1.
AF9A LD A,($5BA2) Fetch the low byte of FrameCounter.
AF9D ADD A,(HL) Add it to RandomSeed1.
AF9E LD (HL),A
Show the menu and wait for the player to start.
AF9F CALL ClearScreen Call ClearScreen.
AFA2 CALL GameMenu Call GameMenu.
AFA5 LD DE,$B20E Point DE at StartGameTune.
AFA8 CALL PlayMusic Call PlayMusic.
Place the player and set up the rooms.
AFAB CALL ShuffleRequiredObjects Call ShuffleRequiredObjects.
AFAE CALL InitialisePlayer Call InitialisePlayer.
AFB1 CALL InitialiseSun Call InitialiseSun.
AFB4 CALL InitialiseSpecialObjects Call InitialiseSpecialObjects.
Continue on to StartLife.
Prev: AF7F Up: Map Next: AFB7