mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
WIP
This commit is contained in:
parent
113b5d9037
commit
e7f75cbf4d
23 changed files with 122 additions and 105 deletions
|
@ -811,9 +811,9 @@ static void DoQuickSave(void)
|
||||||
|
|
||||||
void LocalKeys(void)
|
void LocalKeys(void)
|
||||||
{
|
{
|
||||||
char alt = keystatus[sc_LeftAlt] | keystatus[sc_RightAlt];
|
bool alt = inputState.AltPressed();
|
||||||
char ctrl = keystatus[sc_LeftControl] | keystatus[sc_RightControl];
|
bool ctrl = inputState.CtrlPressed();
|
||||||
char shift = keystatus[sc_LeftShift] | keystatus[sc_RightShift];
|
bool shift = inputState.ShiftPressed();
|
||||||
if (BUTTON(gamefunc_See_Chase_View) && !alt && !shift)
|
if (BUTTON(gamefunc_See_Chase_View) && !alt && !shift)
|
||||||
{
|
{
|
||||||
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
||||||
|
@ -877,7 +877,7 @@ void LocalKeys(void)
|
||||||
gPlayerMsg.Send();
|
gPlayerMsg.Send();
|
||||||
}
|
}
|
||||||
keyFlushScans();
|
keyFlushScans();
|
||||||
keystatus[key] = 0;
|
inputState.ClearKeyStatus(key);
|
||||||
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1679,7 +1679,7 @@ RESTART:
|
||||||
{
|
{
|
||||||
if (handleevents() && quitevent)
|
if (handleevents() && quitevent)
|
||||||
{
|
{
|
||||||
KB_KeyDown[sc_Escape] = 1;
|
inputState.SetKeyStatus(sc_Escape, 1);
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
}
|
}
|
||||||
netUpdate();
|
netUpdate();
|
||||||
|
|
|
@ -99,7 +99,7 @@ char DoUnFade(int nTicks)
|
||||||
|
|
||||||
void credLogosDos(void)
|
void credLogosDos(void)
|
||||||
{
|
{
|
||||||
char bShift = keystatus[sc_LeftShift] | keystatus[sc_RightShift];
|
char bShift = inputState.ShiftPressed();
|
||||||
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
||||||
DoUnFade(1);
|
DoUnFade(1);
|
||||||
videoClearScreen(0);
|
videoClearScreen(0);
|
||||||
|
|
|
@ -289,8 +289,6 @@ void CDemo::ProcessKeys(void)
|
||||||
char nKey;
|
char nKey;
|
||||||
while ((nKey = keyGetScan()) != 0)
|
while ((nKey = keyGetScan()) != 0)
|
||||||
{
|
{
|
||||||
char UNUSED(alt) = keystatus[0x38] | keystatus[0xb8];
|
|
||||||
char UNUSED(ctrl) = keystatus[0x1d] | keystatus[0x9d];
|
|
||||||
switch (nKey)
|
switch (nKey)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -333,8 +331,8 @@ _DEMOPLAYBACK:
|
||||||
{
|
{
|
||||||
if (handleevents() && quitevent)
|
if (handleevents() && quitevent)
|
||||||
{
|
{
|
||||||
KB_KeyDown[sc_Escape] = 1;
|
inputState.SetKeyStatus(sc_Escape, 1);
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
}
|
}
|
||||||
MUSIC_Update();
|
MUSIC_Update();
|
||||||
while (totalclock >= gNetFifoClock && !gQuitGame)
|
while (totalclock >= gNetFifoClock && !gQuitGame)
|
||||||
|
|
|
@ -240,7 +240,7 @@ void CGameMenuMgr::Process(void)
|
||||||
event.at0 = kMenuEventEscape;
|
event.at0 = kMenuEventEscape;
|
||||||
break;
|
break;
|
||||||
case sc_Tab:
|
case sc_Tab:
|
||||||
if (keystatus[sc_LeftShift] || keystatus[sc_RightShift])
|
if (inputState.ShiftPressed())
|
||||||
event.at0 = kMenuEventUp;
|
event.at0 = kMenuEventUp;
|
||||||
else
|
else
|
||||||
event.at0 = kMenuEventDown;
|
event.at0 = kMenuEventDown;
|
||||||
|
@ -1906,7 +1906,7 @@ bool CGameMenuItemZEdit::Event(CGameMenuEvent &event)
|
||||||
char key;
|
char key;
|
||||||
if (event.at2 < 128)
|
if (event.at2 < 128)
|
||||||
{
|
{
|
||||||
if (keystatus[sc_LeftShift] || keystatus[sc_RightShift])
|
if (inputState.ShiftPressed())
|
||||||
key = g_keyAsciiTableShift[event.at2];
|
key = g_keyAsciiTableShift[event.at2];
|
||||||
else
|
else
|
||||||
key = g_keyAsciiTable[event.at2];
|
key = g_keyAsciiTable[event.at2];
|
||||||
|
@ -2099,7 +2099,7 @@ bool CGameMenuItemZEditBitmap::Event(CGameMenuEvent &event)
|
||||||
char key;
|
char key;
|
||||||
if (bScan && event.at2 < 128)
|
if (bScan && event.at2 < 128)
|
||||||
{
|
{
|
||||||
if (keystatus[sc_LeftShift] || keystatus[sc_RightShift])
|
if (inputState.ShiftPressed())
|
||||||
key = g_keyAsciiTableShift[event.at2];
|
key = g_keyAsciiTableShift[event.at2];
|
||||||
else
|
else
|
||||||
key = g_keyAsciiTable[event.at2];
|
key = g_keyAsciiTable[event.at2];
|
||||||
|
|
|
@ -595,9 +595,8 @@ void CPlayerMsg::ProcessKeys(void)
|
||||||
char ch;
|
char ch;
|
||||||
if (key != 0)
|
if (key != 0)
|
||||||
{
|
{
|
||||||
bool UNUSED(alt) = keystatus[sc_LeftAlt] || keystatus[sc_RightAlt];
|
bool ctrl = (inputState.CtrlPressed());
|
||||||
bool ctrl = keystatus[sc_LeftControl] || keystatus[sc_RightControl];
|
bool shift = (inputState.ShiftPressed());
|
||||||
bool shift = keystatus[sc_LeftShift] || keystatus[sc_RightShift];
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case sc_Escape:
|
case sc_Escape:
|
||||||
|
@ -616,8 +615,9 @@ void CPlayerMsg::ProcessKeys(void)
|
||||||
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
||||||
Set(*CombatMacros[key-sc_F1]);
|
Set(*CombatMacros[key-sc_F1]);
|
||||||
Send();
|
Send();
|
||||||
keystatus[key] = 0;
|
inputState.ClearKeyStatus(key);
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
case sc_BackSpace:
|
case sc_BackSpace:
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
Clear();
|
Clear();
|
||||||
|
|
|
@ -540,7 +540,7 @@ void netGetPackets(void)
|
||||||
gStartNewGame = 1;
|
gStartNewGame = 1;
|
||||||
break;
|
break;
|
||||||
case 255:
|
case 255:
|
||||||
keystatus[1] = 1;
|
inputState.SetKeyStatus(sc_Escape, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,8 +637,8 @@ void netWaitForEveryone(char a1)
|
||||||
int p;
|
int p;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (keystatus[sc_Escape] && a1)
|
if (inputState.EscapePressed() && a1)
|
||||||
exit(0);
|
Bexit(0);
|
||||||
gameHandleEvents();
|
gameHandleEvents();
|
||||||
faketimerhandler();
|
faketimerhandler();
|
||||||
for (p = connecthead; p >= 0; p = connectpoint2[p])
|
for (p = connecthead; p >= 0; p = connectpoint2[p])
|
||||||
|
|
|
@ -842,7 +842,8 @@ void GAME_onshowosd(int shown)
|
||||||
|
|
||||||
// XXX: it's weird to fake a keypress like this.
|
// XXX: it's weird to fake a keypress like this.
|
||||||
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
||||||
// KB_KeyDown[sc_Pause] = 1;
|
// inputState.SetKeyStatus(sc_Escape, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAME_clearbackground(int numcols, int numrows)
|
void GAME_clearbackground(int numcols, int numrows)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
#include "inputstate.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUGGINGAIDS
|
#ifdef DEBUGGINGAIDS
|
||||||
|
@ -88,7 +89,6 @@ vec2_t CONSTEXPR const g_defaultVideoModes []
|
||||||
extern char inputdevices;
|
extern char inputdevices;
|
||||||
|
|
||||||
// keys
|
// keys
|
||||||
#define NUMKEYS 256
|
|
||||||
#define KEYFIFOSIZ 64
|
#define KEYFIFOSIZ 64
|
||||||
|
|
||||||
char CONSTEXPR const g_keyAsciiTable[128] = {
|
char CONSTEXPR const g_keyAsciiTable[128] = {
|
||||||
|
@ -107,7 +107,6 @@ char CONSTEXPR const g_keyAsciiTableShift[128] = {
|
||||||
0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char keystatus[NUMKEYS];
|
|
||||||
extern char g_keyFIFO[KEYFIFOSIZ];
|
extern char g_keyFIFO[KEYFIFOSIZ];
|
||||||
extern char g_keyAsciiFIFO[KEYFIFOSIZ];
|
extern char g_keyAsciiFIFO[KEYFIFOSIZ];
|
||||||
extern uint8_t g_keyAsciiPos;
|
extern uint8_t g_keyAsciiPos;
|
||||||
|
@ -116,7 +115,6 @@ extern uint8_t g_keyFIFOend;
|
||||||
extern char g_keyRemapTable[NUMKEYS];
|
extern char g_keyRemapTable[NUMKEYS];
|
||||||
extern char g_keyNameTable[NUMKEYS][24];
|
extern char g_keyNameTable[NUMKEYS][24];
|
||||||
|
|
||||||
extern int32_t keyGetState(int32_t key);
|
|
||||||
extern void keySetState(int32_t key, int32_t state);
|
extern void keySetState(int32_t key, int32_t state);
|
||||||
|
|
||||||
// mouse
|
// mouse
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "a.h"
|
#include "a.h"
|
||||||
#include "polymost.h"
|
#include "polymost.h"
|
||||||
#include "cache1d.h"
|
#include "cache1d.h"
|
||||||
|
#include "inputstate.h"
|
||||||
#include "../../glbackend/glbackend.h"
|
#include "../../glbackend/glbackend.h"
|
||||||
|
|
||||||
// video
|
// video
|
||||||
|
@ -24,7 +25,6 @@ int32_t g_borderless=2;
|
||||||
// input
|
// input
|
||||||
char inputdevices = 0;
|
char inputdevices = 0;
|
||||||
|
|
||||||
char keystatus[NUMKEYS];
|
|
||||||
char g_keyFIFO[KEYFIFOSIZ];
|
char g_keyFIFO[KEYFIFOSIZ];
|
||||||
char g_keyAsciiFIFO[KEYFIFOSIZ];
|
char g_keyAsciiFIFO[KEYFIFOSIZ];
|
||||||
uint8_t g_keyFIFOpos;
|
uint8_t g_keyFIFOpos;
|
||||||
|
@ -38,11 +38,10 @@ void (*keypresscallback)(int32_t, int32_t);
|
||||||
|
|
||||||
void keySetCallback(void (*callback)(int32_t, int32_t)) { keypresscallback = callback; }
|
void keySetCallback(void (*callback)(int32_t, int32_t)) { keypresscallback = callback; }
|
||||||
|
|
||||||
int32_t keyGetState(int32_t key) { return keystatus[g_keyRemapTable[key]]; }
|
|
||||||
|
|
||||||
void keySetState(int32_t key, int32_t state)
|
void keySetState(int32_t key, int32_t state)
|
||||||
{
|
{
|
||||||
keystatus[g_keyRemapTable[key]] = state;
|
inputState.SetKeyStatus(g_keyRemapTable[key], state);
|
||||||
|
//keystatus[g_keyRemapTable[key]] = state;
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "scancodes.h"
|
#include "scancodes.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
#include "inputstate.h"
|
||||||
|
|
||||||
#define XXH_STATIC_LINKING_ONLY
|
#define XXH_STATIC_LINKING_ONLY
|
||||||
#include "xxhash.h"
|
#include "xxhash.h"
|
||||||
|
@ -1217,7 +1218,7 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
|
||||||
|
|
||||||
osddraw_t &draw = osd->draw;
|
osddraw_t &draw = osd->draw;
|
||||||
|
|
||||||
if (scanCode == osd->keycode && (keystatus[sc_LeftShift] || (osd->flags & OSD_CAPTURE) || (osd->flags & OSD_PROTECTED) != OSD_PROTECTED))
|
if (scanCode == osd->keycode && (inputState.ShiftPressed() || (osd->flags & OSD_CAPTURE) || (osd->flags & OSD_PROTECTED) != OSD_PROTECTED))
|
||||||
{
|
{
|
||||||
if (keyDown)
|
if (keyDown)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "resourcefile.h"
|
#include "resourcefile.h"
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "i_specialpaths.h"
|
#include "i_specialpaths.h"
|
||||||
|
#include "inputstate.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "../../glbackend/glbackend.h"
|
#include "../../glbackend/glbackend.h"
|
||||||
|
|
||||||
|
@ -2223,7 +2224,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
{
|
{
|
||||||
for (j = 0; j < NUMKEYS; ++j)
|
for (j = 0; j < NUMKEYS; ++j)
|
||||||
{
|
{
|
||||||
if (keyGetState(j))
|
if (inputState.GetKeyStatus(j))
|
||||||
{
|
{
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(j, 0);
|
keypresscallback(j, 0);
|
||||||
|
@ -2236,7 +2237,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
|
|
||||||
if (ev.key.type == SDL_KEYDOWN)
|
if (ev.key.type == SDL_KEYDOWN)
|
||||||
{
|
{
|
||||||
if (!keyGetState(code))
|
if (!inputState.GetKeyStatus(code))
|
||||||
{
|
{
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(code, 1);
|
keypresscallback(code, 1);
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "keyboard.h"
|
||||||
|
#include "control.h"
|
||||||
|
#include "scancodes.h"
|
||||||
|
|
||||||
|
extern kb_scancode KB_LastScan;
|
||||||
|
|
||||||
// This encapsulates the entire game-readable input state which previously was spread out across several files.
|
// This encapsulates the entire game-readable input state which previously was spread out across several files.
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NUMKEYS = 256,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name.
|
// Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name.
|
||||||
enum GameFunction_t
|
enum GameFunction_t
|
||||||
{
|
{
|
||||||
|
@ -99,6 +111,8 @@ class InputState
|
||||||
{
|
{
|
||||||
|
|
||||||
FixedBitArray<NUMGAMEFUNCTIONS> ButtonState, ButtonHeldState;
|
FixedBitArray<NUMGAMEFUNCTIONS> ButtonState, ButtonHeldState;
|
||||||
|
uint8_t KeyStatus[NUMKEYS];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool BUTTON(int x)
|
bool BUTTON(int x)
|
||||||
|
@ -145,6 +159,45 @@ public:
|
||||||
ButtonState.Zero();
|
ButtonState.Zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t GetKeyStatus(int key)
|
||||||
|
{
|
||||||
|
return KeyStatus[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetKeyStatus(int key, int state)
|
||||||
|
{
|
||||||
|
KeyStatus[key] = (uint8_t)state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearKeyStatus(int key)
|
||||||
|
{
|
||||||
|
KeyStatus[key] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearAllKeyStatus()
|
||||||
|
{
|
||||||
|
memset(KeyStatus, 0, sizeof(KeyStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AltPressed()
|
||||||
|
{
|
||||||
|
return KeyStatus[sc_LeftAlt] || KeyStatus[sc_RightAlt];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CtrlPressed()
|
||||||
|
{
|
||||||
|
KeyStatus[sc_LeftControl] || KeyStatus[sc_RightControl];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShiftPressed()
|
||||||
|
{
|
||||||
|
return KeyStatus[sc_LeftShift] || KeyStatus[sc_RightShift];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EscapePressed()
|
||||||
|
{
|
||||||
|
return !!KeyStatus[sc_Escape];
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -175,3 +228,29 @@ inline bool BUTTONSTATECHANGED(int x)
|
||||||
{
|
{
|
||||||
return (BUTTON(x) != BUTTONHELD(x));
|
return (BUTTON(x) != BUTTONHELD(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint8_t KB_KeyPressed(int scan)
|
||||||
|
{
|
||||||
|
return inputState.GetKeyStatus(scan);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void KB_ClearKeyDown(int scan)
|
||||||
|
{
|
||||||
|
inputState.ClearKeyStatus(scan);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool KB_UnBoundKeyPressed(int scan)
|
||||||
|
{
|
||||||
|
return (inputState.GetKeyStatus(scan) != 0 && !CONTROL_KeyBinds[scan].cmdstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint8_t KEY_PRESSED(int scan) // Shadow Warrior uses different names for many things.
|
||||||
|
{
|
||||||
|
return inputState.GetKeyStatus(scan);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void KB_ClearKeysDown(void)
|
||||||
|
{
|
||||||
|
KB_LastScan = 0;
|
||||||
|
inputState.ClearAllKeyStatus();
|
||||||
|
}
|
||||||
|
|
|
@ -6684,7 +6684,7 @@ MAIN_LOOP_RESTART:
|
||||||
}
|
}
|
||||||
|
|
||||||
ud.warp_on = 0;
|
ud.warp_on = 0;
|
||||||
KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key
|
inputState.ClearKeyStatus(sc_Pause); // JBF: I hate the pause key
|
||||||
|
|
||||||
if(g_netClient)
|
if(g_netClient)
|
||||||
{
|
{
|
||||||
|
@ -6695,8 +6695,8 @@ MAIN_LOOP_RESTART:
|
||||||
{
|
{
|
||||||
if (gameHandleEvents() && quitevent)
|
if (gameHandleEvents() && quitevent)
|
||||||
{
|
{
|
||||||
KB_KeyDown[sc_Escape] = 1;
|
inputState.SetKeyStatus(sc_Escape, 1);
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
|
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
|
||||||
|
|
|
@ -4684,9 +4684,6 @@ void Net_WaitForServer(void)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (quitevent || keystatus[1])
|
|
||||||
G_GameExit("");
|
|
||||||
|
|
||||||
if (G_FPSLimit())
|
if (G_FPSLimit())
|
||||||
{
|
{
|
||||||
display_betascreen();
|
display_betascreen();
|
||||||
|
|
|
@ -113,10 +113,6 @@ void GAME_onshowosd(int shown)
|
||||||
mouseLockToWindow((!shown) + 2);
|
mouseLockToWindow((!shown) + 2);
|
||||||
|
|
||||||
osdshown = shown;
|
osdshown = shown;
|
||||||
|
|
||||||
// XXX: it's weird to fake a keypress like this.
|
|
||||||
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
|
||||||
// KB_KeyDown[sc_Pause] = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ static struct
|
||||||
|
|
||||||
#define MAXKEYBOARDSCAN 256
|
#define MAXKEYBOARDSCAN 256
|
||||||
|
|
||||||
#define KB_KeyDown keystatus
|
|
||||||
extern kb_scancode KB_LastScan;
|
extern kb_scancode KB_LastScan;
|
||||||
|
|
||||||
#define KB_GetLastScanCode() (KB_LastScan)
|
#define KB_GetLastScanCode() (KB_LastScan)
|
||||||
|
@ -72,31 +71,19 @@ extern kb_scancode KB_LastScan;
|
||||||
{ \
|
{ \
|
||||||
KB_SetLastScanCode(sc_None); \
|
KB_SetLastScanCode(sc_None); \
|
||||||
}
|
}
|
||||||
#define KB_KeyPressed(scan) (keystatus[(scan)] != 0)
|
|
||||||
#define KB_ClearKeyDown(scan) \
|
|
||||||
{ \
|
|
||||||
keystatus[(scan)] = FALSE; \
|
|
||||||
}
|
|
||||||
#define KB_UnBoundKeyPressed(scan) (keystatus[(scan)] != 0 && !CONTROL_KeyBinds[scan].cmdstr)
|
|
||||||
#define KB_GetCh keyGetChar
|
#define KB_GetCh keyGetChar
|
||||||
#define KB_KeyWaiting keyBufferWaiting
|
#define KB_KeyWaiting keyBufferWaiting
|
||||||
#define KB_FlushKeyboardQueue keyFlushChars
|
#define KB_FlushKeyboardQueue keyFlushChars
|
||||||
#define KB_FlushKeyboardQueueScans keyFlushScans
|
#define KB_FlushKeyboardQueueScans keyFlushScans
|
||||||
|
|
||||||
static inline void KB_ClearKeysDown(void)
|
|
||||||
{
|
|
||||||
KB_LastScan = 0;
|
|
||||||
Bmemset(keystatus, 0, sizeof(keystatus));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void KB_KeyEvent(int32_t scancode, int32_t keypressed)
|
static inline void KB_KeyEvent(int32_t scancode, int32_t keypressed)
|
||||||
{
|
{
|
||||||
if (keypressed)
|
if (keypressed)
|
||||||
KB_LastScan = scancode;
|
KB_LastScan = scancode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void KB_Startup(void) { keySetCallback(KB_KeyEvent); }
|
void KB_Startup(void);
|
||||||
static inline void KB_Shutdown(void) { keySetCallback((void (*)(int32_t, int32_t))NULL); }
|
void KB_Shutdown(void);
|
||||||
const char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string
|
const char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string
|
||||||
kb_scancode KB_StringToScanCode( const char * string ); // convert a string into a scancode
|
kb_scancode KB_StringToScanCode( const char * string ); // convert a string into a scancode
|
||||||
|
|
||||||
|
|
|
@ -139,37 +139,6 @@ static void CONTROL_SetFlag(int which, int active)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
int32_t CONTROL_KeyboardFunctionPressed(int32_t which)
|
|
||||||
{
|
|
||||||
int32_t key1 = 0, key2 = 0;
|
|
||||||
|
|
||||||
if (CONTROL_CheckRange(which)) return FALSE;
|
|
||||||
|
|
||||||
if (!CONTROL_Flags[which].used) return FALSE;
|
|
||||||
|
|
||||||
if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key1].cmdstr)
|
|
||||||
key1 = KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] ? TRUE : FALSE;
|
|
||||||
|
|
||||||
if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key2].cmdstr)
|
|
||||||
key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? TRUE : FALSE;
|
|
||||||
|
|
||||||
return key1 | key2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CONTROL_ClearKeyboardFunction(int32_t which)
|
|
||||||
{
|
|
||||||
if (CONTROL_CheckRange(which)) return;
|
|
||||||
|
|
||||||
if (!CONTROL_Flags[which].used) return;
|
|
||||||
|
|
||||||
if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED)
|
|
||||||
KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] = 0;
|
|
||||||
|
|
||||||
if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED)
|
|
||||||
KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CONTROL_DefineFlag(int which, int toggle)
|
void CONTROL_DefineFlag(int which, int toggle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,3 +57,6 @@ kb_scancode KB_StringToScanCode(const char * string)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KB_Startup(void) { keySetCallback(KB_KeyEvent); }
|
||||||
|
void KB_Shutdown(void) { keySetCallback((void (*)(int32_t, int32_t))NULL); }
|
||||||
|
|
|
@ -8051,14 +8051,14 @@ MAIN_LOOP_RESTART:
|
||||||
}
|
}
|
||||||
|
|
||||||
ud.warp_on = 0;
|
ud.warp_on = 0;
|
||||||
KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key
|
inputState.ClearKeyStatus(sc_Pause); // JBF: I hate the pause key
|
||||||
|
|
||||||
do //main loop
|
do //main loop
|
||||||
{
|
{
|
||||||
if (handleevents() && quitevent)
|
if (handleevents() && quitevent)
|
||||||
{
|
{
|
||||||
KB_KeyDown[sc_Escape] = 1;
|
inputState.SetKeyStatus(sc_Escape, 1);
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Net_GetPackets();
|
Net_GetPackets();
|
||||||
|
|
|
@ -168,8 +168,6 @@ void Net_WaitForEverybody(void)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
//if (quitevent || keystatus[sc_Escape]) G_GameExit("");
|
|
||||||
|
|
||||||
if (G_FPSLimit())
|
if (G_FPSLimit())
|
||||||
{
|
{
|
||||||
display_betascreen();
|
display_betascreen();
|
||||||
|
|
|
@ -126,10 +126,6 @@ void GAME_onshowosd(int32_t shown)
|
||||||
mouseLockToWindow((!shown) + 2);
|
mouseLockToWindow((!shown) + 2);
|
||||||
|
|
||||||
osdshown = shown;
|
osdshown = shown;
|
||||||
|
|
||||||
// XXX: it's weird to fake a keypress like this.
|
|
||||||
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
|
||||||
// KB_KeyDown[sc_Pause] = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1044,12 +1044,12 @@ ResizeView(PLAYERp pp)
|
||||||
|
|
||||||
if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6)
|
if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6)
|
||||||
{
|
{
|
||||||
if (PKEY_PRESSED(KEYSC_DASH)||PKEY_PRESSED(KEYSC_GMINUS))
|
if (KEY_PRESSED(KEYSC_DASH)||KEY_PRESSED(KEYSC_GMINUS))
|
||||||
{
|
{
|
||||||
if ((zoom -= (zoom >> 4)) < 48) zoom = 48;
|
if ((zoom -= (zoom >> 4)) < 48) zoom = 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PKEY_PRESSED(KEYSC_EQUAL)||PKEY_PRESSED(KEYSC_GPLUS))
|
if (KEY_PRESSED(KEYSC_EQUAL)||KEY_PRESSED(KEYSC_GPLUS))
|
||||||
{
|
{
|
||||||
if ((zoom += (zoom >> 4)) > 4096) zoom = 4096;
|
if ((zoom += (zoom >> 4)) > 4096) zoom = 4096;
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,12 +231,6 @@ extern char MessageOutputString[256];
|
||||||
#define KEYSC_EPGUP sc_PgUp
|
#define KEYSC_EPGUP sc_PgUp
|
||||||
#define KEYSC_EPGDN sc_PgDn
|
#define KEYSC_EPGDN sc_PgDn
|
||||||
|
|
||||||
#undef KB_KeyPressed
|
|
||||||
#define KB_KeyPressed( scan ) \
|
|
||||||
( KB_KeyDown[( scan )])
|
|
||||||
#define KEY_PRESSED(sc) KB_KeyPressed((sc))
|
|
||||||
#define PKEY_PRESSED(sc) KB_KeyPressed((sc))
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// NETWORK - REDEFINABLE SHARED (SYNC) KEYS BIT POSITIONS
|
// NETWORK - REDEFINABLE SHARED (SYNC) KEYS BIT POSITIONS
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue