mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- some more work on this, taking antoher break
This commit is contained in:
parent
897354e725
commit
e86e830407
2 changed files with 11 additions and 48 deletions
|
@ -40,12 +40,11 @@
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "dikeys.h"
|
#include "dikeys.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
#include "common/console/keydef.h"
|
||||||
|
#include "menu/menu.h"
|
||||||
|
|
||||||
|
|
||||||
static void I_CheckGUICapture ();
|
|
||||||
static void I_CheckNativeMouse ();
|
static void I_CheckNativeMouse ();
|
||||||
|
|
||||||
bool GUICapture;
|
|
||||||
static bool NativeMouse = true;
|
static bool NativeMouse = true;
|
||||||
|
|
||||||
extern int paused;
|
extern int paused;
|
||||||
|
@ -162,30 +161,6 @@ static TMap<SDL_Scancode, uint8_t> InitKeyScanMap ()
|
||||||
}
|
}
|
||||||
static const TMap<SDL_Scancode, uint8_t> KeyScanToDIK(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()
|
void I_SetMouseCapture()
|
||||||
{
|
{
|
||||||
// Clear out any mouse movement.
|
// Clear out any mouse movement.
|
||||||
|
@ -251,24 +226,23 @@ CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
||||||
|
|
||||||
static bool inGame()
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return gi->CanSave();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void I_CheckNativeMouse ()
|
static void I_CheckNativeMouse ()
|
||||||
{
|
{
|
||||||
bool focus = SDL_GetKeyboardFocus() != NULL;
|
bool focus = SDL_GetKeyboardFocus() != NULL;
|
||||||
bool fs = screen->IsFullscreen();
|
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)
|
if (wantNative != NativeMouse)
|
||||||
{
|
{
|
||||||
|
@ -290,7 +264,7 @@ void MessagePump (const SDL_Event &sev)
|
||||||
switch (sev.type)
|
switch (sev.type)
|
||||||
{
|
{
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
throw CExitEvent(0);
|
throw ExitEvent(0);
|
||||||
|
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
extern void ProcessSDLWindowEvent(const SDL_WindowEvent &);
|
extern void ProcessSDLWindowEvent(const SDL_WindowEvent &);
|
||||||
|
@ -548,7 +522,6 @@ void I_GetEvent ()
|
||||||
|
|
||||||
void I_StartTic ()
|
void I_StartTic ()
|
||||||
{
|
{
|
||||||
I_CheckGUICapture ();
|
|
||||||
I_CheckNativeMouse ();
|
I_CheckNativeMouse ();
|
||||||
I_GetEvent ();
|
I_GetEvent ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,21 +41,11 @@
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#include "doomerrors.h"
|
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "d_main.h"
|
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "w_wad.h"
|
|
||||||
#include "g_level.h"
|
|
||||||
#include "g_levellocals.h"
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "r_utility.h"
|
|
||||||
#include "doomstat.h"
|
|
||||||
#include "vm.h"
|
|
||||||
#include "doomerrors.h"
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "g_game.h"
|
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue