BOOL C4GraphicsSystem::InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlackScreenFirst)
	{
	// create new loader; overwrite current only if successful
	C4LoaderScreen *pNewLoader = new C4LoaderScreen();
	pNewLoader->SetBlackScreen(fDrawBlackScreenFirst);
	if (!pNewLoader->Init(szLoaderSpec)) { delete pNewLoader; return FALSE; }
	if (pLoaderScreen) delete pLoaderScreen;
	pLoaderScreen = pNewLoader;
	// apply user gamma for loader
	ApplyGamma();
	// done, success
	return TRUE;
	}
void C4GraphicsSystem::Execute()
	{
	// activity check
	if (!StartDrawing()) return;

	bool fBGDrawn = false;

	// If lobby running, message board only (page flip done by startup message board)
	if (!Game.pGUI || !Game.pGUI->HasFullscreenDialog(true)) // allow for message board behind GUI
		if(Game.Network.isLobbyActive() || !Game.IsRunning)
			if (Application.isFullScreen)
				{
				// Message board
				if (iRedrawBackground) ClearFullscreenBackground();
				MessageBoard.Execute();
				if (!Game.pGUI || !C4GUI::IsActive())
					{ FinishDrawing(); return; }
				fBGDrawn = true;
				}

	// fullscreen GUI?
	if (Application.isFullScreen && Game.pGUI && C4GUI::IsActive() && (Game.pGUI->HasFullscreenDialog(false) || !Game.IsRunning))
		{  
		if (!fBGDrawn && iRedrawBackground) ClearFullscreenBackground();
		Game.pGUI->Render(!fBGDrawn);
		FinishDrawing();
		return;
		}

	// Fixed screen rate in old network
	ScreenRate = 1;

	// Background redraw
	if (Application.isFullScreen)
		if (iRedrawBackground)
			DrawFullscreenBackground();

	// Screen rate skip frame draw
	ScreenTick++; if (ScreenTick>=ScreenRate) ScreenTick=0;

	// Reset object audibility
	Game.Objects.ResetAudibility();

	// some hack to ensure the mouse is drawn after a dialog close and before any
	// movement messages
	if (Game.pGUI && !C4GUI::IsActive())
		SetMouseInGUI(false, false);

	// Viewports
	for (C4Viewport *cvp=FirstViewport; cvp; cvp=cvp->Next)	
		cvp->Execute();

	if (Application.isFullScreen)
		{
		// Upper board
		UpperBoard.Execute();

		// Message board
		MessageBoard.Execute();

		// Help & Messages
		DrawHelp();
		DrawHoldMessages();
		DrawFlashMessage();
		}

	// InGame-GUI
	if (Game.pGUI && C4GUI::IsActive())
		{  
		Game.pGUI->Render(false);
		}

	// Palette update
	if (fSetPalette) { SetPalette(); /*SetDarkColorTable();*/ fSetPalette=FALSE; }

	// gamma update
	if (fSetGamma)
		{
		ApplyGamma();
		fSetGamma=FALSE;
		}

	// Video record & status (fullsrceen)
	if (Application.isFullScreen)
		Video.Execute();
	
	// done
	FinishDrawing();
	}
示例#3
0
void CGameOptions::SetGamma(s32 val, bool apply) {
  m_gamma = zeus::clamp(-100, val, 100);

  if (apply)
    ApplyGamma();
}