//// // Process Routine //// void CPlayGameVorticon::ponder(const float deltaT) { if( !mpFinale && !gMenuController.active() ) // Game is not paused, no messages have to be shown and no menu is open { if(mMessageBoxes.empty() && !StatusScreenOpen()) { // Perform AIs mpObjectAI->process(); if( !g_pBehaviorEngine->paused() ) { // The following functions must be worldmap dependent if( m_Level == WORLD_MAP_LEVEL_VORTICON ) { processOnWorldMap(); // TODO: I think the main loop of that should be here! } else { processInLevel(); // TODO: I think the main loop of that should be here! } if(m_Player.size() > (unsigned int)mCamLead ) { if(m_Player[mCamLead].pdie) { const int numPlayers = g_pBehaviorEngine->mPlayers; for( int i=0 ; i<numPlayers ; i++ ) { if(m_Player[i].pdie) cycleCamLead(); } } else { for(auto &player : m_Player) { // Process Players' Cameras player.processCamera(); } } } } for(auto &player : m_Player) { // Process Players' Events player.processEvents(); } } } if(mpFinale) // Finale processing if it is opened { mpFinale->ponder(); if( mpFinale->getHasFinished() ) { mpFinale.release(); if(!m_gameover) { CHighScores *pHighScores = new CHighScores(); pHighScores->init(); collectHighScoreInfo(*pHighScores); gEventManager.add(new GMSwitchToPassiveMode(/*m_Gamepath, m_Episode*/)); gEventManager.add(new StartInfoSceneEvent( pHighScores )); } } } // Render the dialogs which are seen when the game is paused if( !mMessageBoxes.empty() ) { // Finally draw Dialogs like status screen, game paused, etc. processPauseDialogs(); } // Check if we are in gameover mode. If yes, than show the bitmaps and block the FKeys(). // Only confirmation button is allowed if(m_gameover && !mpFinale) // game over mode { if( mpGameoverBmp ) { if( gInput.getPressedAnyCommand() ) { CHighScores *pHighScores = new CHighScores(); pHighScores->init(); collectHighScoreInfo(*pHighScores); gEventManager.add(new GMSwitchToPassiveMode(/*m_Gamepath, m_Episode*/)); gEventManager.add(new StartInfoSceneEvent( pHighScores )); } } else // Bitmap must first be created { GsBitmap *pBitmap = gGraphics.getBitmapFromStr("GAMEOVER"); g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW); mpGameoverBmp.reset( new CEGABitmap( mMap.get() , gVideoDriver.getBlitSurface(), pBitmap) ); GsRect<Uint16> gameRes = gVideoDriver.getGameResolution(); mpGameoverBmp->setScrPos( (gameRes.w/2) -(pBitmap->getWidth()/2), (gameRes.h/2) -(pBitmap->getHeight()/2) ); } } else // No game over { // Handle special functional keys for paused game, F1 Help, god mode, all items, etc. handleFKeys(); } }
//// // Process Routine //// void CPlayGameVorticon::process() { // Check for fading processes if necessary if(g_pGfxEngine->Palette.in_progress()) g_pGfxEngine->Palette.applyFade(); if( !mpFinale && !gpMenuController->active() ) // Game is not paused, no messages have to be shown and no menu is open { if(mMessageBoxes.empty() && !StatusScreenOpen()) { // Perform AIs mpObjectAI->process(); if( !g_pBehaviorEngine->paused() ) { /// The following functions must be worldmap dependent if( m_Level == WORLD_MAP_LEVEL_VORTICON ) { processOnWorldMap(); } else { processInLevel(); } if(m_Player[mCamLead].pdie) { for( int i=0 ; i<m_NumPlayers ; i++ ) { if(m_Player[i].pdie) cycleCamLead(); } } else { // Process Players' Cameras m_Player[mCamLead].processCamera(); } } } } // Draw all the Stuff here! drawAllElements(); if( m_Level == WORLD_MAP_LEVEL_VORTICON && m_showKeensLeft ) showKeensLeft(); // Check if we are in gameover mode. If yes, than show the bitmaps and block the FKeys(). // Only confirmation button is allowes if(m_gameover && !mpFinale) // game over mode { if( mpGameoverBmp ) { mpGameoverBmp->process(); if( g_pInput->getPressedAnyCommand() ) { CHighScores *pHighScores = new CHighScores(); pHighScores->init(); collectHighScoreInfo(*pHighScores); g_pBehaviorEngine->EventList().add(new GMSwitchToPassiveMode(m_Gamepath, m_Episode)); g_pBehaviorEngine->EventList().add(new StartInfoSceneEvent( pHighScores )); } } else // Bitmap must first be created { CBitmap *pBitmap = g_pGfxEngine->getBitmap("GAMEOVER"); g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW); mpGameoverBmp.reset( new CEGABitmap( mMap.get() , g_pVideoDriver->getBlitSurface(), pBitmap) ); mpGameoverBmp->setScrPos( 160-(pBitmap->getWidth()/2), 100-(pBitmap->getHeight()/2) ); } } else // No game over { // Handle special functional keys for paused game, F1 Help, god mode, all items, etc. handleFKeys(); } auto &eventContainer = g_pBehaviorEngine->EventList(); if( eventContainer.occurredEvent<EventEndGamePlay>() ) { m_endgame = true; eventContainer.pop_Event(); } }