void ScoreTableView (int bNetwork) { int i, k, done,choice; fix entryTime = TimerGetApproxSeconds (); int key; int oldstates [MAX_PLAYERS]; int previousSeconds_left=-1; int nReady,nEscaped; int bRedraw = 0; bkg bg; gameStates.menus.nInMenu++; gameStates.app.bGameRunning = 0; memset (&bg, 0, sizeof (bg)); bNetwork = gameData.app.nGameMode & GM_NETWORK; for (i = 0; i < MAX_NUM_NET_PLAYERS; i++) DigiKillSoundLinkedToObject (gameData.multiplayer.players [i].nObject); SetScreenMode (SCREEN_MENU); gameData.score.bWaitingForOthers = 0; //@@GrPaletteFadeIn (grPalette,32, 0); GameFlushInputs (); done = 0; for (i = 0; i < gameData.multiplayer.nPlayers; i++) oldstates [i] = gameData.multiplayer.players [i].connected; if (bNetwork) NetworkEndLevel (&key); while (!done) { if (!bRedraw || (curDrawBuffer == GL_BACK)) { LoadStars (&bg, bRedraw); ScoreTableRedraw (); bRedraw = 1; } gameData.score.nKillsChanged = 0; for (i = 0; i < 4; i++) if (JoyGetButtonDownCnt (i)) { if (LAST_OEM_LEVEL) { ScoreTableQuit (&bg, 1, bNetwork); return; } LOCALPLAYER.connected = 7; if (bNetwork) NetworkSendEndLevelPacket (); break; } for (i = 0; i < 3; i++) if (MouseButtonDownCount (i)) { if (LAST_OEM_LEVEL) { ScoreTableQuit (&bg, 1, bNetwork); return; } LOCALPLAYER.connected=7; if (bNetwork) NetworkSendEndLevelPacket (); break; } //see if redbook song needs to be restarted SongsCheckRedbookRepeat (); k = KeyInKey (); switch (k) { case KEY_ENTER: case KEY_SPACEBAR: if ((gameData.app.nGameMode & GM_SERIAL) || (gameData.app.nGameMode & GM_MODEM)) { done=1; break; } if (LAST_OEM_LEVEL) { ScoreTableQuit (&bg, 1, bNetwork); return; } gameData.multiplayer.players [gameData.multiplayer.nLocalPlayer].connected = 7; if (bNetwork) NetworkSendEndLevelPacket (); break; case KEY_ESC: if (gameData.app.nGameMode & GM_NETWORK) { gameData.multiplayer.xStartAbortMenuTime = TimerGetApproxSeconds (); choice=ExecMessageBox1 (NULL, NetworkEndLevelPoll3, NULL, 2, TXT_YES, TXT_NO, TXT_ABORT_GAME); } else choice=ExecMessageBox (NULL, NULL, 2, TXT_YES, TXT_NO, TXT_ABORT_GAME); if (choice == 0) { ScoreTableQuit (&bg, 1, bNetwork); return; } gameData.score.nKillsChanged=1; break; case KEY_PRINT_SCREEN: SaveScreenShot (NULL, 0); break; case KEY_BACKSP: Int3 (); break; default: break; } if ((TimerGetApproxSeconds () >= entryTime + MAX_VIEW_TIME) && (LOCALPLAYER.connected != 7)) { if (LAST_OEM_LEVEL) { ScoreTableQuit (&bg, 1, bNetwork); return; } if ((gameData.app.nGameMode & GM_SERIAL) || (gameData.app.nGameMode & GM_MODEM)) { done=1; break; } LOCALPLAYER.connected = 7; if (bNetwork) NetworkSendEndLevelPacket (); } if (bNetwork && (gameData.app.nGameMode & GM_NETWORK)) { NetworkEndLevelPoll2 (0, NULL, &key, 0); for (nEscaped = 0, nReady = 0, i = 0; i < gameData.multiplayer.nPlayers; i++) { if (gameData.multiplayer.players [i].connected && i!=gameData.multiplayer.nLocalPlayer) { // Check timeout for idle players if (TimerGetApproxSeconds () > networkData.nLastPacketTime [i]+ENDLEVEL_IDLE_TIME) { #if TRACE con_printf (CONDBG, "idle timeout for tPlayer %d.\n", i); #endif gameData.multiplayer.players [i].connected = 0; NetworkSendEndLevelSub (i); } } if (gameData.multiplayer.players [i].connected!=oldstates [i]) { if (szConditionLetters [gameData.multiplayer.players [i].connected] != szConditionLetters [oldstates [i]]) gameData.score.nKillsChanged = 1; oldstates [i] = gameData.multiplayer.players [i].connected; NetworkSendEndLevelPacket (); } if (gameData.multiplayer.players [i].connected==0 || gameData.multiplayer.players [i].connected==7) nReady++; if (gameData.multiplayer.players [i].connected!=1) nEscaped++; } if (nReady >= gameData.multiplayer.nPlayers) done = 1; if (nEscaped >= gameData.multiplayer.nPlayers) gameData.reactor.countdown.nSecsLeft = -1; if (previousSeconds_left != gameData.reactor.countdown.nSecsLeft) { previousSeconds_left = gameData.reactor.countdown.nSecsLeft; gameData.score.nKillsChanged=1; } if (gameData.score.nKillsChanged) { ScoreTableRedraw (); gameData.score.nKillsChanged = 0; } } } LOCALPLAYER.connected = 7; // Restore background and exit GrPaletteFadeOut (NULL, 32, 0); GameFlushInputs (); ScoreTableQuit (&bg, 0, bNetwork); }
void ScoreTableView (int bNetwork) { int i, k, done, choice, nInMenu; uint entryTime = SDL_GetTicks (); int key; int oldstates [MAX_PLAYERS]; int previousSeconds_left = -1; int nReady,nEscaped; int bRedraw = 0; gameStates.menus.nInMenu++; gameStates.app.bGameRunning = 0; bNetwork = gameData.app.nGameMode & GM_NETWORK; for (i = 0; i < MAX_NUM_NET_PLAYERS; i++) audio.DestroyObjectSound (gameData.multiplayer.players [i].nObject); SetScreenMode (SCREEN_MENU); gameData.score.bWaitingForOthers = 0; //@@GrPaletteFadeIn (grPalette,32, 0); GameFlushInputs (); done = 0; for (i = 0; i < gameData.multiplayer.nPlayers; i++) oldstates [i] = gameData.multiplayer.players [i].connected; if (bNetwork) NetworkEndLevel (&key); backgroundManager.LoadStars (true); while (!done) { if (!bRedraw || (ogl.m_states.nDrawBuffer == GL_BACK)) { backgroundManager.Redraw (); ScoreTableRedraw (); bRedraw = 1; } gameData.score.nKillsChanged = 0; for (i = 0; i < 4; i++) if (JoyGetButtonDownCnt (i)) { if (LAST_OEM_LEVEL) { ScoreTableQuit (1, bNetwork); return; } LOCALPLAYER.connected = 7; if (bNetwork) NetworkSendEndLevelPacket (); break; } for (i = 0; i < 3; i++) if (MouseButtonDownCount (i)) { if (LAST_OEM_LEVEL) { ScoreTableQuit (1, bNetwork); return; } LOCALPLAYER.connected=7; if (bNetwork) NetworkSendEndLevelPacket (); break; } //see if redbook song needs to be restarted redbook.CheckRepeat (); k = KeyInKey (); switch (k) { case KEY_ENTER: case KEY_SPACEBAR: if ((gameData.app.nGameMode & GM_SERIAL) || (gameData.app.nGameMode & GM_MODEM)) { done=1; break; } if (LAST_OEM_LEVEL) { ScoreTableQuit (1, bNetwork); return; } gameData.multiplayer.players [gameData.multiplayer.nLocalPlayer].connected = 7; if (bNetwork) NetworkSendEndLevelPacket (); break; case KEY_ESC: if (gameData.app.nGameMode & GM_NETWORK) { gameData.multiplayer.xStartAbortMenuTime = TimerGetApproxSeconds (); nInMenu = gameStates.menus.nInMenu; gameStates.menus.nInMenu = 0; choice = MsgBox (NULL, NetworkEndLevelPoll3, NULL, 2, TXT_YES, TXT_NO, TXT_ABORT_GAME); gameStates.menus.nInMenu = nInMenu; } else nInMenu = gameStates.menus.nInMenu; gameStates.menus.nInMenu = 0; choice = MsgBox (NULL, NULL, 2, TXT_YES, TXT_NO, TXT_ABORT_GAME); gameStates.menus.nInMenu = nInMenu; if (choice == 0) { ScoreTableQuit (1, bNetwork); return; } gameData.score.nKillsChanged = 1; break; case KEY_PRINT_SCREEN: SaveScreenShot (NULL, 0); break; case KEY_BACKSPACE: Int3 (); break; default: break; } if ((SDL_GetTicks () >= entryTime + MAX_VIEW_TIME) && (LOCALPLAYER.connected != 7)) { if (LAST_OEM_LEVEL) { ScoreTableQuit (1, bNetwork); return; } if ((gameData.app.nGameMode & GM_SERIAL) || (gameData.app.nGameMode & GM_MODEM)) { done = 1; break; } LOCALPLAYER.connected = 7; if (bNetwork) NetworkSendEndLevelPacket (); } if (bNetwork && (gameData.app.nGameMode & GM_NETWORK)) { CMenu m (1); m.AddGauge ("", -1, 1000); //dummy for NetworkEndLevelPoll2() NetworkEndLevelPoll2 (m, key, 0, 0); for (nEscaped = 0, nReady = 0, i = 0; i < gameData.multiplayer.nPlayers; i++) { if (gameData.multiplayer.players [i].connected && (i != gameData.multiplayer.nLocalPlayer)) { // Check timeout for idle players if (SDL_GetTicks () > (uint) networkData.nLastPacketTime [i] + ENDLEVEL_IDLE_TIME) { #if TRACE console.printf (CON_DBG, "idle timeout for CPlayerData %d.\n", i); #endif gameData.multiplayer.players [i].connected = 0; NetworkSendEndLevelSub (i); } } if (gameData.multiplayer.players [i].connected != oldstates [i]) { if (szConditionLetters [gameData.multiplayer.players [i].connected] != szConditionLetters [oldstates [i]]) gameData.score.nKillsChanged = 1; oldstates [i] = gameData.multiplayer.players [i].connected; NetworkSendEndLevelPacket (); } if ((gameData.multiplayer.players [i].connected == 0) || (gameData.multiplayer.players [i].connected == 7)) nReady++; if (gameData.multiplayer.players [i].connected != 1) nEscaped++; } if (nReady >= gameData.multiplayer.nPlayers) done = 1; if (nEscaped >= gameData.multiplayer.nPlayers) gameData.reactor.countdown.nSecsLeft = -1; if (previousSeconds_left != gameData.reactor.countdown.nSecsLeft) { previousSeconds_left = gameData.reactor.countdown.nSecsLeft; gameData.score.nKillsChanged=1; } if (gameData.score.nKillsChanged) { ScoreTableRedraw (); gameData.score.nKillsChanged = 0; } } } LOCALPLAYER.connected = 7; // Restore background and exit paletteManager.DisableEffect (); GameFlushInputs (); ScoreTableQuit (0, bNetwork); }
/* Send an updated endlevel status to other hosts */ void NetworkSendEndLevelPacket (void) { NetworkSendEndLevelSub (gameData.multiplayer.nLocalPlayer); }