mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 09:20:51 +00:00
- externalized the controller bindings and removed all code responsible for maintaining them separately.
Bindings were changed a bit because what was there was a very poor default for my own controller.
This commit is contained in:
parent
26daff79db
commit
026cc7153c
6 changed files with 23 additions and 121 deletions
|
@ -37,6 +37,7 @@
|
||||||
#include "basics.h"
|
#include "basics.h"
|
||||||
#include "zstring.h"
|
#include "zstring.h"
|
||||||
#include "c_bind.h"
|
#include "c_bind.h"
|
||||||
|
#include "control.h"
|
||||||
#include "gamecontrol.h"
|
#include "gamecontrol.h"
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -411,7 +411,6 @@ int CONFIG_Init()
|
||||||
|
|
||||||
CONTROL_ClearAssignments();
|
CONTROL_ClearAssignments();
|
||||||
CONFIG_InitMouseAndController();
|
CONFIG_InitMouseAndController();
|
||||||
CONFIG_SetGameControllerDefaultsStandard();
|
|
||||||
CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
|
CONFIG_SetDefaultKeys(cl_defaultconfiguration == 1 ? "demolition/origbinds.txt" : cl_defaultconfiguration == 2 ? "demolition/leftbinds.txt" : "demolition/defbinds.txt");
|
||||||
|
|
||||||
G_ReadConfig(currentGame);
|
G_ReadConfig(currentGame);
|
||||||
|
@ -721,122 +720,6 @@ static void CONFIG_SetGameControllerAxesModern()
|
||||||
analogAxis.apply();
|
analogAxis.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CONFIG_SetGameControllerDefaultsStandard()
|
|
||||||
{
|
|
||||||
CONFIG_SetGameControllerDefaultsClear();
|
|
||||||
CONFIG_SetGameControllerAxesModern();
|
|
||||||
|
|
||||||
static GameControllerButtonSetting const buttons[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_BUTTON_A, gamefunc_Jump },
|
|
||||||
{ GAMECONTROLLER_BUTTON_B, gamefunc_Toggle_Crouch },
|
|
||||||
{ GAMECONTROLLER_BUTTON_BACK, gamefunc_Map },
|
|
||||||
{ GAMECONTROLLER_BUTTON_LEFTSTICK, gamefunc_Run },
|
|
||||||
{ GAMECONTROLLER_BUTTON_RIGHTSTICK, gamefunc_Quick_Kick },
|
|
||||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Crouch },
|
|
||||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Jump },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_UP, gamefunc_Previous_Weapon },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_DOWN, gamefunc_Next_Weapon },
|
|
||||||
};
|
|
||||||
|
|
||||||
static GameControllerButtonSetting const buttonsDuke[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Open },
|
|
||||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Inventory },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_Inventory_Left },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_Inventory_Right },
|
|
||||||
};
|
|
||||||
|
|
||||||
static GameControllerButtonSetting const buttonsFury[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Steroids }, // Reload
|
|
||||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Open },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_MedKit },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_NightVision }, // Radar
|
|
||||||
};
|
|
||||||
|
|
||||||
static GameControllerDigitalAxisSetting const digitalAxes[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_AXIS_TRIGGERLEFT, 1, gamefunc_Alt_Fire },
|
|
||||||
{ GAMECONTROLLER_AXIS_TRIGGERRIGHT, 1, gamefunc_Fire },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto const& button : buttons)
|
|
||||||
button.apply();
|
|
||||||
|
|
||||||
if (g_gameType & GAMEFLAG_FURY)
|
|
||||||
{
|
|
||||||
for (auto const& button : buttonsFury)
|
|
||||||
button.apply();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (auto const& button : buttonsDuke)
|
|
||||||
button.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto const& digitalAxis : digitalAxes)
|
|
||||||
digitalAxis.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CONFIG_SetGameControllerDefaultsPro()
|
|
||||||
{
|
|
||||||
CONFIG_SetGameControllerDefaultsClear();
|
|
||||||
CONFIG_SetGameControllerAxesModern();
|
|
||||||
|
|
||||||
static GameControllerButtonSetting const buttons[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_BUTTON_A, gamefunc_Open },
|
|
||||||
{ GAMECONTROLLER_BUTTON_B, gamefunc_Third_Person_View },
|
|
||||||
{ GAMECONTROLLER_BUTTON_Y, gamefunc_Quick_Kick },
|
|
||||||
{ GAMECONTROLLER_BUTTON_BACK, gamefunc_Map },
|
|
||||||
{ GAMECONTROLLER_BUTTON_LEFTSTICK, gamefunc_Run },
|
|
||||||
{ GAMECONTROLLER_BUTTON_RIGHTSTICK, gamefunc_Crouch },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_UP, gamefunc_Previous_Weapon },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_DOWN, gamefunc_Next_Weapon },
|
|
||||||
};
|
|
||||||
|
|
||||||
static GameControllerButtonSetting const buttonsDuke[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Inventory },
|
|
||||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Previous_Weapon },
|
|
||||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Next_Weapon },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_Inventory_Left },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_Inventory_Right },
|
|
||||||
};
|
|
||||||
|
|
||||||
static GameControllerButtonSetting const buttonsFury[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_BUTTON_X, gamefunc_Steroids }, // Reload
|
|
||||||
{ GAMECONTROLLER_BUTTON_LEFTSHOULDER, gamefunc_Crouch },
|
|
||||||
{ GAMECONTROLLER_BUTTON_RIGHTSHOULDER, gamefunc_Alt_Fire },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_LEFT, gamefunc_MedKit },
|
|
||||||
{ GAMECONTROLLER_BUTTON_DPAD_RIGHT, gamefunc_NightVision }, // Radar
|
|
||||||
};
|
|
||||||
|
|
||||||
static GameControllerDigitalAxisSetting const digitalAxes[] =
|
|
||||||
{
|
|
||||||
{ GAMECONTROLLER_AXIS_TRIGGERLEFT, 1, gamefunc_Jump },
|
|
||||||
{ GAMECONTROLLER_AXIS_TRIGGERRIGHT, 1, gamefunc_Fire },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto const& button : buttons)
|
|
||||||
button.apply();
|
|
||||||
|
|
||||||
if (g_gameType & GAMEFLAG_FURY)
|
|
||||||
{
|
|
||||||
for (auto const& button : buttonsFury)
|
|
||||||
button.apply();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (auto const& button : buttonsDuke)
|
|
||||||
button.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto const& digitalAxis : digitalAxes)
|
|
||||||
digitalAxis.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CONFIG_InitMouseAndController()
|
void CONFIG_InitMouseAndController()
|
||||||
|
|
|
@ -42,8 +42,6 @@ void CONFIG_SetupJoystick(void);
|
||||||
void CONFIG_WriteControllerSettings();
|
void CONFIG_WriteControllerSettings();
|
||||||
void CONFIG_InitMouseAndController();
|
void CONFIG_InitMouseAndController();
|
||||||
|
|
||||||
void CONFIG_SetGameControllerDefaultsStandard();
|
|
||||||
void CONFIG_SetGameControllerDefaultsPro();
|
|
||||||
void CONFIG_SetGameControllerDefaultsClear();
|
void CONFIG_SetGameControllerDefaultsClear();
|
||||||
|
|
||||||
extern FStringCVar* const CombatMacros[];
|
extern FStringCVar* const CombatMacros[];
|
||||||
|
|
|
@ -63,3 +63,17 @@ K "+See_Coop_View"
|
||||||
Mouse1 "+Fire"
|
Mouse1 "+Fire"
|
||||||
MWheelUp "+Previous_Weapon"
|
MWheelUp "+Previous_Weapon"
|
||||||
MWheelDown "+Next_Weapon"
|
MWheelDown "+Next_Weapon"
|
||||||
|
|
||||||
|
Pad_A "+Fire"
|
||||||
|
Pad_B "+Toggle_Crouch" // fixme: not yet supported by all games
|
||||||
|
Pad_Back "+Map"
|
||||||
|
LTrigger "+Run"
|
||||||
|
RTrigger "+Quick_Kick"
|
||||||
|
LShoulder "+Crouch"
|
||||||
|
RShoulder "+Jump"
|
||||||
|
DPadUp "+Previous_Weapon"
|
||||||
|
DPadDown "+Next_Weapon"
|
||||||
|
Pad_X "+Open"
|
||||||
|
Pad_Y "+Inventory"
|
||||||
|
DPadLeft "+Inventory_Left"
|
||||||
|
DPadRight "+Inventory_Right"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
//
|
//
|
||||||
X "+Last_Used_Weapon"
|
X "+Last_Used_Weapon"
|
||||||
C "+Toggle_Crouch"
|
C "+Toggle_Crouch"
|
||||||
Mouse2 "+Jetpack"
|
Mouse2 "+Steroids"
|
||||||
Mouse3 "+MediKit"
|
Mouse3 "+MediKit"
|
||||||
|
Pad_Y "+Steroids"
|
||||||
|
DPadLeft "+MedKit"
|
||||||
|
DPadRight "+Nightvision"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
W "+Show_Opponents_Weapon"
|
W "+Show_Opponents_Weapon"
|
||||||
Mouse2 "+Jetpack"
|
Mouse2 "+Steroids"
|
||||||
Mouse3 "+MediKit"
|
Mouse3 "+MediKit"
|
||||||
|
Pad_Y "+Steroids"
|
||||||
|
DPadLeft "+MedKit"
|
||||||
|
DPadRight "+Nightvision"
|
||||||
|
|
Loading…
Reference in a new issue