mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- simplified the button state maintenance
This removes all unused parts of the implementation and moves the rest to the InputState class for easier replacement later. All MACT is doing now here is to call the UpdateStatus function, the internal workings are no longer relevant.
This commit is contained in:
parent
f8203ac766
commit
065721c62b
23 changed files with 137 additions and 476 deletions
|
@ -816,7 +816,7 @@ void LocalKeys(void)
|
|||
bool shift = inputState.ShiftPressed();
|
||||
if (BUTTON(gamefunc_See_Chase_View) && !alt && !shift)
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
||||
inputState.ClearButton(gamefunc_See_Chase_View);
|
||||
if (gViewPos > VIEWPOS_0)
|
||||
gViewPos = VIEWPOS_0;
|
||||
else
|
||||
|
@ -824,7 +824,7 @@ void LocalKeys(void)
|
|||
}
|
||||
if (BUTTON(gamefunc_See_Coop_View))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_See_Coop_View);
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
if (gGameOptions.nGameType == 1)
|
||||
{
|
||||
gViewIndex = connectpoint2[gViewIndex];
|
||||
|
@ -878,7 +878,7 @@ void LocalKeys(void)
|
|||
}
|
||||
keyFlushScans();
|
||||
inputState.ClearKeyStatus(key);
|
||||
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
||||
inputState.ClearButton(gamefunc_See_Chase_View);
|
||||
return;
|
||||
}
|
||||
switch (key)
|
||||
|
|
|
@ -142,7 +142,7 @@ void ctrlGetInput(void)
|
|||
g_MyAimMode = 1;
|
||||
else
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Mouse_Aiming);
|
||||
inputState.ClearButton(gamefunc_Mouse_Aiming);
|
||||
g_MyAimMode = !g_MyAimMode;
|
||||
if (g_MyAimMode)
|
||||
{
|
||||
|
@ -189,14 +189,14 @@ void ctrlGetInput(void)
|
|||
if (gGameStarted && gInputMode != kInputMessage && gInputMode != kInputMenu
|
||||
&& BUTTON(gamefunc_Send_Message))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Send_Message);
|
||||
inputState.ClearButton(gamefunc_Send_Message);
|
||||
keyFlushScans();
|
||||
gInputMode = kInputMessage;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_AutoRun))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_AutoRun);
|
||||
inputState.ClearButton(gamefunc_AutoRun);
|
||||
gAutoRun = !gAutoRun;
|
||||
if (gAutoRun)
|
||||
viewSetMessage("Auto run ON");
|
||||
|
@ -206,13 +206,13 @@ void ctrlGetInput(void)
|
|||
|
||||
if (BUTTON(gamefunc_Map_Toggle))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map_Toggle);
|
||||
inputState.ClearButton(gamefunc_Map_Toggle);
|
||||
viewToggle(gViewMode);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map_Follow_Mode);
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
gFollowMap = !gFollowMap;
|
||||
gViewMap.FollowMode(gFollowMap);
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ void ctrlGetInput(void)
|
|||
{
|
||||
if (gViewMode == 3)
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Shrink_Screen);
|
||||
inputState.ClearButton(gamefunc_Shrink_Screen);
|
||||
G_ChangeHudLayout(-1);
|
||||
}
|
||||
if (gViewMode == 2 || gViewMode == 4)
|
||||
|
@ -235,7 +235,7 @@ void ctrlGetInput(void)
|
|||
{
|
||||
if (gViewMode == 3)
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
|
||||
inputState.ClearButton(gamefunc_Enlarge_Screen);
|
||||
G_ChangeHudLayout(1);
|
||||
}
|
||||
if (gViewMode == 2 || gViewMode == 4)
|
||||
|
@ -247,25 +247,25 @@ void ctrlGetInput(void)
|
|||
|
||||
if (BUTTON(gamefunc_Toggle_Crosshair))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Toggle_Crosshair);
|
||||
inputState.ClearButton(gamefunc_Toggle_Crosshair);
|
||||
cl_crosshair = !cl_crosshair;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Next_Weapon))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Next_Weapon);
|
||||
inputState.ClearButton(gamefunc_Next_Weapon);
|
||||
gInput.keyFlags.nextWeapon = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Previous_Weapon))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Previous_Weapon);
|
||||
inputState.ClearButton(gamefunc_Previous_Weapon);
|
||||
gInput.keyFlags.prevWeapon = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon);
|
||||
inputState.ClearButton(gamefunc_Show_Opponents_Weapon);
|
||||
cl_showweapon = (cl_showweapon + 1) & 3;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ void ctrlGetInput(void)
|
|||
|
||||
if (BUTTON(gamefunc_Open))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Open);
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
gInput.keyFlags.action = 1;
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ void ctrlGetInput(void)
|
|||
|
||||
if (BUTTON(gamefunc_Aim_Center))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Aim_Center);
|
||||
inputState.ClearButton(gamefunc_Aim_Center);
|
||||
gInput.keyFlags.lookCenter = 1;
|
||||
}
|
||||
|
||||
|
@ -308,43 +308,43 @@ void ctrlGetInput(void)
|
|||
|
||||
if (BUTTON(gamefunc_Inventory_Left))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Inventory_Left);
|
||||
inputState.ClearButton(gamefunc_Inventory_Left);
|
||||
gInput.keyFlags.prevItem = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Inventory_Right))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Inventory_Right);
|
||||
inputState.ClearButton(gamefunc_Inventory_Right);
|
||||
gInput.keyFlags.nextItem = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Inventory_Use))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Inventory_Use);
|
||||
inputState.ClearButton(gamefunc_Inventory_Use);
|
||||
gInput.keyFlags.useItem = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_BeastVision))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_BeastVision);
|
||||
inputState.ClearButton(gamefunc_BeastVision);
|
||||
gInput.useFlags.useBeastVision = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_CrystalBall))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_CrystalBall);
|
||||
inputState.ClearButton(gamefunc_CrystalBall);
|
||||
gInput.useFlags.useCrystalBall = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_JumpBoots))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_JumpBoots);
|
||||
inputState.ClearButton(gamefunc_JumpBoots);
|
||||
gInput.useFlags.useJumpBoots = 1;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_MedKit))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_MedKit);
|
||||
inputState.ClearButton(gamefunc_MedKit);
|
||||
gInput.useFlags.useMedKit = 1;
|
||||
}
|
||||
|
||||
|
@ -352,26 +352,26 @@ void ctrlGetInput(void)
|
|||
{
|
||||
if (BUTTON(gamefunc_Weapon_1 + i))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Weapon_1 + i);
|
||||
inputState.ClearButton(gamefunc_Weapon_1 + i);
|
||||
gInput.newWeapon = 1 + i;
|
||||
}
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_ProximityBombs))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_ProximityBombs);
|
||||
inputState.ClearButton(gamefunc_ProximityBombs);
|
||||
gInput.newWeapon = 11;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_RemoteBombs))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_RemoteBombs);
|
||||
inputState.ClearButton(gamefunc_RemoteBombs);
|
||||
gInput.newWeapon = 12;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Holster_Weapon))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Holster_Weapon);
|
||||
inputState.ClearButton(gamefunc_Holster_Weapon);
|
||||
gInput.keyFlags.holsterWeapon = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "input.h"
|
||||
#include "menus.h"
|
||||
#include "gamemenu.h"
|
||||
#include "inputstate.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -52,7 +53,7 @@ void I_ClearAllInput(void)
|
|||
KB_ClearKeysDown();
|
||||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
CONTROL_ClearAllButtons();
|
||||
inputState.ClearAllButtons();
|
||||
#if defined EDUKE32_IOS
|
||||
mouseAdvanceClickState();
|
||||
#endif
|
||||
|
@ -146,10 +147,10 @@ void I_GeneralTriggerClear(void)
|
|||
I_AdvanceTriggerClear();
|
||||
I_ReturnTriggerClear();
|
||||
#if !defined GEKKO
|
||||
CONTROL_ClearButton(gamefunc_Open);
|
||||
CONTROL_ClearButton(gamefunc_Weapon_Fire);
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
inputState.ClearButton(gamefunc_Weapon_Fire);
|
||||
#endif
|
||||
CONTROL_ClearButton(gamefunc_Crouch);
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
|
||||
}
|
||||
|
||||
|
@ -194,7 +195,7 @@ void I_MenuUpClear(void)
|
|||
KB_ClearKeyDown(sc_UpArrow);
|
||||
KB_ClearKeyDown(sc_kpad_8);
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Forward);
|
||||
inputState.ClearButton(gamefunc_Move_Forward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_UP);
|
||||
CONTROL_ClearGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTY);
|
||||
|
@ -220,7 +221,7 @@ void I_MenuDownClear(void)
|
|||
KB_ClearKeyDown(sc_kpad_2);
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Backward);
|
||||
inputState.ClearButton(gamefunc_Move_Backward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN);
|
||||
CONTROL_ClearGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTY);
|
||||
|
@ -246,8 +247,8 @@ void I_MenuLeftClear(void)
|
|||
KB_ClearKeyDown(sc_LeftArrow);
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Left);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Left);
|
||||
inputState.ClearButton(gamefunc_Turn_Left);
|
||||
inputState.ClearButton(gamefunc_Strafe_Left);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_LEFT);
|
||||
CONTROL_ClearGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTX);
|
||||
|
@ -274,8 +275,8 @@ void I_MenuRightClear(void)
|
|||
KB_ClearKeyDown(sc_RightArrow);
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Right);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Right);
|
||||
inputState.ClearButton(gamefunc_Turn_Right);
|
||||
inputState.ClearButton(gamefunc_Strafe_Right);
|
||||
MOUSE_ClearButton(MIDDLE_MOUSE);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT);
|
||||
|
|
|
@ -50,7 +50,7 @@ CCheatMgr gCheatMgr;
|
|||
void sub_5A928(void)
|
||||
{
|
||||
for (int i = 0; i < NUMGAMEFUNCTIONS-1; i++)
|
||||
CONTROL_ClearButton(i);
|
||||
inputState.ClearButton(i);
|
||||
}
|
||||
|
||||
void sub_5A944(char key)
|
||||
|
@ -61,7 +61,7 @@ void sub_5A944(char key)
|
|||
key1 = KeyboardKeys[i][0];
|
||||
key2 = KeyboardKeys[i][1];
|
||||
if (key1 == key || key2 == key)
|
||||
CONTROL_ClearButton(i);
|
||||
inputState.ClearButton(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ void CPlayerMsg::ProcessKeys(void)
|
|||
case sc_F8:
|
||||
case sc_F9:
|
||||
case sc_F10:
|
||||
CONTROL_ClearButton(gamefunc_See_Chase_View);
|
||||
inputState.ClearButton(gamefunc_See_Chase_View);
|
||||
Set(*CombatMacros[key-sc_F1]);
|
||||
Send();
|
||||
inputState.ClearKeyStatus(key);
|
||||
|
|
|
@ -338,7 +338,6 @@ void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy/*=false*/)
|
|||
CONFIG_MapKey(num, key[0], 0, key[1], 0);
|
||||
|
||||
}
|
||||
CONTROL_DefineFlag(num, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
0
source/common/inputstate.cpp
Normal file
0
source/common/inputstate.cpp
Normal file
|
@ -124,54 +124,47 @@ enum GameFunction_t
|
|||
|
||||
class InputState
|
||||
{
|
||||
// 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.
|
||||
struct ButtonStateFlags
|
||||
{
|
||||
bool ButtonActive; // Button currently reports being active to the client
|
||||
bool ButtonCleared;, // Button has been cleared by the client, i.e. do not set to active until no input for this button is active anymore.
|
||||
};
|
||||
|
||||
FixedBitArray<NUMGAMEFUNCTIONS> ButtonState, ButtonHeldState;
|
||||
ButtonStateFlags ButtonState[NUMGAMEFUNCTIONS];
|
||||
uint8_t KeyStatus[NUMKEYS];
|
||||
|
||||
public:
|
||||
|
||||
bool BUTTON(int x)
|
||||
{
|
||||
return ButtonState[x];
|
||||
return ButtonState[x].ButtonActive;
|
||||
}
|
||||
|
||||
bool BUTTONHELD(int x)
|
||||
// Receive a status update
|
||||
void UpdateButton(int x, bool set)
|
||||
{
|
||||
return ButtonHeldState[x];
|
||||
}
|
||||
auto &b = ButtonState[x];
|
||||
if (!b.ButtonCleared) b.ButtonActive = set;
|
||||
else if (!set) b.ButtonCleared = false;
|
||||
|
||||
void SetButton(int x, bool set = true)
|
||||
{
|
||||
if (set) ButtonState.Set(x);
|
||||
else ButtonState.Clear(x);
|
||||
}
|
||||
|
||||
void SetButtonHeld(int x, bool set = true)
|
||||
{
|
||||
if (set) ButtonHeldState.Set(x);
|
||||
else ButtonHeldState.Clear(x);
|
||||
}
|
||||
|
||||
void ClearButton(int x)
|
||||
{
|
||||
ButtonState.Clear(x);
|
||||
ButtonState[x].ButtonActive = false;
|
||||
ButtonState[x].ButtonCleared = true;
|
||||
}
|
||||
|
||||
void ClearButtonHeld(int x)
|
||||
void ClearAllButtons()
|
||||
{
|
||||
ButtonHeldState.Clear(x);
|
||||
}
|
||||
|
||||
void ClearButtonState()
|
||||
{
|
||||
ButtonState.Zero();
|
||||
ButtonHeldState.Zero();
|
||||
}
|
||||
|
||||
void PrepareState()
|
||||
{
|
||||
ButtonHeldState = ButtonState;
|
||||
ButtonState.Zero();
|
||||
for (auto & b : ButtonState)
|
||||
{
|
||||
b.ButtonActive = false;
|
||||
b.ButtonCleared = true;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t GetKeyStatus(int key)
|
||||
|
@ -224,26 +217,6 @@ inline bool BUTTON(int x)
|
|||
return inputState.BUTTON(x);
|
||||
}
|
||||
|
||||
inline bool BUTTONHELD(int x)
|
||||
{
|
||||
return inputState.BUTTONHELD(x);
|
||||
}
|
||||
|
||||
inline bool BUTTONJUSTPRESSED(int x)
|
||||
{
|
||||
return (BUTTON(x) && !BUTTONHELD(x));
|
||||
}
|
||||
|
||||
inline bool BUTTONRELEASED(int x)
|
||||
{
|
||||
return (!BUTTON(x) && BUTTONHELD(x));
|
||||
}
|
||||
|
||||
inline bool BUTTONSTATECHANGED(int x)
|
||||
{
|
||||
return (BUTTON(x) != BUTTONHELD(x));
|
||||
}
|
||||
|
||||
inline uint8_t KB_KeyPressed(int scan)
|
||||
{
|
||||
return inputState.GetKeyStatus(scan);
|
||||
|
|
|
@ -909,7 +909,7 @@ nextdemo_nomenu:
|
|||
if (BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_SendMessage);
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
g_player[myconnectindex].ps->gm = MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
}
|
||||
|
|
|
@ -4550,7 +4550,7 @@ void G_HandleLocalKeys(void)
|
|||
{
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
|
||||
inputState.ClearButton(gamefunc_Enlarge_Screen);
|
||||
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
|
@ -4569,7 +4569,7 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Shrink_Screen);
|
||||
inputState.ClearButton(gamefunc_Shrink_Screen);
|
||||
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
|
@ -4592,7 +4592,7 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_See_Coop_View);
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
if (screenpeek == -1) screenpeek = 0;
|
||||
g_restorePalette = -1;
|
||||
|
@ -4600,21 +4600,21 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
{
|
||||
CONTROL_ClearButton(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))
|
||||
{
|
||||
CONTROL_ClearButton(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))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map_Follow_Mode);
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ud.scrollmode = 1-ud.scrollmode;
|
||||
if (ud.scrollmode)
|
||||
{
|
||||
|
@ -4806,7 +4806,7 @@ void G_HandleLocalKeys(void)
|
|||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_SendMessage);
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
myplayer.gm |= MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
}
|
||||
|
@ -4905,7 +4905,7 @@ FAKE_F3:
|
|||
|
||||
if ((BUTTON(gamefunc_Quick_Save) || g_doQuickSave == 1) && (myplayer.gm & MODE_GAME))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Quick_Save);
|
||||
inputState.ClearButton(gamefunc_Quick_Save);
|
||||
|
||||
g_doQuickSave = 0;
|
||||
|
||||
|
@ -4942,7 +4942,7 @@ FAKE_F3:
|
|||
|
||||
if (BUTTON(gamefunc_Third_Person_View))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Third_Person_View);
|
||||
inputState.ClearButton(gamefunc_Third_Person_View);
|
||||
|
||||
myplayer.over_shoulder_on = !myplayer.over_shoulder_on;
|
||||
|
||||
|
@ -4964,7 +4964,7 @@ FAKE_F3:
|
|||
|
||||
if ((BUTTON(gamefunc_Quick_Load) || g_doQuickSave == 2) && (myplayer.gm & MODE_GAME))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Quick_Load);
|
||||
inputState.ClearButton(gamefunc_Quick_Load);
|
||||
|
||||
g_doQuickSave = 0;
|
||||
|
||||
|
@ -5036,14 +5036,14 @@ FAKE_F3:
|
|||
|
||||
if (BUTTON(gamefunc_AutoRun))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_AutoRun);
|
||||
inputState.ClearButton(gamefunc_AutoRun);
|
||||
cl_autorun= 1-cl_autorun;
|
||||
P_DoQuote(QUOTE_RUN_MODE_OFF + cl_autorun, &myplayer);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Map))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map);
|
||||
inputState.ClearButton(gamefunc_Map);
|
||||
if (ud.last_overhead != ud.overhead_on && ud.last_overhead)
|
||||
{
|
||||
ud.overhead_on = ud.last_overhead;
|
||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "control.h"
|
||||
#include "input.h"
|
||||
#include "menus.h"
|
||||
#include "inputstate.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -52,7 +53,7 @@ void I_ClearAllInput(void)
|
|||
KB_ClearKeysDown();
|
||||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
CONTROL_ClearAllButtons();
|
||||
inputState.ClearAllButtons();
|
||||
#if defined EDUKE32_IOS
|
||||
mouseAdvanceClickState();
|
||||
#endif
|
||||
|
@ -146,10 +147,10 @@ void I_GeneralTriggerClear(void)
|
|||
I_AdvanceTriggerClear();
|
||||
I_ReturnTriggerClear();
|
||||
#if !defined GEKKO
|
||||
CONTROL_ClearButton(gamefunc_Open);
|
||||
CONTROL_ClearButton(gamefunc_Fire);
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
inputState.ClearButton(gamefunc_Fire);
|
||||
#endif
|
||||
CONTROL_ClearButton(gamefunc_Crouch);
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
|
||||
}
|
||||
|
||||
|
@ -194,7 +195,7 @@ void I_MenuUpClear(void)
|
|||
KB_ClearKeyDown(sc_UpArrow);
|
||||
KB_ClearKeyDown(sc_kpad_8);
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Forward);
|
||||
inputState.ClearButton(gamefunc_Move_Forward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_UP);
|
||||
CONTROL_ClearGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTY);
|
||||
|
@ -220,7 +221,7 @@ void I_MenuDownClear(void)
|
|||
KB_ClearKeyDown(sc_kpad_2);
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Backward);
|
||||
inputState.ClearButton(gamefunc_Move_Backward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN);
|
||||
CONTROL_ClearGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTY);
|
||||
|
@ -246,8 +247,8 @@ void I_MenuLeftClear(void)
|
|||
KB_ClearKeyDown(sc_LeftArrow);
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Left);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Left);
|
||||
inputState.ClearButton(gamefunc_Turn_Left);
|
||||
inputState.ClearButton(gamefunc_Strafe_Left);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_LEFT);
|
||||
CONTROL_ClearGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTX);
|
||||
|
@ -274,8 +275,8 @@ void I_MenuRightClear(void)
|
|||
KB_ClearKeyDown(sc_RightArrow);
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Right);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Right);
|
||||
inputState.ClearButton(gamefunc_Turn_Right);
|
||||
inputState.ClearButton(gamefunc_Strafe_Right);
|
||||
MOUSE_ClearButton(MIDDLE_MOUSE);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT);
|
||||
|
|
|
@ -3060,7 +3060,7 @@ void P_GetInput(int const playerNum)
|
|||
pPlayer->crouch_toggle = !pPlayer->crouch_toggle && crouchable;
|
||||
|
||||
if (crouchable)
|
||||
CONTROL_ClearButton(gamefunc_Toggle_Crouch);
|
||||
inputState.ClearButton(gamefunc_Toggle_Crouch);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Crouch) || BUTTON(gamefunc_Jump) || pPlayer->jetpack_on || (!crouchable && pPlayer->on_ground))
|
||||
|
@ -3106,7 +3106,7 @@ void P_GetInput(int const playerNum)
|
|||
input.fvel = 0;
|
||||
|
||||
if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_SEMIAUTO && BUTTON(gamefunc_Fire))
|
||||
CONTROL_ClearButton(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;
|
||||
|
@ -5142,7 +5142,7 @@ void P_ProcessInput(int playerNum)
|
|||
pPlayer->jumping_toggle = 2;
|
||||
|
||||
if (myconnectindex == playerNum)
|
||||
CONTROL_ClearButton(gamefunc_Jump);
|
||||
inputState.ClearButton(gamefunc_Jump);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,13 +177,11 @@ extern LastSeenInput CONTROL_LastSeenInput;
|
|||
|
||||
//void CONTROL_MapKey( int32_t which, kb_scancode key1, kb_scancode key2 );
|
||||
void CONTROL_MapButton(int whichfunction, int whichbutton, int doubleclicked, controldevice device);
|
||||
void CONTROL_DefineFlag( int which, int toggle );
|
||||
int CONTROL_FlagActive( int which );
|
||||
void CONTROL_ClearAssignments( void );
|
||||
// void CONTROL_GetFunctionInput( void );
|
||||
void CONTROL_GetInput( ControlInfo *info );
|
||||
void CONTROL_ClearButton( int whichbutton );
|
||||
void CONTROL_ClearAllButtons( void );
|
||||
extern float CONTROL_MouseSensitivity;
|
||||
bool CONTROL_Startup(controltype which, int32_t ( *TimeFunction )( void ), int32_t ticspersecond);
|
||||
void CONTROL_Shutdown( void );
|
||||
|
@ -230,8 +228,6 @@ void CONTROL_ProcessBinds(void);
|
|||
|
||||
////////////////////
|
||||
|
||||
#define CONTROL_NUM_FLAGS 80
|
||||
extern int32_t CONTROL_ButtonFlags[CONTROL_NUM_FLAGS];
|
||||
extern bool CONTROL_SmoothMouse;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,8 +29,6 @@ static int32_t CONTROL_NumMouseButtons = 0;
|
|||
static int32_t CONTROL_NumJoyButtons = 0;
|
||||
static int32_t CONTROL_NumJoyAxes = 0;
|
||||
|
||||
static controlflags CONTROL_Flags[CONTROL_NUM_FLAGS];
|
||||
|
||||
// static controlkeymaptype CONTROL_KeyMapping[CONTROL_NUM_FLAGS];
|
||||
|
||||
static int32_t CONTROL_MouseAxesScale[2];
|
||||
|
@ -122,86 +120,6 @@ static int32_t CONTROL_GetTime(void)
|
|||
return t;
|
||||
}
|
||||
|
||||
static void CONTROL_SetFlag(int which, int active)
|
||||
{
|
||||
if (CONTROL_CheckRange(which)) return;
|
||||
|
||||
controlflags &flags = CONTROL_Flags[which];
|
||||
|
||||
if (flags.toggle == INSTANT_ONOFF)
|
||||
flags.active = active;
|
||||
else if (active)
|
||||
flags.buttonheld = FALSE;
|
||||
else if (flags.buttonheld == FALSE)
|
||||
{
|
||||
flags.buttonheld = TRUE;
|
||||
flags.active = (flags.active ? FALSE : TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONTROL_DefineFlag(int which, int toggle)
|
||||
{
|
||||
if (CONTROL_CheckRange(which)) return;
|
||||
|
||||
controlflags &flags = CONTROL_Flags[which];
|
||||
|
||||
flags.active = FALSE;
|
||||
flags.buttonheld = FALSE;
|
||||
flags.cleared = 0;
|
||||
flags.toggle = toggle;
|
||||
flags.used = TRUE;
|
||||
}
|
||||
|
||||
int CONTROL_FlagActive(int which)
|
||||
{
|
||||
if (CONTROL_CheckRange(which)) return FALSE;
|
||||
|
||||
return CONTROL_Flags[which].used;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void CONTROL_MapKey(int32_t which, kb_scancode key1, kb_scancode key2)
|
||||
{
|
||||
if (CONTROL_CheckRange(which)) return;
|
||||
|
||||
CONTROL_KeyMapping[which].key1 = key1 ? key1 : KEYUNDEFINED;
|
||||
CONTROL_KeyMapping[which].key2 = key2 ? key2 : KEYUNDEFINED;
|
||||
}
|
||||
|
||||
void CONTROL_PrintKeyMap(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
for (i=0; i<CONTROL_NUM_FLAGS; i++)
|
||||
{
|
||||
initprintf("function %2d key1=%3x key2=%3x\n",
|
||||
i, CONTROL_KeyMapping[i].key1, CONTROL_KeyMapping[i].key2);
|
||||
}
|
||||
}
|
||||
|
||||
void CONTROL_PrintControlFlag(int32_t which)
|
||||
{
|
||||
initprintf("function %2d active=%d used=%d toggle=%d buttonheld=%d cleared=%d\n",
|
||||
which, CONTROL_Flags[which].active, CONTROL_Flags[which].used,
|
||||
CONTROL_Flags[which].toggle, CONTROL_Flags[which].buttonheld,
|
||||
CONTROL_Flags[which].cleared);
|
||||
}
|
||||
|
||||
void CONTROL_PrintAxes(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
initprintf("numjoyaxes=%d\n", CONTROL_NumJoyAxes);
|
||||
for (i=0; i<CONTROL_NumJoyAxes; i++)
|
||||
{
|
||||
initprintf("axis=%d analog=%d digital1=%d digital2=%d\n",
|
||||
i, CONTROL_JoyAxesMap[i].analogmap,
|
||||
CONTROL_JoyAxesMap[i].minmap, CONTROL_JoyAxesMap[i].maxmap);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void CONTROL_MapButton(int whichfunction, int whichbutton, int doubleclicked, controldevice device)
|
||||
{
|
||||
controlbuttontype *set;
|
||||
|
@ -709,14 +627,6 @@ void CONTROL_ClearButton(int whichbutton)
|
|||
CONTROL_Flags[whichbutton].cleared = TRUE;
|
||||
}
|
||||
|
||||
void CONTROL_ClearAllButtons(void)
|
||||
{
|
||||
inputState.ClearButtonState();
|
||||
|
||||
for (auto & c : CONTROL_Flags)
|
||||
c.cleared = TRUE;
|
||||
}
|
||||
|
||||
int32_t CONTROL_GetGameControllerDigitalAxisPos(int32_t axis)
|
||||
{
|
||||
if (!joystick.isGameController)
|
||||
|
@ -777,18 +687,10 @@ static void CONTROL_GetFunctionInput(void)
|
|||
CONTROL_ButtonFunctionState(CONTROL_ButtonFlags);
|
||||
CONTROL_AxisFunctionState(CONTROL_ButtonFlags);
|
||||
|
||||
inputState.PrepareState();
|
||||
|
||||
int i = CONTROL_NUM_FLAGS-1;
|
||||
|
||||
do
|
||||
for (int i = 0; i < NUMGAMEFUNCTIONS; i++ )
|
||||
{
|
||||
CONTROL_SetFlag(i, /*CONTROL_KeyboardFunctionPressed(i) | */CONTROL_ButtonFlags[i]);
|
||||
|
||||
if (CONTROL_Flags[i].cleared == FALSE) inputState.SetButton(i, CONTROL_Flags[i].active);
|
||||
else if (CONTROL_Flags[i].active == FALSE) CONTROL_Flags[i].cleared = 0;
|
||||
inputState.UpdateButton(i, CONTROL_ButtonFlags[i]);
|
||||
}
|
||||
while (i--);
|
||||
|
||||
memset(CONTROL_ButtonFlags, 0, sizeof(CONTROL_ButtonFlags));
|
||||
}
|
||||
|
@ -838,11 +740,6 @@ bool CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ti
|
|||
|
||||
CONTROL_ResetJoystickValues();
|
||||
|
||||
inputState.ClearButtonState();
|
||||
|
||||
for (auto & CONTROL_Flag : CONTROL_Flags)
|
||||
CONTROL_Flag.used = FALSE;
|
||||
|
||||
CONTROL_Started = TRUE;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -917,7 +917,7 @@ nextdemo_nomenu:
|
|||
if (BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_SendMessage);
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
g_player[myconnectindex].ps->gm = MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
}
|
||||
|
|
|
@ -6057,7 +6057,7 @@ void G_HandleLocalKeys(void)
|
|||
{
|
||||
if (BUTTON(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
|
||||
inputState.ClearButton(gamefunc_Enlarge_Screen);
|
||||
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
|
@ -6076,7 +6076,7 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (BUTTON(gamefunc_Shrink_Screen))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Shrink_Screen);
|
||||
inputState.ClearButton(gamefunc_Shrink_Screen);
|
||||
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
|
@ -6099,7 +6099,7 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if (BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_COOPVIEW) || ud.recstat == 2))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_See_Coop_View);
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
if (screenpeek == -1) screenpeek = 0;
|
||||
g_restorePalette = -1;
|
||||
|
@ -6107,21 +6107,21 @@ void G_HandleLocalKeys(void)
|
|||
|
||||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_Show_Opponents_Weapon))
|
||||
{
|
||||
CONTROL_ClearButton(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))
|
||||
{
|
||||
CONTROL_ClearButton(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))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map_Follow_Mode);
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ud.scrollmode = 1-ud.scrollmode;
|
||||
if (ud.scrollmode)
|
||||
{
|
||||
|
@ -6312,7 +6312,7 @@ void G_HandleLocalKeys(void)
|
|||
if ((g_netServer || ud.multimode > 1) && BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_SendMessage);
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
g_player[myconnectindex].ps->gm |= MODE_TYPE;
|
||||
typebuf[0] = 0;
|
||||
}
|
||||
|
@ -6411,7 +6411,7 @@ FAKE_F3:
|
|||
|
||||
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))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Quick_Save);
|
||||
inputState.ClearButton(gamefunc_Quick_Save);
|
||||
|
||||
g_doQuickSave = 0;
|
||||
|
||||
|
@ -6448,7 +6448,7 @@ FAKE_F3:
|
|||
|
||||
if (BUTTON(gamefunc_Third_Person_View))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Third_Person_View);
|
||||
inputState.ClearButton(gamefunc_Third_Person_View);
|
||||
|
||||
if (!RRRA || (!g_player[myconnectindex].ps->on_motorcycle && !g_player[myconnectindex].ps->on_boat))
|
||||
{
|
||||
|
@ -6473,7 +6473,7 @@ FAKE_F3:
|
|||
|
||||
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))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Quick_Load);
|
||||
inputState.ClearButton(gamefunc_Quick_Load);
|
||||
|
||||
g_doQuickSave = 0;
|
||||
|
||||
|
@ -6545,14 +6545,14 @@ FAKE_F3:
|
|||
|
||||
if (BUTTON(gamefunc_AutoRun))
|
||||
{
|
||||
CONTROL_ClearButton(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))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map);
|
||||
inputState.ClearButton(gamefunc_Map);
|
||||
if (ud.last_overhead != ud.overhead_on && ud.last_overhead)
|
||||
{
|
||||
ud.overhead_on = ud.last_overhead;
|
||||
|
|
|
@ -87,8 +87,8 @@ void I_AdvanceTriggerClear(void)
|
|||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_A);
|
||||
#else
|
||||
CONTROL_ClearButton(gamefunc_Open);
|
||||
CONTROL_ClearButton(gamefunc_Fire);
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
inputState.ClearButton(gamefunc_Fire);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ void I_ReturnTriggerClear(void)
|
|||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
MOUSE_ClearButton(RIGHT_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Crouch);
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_B);
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
|
@ -153,7 +153,7 @@ void I_MenuUpClear(void)
|
|||
KB_ClearKeyDown(sc_UpArrow);
|
||||
KB_ClearKeyDown(sc_kpad_8);
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Forward);
|
||||
inputState.ClearButton(gamefunc_Move_Forward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ void I_MenuDownClear(void)
|
|||
KB_ClearKeyDown(sc_kpad_2);
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
CONTROL_ClearButton(gamefunc_Move_Backward);
|
||||
inputState.ClearButton(gamefunc_Move_Backward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
@ -197,8 +197,8 @@ void I_MenuLeftClear(void)
|
|||
KB_ClearKeyDown(sc_LeftArrow);
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Left);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Left);
|
||||
inputState.ClearButton(gamefunc_Turn_Left);
|
||||
inputState.ClearButton(gamefunc_Strafe_Left);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,8 @@ void I_MenuRightClear(void)
|
|||
KB_ClearKeyDown(sc_RightArrow);
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Right);
|
||||
CONTROL_ClearButton(gamefunc_Strafe_Right);
|
||||
inputState.ClearButton(gamefunc_Turn_Right);
|
||||
inputState.ClearButton(gamefunc_Strafe_Right);
|
||||
MOUSE_ClearButton(MIDDLE_MOUSE);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
|
|||
}
|
||||
|
||||
// All gamefuncs (and *only* _gamefuncs_) in I_ReturnTriggerClear() should be replicated here.
|
||||
CONTROL_ClearButton(gamefunc_Crouch);
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
if (I_ReturnTrigger())
|
||||
{
|
||||
I_ReturnTriggerClear();
|
||||
|
|
|
@ -396,14 +396,6 @@ static MenuEntry_t ME_GAMESETUP_DEMOREC = MAKE_MENUENTRY( "Record demo:", &MF_Re
|
|||
static MenuOption_t MEO_ADULTMODE = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &adult_lockout.Value);
|
||||
static MenuEntry_t ME_ADULTMODE = MAKE_MENUENTRY( "Parental lock:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_ADULTMODE, Option );
|
||||
|
||||
#ifdef EDUKE32_ANDROID_MENU
|
||||
static MenuOption_t MEO_GAMESETUP_CROUCHLOCK = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &droidinput.toggleCrouch);
|
||||
static MenuEntry_t ME_GAMESETUP_CROUCHLOCK = MAKE_MENUENTRY("Crouch lock:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_CROUCHLOCK, Option);
|
||||
|
||||
static MenuOption_t MEO_GAMESETUP_QUICKSWITCH = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &droidinput.quickSelectWeapon);
|
||||
static MenuEntry_t ME_GAMESETUP_QUICKSWITCH = MAKE_MENUENTRY("Quick weapon switch:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_QUICKSWITCH, Option);
|
||||
#endif
|
||||
|
||||
#if defined(EDUKE32_ANDROID_MENU) || !defined(EDUKE32_SIMPLE_MENU)
|
||||
static MenuLink_t MEO_GAMESETUP_CHEATS = { MENU_CHEATS, MA_Advance, };
|
||||
static MenuEntry_t ME_GAMESETUP_CHEATS = MAKE_MENUENTRY( "Cheats", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_CHEATS, Link );
|
||||
|
|
|
@ -2953,7 +2953,7 @@ void P_GetInput(int playerNum)
|
|||
pPlayer->crouch_toggle = !pPlayer->crouch_toggle && crouchable;
|
||||
|
||||
if (crouchable)
|
||||
CONTROL_ClearButton(gamefunc_Toggle_Crouch);
|
||||
inputState.ClearButton(gamefunc_Toggle_Crouch);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Crouch) || BUTTON(gamefunc_Jump) || pPlayer->jetpack_on || (!crouchable && pPlayer->on_ground))
|
||||
|
|
|
@ -480,7 +480,7 @@ DemoPlayBack(void)
|
|||
|
||||
if (BUTTON(gamefunc_See_Coop_View))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_See_Coop_View);
|
||||
inputState.ClearButton(gamefunc_See_Coop_View);
|
||||
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
|
||||
|
|
|
@ -1067,18 +1067,15 @@ ResizeView(PLAYERp pp)
|
|||
else
|
||||
{
|
||||
if (BUTTON(gamefunc_Shrink_Screen)) // &&
|
||||
// !BUTTONHELD(gamefunc_SizeVi
|
||||
// ewDown))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Shrink_Screen);
|
||||
inputState.ClearButton(gamefunc_Shrink_Screen);
|
||||
SetBorder(pp, gs.BorderNum + 1);
|
||||
SetRedrawScreen(pp);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Enlarge_Screen)) // &&
|
||||
// !BUTTONHELD(gamefunc_SizeViewUp))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
|
||||
inputState.ClearButton(gamefunc_Enlarge_Screen);
|
||||
SetBorder(pp, gs.BorderNum - 1);
|
||||
SetRedrawScreen(pp);
|
||||
}
|
||||
|
|
|
@ -4125,7 +4125,7 @@ SinglePlayInput(PLAYERp pp)
|
|||
{
|
||||
short oldscreenpeek = screenpeek;
|
||||
|
||||
CONTROL_ClearButton(gamefunc_See_Co_Op_View);
|
||||
inputState.ClearButton(gamefunc_See_Co_Op_View);
|
||||
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
|
||||
|
@ -4633,7 +4633,7 @@ void GetMessageInput(PLAYERp pp)
|
|||
{
|
||||
if (BUTTON(gamefunc_SendMessage))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_SendMessage);
|
||||
inputState.ClearButton(gamefunc_SendMessage);
|
||||
KB_FlushKeyboardQueue();
|
||||
MessageInputMode = TRUE;
|
||||
InputMode = TRUE;
|
||||
|
@ -4668,7 +4668,7 @@ void GetMessageInput(PLAYERp pp)
|
|||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_Inventory);
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4702,11 +4702,11 @@ SEND_MESSAGE:
|
|||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_Inventory);
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
CON_ProcessUserCommand(); // Check to see if it's a cheat or command
|
||||
|
||||
for (i = 0; i < NUMGAMEFUNCTIONS; i++)
|
||||
CONTROL_ClearButton(i);
|
||||
inputState.ClearButton(i);
|
||||
|
||||
// Put who sent this
|
||||
sprintf(ds,"%s: %s",pp->PlayerName,MessageInputString);
|
||||
|
@ -4798,7 +4798,7 @@ void GetConInput(PLAYERp pp)
|
|||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_Inventory);
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
memset(MessageInputString, '\0', sizeof(MessageInputString));
|
||||
}
|
||||
else
|
||||
|
@ -4806,7 +4806,7 @@ void GetConInput(PLAYERp pp)
|
|||
InputMode = FALSE;
|
||||
KB_ClearKeysDown();
|
||||
KB_FlushKeyboardQueue();
|
||||
CONTROL_ClearButton(gamefunc_Inventory);
|
||||
inputState.ClearButton(gamefunc_Inventory);
|
||||
CON_ConMessage("%s", MessageInputString);
|
||||
CON_ProcessUserCommand(); // Check to see if it's a cheat or command
|
||||
|
||||
|
@ -4960,7 +4960,7 @@ getinput(SW_PACKET *loc)
|
|||
g_MyAimMode = 1;
|
||||
else
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Mouse_Aiming);
|
||||
inputState.ClearButton(gamefunc_Mouse_Aiming);
|
||||
g_MyAimMode = !g_MyAimMode;
|
||||
if (g_MyAimMode)
|
||||
{
|
||||
|
@ -4994,7 +4994,7 @@ getinput(SW_PACKET *loc)
|
|||
// MAP KEY
|
||||
if (BUTTON(gamefunc_Map))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map);
|
||||
inputState.ClearButton(gamefunc_Map);
|
||||
|
||||
// Init follow coords
|
||||
Follow_posx = pp->posx;
|
||||
|
@ -5017,8 +5017,9 @@ getinput(SW_PACKET *loc)
|
|||
// Toggle follow map mode on/off
|
||||
if (dimensionmode == 5 || dimensionmode == 6)
|
||||
{
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode) && !BUTTONHELD(gamefunc_Map_Follow_Mode))
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ScrollMode2D = !ScrollMode2D;
|
||||
Follow_posx = pp->posx;
|
||||
Follow_posy = pp->posy;
|
||||
|
@ -5198,7 +5199,7 @@ getinput(SW_PACKET *loc)
|
|||
short next_weapon = u->WeaponNum + 1;
|
||||
short start_weapon;
|
||||
|
||||
CONTROL_ClearButton(gamefunc_Next_Weapon);
|
||||
inputState.ClearButton(gamefunc_Next_Weapon);
|
||||
|
||||
start_weapon = u->WeaponNum + 1;
|
||||
|
||||
|
@ -5238,7 +5239,7 @@ getinput(SW_PACKET *loc)
|
|||
short prev_weapon = u->WeaponNum - 1;
|
||||
short start_weapon;
|
||||
|
||||
CONTROL_ClearButton(gamefunc_Previous_Weapon);
|
||||
inputState.ClearButton(gamefunc_Previous_Weapon);
|
||||
|
||||
start_weapon = u->WeaponNum - 1;
|
||||
|
||||
|
@ -5305,7 +5306,7 @@ getinput(SW_PACKET *loc)
|
|||
{
|
||||
if (BUTTON(gamefunc_See_Co_Op_View))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_See_Co_Op_View);
|
||||
inputState.ClearButton(gamefunc_See_Co_Op_View);
|
||||
|
||||
screenpeek = connectpoint2[screenpeek];
|
||||
|
||||
|
@ -5344,7 +5345,7 @@ getinput(SW_PACKET *loc)
|
|||
|
||||
if (BUTTON(gamefunc_Toggle_Crosshair))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Toggle_Crosshair);
|
||||
inputState.ClearButton(gamefunc_Toggle_Crosshair);
|
||||
pToggleCrosshair(pp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2426,8 +2426,9 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
}
|
||||
|
||||
// Toggle follow map mode on/off
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode) && !BUTTONHELD(gamefunc_Map_Follow_Mode))
|
||||
if (BUTTON(gamefunc_Map_Follow_Mode))
|
||||
{
|
||||
inputState.ClearButton(gamefunc_Map_Follow_Mode);
|
||||
ScrollMode2D = !ScrollMode2D;
|
||||
// Reset coords
|
||||
Follow_posx = pp->posx;
|
||||
|
|
|
@ -117,202 +117,5 @@ void TermSetup(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
// BELOW IS FROM A TEST SETUP BY MARK DOC
|
||||
//******************************************************************************
|
||||
//******************************************************************************
|
||||
//******************************************************************************
|
||||
//******************************************************************************
|
||||
|
||||
#if 0
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "types.h"
|
||||
#include "sndcards.h"
|
||||
#include "fx_man.h"
|
||||
#include "music.h"
|
||||
#include "gamedefs.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "config.h"
|
||||
#include "sounds.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "rts.h"
|
||||
#include "timer.h"
|
||||
|
||||
int32_t timerhandle=0;
|
||||
volatile int32_t timer;
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= Shutdown
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void ShutDown(void)
|
||||
{
|
||||
KB_Shutdown();
|
||||
TIME_RemoveTimer(timerhandle);
|
||||
SoundShutdown();
|
||||
MusicShutdown();
|
||||
CONFIG_WriteSetup();
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= GetTime
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
int32_t GetTime(void)
|
||||
{
|
||||
return timer;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= CenterCenter
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void CenterCenter(void)
|
||||
{
|
||||
printf("Center the joystick and press a button\n");
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= UpperLeft
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void UpperLeft(void)
|
||||
{
|
||||
printf("Move joystick to upper-left corner and press a button\n");
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= LowerRight
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void LowerRight(void)
|
||||
{
|
||||
printf("Move joystick to lower-right corner and press a button\n");
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= CenterThrottle
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void CenterThrottle(void)
|
||||
{
|
||||
printf("Center the throttle control and press a button\n");
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
=
|
||||
= CenterRudder
|
||||
=
|
||||
===================
|
||||
*/
|
||||
|
||||
void CenterRudder(void)
|
||||
{
|
||||
printf("Center the rudder control and press a button\n");
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
char *song;
|
||||
char *voc;
|
||||
volatile int32_t lasttime;
|
||||
|
||||
RegisterShutdownFunction(ShutDown);
|
||||
KB_Startup();
|
||||
timerhandle = TIME_AddTimer(40, &timer);
|
||||
//CONFIG_GetSetupFilename();
|
||||
CONFIG_ReadSetup();
|
||||
|
||||
SoundStartup();
|
||||
MusicStartup();
|
||||
|
||||
// load in some test data
|
||||
|
||||
LoadFile("test.mid",&song);
|
||||
LoadFile("test.voc",&voc);
|
||||
|
||||
// start playing a song
|
||||
|
||||
MUSIC_PlaySong(song, MUSIC_LoopSong);
|
||||
|
||||
|
||||
lasttime = timer;
|
||||
while (1)
|
||||
{
|
||||
int32_t i;
|
||||
ControlInfo info;
|
||||
|
||||
while (lasttime==timer)
|
||||
{
|
||||
ServiceEvents();
|
||||
}
|
||||
lasttime = timer;
|
||||
// printf("timer=%ld\n",timer);
|
||||
CONTROL_GetInput(&info);
|
||||
|
||||
if (
|
||||
info.dx!=0 ||
|
||||
info.dy!=0 ||
|
||||
info.dz!=0 ||
|
||||
info.dpitch!=0 ||
|
||||
info.dyaw!=0 ||
|
||||
info.droll!=0
|
||||
)
|
||||
printf("x=%6ld y=%6ld z=%6ld yaw=%6ld pitch=%6ld roll=%6ld\n",
|
||||
info.dx,info.dy,info.dz,info.dyaw,info.dpitch,info.droll);
|
||||
// Get Keyboard input and set appropiate game function states
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
if (KB_KeyPressed(sc_F1+i))
|
||||
{
|
||||
uint8_t *ptr;
|
||||
KB_ClearKeyDown(sc_F1+i);
|
||||
ptr = (uint8_t *)RTS_GetSound(i);
|
||||
FX_PlayVOC(ptr, 0, 255, 255, 255, 255, 0);
|
||||
}
|
||||
}
|
||||
// Check to see if fire is being pressed so we can play a sound
|
||||
if (BUTTON(gamefunc_Fire) && !BUTTONHELD(gamefunc_Fire))
|
||||
{
|
||||
FX_PlayVOC(voc, 0, 255, 255, 255, 255, 0);
|
||||
}
|
||||
|
||||
// Check to see if we want to exit
|
||||
if (KB_KeyPressed(sc_Escape))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ShutDown();
|
||||
}
|
||||
#endif
|
||||
END_SW_NS
|
||||
|
|
Loading…
Reference in a new issue