![]() |
Routines |
| Prev: 25568 | Up: Map | Next: 25622 |
|
Used by the routine at StartGame.
Sets up the data for both players at the start of a game. Both players start with level 0 and four lives. The data for the player who is not active is then changed; the level is set to 255 so that when it is the turn of that player NextLevel (which adds one to the level) starts them on level 0 and the lives are made 5 for a two player game or 0 for a one player game.
|
||||
|
Set the level and the lives for both players.
|
||||
| NewGame | 25584 | LD B,2 | Set the player counter to 2 (one for each player). | |
| NewGame_Loop | 25586 | PUSH BC | Stash the player counter on the stack. | |
| 25587 | XOR A | Write 0 to ActivePlayer_Level. | ||
| 25588 | LD (24365),A | |||
|
Set both players starting lives.
|
||||
| 25591 | LD A,4 | Write 4 to ActivePlayer_Lives. | ||
| 25593 | LD (24366),A | |||
| 25596 | CALL ChangePlayer | Call ChangePlayer to swap the player data between 1UP and 2UP players. | ||
| 25599 | POP BC | Restore the player counter from the stack. | ||
| 25600 | DJNZ NewGame_Loop | Decrease the player counter by one and loop back to NewGame_Loop until both players have been set up. | ||
|
Note this is +1 to 25591 as you "spend a life", and 1UP goes first.
|
||||
| 25602 | LD A,5 | Write 5 to InactivePlayer_Lives. | ||
| 25604 | LD (24370),A | |||
|
The level for the other player starts at 255.
|
||||
| 25607 | LD A,255 | Write 255 to InactivePlayer_Level. | ||
| 25609 | LD (24369),A | |||
|
Handle a one player game; the other player has no lives.
|
||||
| 25612 | LD A,(24332) | Fetch the game options. | ||
| 25615 | AND %00000001 | Keep only bit 0 (set for a two player game). | ||
| 25617 | RET NZ | Return if this is a two player game. | ||
| 25618 | LD (24370),A | Write 0 to the lives of the inactive player (InactivePlayer_Lives). | ||
| 25621 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 25568 | Up: Map | Next: 25622 |