Prev: F3B7 Up: Map Next: F419
F3BD: Set up a new game
Used by the routine at game.
Called by game after the menu. Clears bits 6 and 7 of the 290 bytes from map_object_kinds (mask_world_objects with E = $3F): each player's mark on the level's objects, bit 7 for player 1 and bit 6 for player 2 (see play). Clears both player records (clear_player_record) and gives each five lives; if the score lines were left the other way round by the last game (the byte at p1_lives_text is $A0) they are put back with swap_players, player_in_play being set to $99 meanwhile so that it does not also change the current player. Player 1 is current; with one player, player 2 has no lives. Each player's control method is copied from the menu, the two scores on the panel are set to six noughts ($1A is the font's 0), and each player's table of the level's objects is filled in by deal_places.
new_game F3BD LD E,$3F Clear both players' marks on the level's objects
F3BF CALL mask_world_objects
F3C2 LD HL,score Clear both records
F3C5 CALL clear_player_record
F3C8 LD HL,other_player_record
F3CB CALL clear_player_record
F3CE LD A,$05 Five lives each
F3D0 LD (lives),A
F3D3 LD ($F656),A
F3D6 LD A,$99 Put the score lines back in order if they were swapped
F3D8 LD (player_in_play),A
F3DB LD A,(p1_lives_text)
F3DE CP $A0
F3E0 CALL Z,swap_players
F3E3 XOR A Player 1 is current
F3E4 LD (player_in_play),A
F3E7 LD A,(player_count) One player: player 2 has no lives
F3EA AND A
F3EB JR NZ,new_game_0
F3ED LD ($F656),A
new_game_0 F3F0 LD A,($870A) Each player's control method, as chosen on the menu
F3F3 LD (control_method),A
F3F6 LD A,($870D)
F3F9 LD ($F66C),A
F3FC LD B,$06 Both scores to 000000
F3FE LD DE,p1_score_digits
F401 LD HL,p2_score_digits
F404 LD A,$1A
new_game_1 F406 LD (DE),A
F407 LD (HL),A
F408 INC HL
F409 INC DE
F40A DJNZ new_game_1
F40C LD DE,player_places Each player's table of the level's objects
F40F CALL deal_places
F412 LD DE,$F66D
F415 CALL deal_places
F418 RET Done
Prev: F3B7 Up: Map Next: F419