// fill buffers with the static screen void initLoadingScreen( bool drawbdrop ) { setupLoadingScreen(); wzShowMouse(false); pie_SetFogStatus(false); // setup the callback.... resSetLoadCallback(loadingScreenCallback); if (drawbdrop) { if (!screen_GetBackDrop()) { pie_LoadBackDrop(SCREEN_RANDOMBDROP); } screen_RestartBackDrop(); } else { screen_StopBackDrop(); } // Start with two cleared buffers as the hacky loading screen code re-uses old buffers to create its effect. pie_ScreenFlip(CLEAR_BLACK); pie_ScreenFlip(CLEAR_BLACK); }
void loop_ClearVideoPlaybackMode(void) { videoMode -=1; paused = false; video = false; gameTimeStart(); pie_SetFogStatus(true); cdAudio_Resume(); wzShowMouse(true); ASSERT( videoMode == 0, "loop_ClearVideoPlaybackMode: out of sync." ); }
void loop_SetVideoPlaybackMode(void) { videoMode += 1; paused = true; video = true; gameTimeStop(); pie_SetFogStatus(false); audio_StopAll(); wzShowMouse(false); screen_StopBackDrop(); pie_ScreenFlip(CLEAR_BLACK); }
static GAMECODE renderLoop() { if (bMultiPlayer && !NetPlay.isHostAlive && NetPlay.bComms && !NetPlay.isHost) { intAddInGamePopup(); } int clearMode = 0; if(getDrawShadows()) { clearMode |= CLEAR_SHADOW; } if (loopMissionState == LMS_SAVECONTINUE) { pie_SetFogStatus(false); clearMode = CLEAR_BLACK; } pie_ScreenFlip(clearMode);//gameloopflip HandleClosingWindows(); // Needs to be done outside the pause case. audio_Update(); wzShowMouse(true); INT_RETVAL intRetVal = INT_NONE; if (!paused) { /* Run the in game interface and see if it grabbed any mouse clicks */ if (!rotActive && getWidgetsStatus() && dragBox3D.status != DRAG_DRAGGING && wallDrag.status != DRAG_DRAGGING) { intRetVal = intRunWidgets(); } //don't process the object lists if paused or about to quit to the front end if (!gameUpdatePaused() && intRetVal != INT_QUIT) { if( dragBox3D.status != DRAG_DRAGGING && wallDrag.status != DRAG_DRAGGING && ( intRetVal == INT_INTERCEPT || ( radarOnScreen && CoordInRadar(mouseX(), mouseY()) && getHQExists(selectedPlayer) ) ) ) { // Using software cursors (when on) for these menus due to a bug in SDL's SDL_ShowCursor() wzSetCursor(CURSOR_DEFAULT); intRetVal = INT_INTERCEPT; } #ifdef DEBUG // check all flag positions for duplicate delivery points checkFactoryFlags(); #endif //handles callbacks for positioning of DP's process3DBuilding(); //ajl. get the incoming netgame messages and process them. // FIXME Previous comment is deprecated. multiPlayerLoop does some other weird stuff, but not that anymore. if (bMultiPlayer) { multiPlayerLoop(); } for (unsigned i = 0; i < MAX_PLAYERS; i++) { for (DROID *psCurr = apsDroidLists[i]; psCurr; psCurr = psCurr->psNext) { // Don't copy the next pointer - if droids somehow get destroyed in the graphics rendering loop, who cares if we crash. calcDroidIllumination(psCurr); } } /* update animations */ animObj_Update(); } if (!consolePaused()) { /* Process all the console messages */ updateConsoleMessages(); } if (!scrollPaused() && !getWarCamStatus() && dragBox3D.status != DRAG_DRAGGING && intMode != INT_INGAMEOP ) { scroll(); } } else // paused { // Using software cursors (when on) for these menus due to a bug in SDL's SDL_ShowCursor() wzSetCursor(CURSOR_DEFAULT); if(dragBox3D.status != DRAG_DRAGGING) { scroll(); } if(InGameOpUp || isInGamePopupUp) // ingame options menu up, run it! { unsigned widgval = widgRunScreen(psWScreen); intProcessInGameOptions(widgval); if(widgval == INTINGAMEOP_QUIT_CONFIRM || widgval == INTINGAMEOP_POPUP_QUIT) { if(gamePaused()) { kf_TogglePauseMode(); } intRetVal = INT_QUIT; } } if(bLoadSaveUp && runLoadSave(true) && strlen(sRequestResult)) { debug( LOG_NEVER, "Returned %s", sRequestResult ); if(bRequestLoad) { loopMissionState = LMS_LOADGAME; NET_InitPlayers(); // otherwise alliances were not cleared sstrcpy(saveGameName, sRequestResult); } else { char msgbuffer[256]= {'\0'}; if (saveInMissionRes()) { if (saveGame(sRequestResult, GTYPE_SAVE_START)) { sstrcpy(msgbuffer, _("GAME SAVED: ")); sstrcat(msgbuffer, sRequestResult); addConsoleMessage( msgbuffer, LEFT_JUSTIFY, NOTIFY_MESSAGE); } else { ASSERT( false,"Mission Results: saveGame Failed" ); sstrcpy(msgbuffer, _("Could not save game!")); addConsoleMessage( msgbuffer, LEFT_JUSTIFY, NOTIFY_MESSAGE); deleteSaveGame(sRequestResult); } } else if (bMultiPlayer || saveMidMission()) { if (saveGame(sRequestResult, GTYPE_SAVE_MIDMISSION))//mid mission from [esc] menu { sstrcpy(msgbuffer, _("GAME SAVED: ")); sstrcat(msgbuffer, sRequestResult); addConsoleMessage( msgbuffer, LEFT_JUSTIFY, NOTIFY_MESSAGE); } else { ASSERT(!"saveGame(sRequestResult, GTYPE_SAVE_MIDMISSION) failed", "Mid Mission: saveGame Failed" ); sstrcpy(msgbuffer, _("Could not save game!")); addConsoleMessage( msgbuffer, LEFT_JUSTIFY, NOTIFY_MESSAGE); deleteSaveGame(sRequestResult); } } else { ASSERT( false, "Attempt to save game with incorrect load/save mode" ); } } } } /* Check for quit */ bool quitting = false; if (intRetVal == INT_QUIT) { if (!loop_GetVideoStatus()) { //quitting from the game to the front end //so get a new backdrop quitting = true; pie_LoadBackDrop(SCREEN_RANDOMBDROP); } } if (!loop_GetVideoStatus() && !quitting) { if (!gameUpdatePaused()) { if (dragBox3D.status != DRAG_DRAGGING && wallDrag.status != DRAG_DRAGGING) { ProcessRadarInput(); } processInput(); //no key clicks or in Intelligence Screen if (intRetVal == INT_NONE && !InGameOpUp && !isInGamePopupUp) { processMouseClickInput(); } displayWorld(); } /* Display the in game interface */ pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON); pie_SetFogStatus(false); if(bMultiPlayer && bDisplayMultiJoiningStatus) { intDisplayMultiJoiningStatus(bDisplayMultiJoiningStatus); setWidgetsStatus(false); } if(getWidgetsStatus()) { intDisplayWidgets(); } pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON); pie_SetFogStatus(true); } pie_GetResetCounts(&loopPieCount, &loopPolyCount, &loopStateChanges); if ((fogStatus & FOG_BACKGROUND) && (loopMissionState == LMS_SAVECONTINUE)) { pie_SetFogStatus(false); } if (!quitting) { /* Check for toggling display mode */ if ((keyDown(KEY_LALT) || keyDown(KEY_RALT)) && keyPressed(KEY_RETURN)) { screenToggleMode(); } } // deal with the mission state switch (loopMissionState) { case LMS_CLEAROBJECTS: missionDestroyObjects(); setScriptPause(true); loopMissionState = LMS_SETUPMISSION; break; case LMS_NORMAL: // default break; case LMS_SETUPMISSION: setScriptPause(false); if (!setUpMission(nextMissionType)) { return GAMECODE_QUITGAME; } break; case LMS_SAVECONTINUE: // just wait for this to be changed when the new mission starts break; case LMS_NEWLEVEL: //nextMissionType = MISSION_NONE; nextMissionType = LDS_NONE; return GAMECODE_NEWLEVEL; break; case LMS_LOADGAME: return GAMECODE_LOADGAME; break; default: ASSERT( false, "unknown loopMissionState" ); break; } if (quitting) { pie_SetFogStatus(false); pie_ScreenFlip(CLEAR_BLACK);//gameloopflip /* Check for toggling display mode */ if ((keyDown(KEY_LALT) || keyDown(KEY_RALT)) && keyPressed(KEY_RETURN)) { screenToggleMode(); } return GAMECODE_QUITGAME; } else if (loop_GetVideoStatus()) { audio_StopAll(); return GAMECODE_PLAYVIDEO; } return GAMECODE_CONTINUE; }
// ///////////////// ///////////////////////////////////////////////// // Main Front end game loop. TITLECODE titleLoop(void) { TITLECODE RetCode = TITLECODE_CONTINUE; pie_SetDepthBufferStatus(DEPTH_CMP_ALWAYS_WRT_ON); pie_SetFogStatus(false); screen_RestartBackDrop(); wzShowMouse(true); // When we first init the game, firstcall is true. if (firstcall) { firstcall = false; // First check to see if --host was given as a command line option, if not, // then check --join and if neither, run the normal game menu. if( hostlaunch ) { ingame.bHostSetup = true; bMultiPlayer = true; bMultiMessages = true; game.type = SKIRMISH; // needed? changeTitleMode(MULTIOPTION); hostlaunch = false; // reset the bool to default state. } else if(strlen(iptoconnect) ) { joinGame(iptoconnect, 0); } else { changeTitleMode(TITLE); // normal game, run main title screen. } // Using software cursors (when on) for these menus due to a bug in SDL's SDL_ShowCursor() wzSetCursor(CURSOR_DEFAULT); } if (titleMode != MULTIOPTION && titleMode != MULTILIMIT && titleMode != STARTGAME) screen_disableMapPreview(); switch(titleMode) // run relevant title screen code. { // MULTIPLAYER screens case PROTOCOL: runConnectionScreen(); // multiplayer connection screen. break; case MULTIOPTION: runMultiOptions(); break; case GAMEFIND: runGameFind(); break; case MULTI: runMultiPlayerMenu(); break; case MULTILIMIT: runLimitScreen(); break; case KEYMAP: runKeyMapEditor(); break; case TITLE: runTitleMenu(); break; case SINGLE: runSinglePlayerMenu(); break; case TUTORIAL: runTutorialMenu(); break; // case GRAPHICS: // runGraphicsOptionsMenu(); // break; case CREDITS: runCreditsScreen(); break; // case DEMOMODE: // runDemoMenu(); // break; // case VIDEO: // runVideoOptionsMenu(); // break; case OPTIONS: runOptionsMenu(); break; case GAME: runGameOptionsMenu(); break; case GRAPHICS_OPTIONS: runGraphicsOptionsMenu(); break; case AUDIO_OPTIONS: runAudioOptionsMenu(); break; case VIDEO_OPTIONS: runVideoOptionsMenu(); break; case MOUSE_OPTIONS: runMouseOptionsMenu(); break; case QUIT: RetCode = TITLECODE_QUITGAME; break; case STARTGAME: case LOADSAVEGAME: if (titleMode == LOADSAVEGAME) { RetCode = TITLECODE_SAVEGAMELOAD; } else { RetCode = TITLECODE_STARTGAME; } return RetCode; // don't flip! case SHOWINTRO: pie_SetFogStatus(false); pie_ScreenFlip(CLEAR_BLACK); changeTitleMode(TITLE); RetCode = TITLECODE_SHOWINTRO; break; default: debug( LOG_FATAL, "unknown title screen mode" ); abort(); } NETflush(); // Send any pending network data. audio_Update(); pie_SetFogStatus(false); pie_ScreenFlip(CLEAR_BLACK);//title loop if ((keyDown(KEY_LALT) || keyDown(KEY_RALT)) /* Check for toggling display mode */ && keyPressed(KEY_RETURN)) { wzToggleFullscreen(); } return RetCode; }