![]() |
Routines |
| Prev: 41712 | Up: Map | Next: 41883 |
|
Used by the routine at RunGame.
Switches to the other player in a two-player game, by swapping the saved game state of the two players, and sets up the level for the new player.
|
||||
| SwitchPlayer | 41741 | LD A,(57085) | Fetch the number of lives of the second player from OtherPlayerState. | |
| 41744 | AND A | Test it. | ||
| 41745 | RET Z | Return if there is no second player. | ||
|
This entry point is used by the routine at RunGame.
|
||||
| SwitchPlayer_Flip | 41746 | LD A,(42004) | Fetch the low byte of the operand of the instruction at 42003. | |
| 41749 | XOR %11100000 | Flip bits 5-7. | ||
| 41751 | LD (42004),A | Store it. | ||
| 41754 | LD (54010),A | Store it in the operand byte at 54010. | ||
| 41757 | LD HL,57054 | Point HL at Lives. | ||
| 41760 | LD DE,57085 | Point DE at OtherPlayerState. | ||
| 41763 | LD B,31 | Set the number of bytes to 31. | ||
| 41765 | CALL SwapBytes | Swap the two game states. | ||
| 41768 | LD HL,57646 | Point HL at ScoreTextPlayerOne_Record. | ||
| 41771 | LD DE,57664 | Point DE at ScoreTextPlayerTwo_Record. | ||
| 41774 | LD B,9 | Set the number of bytes to 9. | ||
| 41776 | CALL SwapBytes | Swap them. | ||
| 41779 | LD HL,57765 | Point HL at LivesTextPlayerOne_Record. | ||
| 41782 | LD DE,57771 | Point DE at LivesTextPlayerTwo_Record. | ||
| 41785 | LD B,6 | Set the number of bytes to 6. | ||
| 41787 | CALL SwapBytes | Swap them. | ||
| 41790 | LD HL,57777 | Point HL at BottlesTextPlayerOne_Record. | ||
| 41793 | LD DE,57783 | Point DE at BottlesTextPlayerTwo_Record. | ||
| 41796 | LD B,6 | Set the number of bytes to 6. | ||
| 41798 | CALL SwapBytes | Swap them. | ||
| 41801 | LD DE,42397 | Point DE at Gauges. | ||
| 41804 | LD HL,42401 | Point HL at Gauges_Second. | ||
| 41807 | LD B,4 | Set the number of bytes to 4. | ||
| 41809 | CALL SwapBytes | Swap them. | ||
| 41812 | LD A,(24827) | Fetch the control method of the first player from Player1ControlMethod and keep it in B. | ||
| 41815 | LD B,A | |||
| 41816 | LD A,(24828) | Fetch the control method of the second player from Player2ControlMethod. | ||
| 41819 | LD (24827),A | Make it the control method of the first player. | ||
| 41822 | LD A,B | Fetch the old control method of the first player. | ||
| 41823 | LD (24828),A | Make it the control method of the second player. | ||
| 41826 | LD A,(57054) | Fetch the number of lives of the new player from Lives. | ||
| 41829 | AND A | Test it. | ||
| 41830 | RET Z | Return if the new player has no lives. | ||
| 41831 | XOR A | Set A to zero. | ||
| 41832 | LD (42397),A | Clear the first of the saved values at Gauges. | ||
| 41835 | LD (42401),A | Clear the second of the saved values at 42401. | ||
| 41838 | LD A,(57053) | Fetch the number of the current player from CurrentPlayer. | ||
| 41841 | XOR %00000001 | Flip bit 0. | ||
| 41843 | LD (57053),A | Store it. | ||
| 41846 | CALL ShowPlayerNumber | Call ShowPlayerNumber. | ||
| 41849 | CALL ResetAttributes | Call ResetAttributes. | ||
| 41852 | CALL ClearScreen | Call ClearScreen. | ||
| 41855 | CALL DrawPanel | Call DrawPanel. | ||
| 41858 | LD C,0 | C is 0 so that the player is not placed. | ||
| 41860 | CALL StartLevel_FindData | Call 34555 to find the data of the level. | ||
| 41863 | LD A,(57056) | Fetch the number of bottles left from BottlesLeft. | ||
| 41866 | PUSH AF | Save it. | ||
| 41867 | CALL SetLevelGraphics | Call SetLevelGraphics to set the graphics of the level. | ||
| 41870 | POP AF | Restore the number of bottles left. | ||
| 41871 | LD (57056),A | Store it. | ||
| 41874 | LD HL,30512 | Set the position of the panel attributes. | ||
| 41877 | LD DE,57628 | Point DE at PanelRectangle. | ||
| 41880 | JP FillRectangle | Jump to FillRectangle to fill the attributes. | ||
| Prev: 41712 | Up: Map | Next: 41883 |