Exemplo n.º 1
0
// ////////////////////////////////////////////////////////////////////////////
BOOL closeLoadSave(void)
{
	widgDelete(psRequestScreen,LOADSAVE_FORM);
	bLoadSaveUp = false;

	if ((bLoadSaveMode == LOAD_INGAME) || (bLoadSaveMode == SAVE_INGAME))
	{

		if (!bMultiPlayer || (NetPlay.bComms == 0))
		{
			gameTimeStart();
			setGamePauseStatus( false );
			setGameUpdatePause(false);
			setScriptPause(false);
			setScrollPause(false);
			setConsolePause(false);
		}

		intAddReticule();
		intShowPowerBar();

	}
	widgReleaseScreen(psRequestScreen);
	// need to "eat" up the return key so it don't pass back to game.
	inputLooseFocus();
	return true;
}
Exemplo n.º 2
0
/*!
 * The mainloop.
 * Fetches events, executes appropriate code
 */
void mainLoop(void)
{
	frameUpdate(); // General housekeeping

	// Screenshot key is now available globally
	if (keyPressed(KEY_F10))
	{
		kf_ScreenDump();
		inputLooseFocus();		// remove it from input stream
	}

	if (NetPlay.bComms || focusState == FOCUS_IN || !war_GetPauseOnFocusLoss())
	{
		if (loop_GetVideoStatus())
		{
			videoLoop(); // Display the video if neccessary
		}
		else switch (GetGameMode())
		{
			case GS_NORMAL: // Run the gameloop code
				runGameLoop();
				break;
			case GS_TITLE_SCREEN: // Run the titleloop code
				runTitleLoop();
				break;
			default:
				break;
		}
		realTimeUpdate(); // Update realTime.
	}
}
Exemplo n.º 3
0
// ////////////////////////////////////////////////////////////////////////////
bool closeChallenges()
{
    widgDelete(psRequestScreen, CHALLENGE_FORM);
    widgReleaseScreen(psRequestScreen);
    // need to "eat" up the return key so it don't pass back to game.
    inputLooseFocus();
    challengesUp = false;
    return true;
}
Exemplo n.º 4
0
/*!
 * Activation (focus change) eventhandler
 */
static void handleActiveEvent(SDL_ActiveEvent * activeEvent)
{
	// Ignore focus loss through SDL_APPMOUSEFOCUS, since it mostly happens accidentialy
	// active.state is a bitflag! Mixed events (eg. APPACTIVE|APPMOUSEFOCUS) will thus not be ignored.
	if ( activeEvent->state == SDL_APPMOUSEFOCUS )
	{
		setMouseScroll(activeEvent->gain);
		return;
	}

	if ( activeEvent->gain == 1 )
	{
		debug( LOG_NEVER, "WM_SETFOCUS");
		if (focusState != FOCUS_IN)
		{
			focusState = FOCUS_IN;

			// Don't pause in multiplayer!
			if (war_GetPauseOnFocusLoss() && !NetPlay.bComms)
			{
				gameTimeStart();
				audio_ResumeAll();
				cdAudio_Resume();
			}
			// enable scrolling
			setScrollPause(false);
			resetScroll();
		}
	}
	else
	{
		debug( LOG_NEVER, "WM_KILLFOCUS");
		if (focusState != FOCUS_OUT)
		{
			focusState = FOCUS_OUT;

			// Don't pause in multiplayer!
			if (war_GetPauseOnFocusLoss() && !NetPlay.bComms)
			{
				gameTimeStop();
				audio_PauseAll();
				cdAudio_Pause();
			}
			/* Have to tell the input system that we've lost focus */
			inputLooseFocus();
			// stop scrolling
			setScrollPause(true);
		}
	}
}
Exemplo n.º 5
0
/*!
 * The mainloop.
 * Fetches events, executes appropriate code
 */
static void mainLoop(void)
{
	SDL_Event event;

	while (true)
	{
		frameUpdate(); // General housekeeping

		/* Deal with any windows messages */
		while (SDL_PollEvent(&event))
		{
			switch (event.type)
			{
				case SDL_KEYUP:
				case SDL_KEYDOWN:
					inputHandleKeyEvent(&event.key);
					break;
				case SDL_MOUSEBUTTONUP:
				case SDL_MOUSEBUTTONDOWN:
					inputHandleMouseButtonEvent(&event.button);
					break;
				case SDL_MOUSEMOTION:
					inputHandleMouseMotionEvent(&event.motion);
					break;
				case SDL_ACTIVEEVENT:
					handleActiveEvent(&event.active);
					break;
				case SDL_QUIT:
					saveConfig();
					return;
				default:
					break;
			}
		}
		// Screenshot key is now available globally
		if(keyPressed(KEY_F10))
		{
			kf_ScreenDump();
			inputLooseFocus();		// remove it from input stream
		}

		// only pause when not in multiplayer, no focus, and we actually want to pause
		if (NetPlay.bComms || focusState == FOCUS_IN || !war_GetPauseOnFocusLoss())
		{
			if (loop_GetVideoStatus())
			{
				videoLoop(); // Display the video if neccessary
			}
			else switch (GetGameMode())
			{
				case GS_NORMAL: // Run the gameloop code
					runGameLoop();
					break;
				case GS_TITLE_SCREEN: // Run the titleloop code
					runTitleLoop();
					break;
				default:
					break;
			}

			realTimeUpdate(); // Update realTime.
		}
	}
}