mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- moved all keyboard related code into the InputState class, so that looking for this stuff is easier.
Sadly there's 1ß00 lines of code using this...
This commit is contained in:
parent
1b65510bc2
commit
b747df60ee
50 changed files with 1009 additions and 1069 deletions
|
@ -717,7 +717,6 @@ set (PCH_SOURCES
|
|||
mact/src/animlib.cpp
|
||||
mact/src/control.cpp
|
||||
mact/src/joystick.cpp
|
||||
mact/src/keyboard.cpp
|
||||
mact/src/input.cpp
|
||||
|
||||
thirdparty/src/base64.cpp
|
||||
|
|
|
@ -409,7 +409,7 @@ void PreloadCache(void)
|
|||
int cnt = 0;
|
||||
int percentDisplayed = -1;
|
||||
|
||||
for (int i=0; i<kMaxTiles && !KB_KeyPressed(sc_Space); i++)
|
||||
for (int i=0; i<kMaxTiles && !inputState.GetKeyStatus(sc_Space); i++)
|
||||
{
|
||||
if (TestBitString(gotpic, i))
|
||||
{
|
||||
|
@ -817,7 +817,7 @@ void LocalKeys(void)
|
|||
bool alt = inputState.AltPressed();
|
||||
bool ctrl = inputState.CtrlPressed();
|
||||
bool shift = inputState.ShiftPressed();
|
||||
if (BUTTON(gamefunc_See_Chase_View) && !alt && !shift)
|
||||
if (inputState.BUTTON(gamefunc_See_Chase_View) && !alt && !shift)
|
||||
{
|
||||
inputState.ClearButton(gamefunc_See_Chase_View);
|
||||
if (gViewPos > VIEWPOS_0)
|
||||
|
@ -825,7 +825,7 @@ void LocalKeys(void)
|
|||
else
|
||||
gViewPos = VIEWPOS_1;
|
||||
}
|
||||
if (BUTTON(gamefunc_See_Coop_View))
|
||||
if (inputState.BUTTON(gamefunc_See_Coop_View))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
if (gGameOptions.nGameType == 1)
|
||||
|
@ -851,7 +851,7 @@ void LocalKeys(void)
|
|||
}
|
||||
if (gDoQuickSave)
|
||||
{
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
switch (gDoQuickSave)
|
||||
{
|
||||
case 1:
|
||||
|
@ -865,7 +865,7 @@ void LocalKeys(void)
|
|||
return;
|
||||
}
|
||||
char key;
|
||||
if ((key = keyGetScan()) != 0)
|
||||
if ((key = inputState.keyGetScan()) != 0)
|
||||
{
|
||||
if ((alt || shift) && gGameOptions.nGameType > 0 && key >= sc_F1 && key <= sc_F10)
|
||||
{
|
||||
|
@ -879,7 +879,7 @@ void LocalKeys(void)
|
|||
gPlayerMsg.Set(*CombatMacros[fk]);
|
||||
gPlayerMsg.Send();
|
||||
}
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
inputState.ClearKeyStatus(key);
|
||||
inputState.ClearButton(gamefunc_See_Chase_View);
|
||||
return;
|
||||
|
@ -895,7 +895,7 @@ void LocalKeys(void)
|
|||
}
|
||||
break;
|
||||
case sc_Escape:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (gGameStarted && gPlayer[myconnectindex].pXSprite->health != 0)
|
||||
{
|
||||
if (!gGameMenuMgr.m_bActive)
|
||||
|
@ -908,45 +908,45 @@ void LocalKeys(void)
|
|||
}
|
||||
return;
|
||||
case sc_F1:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (gGameOptions.nGameType == 0)
|
||||
gGameMenuMgr.Push(&menuOrder,-1);
|
||||
break;
|
||||
case sc_F2:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (!gGameMenuMgr.m_bActive && gGameOptions.nGameType == 0)
|
||||
gGameMenuMgr.Push(&menuSaveGame,-1);
|
||||
break;
|
||||
case sc_F3:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (!gGameMenuMgr.m_bActive && gGameOptions.nGameType == 0)
|
||||
gGameMenuMgr.Push(&menuLoadGame,-1);
|
||||
break;
|
||||
case sc_F4:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (!gGameMenuMgr.m_bActive)
|
||||
gGameMenuMgr.Push(&menuOptionsSound,-1);
|
||||
return;
|
||||
case sc_F5:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (!gGameMenuMgr.m_bActive)
|
||||
gGameMenuMgr.Push(&menuOptions,-1);
|
||||
return;
|
||||
case sc_F6:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
DoQuickSave();
|
||||
break;
|
||||
case sc_F8:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (!gGameMenuMgr.m_bActive)
|
||||
gGameMenuMgr.Push(&menuOptionsDisplayMode, -1);
|
||||
return;
|
||||
case sc_F9:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
DoQuickLoad();
|
||||
break;
|
||||
case sc_F10:
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
if (!gGameMenuMgr.m_bActive)
|
||||
gGameMenuMgr.Push(&menuQuit,-1);
|
||||
break;
|
||||
|
@ -1359,9 +1359,9 @@ RESTART:
|
|||
gRestartGame = 0;
|
||||
if (gGameOptions.nGameType > 0)
|
||||
{
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
keyFlushScans();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.keyFlushScans();
|
||||
}
|
||||
else if (gDemo.at1 && !bAddUserMap && !bNoDemo)
|
||||
gDemo.Playback();
|
||||
|
|
|
@ -45,7 +45,7 @@ BEGIN_BLD_NS
|
|||
int32_t ctrlCheckAllInput(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyWaiting() ||
|
||||
inputState.keyBufferWaiting() ||
|
||||
MOUSE_GetButtons() ||
|
||||
JOYSTICK_GetButtons()
|
||||
);
|
||||
|
@ -53,8 +53,8 @@ int32_t ctrlCheckAllInput(void)
|
|||
|
||||
void ctrlClearAllInput(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ void ctrlGetInput(void)
|
|||
if (in_aimmode)
|
||||
g_MyAimMode = 0;
|
||||
|
||||
if (BUTTON(gamefunc_Mouse_Aiming))
|
||||
if (inputState.BUTTON(gamefunc_Mouse_Aiming))
|
||||
{
|
||||
if (in_aimmode)
|
||||
g_MyAimMode = 1;
|
||||
|
@ -175,14 +175,14 @@ void ctrlGetInput(void)
|
|||
gInput.keyFlags.quit = 1;
|
||||
|
||||
if (gGameStarted && gInputMode != kInputMessage && gInputMode != kInputMenu
|
||||
&& BUTTON(gamefunc_Send_Message))
|
||||
&& inputState.BUTTON(gamefunc_Send_Message))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Send_Message);
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
gInputMode = kInputMessage;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_AutoRun))
|
||||
if (inputState.BUTTON(gamefunc_AutoRun))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_AutoRun);
|
||||
gAutoRun = !gAutoRun;
|
||||
|
@ -192,20 +192,20 @@ void ctrlGetInput(void)
|
|||
viewSetMessage("Auto run OFF");
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Map_Toggle))
|
||||
if (inputState.BUTTON(gamefunc_Map_Toggle))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Toggle);
|
||||
viewToggle(gViewMode);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode))
|
||||
if (inputState.BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
gFollowMap = !gFollowMap;
|
||||
gViewMap.FollowMode(gFollowMap);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Shrink_Screen))
|
||||
{
|
||||
if (gViewMode == 3)
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ void ctrlGetInput(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
if (gViewMode == 3)
|
||||
{
|
||||
|
@ -233,104 +233,104 @@ void ctrlGetInput(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Toggle_Crosshair))
|
||||
if (inputState.BUTTON(gamefunc_Toggle_Crosshair))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Toggle_Crosshair);
|
||||
cl_crosshair = !cl_crosshair;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Next_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Next_Weapon))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Next_Weapon);
|
||||
gInput.keyFlags.nextWeapon = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Previous_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Previous_Weapon))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Previous_Weapon);
|
||||
gInput.keyFlags.prevWeapon = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Show_Opponents_Weapon);
|
||||
cl_showweapon = (cl_showweapon + 1) & 3;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Jump))
|
||||
if (inputState.BUTTON(gamefunc_Jump))
|
||||
gInput.buttonFlags.jump = 1;
|
||||
|
||||
if (BUTTON(gamefunc_Crouch))
|
||||
if (inputState.BUTTON(gamefunc_Crouch))
|
||||
gInput.buttonFlags.crouch = 1;
|
||||
|
||||
if (BUTTON(gamefunc_Weapon_Fire))
|
||||
if (inputState.BUTTON(gamefunc_Fire))
|
||||
gInput.buttonFlags.shoot = 1;
|
||||
|
||||
if (BUTTON(gamefunc_Weapon_Special_Fire))
|
||||
if (inputState.BUTTON(gamefunc_Alt_Fire))
|
||||
gInput.buttonFlags.shoot2 = 1;
|
||||
|
||||
if (BUTTON(gamefunc_Open))
|
||||
if (inputState.BUTTON(gamefunc_Open))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
gInput.keyFlags.action = 1;
|
||||
}
|
||||
|
||||
gInput.buttonFlags.lookUp = BUTTON(gamefunc_Look_Up);
|
||||
gInput.buttonFlags.lookDown = BUTTON(gamefunc_Look_Down);
|
||||
gInput.buttonFlags.lookUp = inputState.BUTTON(gamefunc_Look_Up);
|
||||
gInput.buttonFlags.lookDown = inputState.BUTTON(gamefunc_Look_Down);
|
||||
|
||||
if (gInput.buttonFlags.lookUp || gInput.buttonFlags.lookDown)
|
||||
gInput.keyFlags.lookCenter = 1;
|
||||
else
|
||||
{
|
||||
gInput.buttonFlags.lookUp = BUTTON(gamefunc_Aim_Up);
|
||||
gInput.buttonFlags.lookDown = BUTTON(gamefunc_Aim_Down);
|
||||
gInput.buttonFlags.lookUp = inputState.BUTTON(gamefunc_Aim_Up);
|
||||
gInput.buttonFlags.lookDown = inputState.BUTTON(gamefunc_Aim_Down);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Aim_Center))
|
||||
if (inputState.BUTTON(gamefunc_Aim_Center))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Aim_Center);
|
||||
gInput.keyFlags.lookCenter = 1;
|
||||
}
|
||||
|
||||
gInput.keyFlags.spin180 = BUTTON(gamefunc_Turn_Around);
|
||||
gInput.keyFlags.spin180 = inputState.BUTTON(gamefunc_Turn_Around);
|
||||
|
||||
if (BUTTON(gamefunc_Inventory_Left))
|
||||
if (inputState.BUTTON(gamefunc_Inventory_Left))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Inventory_Left);
|
||||
gInput.keyFlags.prevItem = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Inventory_Right))
|
||||
if (inputState.BUTTON(gamefunc_Inventory_Right))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Inventory_Right);
|
||||
gInput.keyFlags.nextItem = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Inventory_Use))
|
||||
if (inputState.BUTTON(gamefunc_Inventory_Use))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Inventory_Use);
|
||||
gInput.keyFlags.useItem = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_BeastVision))
|
||||
if (inputState.BUTTON(gamefunc_BeastVision))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_BeastVision);
|
||||
gInput.useFlags.useBeastVision = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_CrystalBall))
|
||||
if (inputState.BUTTON(gamefunc_CrystalBall))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_CrystalBall);
|
||||
gInput.useFlags.useCrystalBall = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_JumpBoots))
|
||||
if (inputState.BUTTON(gamefunc_JumpBoots))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_JumpBoots);
|
||||
gInput.useFlags.useJumpBoots = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_MedKit))
|
||||
if (inputState.BUTTON(gamefunc_MedKit))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_MedKit);
|
||||
gInput.useFlags.useMedKit = 1;
|
||||
|
@ -338,60 +338,60 @@ void ctrlGetInput(void)
|
|||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (BUTTON(gamefunc_Weapon_1 + i))
|
||||
if (inputState.BUTTON(gamefunc_Weapon_1 + i))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Weapon_1 + i);
|
||||
gInput.newWeapon = 1 + i;
|
||||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_ProximityBombs))
|
||||
if (inputState.BUTTON(gamefunc_ProximityBombs))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_ProximityBombs);
|
||||
gInput.newWeapon = 11;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_RemoteBombs))
|
||||
if (inputState.BUTTON(gamefunc_RemoteBombs))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_RemoteBombs);
|
||||
gInput.newWeapon = 12;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Holster_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Holster_Weapon))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Holster_Weapon);
|
||||
gInput.keyFlags.holsterWeapon = 1;
|
||||
}
|
||||
|
||||
char run = G_CheckAutorun(BUTTON(gamefunc_Run));
|
||||
char run2 = false; // What??? BUTTON(gamefunc_Run);
|
||||
char run = G_CheckAutorun(inputState.BUTTON(gamefunc_Run));
|
||||
char run2 = false; // What??? inputState.BUTTON(gamefunc_Run);
|
||||
|
||||
gInput.syncFlags.run = run;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Forward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward))
|
||||
forward += (1+run)<<10;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Backward))
|
||||
forward -= (1+run)<<10;
|
||||
|
||||
char turnLeft = 0, turnRight = 0;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (inputState.BUTTON(gamefunc_Strafe))
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left))
|
||||
strafe += (1 + run) << 10;
|
||||
if (BUTTON(gamefunc_Turn_Right))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Right))
|
||||
strafe -= (1 + run) << 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Strafe_Left))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Left))
|
||||
strafe += (1 + run) << 10;
|
||||
if (BUTTON(gamefunc_Strafe_Right))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Right))
|
||||
strafe -= (1 + run) << 10;
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left))
|
||||
turnLeft = 1;
|
||||
if (BUTTON(gamefunc_Turn_Right))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Right))
|
||||
turnRight = 1;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ void ctrlGetInput(void)
|
|||
if ((run2 || run) && iTurnCount > 24)
|
||||
turn <<= 1;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (inputState.BUTTON(gamefunc_Strafe))
|
||||
strafe = ClipRange(strafe - info.mousex, -2048, 2048);
|
||||
else
|
||||
turn = fix16_clamp(turn + fix16_div(fix16_from_int(info.mousex), F16(32)), F16(-1024)>>2, F16(1024)>>2);
|
||||
|
@ -428,10 +428,10 @@ void ctrlGetInput(void)
|
|||
if (!in_mouseflip)
|
||||
gInput.q16mlook = -gInput.q16mlook;
|
||||
|
||||
if (KB_KeyPressed(sc_Pause)) // 0xc5 in disassembly
|
||||
if (inputState.GetKeyStatus(sc_Pause)) // 0xc5 in disassembly
|
||||
{
|
||||
gInput.keyFlags.pause = 1;
|
||||
KB_ClearKeyDown(sc_Pause);
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
}
|
||||
|
||||
if (!gViewMap.bFollowMode && gViewMode == 4)
|
||||
|
|
|
@ -48,7 +48,7 @@ char Wait(int nTicks)
|
|||
while (totalclock < nTicks)
|
||||
{
|
||||
gameHandleEvents();
|
||||
char key = keyGetScan();
|
||||
char key = inputState.keyGetScan();
|
||||
if (key)
|
||||
{
|
||||
if (key == sc_Escape) // sc_Escape
|
||||
|
@ -71,7 +71,7 @@ char DoFade(char r, char g, char b, int nTicks)
|
|||
gFrameClock += 2;
|
||||
scrNextPage();
|
||||
scrFadeAmount(divscale16(ClipHigh((int)totalclock, nTicks), nTicks));
|
||||
if (keyGetScan())
|
||||
if (inputState.keyGetScan())
|
||||
return 0;
|
||||
} while (totalclock <= nTicks);
|
||||
#endif
|
||||
|
@ -90,7 +90,7 @@ char DoUnFade(int nTicks)
|
|||
gFrameClock += 2;
|
||||
scrNextPage();
|
||||
scrFadeAmount(0x10000-divscale16(ClipHigh((int)totalclock, nTicks), nTicks));
|
||||
if (keyGetScan())
|
||||
if (inputState.keyGetScan())
|
||||
return 0;
|
||||
} while (totalclock <= nTicks);
|
||||
#endif
|
||||
|
|
|
@ -289,7 +289,7 @@ void CDemo::ProcessKeys(void)
|
|||
case kInputGame:
|
||||
{
|
||||
char nKey;
|
||||
while ((nKey = keyGetScan()) != 0)
|
||||
while ((nKey = inputState.keyGetScan()) != 0)
|
||||
{
|
||||
switch (nKey)
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ void CEndGameMgr::ProcessKeys(void)
|
|||
//}
|
||||
//else
|
||||
{
|
||||
char ch = keyGetScan();
|
||||
char ch = inputState.keyGetScan();
|
||||
if (!ch)
|
||||
return;
|
||||
if (gGameOptions.nGameType > 0 || numplayers > 1)
|
||||
|
@ -103,7 +103,7 @@ void CEndGameMgr::Setup(void)
|
|||
at0 = 1;
|
||||
EndLevel();
|
||||
sndStartSample(268, 128, -1, 1);
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
}
|
||||
|
||||
//int gNextLevel;
|
||||
|
|
|
@ -230,10 +230,10 @@ void CGameMenuMgr::Process(void)
|
|||
event.at0 = 0;
|
||||
event.at2 = 0;
|
||||
char key;
|
||||
if (!pActiveMenu->MouseEvent(event) && (key = keyGetScan()) != 0 )
|
||||
if (!pActiveMenu->MouseEvent(event) && (key = inputState.keyGetScan()) != 0 )
|
||||
{
|
||||
keyFlushScans();
|
||||
keyFlushChars();
|
||||
inputState.keyFlushScans();
|
||||
inputState.keyFlushChars();
|
||||
event.at2 = key;
|
||||
switch (key)
|
||||
{
|
||||
|
@ -293,8 +293,8 @@ void CGameMenuMgr::Process(void)
|
|||
void CGameMenuMgr::Deactivate(void)
|
||||
{
|
||||
Clear();
|
||||
keyFlushScans();
|
||||
keyFlushChars();
|
||||
inputState.keyFlushScans();
|
||||
inputState.keyFlushChars();
|
||||
m_bActive = false;
|
||||
|
||||
mouseLockToWindow(1);
|
||||
|
@ -1121,10 +1121,9 @@ CGameMenuItemKeyList::CGameMenuItemKeyList(const char *a1, int a2, int a3, int a
|
|||
|
||||
void CGameMenuItemKeyList::Scan(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_FlushKeyboardQueueScans();
|
||||
KB_ClearKeysDown();
|
||||
KB_LastScan = 0;
|
||||
inputState.keyFlushChars();
|
||||
inputState.keyFlushScans();
|
||||
inputState.ClearKeysDown();
|
||||
bScan = true;
|
||||
}
|
||||
|
||||
|
@ -1199,17 +1198,17 @@ bool CGameMenuItemKeyList::Event(CGameMenuEvent &event)
|
|||
{
|
||||
if (bScan)
|
||||
{
|
||||
if (KB_LastScan && KB_LastScan != sc_Pause)
|
||||
if (inputState.GetLastScanCode() && inputState.GetLastScanCode() != sc_Pause)
|
||||
{
|
||||
if (KB_KeyWaiting())
|
||||
KB_GetCh();
|
||||
if (inputState.keyBufferWaiting())
|
||||
inputState.keyGetChar();
|
||||
|
||||
Bindings.SetBind(KB_LastScan, CONFIG_FunctionNumToName(nFocus));
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_FlushKeyboardQueueScans();
|
||||
KB_ClearKeysDown();
|
||||
keyFlushScans();
|
||||
keyFlushChars();
|
||||
Bindings.SetBind(inputState.GetLastScanCode(), CONFIG_FunctionNumToName(nFocus));
|
||||
inputState.keyFlushChars();
|
||||
inputState.keyFlushScans();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushScans();
|
||||
inputState.keyFlushChars();
|
||||
bScan = 0;
|
||||
}
|
||||
return false;
|
||||
|
@ -2049,8 +2048,8 @@ bool CGameMenuItemZEditBitmap::Event(CGameMenuEvent &event)
|
|||
gGameMenuMgr.m_bScanning = false;
|
||||
}
|
||||
gSaveGameActive = false;
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
KB_ClearKeyDown(sc_kpad_Enter);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_kpad_Enter);
|
||||
return false;
|
||||
}
|
||||
strncpy(buffer, at20, at24);
|
||||
|
|
|
@ -29,9 +29,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#define BGSTRETCH (hud_bgstretch ? 1024 : 0)
|
||||
|
||||
#define WIN_IS_PRESSED ( KB_KeyPressed( sc_RightWin ) || KB_KeyPressed( sc_LeftWin ) )
|
||||
#define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) )
|
||||
#define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) )
|
||||
#define WIN_IS_PRESSED ( inputState.GetKeyStatus( sc_RightWin ) || inputState.GetKeyStatus( sc_LeftWin ) )
|
||||
#define ALT_IS_PRESSED ( inputState.GetKeyStatus( sc_RightAlt ) || inputState.GetKeyStatus( sc_LeftAlt ) )
|
||||
#define SHIFTS_IS_PRESSED ( inputState.GetKeyStatus( sc_RightShift ) || inputState.GetKeyStatus( sc_LeftShift ) )
|
||||
|
||||
#define TRAVERSE_SPRITE_SECT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n)
|
||||
#define TRAVERSE_SPRITE_STAT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n)
|
||||
|
|
|
@ -580,14 +580,14 @@ void CPlayerMsg::Send(void)
|
|||
}
|
||||
|
||||
Term();
|
||||
keyFlushScans();
|
||||
inputState.keyFlushScans();
|
||||
}
|
||||
|
||||
void CPlayerMsg::ProcessKeys(void)
|
||||
{
|
||||
if (KB_KeyPressed(sc_Escape)) Term();
|
||||
if (inputState.GetKeyStatus(sc_Escape)) Term();
|
||||
#if 0
|
||||
int key = keyGetScan();
|
||||
int key = inputState.keyGetScan();
|
||||
int ch;
|
||||
if (key != 0)
|
||||
{
|
||||
|
|
|
@ -1012,7 +1012,7 @@ void netInitialize(bool bConsole)
|
|||
netServerDisconnect();
|
||||
QuitGame();
|
||||
}
|
||||
if (!bConsole && KB_KeyPressed(sc_Escape))
|
||||
if (!bConsole && inputState.GetKeyStatus(sc_Escape))
|
||||
{
|
||||
netServerDisconnect();
|
||||
netDeinitialize();
|
||||
|
@ -1173,7 +1173,7 @@ void netInitialize(bool bConsole)
|
|||
netClientDisconnect();
|
||||
QuitGame();
|
||||
}
|
||||
if (!bConsole && KB_KeyPressed(sc_Escape))
|
||||
if (!bConsole && inputState.GetKeyStatus(sc_Escape))
|
||||
{
|
||||
netClientDisconnect();
|
||||
netDeinitialize();
|
||||
|
|
|
@ -107,14 +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,
|
||||
};
|
||||
|
||||
extern char g_keyFIFO[KEYFIFOSIZ];
|
||||
extern char g_keyAsciiFIFO[KEYFIFOSIZ];
|
||||
extern uint8_t g_keyAsciiPos;
|
||||
extern uint8_t g_keyAsciiEnd;
|
||||
extern uint8_t g_keyFIFOend;
|
||||
|
||||
extern void keySetState(int32_t key, int32_t state);
|
||||
|
||||
// mouse
|
||||
extern vec2_t g_mousePos;
|
||||
extern vec2_t g_mouseAbs;
|
||||
|
@ -179,24 +171,6 @@ void joySetCallback(void (*callback)(int32_t,int32_t));
|
|||
const char *joyGetName(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat
|
||||
void joyScanDevices(void);
|
||||
|
||||
char keyGetScan(void);
|
||||
char keyGetChar(void);
|
||||
#define keyBufferWaiting() (g_keyAsciiPos != g_keyAsciiEnd)
|
||||
|
||||
static FORCE_INLINE int keyBufferFull(void)
|
||||
{
|
||||
return ((g_keyAsciiEnd+1)&(KEYFIFOSIZ-1)) == g_keyAsciiPos;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void keyBufferInsert(char code)
|
||||
{
|
||||
g_keyAsciiFIFO[g_keyAsciiEnd] = code;
|
||||
g_keyAsciiEnd = ((g_keyAsciiEnd+1)&(KEYFIFOSIZ-1));
|
||||
}
|
||||
|
||||
void keyFlushScans(void);
|
||||
void keyFlushChars(void);
|
||||
|
||||
void mouseInit(void);
|
||||
void mouseUninit(void);
|
||||
int32_t mouseReadAbs(vec2_t *pResult, vec2_t const *pInput);
|
||||
|
|
|
@ -26,68 +26,11 @@ int32_t g_borderless=2;
|
|||
// input
|
||||
char inputdevices = 0;
|
||||
|
||||
char g_keyFIFO[KEYFIFOSIZ];
|
||||
char g_keyAsciiFIFO[KEYFIFOSIZ];
|
||||
uint8_t g_keyFIFOpos;
|
||||
uint8_t g_keyFIFOend;
|
||||
uint8_t g_keyAsciiPos;
|
||||
uint8_t g_keyAsciiEnd;
|
||||
|
||||
void (*keypresscallback)(int32_t, int32_t);
|
||||
|
||||
void keySetCallback(void (*callback)(int32_t, int32_t)) { keypresscallback = callback; }
|
||||
|
||||
void keySetState(int32_t key, int32_t state)
|
||||
{
|
||||
inputState.SetKeyStatus(key, state);
|
||||
event_t ev = { (uint8_t)(state ? EV_KeyDown : EV_KeyUp), 0, (uint16_t)key };
|
||||
|
||||
D_PostEvent(&ev);
|
||||
|
||||
if (state)
|
||||
{
|
||||
g_keyFIFO[g_keyFIFOend] = key;
|
||||
g_keyFIFO[(g_keyFIFOend+1)&(KEYFIFOSIZ-1)] = state;
|
||||
g_keyFIFOend = ((g_keyFIFOend+2)&(KEYFIFOSIZ-1));
|
||||
}
|
||||
}
|
||||
|
||||
char keyGetScan(void)
|
||||
{
|
||||
if (g_keyFIFOpos == g_keyFIFOend)
|
||||
return 0;
|
||||
|
||||
char const c = g_keyFIFO[g_keyFIFOpos];
|
||||
g_keyFIFOpos = ((g_keyFIFOpos + 2) & (KEYFIFOSIZ - 1));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void keyFlushScans(void)
|
||||
{
|
||||
Bmemset(&g_keyFIFO,0,sizeof(g_keyFIFO));
|
||||
g_keyFIFOpos = g_keyFIFOend = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// character-based input functions
|
||||
//
|
||||
char keyGetChar(void)
|
||||
{
|
||||
if (g_keyAsciiPos == g_keyAsciiEnd)
|
||||
return 0;
|
||||
|
||||
char const c = g_keyAsciiFIFO[g_keyAsciiPos];
|
||||
g_keyAsciiPos = ((g_keyAsciiPos + 1) & (KEYFIFOSIZ - 1));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void keyFlushChars(void)
|
||||
{
|
||||
Bmemset(&g_keyAsciiFIFO,0,sizeof(g_keyAsciiFIFO));
|
||||
g_keyAsciiPos = g_keyAsciiEnd = 0;
|
||||
}
|
||||
|
||||
vec2_t g_mousePos;
|
||||
vec2_t g_mouseAbs;
|
||||
|
|
|
@ -1249,7 +1249,7 @@ void OSD_CaptureInput(int cap)
|
|||
mouseGrabInput(cap == 0 ? g_mouseLockedToWindow : 0);
|
||||
onshowosd(cap);
|
||||
|
||||
keyFlushChars();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1889,10 +1889,10 @@ int32_t handleevents_pollsdl(void)
|
|||
{
|
||||
code = ev.text.text[j];
|
||||
|
||||
if (code != g_keyAsciiTable[OSD_OSDKey()] && !keyBufferFull())
|
||||
if (code != g_keyAsciiTable[OSD_OSDKey()] && !inputState.keyBufferFull())
|
||||
{
|
||||
if (OSD_HandleChar(code))
|
||||
keyBufferInsert(code);
|
||||
inputState.keyBufferInsert(code);
|
||||
}
|
||||
} while (j < SDL_TEXTINPUTEVENT_TEXT_SIZE-1 && ev.text.text[++j]);
|
||||
break;
|
||||
|
@ -1910,7 +1910,7 @@ int32_t handleevents_pollsdl(void)
|
|||
KMOD_LALT|KMOD_RALT|KMOD_LGUI|KMOD_RGUI;
|
||||
|
||||
// XXX: see osd.c, OSD_HandleChar(), there are more...
|
||||
if (ev.key.type == SDL_KEYDOWN && !keyBufferFull() &&
|
||||
if (ev.key.type == SDL_KEYDOWN && !inputState.keyBufferFull() &&
|
||||
(sc == SDL_SCANCODE_RETURN || sc == SDL_SCANCODE_KP_ENTER ||
|
||||
sc == SDL_SCANCODE_ESCAPE ||
|
||||
sc == SDL_SCANCODE_BACKSPACE ||
|
||||
|
@ -1928,10 +1928,10 @@ int32_t handleevents_pollsdl(void)
|
|||
default: keyvalue = sc - SDL_SCANCODE_A + 1; break; // Ctrl+A --> 1, etc.
|
||||
}
|
||||
if (OSD_HandleChar(keyvalue))
|
||||
keyBufferInsert(keyvalue);
|
||||
inputState.keyBufferInsert(keyvalue);
|
||||
}
|
||||
else if (ev.key.type == SDL_KEYDOWN &&
|
||||
ev.key.keysym.sym != g_keyAsciiTable[OSD_OSDKey()] && !keyBufferFull() &&
|
||||
ev.key.keysym.sym != g_keyAsciiTable[OSD_OSDKey()] && !inputState.keyBufferFull() &&
|
||||
!SDL_IsTextInputActive())
|
||||
{
|
||||
/*
|
||||
|
@ -2007,7 +2007,7 @@ int32_t handleevents_pollsdl(void)
|
|||
if ((unsigned)keyvalue <= 0x7Fu)
|
||||
{
|
||||
if (OSD_HandleChar(keyvalue))
|
||||
keyBufferInsert(keyvalue);
|
||||
inputState.keyBufferInsert(keyvalue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2025,7 +2025,7 @@ int32_t handleevents_pollsdl(void)
|
|||
if (keypresscallback)
|
||||
keypresscallback(j, 0);
|
||||
}
|
||||
keySetState(j, 0);
|
||||
inputState.keySetState(j, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2038,7 +2038,7 @@ int32_t handleevents_pollsdl(void)
|
|||
if (keypresscallback)
|
||||
keypresscallback(code, 1);
|
||||
}
|
||||
keySetState(code, 1);
|
||||
inputState.keySetState(code, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2049,7 +2049,7 @@ int32_t handleevents_pollsdl(void)
|
|||
if (code == 0x59) // pause
|
||||
break;
|
||||
# endif
|
||||
keySetState(code, 0);
|
||||
inputState.keySetState(code, 0);
|
||||
if (keypresscallback)
|
||||
keypresscallback(code, 0);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
int eventhead;
|
||||
int eventtail;
|
||||
event_t events[MAXEVENTS];
|
||||
event_t events[NUM_EVENTS];
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -138,7 +138,7 @@ bool G_Responder (event_t *ev)
|
|||
void D_ProcessEvents (void)
|
||||
{
|
||||
event_t *ev;
|
||||
for (; eventtail != eventhead ; eventtail = (eventtail+1)&(MAXEVENTS-1))
|
||||
for (; eventtail != eventhead ; eventtail = (eventtail+1)&(NUM_EVENTS-1))
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
if (ev->type == EV_None)
|
||||
|
@ -193,7 +193,7 @@ void D_PostEvent (const event_t *ev)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
eventhead = (eventhead+1)&(MAXEVENTS-1);
|
||||
eventhead = (eventhead+1)&(NUM_EVENTS-1);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -213,7 +213,7 @@ void D_PostEvent (const event_t *ev)
|
|||
void D_RemoveNextCharEvent()
|
||||
{
|
||||
assert(events[eventtail].type == EV_GUI_Event && events[eventtail].subtype == EV_GUI_KeyDown);
|
||||
for (int evnum = eventtail; evnum != eventhead; evnum = (evnum+1) & (MAXEVENTS-1))
|
||||
for (int evnum = eventtail; evnum != eventhead; evnum = (evnum+1) & (NUM_EVENTS-1))
|
||||
{
|
||||
event_t *ev = &events[evnum];
|
||||
if (ev->type != EV_GUI_Event)
|
||||
|
|
|
@ -65,9 +65,12 @@ void D_ProcessEvents(void);
|
|||
//
|
||||
// GLOBAL VARIABLES
|
||||
//
|
||||
#define MAXEVENTS 128
|
||||
enum
|
||||
{
|
||||
NUM_EVENTS = 128
|
||||
};
|
||||
|
||||
extern event_t events[MAXEVENTS];
|
||||
extern event_t events[NUM_EVENTS];
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -96,8 +96,6 @@ static const GameFuncNameDesc gamefuncs[] = {
|
|||
{ gamefunc_Toggle_Crouch, "Toggle_Crouch"},
|
||||
{ gamefunc_See_Chase_View, "See_Chase_View"}, // the following were added by Blood
|
||||
{ gamefunc_Turn_Around, "Turn_Around"},
|
||||
{ gamefunc_Weapon_Fire, "Weapon_Fire"},
|
||||
{ gamefunc_Weapon_Special_Fire, "Weapon_Special_Fire"},
|
||||
{ gamefunc_Aim_Center, "Aim_Center"},
|
||||
{ gamefunc_Tilt_Left, "Tilt_Left"},
|
||||
{ gamefunc_Tilt_Right, "Tilt_Right"},
|
||||
|
@ -621,7 +619,7 @@ int32_t JoystickAnalogueInvert[MAXJOYAXES];
|
|||
|
||||
static const char* mousedefaults[MAXMOUSEBUTTONS] =
|
||||
{
|
||||
"Weapon_Fire",
|
||||
"Fire",
|
||||
"Weapon_Special_Fire",
|
||||
"",
|
||||
"",
|
||||
|
@ -1156,7 +1154,7 @@ FString CONFIG_GetGameFuncOnMouse(int gameFunc)
|
|||
auto keys = Bindings.GetKeysForCommand(binding);
|
||||
for (auto key : keys)
|
||||
{
|
||||
if (key >= KEY_FIRSTMOUSEBUTTON && key < KEY_FIRSTJOYBUTTON)
|
||||
if ((key >= KEY_FIRSTMOUSEBUTTON && key < KEY_FIRSTJOYBUTTON) || (key >= KEY_MWHEELUP && key <= KEY_MWHEELLEFT))
|
||||
{
|
||||
auto scan = KB_ScanCodeToString(key);
|
||||
if (scan) return scan;
|
||||
|
@ -1172,7 +1170,7 @@ char const* CONFIG_GetGameFuncOnJoystick(int gameFunc)
|
|||
auto keys = Bindings.GetKeysForCommand(binding);
|
||||
for (auto key : keys)
|
||||
{
|
||||
if (key >= KEY_FIRSTJOYBUTTON)
|
||||
if (key >= KEY_FIRSTJOYBUTTON && !(key >= KEY_MWHEELUP && key <= KEY_MWHEELLEFT))
|
||||
{
|
||||
auto scan = KB_ScanCodeToString(key);
|
||||
if (scan) return scan;
|
||||
|
@ -1245,9 +1243,9 @@ void CONFIG_InitMouseAndController()
|
|||
}
|
||||
CONFIG_SetupMouse();
|
||||
CONFIG_SetupJoystick();
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_FlushKeyboardQueueScans();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.keyFlushScans();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
#include "tarray.h"
|
||||
#include "scancodes.h"
|
||||
#include "c_bind.h"
|
||||
#include "d_event.h"
|
||||
|
||||
typedef uint8_t kb_scancode;
|
||||
|
||||
extern kb_scancode KB_LastScan;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* key;
|
||||
|
@ -103,8 +102,6 @@ enum GameFunction_t
|
|||
gamefunc_Toggle_Crouch,
|
||||
gamefunc_See_Chase_View, // this was added by Blood
|
||||
gamefunc_Turn_Around,
|
||||
gamefunc_Weapon_Fire,
|
||||
gamefunc_Weapon_Special_Fire,
|
||||
gamefunc_Aim_Center,
|
||||
gamefunc_Tilt_Left,
|
||||
gamefunc_Tilt_Right,
|
||||
|
@ -125,6 +122,10 @@ enum GameFunction_t
|
|||
|
||||
class InputState
|
||||
{
|
||||
enum
|
||||
{
|
||||
KEYFIFOSIZ = 64,
|
||||
};
|
||||
// NOTE: This entire thing is mostly a band-aid to wrap something around MACT so that replacing it with a true event-driven system later
|
||||
// won't result in a total disaster. None of this is meant to live for long because the input method at use here is fundamentally flawed
|
||||
// because it does not track what triggered the button.
|
||||
|
@ -137,6 +138,15 @@ class InputState
|
|||
ButtonStateFlags ButtonState[NUMGAMEFUNCTIONS];
|
||||
uint8_t KeyStatus[NUMKEYS];
|
||||
|
||||
char g_keyFIFO[KEYFIFOSIZ];
|
||||
char g_keyAsciiFIFO[KEYFIFOSIZ];
|
||||
uint8_t g_keyFIFOpos;
|
||||
uint8_t g_keyFIFOend;
|
||||
uint8_t g_keyAsciiPos;
|
||||
uint8_t g_keyAsciiEnd;
|
||||
|
||||
kb_scancode KB_LastScan;
|
||||
|
||||
public:
|
||||
|
||||
bool BUTTON(int x)
|
||||
|
@ -219,33 +229,113 @@ public:
|
|||
CONTROL_BindsEnabled = on;
|
||||
}
|
||||
|
||||
bool keyBufferWaiting()
|
||||
{
|
||||
return (g_keyAsciiPos != g_keyAsciiEnd);
|
||||
}
|
||||
|
||||
int keyBufferFull(void)
|
||||
{
|
||||
return ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)) == g_keyAsciiPos;
|
||||
}
|
||||
|
||||
void keyBufferInsert(char code)
|
||||
{
|
||||
g_keyAsciiFIFO[g_keyAsciiEnd] = code;
|
||||
g_keyAsciiEnd = ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1));
|
||||
}
|
||||
|
||||
void keySetState(int32_t key, int32_t state)
|
||||
{
|
||||
SetKeyStatus(key, state);
|
||||
event_t ev = { (uint8_t)(state ? EV_KeyDown : EV_KeyUp), 0, (int16_t)key };
|
||||
|
||||
D_PostEvent(&ev);
|
||||
|
||||
if (state)
|
||||
{
|
||||
g_keyFIFO[g_keyFIFOend] = key;
|
||||
g_keyFIFO[(g_keyFIFOend + 1) & (KEYFIFOSIZ - 1)] = state;
|
||||
g_keyFIFOend = ((g_keyFIFOend + 2) & (KEYFIFOSIZ - 1));
|
||||
}
|
||||
}
|
||||
|
||||
char keyGetScan(void)
|
||||
{
|
||||
if (g_keyFIFOpos == g_keyFIFOend)
|
||||
return 0;
|
||||
|
||||
char const c = g_keyFIFO[g_keyFIFOpos];
|
||||
g_keyFIFOpos = ((g_keyFIFOpos + 2) & (KEYFIFOSIZ - 1));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void keyFlushScans(void)
|
||||
{
|
||||
Bmemset(&g_keyFIFO, 0, sizeof(g_keyFIFO));
|
||||
g_keyFIFOpos = g_keyFIFOend = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// character-based input functions
|
||||
//
|
||||
char keyGetChar(void)
|
||||
{
|
||||
if (g_keyAsciiPos == g_keyAsciiEnd)
|
||||
return 0;
|
||||
|
||||
char const c = g_keyAsciiFIFO[g_keyAsciiPos];
|
||||
g_keyAsciiPos = ((g_keyAsciiPos + 1) & (KEYFIFOSIZ - 1));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void keyFlushChars(void)
|
||||
{
|
||||
Bmemset(&g_keyAsciiFIFO, 0, sizeof(g_keyAsciiFIFO));
|
||||
g_keyAsciiPos = g_keyAsciiEnd = 0;
|
||||
}
|
||||
|
||||
inline bool UnboundKeyPressed(int scan)
|
||||
{
|
||||
return (GetKeyStatus(scan) != 0 && Bindings.GetBind(scan) == nullptr);
|
||||
}
|
||||
|
||||
|
||||
kb_scancode GetLastScanCode()
|
||||
{
|
||||
return (KB_LastScan);
|
||||
}
|
||||
|
||||
void SetLastScanCode(kb_scancode scancode)
|
||||
{
|
||||
KB_LastScan = (scancode);
|
||||
}
|
||||
|
||||
void ClearLastScanCode()
|
||||
{
|
||||
KB_LastScan = sc_None;
|
||||
}
|
||||
|
||||
void ClearKeysDown(void)
|
||||
{
|
||||
KB_LastScan = 0;
|
||||
ClearAllKeyStatus();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
extern InputState inputState;
|
||||
|
||||
inline bool BUTTON(int x)
|
||||
static inline void KB_KeyEvent(int32_t scancode, int32_t keypressed)
|
||||
{
|
||||
return inputState.BUTTON(x);
|
||||
if (keypressed) inputState.SetLastScanCode(scancode);
|
||||
}
|
||||
|
||||
inline uint8_t KB_KeyPressed(int scan)
|
||||
{
|
||||
return inputState.GetKeyStatus(scan);
|
||||
}
|
||||
void keySetCallback(void (*callback)(int32_t, int32_t));
|
||||
inline void KB_Startup(void) { keySetCallback(KB_KeyEvent); }
|
||||
inline void KB_Shutdown(void) { keySetCallback((void (*)(int32_t, int32_t))NULL); }
|
||||
|
||||
inline void KB_ClearKeyDown(int scan)
|
||||
{
|
||||
inputState.ClearKeyStatus(scan);
|
||||
}
|
||||
|
||||
inline bool KB_UnBoundKeyPressed(int scan)
|
||||
{
|
||||
return (inputState.GetKeyStatus(scan) != 0 && Bindings.GetBind(scan) == nullptr);
|
||||
}
|
||||
|
||||
inline void KB_ClearKeysDown(void)
|
||||
{
|
||||
KB_LastScan = 0;
|
||||
inputState.ClearAllKeyStatus();
|
||||
}
|
||||
|
|
|
@ -32,31 +32,9 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|||
|
||||
#include "baselayer.h" // for the keyboard stuff
|
||||
#include "scancodes.h"
|
||||
#include "inputstate.h"
|
||||
#include "c_bind.h"
|
||||
|
||||
extern kb_scancode KB_LastScan;
|
||||
|
||||
#define KB_GetLastScanCode() (KB_LastScan)
|
||||
#define KB_SetLastScanCode(scancode) \
|
||||
{ \
|
||||
KB_LastScan = (scancode); \
|
||||
}
|
||||
#define KB_ClearLastScanCode() \
|
||||
{ \
|
||||
KB_SetLastScanCode(sc_None); \
|
||||
}
|
||||
#define KB_GetCh keyGetChar
|
||||
#define KB_KeyWaiting keyBufferWaiting
|
||||
#define KB_FlushKeyboardQueue keyFlushChars
|
||||
#define KB_FlushKeyboardQueueScans keyFlushScans
|
||||
|
||||
static inline void KB_KeyEvent(int32_t scancode, int32_t keypressed)
|
||||
{
|
||||
if (keypressed)
|
||||
KB_LastScan = scancode;
|
||||
}
|
||||
|
||||
void KB_Startup(void);
|
||||
void KB_Shutdown(void);
|
||||
const char * KB_ScanCodeToString( int scancode ); // convert scancode into a string
|
||||
int KB_StringToScanCode( const char * string ); // convert a string into a scancode
|
||||
|
|
@ -248,7 +248,7 @@ static void G_CheatGetInv(DukePlayer_t *pPlayer)
|
|||
static void end_cheat(DukePlayer_t * const pPlayer)
|
||||
{
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
static int32_t cheatbuflen;
|
||||
|
@ -310,9 +310,9 @@ void G_DoCheats(void)
|
|||
{
|
||||
int ch;
|
||||
|
||||
while (KB_KeyWaiting())
|
||||
while (inputState.keyBufferWaiting())
|
||||
{
|
||||
ch = Btolower(KB_GetCh());
|
||||
ch = Btolower(inputState.keyGetChar());
|
||||
|
||||
if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')))
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ void G_DoCheats(void)
|
|||
// cheat string matching logic below.
|
||||
Bassert(cheatbuflen < (signed)sizeof(cheatbuf));
|
||||
cheatbuf[cheatbuflen] = 0;
|
||||
// KB_ClearKeysDown();
|
||||
// inputState.ClearKeysDown();
|
||||
|
||||
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
|
||||
{
|
||||
|
@ -434,7 +434,7 @@ void G_DoCheats(void)
|
|||
|
||||
case CHEAT_KEYS:
|
||||
pPlayer->got_access = 7;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
P_DoQuote(QUOTE_CHEAT_ALL_KEYS, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
@ -465,7 +465,7 @@ void G_DoCheats(void)
|
|||
case CHEAT_ALLEN:
|
||||
P_DoQuote(QUOTE_CHEAT_ALLEN, pPlayer);
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_ClearKeyDown(sc_N);
|
||||
inputState.ClearKeyStatus(sc_N);
|
||||
return;
|
||||
|
||||
case CHEAT_CORNHOLIO:
|
||||
|
@ -628,7 +628,7 @@ void G_DoCheats(void)
|
|||
|
||||
case CHEAT_CASHMAN:
|
||||
ud.cashman = 1-ud.cashman;
|
||||
KB_ClearKeyDown(sc_N);
|
||||
inputState.ClearKeyStatus(sc_N);
|
||||
pPlayer->cheat_phase = 0;
|
||||
return;
|
||||
|
||||
|
@ -675,7 +675,7 @@ void G_DoCheats(void)
|
|||
|
||||
case CHEAT_BETA:
|
||||
P_DoQuote(QUOTE_CHEAT_BETA, pPlayer);
|
||||
KB_ClearKeyDown(sc_H);
|
||||
inputState.ClearKeyStatus(sc_H);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
|
@ -705,7 +705,7 @@ void G_DoCheats(void)
|
|||
ud.eog = 1;
|
||||
pPlayer->player_par = 0;
|
||||
pPlayer->gm |= MODE_EOL;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -717,17 +717,17 @@ void G_DoCheats(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (KB_KeyPressed((uint8_t) CheatKeys[0]))
|
||||
if (inputState.GetKeyStatus((uint8_t) CheatKeys[0]))
|
||||
{
|
||||
if (pPlayer->cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0)
|
||||
{
|
||||
if (CheatKeys[0] == CheatKeys[1])
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[0]);
|
||||
inputState.ClearKeyStatus((uint8_t) CheatKeys[0]);
|
||||
pPlayer->cheat_phase = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (KB_KeyPressed((uint8_t) CheatKeys[1]))
|
||||
if (inputState.GetKeyStatus((uint8_t) CheatKeys[1]))
|
||||
{
|
||||
if (pPlayer->cheat_phase == -1)
|
||||
{
|
||||
|
@ -742,13 +742,13 @@ void G_DoCheats(void)
|
|||
// P_DoQuote(QUOTE_25,pPlayer);
|
||||
cheatbuflen = 0;
|
||||
}
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
else if (pPlayer->cheat_phase != 0)
|
||||
{
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[0]);
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[1]);
|
||||
inputState.ClearKeyStatus((uint8_t) CheatKeys[0]);
|
||||
inputState.ClearKeyStatus((uint8_t) CheatKeys[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -907,9 +907,9 @@ nextdemo_nomenu:
|
|||
{
|
||||
ControlInfo noshareinfo;
|
||||
CONTROL_GetInput(&noshareinfo);
|
||||
if (BUTTON(gamefunc_SendMessage))
|
||||
if (inputState.BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
g_player[myconnectindex].ps->gm = MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
|
|
|
@ -190,7 +190,7 @@ void G_HandleSpecialKeys(void)
|
|||
CONTROL_GetInput(&noshareinfo);
|
||||
}
|
||||
|
||||
if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
|
||||
if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && inputState.GetKeyStatus(sc_Enter))
|
||||
{
|
||||
if (videoSetGameMode(!ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ud.detail))
|
||||
{
|
||||
|
@ -202,14 +202,14 @@ void G_HandleSpecialKeys(void)
|
|||
else
|
||||
ScreenMode = !ScreenMode;
|
||||
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
g_restorePalette = 1;
|
||||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F12))
|
||||
if (inputState.UnboundKeyPressed(sc_F12))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F12);
|
||||
inputState.ClearKeyStatus(sc_F12);
|
||||
videoCaptureScreen();
|
||||
P_DoQuote(QUOTE_SCREEN_SAVED, &myplayer);
|
||||
}
|
||||
|
@ -4513,18 +4513,18 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex)
|
||||
{
|
||||
if (KB_UnBoundKeyPressed(sc_F1) || KB_UnBoundKeyPressed(sc_F2) || cl_autovote)
|
||||
if (inputState.UnboundKeyPressed(sc_F1) || inputState.UnboundKeyPressed(sc_F2) || cl_autovote)
|
||||
{
|
||||
G_AddUserQuote("Vote Cast");
|
||||
Net_SendMapVote(KB_UnBoundKeyPressed(sc_F1) || cl_autovote ? cl_autovote-1 : 0);
|
||||
KB_ClearKeyDown(sc_F1);
|
||||
KB_ClearKeyDown(sc_F2);
|
||||
Net_SendMapVote(inputState.UnboundKeyPressed(sc_F1) || cl_autovote ? cl_autovote-1 : 0);
|
||||
inputState.ClearKeyStatus(sc_F1);
|
||||
inputState.ClearKeyStatus(sc_F2);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ALT_IS_PRESSED && ud.overhead_on == 0 && (myplayer.gm & MODE_TYPE) == 0)
|
||||
{
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Enlarge_Screen);
|
||||
|
||||
|
@ -4543,7 +4543,7 @@ void G_HandleLocalKeys(void)
|
|||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Shrink_Screen))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Shrink_Screen);
|
||||
|
||||
|
@ -4566,7 +4566,7 @@ void G_HandleLocalKeys(void)
|
|||
if (myplayer.cheat_phase == 1 || (myplayer.gm & (MODE_MENU|MODE_TYPE)))
|
||||
return;
|
||||
|
||||
if (BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
||||
if (inputState.BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
|
@ -4574,21 +4574,21 @@ void G_HandleLocalKeys(void)
|
|||
g_restorePalette = -1;
|
||||
}
|
||||
|
||||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
if ((g_netServer || ud.multimode > 1) && inputState.BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Show_Opponents_Weapon);
|
||||
ud.config.ShowWeapons = ud.showweapons = 1-ud.showweapons;
|
||||
P_DoQuote(QUOTE_WEAPON_MODE_OFF-ud.showweapons, &myplayer);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Toggle_Crosshair))
|
||||
if (inputState.BUTTON(gamefunc_Toggle_Crosshair))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Toggle_Crosshair);
|
||||
cl_crosshair = !cl_crosshair;
|
||||
P_DoQuote(QUOTE_CROSSHAIR_OFF-cl_crosshair, &myplayer);
|
||||
}
|
||||
|
||||
if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode))
|
||||
if (ud.overhead_on && inputState.BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ud.scrollmode = 1-ud.scrollmode;
|
||||
|
@ -4601,9 +4601,9 @@ void G_HandleLocalKeys(void)
|
|||
P_DoQuote(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode, &myplayer);
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_ScrollLock))
|
||||
if (inputState.UnboundKeyPressed(sc_ScrollLock))
|
||||
{
|
||||
KB_ClearKeyDown(sc_ScrollLock);
|
||||
inputState.ClearKeyStatus(sc_ScrollLock);
|
||||
|
||||
switch (ud.recstat)
|
||||
{
|
||||
|
@ -4619,9 +4619,9 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (ud.recstat == 2)
|
||||
{
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
if (inputState.GetKeyStatus(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
|
||||
g_demo_paused = !g_demo_paused;
|
||||
g_demo_rewind = 0;
|
||||
|
@ -4630,18 +4630,18 @@ void G_HandleLocalKeys(void)
|
|||
FX_StopAllSounds();
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(sc_Tab))
|
||||
if (inputState.GetKeyStatus(sc_Tab))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearKeyStatus(sc_Tab);
|
||||
g_demo_showStats = !g_demo_showStats;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (KB_KeyPressed(sc_kpad_Plus))
|
||||
if (inputState.GetKeyStatus(sc_kpad_Plus))
|
||||
{
|
||||
G_InitTimer(240);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_kpad_Minus))
|
||||
else if (inputState.GetKeyStatus(sc_kpad_Minus))
|
||||
{
|
||||
G_InitTimer(60);
|
||||
}
|
||||
|
@ -4651,9 +4651,9 @@ void G_HandleLocalKeys(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (KB_KeyPressed(sc_kpad_6))
|
||||
if (inputState.GetKeyStatus(sc_kpad_6))
|
||||
{
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
inputState.ClearKeyStatus(sc_kpad_6);
|
||||
|
||||
int const fwdTics = (15 << (int)ALT_IS_PRESSED) << (2 * (int)SHIFTS_IS_PRESSED);
|
||||
g_demo_goalCnt = g_demo_paused ? g_demo_cnt + 1 : g_demo_cnt + REALGAMETICSPERSEC * fwdTics;
|
||||
|
@ -4664,9 +4664,9 @@ void G_HandleLocalKeys(void)
|
|||
else
|
||||
Demo_PrepareWarp();
|
||||
}
|
||||
else if (KB_KeyPressed(sc_kpad_4))
|
||||
else if (inputState.GetKeyStatus(sc_kpad_4))
|
||||
{
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
inputState.ClearKeyStatus(sc_kpad_4);
|
||||
|
||||
int const rewindTics = (15 << (int)ALT_IS_PRESSED) << (2 * (int)SHIFTS_IS_PRESSED);
|
||||
g_demo_goalCnt = g_demo_paused ? g_demo_cnt - 1 : g_demo_cnt - REALGAMETICSPERSEC * rewindTics;
|
||||
|
@ -4686,9 +4686,9 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
// NOTE: sc_F1 .. sc_F10 are contiguous. sc_F11 is not sc_F10+1.
|
||||
for (bssize_t j=sc_F1; j<=sc_F10; j++)
|
||||
if (KB_UnBoundKeyPressed(j))
|
||||
if (inputState.UnboundKeyPressed(j))
|
||||
{
|
||||
KB_ClearKeyDown(j);
|
||||
inputState.ClearKeyStatus(j);
|
||||
ridiculeNum = j - sc_F1 + 1;
|
||||
break;
|
||||
}
|
||||
|
@ -4739,17 +4739,17 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED && !WIN_IS_PRESSED)
|
||||
{
|
||||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_SendMessage))
|
||||
if ((g_netServer || ud.multimode > 1) && inputState.BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
myplayer.gm |= MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F1) && !(G_GetLogoFlags() & LOGO_NOHELP)/* || (ud.show_help && I_AdvanceTrigger())*/)
|
||||
if (inputState.UnboundKeyPressed(sc_F1) && !(G_GetLogoFlags() & LOGO_NOHELP)/* || (ud.show_help && I_AdvanceTrigger())*/)
|
||||
{
|
||||
KB_ClearKeyDown(sc_F1);
|
||||
inputState.ClearKeyStatus(sc_F1);
|
||||
|
||||
Menu_Change(MENU_STORY);
|
||||
S_PauseSounds(true);
|
||||
|
@ -4765,9 +4765,9 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
// if((!net_server && ud.multimode < 2))
|
||||
{
|
||||
if (ud.recstat != 2 && KB_UnBoundKeyPressed(sc_F2))
|
||||
if (ud.recstat != 2 && inputState.UnboundKeyPressed(sc_F2))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F2);
|
||||
inputState.ClearKeyStatus(sc_F2);
|
||||
|
||||
FAKE_F2:
|
||||
if (sprite[myplayer.i].extra <= 0)
|
||||
|
@ -4789,9 +4789,9 @@ FAKE_F2:
|
|||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F3))
|
||||
if (inputState.UnboundKeyPressed(sc_F3))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F3);
|
||||
inputState.ClearKeyStatus(sc_F3);
|
||||
|
||||
FAKE_F3:
|
||||
Menu_Change(MENU_LOAD);
|
||||
|
@ -4808,9 +4808,9 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F4))
|
||||
if (inputState.UnboundKeyPressed(sc_F4))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F4);
|
||||
inputState.ClearKeyStatus(sc_F4);
|
||||
|
||||
S_PauseSounds(true);
|
||||
Menu_Open(myconnectindex);
|
||||
|
@ -4824,12 +4824,12 @@ FAKE_F3:
|
|||
Menu_Change(MENU_SOUND_INGAME);
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F5) && MusicEnabled())
|
||||
if (inputState.UnboundKeyPressed(sc_F5) && MusicEnabled())
|
||||
{
|
||||
map_t *const pMapInfo = &g_mapInfo[g_musicIndex];
|
||||
char *const musicString = apStrings[QUOTE_MUSIC];
|
||||
|
||||
KB_ClearKeyDown(sc_F5);
|
||||
inputState.ClearKeyStatus(sc_F5);
|
||||
|
||||
if (pMapInfo->musicfn != NULL)
|
||||
Bsnprintf(musicString, MAXQUOTELEN, "%s. Use SHIFT-F5 to change.", pMapInfo->musicfn);
|
||||
|
@ -4839,7 +4839,7 @@ FAKE_F3:
|
|||
P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps);
|
||||
}
|
||||
|
||||
if ((BUTTON(gamefunc_Quick_Save) || g_doQuickSave == 1) && (myplayer.gm & MODE_GAME))
|
||||
if ((inputState.BUTTON(gamefunc_Quick_Save) || g_doQuickSave == 1) && (myplayer.gm & MODE_GAME))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Quick_Save);
|
||||
|
||||
|
@ -4848,7 +4848,7 @@ FAKE_F3:
|
|||
if (!g_lastusersave.isValid())
|
||||
goto FAKE_F2;
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
|
||||
if (sprite[myplayer.i].extra <= 0)
|
||||
{
|
||||
|
@ -4876,7 +4876,7 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Third_Person_View))
|
||||
if (inputState.BUTTON(gamefunc_Third_Person_View))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Third_Person_View);
|
||||
|
||||
|
@ -4888,9 +4888,9 @@ FAKE_F3:
|
|||
P_DoQuote(QUOTE_VIEW_MODE_OFF + myplayer.over_shoulder_on, &myplayer);
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F8))
|
||||
if (inputState.UnboundKeyPressed(sc_F8))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F8);
|
||||
inputState.ClearKeyStatus(sc_F8);
|
||||
|
||||
int const fta = !ud.fta_on;
|
||||
ud.fta_on = 1;
|
||||
|
@ -4898,7 +4898,7 @@ FAKE_F3:
|
|||
ud.fta_on = fta;
|
||||
}
|
||||
|
||||
if ((BUTTON(gamefunc_Quick_Load) || g_doQuickSave == 2) && (myplayer.gm & MODE_GAME))
|
||||
if ((inputState.BUTTON(gamefunc_Quick_Load) || g_doQuickSave == 2) && (myplayer.gm & MODE_GAME))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Quick_Load);
|
||||
|
||||
|
@ -4908,17 +4908,17 @@ FAKE_F3:
|
|||
goto FAKE_F3;
|
||||
else if (g_quickload->isValid())
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
S_PauseSounds(true);
|
||||
if (G_LoadPlayerMaybeMulti(*g_quickload) != 0)
|
||||
g_quickload->reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F10))
|
||||
if (inputState.UnboundKeyPressed(sc_F10))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F10);
|
||||
inputState.ClearKeyStatus(sc_F10);
|
||||
|
||||
Menu_Change(MENU_QUIT_INGAME);
|
||||
S_PauseSounds(true);
|
||||
|
@ -4931,9 +4931,9 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F11))
|
||||
if (inputState.UnboundKeyPressed(sc_F11))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F11);
|
||||
inputState.ClearKeyStatus(sc_F11);
|
||||
|
||||
Menu_Change(MENU_COLCORR_INGAME);
|
||||
S_PauseSounds(true);
|
||||
|
@ -4951,10 +4951,10 @@ FAKE_F3:
|
|||
int const timerOffset = ((int) totalclock - nonsharedtimer);
|
||||
nonsharedtimer += timerOffset;
|
||||
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Enlarge_Screen))
|
||||
myplayer.zoom += mulscale6(timerOffset, max<int>(myplayer.zoom, 256));
|
||||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Shrink_Screen))
|
||||
myplayer.zoom -= mulscale6(timerOffset, max<int>(myplayer.zoom, 256));
|
||||
|
||||
myplayer.zoom = clamp(myplayer.zoom, 48, 2048);
|
||||
|
@ -4970,14 +4970,14 @@ FAKE_F3:
|
|||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_AutoRun))
|
||||
if (inputState.BUTTON(gamefunc_AutoRun))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_AutoRun);
|
||||
cl_autorun= 1-cl_autorun;
|
||||
P_DoQuote(QUOTE_RUN_MODE_OFF + cl_autorun, &myplayer);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Map))
|
||||
if (inputState.BUTTON(gamefunc_Map))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map);
|
||||
if (ud.last_overhead != ud.overhead_on && ud.last_overhead)
|
||||
|
@ -6043,7 +6043,7 @@ void G_BackToMenu(void)
|
|||
g_player[myconnectindex].ps->gm = 0;
|
||||
Menu_Open(myconnectindex);
|
||||
Menu_Change(MENU_MAIN);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
static int G_EndOfLevel(void)
|
||||
|
@ -6597,7 +6597,7 @@ MAIN_LOOP_RESTART:
|
|||
// handle CON_SAVE and CON_SAVENN
|
||||
if (g_saveRequested)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
videoNextPage();
|
||||
|
||||
g_screenCapture = 1;
|
||||
|
|
|
@ -1067,8 +1067,8 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags, int32_t cons
|
|||
{
|
||||
if (resetFlags & 4)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
if (G_LoadPlayerMaybeMulti(*g_quickload) != 0)
|
||||
|
@ -1080,7 +1080,7 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags, int32_t cons
|
|||
else if (!(resetFlags & 1))
|
||||
{
|
||||
Menu_Open(playerNum);
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
I_AdvanceTriggerClear();
|
||||
Menu_Change(MENU_RESETPLAYER);
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ BEGIN_DUKE_NS
|
|||
|
||||
static FORCE_INLINE void Menu_StartTextInput()
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
}
|
||||
|
||||
static FORCE_INLINE void Menu_StopTextInput()
|
||||
|
@ -2861,26 +2861,26 @@ static void Menu_PreInput(MenuEntry_t *entry)
|
|||
{
|
||||
|
||||
case MENU_KEYBOARDKEYS:
|
||||
if (KB_KeyPressed(sc_Delete))
|
||||
if (inputState.GetKeyStatus(sc_Delete))
|
||||
{
|
||||
Bindings.UnbindACommand(CONFIG_FunctionNumToName(M_KEYBOARDKEYS.currentEntry));
|
||||
S_PlaySound(KICK_HIT);
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
inputState.ClearKeyStatus(sc_Delete);
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_LOAD:
|
||||
if (KB_KeyPressed(sc_Delete))
|
||||
if (inputState.GetKeyStatus(sc_Delete))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
inputState.ClearKeyStatus(sc_Delete);
|
||||
if (M_LOAD.currentEntry < g_nummenusaves)
|
||||
Menu_Change(MENU_LOADDELVERIFY);
|
||||
}
|
||||
break;
|
||||
case MENU_SAVE:
|
||||
if (KB_KeyPressed(sc_Delete))
|
||||
if (inputState.GetKeyStatus(sc_Delete))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
inputState.ClearKeyStatus(sc_Delete);
|
||||
if (0 < M_SAVE.currentEntry && M_SAVE.currentEntry <= (int32_t)g_nummenusaves)
|
||||
Menu_Change(MENU_SAVEDELVERIFY);
|
||||
}
|
||||
|
@ -2916,12 +2916,12 @@ static int32_t Menu_PreCustom2ColScreen(MenuEntry_t *entry)
|
|||
{
|
||||
auto column = (MenuCustom2Col_t*)entry->entry;
|
||||
|
||||
int32_t sc = KB_GetLastScanCode();
|
||||
int32_t sc = inputState.GetLastScanCode();
|
||||
if (sc != sc_None)
|
||||
{
|
||||
S_PlaySound(PISTOL_BODYHIT);
|
||||
Bindings.SetBind(sc, CONFIG_FunctionNumToName(M_KEYBOARDKEYS.currentEntry));
|
||||
KB_ClearKeyDown(sc);
|
||||
inputState.ClearKeyStatus(sc);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -3383,8 +3383,8 @@ static void Menu_Custom2ColScreen(/*MenuEntry_t *entry*/)
|
|||
{
|
||||
if (g_currentMenu == MENU_KEYBOARDKEYS)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearLastScanCode();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearLastScanCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3553,8 +3553,8 @@ static void Menu_Verify(int32_t input)
|
|||
switch (input)
|
||||
{
|
||||
default:
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
FX_StopAllSounds();
|
||||
|
||||
if (G_LoadPlayerMaybeMulti(*g_quickload) == 0)
|
||||
|
@ -3594,8 +3594,8 @@ static void Menu_Verify(int32_t input)
|
|||
g_quickload = &g_lastusersave;
|
||||
}
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
|
||||
if (G_LoadPlayerMaybeMulti(sv))
|
||||
Menu_Change(MENU_PREVIOUS);
|
||||
|
@ -3845,7 +3845,7 @@ static void Menu_FileSelectInit(MenuFileSelect_t *object)
|
|||
object->currentList = 1;
|
||||
|
||||
#endif
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
static void Menu_FileSelect(int32_t input)
|
||||
|
@ -6393,29 +6393,29 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
|
||||
S_PlaySound(PISTOL_BODYHIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
|
||||
Menu_RunInput_FileSelect_Movement(object, MM_Home);
|
||||
|
||||
S_PlaySound(KICK_HIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
|
||||
Menu_RunInput_FileSelect_Movement(object, MM_End);
|
||||
|
||||
S_PlaySound(KICK_HIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgUp))
|
||||
else if (inputState.GetKeyStatus(sc_PgUp))
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
|
||||
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
inputState.ClearKeyStatus(sc_PgUp);
|
||||
|
||||
for (i = 0; i < 6; ++i)
|
||||
{
|
||||
|
@ -6432,13 +6432,13 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlaySound(KICK_HIT);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgDn))
|
||||
else if (inputState.GetKeyStatus(sc_PgDn))
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
|
||||
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
inputState.ClearKeyStatus(sc_PgDn);
|
||||
|
||||
for (i = 0; i < 6; ++i)
|
||||
{
|
||||
|
@ -6487,7 +6487,7 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
{
|
||||
// JBF 20040208: seek to first name matching pressed character
|
||||
char ch2, ch;
|
||||
ch = KB_GetCh();
|
||||
ch = inputState.keyGetChar();
|
||||
if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')))
|
||||
{
|
||||
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList]->usera;
|
||||
|
@ -6543,10 +6543,10 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
break;
|
||||
|
||||
case Verify:
|
||||
if (I_ReturnTrigger() || KB_KeyPressed(sc_N) || Menu_RunInput_MouseReturn())
|
||||
if (I_ReturnTrigger() || inputState.GetKeyStatus(sc_N) || Menu_RunInput_MouseReturn())
|
||||
{
|
||||
I_ReturnTriggerClear();
|
||||
KB_ClearKeyDown(sc_N);
|
||||
inputState.ClearKeyStatus(sc_N);
|
||||
m_mousecaught = 1;
|
||||
|
||||
Menu_Verify(0);
|
||||
|
@ -6556,12 +6556,12 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlaySound(EXITMENUSOUND);
|
||||
}
|
||||
|
||||
if (I_AdvanceTrigger() || KB_KeyPressed(sc_Y) || Menu_RunInput_MouseAdvance())
|
||||
if (I_AdvanceTrigger() || inputState.GetKeyStatus(sc_Y) || Menu_RunInput_MouseAdvance())
|
||||
{
|
||||
auto verify = (MenuVerify_t*)cm->object;
|
||||
|
||||
I_AdvanceTriggerClear();
|
||||
KB_ClearKeyDown(sc_Y);
|
||||
inputState.ClearKeyStatus(sc_Y);
|
||||
m_mousecaught = 1;
|
||||
|
||||
Menu_Verify(1);
|
||||
|
@ -6767,17 +6767,17 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
|
||||
Menu_AnimateChange(cm->parentID, cm->parentAnimation);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
|
||||
S_PlaySound(KICK_HIT);
|
||||
|
||||
currentry = Menu_RunInput_Menu_Movement(menu, MM_Home);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
|
||||
S_PlaySound(KICK_HIT);
|
||||
|
||||
|
@ -6849,17 +6849,17 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
if (!Menu_RunInput_EntryOptionList_Activate(currentry, object))
|
||||
S_PlaySound(PISTOL_BODYHIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
|
||||
S_PlaySound(KICK_HIT);
|
||||
|
||||
Menu_RunInput_EntryOptionList_Movement(object, MM_Home);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
|
||||
S_PlaySound(KICK_HIT);
|
||||
|
||||
|
@ -6915,7 +6915,7 @@ void M_DisplayMenus(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Menu_IsTextInput(m_currentMenu) && KB_KeyPressed(sc_Q))
|
||||
if (!Menu_IsTextInput(m_currentMenu) && inputState.GetKeyStatus(sc_Q))
|
||||
Menu_AnimateChange(MENU_QUIT, MA_Advance);
|
||||
|
||||
int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs);
|
||||
|
|
|
@ -5077,9 +5077,9 @@ void Net_SendMessage(void)
|
|||
|
||||
mpgametext(mpgametext_x, ud.screen_size > 0 ? (200 - 45) << 16 : (200 - 8) << 16, typebuf, 0, 0, 0, 0);
|
||||
|
||||
if (KB_KeyWaiting())
|
||||
if (inputState.keyBufferWaiting())
|
||||
{
|
||||
i = KB_GetCh();
|
||||
i = inputState.keyGetChar();
|
||||
|
||||
if (i == 'A' || i == 'a' || i == 13)
|
||||
g_chatPlayer = ud.multimode;
|
||||
|
@ -5097,17 +5097,17 @@ void Net_SendMessage(void)
|
|||
typebuf[0] = 0;
|
||||
}
|
||||
|
||||
KB_ClearKeyDown(sc_1);
|
||||
KB_ClearKeyDown(sc_2);
|
||||
KB_ClearKeyDown(sc_3);
|
||||
KB_ClearKeyDown(sc_4);
|
||||
KB_ClearKeyDown(sc_5);
|
||||
KB_ClearKeyDown(sc_6);
|
||||
KB_ClearKeyDown(sc_7);
|
||||
KB_ClearKeyDown(sc_8);
|
||||
KB_ClearKeyDown(sc_A);
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_1);
|
||||
inputState.ClearKeyStatus(sc_2);
|
||||
inputState.ClearKeyStatus(sc_3);
|
||||
inputState.ClearKeyStatus(sc_4);
|
||||
inputState.ClearKeyStatus(sc_5);
|
||||
inputState.ClearKeyStatus(sc_6);
|
||||
inputState.ClearKeyStatus(sc_7);
|
||||
inputState.ClearKeyStatus(sc_8);
|
||||
inputState.ClearKeyStatus(sc_A);
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5127,7 +5127,7 @@ void Net_SendMessage(void)
|
|||
|
||||
if (hitstate == 1)
|
||||
{
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
if (Bstrlen(typebuf) == 0)
|
||||
{
|
||||
g_player[myconnectindex].ps->gm &= ~(MODE_TYPE | MODE_SENDTOWHOM);
|
||||
|
|
|
@ -2894,7 +2894,7 @@ void P_GetInput(int const playerNum)
|
|||
auto const pPlayer = g_player[playerNum].ps;
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -2910,11 +2910,11 @@ void P_GetInput(int const playerNum)
|
|||
D_ProcessEvents();
|
||||
|
||||
if (in_aimmode)
|
||||
g_MyAimMode = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_MyAimMode = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
else
|
||||
{
|
||||
g_oldAimStat = g_myAimStat;
|
||||
g_myAimStat = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_myAimStat = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
|
||||
if (g_myAimStat > g_oldAimStat)
|
||||
{
|
||||
|
@ -2947,7 +2947,7 @@ void P_GetInput(int const playerNum)
|
|||
}
|
||||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = G_CheckAutorun(BUTTON(gamefunc_Run));
|
||||
int const playerRunning = G_CheckAutorun(inputState.BUTTON(gamefunc_Run));
|
||||
int const turnAmount = playerRunning ? (NORMALTURN << 1) : NORMALTURN;
|
||||
constexpr int const analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
|
@ -2955,7 +2955,7 @@ void P_GetInput(int const playerNum)
|
|||
|
||||
input_t input {};
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (inputState.BUTTON(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
|
@ -2981,12 +2981,12 @@ void P_GetInput(int const playerNum)
|
|||
input.svel -= info.dx * keyMove / analogExtent;
|
||||
input.fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (inputState.BUTTON(gamefunc_Strafe))
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left) && !(pPlayer->movement_lock&4))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left) && !(pPlayer->movement_lock&4))
|
||||
input.svel -= -keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Turn_Right) && !(pPlayer->movement_lock&8))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Right) && !(pPlayer->movement_lock&8))
|
||||
input.svel -= keyMove;
|
||||
}
|
||||
else
|
||||
|
@ -2997,12 +2997,12 @@ void P_GetInput(int const playerNum)
|
|||
|
||||
lastInputClock = (int32_t) totalclock;
|
||||
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel -= fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
|
||||
}
|
||||
else if (BUTTON(gamefunc_Turn_Right))
|
||||
else if (inputState.BUTTON(gamefunc_Turn_Right))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel += fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
|
||||
|
@ -3011,16 +3011,16 @@ void P_GetInput(int const playerNum)
|
|||
turnHeldTime=0;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Left) && !(pPlayer->movement_lock & 4))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Left) && !(pPlayer->movement_lock & 4))
|
||||
input.svel += keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Right) && !(pPlayer->movement_lock & 8))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Right) && !(pPlayer->movement_lock & 8))
|
||||
input.svel += -keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Forward) && !(pPlayer->movement_lock & 1))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward) && !(pPlayer->movement_lock & 1))
|
||||
input.fvel += keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward) && !(pPlayer->movement_lock & 2))
|
||||
if (inputState.BUTTON(gamefunc_Move_Backward) && !(pPlayer->movement_lock & 2))
|
||||
input.fvel += -keyMove;
|
||||
|
||||
input.fvel = clamp(input.fvel, -MAXVEL, MAXVEL);
|
||||
|
@ -3033,31 +3033,31 @@ void P_GetInput(int const playerNum)
|
|||
|
||||
for (weaponSelection = gamefunc_Weapon_10; weaponSelection >= gamefunc_Weapon_1; --weaponSelection)
|
||||
{
|
||||
if (BUTTON(weaponSelection))
|
||||
if (inputState.BUTTON(weaponSelection))
|
||||
{
|
||||
weaponSelection -= (gamefunc_Weapon_1 - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Last_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Last_Weapon))
|
||||
weaponSelection = 14;
|
||||
else if (BUTTON(gamefunc_Alt_Weapon))
|
||||
else if (inputState.BUTTON(gamefunc_Alt_Weapon))
|
||||
weaponSelection = 13;
|
||||
else if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel > 0))
|
||||
else if (inputState.BUTTON(gamefunc_Next_Weapon) || (inputState.BUTTON(gamefunc_Dpad_Select) && input.fvel > 0))
|
||||
weaponSelection = 12;
|
||||
else if (BUTTON(gamefunc_Previous_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel < 0))
|
||||
else if (inputState.BUTTON(gamefunc_Previous_Weapon) || (inputState.BUTTON(gamefunc_Dpad_Select) && input.fvel < 0))
|
||||
weaponSelection = 11;
|
||||
else if (weaponSelection == gamefunc_Weapon_1-1)
|
||||
weaponSelection = 0;
|
||||
|
||||
localInput.bits = (weaponSelection << SK_WEAPON_BITS) | (BUTTON(gamefunc_Fire) << SK_FIRE);
|
||||
localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN);
|
||||
localInput.bits = (weaponSelection << SK_WEAPON_BITS) | (inputState.BUTTON(gamefunc_Fire) << SK_FIRE);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Open) << SK_OPEN);
|
||||
|
||||
int const sectorLotag = pPlayer->cursectnum != -1 ? sector[pPlayer->cursectnum].lotag : 0;
|
||||
int const crouchable = sectorLotag != 2 && (sectorLotag != 1 || pPlayer->spritebridge);
|
||||
|
||||
if (pPlayer->cheat_phase == 0 && BUTTON(gamefunc_Toggle_Crouch))
|
||||
if (pPlayer->cheat_phase == 0 && inputState.BUTTON(gamefunc_Toggle_Crouch))
|
||||
{
|
||||
pPlayer->crouch_toggle = !pPlayer->crouch_toggle && crouchable;
|
||||
|
||||
|
@ -3065,58 +3065,58 @@ void P_GetInput(int const playerNum)
|
|||
inputState.ClearButton(gamefunc_Toggle_Crouch);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Crouch) || BUTTON(gamefunc_Jump) || pPlayer->jetpack_on || (!crouchable && pPlayer->on_ground))
|
||||
if (inputState.BUTTON(gamefunc_Crouch) || inputState.BUTTON(gamefunc_Jump) || pPlayer->jetpack_on || (!crouchable && pPlayer->on_ground))
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
||||
int const crouching = BUTTON(gamefunc_Crouch) || BUTTON(gamefunc_Toggle_Crouch) || pPlayer->crouch_toggle;
|
||||
int const crouching = inputState.BUTTON(gamefunc_Crouch) || inputState.BUTTON(gamefunc_Toggle_Crouch) || pPlayer->crouch_toggle;
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | (crouching << SK_CROUCH);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Jump) << SK_JUMP) | (crouching << SK_CROUCH);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP;
|
||||
localInput.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN;
|
||||
localInput.bits |= (BUTTON(gamefunc_Center_View) << SK_CENTER_VIEW);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Aim_Up) || (inputState.BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Aim_Down) || (inputState.BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Center_View) << SK_CENTER_VIEW);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Look_Left) << SK_LOOK_LEFT) | (BUTTON(gamefunc_Look_Right) << SK_LOOK_RIGHT);
|
||||
localInput.bits |= (BUTTON(gamefunc_Look_Up) << SK_LOOK_UP) | (BUTTON(gamefunc_Look_Down) << SK_LOOK_DOWN);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Look_Left) << SK_LOOK_LEFT) | (inputState.BUTTON(gamefunc_Look_Right) << SK_LOOK_RIGHT);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Look_Up) << SK_LOOK_UP) | (inputState.BUTTON(gamefunc_Look_Down) << SK_LOOK_DOWN);
|
||||
|
||||
localInput.bits |= (playerRunning << SK_RUN);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Left) || (BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Right) || (BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory) << SK_INVENTORY);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Left) || (inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Right) || (inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory) << SK_INVENTORY);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Steroids) << SK_STEROIDS) | (BUTTON(gamefunc_NightVision) << SK_NIGHTVISION);
|
||||
localInput.bits |= (BUTTON(gamefunc_MedKit) << SK_MEDKIT) | (BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE);
|
||||
localInput.bits |= (BUTTON(gamefunc_Jetpack) << SK_JETPACK);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Steroids) << SK_STEROIDS) | (inputState.BUTTON(gamefunc_NightVision) << SK_NIGHTVISION);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_MedKit) << SK_MEDKIT) | (inputState.BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Jetpack) << SK_JETPACK);
|
||||
|
||||
localInput.bits |= BUTTON(gamefunc_Holster_Weapon) << SK_HOLSTER;
|
||||
localInput.bits |= BUTTON(gamefunc_Quick_Kick) << SK_QUICK_KICK;
|
||||
localInput.bits |= BUTTON(gamefunc_TurnAround) << SK_TURNAROUND;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Holster_Weapon) << SK_HOLSTER;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Quick_Kick) << SK_QUICK_KICK;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_TurnAround) << SK_TURNAROUND;
|
||||
|
||||
localInput.bits |= (g_MyAimMode << SK_AIMMODE);
|
||||
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
|
||||
localInput.bits |= KB_KeyPressed(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= ((uint32_t)KB_KeyPressed(sc_Escape)) << SK_ESCAPE;
|
||||
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE;
|
||||
|
||||
if (BUTTON(gamefunc_Dpad_Select))
|
||||
if (inputState.BUTTON(gamefunc_Dpad_Select))
|
||||
{
|
||||
input.fvel = 0;
|
||||
input.svel = 0;
|
||||
input.q16avel = 0;
|
||||
}
|
||||
else if (BUTTON(gamefunc_Dpad_Aiming))
|
||||
else if (inputState.BUTTON(gamefunc_Dpad_Aiming))
|
||||
input.fvel = 0;
|
||||
|
||||
if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_SEMIAUTO && BUTTON(gamefunc_Fire))
|
||||
if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_SEMIAUTO && inputState.BUTTON(gamefunc_Fire))
|
||||
inputState.ClearButton(gamefunc_Fire);
|
||||
|
||||
localInput.extbits = (BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
localInput.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
|
||||
localInput.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
|
||||
localInput.extbits |= BUTTON(gamefunc_Alt_Fire)<<6;
|
||||
localInput.extbits = (inputState.BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
localInput.extbits |= inputState.BUTTON(gamefunc_Turn_Left)<<4;
|
||||
localInput.extbits |= inputState.BUTTON(gamefunc_Turn_Right)<<5;
|
||||
localInput.extbits |= inputState.BUTTON(gamefunc_Alt_Fire)<<6;
|
||||
|
||||
if (ud.scrollmode && ud.overhead_on)
|
||||
{
|
||||
|
|
|
@ -407,7 +407,7 @@ static void G_DoLoadScreen(const char *statustext, int percent)
|
|||
|
||||
if (!statustext)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
ud.screen_size = screenSize;
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ void G_CacheMapData(void)
|
|||
int cnt = 0;
|
||||
int percentDisplayed = -1;
|
||||
|
||||
for (int i=0; i<MAXTILES && !KB_KeyPressed(sc_Space); i++)
|
||||
for (int i=0; i<MAXTILES && !inputState.GetKeyStatus(sc_Space); i++)
|
||||
{
|
||||
if (!(i&7) && !gotpic[i>>3])
|
||||
{
|
||||
|
@ -1652,9 +1652,9 @@ static void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t e
|
|||
sampletimer();
|
||||
nexttic += ticwait;
|
||||
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
if (inputState.GetKeyStatus(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1255,7 +1255,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
gametext_center(70, "Press F1 to Accept, F2 to Decline");
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Show_DukeMatch_Scores))
|
||||
if (inputState.BUTTON(gamefunc_Show_DukeMatch_Scores))
|
||||
G_ShowScores();
|
||||
|
||||
if (g_Debug)
|
||||
|
@ -1496,7 +1496,7 @@ void gameDisplayTitleScreen(void)
|
|||
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8 + 2 + 1); // JBF 20040308
|
||||
renderFlushPerms();
|
||||
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
fadepaltile(0, 0, 0, 252, 0, -28, BETASCREEN);
|
||||
totalclock = 0;
|
||||
|
||||
|
@ -2181,7 +2181,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
G_FadePalette(0, 0, 0, 252); // JBF 20031228
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
totalclock = 0;
|
||||
bonuscnt = 0;
|
||||
|
||||
|
@ -2473,7 +2473,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
I_ClearAllInput();
|
||||
if (totalclock < (60*13))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
totalclock = (60*13);
|
||||
}
|
||||
else if (totalclock < 1000000000)
|
||||
|
|
|
@ -2594,7 +2594,7 @@ void P_HandleSharedKeys(int playerNum)
|
|||
{
|
||||
if (TEST_SYNC_KEY(playerBits, SK_PAUSE))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Pause);
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
if (ud.pause_on)
|
||||
ud.pause_on = 0;
|
||||
else ud.pause_on = 1+SHIFTS_IS_PRESSED;
|
||||
|
|
|
@ -35,14 +35,14 @@ char typebuf[TYPEBUFSIZE];
|
|||
int32_t I_CheckAllInput(void)
|
||||
{
|
||||
return
|
||||
KB_KeyWaiting()
|
||||
inputState.keyBufferWaiting()
|
||||
|| MOUSE_GetButtons()
|
||||
|| JOYSTICK_GetButtons();
|
||||
}
|
||||
void I_ClearAllInput(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
inputState.ClearAllButtons();
|
||||
|
@ -52,17 +52,17 @@ void I_ClearAllInput(void)
|
|||
int32_t I_TextSubmit(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_Enter)
|
||||
|| KB_KeyPressed(sc_kpad_Enter)
|
||||
inputState.GetKeyStatus(sc_Enter)
|
||||
|| inputState.GetKeyStatus(sc_kpad_Enter)
|
||||
//|| MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A));
|
||||
}
|
||||
|
||||
void I_TextSubmitClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_kpad_Enter);
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeyStatus(sc_kpad_Enter);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
MOUSE_ClearButton(LEFT_MOUSE);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_A);
|
||||
}
|
||||
|
@ -71,27 +71,27 @@ int32_t I_AdvanceTrigger(void)
|
|||
{
|
||||
return
|
||||
I_TextSubmit()
|
||||
|| KB_KeyPressed(sc_Space);
|
||||
|| inputState.GetKeyStatus(sc_Space);
|
||||
}
|
||||
|
||||
void I_AdvanceTriggerClear(void)
|
||||
{
|
||||
I_TextSubmitClear();
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
}
|
||||
|
||||
int32_t I_ReturnTrigger(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_Escape)
|
||||
inputState.GetKeyStatus(sc_Escape)
|
||||
|| (MOUSE_GetButtons()&RIGHT_MOUSE)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B));
|
||||
}
|
||||
|
||||
void I_ReturnTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
MOUSE_ClearButton(RIGHT_MOUSE);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_B);
|
||||
}
|
||||
|
@ -101,9 +101,9 @@ int32_t I_GeneralTrigger(void)
|
|||
return
|
||||
I_AdvanceTrigger()
|
||||
|| I_ReturnTrigger()
|
||||
|| BUTTON(gamefunc_Open)
|
||||
//|| MOUSEINACTIVECONDITIONAL(BUTTON(gamefunc_Fire))
|
||||
|| BUTTON(gamefunc_Crouch)
|
||||
|| inputState.BUTTON(gamefunc_Open)
|
||||
//|| MOUSEINACTIVECONDITIONAL(inputState.BUTTON(gamefunc_Fire))
|
||||
|| inputState.BUTTON(gamefunc_Crouch)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START));
|
||||
}
|
||||
|
||||
|
@ -121,14 +121,14 @@ void I_GeneralTriggerClear(void)
|
|||
int32_t I_EscapeTrigger(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_Escape)
|
||||
inputState.GetKeyStatus(sc_Escape)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START));
|
||||
}
|
||||
|
||||
void I_EscapeTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
|
||||
}
|
||||
|
||||
|
@ -136,10 +136,10 @@ void I_EscapeTriggerClear(void)
|
|||
int32_t I_MenuUp(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_UpArrow)
|
||||
|| KB_KeyPressed(sc_kpad_8)
|
||||
inputState.GetKeyStatus(sc_UpArrow)
|
||||
|| inputState.GetKeyStatus(sc_kpad_8)
|
||||
|| (MOUSE_GetButtons()&WHEELUP_MOUSE)
|
||||
|| BUTTON(gamefunc_Move_Forward)
|
||||
|| inputState.BUTTON(gamefunc_Move_Forward)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_UP)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_UP))
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTY);
|
||||
|
@ -147,8 +147,8 @@ int32_t I_MenuUp(void)
|
|||
|
||||
void I_MenuUpClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_UpArrow);
|
||||
KB_ClearKeyDown(sc_kpad_8);
|
||||
inputState.ClearKeyStatus(sc_UpArrow);
|
||||
inputState.ClearKeyStatus(sc_kpad_8);
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
inputState.ClearButton(gamefunc_Move_Forward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
|
@ -160,10 +160,10 @@ void I_MenuUpClear(void)
|
|||
int32_t I_MenuDown(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_DownArrow)
|
||||
|| KB_KeyPressed(sc_kpad_2)
|
||||
inputState.GetKeyStatus(sc_DownArrow)
|
||||
|| inputState.GetKeyStatus(sc_kpad_2)
|
||||
|| (MOUSE_GetButtons()&WHEELDOWN_MOUSE)
|
||||
|| BUTTON(gamefunc_Move_Backward)
|
||||
|| inputState.BUTTON(gamefunc_Move_Backward)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_DOWN)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN))
|
||||
|| CONTROL_GetGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTY);
|
||||
|
@ -171,9 +171,9 @@ int32_t I_MenuDown(void)
|
|||
|
||||
void I_MenuDownClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_DownArrow);
|
||||
KB_ClearKeyDown(sc_kpad_2);
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
inputState.ClearKeyStatus(sc_DownArrow);
|
||||
inputState.ClearKeyStatus(sc_kpad_2);
|
||||
inputState.ClearKeyStatus(sc_PgDn);
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
inputState.ClearButton(gamefunc_Move_Backward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
|
@ -185,11 +185,11 @@ void I_MenuDownClear(void)
|
|||
int32_t I_MenuLeft(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_LeftArrow)
|
||||
|| KB_KeyPressed(sc_kpad_4)
|
||||
|| (inputState.ShiftPressed() && KB_KeyPressed(sc_Tab))
|
||||
|| BUTTON(gamefunc_Turn_Left)
|
||||
|| BUTTON(gamefunc_Strafe_Left)
|
||||
inputState.GetKeyStatus(sc_LeftArrow)
|
||||
|| inputState.GetKeyStatus(sc_kpad_4)
|
||||
|| (inputState.ShiftPressed() && inputState.GetKeyStatus(sc_Tab))
|
||||
|| inputState.BUTTON(gamefunc_Turn_Left)
|
||||
|| inputState.BUTTON(gamefunc_Strafe_Left)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_LEFT)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_LEFT))
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTX);
|
||||
|
@ -197,9 +197,9 @@ int32_t I_MenuLeft(void)
|
|||
|
||||
void I_MenuLeftClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_LeftArrow);
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearKeyStatus(sc_LeftArrow);
|
||||
inputState.ClearKeyStatus(sc_kpad_4);
|
||||
inputState.ClearKeyStatus(sc_Tab);
|
||||
inputState.ClearButton(gamefunc_Turn_Left);
|
||||
inputState.ClearButton(gamefunc_Strafe_Left);
|
||||
JOYSTICK_ClearHat(0);
|
||||
|
@ -211,11 +211,11 @@ void I_MenuLeftClear(void)
|
|||
int32_t I_MenuRight(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_RightArrow)
|
||||
|| KB_KeyPressed(sc_kpad_6)
|
||||
|| (!inputState.ShiftPressed() && KB_KeyPressed(sc_Tab))
|
||||
|| BUTTON(gamefunc_Turn_Right)
|
||||
|| BUTTON(gamefunc_Strafe_Right)
|
||||
inputState.GetKeyStatus(sc_RightArrow)
|
||||
|| inputState.GetKeyStatus(sc_kpad_6)
|
||||
|| (!inputState.ShiftPressed() && inputState.GetKeyStatus(sc_Tab))
|
||||
|| inputState.BUTTON(gamefunc_Turn_Right)
|
||||
|| inputState.BUTTON(gamefunc_Strafe_Right)
|
||||
|| (MOUSE_GetButtons()&MIDDLE_MOUSE)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_RIGHT)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT))
|
||||
|
@ -225,9 +225,9 @@ int32_t I_MenuRight(void)
|
|||
|
||||
void I_MenuRightClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_RightArrow);
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearKeyStatus(sc_RightArrow);
|
||||
inputState.ClearKeyStatus(sc_kpad_6);
|
||||
inputState.ClearKeyStatus(sc_Tab);
|
||||
inputState.ClearButton(gamefunc_Turn_Right);
|
||||
inputState.ClearButton(gamefunc_Strafe_Right);
|
||||
MOUSE_ClearButton(MIDDLE_MOUSE);
|
||||
|
@ -242,7 +242,7 @@ int32_t I_PanelUp(void)
|
|||
return
|
||||
I_MenuUp()
|
||||
|| I_MenuLeft()
|
||||
|| KB_KeyPressed(sc_PgUp)
|
||||
|| inputState.GetKeyStatus(sc_PgUp)
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ void I_PanelUpClear(void)
|
|||
{
|
||||
I_MenuUpClear();
|
||||
I_MenuLeftClear();
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
inputState.ClearKeyStatus(sc_PgUp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,7 +259,7 @@ int32_t I_PanelDown(void)
|
|||
return
|
||||
I_MenuDown()
|
||||
|| I_MenuRight()
|
||||
|| KB_KeyPressed(sc_PgDn)
|
||||
|| inputState.GetKeyStatus(sc_PgDn)
|
||||
|| I_AdvanceTrigger()
|
||||
;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ void I_PanelDownClear(void)
|
|||
{
|
||||
I_MenuDownClear();
|
||||
I_MenuRightClear();
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
inputState.ClearKeyStatus(sc_PgDn);
|
||||
I_AdvanceTriggerClear();
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
|
|||
char ch;
|
||||
int32_t inputloc = strlen(typebuf);
|
||||
|
||||
while ((ch = KB_GetCh()) != 0)
|
||||
while ((ch = inputState.keyGetChar()) != 0)
|
||||
{
|
||||
if (ch == asc_BackSpace)
|
||||
{
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* keyboard.c
|
||||
* MACT library -to- JonoF's Build Port Keyboard Glue
|
||||
*
|
||||
* by Jonathon Fowler
|
||||
*
|
||||
* Since we don't have the source to the MACT library I've had to
|
||||
* concoct some magic to glue its idea of controllers into that of
|
||||
* my Build port.
|
||||
*
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
|
||||
|
||||
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
||||
|
||||
Duke Nukem 3D is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
|
||||
kb_scancode KB_LastScan;
|
||||
|
||||
|
||||
void KB_Startup(void) { keySetCallback(KB_KeyEvent); }
|
||||
void KB_Shutdown(void) { keySetCallback((void (*)(int32_t, int32_t))NULL); }
|
|
@ -238,7 +238,7 @@ static void G_CheatGetInv(DukePlayer_t *pPlayer)
|
|||
static void end_cheat(DukePlayer_t * const pPlayer)
|
||||
{
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
static int32_t cheatbuflen;
|
||||
|
@ -303,9 +303,9 @@ void G_DoCheats(void)
|
|||
{
|
||||
int ch;
|
||||
|
||||
while (KB_KeyWaiting())
|
||||
while (inputState.keyBufferWaiting())
|
||||
{
|
||||
ch = Btolower(KB_GetCh());
|
||||
ch = Btolower(inputState.keyGetChar());
|
||||
|
||||
if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')))
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ void G_DoCheats(void)
|
|||
// cheat string matching logic below.
|
||||
Bassert(cheatbuflen < (signed)sizeof(cheatbuf));
|
||||
cheatbuf[cheatbuflen] = 0;
|
||||
// KB_ClearKeysDown();
|
||||
// inputState.ClearKeysDown();
|
||||
|
||||
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
|
||||
{
|
||||
|
@ -415,7 +415,7 @@ void G_DoCheats(void)
|
|||
if (RR)
|
||||
for (int key = 0; key < 5; key++)
|
||||
pPlayer->keys[key] = 1;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
P_DoQuote(QUOTE_CHEAT_ALL_KEYS, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
@ -441,7 +441,7 @@ void G_DoCheats(void)
|
|||
if (RR)
|
||||
{
|
||||
P_DoQuote(QUOTE_JETPACK_ON, pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -454,7 +454,7 @@ void G_DoCheats(void)
|
|||
case CHEAT_ALLEN:
|
||||
P_DoQuote(QUOTE_CHEAT_ALLEN, pPlayer);
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_ClearKeyDown(sc_N);
|
||||
inputState.ClearKeyStatus(sc_N);
|
||||
return;
|
||||
|
||||
case CHEAT_CORNHOLIO:
|
||||
|
@ -632,7 +632,7 @@ void G_DoCheats(void)
|
|||
|
||||
case CHEAT_CASHMAN:
|
||||
ud.cashman = 1-ud.cashman;
|
||||
KB_ClearKeyDown(sc_N);
|
||||
inputState.ClearKeyStatus(sc_N);
|
||||
pPlayer->cheat_phase = 0;
|
||||
return;
|
||||
|
||||
|
@ -682,7 +682,7 @@ void G_DoCheats(void)
|
|||
|
||||
case CHEAT_BETA:
|
||||
P_DoQuote(QUOTE_CHEAT_BETA, pPlayer);
|
||||
KB_ClearKeyDown(sc_H);
|
||||
inputState.ClearKeyStatus(sc_H);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
|
@ -721,7 +721,7 @@ void G_DoCheats(void)
|
|||
pPlayer->player_par = 0;
|
||||
pPlayer->gm |= MODE_EOL;
|
||||
}
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAJOSEPH:
|
||||
|
@ -729,25 +729,25 @@ void G_DoCheats(void)
|
|||
pPlayer->ammo_amount[MOTORCYCLE_WEAPON] = pPlayer->max_ammo_amount[MOTORCYCLE_WEAPON];
|
||||
P_DoQuote(126, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAMRBILL:
|
||||
P_QuickKill(pPlayer);
|
||||
P_DoQuote(127, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAGARY:
|
||||
S_PlayRRMusic(10);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RANOAH:
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RARHETT:
|
||||
|
@ -758,33 +758,33 @@ void G_DoCheats(void)
|
|||
sprite[pPlayer->i].extra = 1;
|
||||
P_DoQuote(128, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAAARON:
|
||||
pPlayer->drug_mode = pPlayer->drug_mode ? 0 : 5;
|
||||
pPlayer->drug_timer = (int32_t) totalclock;
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RANOCHEAT:
|
||||
pPlayer->nocheat = 1;
|
||||
P_DoQuote(130, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RATONY:
|
||||
g_changeEnemySize = 2;
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAVAN:
|
||||
g_changeEnemySize = 3;
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAKFC:
|
||||
|
@ -797,7 +797,7 @@ void G_DoCheats(void)
|
|||
}
|
||||
P_DoQuote(139, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAWOLESLAGLE:
|
||||
|
@ -812,7 +812,7 @@ void G_DoCheats(void)
|
|||
P_DoQuote(131, pPlayer);
|
||||
}
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAMIKAEL:
|
||||
|
@ -830,7 +830,7 @@ void G_DoCheats(void)
|
|||
pPlayer->keys[key] = 1;
|
||||
P_DoQuote(5, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAGREG:
|
||||
|
@ -845,7 +845,7 @@ void G_DoCheats(void)
|
|||
P_DoQuote(137, pPlayer);
|
||||
}
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case CHEAT_RAARIJIT:
|
||||
|
@ -854,7 +854,7 @@ void G_DoCheats(void)
|
|||
pPlayer->ammo_amount[BOAT_WEAPON] = pPlayer->max_ammo_amount[BOAT_WEAPON];
|
||||
P_DoQuote(136, pPlayer);
|
||||
end_cheat(pPlayer);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -866,17 +866,17 @@ void G_DoCheats(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (KB_KeyPressed((uint8_t) CheatKeys[0]))
|
||||
if (inputState.GetKeyStatus((uint8_t) CheatKeys[0]))
|
||||
{
|
||||
if (pPlayer->cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0)
|
||||
{
|
||||
if (CheatKeys[0] == CheatKeys[1])
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[0]);
|
||||
inputState.ClearKeyStatus((uint8_t) CheatKeys[0]);
|
||||
pPlayer->cheat_phase = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (KB_KeyPressed((uint8_t) CheatKeys[1]))
|
||||
if (inputState.GetKeyStatus((uint8_t) CheatKeys[1]))
|
||||
{
|
||||
if (pPlayer->cheat_phase == -1)
|
||||
{
|
||||
|
@ -891,13 +891,13 @@ void G_DoCheats(void)
|
|||
// P_DoQuote(QUOTE_25,pPlayer);
|
||||
cheatbuflen = 0;
|
||||
}
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
else if (pPlayer->cheat_phase != 0)
|
||||
{
|
||||
pPlayer->cheat_phase = 0;
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[0]);
|
||||
KB_ClearKeyDown((uint8_t) CheatKeys[1]);
|
||||
inputState.ClearKeyStatus((uint8_t) CheatKeys[0]);
|
||||
inputState.ClearKeyStatus((uint8_t) CheatKeys[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -915,9 +915,9 @@ nextdemo_nomenu:
|
|||
{
|
||||
ControlInfo noshareinfo;
|
||||
CONTROL_GetInput(&noshareinfo);
|
||||
if (BUTTON(gamefunc_SendMessage))
|
||||
if (inputState.BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
g_player[myconnectindex].ps->gm = MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
|
|
|
@ -170,7 +170,7 @@ void G_HandleSpecialKeys(void)
|
|||
|
||||
// CONTROL_ProcessBinds();
|
||||
|
||||
if (/*g_networkMode != NET_DEDICATED_SERVER && */ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
|
||||
if (/*g_networkMode != NET_DEDICATED_SERVER && */ALT_IS_PRESSED && inputState.GetKeyStatus(sc_Enter))
|
||||
{
|
||||
if (videoSetGameMode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,ud.detail))
|
||||
{
|
||||
|
@ -179,14 +179,14 @@ void G_HandleSpecialKeys(void)
|
|||
G_GameExit("Failed to recover from failure to set fullscreen video mode.\n");
|
||||
}
|
||||
else ScreenMode = !ScreenMode;
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
g_restorePalette = 1;
|
||||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F12))
|
||||
if (inputState.UnboundKeyPressed(sc_F12))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F12);
|
||||
inputState.ClearKeyStatus(sc_F12);
|
||||
videoCaptureScreen();
|
||||
P_DoQuote(QUOTE_SCREEN_SAVED, g_player[myconnectindex].ps);
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ void G_HandleSpecialKeys(void)
|
|||
if (!(g_player[myconnectindex].ps->gm & MODE_GAME))
|
||||
OSD_DispatchQueued();
|
||||
|
||||
if (g_quickExit == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && (KB_KeyPressed(sc_Delete)||KB_KeyPressed(sc_End)))
|
||||
if (g_quickExit == 0 && inputState.GetKeyStatus(sc_LeftControl) && inputState.GetKeyStatus(sc_LeftAlt) && (inputState.GetKeyStatus(sc_Delete)||inputState.GetKeyStatus(sc_End)))
|
||||
{
|
||||
g_quickExit = 1;
|
||||
G_GameExit("Quick Exit.");
|
||||
|
@ -6034,18 +6034,18 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (g_player[myconnectindex].gotvote == 0 && voting != -1 && voting != myconnectindex)
|
||||
{
|
||||
if (KB_UnBoundKeyPressed(sc_F1) || KB_UnBoundKeyPressed(sc_F2) || cl_autovote)
|
||||
if (inputState.UnboundKeyPressed(sc_F1) || inputState.UnboundKeyPressed(sc_F2) || cl_autovote)
|
||||
{
|
||||
G_AddUserQuote("Vote Cast");
|
||||
Net_SendMapVote(KB_UnBoundKeyPressed(sc_F1) || cl_autovote ? cl_autovote-1 : 0);
|
||||
KB_ClearKeyDown(sc_F1);
|
||||
KB_ClearKeyDown(sc_F2);
|
||||
Net_SendMapVote(inputState.UnboundKeyPressed(sc_F1) || cl_autovote ? cl_autovote-1 : 0);
|
||||
inputState.ClearKeyStatus(sc_F1);
|
||||
inputState.ClearKeyStatus(sc_F2);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ALT_IS_PRESSED && ud.overhead_on == 0 && (g_player[myconnectindex].ps->gm & MODE_TYPE) == 0)
|
||||
{
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Enlarge_Screen);
|
||||
|
||||
|
@ -6064,7 +6064,7 @@ void G_HandleLocalKeys(void)
|
|||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Shrink_Screen))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Shrink_Screen);
|
||||
|
||||
|
@ -6087,7 +6087,7 @@ void G_HandleLocalKeys(void)
|
|||
if (g_player[myconnectindex].ps->cheat_phase == 1 || (g_player[myconnectindex].ps->gm&(MODE_MENU|MODE_TYPE)))
|
||||
return;
|
||||
|
||||
if (BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
||||
if (inputState.BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
|
@ -6095,21 +6095,21 @@ void G_HandleLocalKeys(void)
|
|||
g_restorePalette = -1;
|
||||
}
|
||||
|
||||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
if ((g_netServer || ud.multimode > 1) && inputState.BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Show_Opponents_Weapon);
|
||||
ud.config.ShowOpponentWeapons = ud.showweapons = 1-ud.showweapons;
|
||||
P_DoQuote(QUOTE_WEAPON_MODE_OFF-ud.showweapons,g_player[screenpeek].ps);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Toggle_Crosshair))
|
||||
if (inputState.BUTTON(gamefunc_Toggle_Crosshair))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Toggle_Crosshair);
|
||||
cl_crosshair = !cl_crosshair;
|
||||
P_DoQuote(QUOTE_CROSSHAIR_OFF-cl_crosshair,g_player[screenpeek].ps);
|
||||
}
|
||||
|
||||
if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode))
|
||||
if (ud.overhead_on && inputState.BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ud.scrollmode = 1-ud.scrollmode;
|
||||
|
@ -6122,9 +6122,9 @@ void G_HandleLocalKeys(void)
|
|||
P_DoQuote(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode,g_player[myconnectindex].ps);
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_ScrollLock))
|
||||
if (inputState.UnboundKeyPressed(sc_ScrollLock))
|
||||
{
|
||||
KB_ClearKeyDown(sc_ScrollLock);
|
||||
inputState.ClearKeyStatus(sc_ScrollLock);
|
||||
|
||||
switch (ud.recstat)
|
||||
{
|
||||
|
@ -6140,9 +6140,9 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (ud.recstat == 2)
|
||||
{
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
if (inputState.GetKeyStatus(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
|
||||
g_demo_paused = !g_demo_paused;
|
||||
g_demo_rewind = 0;
|
||||
|
@ -6151,18 +6151,18 @@ void G_HandleLocalKeys(void)
|
|||
FX_StopAllSounds();
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(sc_Tab))
|
||||
if (inputState.GetKeyStatus(sc_Tab))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearKeyStatus(sc_Tab);
|
||||
g_demo_showStats = !g_demo_showStats;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (KB_KeyPressed(sc_kpad_Plus))
|
||||
if (inputState.GetKeyStatus(sc_kpad_Plus))
|
||||
{
|
||||
G_InitTimer(240);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_kpad_Minus))
|
||||
else if (inputState.GetKeyStatus(sc_kpad_Minus))
|
||||
{
|
||||
G_InitTimer(60);
|
||||
}
|
||||
|
@ -6172,9 +6172,9 @@ void G_HandleLocalKeys(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (KB_KeyPressed(sc_kpad_6))
|
||||
if (inputState.GetKeyStatus(sc_kpad_6))
|
||||
{
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
inputState.ClearKeyStatus(sc_kpad_6);
|
||||
|
||||
int const fwdTics = (15 << (int)ALT_IS_PRESSED) << (2 * (int)SHIFTS_IS_PRESSED);
|
||||
g_demo_goalCnt = g_demo_paused ? g_demo_cnt + 1 : g_demo_cnt + REALGAMETICSPERSEC * fwdTics;
|
||||
|
@ -6185,9 +6185,9 @@ void G_HandleLocalKeys(void)
|
|||
else
|
||||
Demo_PrepareWarp();
|
||||
}
|
||||
else if (KB_KeyPressed(sc_kpad_4))
|
||||
else if (inputState.GetKeyStatus(sc_kpad_4))
|
||||
{
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
inputState.ClearKeyStatus(sc_kpad_4);
|
||||
|
||||
int const rewindTics = (15 << (int)ALT_IS_PRESSED) << (2 * (int)SHIFTS_IS_PRESSED);
|
||||
g_demo_goalCnt = g_demo_paused ? g_demo_cnt - 1 : g_demo_cnt - REALGAMETICSPERSEC * rewindTics;
|
||||
|
@ -6206,9 +6206,9 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
// NOTE: sc_F1 .. sc_F10 are contiguous. sc_F11 is not sc_F10+1.
|
||||
for (bssize_t j=sc_F1; j<=sc_F10; j++)
|
||||
if (KB_UnBoundKeyPressed(j))
|
||||
if (inputState.UnboundKeyPressed(j))
|
||||
{
|
||||
KB_ClearKeyDown(j);
|
||||
inputState.ClearKeyStatus(j);
|
||||
ridiculeNum = j - sc_F1 + 1;
|
||||
break;
|
||||
}
|
||||
|
@ -6257,17 +6257,17 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED && !WIN_IS_PRESSED)
|
||||
{
|
||||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_SendMessage))
|
||||
if ((g_netServer || ud.multimode > 1) && inputState.BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
g_player[myconnectindex].ps->gm |= MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F1)/* || (ud.show_help && I_AdvanceTrigger())*/)
|
||||
if (inputState.UnboundKeyPressed(sc_F1)/* || (ud.show_help && I_AdvanceTrigger())*/)
|
||||
{
|
||||
KB_ClearKeyDown(sc_F1);
|
||||
inputState.ClearKeyStatus(sc_F1);
|
||||
|
||||
Menu_Change(MENU_STORY);
|
||||
S_PauseSounds(true);
|
||||
|
@ -6283,9 +6283,9 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
// if((!net_server && ud.multimode < 2))
|
||||
{
|
||||
if (ud.recstat != 2 && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && KB_UnBoundKeyPressed(sc_F2))
|
||||
if (ud.recstat != 2 && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && inputState.UnboundKeyPressed(sc_F2))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F2);
|
||||
inputState.ClearKeyStatus(sc_F2);
|
||||
|
||||
FAKE_F2:
|
||||
if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
|
||||
|
@ -6307,9 +6307,9 @@ FAKE_F2:
|
|||
}
|
||||
}
|
||||
|
||||
if ((!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && KB_UnBoundKeyPressed(sc_F3))
|
||||
if ((!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && inputState.UnboundKeyPressed(sc_F3))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F3);
|
||||
inputState.ClearKeyStatus(sc_F3);
|
||||
|
||||
FAKE_F3:
|
||||
Menu_Change(MENU_LOAD);
|
||||
|
@ -6326,9 +6326,9 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F4))
|
||||
if (inputState.UnboundKeyPressed(sc_F4))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F4);
|
||||
inputState.ClearKeyStatus(sc_F4);
|
||||
|
||||
S_PauseSounds(true);
|
||||
Menu_Open(myconnectindex);
|
||||
|
@ -6342,12 +6342,12 @@ FAKE_F3:
|
|||
Menu_Change(MENU_SOUND_INGAME);
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F5) && MusicEnabled())
|
||||
if (inputState.UnboundKeyPressed(sc_F5) && MusicEnabled())
|
||||
{
|
||||
map_t *const pMapInfo = &g_mapInfo[g_musicIndex];
|
||||
char *const musicString = apStrings[QUOTE_MUSIC];
|
||||
|
||||
KB_ClearKeyDown(sc_F5);
|
||||
inputState.ClearKeyStatus(sc_F5);
|
||||
|
||||
if (pMapInfo->musicfn != NULL)
|
||||
Bsnprintf(musicString, MAXQUOTELEN, "%s. Use SHIFT-F5 to change.", pMapInfo->musicfn);
|
||||
|
@ -6357,7 +6357,7 @@ FAKE_F3:
|
|||
P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps);
|
||||
}
|
||||
|
||||
if ((BUTTON(gamefunc_Quick_Save) || g_doQuickSave == 1) && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && (g_player[myconnectindex].ps->gm&MODE_GAME))
|
||||
if ((inputState.BUTTON(gamefunc_Quick_Save) || g_doQuickSave == 1) && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && (g_player[myconnectindex].ps->gm&MODE_GAME))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Quick_Save);
|
||||
|
||||
|
@ -6366,7 +6366,7 @@ FAKE_F3:
|
|||
if (!g_lastusersave.isValid())
|
||||
goto FAKE_F2;
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
|
||||
if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
|
||||
{
|
||||
|
@ -6394,7 +6394,7 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Third_Person_View))
|
||||
if (inputState.BUTTON(gamefunc_Third_Person_View))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Third_Person_View);
|
||||
|
||||
|
@ -6409,9 +6409,9 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F8))
|
||||
if (inputState.UnboundKeyPressed(sc_F8))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F8);
|
||||
inputState.ClearKeyStatus(sc_F8);
|
||||
|
||||
int const fta = !ud.fta_on;
|
||||
ud.fta_on = 1;
|
||||
|
@ -6419,7 +6419,7 @@ FAKE_F3:
|
|||
ud.fta_on = fta;
|
||||
}
|
||||
|
||||
if ((BUTTON(gamefunc_Quick_Load) || g_doQuickSave == 2) && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && (g_player[myconnectindex].ps->gm&MODE_GAME))
|
||||
if ((inputState.BUTTON(gamefunc_Quick_Load) || g_doQuickSave == 2) && (!RRRA || ud.player_skill != 4) && (!RR || RRRA || ud.player_skill != 5) && (g_player[myconnectindex].ps->gm&MODE_GAME))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Quick_Load);
|
||||
|
||||
|
@ -6429,17 +6429,17 @@ FAKE_F3:
|
|||
goto FAKE_F3;
|
||||
else if (g_quickload->isValid())
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
S_PauseSounds(true);
|
||||
if (G_LoadPlayerMaybeMulti(*g_quickload) != 0)
|
||||
g_quickload->reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F10))
|
||||
if (inputState.UnboundKeyPressed(sc_F10))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F10);
|
||||
inputState.ClearKeyStatus(sc_F10);
|
||||
|
||||
Menu_Change(MENU_QUIT_INGAME);
|
||||
S_PauseSounds(true);
|
||||
|
@ -6452,9 +6452,9 @@ FAKE_F3:
|
|||
}
|
||||
}
|
||||
|
||||
if (KB_UnBoundKeyPressed(sc_F11))
|
||||
if (inputState.UnboundKeyPressed(sc_F11))
|
||||
{
|
||||
KB_ClearKeyDown(sc_F11);
|
||||
inputState.ClearKeyStatus(sc_F11);
|
||||
|
||||
Menu_Change(MENU_COLCORR_INGAME);
|
||||
S_PauseSounds(true);
|
||||
|
@ -6472,10 +6472,10 @@ FAKE_F3:
|
|||
int const timerOffset = ((int) totalclock - nonsharedtimer);
|
||||
nonsharedtimer += timerOffset;
|
||||
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Enlarge_Screen))
|
||||
g_player[myconnectindex].ps->zoom += mulscale6(timerOffset, max<int>(g_player[myconnectindex].ps->zoom, 256));
|
||||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
if (inputState.BUTTON(gamefunc_Shrink_Screen))
|
||||
g_player[myconnectindex].ps->zoom -= mulscale6(timerOffset, max<int>(g_player[myconnectindex].ps->zoom, 256));
|
||||
|
||||
g_player[myconnectindex].ps->zoom = clamp(g_player[myconnectindex].ps->zoom, 48, 2048);
|
||||
|
@ -6491,14 +6491,14 @@ FAKE_F3:
|
|||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_AutoRun))
|
||||
if (inputState.BUTTON(gamefunc_AutoRun))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_AutoRun);
|
||||
cl_autorun = !cl_autorun;
|
||||
P_DoQuote(QUOTE_RUN_MODE_OFF+cl_autorun,g_player[myconnectindex].ps);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Map))
|
||||
if (inputState.BUTTON(gamefunc_Map))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map);
|
||||
if (ud.last_overhead != ud.overhead_on && ud.last_overhead)
|
||||
|
@ -7440,7 +7440,7 @@ void G_BackToMenu(void)
|
|||
g_player[myconnectindex].ps->gm = 0;
|
||||
Menu_Open(myconnectindex);
|
||||
Menu_Change(MENU_MAIN);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
static int G_EndOfLevel(void)
|
||||
|
@ -8003,7 +8003,7 @@ MAIN_LOOP_RESTART:
|
|||
// handle CON_SAVE and CON_SAVENN
|
||||
if (g_saveRequested)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
videoNextPage();
|
||||
|
||||
g_screenCapture = 1;
|
||||
|
|
|
@ -1063,7 +1063,7 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags)
|
|||
if (g_quickload && g_quickload->isValid() && ud.recstat != 2)
|
||||
{
|
||||
Menu_Open(playerNum);
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
I_AdvanceTriggerClear();
|
||||
Menu_Change(MENU_RESETPLAYER);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ int32_t g_skillSoundVoice = -1;
|
|||
|
||||
static FORCE_INLINE void Menu_StartTextInput()
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
#if defined EDUKE32_TOUCH_DEVICES && defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1
|
||||
# if defined __ANDROID__
|
||||
AndroidShowKeyboard(1);
|
||||
|
@ -3237,26 +3237,26 @@ static void Menu_PreInput(MenuEntry_t *entry)
|
|||
{
|
||||
|
||||
case MENU_KEYBOARDKEYS:
|
||||
if (KB_KeyPressed(sc_Delete))
|
||||
if (inputState.GetKeyStatus(sc_Delete))
|
||||
{
|
||||
Bindings.UnbindACommand(CONFIG_FunctionNumToName(M_KEYBOARDKEYS.currentEntry));
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
inputState.ClearKeyStatus(sc_Delete);
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_LOAD:
|
||||
if (KB_KeyPressed(sc_Delete))
|
||||
if (inputState.GetKeyStatus(sc_Delete))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
inputState.ClearKeyStatus(sc_Delete);
|
||||
if (M_LOAD.currentEntry < g_nummenusaves)
|
||||
Menu_Change(MENU_LOADDELVERIFY);
|
||||
}
|
||||
break;
|
||||
case MENU_SAVE:
|
||||
if (KB_KeyPressed(sc_Delete))
|
||||
if (inputState.GetKeyStatus(sc_Delete))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
inputState.ClearKeyStatus(sc_Delete);
|
||||
if (0 < M_SAVE.currentEntry && M_SAVE.currentEntry <= (int32_t)g_nummenusaves)
|
||||
Menu_Change(MENU_SAVEDELVERIFY);
|
||||
}
|
||||
|
@ -3292,13 +3292,13 @@ static int32_t Menu_PreCustom2ColScreen(MenuEntry_t *entry)
|
|||
{
|
||||
auto *column = (MenuCustom2Col_t*)entry->entry;
|
||||
|
||||
int32_t sc = KB_GetLastScanCode();
|
||||
int32_t sc = inputState.GetLastScanCode();
|
||||
if (sc != sc_None)
|
||||
{
|
||||
S_PlaySound(PISTOL_BODYHIT);
|
||||
*column->column[M_KEYBOARDKEYS.currentColumn] = sc;
|
||||
Bindings.SetBind(sc, CONFIG_FunctionNumToName(M_KEYBOARDKEYS.currentEntry));
|
||||
KB_ClearKeyDown(sc);
|
||||
inputState.ClearKeyStatus(sc);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -3766,8 +3766,8 @@ static void Menu_Custom2ColScreen(/*MenuEntry_t *entry*/)
|
|||
{
|
||||
if (g_currentMenu == MENU_KEYBOARDKEYS)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearLastScanCode();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearLastScanCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3936,8 +3936,8 @@ static void Menu_Verify(int32_t input)
|
|||
switch (input)
|
||||
{
|
||||
default:
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
FX_StopAllSounds();
|
||||
|
||||
if (G_LoadPlayerMaybeMulti(*g_quickload) == 0)
|
||||
|
@ -3976,8 +3976,8 @@ static void Menu_Verify(int32_t input)
|
|||
g_quickload = &g_lastusersave;
|
||||
}
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
|
||||
Menu_Change(MENU_CLOSE);
|
||||
|
||||
|
@ -4183,7 +4183,7 @@ static void Menu_FileSelectInit(MenuFileSelect_t *object)
|
|||
object->currentList = 1;
|
||||
|
||||
#endif
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
static void Menu_FileSelect(int32_t input)
|
||||
|
@ -6794,29 +6794,29 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
|
||||
S_PlaySound(RR ? 341 : PISTOL_BODYHIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
|
||||
Menu_RunInput_FileSelect_Movement(object, MM_Home);
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
|
||||
Menu_RunInput_FileSelect_Movement(object, MM_End);
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgUp))
|
||||
else if (inputState.GetKeyStatus(sc_PgUp))
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
|
||||
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
inputState.ClearKeyStatus(sc_PgUp);
|
||||
|
||||
for (i = 0; i < 6; ++i)
|
||||
{
|
||||
|
@ -6833,13 +6833,13 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgDn))
|
||||
else if (inputState.GetKeyStatus(sc_PgDn))
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList];
|
||||
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
inputState.ClearKeyStatus(sc_PgDn);
|
||||
|
||||
for (i = 0; i < 6; ++i)
|
||||
{
|
||||
|
@ -6888,7 +6888,7 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
{
|
||||
// JBF 20040208: seek to first name matching pressed character
|
||||
char ch2, ch;
|
||||
ch = KB_GetCh();
|
||||
ch = inputState.keyGetChar();
|
||||
if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9')))
|
||||
{
|
||||
CACHE1D_FIND_REC *seeker = object->findhigh[object->currentList]->usera;
|
||||
|
@ -6944,10 +6944,10 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
break;
|
||||
|
||||
case Verify:
|
||||
if (I_ReturnTrigger() || KB_KeyPressed(sc_N) || Menu_RunInput_MouseReturn())
|
||||
if (I_ReturnTrigger() || inputState.GetKeyStatus(sc_N) || Menu_RunInput_MouseReturn())
|
||||
{
|
||||
I_ReturnTriggerClear();
|
||||
KB_ClearKeyDown(sc_N);
|
||||
inputState.ClearKeyStatus(sc_N);
|
||||
m_mousecaught = 1;
|
||||
|
||||
Menu_Verify(0);
|
||||
|
@ -6957,12 +6957,12 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlaySound(EXITMENUSOUND);
|
||||
}
|
||||
|
||||
if (I_AdvanceTrigger() || KB_KeyPressed(sc_Y) || Menu_RunInput_MouseAdvance())
|
||||
if (I_AdvanceTrigger() || inputState.GetKeyStatus(sc_Y) || Menu_RunInput_MouseAdvance())
|
||||
{
|
||||
auto *verify = (MenuVerify_t*)cm->object;
|
||||
|
||||
I_AdvanceTriggerClear();
|
||||
KB_ClearKeyDown(sc_Y);
|
||||
inputState.ClearKeyStatus(sc_Y);
|
||||
m_mousecaught = 1;
|
||||
|
||||
Menu_Verify(1);
|
||||
|
@ -7038,9 +7038,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_1))
|
||||
else if (inputState.GetKeyStatus(sc_1))
|
||||
{
|
||||
KB_ClearKeyDown(sc_1);
|
||||
inputState.ClearKeyStatus(sc_1);
|
||||
menu->currentEntry = 0;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7050,9 +7050,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_2))
|
||||
else if (inputState.GetKeyStatus(sc_2))
|
||||
{
|
||||
KB_ClearKeyDown(sc_2);
|
||||
inputState.ClearKeyStatus(sc_2);
|
||||
menu->currentEntry = 1;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7062,9 +7062,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_3))
|
||||
else if (inputState.GetKeyStatus(sc_3))
|
||||
{
|
||||
KB_ClearKeyDown(sc_3);
|
||||
inputState.ClearKeyStatus(sc_3);
|
||||
menu->currentEntry = 2;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7074,9 +7074,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_4))
|
||||
else if (inputState.GetKeyStatus(sc_4))
|
||||
{
|
||||
KB_ClearKeyDown(sc_4);
|
||||
inputState.ClearKeyStatus(sc_4);
|
||||
menu->currentEntry = 3;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7086,9 +7086,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_5))
|
||||
else if (inputState.GetKeyStatus(sc_5))
|
||||
{
|
||||
KB_ClearKeyDown(sc_5);
|
||||
inputState.ClearKeyStatus(sc_5);
|
||||
menu->currentEntry = 4;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7098,9 +7098,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_6))
|
||||
else if (inputState.GetKeyStatus(sc_6))
|
||||
{
|
||||
KB_ClearKeyDown(sc_6);
|
||||
inputState.ClearKeyStatus(sc_6);
|
||||
menu->currentEntry = 5;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7110,9 +7110,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_7))
|
||||
else if (inputState.GetKeyStatus(sc_7))
|
||||
{
|
||||
KB_ClearKeyDown(sc_7);
|
||||
inputState.ClearKeyStatus(sc_7);
|
||||
menu->currentEntry = 6;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7122,9 +7122,9 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
S_PlayRRMusic(2+menu->currentEntry);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_8))
|
||||
else if (inputState.GetKeyStatus(sc_8))
|
||||
{
|
||||
KB_ClearKeyDown(sc_8);
|
||||
inputState.ClearKeyStatus(sc_8);
|
||||
menu->currentEntry = 7;
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
@ -7334,17 +7334,17 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
|
||||
Menu_AnimateChange(cm->parentID, cm->parentAnimation);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
||||
currentry = Menu_RunInput_Menu_Movement(menu, MM_Home);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
||||
|
@ -7416,17 +7416,17 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
if (!Menu_RunInput_EntryOptionList_Activate(currentry, object))
|
||||
S_PlaySound(RR ? 341 : PISTOL_BODYHIT);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
||||
Menu_RunInput_EntryOptionList_Movement(object, MM_Home);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
|
||||
S_PlaySound(RR ? 335 : KICK_HIT);
|
||||
|
||||
|
@ -7482,7 +7482,7 @@ void M_DisplayMenus(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Menu_IsTextInput(m_currentMenu) && KB_KeyPressed(sc_Q))
|
||||
if (!Menu_IsTextInput(m_currentMenu) && inputState.GetKeyStatus(sc_Q))
|
||||
Menu_AnimateChange(MENU_QUIT, MA_Advance);
|
||||
|
||||
int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs);
|
||||
|
|
|
@ -3644,9 +3644,9 @@ void Net_SendMessage(void)
|
|||
|
||||
mpgametext(mpgametext_x, ud.screen_size > 0 ? (200-45)<<16 : (200-8)<<16, typebuf, 0, 0, 0, 0);
|
||||
|
||||
if (KB_KeyWaiting())
|
||||
if (inputState.keyBufferWaiting())
|
||||
{
|
||||
i = KB_GetCh();
|
||||
i = inputState.keyGetChar();
|
||||
|
||||
if (i == 'A' || i == 'a' || i == 13)
|
||||
g_chatPlayer = ud.multimode;
|
||||
|
@ -3664,17 +3664,17 @@ void Net_SendMessage(void)
|
|||
typebuf[0] = 0;
|
||||
}
|
||||
|
||||
KB_ClearKeyDown(sc_1);
|
||||
KB_ClearKeyDown(sc_2);
|
||||
KB_ClearKeyDown(sc_3);
|
||||
KB_ClearKeyDown(sc_4);
|
||||
KB_ClearKeyDown(sc_5);
|
||||
KB_ClearKeyDown(sc_6);
|
||||
KB_ClearKeyDown(sc_7);
|
||||
KB_ClearKeyDown(sc_8);
|
||||
KB_ClearKeyDown(sc_A);
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_1);
|
||||
inputState.ClearKeyStatus(sc_2);
|
||||
inputState.ClearKeyStatus(sc_3);
|
||||
inputState.ClearKeyStatus(sc_4);
|
||||
inputState.ClearKeyStatus(sc_5);
|
||||
inputState.ClearKeyStatus(sc_6);
|
||||
inputState.ClearKeyStatus(sc_7);
|
||||
inputState.ClearKeyStatus(sc_8);
|
||||
inputState.ClearKeyStatus(sc_A);
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3695,7 +3695,7 @@ void Net_SendMessage(void)
|
|||
|
||||
if (hitstate == 1)
|
||||
{
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
if (Bstrlen(typebuf) == 0)
|
||||
{
|
||||
g_player[myconnectindex].ps->gm &= ~(MODE_TYPE|MODE_SENDTOWHOM);
|
||||
|
|
|
@ -2743,7 +2743,7 @@ void P_GetInput(int playerNum)
|
|||
auto const pPlayer = g_player[playerNum].ps;
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -2759,11 +2759,11 @@ void P_GetInput(int playerNum)
|
|||
D_ProcessEvents();
|
||||
|
||||
if (in_aimmode)
|
||||
g_MyAimMode = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_MyAimMode = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
else
|
||||
{
|
||||
g_oldAimStat = g_myAimStat;
|
||||
g_myAimStat = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_myAimStat = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
|
||||
if (g_myAimStat > g_oldAimStat)
|
||||
{
|
||||
|
@ -2797,7 +2797,7 @@ void P_GetInput(int playerNum)
|
|||
|
||||
// JBF: Run key behaviour is selectable
|
||||
|
||||
int const playerRunning = G_CheckAutorun(BUTTON(gamefunc_Run));
|
||||
int const playerRunning = G_CheckAutorun(inputState.BUTTON(gamefunc_Run));
|
||||
int const turnAmount = playerRunning ? (NORMALTURN << 1) : NORMALTURN;
|
||||
constexpr int const analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
|
@ -2805,7 +2805,7 @@ void P_GetInput(int playerNum)
|
|||
|
||||
input_t input {};
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (inputState.BUTTON(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
|
@ -2831,12 +2831,12 @@ void P_GetInput(int playerNum)
|
|||
input.svel -= info.dx * keyMove / analogExtent;
|
||||
input.fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (inputState.BUTTON(gamefunc_Strafe))
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left) && !(pPlayer->movement_lock&4))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left) && !(pPlayer->movement_lock&4))
|
||||
input.svel -= -keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Turn_Right) && !(pPlayer->movement_lock&8))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Right) && !(pPlayer->movement_lock&8))
|
||||
input.svel -= keyMove;
|
||||
}
|
||||
else
|
||||
|
@ -2847,12 +2847,12 @@ void P_GetInput(int playerNum)
|
|||
|
||||
lastInputClock = (int32_t) totalclock;
|
||||
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel -= fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
|
||||
}
|
||||
else if (BUTTON(gamefunc_Turn_Right))
|
||||
else if (inputState.BUTTON(gamefunc_Turn_Right))
|
||||
{
|
||||
turnHeldTime += elapsedTics;
|
||||
input.q16avel += fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
|
||||
|
@ -2861,24 +2861,24 @@ void P_GetInput(int playerNum)
|
|||
turnHeldTime=0;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Left) && !(pPlayer->movement_lock & 4))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Left) && !(pPlayer->movement_lock & 4))
|
||||
input.svel += keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Right) && !(pPlayer->movement_lock & 8))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Right) && !(pPlayer->movement_lock & 8))
|
||||
input.svel += -keyMove;
|
||||
|
||||
if (RR)
|
||||
{
|
||||
/*if (BUTTON(gamefunc_Quick_Kick))
|
||||
/*if (inputState.BUTTON(gamefunc_Quick_Kick))
|
||||
{
|
||||
localInput.bits |= BUTTON(gamefunc_Move_Forward)<<SK_AIM_UP;
|
||||
localInput.bits |= BUTTON(gamefunc_Move_Backward)<<SK_AIM_DOWN;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Move_Forward)<<SK_AIM_UP;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Move_Backward)<<SK_AIM_DOWN;
|
||||
}
|
||||
else*/
|
||||
{
|
||||
if (pPlayer->drink_amt >= 66 && pPlayer->drink_amt <= 87)
|
||||
{
|
||||
if (BUTTON(gamefunc_Move_Forward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward))
|
||||
{
|
||||
input.fvel += keyMove;
|
||||
if (pPlayer->drink_amt & 1)
|
||||
|
@ -2887,7 +2887,7 @@ void P_GetInput(int playerNum)
|
|||
input.svel -= keyMove;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Backward))
|
||||
{
|
||||
input.fvel += -keyMove;
|
||||
if (pPlayer->drink_amt & 1)
|
||||
|
@ -2898,20 +2898,20 @@ void P_GetInput(int playerNum)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Move_Forward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward))
|
||||
input.fvel += keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Backward))
|
||||
input.fvel += -keyMove;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Move_Forward) && !(g_player[playerNum].ps->movement_lock & 1))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward) && !(g_player[playerNum].ps->movement_lock & 1))
|
||||
input.fvel += keyMove;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward) && !(g_player[playerNum].ps->movement_lock & 2))
|
||||
if (inputState.BUTTON(gamefunc_Move_Backward) && !(g_player[playerNum].ps->movement_lock & 2))
|
||||
input.fvel += -keyMove;
|
||||
}
|
||||
|
||||
|
@ -2925,31 +2925,31 @@ void P_GetInput(int playerNum)
|
|||
|
||||
for (weaponSelection = gamefunc_Weapon_10; weaponSelection >= gamefunc_Weapon_1; --weaponSelection)
|
||||
{
|
||||
if (BUTTON(weaponSelection))
|
||||
if (inputState.BUTTON(weaponSelection))
|
||||
{
|
||||
weaponSelection -= (gamefunc_Weapon_1 - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Last_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Last_Weapon))
|
||||
weaponSelection = 14;
|
||||
else if (BUTTON(gamefunc_Alt_Weapon))
|
||||
else if (inputState.BUTTON(gamefunc_Alt_Weapon))
|
||||
weaponSelection = 13;
|
||||
else if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel > 0))
|
||||
else if (inputState.BUTTON(gamefunc_Next_Weapon) || (inputState.BUTTON(gamefunc_Dpad_Select) && input.fvel > 0))
|
||||
weaponSelection = 12;
|
||||
else if (BUTTON(gamefunc_Previous_Weapon) || (BUTTON(gamefunc_Dpad_Select) && input.fvel < 0))
|
||||
else if (inputState.BUTTON(gamefunc_Previous_Weapon) || (inputState.BUTTON(gamefunc_Dpad_Select) && input.fvel < 0))
|
||||
weaponSelection = 11;
|
||||
else if (weaponSelection == gamefunc_Weapon_1-1)
|
||||
weaponSelection = 0;
|
||||
|
||||
localInput.bits = (weaponSelection << SK_WEAPON_BITS) | (BUTTON(gamefunc_Fire) << SK_FIRE);
|
||||
localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN);
|
||||
localInput.bits = (weaponSelection << SK_WEAPON_BITS) | (inputState.BUTTON(gamefunc_Fire) << SK_FIRE);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Open) << SK_OPEN);
|
||||
|
||||
int const sectorLotag = pPlayer->cursectnum != -1 ? sector[pPlayer->cursectnum].lotag : 0;
|
||||
int const crouchable = sectorLotag != 2 && (sectorLotag != 1 || pPlayer->spritebridge);
|
||||
|
||||
if (BUTTON(gamefunc_Toggle_Crouch))
|
||||
if (inputState.BUTTON(gamefunc_Toggle_Crouch))
|
||||
{
|
||||
pPlayer->crouch_toggle = !pPlayer->crouch_toggle && crouchable;
|
||||
|
||||
|
@ -2957,38 +2957,38 @@ void P_GetInput(int playerNum)
|
|||
inputState.ClearButton(gamefunc_Toggle_Crouch);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Crouch) || BUTTON(gamefunc_Jump) || pPlayer->jetpack_on || (!crouchable && pPlayer->on_ground))
|
||||
if (inputState.BUTTON(gamefunc_Crouch) || inputState.BUTTON(gamefunc_Jump) || pPlayer->jetpack_on || (!crouchable && pPlayer->on_ground))
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
||||
int const crouching = BUTTON(gamefunc_Crouch) || BUTTON(gamefunc_Toggle_Crouch) || pPlayer->crouch_toggle;
|
||||
int const crouching = inputState.BUTTON(gamefunc_Crouch) || inputState.BUTTON(gamefunc_Toggle_Crouch) || pPlayer->crouch_toggle;
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | (crouching << SK_CROUCH);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Jump) << SK_JUMP) | (crouching << SK_CROUCH);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP;
|
||||
localInput.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN;
|
||||
localInput.bits |= (BUTTON(gamefunc_Center_View) << SK_CENTER_VIEW);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Aim_Up) || (inputState.BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Aim_Down) || (inputState.BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Center_View) << SK_CENTER_VIEW);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Look_Left) << SK_LOOK_LEFT) | (BUTTON(gamefunc_Look_Right) << SK_LOOK_RIGHT);
|
||||
localInput.bits |= (BUTTON(gamefunc_Look_Up) << SK_LOOK_UP) | (BUTTON(gamefunc_Look_Down) << SK_LOOK_DOWN);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Look_Left) << SK_LOOK_LEFT) | (inputState.BUTTON(gamefunc_Look_Right) << SK_LOOK_RIGHT);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Look_Up) << SK_LOOK_UP) | (inputState.BUTTON(gamefunc_Look_Down) << SK_LOOK_DOWN);
|
||||
|
||||
localInput.bits |= (playerRunning << SK_RUN);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Left) || (BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Right) || (BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory) << SK_INVENTORY);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Left) || (inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Right) || (inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory) << SK_INVENTORY);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Steroids) << SK_STEROIDS) | (BUTTON(gamefunc_NightVision) << SK_NIGHTVISION);
|
||||
localInput.bits |= (BUTTON(gamefunc_MedKit) << SK_MEDKIT) | (BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE);
|
||||
localInput.bits |= (BUTTON(gamefunc_Jetpack) << SK_JETPACK);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Steroids) << SK_STEROIDS) | (inputState.BUTTON(gamefunc_NightVision) << SK_NIGHTVISION);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_MedKit) << SK_MEDKIT) | (inputState.BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE);
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Jetpack) << SK_JETPACK);
|
||||
|
||||
localInput.bits |= BUTTON(gamefunc_Holster_Weapon) << SK_HOLSTER;
|
||||
localInput.bits |= BUTTON(gamefunc_Quick_Kick) << SK_QUICK_KICK;
|
||||
localInput.bits |= BUTTON(gamefunc_TurnAround) << SK_TURNAROUND;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Holster_Weapon) << SK_HOLSTER;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Quick_Kick) << SK_QUICK_KICK;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_TurnAround) << SK_TURNAROUND;
|
||||
|
||||
localInput.bits |= (g_MyAimMode << SK_AIMMODE);
|
||||
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
|
||||
localInput.bits |= KB_KeyPressed(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= ((uint32_t)KB_KeyPressed(sc_Escape)) << SK_ESCAPE;
|
||||
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE;
|
||||
|
||||
if (RR)
|
||||
{
|
||||
|
@ -3000,21 +3000,21 @@ void P_GetInput(int playerNum)
|
|||
localInput.bits |= 1 << SK_LOOK_DOWN;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Dpad_Select))
|
||||
if (inputState.BUTTON(gamefunc_Dpad_Select))
|
||||
{
|
||||
input.fvel = 0;
|
||||
input.svel = 0;
|
||||
input.q16avel = 0;
|
||||
}
|
||||
else if (BUTTON(gamefunc_Dpad_Aiming))
|
||||
else if (inputState.BUTTON(gamefunc_Dpad_Aiming))
|
||||
input.fvel = 0;
|
||||
|
||||
localInput.extbits = (BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
localInput.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
|
||||
localInput.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
|
||||
localInput.extbits = (inputState.BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
localInput.extbits |= inputState.BUTTON(gamefunc_Turn_Left)<<4;
|
||||
localInput.extbits |= inputState.BUTTON(gamefunc_Turn_Right)<<5;
|
||||
|
||||
if (ud.scrollmode && ud.overhead_on)
|
||||
{
|
||||
|
@ -3049,7 +3049,7 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
auto const pPlayer = g_player[playerNum].ps;
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -3065,11 +3065,11 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
D_ProcessEvents();
|
||||
|
||||
if (in_aimmode)
|
||||
g_MyAimMode = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_MyAimMode = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
else
|
||||
{
|
||||
g_oldAimStat = g_myAimStat;
|
||||
g_myAimStat = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_myAimStat = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
|
||||
if (g_myAimStat > g_oldAimStat)
|
||||
{
|
||||
|
@ -3102,7 +3102,7 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
}
|
||||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = G_CheckAutorun(BUTTON(gamefunc_Run));
|
||||
int const playerRunning = G_CheckAutorun(inputState.BUTTON(gamefunc_Run));
|
||||
constexpr int const analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp
|
||||
|
@ -3128,40 +3128,40 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
||||
localInput.bits = BUTTON(gamefunc_Fire) << SK_FIRE;
|
||||
localInput.bits |= BUTTON(gamefunc_Steroids) << SK_STEROIDS;
|
||||
localInput.bits |= BUTTON(gamefunc_NightVision) << SK_NIGHTVISION;
|
||||
localInput.bits |= BUTTON(gamefunc_MedKit) << SK_MEDKIT;
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Left) ||
|
||||
(BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= KB_KeyPressed(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE;
|
||||
localInput.bits |= BUTTON(gamefunc_Jetpack) << SK_JETPACK;
|
||||
localInput.bits = inputState.BUTTON(gamefunc_Fire) << SK_FIRE;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Steroids) << SK_STEROIDS;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_NightVision) << SK_NIGHTVISION;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_MedKit) << SK_MEDKIT;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Left) ||
|
||||
(inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Jetpack) << SK_JETPACK;
|
||||
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Right) ||
|
||||
(BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= BUTTON(gamefunc_Open) << SK_OPEN;
|
||||
localInput.bits |= BUTTON(gamefunc_Inventory) << SK_INVENTORY;
|
||||
localInput.bits |= ((uint32_t)KB_KeyPressed(sc_Escape)) << SK_ESCAPE;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Right) ||
|
||||
(inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Open) << SK_OPEN;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Inventory) << SK_INVENTORY;
|
||||
localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE;
|
||||
|
||||
if (BUTTON(gamefunc_Dpad_Select))
|
||||
if (inputState.BUTTON(gamefunc_Dpad_Select))
|
||||
{
|
||||
input.fvel = 0;
|
||||
input.svel = 0;
|
||||
input.q16avel = 0;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Dpad_Aiming))
|
||||
if (inputState.BUTTON(gamefunc_Dpad_Aiming))
|
||||
input.fvel = 0;
|
||||
|
||||
localInput.extbits = (BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
localInput.extbits = (inputState.BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
|
||||
int const turn = input.q16avel / 32;
|
||||
int turnLeft = BUTTON(gamefunc_Turn_Left) || BUTTON(gamefunc_Strafe_Left);
|
||||
int turnRight = BUTTON(gamefunc_Turn_Right) || BUTTON(gamefunc_Strafe_Right);
|
||||
int turnLeft = inputState.BUTTON(gamefunc_Turn_Left) || inputState.BUTTON(gamefunc_Strafe_Left);
|
||||
int turnRight = inputState.BUTTON(gamefunc_Turn_Right) || inputState.BUTTON(gamefunc_Strafe_Right);
|
||||
int avelScale = F16((turnLeft || turnRight) ? 1 : 0);
|
||||
if (turn)
|
||||
{
|
||||
|
@ -3176,9 +3176,9 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
|
||||
if (!pPlayer->moto_underwater)
|
||||
{
|
||||
localInput.bits |= (BUTTON(gamefunc_Move_Forward) || BUTTON(gamefunc_Strafe)) << SK_JUMP;
|
||||
localInput.bits |= BUTTON(gamefunc_Move_Backward) << SK_AIM_UP;
|
||||
localInput.bits |= BUTTON(gamefunc_Run) << SK_CROUCH;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Move_Forward) || inputState.BUTTON(gamefunc_Strafe)) << SK_JUMP;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Move_Backward) << SK_AIM_UP;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Run) << SK_CROUCH;
|
||||
}
|
||||
|
||||
localInput.bits |= turnLeft << SK_AIM_DOWN;
|
||||
|
@ -3188,7 +3188,7 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
static int32_t lastInputClock = 0; // MED
|
||||
int32_t const elapsedTics = (int32_t) totalclock - lastInputClock;
|
||||
|
||||
int const moveBack = BUTTON(gamefunc_Move_Backward) && pPlayer->moto_speed <= 0;
|
||||
int const moveBack = inputState.BUTTON(gamefunc_Move_Backward) && pPlayer->moto_speed <= 0;
|
||||
|
||||
if (pPlayer->moto_speed == 0 || !pPlayer->on_ground)
|
||||
{
|
||||
|
@ -3347,7 +3347,7 @@ void P_GetInputBoat(int playerNum)
|
|||
auto const pPlayer = g_player[playerNum].ps;
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -3363,11 +3363,11 @@ void P_GetInputBoat(int playerNum)
|
|||
D_ProcessEvents();
|
||||
|
||||
if (in_aimmode)
|
||||
g_MyAimMode = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_MyAimMode = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
else
|
||||
{
|
||||
g_oldAimStat = g_myAimStat;
|
||||
g_myAimStat = BUTTON(gamefunc_Mouse_Aiming);
|
||||
g_myAimStat = inputState.BUTTON(gamefunc_Mouse_Aiming);
|
||||
|
||||
if (g_myAimStat > g_oldAimStat)
|
||||
{
|
||||
|
@ -3400,7 +3400,7 @@ void P_GetInputBoat(int playerNum)
|
|||
}
|
||||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = G_CheckAutorun(BUTTON(gamefunc_Run));
|
||||
int const playerRunning = G_CheckAutorun(inputState.BUTTON(gamefunc_Run));
|
||||
constexpr int const analogTurnAmount = (NORMALTURN << 1);
|
||||
int const keyMove = playerRunning ? (NORMALKEYMOVE << 1) : NORMALKEYMOVE;
|
||||
constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp
|
||||
|
@ -3426,40 +3426,40 @@ void P_GetInputBoat(int playerNum)
|
|||
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
||||
localInput.bits = BUTTON(gamefunc_Fire) << SK_FIRE;
|
||||
localInput.bits |= BUTTON(gamefunc_Steroids) << SK_STEROIDS;
|
||||
localInput.bits |= BUTTON(gamefunc_NightVision) << SK_NIGHTVISION;
|
||||
localInput.bits |= BUTTON(gamefunc_MedKit) << SK_MEDKIT;
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Left) ||
|
||||
(BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= KB_KeyPressed(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE;
|
||||
localInput.bits |= BUTTON(gamefunc_Jetpack) << SK_JETPACK;
|
||||
localInput.bits = inputState.BUTTON(gamefunc_Fire) << SK_FIRE;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Steroids) << SK_STEROIDS;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_NightVision) << SK_NIGHTVISION;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_MedKit) << SK_MEDKIT;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Left) ||
|
||||
(inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel > 0 || input.q16avel < 0))) << SK_INV_LEFT;
|
||||
localInput.bits |= inputState.GetKeyStatus(sc_Pause) << SK_PAUSE;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Holo_Duke) << SK_HOLODUKE;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Jetpack) << SK_JETPACK;
|
||||
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
|
||||
localInput.bits |= (BUTTON(gamefunc_Inventory_Right) ||
|
||||
(BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= BUTTON(gamefunc_Open) << SK_OPEN;
|
||||
localInput.bits |= BUTTON(gamefunc_Inventory) << SK_INVENTORY;
|
||||
localInput.bits |= ((uint32_t)KB_KeyPressed(sc_Escape)) << SK_ESCAPE;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Inventory_Right) ||
|
||||
(inputState.BUTTON(gamefunc_Dpad_Select) && (input.svel < 0 || input.q16avel > 0))) << SK_INV_RIGHT;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Open) << SK_OPEN;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Inventory) << SK_INVENTORY;
|
||||
localInput.bits |= ((uint32_t)inputState.GetKeyStatus(sc_Escape)) << SK_ESCAPE;
|
||||
|
||||
if (BUTTON(gamefunc_Dpad_Select))
|
||||
if (inputState.BUTTON(gamefunc_Dpad_Select))
|
||||
{
|
||||
input.fvel = 0;
|
||||
input.svel = 0;
|
||||
input.q16avel = 0;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Dpad_Aiming))
|
||||
if (inputState.BUTTON(gamefunc_Dpad_Aiming))
|
||||
input.fvel = 0;
|
||||
|
||||
localInput.extbits = (BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
localInput.extbits = (inputState.BUTTON(gamefunc_Move_Forward) || (input.fvel > 0));
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Move_Backward) || (input.fvel < 0)) << 1;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Left) || (input.svel > 0)) << 2;
|
||||
localInput.extbits |= (inputState.BUTTON(gamefunc_Strafe_Right) || (input.svel < 0)) << 3;
|
||||
|
||||
int const turn = input.q16avel / 32;
|
||||
int turnLeft = BUTTON(gamefunc_Turn_Left) || BUTTON(gamefunc_Strafe_Left);
|
||||
int turnRight = BUTTON(gamefunc_Turn_Right) || BUTTON(gamefunc_Strafe_Right);
|
||||
int turnLeft = inputState.BUTTON(gamefunc_Turn_Left) || inputState.BUTTON(gamefunc_Strafe_Left);
|
||||
int turnRight = inputState.BUTTON(gamefunc_Turn_Right) || inputState.BUTTON(gamefunc_Strafe_Right);
|
||||
int avelScale = F16((turnLeft || turnRight) ? 1 : 0);
|
||||
if (turn)
|
||||
{
|
||||
|
@ -3472,9 +3472,9 @@ void P_GetInputBoat(int playerNum)
|
|||
|
||||
input.svel = input.fvel = input.q16avel = input.q16horz = 0;
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Move_Forward) || BUTTON(gamefunc_Strafe)) << SK_JUMP;
|
||||
localInput.bits |= BUTTON(gamefunc_Move_Backward) << SK_AIM_UP;
|
||||
localInput.bits |= BUTTON(gamefunc_Run) << SK_CROUCH;
|
||||
localInput.bits |= (inputState.BUTTON(gamefunc_Move_Forward) || inputState.BUTTON(gamefunc_Strafe)) << SK_JUMP;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Move_Backward) << SK_AIM_UP;
|
||||
localInput.bits |= inputState.BUTTON(gamefunc_Run) << SK_CROUCH;
|
||||
|
||||
localInput.bits |= turnLeft << SK_AIM_DOWN;
|
||||
localInput.bits |= turnRight << SK_LOOK_LEFT;
|
||||
|
|
|
@ -528,7 +528,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
|
|||
|
||||
if (!statustext)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
ud.screen_size = i;
|
||||
}
|
||||
}
|
||||
|
@ -2205,9 +2205,9 @@ static void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t e
|
|||
sampletimer();
|
||||
nexttic += ticwait;
|
||||
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
if (inputState.GetKeyStatus(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1253,7 +1253,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
gametext_center(70, "Press F1 to Accept, F2 to Decline");
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Show_DukeMatch_Scores))
|
||||
if (inputState.BUTTON(gamefunc_Show_DukeMatch_Scores))
|
||||
G_ShowScores();
|
||||
|
||||
if (g_Debug)
|
||||
|
@ -1321,9 +1321,9 @@ void fadepal(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_
|
|||
// (end-start)/step + 1 iterations
|
||||
do
|
||||
{
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
if (inputState.GetKeyStatus(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
videoFadePalette(r, g, b, end); // have to set to end fade value if we break!
|
||||
return;
|
||||
}
|
||||
|
@ -1350,9 +1350,9 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t
|
|||
#ifdef __ANDROID__ //Needed for N7 2013 to stop corruption while fading video
|
||||
videoClearViewableArea(0);
|
||||
#endif
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
if (inputState.GetKeyStatus(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
inputState.ClearKeyStatus(sc_Space);
|
||||
videoFadePalette(r, g, b, end); // have to set to end fade value if we break!
|
||||
return;
|
||||
}
|
||||
|
@ -1579,7 +1579,7 @@ void G_DisplayLogo(void)
|
|||
P_SetGamePalette(g_player[myconnectindex].ps, TITLEPAL, 8+2+1); // JBF 20040308
|
||||
renderFlushPerms();
|
||||
rotatesprite_fs(160<<16, 100<<16, 65536L, 0, BETASCREEN, 0, 0, 2+8+64+BGSTRETCH);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
fadepaltile(0, 0, 0, 252, 0, -28, BETASCREEN);
|
||||
totalclock = 0;
|
||||
|
||||
|
@ -2206,7 +2206,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
G_FadePalette(0, 0, 0, 252); // JBF 20031228
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
totalclock = 0;
|
||||
bonuscnt = 0;
|
||||
|
||||
|
@ -2594,7 +2594,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
I_ClearAllInput();
|
||||
if (totalclock < (60*13))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
totalclock = (60*13);
|
||||
}
|
||||
else if (totalclock < 1000000000)
|
||||
|
@ -2784,7 +2784,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
{
|
||||
showMap = 1;
|
||||
MUSIC_StopSong();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1);
|
||||
G_ShowMapFrame();
|
||||
|
@ -2798,7 +2798,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
|
||||
//G_FadePalette(0, 0, 0, 252); // JBF 20031228
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
totalclock = 0;
|
||||
bonuscnt = 0;
|
||||
|
||||
|
@ -3104,7 +3104,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
|
||||
if (totalclock < (60*13))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
totalclock = (60*13);
|
||||
}
|
||||
else if (totalclock < 1000000000)
|
||||
|
|
|
@ -3642,7 +3642,7 @@ void P_HandleSharedKeys(int playerNum)
|
|||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_PAUSE))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Pause);
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
if (ud.pause_on)
|
||||
ud.pause_on = 0;
|
||||
else ud.pause_on = 1+SHIFTS_IS_PRESSED;
|
||||
|
|
|
@ -271,8 +271,8 @@ playanm(short anim_num)
|
|||
|
||||
ANIMnum = anim_num;
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
|
||||
DSPRINTF(ds,"PlayAnm");
|
||||
MONO_PRINT(ds);
|
||||
|
@ -322,11 +322,11 @@ playanm(short anim_num)
|
|||
switch (ANIMnum)
|
||||
{
|
||||
case ANIM_INTRO:
|
||||
if (KB_KeyWaiting() || uinfo.button0 || uinfo.button1 || quitevent)
|
||||
if (inputState.keyBufferWaiting() || uinfo.button0 || uinfo.button1 || quitevent)
|
||||
goto ENDOFANIMLOOP;
|
||||
break;
|
||||
case ANIM_SERP:
|
||||
if (KB_KeyPressed(KEYSC_ESC) || uinfo.button1 || quitevent)
|
||||
if (inputState.GetKeyStatus(KEYSC_ESC) || uinfo.button1 || quitevent)
|
||||
goto ENDOFANIMLOOP;
|
||||
break;
|
||||
}
|
||||
|
@ -371,8 +371,8 @@ ENDOFANIMLOOP:
|
|||
|
||||
videoSetPalette(0, BASEPAL, 2);
|
||||
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearKeysDown();
|
||||
ANIM_FreeAnim();
|
||||
}
|
||||
END_SW_NS
|
||||
|
|
|
@ -399,9 +399,9 @@ void CheatInput(void)
|
|||
|
||||
if (!CheatInputMode)
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_S))
|
||||
if (inputState.GetKeyStatus(KEYSC_S))
|
||||
{
|
||||
//KB_KeyPressed(KEYSC_S) = FALSE;
|
||||
//inputState.GetKeyStatus(KEYSC_S) = FALSE;
|
||||
CheatInputMode = TRUE;
|
||||
strcpy(CheatInputString,"s");
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ void CheatInput(void)
|
|||
case FALSE: // Input finished (RETURN)
|
||||
case -1: // Cancel Input (pressed ESC) or Err
|
||||
CheatInputMode = FALSE;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
return;
|
||||
|
||||
case TRUE: // Got input
|
||||
|
@ -446,7 +446,7 @@ void CheatInput(void)
|
|||
match = TRUE;
|
||||
|
||||
CheatInputMode = FALSE;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
|
||||
if (ci[i].CheatInputFunc)
|
||||
(*ci[i].CheatInputFunc)(Player, CheatInputString);
|
||||
|
@ -467,7 +467,7 @@ void CheatInput(void)
|
|||
//MONO_PRINT(ds);
|
||||
|
||||
CheatInputMode = FALSE;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -457,21 +457,21 @@ DemoPlayBack(void)
|
|||
// fast forward and slow mo
|
||||
if (DemoEdit)
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_F))
|
||||
if (inputState.GetKeyStatus(KEYSC_F))
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
|
||||
if (inputState.GetKeyStatus(KEYSC_LSHIFT) || inputState.GetKeyStatus(KEYSC_RSHIFT))
|
||||
totalclock += synctics;
|
||||
else
|
||||
totalclock += synctics-1;
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(KEYSC_S))
|
||||
if (inputState.GetKeyStatus(KEYSC_S))
|
||||
totalclock += 1-synctics;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (BUTTON(gamefunc_See_Coop_View))
|
||||
if (inputState.BUTTON(gamefunc_See_Coop_View))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
|
||||
|
@ -497,16 +497,16 @@ DemoPlayBack(void)
|
|||
|
||||
// if a key is pressed, start recording from the point the key
|
||||
// was pressed
|
||||
if (BUTTON(gamefunc_Move_Forward) ||
|
||||
BUTTON(gamefunc_Move_Backward) ||
|
||||
BUTTON(gamefunc_Turn_Left) ||
|
||||
BUTTON(gamefunc_Turn_Right) ||
|
||||
BUTTON(gamefunc_Fire) ||
|
||||
BUTTON(gamefunc_Open) ||
|
||||
BUTTON(gamefunc_Jump) ||
|
||||
BUTTON(gamefunc_Crouch) ||
|
||||
BUTTON(gamefunc_Look_Up) ||
|
||||
BUTTON(gamefunc_Look_Down))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward) ||
|
||||
inputState.BUTTON(gamefunc_Move_Backward) ||
|
||||
inputState.BUTTON(gamefunc_Turn_Left) ||
|
||||
inputState.BUTTON(gamefunc_Turn_Right) ||
|
||||
inputState.BUTTON(gamefunc_Fire) ||
|
||||
inputState.BUTTON(gamefunc_Open) ||
|
||||
inputState.BUTTON(gamefunc_Jump) ||
|
||||
inputState.BUTTON(gamefunc_Crouch) ||
|
||||
inputState.BUTTON(gamefunc_Look_Up) ||
|
||||
inputState.BUTTON(gamefunc_Look_Down))
|
||||
{
|
||||
DemoBackupBuffer();
|
||||
|
||||
|
@ -517,7 +517,7 @@ DemoPlayBack(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_See_Co_Op_View))
|
||||
if (inputState.BUTTON(gamefunc_See_Co_Op_View))
|
||||
{
|
||||
screenpeek += 1;
|
||||
if (screenpeek > numplayers-1)
|
||||
|
|
|
@ -1044,17 +1044,17 @@ ResizeView(PLAYERp pp)
|
|||
|
||||
if (dimensionmode == 2 || dimensionmode == 5 || dimensionmode == 6)
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_DASH)||KB_KeyPressed(KEYSC_GMINUS))
|
||||
if (inputState.GetKeyStatus(KEYSC_DASH)||inputState.GetKeyStatus(KEYSC_GMINUS))
|
||||
{
|
||||
if ((zoom -= (zoom >> 4)) < 48) zoom = 48;
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(KEYSC_EQUAL)||KB_KeyPressed(KEYSC_GPLUS))
|
||||
if (inputState.GetKeyStatus(KEYSC_EQUAL)||inputState.GetKeyStatus(KEYSC_GPLUS))
|
||||
{
|
||||
if ((zoom += (zoom >> 4)) > 4096) zoom = 4096;
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(KEYSC_ESC))
|
||||
if (inputState.GetKeyStatus(KEYSC_ESC))
|
||||
{
|
||||
extern SWBOOL ScrollMode2D;
|
||||
|
||||
|
@ -1066,14 +1066,14 @@ ResizeView(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Shrink_Screen)) // &&
|
||||
if (inputState.BUTTON(gamefunc_Shrink_Screen)) // &&
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Shrink_Screen);
|
||||
SetBorder(pp, gs.BorderNum + 1);
|
||||
SetRedrawScreen(pp);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Enlarge_Screen)) // &&
|
||||
if (inputState.BUTTON(gamefunc_Enlarge_Screen)) // &&
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Enlarge_Screen);
|
||||
SetBorder(pp, gs.BorderNum - 1);
|
||||
|
@ -1671,7 +1671,7 @@ void ScreenCaptureKeys(void)
|
|||
return;
|
||||
|
||||
// screen capture
|
||||
if (KB_KeyPressed(KEYSC_F12))
|
||||
if (inputState.GetKeyStatus(KEYSC_F12))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F12);
|
||||
PauseAction();
|
||||
|
|
|
@ -1603,7 +1603,7 @@ KeyPressed(void)
|
|||
|
||||
for (i = 0; i < NUMKEYS; i++)
|
||||
{
|
||||
if (KB_KeyPressed(i))
|
||||
if (inputState.GetKeyStatus(i))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1797,7 +1797,7 @@ CreditsLevel(void)
|
|||
if (!SongIsPlaying())
|
||||
break;
|
||||
|
||||
if (KB_KeyPressed(KEYSC_ESC))
|
||||
if (inputState.GetKeyStatus(KEYSC_ESC))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2170,7 +2170,7 @@ MenuLevel(void)
|
|||
BorderAdjust = TRUE;
|
||||
//LoadGameOutsideMoveLoop = FALSE;
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
//ExitMenus();
|
||||
UsingMenus = FALSE;
|
||||
InMenuLevel = FALSE;
|
||||
|
@ -2410,7 +2410,7 @@ BonusScreen(PLAYERp pp)
|
|||
videoClearViewableArea(0L);
|
||||
videoNextPage();
|
||||
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
|
||||
totalclock = ototalclock = 0;
|
||||
limit = synctics;
|
||||
|
@ -2444,7 +2444,7 @@ BonusScreen(PLAYERp pp)
|
|||
|
||||
CONTROL_GetUserInput(&uinfo);
|
||||
CONTROL_ClearUserInput(&uinfo);
|
||||
if (KB_KeyPressed(KEYSC_SPACE) || KB_KeyPressed(KEYSC_ENTER) || uinfo.button0 || uinfo.button1)
|
||||
if (inputState.GetKeyStatus(KEYSC_SPACE) || inputState.GetKeyStatus(KEYSC_ENTER) || uinfo.button0 || uinfo.button1)
|
||||
{
|
||||
if (State >= s_BonusRest && State < &s_BonusRest[SIZ(s_BonusRest)])
|
||||
{
|
||||
|
@ -2738,7 +2738,7 @@ StatScreen(PLAYERp mpp)
|
|||
PlaySong(voc[DIGI_ENDLEV].name, 3, TRUE, TRUE);
|
||||
}
|
||||
|
||||
while (!KB_KeyPressed(KEYSC_SPACE) && !KB_KeyPressed(KEYSC_ENTER))
|
||||
while (!inputState.GetKeyStatus(KEYSC_SPACE) && !inputState.GetKeyStatus(KEYSC_ENTER))
|
||||
{
|
||||
handleevents();
|
||||
|
||||
|
@ -3443,7 +3443,7 @@ SinglePlayInput(PLAYERp pp)
|
|||
int pnum = myconnectindex;
|
||||
uint8_t* kp;
|
||||
|
||||
if (BUTTON(gamefunc_See_Co_Op_View) && !UsingMenus && !ConPanel && dimensionmode == 3)
|
||||
if (inputState.BUTTON(gamefunc_See_Co_Op_View) && !UsingMenus && !ConPanel && dimensionmode == 3)
|
||||
{
|
||||
short oldscreenpeek = screenpeek;
|
||||
|
||||
|
@ -3479,7 +3479,7 @@ DebugKeys(PLAYERp pp)
|
|||
{
|
||||
short w, h;
|
||||
|
||||
if (!(KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT)))
|
||||
if (!(inputState.GetKeyStatus(KEYSC_ALT) || inputState.GetKeyStatus(KEYSC_RALT)))
|
||||
return;
|
||||
|
||||
if (InputMode)
|
||||
|
@ -3492,9 +3492,9 @@ DebugKeys(PLAYERp pp)
|
|||
// visiblity adjust
|
||||
//
|
||||
|
||||
if (KB_KeyPressed(KEYSC_L) > 0)
|
||||
if (inputState.GetKeyStatus(KEYSC_L) > 0)
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_LSHIFT) | KB_KeyPressed(KEYSC_RSHIFT)) // SHIFT
|
||||
if (inputState.GetKeyStatus(KEYSC_LSHIFT) | inputState.GetKeyStatus(KEYSC_RSHIFT)) // SHIFT
|
||||
{
|
||||
g_visibility = g_visibility - (g_visibility >> 3);
|
||||
|
||||
|
@ -3506,7 +3506,7 @@ DebugKeys(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
KB_KeyPressed(KEYSC_L) = 0;
|
||||
inputState.GetKeyStatus(KEYSC_L) = 0;
|
||||
|
||||
g_visibility = g_visibility - (g_visibility >> 3);
|
||||
|
||||
|
@ -3519,12 +3519,12 @@ DebugKeys(PLAYERp pp)
|
|||
// parallax changes
|
||||
//
|
||||
|
||||
if (KB_KeyPressed(KEYSC_X))
|
||||
if (inputState.GetKeyStatus(KEYSC_X))
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_LSHIFT))
|
||||
if (inputState.GetKeyStatus(KEYSC_LSHIFT))
|
||||
{
|
||||
KB_KeyPressed(KEYSC_LSHIFT) = FALSE;
|
||||
KB_KeyPressed(KEYSC_X) = 0;
|
||||
inputState.GetKeyStatus(KEYSC_LSHIFT) = FALSE;
|
||||
inputState.GetKeyStatus(KEYSC_X) = 0;
|
||||
|
||||
parallaxyoffs_override += 10;
|
||||
|
||||
|
@ -3533,7 +3533,7 @@ DebugKeys(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
KB_KeyPressed(KEYSC_X) = 0;
|
||||
inputState.GetKeyStatus(KEYSC_X) = 0;
|
||||
parallaxtype++;
|
||||
if (parallaxtype > 2)
|
||||
parallaxtype = 0;
|
||||
|
@ -3550,12 +3550,12 @@ ConKey(void)
|
|||
// Console Input Panel
|
||||
if (!ConPanel && dimensionmode == 3)
|
||||
{
|
||||
//if (KB_KeyPressed(KEYSC_TILDE) && KB_KeyPressed(KEYSC_LSHIFT))
|
||||
if (KB_KeyPressed(KEYSC_TILDE))
|
||||
//if (inputState.GetKeyStatus(KEYSC_TILDE) && inputState.GetKeyStatus(KEYSC_LSHIFT))
|
||||
if (inputState.GetKeyStatus(KEYSC_TILDE))
|
||||
{
|
||||
KB_KeyPressed(KEYSC_TILDE) = FALSE;
|
||||
//KB_KeyPressed(KEYSC_LSHIFT) = FALSE;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.GetKeyStatus(KEYSC_TILDE) = FALSE;
|
||||
//inputState.GetKeyStatus(KEYSC_LSHIFT) = FALSE;
|
||||
inputState.keyFlushChars();
|
||||
ConPanel = TRUE;
|
||||
InputMode = TRUE;
|
||||
ConInputMode = TRUE;
|
||||
|
@ -3566,12 +3566,12 @@ ConKey(void)
|
|||
}
|
||||
else if (ConPanel)
|
||||
{
|
||||
//if (KB_KeyPressed(KEYSC_TILDE) && KB_KeyPressed(KEYSC_LSHIFT))
|
||||
if (KB_KeyPressed(KEYSC_TILDE))
|
||||
//if (inputState.GetKeyStatus(KEYSC_TILDE) && inputState.GetKeyStatus(KEYSC_LSHIFT))
|
||||
if (inputState.GetKeyStatus(KEYSC_TILDE))
|
||||
{
|
||||
KB_KeyPressed(KEYSC_TILDE) = FALSE;
|
||||
//KB_KeyPressed(KEYSC_LSHIFT) = FALSE;
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.GetKeyStatus(KEYSC_TILDE) = FALSE;
|
||||
//inputState.GetKeyStatus(KEYSC_LSHIFT) = FALSE;
|
||||
inputState.keyFlushChars();
|
||||
ConPanel = FALSE;
|
||||
ConInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
|
@ -3594,16 +3594,16 @@ FunctionKeys(PLAYERp pp)
|
|||
|
||||
rts_delay++;
|
||||
|
||||
if (KB_KeyPressed(sc_F1)) { fn_key = 1; }
|
||||
if (KB_KeyPressed(sc_F2)) { fn_key = 2; }
|
||||
if (KB_KeyPressed(sc_F3)) { fn_key = 3; }
|
||||
if (KB_KeyPressed(sc_F4)) { fn_key = 4; }
|
||||
if (KB_KeyPressed(sc_F5)) { fn_key = 5; }
|
||||
if (KB_KeyPressed(sc_F6)) { fn_key = 6; }
|
||||
if (KB_KeyPressed(sc_F7)) { fn_key = 7; }
|
||||
if (KB_KeyPressed(sc_F8)) { fn_key = 8; }
|
||||
if (KB_KeyPressed(sc_F9)) { fn_key = 9; }
|
||||
if (KB_KeyPressed(sc_F10)) { fn_key = 10; }
|
||||
if (inputState.GetKeyStatus(sc_F1)) { fn_key = 1; }
|
||||
if (inputState.GetKeyStatus(sc_F2)) { fn_key = 2; }
|
||||
if (inputState.GetKeyStatus(sc_F3)) { fn_key = 3; }
|
||||
if (inputState.GetKeyStatus(sc_F4)) { fn_key = 4; }
|
||||
if (inputState.GetKeyStatus(sc_F5)) { fn_key = 5; }
|
||||
if (inputState.GetKeyStatus(sc_F6)) { fn_key = 6; }
|
||||
if (inputState.GetKeyStatus(sc_F7)) { fn_key = 7; }
|
||||
if (inputState.GetKeyStatus(sc_F8)) { fn_key = 8; }
|
||||
if (inputState.GetKeyStatus(sc_F9)) { fn_key = 9; }
|
||||
if (inputState.GetKeyStatus(sc_F10)) { fn_key = 10; }
|
||||
|
||||
if (inputState.AltPressed())
|
||||
{
|
||||
|
@ -3661,7 +3661,7 @@ FunctionKeys(PLAYERp pp)
|
|||
if (numplayers <= 1)
|
||||
{
|
||||
// F2 save menu
|
||||
if (KB_KeyPressed(KEYSC_F2))
|
||||
if (inputState.GetKeyStatus(KEYSC_F2))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F2);
|
||||
if (!TEST(pp->Flags, PF_DEAD))
|
||||
|
@ -3672,7 +3672,7 @@ FunctionKeys(PLAYERp pp)
|
|||
}
|
||||
|
||||
// F3 load menu
|
||||
if (KB_KeyPressed(KEYSC_F3))
|
||||
if (inputState.GetKeyStatus(KEYSC_F3))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F3);
|
||||
if (!TEST(pp->Flags, PF_DEAD))
|
||||
|
@ -3683,7 +3683,7 @@ FunctionKeys(PLAYERp pp)
|
|||
}
|
||||
|
||||
// F6 option menu
|
||||
if (KB_KeyPressed(KEYSC_F6))
|
||||
if (inputState.GetKeyStatus(KEYSC_F6))
|
||||
{
|
||||
extern SWBOOL QuickSaveMode;
|
||||
inputState.ClearKeyStatus(KEYSC_F6);
|
||||
|
@ -3696,7 +3696,7 @@ FunctionKeys(PLAYERp pp)
|
|||
}
|
||||
|
||||
// F9 quick load
|
||||
if (KB_KeyPressed(KEYSC_F9))
|
||||
if (inputState.GetKeyStatus(KEYSC_F9))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F9);
|
||||
|
||||
|
@ -3708,7 +3708,7 @@ FunctionKeys(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.SetKeyStatus(sc_Escape);
|
||||
ControlPanelType = ct_quickloadmenu;
|
||||
}
|
||||
|
@ -3719,7 +3719,7 @@ FunctionKeys(PLAYERp pp)
|
|||
|
||||
|
||||
// F4 sound menu
|
||||
if (KB_KeyPressed(KEYSC_F4))
|
||||
if (inputState.GetKeyStatus(KEYSC_F4))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F4);
|
||||
inputState.SetKeyStatus(sc_Escape);
|
||||
|
@ -3728,11 +3728,11 @@ FunctionKeys(PLAYERp pp)
|
|||
|
||||
|
||||
// F7 VIEW control
|
||||
if (KB_KeyPressed(KEYSC_F7))
|
||||
if (inputState.GetKeyStatus(KEYSC_F7))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F7);
|
||||
|
||||
if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
|
||||
if (inputState.GetKeyStatus(KEYSC_LSHIFT) || inputState.GetKeyStatus(KEYSC_RSHIFT))
|
||||
{
|
||||
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||
pp->view_outside_dang = NORM_ANGLE(pp->view_outside_dang + 256);
|
||||
|
@ -3752,7 +3752,7 @@ FunctionKeys(PLAYERp pp)
|
|||
}
|
||||
|
||||
// F8 toggle messages
|
||||
if (KB_KeyPressed(KEYSC_F8))
|
||||
if (inputState.GetKeyStatus(KEYSC_F8))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F8);
|
||||
|
||||
|
@ -3765,7 +3765,7 @@ FunctionKeys(PLAYERp pp)
|
|||
}
|
||||
|
||||
// F10 quit menu
|
||||
if (KB_KeyPressed(KEYSC_F10))
|
||||
if (inputState.GetKeyStatus(KEYSC_F10))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F10);
|
||||
inputState.SetKeyStatus(sc_Escape);
|
||||
|
@ -3773,7 +3773,7 @@ FunctionKeys(PLAYERp pp)
|
|||
}
|
||||
|
||||
// F11 gamma correction
|
||||
if (KB_KeyPressed(KEYSC_F11) > 0)
|
||||
if (inputState.GetKeyStatus(KEYSC_F11) > 0)
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F11);
|
||||
// Do this entirely in the video backend.
|
||||
|
@ -3787,7 +3787,7 @@ void PauseKey(PLAYERp pp)
|
|||
extern short QuickLoadNum;
|
||||
extern SWBOOL enabled;
|
||||
|
||||
if (KB_KeyPressed(sc_Pause) && !CommEnabled && !InputMode && !UsingMenus && !CheatInputMode && !ConPanel)
|
||||
if (inputState.GetKeyStatus(sc_Pause) && !CommEnabled && !InputMode && !UsingMenus && !CheatInputMode && !ConPanel)
|
||||
{
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
|
||||
|
@ -3844,10 +3844,10 @@ void GetMessageInput(PLAYERp pp)
|
|||
|
||||
if (!MessageInputMode && !ConInputMode)
|
||||
{
|
||||
if (BUTTON(gamefunc_SendMessage))
|
||||
if (inputState.BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.keyFlushChars();
|
||||
MessageInputMode = TRUE;
|
||||
InputMode = TRUE;
|
||||
TeamSendTeam = FALSE;
|
||||
|
@ -3870,8 +3870,8 @@ void GetMessageInput(PLAYERp pp)
|
|||
case -1: // Cancel Input (pressed ESC) or Err
|
||||
MessageInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
break;
|
||||
case FALSE: // Input finished (RETURN)
|
||||
if (MessageInputString[0] == '\0')
|
||||
|
@ -3879,8 +3879,8 @@ void GetMessageInput(PLAYERp pp)
|
|||
// no input
|
||||
MessageInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
}
|
||||
else
|
||||
|
@ -3913,8 +3913,8 @@ SEND_MESSAGE:
|
|||
// broadcast message
|
||||
MessageInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
CON_ProcessUserCommand(); // Check to see if it's a cheat or command
|
||||
|
||||
|
@ -4001,24 +4001,24 @@ void GetConInput(PLAYERp pp)
|
|||
{
|
||||
case -1: // Cancel Input (pressed ESC) or Err
|
||||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
memset(MessageInputString, '\0', sizeof(MessageInputString));
|
||||
break;
|
||||
case FALSE: // Input finished (RETURN)
|
||||
if (MessageInputString[0] == '\0')
|
||||
{
|
||||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
memset(MessageInputString, '\0', sizeof(MessageInputString));
|
||||
}
|
||||
else
|
||||
{
|
||||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
CON_ConMessage("%s", MessageInputString);
|
||||
CON_ProcessUserCommand(); // Check to see if it's a cheat or command
|
||||
|
@ -4041,10 +4041,10 @@ void GetHelpInput(PLAYERp pp)
|
|||
{
|
||||
extern SWBOOL GamePaused;
|
||||
|
||||
if (KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT))
|
||||
if (inputState.GetKeyStatus(KEYSC_ALT) || inputState.GetKeyStatus(KEYSC_RALT))
|
||||
return;
|
||||
|
||||
if (KB_KeyPressed(KEYSC_LSHIFT) || KB_KeyPressed(KEYSC_RSHIFT))
|
||||
if (inputState.GetKeyStatus(KEYSC_LSHIFT) || inputState.GetKeyStatus(KEYSC_RSHIFT))
|
||||
return;
|
||||
|
||||
if (MessageInputMode || ConInputMode)
|
||||
|
@ -4053,7 +4053,7 @@ void GetHelpInput(PLAYERp pp)
|
|||
// F1 help menu
|
||||
if (!HelpInputMode)
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_F1))
|
||||
if (inputState.GetKeyStatus(KEYSC_F1))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_F11);
|
||||
HelpPage = 0;
|
||||
|
@ -4066,10 +4066,10 @@ void GetHelpInput(PLAYERp pp)
|
|||
}
|
||||
else if (HelpInputMode)
|
||||
{
|
||||
if (KB_KeyPressed(KEYSC_ESC))
|
||||
if (inputState.GetKeyStatus(KEYSC_ESC))
|
||||
{
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
PanelUpdateMode = TRUE;
|
||||
HelpInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
|
@ -4078,7 +4078,7 @@ void GetHelpInput(PLAYERp pp)
|
|||
SetRedrawScreen(pp);
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(KEYSC_SPACE) || KB_KeyPressed(KEYSC_ENTER) || KB_KeyPressed(KEYSC_PGDN) || KB_KeyPressed(KEYSC_DOWN) || KB_KeyPressed(KEYSC_RIGHT) || KB_KeyPressed(sc_kpad_3) || KB_KeyPressed(sc_kpad_2) || KB_KeyPressed(sc_kpad_6))
|
||||
if (inputState.GetKeyStatus(KEYSC_SPACE) || inputState.GetKeyStatus(KEYSC_ENTER) || inputState.GetKeyStatus(KEYSC_PGDN) || inputState.GetKeyStatus(KEYSC_DOWN) || inputState.GetKeyStatus(KEYSC_RIGHT) || inputState.GetKeyStatus(sc_kpad_3) || inputState.GetKeyStatus(sc_kpad_2) || inputState.GetKeyStatus(sc_kpad_6))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_SPACE);
|
||||
inputState.ClearKeyStatus(KEYSC_ENTER);
|
||||
|
@ -4098,7 +4098,7 @@ void GetHelpInput(PLAYERp pp)
|
|||
// CTW MODIFICATION END
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(KEYSC_PGUP) || KB_KeyPressed(KEYSC_UP) || KB_KeyPressed(KEYSC_LEFT) || KB_KeyPressed(sc_kpad_9) || KB_KeyPressed(sc_kpad_8) || KB_KeyPressed(sc_kpad_4))
|
||||
if (inputState.GetKeyStatus(KEYSC_PGUP) || inputState.GetKeyStatus(KEYSC_UP) || inputState.GetKeyStatus(KEYSC_LEFT) || inputState.GetKeyStatus(sc_kpad_9) || inputState.GetKeyStatus(sc_kpad_8) || inputState.GetKeyStatus(sc_kpad_4))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_PGUP);
|
||||
inputState.ClearKeyStatus(KEYSC_UP);
|
||||
|
@ -4167,7 +4167,7 @@ getinput(SW_PACKET *loc)
|
|||
if (in_aimmode)
|
||||
g_MyAimMode = 0;
|
||||
|
||||
if (BUTTON(gamefunc_Mouse_Aiming))
|
||||
if (inputState.BUTTON(gamefunc_Mouse_Aiming))
|
||||
{
|
||||
if (in_aimmode)
|
||||
g_MyAimMode = 1;
|
||||
|
@ -4205,7 +4205,7 @@ getinput(SW_PACKET *loc)
|
|||
}
|
||||
|
||||
// MAP KEY
|
||||
if (BUTTON(gamefunc_Map))
|
||||
if (inputState.BUTTON(gamefunc_Map))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map);
|
||||
|
||||
|
@ -4230,7 +4230,7 @@ getinput(SW_PACKET *loc)
|
|||
// Toggle follow map mode on/off
|
||||
if (dimensionmode == 5 || dimensionmode == 6)
|
||||
{
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode))
|
||||
if (inputState.BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ScrollMode2D = !ScrollMode2D;
|
||||
|
@ -4249,11 +4249,11 @@ getinput(SW_PACKET *loc)
|
|||
if (MenuInputMode || UsingMenus || ScrollMode2D || InputMode)
|
||||
return;
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, ((!!KB_KeyPressed(KEYSC_SPACE)) | BUTTON(gamefunc_Open)));
|
||||
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, ((!!inputState.GetKeyStatus(KEYSC_SPACE)) | inputState.BUTTON(gamefunc_Open)));
|
||||
|
||||
running = G_CheckAutorun(BUTTON(gamefunc_Run));
|
||||
running = G_CheckAutorun(inputState.BUTTON(gamefunc_Run));
|
||||
|
||||
if (BUTTON(gamefunc_Strafe) && !pp->sop)
|
||||
if (inputState.BUTTON(gamefunc_Strafe) && !pp->sop)
|
||||
svel = -info.dyaw;
|
||||
else
|
||||
{
|
||||
|
@ -4291,16 +4291,16 @@ getinput(SW_PACKET *loc)
|
|||
keymove = NORMALKEYMOVE;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Strafe) && !pp->sop)
|
||||
if (inputState.BUTTON(gamefunc_Strafe) && !pp->sop)
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left))
|
||||
svel -= -keymove;
|
||||
if (BUTTON(gamefunc_Turn_Right))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Right))
|
||||
svel -= keymove;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left))
|
||||
{
|
||||
turnheldtime += synctics;
|
||||
if (turnheldtime >= TURBOTURNTIME)
|
||||
|
@ -4308,7 +4308,7 @@ getinput(SW_PACKET *loc)
|
|||
else
|
||||
angvel -= PREAMBLETURN;
|
||||
}
|
||||
else if (BUTTON(gamefunc_Turn_Right))
|
||||
else if (inputState.BUTTON(gamefunc_Turn_Right))
|
||||
{
|
||||
turnheldtime += synctics;
|
||||
if (turnheldtime >= TURBOTURNTIME)
|
||||
|
@ -4322,13 +4322,13 @@ getinput(SW_PACKET *loc)
|
|||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Left) && !pp->sop)
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Left) && !pp->sop)
|
||||
svel += keymove;
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Right) && !pp->sop)
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Right) && !pp->sop)
|
||||
svel += -keymove;
|
||||
|
||||
if (BUTTON(gamefunc_Move_Forward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward))
|
||||
{
|
||||
vel += keymove;
|
||||
//DSPRINTF(ds,"vel key %d",vel);
|
||||
|
@ -4340,7 +4340,7 @@ getinput(SW_PACKET *loc)
|
|||
//DebugWriteString(ds);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Backward))
|
||||
vel += -keymove;
|
||||
|
||||
|
||||
|
@ -4377,36 +4377,36 @@ getinput(SW_PACKET *loc)
|
|||
SET_LOC_KEY(loc->bits, SK_AUTO_AIM, TRUE);
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Pause))
|
||||
else if (inputState.GetKeyStatus(sc_Pause))
|
||||
{
|
||||
SET_LOC_KEY(loc->bits, SK_PAUSE, KB_KeyPressed(sc_Pause));
|
||||
SET_LOC_KEY(loc->bits, SK_PAUSE, inputState.GetKeyStatus(sc_Pause));
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
}
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_CENTER_VIEW, BUTTON(gamefunc_Center_View));
|
||||
SET_LOC_KEY(loc->bits, SK_CENTER_VIEW, inputState.BUTTON(gamefunc_Center_View));
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_RUN, BUTTON(gamefunc_Run));
|
||||
SET_LOC_KEY(loc->bits, SK_SHOOT, BUTTON(gamefunc_Fire));
|
||||
SET_LOC_KEY(loc->bits, SK_RUN, inputState.BUTTON(gamefunc_Run));
|
||||
SET_LOC_KEY(loc->bits, SK_SHOOT, inputState.BUTTON(gamefunc_Fire));
|
||||
|
||||
// actually snap
|
||||
SET_LOC_KEY(loc->bits, SK_SNAP_UP, BUTTON(gamefunc_Aim_Up));
|
||||
SET_LOC_KEY(loc->bits, SK_SNAP_DOWN, BUTTON(gamefunc_Aim_Down));
|
||||
SET_LOC_KEY(loc->bits, SK_SNAP_UP, inputState.BUTTON(gamefunc_Aim_Up));
|
||||
SET_LOC_KEY(loc->bits, SK_SNAP_DOWN, inputState.BUTTON(gamefunc_Aim_Down));
|
||||
|
||||
// actually just look
|
||||
SET_LOC_KEY(loc->bits, SK_LOOK_UP, BUTTON(gamefunc_Look_Up));
|
||||
SET_LOC_KEY(loc->bits, SK_LOOK_DOWN, BUTTON(gamefunc_Look_Down));
|
||||
SET_LOC_KEY(loc->bits, SK_LOOK_UP, inputState.BUTTON(gamefunc_Look_Up));
|
||||
SET_LOC_KEY(loc->bits, SK_LOOK_DOWN, inputState.BUTTON(gamefunc_Look_Down));
|
||||
|
||||
|
||||
for (i = 0; i < MAX_WEAPONS_KEYS; i++)
|
||||
{
|
||||
if (BUTTON(gamefunc_Weapon_1 + i))
|
||||
if (inputState.BUTTON(gamefunc_Weapon_1 + i))
|
||||
{
|
||||
SET(loc->bits, i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Next_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Next_Weapon))
|
||||
{
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
short next_weapon = u->WeaponNum + 1;
|
||||
|
@ -4446,7 +4446,7 @@ getinput(SW_PACKET *loc)
|
|||
}
|
||||
|
||||
|
||||
if (BUTTON(gamefunc_Previous_Weapon))
|
||||
if (inputState.BUTTON(gamefunc_Previous_Weapon))
|
||||
{
|
||||
USERp u = User[pp->PlayerSprite];
|
||||
short prev_weapon = u->WeaponNum - 1;
|
||||
|
@ -4484,40 +4484,40 @@ getinput(SW_PACKET *loc)
|
|||
}
|
||||
|
||||
inv_hotkey = 0;
|
||||
if (BUTTON(gamefunc_Med_Kit))
|
||||
if (inputState.BUTTON(gamefunc_Med_Kit))
|
||||
inv_hotkey = INVENTORY_MEDKIT+1;
|
||||
if (BUTTON(gamefunc_Smoke_Bomb))
|
||||
if (inputState.BUTTON(gamefunc_Smoke_Bomb))
|
||||
inv_hotkey = INVENTORY_CLOAK+1;
|
||||
if (BUTTON(gamefunc_Night_Vision))
|
||||
if (inputState.BUTTON(gamefunc_Night_Vision))
|
||||
inv_hotkey = INVENTORY_NIGHT_VISION+1;
|
||||
if (BUTTON(gamefunc_Gas_Bomb))
|
||||
if (inputState.BUTTON(gamefunc_Gas_Bomb))
|
||||
inv_hotkey = INVENTORY_CHEMBOMB+1;
|
||||
if (BUTTON(gamefunc_Flash_Bomb) && dimensionmode == 3)
|
||||
if (inputState.BUTTON(gamefunc_Flash_Bomb) && dimensionmode == 3)
|
||||
inv_hotkey = INVENTORY_FLASHBOMB+1;
|
||||
if (BUTTON(gamefunc_Caltrops))
|
||||
if (inputState.BUTTON(gamefunc_Caltrops))
|
||||
inv_hotkey = INVENTORY_CALTROPS+1;
|
||||
|
||||
SET(loc->bits, inv_hotkey<<SK_INV_HOTKEY_BIT0);
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_INV_USE, BUTTON(gamefunc_Inventory));
|
||||
SET_LOC_KEY(loc->bits, SK_INV_USE, inputState.BUTTON(gamefunc_Inventory));
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_OPERATE, BUTTON(gamefunc_Open));
|
||||
SET_LOC_KEY(loc->bits, SK_JUMP, BUTTON(gamefunc_Jump));
|
||||
SET_LOC_KEY(loc->bits, SK_CRAWL, BUTTON(gamefunc_Crouch));
|
||||
SET_LOC_KEY(loc->bits, SK_OPERATE, inputState.BUTTON(gamefunc_Open));
|
||||
SET_LOC_KEY(loc->bits, SK_JUMP, inputState.BUTTON(gamefunc_Jump));
|
||||
SET_LOC_KEY(loc->bits, SK_CRAWL, inputState.BUTTON(gamefunc_Crouch));
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_TURN_180, BUTTON(gamefunc_TurnAround));
|
||||
SET_LOC_KEY(loc->bits, SK_TURN_180, inputState.BUTTON(gamefunc_TurnAround));
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_INV_LEFT, BUTTON(gamefunc_Inventory_Left));
|
||||
SET_LOC_KEY(loc->bits, SK_INV_RIGHT, BUTTON(gamefunc_Inventory_Right));
|
||||
SET_LOC_KEY(loc->bits, SK_INV_LEFT, inputState.BUTTON(gamefunc_Inventory_Left));
|
||||
SET_LOC_KEY(loc->bits, SK_INV_RIGHT, inputState.BUTTON(gamefunc_Inventory_Right));
|
||||
|
||||
SET_LOC_KEY(loc->bits, SK_HIDE_WEAPON, BUTTON(gamefunc_Holster_Weapon));
|
||||
SET_LOC_KEY(loc->bits, SK_HIDE_WEAPON, inputState.BUTTON(gamefunc_Holster_Weapon));
|
||||
|
||||
// need BUTTON
|
||||
SET_LOC_KEY(loc->bits, SK_CRAWL_LOCK, KB_KeyPressed(KEYSC_NUM));
|
||||
SET_LOC_KEY(loc->bits, SK_CRAWL_LOCK, inputState.GetKeyStatus(KEYSC_NUM));
|
||||
|
||||
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
|
||||
{
|
||||
if (BUTTON(gamefunc_See_Co_Op_View))
|
||||
if (inputState.BUTTON(gamefunc_See_Co_Op_View))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_See_Co_Op_View);
|
||||
|
||||
|
@ -4556,7 +4556,7 @@ getinput(SW_PACKET *loc)
|
|||
|
||||
FunctionKeys(pp);
|
||||
|
||||
if (BUTTON(gamefunc_Toggle_Crosshair))
|
||||
if (inputState.BUTTON(gamefunc_Toggle_Crosshair))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Toggle_Crosshair);
|
||||
pToggleCrosshair(pp);
|
||||
|
|
|
@ -621,10 +621,10 @@ MNU_ParentalCustom(void)
|
|||
else
|
||||
{
|
||||
// clear keyboard buffer
|
||||
while (KB_KeyWaiting())
|
||||
while (inputState.keyBufferWaiting())
|
||||
{
|
||||
if (KB_GetCh() == 0)
|
||||
KB_GetCh();
|
||||
if (inputState.keyGetChar() == 0)
|
||||
inputState.keyGetChar();
|
||||
}
|
||||
|
||||
// toggle edit mode
|
||||
|
@ -672,14 +672,14 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
|
|||
short w, h = 8;
|
||||
int i, j, y;
|
||||
|
||||
if (KB_KeyPressed(KEYSC_ESC))
|
||||
if (inputState.GetKeyStatus(KEYSC_ESC))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
currentmode = 0;
|
||||
}
|
||||
else if (KB_GetLastScanCode() > 0)
|
||||
else if (inputState.GetLastScanCode() > 0)
|
||||
{
|
||||
KB_ClearKeyDown(KB_GetLastScanCode());
|
||||
inputState.ClearKeyStatus(inputState.GetLastScanCode());
|
||||
|
||||
//KeyboardKeys[currentkey][currentcol] = KB_GetLastScanCode();
|
||||
if (currentkey != gamefunc_Show_Console)
|
||||
|
@ -692,7 +692,7 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
|
|||
}
|
||||
else
|
||||
{
|
||||
OSD_CaptureKey(KB_GetLastScanCode());
|
||||
OSD_CaptureKey(inputState.GetLastScanCode());
|
||||
}
|
||||
|
||||
currentmode = 0;
|
||||
|
@ -726,48 +726,48 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
|
|||
UserInput inpt = {FALSE,FALSE,dir_None};
|
||||
CONTROL_GetUserInput(&inpt);
|
||||
|
||||
if (KB_KeyPressed(KEYSC_ESC) || inpt.button1)
|
||||
if (inputState.GetKeyStatus(KEYSC_ESC) || inpt.button1)
|
||||
{
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
cust_callback = NULL;
|
||||
CONTROL_ClearUserInput(&inpt);
|
||||
return TRUE;
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Delete))
|
||||
else if (inputState.GetKeyStatus(sc_Delete))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
inputState.ClearKeyStatus(sc_Delete);
|
||||
if (currentkey != gamefunc_Show_Console)
|
||||
{
|
||||
//Bindings.UnbindACommand(CONFIG_FunctionNumToName(M_KEYBOARDKEYS.currentEntry));
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
currentkey = 0;
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
currentkey = NUMGAMEFUNCTIONS-1;
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgDn))
|
||||
else if (inputState.GetKeyStatus(sc_PgDn))
|
||||
{
|
||||
currentkey += PGSIZ;
|
||||
if (currentkey >= NUMGAMEFUNCTIONS) currentkey = NUMGAMEFUNCTIONS-1;
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
inputState.ClearKeyStatus(sc_PgDn);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgUp))
|
||||
else if (inputState.GetKeyStatus(sc_PgUp))
|
||||
{
|
||||
currentkey -= PGSIZ;
|
||||
if (currentkey < 0) currentkey = 0;
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
inputState.ClearKeyStatus(sc_PgUp);
|
||||
}
|
||||
else if (inpt.button0)
|
||||
{
|
||||
currentmode = 1;
|
||||
KB_ClearLastScanCode();
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearLastScanCode();
|
||||
inputState.ClearKeysDown();
|
||||
}
|
||||
else if (inpt.dir == dir_North) currentkey = max(0,currentkey-1);
|
||||
else if (inpt.dir == dir_South) currentkey = min(NUMGAMEFUNCTIONS-1,currentkey+1);
|
||||
|
@ -852,30 +852,30 @@ static int MNU_SelectButtonFunction(const char *buttonname, int *currentfunc)
|
|||
|
||||
if (inpt.button1)
|
||||
{
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
returnval = -1;
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
else if (inputState.GetKeyStatus(sc_Home))
|
||||
{
|
||||
*currentfunc = 0;
|
||||
KB_ClearKeyDown(sc_Home);
|
||||
inputState.ClearKeyStatus(sc_Home);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_End))
|
||||
else if (inputState.GetKeyStatus(sc_End))
|
||||
{
|
||||
*currentfunc = NUMGAMEFUNCTIONS-1; // -1 because the last one is the console and the top is 'none'
|
||||
KB_ClearKeyDown(sc_End);
|
||||
inputState.ClearKeyStatus(sc_End);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgDn))
|
||||
else if (inputState.GetKeyStatus(sc_PgDn))
|
||||
{
|
||||
*currentfunc += PGSIZ;
|
||||
if (*currentfunc >= NUMGAMEFUNCTIONS) *currentfunc = NUMGAMEFUNCTIONS-1;
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
inputState.ClearKeyStatus(sc_PgDn);
|
||||
}
|
||||
else if (KB_KeyPressed(sc_PgUp))
|
||||
else if (inputState.GetKeyStatus(sc_PgUp))
|
||||
{
|
||||
*currentfunc -= PGSIZ;
|
||||
if (*currentfunc < 0) *currentfunc = 0;
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
inputState.ClearKeyStatus(sc_PgUp);
|
||||
}
|
||||
else if (inpt.button0)
|
||||
{
|
||||
|
@ -1571,7 +1571,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
CONTROL_GetUserInput(&tst_input);
|
||||
//order_input_buffered.dir = tst_input.dir;
|
||||
// Support a few other keys too
|
||||
if (KB_KeyPressed(KEYSC_SPACE)||KB_KeyPressed(KEYSC_ENTER))
|
||||
if (inputState.GetKeyStatus(KEYSC_SPACE)||inputState.GetKeyStatus(KEYSC_ENTER))
|
||||
{
|
||||
inputState.ClearKeyStatus(KEYSC_SPACE);
|
||||
inputState.ClearKeyStatus(KEYSC_ENTER);
|
||||
|
@ -1611,7 +1611,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
order_input_buffered.dir = tst_input.dir;
|
||||
}
|
||||
|
||||
if (!KB_KeyPressed(KEYSC_ESC) && !order_input_buffered.button1)
|
||||
if (!inputState.GetKeyStatus(KEYSC_ESC) && !order_input_buffered.button1)
|
||||
{
|
||||
cust_callback = MNU_OrderCustom;
|
||||
cust_callback_call = call;
|
||||
|
@ -1751,7 +1751,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
//KB_ClearKeysDown();
|
||||
//inputState.ClearKeysDown();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1952,7 +1952,7 @@ MNU_QuitCustom(UserCall call, MenuItem_p item)
|
|||
|
||||
if (!ret)
|
||||
{
|
||||
if (!mnu_input.button1 && !KB_KeyPressed(sc_N))
|
||||
if (!mnu_input.button1 && !inputState.GetKeyStatus(sc_N))
|
||||
{
|
||||
cust_callback = MNU_QuitCustom;
|
||||
cust_callback_call = call;
|
||||
|
@ -1970,7 +1970,7 @@ MNU_QuitCustom(UserCall call, MenuItem_p item)
|
|||
ExitMenus();
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(sc_Y) || KB_KeyPressed(sc_Enter) || mnu_input.button0)
|
||||
if (inputState.GetKeyStatus(sc_Y) || inputState.GetKeyStatus(sc_Enter) || mnu_input.button0)
|
||||
{
|
||||
if (CommPlayers >= 2)
|
||||
MultiPlayQuitFlag = TRUE;
|
||||
|
@ -1980,7 +1980,7 @@ MNU_QuitCustom(UserCall call, MenuItem_p item)
|
|||
ExitMenus();
|
||||
}
|
||||
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2021,7 +2021,7 @@ MNU_QuickLoadCustom(UserCall call, MenuItem_p item)
|
|||
|
||||
if (ret == FALSE)
|
||||
{
|
||||
if (KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter))
|
||||
if (inputState.GetKeyStatus(sc_N) || inputState.GetKeyStatus(sc_Space) || inputState.GetKeyStatus(sc_Enter))
|
||||
{
|
||||
cust_callback = NULL;
|
||||
if (ReloadPrompt)
|
||||
|
@ -2033,7 +2033,7 @@ MNU_QuickLoadCustom(UserCall call, MenuItem_p item)
|
|||
GlobInfoStringTime = bak;
|
||||
}
|
||||
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
ExitMenus();
|
||||
}
|
||||
else
|
||||
|
@ -2048,7 +2048,7 @@ MNU_QuickLoadCustom(UserCall call, MenuItem_p item)
|
|||
// Y pressed
|
||||
cust_callback = NULL;
|
||||
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
LoadSaveMsg("Loading...");
|
||||
|
||||
PauseAction();
|
||||
|
@ -2064,11 +2064,11 @@ MNU_QuickLoadCustom(UserCall call, MenuItem_p item)
|
|||
LastSaveNum = -1;
|
||||
|
||||
// do a load game here
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
ExitMenus();
|
||||
}
|
||||
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2448,14 +2448,14 @@ MNU_InputSmallString(char *name, short pix_width)
|
|||
}
|
||||
}
|
||||
|
||||
while (KB_KeyWaiting())
|
||||
while (inputState.keyBufferWaiting())
|
||||
{
|
||||
ch = KB_GetCh();
|
||||
ch = inputState.keyGetChar();
|
||||
|
||||
// skip any extended key
|
||||
if (ch == 0)
|
||||
{
|
||||
ch = KB_GetCh();
|
||||
ch = inputState.keyGetChar();
|
||||
if (ch == 104) // extended enter
|
||||
ch = ascii_return;
|
||||
else
|
||||
|
@ -2525,7 +2525,7 @@ MNU_Dialog(void)
|
|||
CONTROL_ClearUserInput(&mnu_input);
|
||||
CONTROL_GetUserInput(&mnu_input);
|
||||
|
||||
if (KB_KeyPressed(sc_Y) || KB_KeyPressed(sc_Enter) || mnu_input.button0)
|
||||
if (inputState.GetKeyStatus(sc_Y) || inputState.GetKeyStatus(sc_Enter) || mnu_input.button0)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -2545,9 +2545,9 @@ MNU_InputString(char *name, short pix_width)
|
|||
#define ascii_esc 27
|
||||
#define ascii_return 13
|
||||
|
||||
while (KB_KeyWaiting())
|
||||
while (inputState.keyBufferWaiting())
|
||||
{
|
||||
ch = KB_GetCh();
|
||||
ch = inputState.keyGetChar();
|
||||
|
||||
////DSPRINTF(ds, "%c %d", ch, ch);
|
||||
//MONO_PRINT(ds);
|
||||
|
@ -2555,7 +2555,7 @@ MNU_InputString(char *name, short pix_width)
|
|||
// skip most extended keys
|
||||
if (ch == 0)
|
||||
{
|
||||
ch = KB_GetCh();
|
||||
ch = inputState.keyGetChar();
|
||||
|
||||
////DSPRINTF(ds, "extended key %c %d", ch, ch);
|
||||
//MONO_PRINT(ds);
|
||||
|
@ -2723,10 +2723,10 @@ MNU_GetSaveCustom(void)
|
|||
strcpy(BackupSaveGameDescr, SaveGameDescr[save_num]);
|
||||
|
||||
// clear keyboard buffer
|
||||
while (KB_KeyWaiting())
|
||||
while (inputState.keyBufferWaiting())
|
||||
{
|
||||
if (KB_GetCh() == 0)
|
||||
KB_GetCh();
|
||||
if (inputState.keyGetChar() == 0)
|
||||
inputState.keyGetChar();
|
||||
}
|
||||
|
||||
// toggle edit mode
|
||||
|
@ -2800,8 +2800,8 @@ MNU_LoadSaveMove(UserCall call, MenuItem_p item)
|
|||
QuickSaveMode = FALSE;
|
||||
MenuInputMode = TRUE;
|
||||
strcpy(BackupSaveGameDescr, SaveGameDescr[game_num]);
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
inputState.ClearKeysDown();
|
||||
inputState.keyFlushChars();
|
||||
}
|
||||
|
||||
LastSaveNum = game_num;
|
||||
|
@ -2813,17 +2813,17 @@ MNU_LoadSaveMove(UserCall call, MenuItem_p item)
|
|||
|
||||
if (SavePrompt)
|
||||
{
|
||||
if (KB_KeyPressed(sc_Y) || KB_KeyPressed(sc_Enter))
|
||||
if (inputState.GetKeyStatus(sc_Y) || inputState.GetKeyStatus(sc_Enter))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Y);
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_Y);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
SavePrompt = FALSE;
|
||||
// use input
|
||||
item->custom();
|
||||
}
|
||||
else if (KB_KeyPressed(sc_N))
|
||||
else if (inputState.GetKeyStatus(sc_N))
|
||||
{
|
||||
KB_ClearKeyDown(sc_N);
|
||||
inputState.ClearKeyStatus(sc_N);
|
||||
strcpy(SaveGameDescr[game_num], BackupSaveGameDescr);
|
||||
SavePrompt = FALSE;
|
||||
MenuInputMode = FALSE;
|
||||
|
@ -2836,7 +2836,7 @@ MNU_LoadSaveMove(UserCall call, MenuItem_p item)
|
|||
case -1: // Cancel Input (pressed ESC) or Err
|
||||
strcpy(SaveGameDescr[game_num], BackupSaveGameDescr);
|
||||
MenuInputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
break;
|
||||
case FALSE: // Input finished (RETURN)
|
||||
// no input
|
||||
|
@ -2849,7 +2849,7 @@ MNU_LoadSaveMove(UserCall call, MenuItem_p item)
|
|||
{
|
||||
GotInput = TRUE;
|
||||
}
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
inputState.ClearKeyStatus(sc_Enter);
|
||||
break;
|
||||
case TRUE: // Got input
|
||||
break;
|
||||
|
@ -4369,7 +4369,7 @@ MNU_DoHotkey(void)
|
|||
index = 0;
|
||||
for (item = currentmenu->items; item->type != mt_none; item++)
|
||||
{
|
||||
if (KB_KeyPressed(item->hotkey) && item->hotkey != 0)
|
||||
if (inputState.GetKeyStatus(item->hotkey) && item->hotkey != 0)
|
||||
{
|
||||
MNU_SelectItem(currentmenu, index, FALSE);
|
||||
return TRUE;
|
||||
|
@ -4498,7 +4498,7 @@ void MNU_DoMenu(CTLType type, PLAYERp pp)
|
|||
static int handle5=0;
|
||||
if (!FX_SoundActive(handle5))
|
||||
handle5 = PlaySound(DIGI_SWORDSWOOSH,&zero,&zero,&zero,v3df_dontpan);
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
MNU_DoItem();
|
||||
resetitem = TRUE;
|
||||
}
|
||||
|
@ -4540,7 +4540,7 @@ void MNU_DoMenu(CTLType type, PLAYERp pp)
|
|||
|
||||
if (resetitem)
|
||||
{
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
ResetKeys();
|
||||
}
|
||||
}
|
||||
|
@ -4560,10 +4560,10 @@ MNU_CheckForMenus(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((KB_KeyPressed(KEYSC_ESC)) && dimensionmode == 3 && !ConPanel)
|
||||
if ((inputState.GetKeyStatus(KEYSC_ESC)) && dimensionmode == 3 && !ConPanel)
|
||||
{
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
// setup sliders/buttons
|
||||
MNU_InitMenus();
|
||||
MNU_DoMenu(ct_mainmenu, Player + myconnectindex);
|
||||
|
@ -4586,7 +4586,7 @@ MNU_CheckForMenusAnyKey(void)
|
|||
if (KeyPressed())
|
||||
{
|
||||
ResetKeys();
|
||||
KB_ClearKeysDown();
|
||||
inputState.ClearKeysDown();
|
||||
MNU_InitMenus();
|
||||
MNU_DoMenu(ct_mainmenu, Player + myconnectindex);
|
||||
pMenuClearTextLine(Player + myconnectindex);
|
||||
|
|
|
@ -637,7 +637,7 @@ waitforeverybody(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
//KB_KeyPressed(KEYSC_ESC) = FALSE;
|
||||
//inputState.GetKeyStatus(KEYSC_ESC) = FALSE;
|
||||
Player[myconnectindex].playerreadyflag++;
|
||||
|
||||
while (TRUE)
|
||||
|
@ -657,7 +657,7 @@ waitforeverybody(void)
|
|||
if (quitevent || (wfe_ExitCallback && wfe_ExitCallback()))
|
||||
{
|
||||
// allow exit
|
||||
//if (KB_KeyPressed(KEYSC_ESC))
|
||||
//if (inputState.GetKeyStatus(KEYSC_ESC))
|
||||
{
|
||||
short pnum;
|
||||
//TRAVERSE_CONNECT(pnum)
|
||||
|
@ -940,7 +940,7 @@ faketimerhandler(void)
|
|||
extern SWBOOL BotMode;
|
||||
|
||||
#if 0
|
||||
if (KB_KeyPressed(KEYSC_PERIOD))
|
||||
if (inputState.GetKeyStatus(KEYSC_PERIOD))
|
||||
{
|
||||
extern unsigned int MoveThingsCount;
|
||||
MoveThingsCount++;
|
||||
|
|
|
@ -1580,17 +1580,17 @@ pSwordRest(PANEL_SPRITEp psp)
|
|||
SWBOOL force = !!TEST(psp->flags, PANF_UNHIDE_SHOOT);
|
||||
|
||||
#if 0
|
||||
if (KB_KeyPressed(KEYSC_SEMI))
|
||||
if (inputState.GetKeyStatus(KEYSC_SEMI))
|
||||
{
|
||||
KB_KeyPressed(KEYSC_SEMI) = 0;
|
||||
inputState.GetKeyStatus(KEYSC_SEMI) = 0;
|
||||
SwordAng -= 4;
|
||||
//DSPRINTF(ds,"SwordAng %d", SwordAng);
|
||||
MONO_PRINT(ds);
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(KEYSC_QUOTE))
|
||||
if (inputState.GetKeyStatus(KEYSC_QUOTE))
|
||||
{
|
||||
KB_KeyPressed(KEYSC_QUOTE) = 0;
|
||||
inputState.GetKeyStatus(KEYSC_QUOTE) = 0;
|
||||
SwordAng += 4;
|
||||
//DSPRINTF(ds,"SwordAng %d", SwordAng);
|
||||
MONO_PRINT(ds);
|
||||
|
|
|
@ -2419,14 +2419,14 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
return;
|
||||
|
||||
// Recenter view if told
|
||||
if (BUTTON(gamefunc_Center_View))
|
||||
if (inputState.BUTTON(gamefunc_Center_View))
|
||||
{
|
||||
Follow_posx = pp->posx;
|
||||
Follow_posy = pp->posy;
|
||||
}
|
||||
|
||||
// Toggle follow map mode on/off
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode))
|
||||
if (inputState.BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ScrollMode2D = !ScrollMode2D;
|
||||
|
@ -2435,9 +2435,9 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
Follow_posy = pp->posy;
|
||||
}
|
||||
|
||||
running = G_CheckAutorun(BUTTON(gamefunc_Run));
|
||||
running = G_CheckAutorun(inputState.BUTTON(gamefunc_Run));
|
||||
|
||||
if (BUTTON(gamefunc_Strafe))
|
||||
if (inputState.BUTTON(gamefunc_Strafe))
|
||||
mfsvel -= scrl_input.dyaw>>2;
|
||||
mfsvel -= scrl_input.dx>>2;
|
||||
mfvel = -scrl_input.dz>>2;
|
||||
|
@ -2454,11 +2454,11 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
|
||||
if (!HelpInputMode && !ConPanel)
|
||||
{
|
||||
if (BUTTON(gamefunc_Turn_Left))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Left))
|
||||
{
|
||||
mfsvel -= -keymove;
|
||||
}
|
||||
if (BUTTON(gamefunc_Turn_Right))
|
||||
if (inputState.BUTTON(gamefunc_Turn_Right))
|
||||
{
|
||||
mfsvel -= keymove;
|
||||
}
|
||||
|
@ -2466,12 +2466,12 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
|
||||
if (!InputMode && !ConPanel)
|
||||
{
|
||||
if (BUTTON(gamefunc_Strafe_Left))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Left))
|
||||
{
|
||||
mfsvel += keymove;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Strafe_Right))
|
||||
if (inputState.BUTTON(gamefunc_Strafe_Right))
|
||||
{
|
||||
mfsvel += -keymove;
|
||||
}
|
||||
|
@ -2479,12 +2479,12 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
|
||||
if (!UsingMenus && !HelpInputMode && !ConPanel)
|
||||
{
|
||||
if (BUTTON(gamefunc_Move_Forward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Forward))
|
||||
{
|
||||
mfvel += keymove;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Move_Backward))
|
||||
if (inputState.BUTTON(gamefunc_Move_Backward))
|
||||
{
|
||||
mfvel += -keymove;
|
||||
}
|
||||
|
@ -4116,7 +4116,7 @@ SWBOOL PlayerFlyKey(PLAYERp pp)
|
|||
if (InputMode)
|
||||
return FALSE;
|
||||
|
||||
key = KB_KeyPressed(KEYSC_J);
|
||||
key = inputState.GetKeyStatus(KEYSC_J);
|
||||
|
||||
if (key)
|
||||
inputState.ClearKeyStatus(KEYSC_J);
|
||||
|
@ -7398,7 +7398,7 @@ DoPlayerRun(PLAYERp pp)
|
|||
}
|
||||
|
||||
// Crawl lock
|
||||
// if (KB_KeyPressed(KEYSC_NUM))
|
||||
// if (inputState.GetKeyStatus(KEYSC_NUM))
|
||||
if (TEST_SYNC_KEY(pp, SK_CRAWL_LOCK))
|
||||
{
|
||||
if (FLAG_KEY_PRESSED(pp, SK_CRAWL_LOCK))
|
||||
|
@ -7983,9 +7983,9 @@ domovethings(void)
|
|||
#if 0
|
||||
{
|
||||
extern SWBOOL PauseKeySet;
|
||||
if (KB_KeyPressed(KEYSC_F5) && !(KB_KeyPressed(KEYSC_ALT) || KB_KeyPressed(KEYSC_RALT)) && !PauseKeySet)
|
||||
if (inputState.GetKeyStatus(KEYSC_F5) && !(inputState.GetKeyStatus(KEYSC_ALT) || inputState.GetKeyStatus(KEYSC_RALT)) && !PauseKeySet)
|
||||
{
|
||||
KB_KeyPressed(KEYSC_F5) = 0;
|
||||
inputState.GetKeyStatus(KEYSC_F5) = 0;
|
||||
ResChange();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue