- some more work on this, taking antoher break

This commit is contained in:
Rachael Alexanderson 2020-01-09 06:04:04 -05:00
parent 897354e725
commit e86e830407
2 changed files with 11 additions and 48 deletions

View file

@ -40,12 +40,11 @@
#include "c_dispatch.h"
#include "dikeys.h"
#include "utf8.h"
#include "common/console/keydef.h"
#include "menu/menu.h"
static void I_CheckGUICapture ();
static void I_CheckNativeMouse ();
bool GUICapture;
static bool NativeMouse = true;
extern int paused;
@ -162,30 +161,6 @@ static TMap<SDL_Scancode, uint8_t> InitKeyScanMap ()
}
static const TMap<SDL_Scancode, uint8_t> KeyScanToDIK(InitKeyScanMap());
static void I_CheckGUICapture ()
{
bool wantCapt;
if (menuactive == MENU_Off)
{
wantCapt = ConsoleState == c_down || ConsoleState == c_falling || chatmodeon;
}
else
{
wantCapt = (menuactive == MENU_On || menuactive == MENU_OnNoPause);
}
// [ZZ] check active event handlers that want the UI processing
if (!wantCapt && primaryLevel->localEventManager->CheckUiProcessors())
wantCapt = true;
if (wantCapt != GUICapture)
{
GUICapture = wantCapt;
ResetButtonStates();
}
}
void I_SetMouseCapture()
{
// Clear out any mouse movement.
@ -251,24 +226,23 @@ CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
static bool inGame()
{
switch (mouse_capturemode)
if (mouse_capturemode == 2)
{
default:
case 0:
return gamestate == GS_LEVEL;
case 1:
return gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_FINALE;
case 2:
return true;
}
else
{
return gi->CanSave();
}
}
static void I_CheckNativeMouse ()
{
bool focus = SDL_GetKeyboardFocus() != NULL;
bool fs = screen->IsFullscreen();
bool wantNative = !focus || (!use_mouse || GUICapture || paused || demoplayback || !inGame());
// TODO: We want this to check for demo playback, as well.
bool wantNative = !focus || (!use_mouse || GUICapture || paused || !inGame());
if (wantNative != NativeMouse)
{
@ -290,7 +264,7 @@ void MessagePump (const SDL_Event &sev)
switch (sev.type)
{
case SDL_QUIT:
throw CExitEvent(0);
throw ExitEvent(0);
case SDL_WINDOWEVENT:
extern void ProcessSDLWindowEvent(const SDL_WindowEvent &);
@ -548,7 +522,6 @@ void I_GetEvent ()
void I_StartTic ()
{
I_CheckGUICapture ();
I_CheckNativeMouse ();
I_GetEvent ();
}

View file

@ -41,21 +41,11 @@
#include <sys/param.h>
#include <locale.h>
#include "doomerrors.h"
#include "m_argv.h"
#include "d_main.h"
#include "c_console.h"
#include "version.h"
#include "w_wad.h"
#include "g_level.h"
#include "g_levellocals.h"
#include "cmdlib.h"
#include "r_utility.h"
#include "doomstat.h"
#include "vm.h"
#include "doomerrors.h"
#include "i_system.h"
#include "g_game.h"
// MACROS ------------------------------------------------------------------