int PlayerEquip(void *bkg) { int cmd1, cmd2, prev1 = 0, prev2 = 0; int done1 = 0, done2; debug(D_NORMAL, "\n"); done2 = gOptions.twoPlayers ? 0 : 1; while (!done1 || !done2) { memcpy(GetDstScreen(), bkg, SCREEN_MEMSIZE); GetPlayerCmd(&cmd1, &cmd2); if (KeyDown(keyEsc)) return 0; // hack to exit from menu if (gOptions.twoPlayers) { if (cmd1 == prev1) cmd1 = 0; else prev1 = cmd1; // if (!done1) // || !gPlayer1Data.weaponCount < MAX_WEAPONS) done1 = !WeaponSelection(CenterOfLeft(50), CHARACTER_PLAYER1, &gPlayer1Data, cmd1, done1); ShowSelection(CenterOfLeft(50), &gPlayer1Data,CHARACTER_PLAYER1); ShowPlayerControls(CenterOfLeft(100), &gPlayer1Data); if (cmd2 == prev2) cmd2 = 0; else prev2 = cmd2; // if (!done2) // || gPlayer2Data.weaponCount < MAX_WEAPONS) done2 = !WeaponSelection(CenterOfRight(50), CHARACTER_PLAYER2, &gPlayer2Data, cmd2, done2); ShowSelection(CenterOfRight(50), &gPlayer2Data, CHARACTER_PLAYER2); ShowPlayerControls(CenterOfRight(100), &gPlayer2Data); } else { if (cmd1 == prev1) cmd1 = 0; else prev1 = cmd1; if (!done1) // || gPlayer1Data.weaponCount <= 0) done1 = !WeaponSelection(CenterX(80), CHARACTER_PLAYER1, &gPlayer1Data, cmd1, done1); ShowSelection(CenterX(80), &gPlayer1Data, CHARACTER_PLAYER1); ShowPlayerControls(CenterX(100), &gPlayer1Data); } CopyToScreen(); } WaitForRelease(); return 1; }
int PlayerEquip(void *bkg) { int done1 = 0, done2; debug(D_NORMAL, "\n"); done2 = gOptions.twoPlayers ? 0 : 1; while (!done1 || !done2) { int cmd1 = 0; int cmd2 = 0; InputPoll(&gJoysticks, &gKeyboard); memcpy(GetDstScreen(), bkg, GraphicsGetMemSize(&gGraphicsDevice.cachedConfig)); GetPlayerCmd(&cmd1, &cmd2, 1); if (KeyIsPressed(&gKeyboard, keyEsc)) return 0; // hack to exit from menu if (gOptions.twoPlayers) { done1 = !WeaponSelection(CenterOfLeft(50), CHARACTER_PLAYER1, &gPlayer1Data, cmd1, done1); ShowSelection(CenterOfLeft(50), &gPlayer1Data,CHARACTER_PLAYER1); ShowPlayerControls(CenterOfLeft(100), &gConfig.Input.PlayerKeys[0]); done2 = !WeaponSelection(CenterOfRight(50), CHARACTER_PLAYER2, &gPlayer2Data, cmd2, done2); ShowSelection(CenterOfRight(50), &gPlayer2Data, CHARACTER_PLAYER2); ShowPlayerControls(CenterOfRight(100), &gConfig.Input.PlayerKeys[1]); } else { done1 = !WeaponSelection(CenterX(80), CHARACTER_PLAYER1, &gPlayer1Data, cmd1, done1); ShowSelection(CenterX(80), &gPlayer1Data, CHARACTER_PLAYER1); ShowPlayerControls(CenterX(100), &gConfig.Input.PlayerKeys[0]); } CopyToScreen(); SDL_Delay(10); } return 1; }