Prev: 56841 Up: Map Next: 57275
57000: Initialise Game
Used by the routines at StartGame and DemoMode.
Don't reset player lives or booty count if the game has already been completed and has looped around to start again.
InitialiseGame 57000 LD A,(23536) Jump to InitialiseGameStates if *GameState is set to "Game Looped Mode" (2).
57003 CP 2
57005 JP Z,InitialiseGameStates
Initialise new Game State attributes.
57008 LD A,3 Write 3 to *PlayerLives.
57010 LD (23537),A
57013 LD BC,0 Write 0000 to *PlayerBooty.
57016 LD (23540),BC
This entry point is used by the routine at AllTreasureCollected.
InitialiseGameStates 57020 XOR A Write 0 to *CurrentRoom.
57021 LD (23507),A
57024 LD BC,125 Write 0125 to *PlayerTreasure.
57027 LD (23538),BC
57031 JR InitialisePlayer Jump to InitialisePlayer.
This entry point is used by the routine at LoseLife.
SetFirstRoom 57033 LD A,1 Write 1 to *CurrentRoom.
57035 LD (23507),A
Initialise Player starting attributes.
InitialisePlayer 57038 LD DE,62001 Copy 0020 bytes of data from TableDefaultPlayerAttributes to TablePlayerAttributes.
57041 LD HL,62021
57044 LD BC,20
57047 LDIR
57049 LD A,0 Write 0 to:
57051 LD (62266),A
57054 LD (62271),A
57057 LD (58489),A
57060 LD A,0 Write 0 to *TableBombSparks.
57062 LD (62171),A
57065 LD A,0 Write 0 to:
57067 LD (62236),A
57070 LD (23672),A
57073 LD (23673),A
57076 LD (62272),A
This also draws the whole room.
57079 CALL PrintStatusBar Call PrintStatusBar.
Restore the default ZX Spectrum font.
57082 LD HL,15360 Write 15360 (CHARSET-256) to *CHARS.
57085 LD (23606),HL
57088 LD A,16 Set INK: YELLOW (6).
57090 RST 16
57091 LD A,6
57093 RST 16
57094 LD A,17 Set PAPER: *Active_BorderColour.
57096 RST 16
57097 LD A,(23504)
57100 RST 16
57101 CALL PrintStatusBarIcons Call PrintStatusBarIcons.
57104 CALL ResetSoundFlags Call ResetSoundFlags.
This is the beginning of the game loop.
Game_Loop 57107 LD A,17 Set PAPER: *ActiveRoom_PaperColour.
57109 RST 16
57110 LD A,(23505)
57113 RST 16
57114 CALL Handler_Animals Call Handler_Animals.
57117 CALL Handler_PortHole Call Handler_PortHole.
57120 CALL Handler_Bomb Call Handler_Bomb.
57123 CALL Handler_Explosion Call Handler_Explosion.
57126 CALL Handler_Pirates Call Handler_Pirates.
57129 CALL InGamePause Call InGamePause.
57132 CALL Handler_Lifts Call Handler_Lifts.
The player doesn't display during the demo mode, he can still "die" though - hence how often you hear the "lose a life" sound.
57135 LD A,(23536) Call Handler_Player if *GameState is not set to "Demo Mode" (3).
57138 CP 3
57140 CALL NZ,Handler_Player
57143 CALL Handler_Lifts2 Call Handler_Lifts2.
57146 LD A,(59424) Jump to InitialiseGame_0 if *59424 is equal to 0.
57149 CP 0
57151 JR Z,InitialiseGame_0
57153 DEC A Decrease A by one.
57154 LD (59424),A Write A to *59424.
InitialiseGame_0 57157 LD A,(23530) Call PlayerControls_Kempston if *ControlMethod is set to Kempston joystick (12).
57160 CP 12
57162 CALL Z,PlayerControls_Kempston
57165 LD A,(23530) Call PlayerControls if *ControlMethod is not set to Kempston joystick (12).
57168 CP 12
57170 CALL NZ,PlayerControls
57173 CALL Handler_Items Call Handler_Items.
57176 CALL Handler_DisappearingFloors Call Handler_DisappearingFloors.
Display the currently carried key.
Set attributes.
57179 LD A,16 Set INK: YELLOW (6).
57181 RST 16
57182 LD A,6
57184 RST 16
57185 LD A,17 Set PAPER: *Active_BorderColour.
57187 RST 16
57188 LD A,(23504)
57191 RST 16
57192 LD C,27 Set up the screen buffer location 27/1 using CL_SET.
57194 LD B,1
57196 CALL 3545
Restore the default ZX Spectrum font.
57199 LD HL,15360 Write 15360 (CHARSET-256) to *CHARS.
57202 LD (23606),HL
57205 LD IX,62001 IX=TablePlayerAttributes.
57209 LD A,(IX+16) A=*IX+16.
57212 ADD A,48 A+=48.
57214 CALL PrintColourCharacter Call PrintColourCharacter.
57217 LD BC,(23538) BC=*PlayerTreasure.
57221 LD A,C Call AllTreasureCollected if BC is zero.
57222 OR B
57223 CALL Z,AllTreasureCollected
57226 LD A,(23536) Jump to Game_Loop if *GameState is not set to "Demo Mode" (3).
57229 CP 3
57231 JP NZ,Game_Loop
Else, this is the demo mode - so check the timer.
57234 LD A,(23673) Loop back round to Game_Loop until *FRAMES+1 is equal to 3.
57237 CP 3
57239 JP NZ,Game_Loop
57242 LD A,(62272) Increment *TimerDemoMode by one.
57245 INC A
57246 LD (62272),A
57249 CP 2 Call 60815 if *TimerDemoMode is equal to 2.
57251 CALL Z,60815
57254 CALL GetRandomNumber Get a random room number between 2 and 17.
57257 AND %00001111
57259 ADD A,2
57261 CALL ChangeRoom Call ChangeRoom.
Reset the *FRAMES counter back to 0000.
57264 LD A,0 Write 0 to:
57266 LD (23672),A
57269 LD (23673),A
57272 JP Game_Loop Jump to Game_Loop.
Prev: 56841 Up: Map Next: 57275