mirror of
https://github.com/nzp-team/quakec.git
synced 2025-02-16 00:51:57 +00:00
Merge pull request #100 from Peter0x44/controller_akimbo_fire_correct_side
CLIENT/SERVER: Fire the correct akimbo weapon when using gamepads
This commit is contained in:
commit
77e8408394
4 changed files with 32 additions and 2 deletions
|
@ -892,9 +892,15 @@ noref float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent
|
||||||
float last_input_storage = last_input_was_gamepad;
|
float last_input_storage = last_input_was_gamepad;
|
||||||
|
|
||||||
if (last_input_deviceid > 0)
|
if (last_input_deviceid > 0)
|
||||||
|
{
|
||||||
last_input_was_gamepad = TRUE;
|
last_input_was_gamepad = TRUE;
|
||||||
|
setlocaluserinfo(0, "using_gamepad", "1");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
last_input_was_gamepad = FALSE;
|
last_input_was_gamepad = FALSE;
|
||||||
|
setlocaluserinfo(0, "using_gamepad", "0");
|
||||||
|
}
|
||||||
|
|
||||||
if (current_menu != MENU_NONE)
|
if (current_menu != MENU_NONE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -592,6 +592,9 @@ void() PlayerPostThink =
|
||||||
|
|
||||||
// Network everything
|
// Network everything
|
||||||
self.SendFlags = 1;
|
self.SendFlags = 1;
|
||||||
|
|
||||||
|
// Used to tell which gun to fire for akimbo weapons
|
||||||
|
self.is_using_gamepad = stof(infokey(self, "using_gamepad"));
|
||||||
|
|
||||||
// Obtain menu state from CSQC via infokeys.
|
// Obtain menu state from CSQC via infokeys.
|
||||||
self.is_in_menu = stof(infokey(self, "in_menu"));
|
self.is_in_menu = stof(infokey(self, "in_menu"));
|
||||||
|
|
|
@ -1912,9 +1912,20 @@ void() WeaponCore_FireButtonPressed =
|
||||||
// to which click of the mouse you've provided, which is different behavior
|
// to which click of the mouse you've provided, which is different behavior
|
||||||
// to single-hand weapons, where left click fires its right-side. (Hooray
|
// to single-hand weapons, where left click fires its right-side. (Hooray
|
||||||
// for ternaries!).
|
// for ternaries!).
|
||||||
|
// For gamepads, we don't want this behavior, because the gun that
|
||||||
|
// fires will be the wrong side
|
||||||
#ifdef FTE
|
#ifdef FTE
|
||||||
|
|
||||||
(IsDualWeapon(self.weapon)) ? W_Fire(S_LEFT) : W_Fire(S_RIGHT);
|
if (self.is_using_gamepad)
|
||||||
|
{
|
||||||
|
// Gamepads always fire the right side
|
||||||
|
W_Fire(S_RIGHT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Otherwise, fire the side of the mouse click for akimbo weapons
|
||||||
|
(IsDualWeapon(self.weapon)) ? W_Fire(S_LEFT) : W_Fire(S_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -1959,8 +1970,17 @@ void() WeaponCore_AimButtonPressed =
|
||||||
// fire our secondary as opposed to Aiming down the Sight.
|
// fire our secondary as opposed to Aiming down the Sight.
|
||||||
if (IsDualWeapon(self.weapon)) {
|
if (IsDualWeapon(self.weapon)) {
|
||||||
#ifdef FTE
|
#ifdef FTE
|
||||||
|
// On KBM this is the right click, so it should fire the right weapon.
|
||||||
|
// On gamepads, this is the left trigger, so it should fire the left weapon.
|
||||||
|
|
||||||
W_Fire(S_RIGHT);
|
if (self.is_using_gamepad)
|
||||||
|
{
|
||||||
|
W_Fire(S_LEFT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
W_Fire(S_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -316,6 +316,7 @@ float game_over;
|
||||||
|
|
||||||
#ifdef FTE
|
#ifdef FTE
|
||||||
.float is_in_menu;
|
.float is_in_menu;
|
||||||
|
.float is_using_gamepad;
|
||||||
#endif // FTE
|
#endif // FTE
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue