Prev: 25478 Up: Map Next: 25562
25489: Initialise New Game
Used by the routine at StartGame.
Sets up a new game with three lives, no cups collected, and the miles and time reset. Continues into PlayerInit which sets up the first car.
Before After
new-game-before new-game-after
NewGame 25489 LD A,3 Write starting lives to Player_Lives (duplicate of 24566 - possibly so POKEs would appear to not work?)
25491 LD (24125),A
This entry point is used by the routine at HandlerCup.
NewGame_ResetCups 25494 XOR A Set the number of cups collected to 0.
25495 LD (24124),A
25498 CALL RandomiseCups Put the cups back at new positions using RandomiseCups.
Reset miles and time.
25501 LD HL,24109 Point HL at the miles (Miles).
25504 LD B,7 Set the byte counter to 7 to cover the miles and the time.
GameInit_Reset 25506 LD (HL),0 Clear a byte of the miles and time.
25508 INC HL Move on to the next byte.
25509 DJNZ GameInit_Reset Decrease the byte counter by one and loop back to GameInit_Reset until the miles and time have been cleared.
This entry point is used by the routine at GameOver.
Set up a new car.
PlayerInit 25511 CALL CreateWindow Create the game window using CreateWindow.
25514 CALL LocatePlayerMarker Call LocatePlayerMarker to find where the player's marker is on the map.
25517 CALL FlashPlayerMarker_SaveByte Call FlashPlayerMarker_SaveByte to save the screen byte at the position of the marker.
25520 CALL FindFirstObject Find the first object using FindFirstObject.
25523 CALL InitialiseEntities Set up the entities using InitialiseEntities.
25526 LD HL,49152 Write 49152 (the maximum value for fuel) to Fuel_LSB.
25529 LD (24074),HL
25532 LD H,0 Write 0000 to;
25534 LD (24076),HL
25537 LD (24078),HL
25540 LD (24080),HL
25543 LD HL,3136 Set the player's X position on the map (PlayerMapPosition) to 3136.
25546 LD (24069),HL
25549 LD HL,1600 Set the player's Y position on the map (PlayerMapPositionY) to 1600.
25552 LD (24072),HL
25555 XOR A Clear the last place visited (LastPlaceVisited).
25556 LD (24143),A
25559 JP FindFirstObject Jump to FindFirstObject to find the first object.
View the equivalent code in;
Prev: 25478 Up: Map Next: 25562