Prev: 62E7 Up: Map Next: 631E
62F7: Reset Player Data
Used by the routine at StartGame.
Gives both players their starting level and lives, and resets their cubby holes, flower and leaves. The data is set up for one player and then swapped using ChangePlayer, and then the same is done for the other.
ResetPlayerData 62F7 LD B,$02 Set the player counter to 02 (a game has at most two players).
ResetPlayerData_Loop 62F9 PUSH BC Stash the player counter on the stack.
62FA XOR A Reset ActivePlayer_Level to 00 (level 1).
62FB LD ($5E37),A
62FE LD A,$04 Set CurrentPlayer_Lives to 04.
6300 LD ($5E38),A
6303 CALL ResetCubbyHoles Reset the cubby holes using ResetCubbyHoles.
6306 CALL ResetFlowerLeaf Reset the flower and leaves using ResetFlowerLeaf.
6309 CALL ChangePlayer Swap the players using ChangePlayer.
630C POP BC Restore the player counter from the stack.
630D DJNZ ResetPlayerData_Loop Decrease the player counter by one and loop back to ResetPlayerData_Loop until both players have been set up.
2UP has one "extra" life, due to the way the game "spends" a life when your turn starts.
630F LD A,$05 Write 05 to InactivePlayer_Lives.
6311 LD ($5E3A),A
6314 LD A,($5E03) A=the game options from GameOptions.
6317 AND %00000001 Keep only bit 0 (1 or 2 players).
6319 RET NZ Return if this is a two player game.
631A LD ($5E3A),A Else, write 00 to InactivePlayer_Lives (2UP has no lives).
631D RET Return.
Prev: 62E7 Up: Map Next: 631E