void CPlayGameVorticon::drawAllElements()
{
	// Animate the tiles of the map
	m_Map.animateAllTiles();

	// Blit the background
	g_pVideoDriver->blitScrollSurface();

	// Draw all objects to the screen
	drawObjects();

	// Draw masked tiles here!
	m_Map.drawForegroundTiles();

	if(mp_option[OPT_HUD].value && !mp_Finale &&
			!m_paused && !mp_Menu && !mp_HighScores)
	{	// Draw the HUD
		mp_HUD->render();
	}

	// Render the dialogs which are seen when the game is paused
	if( m_paused || !m_MessageBoxes.empty() || !mp_Menu )
	{
		// Finally draw Dialogs like status screen, game paused, etc.
		processPauseDialogs();
	}


}
Esempio n. 2
0
////
// 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();
	}
	
}
void CPlayGameVorticon::drawAllElements()
{
	// Animate the tiles of the map
	mMap->animateAllTiles();

	// Blit the background
	g_pVideoDriver->mDrawTasks.add( new BlitScrollSurfaceTask() );

	// Draw all objects to the screen
	drawObjects();

	// Draw masked tiles here!
	g_pVideoDriver->mDrawTasks.add( new DrawForegroundTilesTask(*(mMap.get())) );


	for( short i=0 ; i<m_NumPlayers ; i++ )
	{
		m_Player[i].drawStatusScreen();
	}


	if(mpFinale) // Finale processing if it is opened
	{
		mpFinale->process();

		if(mpFinale->getHasFinished())
		{
			mpFinale.release();

			if(!m_gameover)
			{
				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 ));
			}
		}

		m_Player[0].processEvents();
	}
	else
	{
	    if(mp_option[OPT_HUD].value )
	    {	// Draw the HUD
		mp_HUD->render();
	    }
	}



	// Render the dialogs which are seen when the game is paused
	if( !mMessageBoxes.empty() )
	{
		// Finally draw Dialogs like status screen, game paused, etc.
		processPauseDialogs();
	}


	// Process Related Events.
	CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;

	if(!EventContainer.empty())
	{
		if( EventContainer.occurredEvent<ResetScrollSurface>() )
		{
			g_pVideoDriver->updateScrollBuffer(mMap);
			EventContainer.pop_Event();
			return;
		}
	}

}