huge cleanup controller code
hope i didnt break anything here lel
This commit is contained in:
1 parent
7194f44eca
commit
c998bd9c05
15 files changed
+599
-2356
No files matched your search
+2
-1
@@ -15,6 +15,7 @@
|
||||
/// plus functions to parse command line parameters, configure game
|
||||
/// parameters, and call the startup functions.
|
||||
|
||||
#include "d_netcmd.h"
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -184,7 +185,7 @@ static inline void D_DeviceLEDTick(void)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (cv_usejoystick[i].value == 0)
|
||||
continue;
|
||||
|
||||
color[i] = G_GetSkinColor(i);
|
||||
|
||||
+26
-64
@@ -303,14 +303,12 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
|
||||
consvar_t cv_laglesscam = {"laglesscamera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||
consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick3 = {"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
|
||||
{"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
@@ -1020,58 +1018,22 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_pauseifunfocused);
|
||||
|
||||
// g_input.c
|
||||
CV_RegisterVar(&cv_turnaxis);
|
||||
CV_RegisterVar(&cv_turnaxis2);
|
||||
CV_RegisterVar(&cv_turnaxis3);
|
||||
CV_RegisterVar(&cv_turnaxis4);
|
||||
CV_RegisterVar(&cv_moveaxis);
|
||||
CV_RegisterVar(&cv_moveaxis2);
|
||||
CV_RegisterVar(&cv_moveaxis3);
|
||||
CV_RegisterVar(&cv_moveaxis4);
|
||||
CV_RegisterVar(&cv_brakeaxis);
|
||||
CV_RegisterVar(&cv_brakeaxis2);
|
||||
CV_RegisterVar(&cv_brakeaxis3);
|
||||
CV_RegisterVar(&cv_brakeaxis4);
|
||||
CV_RegisterVar(&cv_aimaxis);
|
||||
CV_RegisterVar(&cv_aimaxis2);
|
||||
CV_RegisterVar(&cv_aimaxis3);
|
||||
CV_RegisterVar(&cv_aimaxis4);
|
||||
CV_RegisterVar(&cv_lookaxis);
|
||||
CV_RegisterVar(&cv_lookaxis2);
|
||||
CV_RegisterVar(&cv_lookaxis3);
|
||||
CV_RegisterVar(&cv_lookaxis4);
|
||||
CV_RegisterVar(&cv_fireaxis);
|
||||
CV_RegisterVar(&cv_fireaxis2);
|
||||
CV_RegisterVar(&cv_fireaxis3);
|
||||
CV_RegisterVar(&cv_fireaxis4);
|
||||
CV_RegisterVar(&cv_driftaxis);
|
||||
CV_RegisterVar(&cv_driftaxis2);
|
||||
CV_RegisterVar(&cv_driftaxis3);
|
||||
CV_RegisterVar(&cv_driftaxis4);
|
||||
CV_RegisterVar(&cv_lookbackaxis);
|
||||
CV_RegisterVar(&cv_lookbackaxis2);
|
||||
CV_RegisterVar(&cv_lookbackaxis3);
|
||||
CV_RegisterVar(&cv_lookbackaxis4);
|
||||
CV_RegisterVar(&cv_custom1axis);
|
||||
CV_RegisterVar(&cv_custom1axis2);
|
||||
CV_RegisterVar(&cv_custom1axis3);
|
||||
CV_RegisterVar(&cv_custom1axis4);
|
||||
CV_RegisterVar(&cv_custom2axis);
|
||||
CV_RegisterVar(&cv_custom2axis2);
|
||||
CV_RegisterVar(&cv_custom2axis3);
|
||||
CV_RegisterVar(&cv_custom2axis4);
|
||||
CV_RegisterVar(&cv_custom3axis);
|
||||
CV_RegisterVar(&cv_custom3axis2);
|
||||
CV_RegisterVar(&cv_custom3axis3);
|
||||
CV_RegisterVar(&cv_custom3axis4);
|
||||
CV_RegisterVar(&cv_xdeadzone);
|
||||
CV_RegisterVar(&cv_ydeadzone);
|
||||
CV_RegisterVar(&cv_xdeadzone2);
|
||||
CV_RegisterVar(&cv_ydeadzone2);
|
||||
CV_RegisterVar(&cv_xdeadzone3);
|
||||
CV_RegisterVar(&cv_ydeadzone3);
|
||||
CV_RegisterVar(&cv_xdeadzone4);
|
||||
CV_RegisterVar(&cv_ydeadzone4);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_turnaxis[i]);
|
||||
CV_RegisterVar(&cv_moveaxis[i]);
|
||||
CV_RegisterVar(&cv_brakeaxis[i]);
|
||||
CV_RegisterVar(&cv_aimaxis[i]);
|
||||
CV_RegisterVar(&cv_lookaxis[i]);
|
||||
CV_RegisterVar(&cv_fireaxis[i]);
|
||||
CV_RegisterVar(&cv_driftaxis[i]);
|
||||
CV_RegisterVar(&cv_lookbackaxis[i]);
|
||||
CV_RegisterVar(&cv_custom1axis[i]);
|
||||
CV_RegisterVar(&cv_custom2axis[i]);
|
||||
CV_RegisterVar(&cv_custom3axis[i]);
|
||||
CV_RegisterVar(&cv_xdeadzone[i]);
|
||||
CV_RegisterVar(&cv_ydeadzone[i]);
|
||||
}
|
||||
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
@@ -1108,10 +1070,10 @@ void D_RegisterClientCommands(void)
|
||||
//CV_RegisterVar(&cv_mousemove);
|
||||
//CV_RegisterVar(&cv_mousemove2);
|
||||
|
||||
CV_RegisterVar(&cv_usejoystick);
|
||||
CV_RegisterVar(&cv_usejoystick2);
|
||||
CV_RegisterVar(&cv_usejoystick3);
|
||||
CV_RegisterVar(&cv_usejoystick4);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
}
|
||||
#ifdef LJOYSTICK
|
||||
CV_RegisterVar(&cv_joyport);
|
||||
CV_RegisterVar(&cv_joyport2);
|
||||
|
||||
+1
-4
@@ -43,10 +43,7 @@ extern consvar_t cv_seenames, cv_allowseenames;
|
||||
extern consvar_t cv_usemouse;
|
||||
//WTF
|
||||
extern consvar_t cv_mouseturn;
|
||||
extern consvar_t cv_usejoystick;
|
||||
extern consvar_t cv_usejoystick2;
|
||||
extern consvar_t cv_usejoystick3;
|
||||
extern consvar_t cv_usejoystick4;
|
||||
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
|
||||
#ifdef LJOYSTICK
|
||||
extern consvar_t cv_joyport;
|
||||
extern consvar_t cv_joyport2;
|
||||
|
||||
+144
-419
@@ -66,10 +66,7 @@ boolean botingame;
|
||||
UINT8 botskin;
|
||||
UINT8 botcolor;
|
||||
|
||||
JoyType_t Joystick;
|
||||
JoyType_t Joystick2;
|
||||
JoyType_t Joystick3;
|
||||
JoyType_t Joystick4;
|
||||
JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
// 1024 bytes is plenty for a savegame
|
||||
#define SAVEGAMESIZE (1024)
|
||||
@@ -361,25 +358,6 @@ void SendWeaponPref2(void);
|
||||
void SendWeaponPref3(void);
|
||||
void SendWeaponPref4(void);
|
||||
|
||||
//static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}};
|
||||
static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
|
||||
{1, "Left X"}, {2, "Left Y"}, {-1, "Left X-"}, {-2, "Left Y-"},
|
||||
#if JOYAXISSET > 1
|
||||
{3, "Right X"}, {4, "Right Y"}, {-3, "Right X-"}, {-4, "Right Y-"},
|
||||
#endif
|
||||
#if JOYAXISSET > 2
|
||||
{5, "L Trigger"}, {6, "R Trigger"}, {-5, "L Trigger-"}, {-6, "R Trigger-"},
|
||||
#endif
|
||||
#if JOYAXISSET > 3
|
||||
{7, "U-Axis"}, {8, "V-Axis"}, {-7, "U-Axis-"}, {-8, "V-Axis-"},
|
||||
#endif
|
||||
{0, NULL}};
|
||||
#if JOYAXISSET > 4
|
||||
"More Axis Sets"
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t deadzone_cons_t[] = {{FRACUNIT/16, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||
|
||||
// don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler.
|
||||
|
||||
// chat timer thingy
|
||||
@@ -434,61 +412,115 @@ consvar_t cv_chasefreelook2 = {"chasemlook2", "Off", CV_SAVE, CV_OnOff, NULL, 0,
|
||||
consvar_t cv_mousemove = {"mousemove", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mousemove2 = {"mousemove2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};*/
|
||||
|
||||
consvar_t cv_turnaxis = {"joyaxis_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_brakeaxis = {"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis = {"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis = {"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis = {"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis = {"joyaxis_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom1axis = {"joyaxis_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom2axis = {"joyaxis_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom3axis = {"joyaxis_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone = {"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone = {"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
//static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}};
|
||||
static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
|
||||
{1, "Left X"}, {2, "Left Y"}, {-1, "Left X-"}, {-2, "Left Y-"},
|
||||
#if JOYAXISSET > 1
|
||||
{3, "Right X"}, {4, "Right Y"}, {-3, "Right X-"}, {-4, "Right Y-"},
|
||||
#endif
|
||||
#if JOYAXISSET > 2
|
||||
{5, "L Trigger"}, {6, "R Trigger"}, {-5, "L Trigger-"}, {-6, "R Trigger-"},
|
||||
#endif
|
||||
#if JOYAXISSET > 3
|
||||
{7, "U-Axis"}, {8, "V-Axis"}, {-7, "U-Axis-"}, {-8, "V-Axis-"},
|
||||
#endif
|
||||
{0, NULL}};
|
||||
#if JOYAXISSET > 4
|
||||
"More Axis Sets"
|
||||
#endif
|
||||
|
||||
consvar_t cv_turnaxis2 = {"joyaxis2_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis2 = {"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_brakeaxis2 = {"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis2 = {"joyaxis2_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis2 = {"joyaxis2_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis2 = {"joyaxis2_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom1axis2 = {"joyaxis2_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom2axis2 = {"joyaxis2_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom3axis2 = {"joyaxis2_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone2 = {"joy2_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone2 = {"joy2_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t deadzone_cons_t[] = {{FRACUNIT/16, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_turnaxis3 = {"joyaxis3_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis3 = {"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_brakeaxis3 = {"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis3 = {"joyaxis3_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis3 = {"joyaxis3_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis3 = {"joyaxis3_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis3 = {"joyaxis3_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom1axis3 = {"joyaxis3_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom2axis3 = {"joyaxis3_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom3axis3 = {"joyaxis3_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone3 = {"joy3_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone3 = {"joy3_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_turnaxis4 = {"joyaxis4_turn", "Left X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis4 = {"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_brakeaxis4 = {"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_aimaxis4 = {"joyaxis4_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis4 = {"joyaxis4_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis4 = {"joyaxis4_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis4 = {"joyaxis4_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom1axis4 = {"joyaxis4_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom2axis4 = {"joyaxis4_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_custom3axis4 = {"joyaxis4_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone4 = {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_custom1", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_custom2", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyaxis_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis2_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis3_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyaxis4_custom3", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy2_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy3_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy2_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy3_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -695,7 +727,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
|
||||
return (INT16)((*aiming)>>16);
|
||||
}
|
||||
|
||||
static INT32 Joy1Axis(axis_input_e axissel)
|
||||
INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
{
|
||||
INT32 retaxis;
|
||||
INT32 axisval;
|
||||
@@ -705,37 +737,37 @@ static INT32 Joy1Axis(axis_input_e axissel)
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis.value;
|
||||
axisval = cv_turnaxis[player-1].value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis.value;
|
||||
axisval = cv_moveaxis[player-1].value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis.value;
|
||||
axisval = cv_brakeaxis[player-1].value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis.value;
|
||||
axisval = cv_aimaxis[player-1].value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis.value;
|
||||
axisval = cv_lookaxis[player-1].value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis.value;
|
||||
axisval = cv_fireaxis[player-1].value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis.value;
|
||||
axisval = cv_driftaxis[player-1].value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis.value;
|
||||
axisval = cv_lookbackaxis[player-1].value;
|
||||
break;
|
||||
case AXISCUSTOM1:
|
||||
axisval = cv_custom1axis.value;
|
||||
axisval = cv_custom1axis[player-1].value;
|
||||
break;
|
||||
case AXISCUSTOM2:
|
||||
axisval = cv_custom2axis.value;
|
||||
axisval = cv_custom2axis[player-1].value;
|
||||
break;
|
||||
case AXISCUSTOM3:
|
||||
axisval = cv_custom3axis.value;
|
||||
axisval = cv_custom3axis[player-1].value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
@@ -758,9 +790,9 @@ static INT32 Joy1Axis(axis_input_e axissel)
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick.bGamepadStyle && axissel < AXISDEAD)
|
||||
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone.value) >> FRACBITS;
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[player-1].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
@@ -777,9 +809,9 @@ static INT32 Joy1Axis(axis_input_e axissel)
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick.bGamepadStyle && axissel < AXISDEAD)
|
||||
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone.value) >> FRACBITS;
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[player-1].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
@@ -788,291 +820,6 @@ static INT32 Joy1Axis(axis_input_e axissel)
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 Joy2Axis(axis_input_e axissel)
|
||||
{
|
||||
INT32 retaxis;
|
||||
INT32 axisval;
|
||||
boolean flp = false;
|
||||
|
||||
//find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis2.value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis2.value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis2.value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis2.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis2.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis2.value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis2.value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis2.value;
|
||||
break;
|
||||
case AXISCUSTOM1:
|
||||
axisval = cv_custom1axis2.value;
|
||||
break;
|
||||
case AXISCUSTOM2:
|
||||
axisval = cv_custom2axis2.value;
|
||||
break;
|
||||
case AXISCUSTOM3:
|
||||
axisval = cv_custom3axis2.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (axisval < 0) //odd -axises
|
||||
{
|
||||
axisval = -axisval;
|
||||
flp = true;
|
||||
}
|
||||
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
|
||||
return 0;
|
||||
|
||||
if (axisval%2)
|
||||
{
|
||||
axisval /= 2;
|
||||
retaxis = joy2xmove[axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone2.value) >> FRACBITS;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
axisval--;
|
||||
axisval /= 2;
|
||||
retaxis = joy2ymove[axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick2.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone2.value) >> FRACBITS;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 Joy3Axis(axis_input_e axissel)
|
||||
{
|
||||
INT32 retaxis;
|
||||
INT32 axisval;
|
||||
boolean flp = false;
|
||||
|
||||
//find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis3.value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis3.value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis3.value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis3.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis3.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis3.value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis3.value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis3.value;
|
||||
break;
|
||||
case AXISCUSTOM1:
|
||||
axisval = cv_custom1axis3.value;
|
||||
break;
|
||||
case AXISCUSTOM2:
|
||||
axisval = cv_custom2axis3.value;
|
||||
break;
|
||||
case AXISCUSTOM3:
|
||||
axisval = cv_custom3axis3.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (axisval < 0) //odd -axises
|
||||
{
|
||||
axisval = -axisval;
|
||||
flp = true;
|
||||
}
|
||||
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
|
||||
return 0;
|
||||
|
||||
if (axisval%2)
|
||||
{
|
||||
axisval /= 2;
|
||||
retaxis = joy3xmove[axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick3.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone3.value) >> FRACBITS;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
axisval--;
|
||||
axisval /= 2;
|
||||
retaxis = joy3ymove[axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick3.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone3.value) >> FRACBITS;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 Joy4Axis(axis_input_e axissel)
|
||||
{
|
||||
INT32 retaxis;
|
||||
INT32 axisval;
|
||||
boolean flp = false;
|
||||
|
||||
//find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis4.value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis4.value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis4.value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis4.value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis4.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis4.value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis4.value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis4.value;
|
||||
break;
|
||||
case AXISCUSTOM1:
|
||||
axisval = cv_custom1axis4.value;
|
||||
break;
|
||||
case AXISCUSTOM2:
|
||||
axisval = cv_custom2axis4.value;
|
||||
break;
|
||||
case AXISCUSTOM3:
|
||||
axisval = cv_custom3axis4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (axisval < 0) //odd -axises
|
||||
{
|
||||
axisval = -axisval;
|
||||
flp = true;
|
||||
}
|
||||
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
|
||||
return 0;
|
||||
|
||||
if (axisval%2)
|
||||
{
|
||||
axisval /= 2;
|
||||
retaxis = joy4xmove[axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick4.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone4.value) >> FRACBITS;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
axisval--;
|
||||
axisval /= 2;
|
||||
retaxis = joy4ymove[axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick4.bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone4.value) >> FRACBITS;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
boolean InputDown(INT32 gc, UINT8 p)
|
||||
{
|
||||
switch (p)
|
||||
@@ -1088,21 +835,6 @@ boolean InputDown(INT32 gc, UINT8 p)
|
||||
}
|
||||
}
|
||||
|
||||
INT32 JoyAxis(axis_input_e axissel, UINT8 p)
|
||||
{
|
||||
switch (p)
|
||||
{
|
||||
case 2:
|
||||
return Joy2Axis(axissel);
|
||||
case 3:
|
||||
return Joy3Axis(axissel);
|
||||
case 4:
|
||||
return Joy4Axis(axissel);
|
||||
default:
|
||||
return Joy1Axis(axissel);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
// Builds a ticcmd from all of the available inputs
|
||||
@@ -1121,11 +853,12 @@ static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4};
|
||||
|
||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
{
|
||||
const UINT8 forplayer = ssplayer-1;
|
||||
INT32 laim, th, tspeed, forward, side, axis; //i
|
||||
const INT32 speed = 1;
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||
boolean invertmouse, lookaxis, usejoystick, kbl, rd;
|
||||
boolean turnleft, turnright, mouseaiming;
|
||||
boolean invertmouse, usejoystick, kbl, rd;
|
||||
player_t *player;
|
||||
camera_t *thiscam;
|
||||
angle_t lang;
|
||||
@@ -1134,22 +867,26 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
static boolean keyboard_look[MAXSPLITSCREENPLAYERS]; // true if lookup/down using keyboard
|
||||
static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame
|
||||
|
||||
const boolean lookaxis = cv_lookaxis[forplayer].value;
|
||||
const boolean analogjoystickmove = cv_usejoystick[forplayer].value && !Joystick[forplayer].bGamepadStyle;
|
||||
const boolean gamepadjoystickmove = cv_usejoystick[forplayer].value && Joystick[forplayer].bGamepadStyle;
|
||||
|
||||
if (demo.playback) return;
|
||||
|
||||
if (ssplayer == 1)
|
||||
player = &players[consoleplayer];
|
||||
else
|
||||
player = &players[displayplayers[ssplayer-1]];
|
||||
player = &players[displayplayers[forplayer]];
|
||||
|
||||
if (ssplayer == 2)
|
||||
thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]);
|
||||
thiscam = (player->bot == 2 ? &camera[0] : &camera[forplayer]);
|
||||
else
|
||||
thiscam = &camera[ssplayer-1];
|
||||
lang = localangle[ssplayer-1];
|
||||
laim = localaiming[ssplayer-1];
|
||||
th = turnheld[ssplayer-1];
|
||||
kbl = keyboard_look[ssplayer-1];
|
||||
rd = resetdown[ssplayer-1];
|
||||
thiscam = &camera[forplayer];
|
||||
lang = localangle[forplayer];
|
||||
laim = localaiming[forplayer];
|
||||
th = turnheld[forplayer];
|
||||
kbl = keyboard_look[forplayer];
|
||||
rd = resetdown[forplayer];
|
||||
|
||||
switch (ssplayer)
|
||||
{
|
||||
@@ -1183,31 +920,19 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
case 2:
|
||||
mouseaiming = player->spectator; //(PLAYER2INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook2.value;
|
||||
invertmouse = cv_invertmouse2.value;
|
||||
lookaxis = cv_lookaxis2.value;
|
||||
analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle;
|
||||
gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle;
|
||||
break;
|
||||
case 3:
|
||||
mouseaiming = false;
|
||||
invertmouse = false;
|
||||
lookaxis = cv_lookaxis3.value;
|
||||
analogjoystickmove = cv_usejoystick3.value && !Joystick3.bGamepadStyle;
|
||||
gamepadjoystickmove = cv_usejoystick3.value && Joystick3.bGamepadStyle;
|
||||
break;
|
||||
case 4:
|
||||
mouseaiming = false;
|
||||
invertmouse = false;
|
||||
lookaxis = cv_lookaxis4.value;
|
||||
analogjoystickmove = cv_usejoystick4.value && !Joystick4.bGamepadStyle;
|
||||
gamepadjoystickmove = cv_usejoystick4.value && Joystick4.bGamepadStyle;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
mouseaiming = player->spectator; //(PLAYER1INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook.value;
|
||||
invertmouse = cv_invertmouse.value;
|
||||
lookaxis = cv_lookaxis.value;
|
||||
analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle;
|
||||
gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1454,13 +1179,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
|
||||
if (!hu_stopped)
|
||||
{
|
||||
localangle[ssplayer-1] = lang;
|
||||
localaiming[ssplayer-1] = laim;
|
||||
keyboard_look[ssplayer-1] = kbl;
|
||||
turnheld[ssplayer-1] = th;
|
||||
resetdown[ssplayer-1] = rd;
|
||||
localangle[forplayer] = lang;
|
||||
localaiming[forplayer] = laim;
|
||||
keyboard_look[forplayer] = kbl;
|
||||
turnheld[forplayer] = th;
|
||||
resetdown[forplayer] = rd;
|
||||
axis = JoyAxis(AXISLOOKBACK, ssplayer);
|
||||
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
|
||||
camspin[forplayer] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
|
||||
}
|
||||
|
||||
/* Lua: Allow this hook to overwrite ticcmd.
|
||||
|
||||
+15
-4
@@ -121,10 +121,21 @@ extern consvar_t cv_pauseifunfocused;
|
||||
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
|
||||
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
|
||||
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
|
||||
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_lookbackaxis,cv_custom1axis,cv_custom2axis,cv_custom3axis,cv_xdeadzone,cv_ydeadzone;
|
||||
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_lookbackaxis2,cv_custom1axis2,cv_custom2axis2,cv_custom3axis2,cv_xdeadzone2,cv_ydeadzone2;
|
||||
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_lookbackaxis3,cv_custom1axis3,cv_custom2axis3,cv_custom3axis3,cv_xdeadzone3,cv_ydeadzone3;
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_custom1axis4,cv_custom2axis4,cv_custom3axis4,cv_xdeadzone4,cv_ydeadzone4;
|
||||
|
||||
extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
// Hud offsets
|
||||
|
||||
+5
-27
@@ -908,28 +908,6 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
|
||||
#include "k_kart.h"
|
||||
|
||||
INT32 G_GetDeviceForPlayer(INT32 player)
|
||||
{
|
||||
switch (player)
|
||||
{
|
||||
case 0:
|
||||
return cv_usejoystick.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_usejoystick2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_usejoystick3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_usejoystick4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline UINT16 G_GetSkinColor(INT32 player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
@@ -972,7 +950,7 @@ void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color)
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
return;
|
||||
|
||||
device = G_GetDeviceForPlayer(player);
|
||||
device = cv_usejoystick[player].value;
|
||||
|
||||
if (device <= 0)
|
||||
{
|
||||
@@ -989,7 +967,7 @@ static void G_ResetPlayerGamepadIndicatorColor(INT32 player)
|
||||
{
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
{
|
||||
INT32 device = G_GetDeviceForPlayer(player);
|
||||
INT32 device = cv_usejoystick[player].value;
|
||||
if (device <= 0)
|
||||
return;
|
||||
|
||||
@@ -1003,7 +981,7 @@ static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
@@ -1022,7 +1000,7 @@ void G_ResetAllDeviceRumbles(void)
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
{
|
||||
INT32 device_id = G_GetDeviceForPlayer(i);
|
||||
INT32 device_id = cv_usejoystick[i].value;
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
@@ -1037,7 +1015,7 @@ void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strengt
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
|
||||
+1
-1
@@ -53,6 +53,6 @@ typedef struct JoyType_s JoyType_t;
|
||||
for palyer[sic] 1-4's joystick/gamepad
|
||||
*/
|
||||
|
||||
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;
|
||||
extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
#endif // __I_JOY_H__
|
||||
+7
-15
@@ -206,9 +206,13 @@ void I_JoyScale4(void);
|
||||
|
||||
// Called by D_SRB2Main.
|
||||
|
||||
/** \brief to startup joystick
|
||||
*/
|
||||
void I_InitJoystick(UINT8 index);
|
||||
|
||||
/** \brief to startup the first joystick
|
||||
*/
|
||||
void I_InitJoystick(void);
|
||||
void I_InitJoystick1(void);
|
||||
|
||||
/** \brief to startup the second joystick
|
||||
*/
|
||||
@@ -311,21 +315,9 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
|
||||
*/
|
||||
const char *I_LocateWad(void);
|
||||
|
||||
/** \brief First Joystick's events
|
||||
/** \brief Joystick events
|
||||
*/
|
||||
void I_GetJoystickEvents(void);
|
||||
|
||||
/** \brief Second Joystick's events
|
||||
*/
|
||||
void I_GetJoystick2Events(void);
|
||||
|
||||
/** \brief Third Joystick's events
|
||||
*/
|
||||
void I_GetJoystick3Events(void);
|
||||
|
||||
/** \brief Fourth Joystick's events
|
||||
*/
|
||||
void I_GetJoystick4Events(void);
|
||||
void I_GetJoystickEvents(UINT8 index);
|
||||
|
||||
/** \brief Mouses events
|
||||
*/
|
||||
|
||||
+147
-147
@@ -1224,19 +1224,19 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
static menuitem_t OP_Joystick1Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup1PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[0] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[0] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[0] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[0] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[0] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[0] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[0] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[0] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[0] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[0] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[0] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[0] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[0] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[0] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[0] , 95},
|
||||
@@ -1246,19 +1246,19 @@ static menuitem_t OP_Joystick1Menu[] =
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup2PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis2 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis2 , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis2 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis2 , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis2 , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis2 , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone2 , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone2 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[1] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[1] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[1] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[1] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[1] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[1] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[1] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[1] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[1] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[1] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[1] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[1] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[1] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[1] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[1] , 95},
|
||||
@@ -1268,19 +1268,19 @@ static menuitem_t OP_Joystick2Menu[] =
|
||||
static menuitem_t OP_Joystick3Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup3PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis3 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis3 , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis3 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis3 , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis3 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis3 , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis3 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis3 , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis3 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone3 , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone3 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[2] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[2] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[2] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[2] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[2] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[2] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[2] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[2] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[2] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[2] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[2] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[2] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[2] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[2] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[2] , 95},
|
||||
@@ -1290,19 +1290,19 @@ static menuitem_t OP_Joystick3Menu[] =
|
||||
static menuitem_t OP_Joystick4Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup4PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis4 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis4 , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis4 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis4 , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis4 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis4 , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis4 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis4 , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis4 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone4 , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone4 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[3] , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Turn Left/Right" , &cv_turnaxis[3] , 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Accelerate" , &cv_moveaxis[3] , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis[3] , 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis[3] , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis[3] , 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis[3] , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis[3] , 55},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 1" , &cv_custom1axis[3] , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 2" , &cv_custom2axis[3] , 65},
|
||||
{IT_STRING | IT_CVAR, NULL, "Custom Button 3" , &cv_custom3axis[3] , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[3] , 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[3] , 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[3] , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Set LED to skin color" , &cv_gamepadled[3] , 95},
|
||||
@@ -3690,14 +3690,14 @@ boolean M_Responder(event_t *ev)
|
||||
tic_t thistime = I_GetTime();
|
||||
if (ev->type == ev_joystick)
|
||||
{
|
||||
const INT32 jxdeadzone = ((JOYAXISRANGE-1) * max(cv_xdeadzone.value, FRACUNIT/2)) >> FRACBITS;
|
||||
const INT32 jydeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone.value, FRACUNIT/2)) >> FRACBITS;
|
||||
INT32 accelaxis = abs(cv_moveaxis.value);
|
||||
const INT32 jxdeadzone = ((JOYAXISRANGE-1) * max(cv_xdeadzone[0].value, FRACUNIT/2)) >> FRACBITS;
|
||||
const INT32 jydeadzone = ((JOYAXISRANGE-1) * max(cv_ydeadzone[0].value, FRACUNIT/2)) >> FRACBITS;
|
||||
INT32 accelaxis = abs(cv_moveaxis[0].value);
|
||||
if (ev->data1 == 0)
|
||||
{
|
||||
if (ev->data3 != INT32_MAX)
|
||||
{
|
||||
if (Joystick.bGamepadStyle || abs(ev->data3) > jydeadzone)
|
||||
if (Joystick[0].bGamepadStyle || abs(ev->data3) > jydeadzone)
|
||||
{
|
||||
if (joywaity < thistime
|
||||
&& (pjoyy == 0 || (ev->data3 < 0) != (pjoyy < 0))) // no previous direction OR change direction
|
||||
@@ -3713,7 +3713,7 @@ boolean M_Responder(event_t *ev)
|
||||
|
||||
if (ev->data2 != INT32_MAX && joywaitx < thistime)
|
||||
{
|
||||
if (Joystick.bGamepadStyle || abs(ev->data2) > jxdeadzone)
|
||||
if (Joystick[0].bGamepadStyle || abs(ev->data2) > jxdeadzone)
|
||||
{
|
||||
if (joywaitx < thistime
|
||||
&& (pjoyx == 0 || (ev->data2 < 0) != (pjoyx < 0))) // no previous direction OR change direction
|
||||
@@ -3741,10 +3741,10 @@ boolean M_Responder(event_t *ev)
|
||||
retaxis = xmode ? ev->data2 : ev->data3;
|
||||
if (retaxis != INT32_MAX)
|
||||
{
|
||||
if (cv_moveaxis.value < 0)
|
||||
if (cv_moveaxis[0].value < 0)
|
||||
retaxis = -retaxis;
|
||||
|
||||
if (Joystick.bGamepadStyle || retaxis > jacceldeadzone)
|
||||
if (Joystick[0].bGamepadStyle || retaxis > jacceldeadzone)
|
||||
{
|
||||
if (joywaitaccel < thistime && retaxis > pjoyaccel) // only on upwards event
|
||||
{
|
||||
@@ -11804,30 +11804,30 @@ static void M_DrawJoystick(void)
|
||||
//M_DrawSaveLoadBorder(OP_JoystickSetDef.x, OP_JoystickSetDef.y+LINEHEIGHT*i);
|
||||
|
||||
#ifdef JOYSTICK_HOTPLUG
|
||||
if (atoi(cv_usejoystick4.string) > I_NumJoys())
|
||||
compareval4 = atoi(cv_usejoystick4.string);
|
||||
if (atoi(cv_usejoystick[3].string) > I_NumJoys())
|
||||
compareval4 = atoi(cv_usejoystick[3].string);
|
||||
else
|
||||
compareval4 = cv_usejoystick4.value;
|
||||
compareval4 = cv_usejoystick[3].value;
|
||||
|
||||
if (atoi(cv_usejoystick3.string) > I_NumJoys())
|
||||
compareval3 = atoi(cv_usejoystick3.string);
|
||||
if (atoi(cv_usejoystick[2].string) > I_NumJoys())
|
||||
compareval3 = atoi(cv_usejoystick[2].string);
|
||||
else
|
||||
compareval3 = cv_usejoystick3.value;
|
||||
compareval3 = cv_usejoystick[2].value;
|
||||
|
||||
if (atoi(cv_usejoystick2.string) > I_NumJoys())
|
||||
compareval2 = atoi(cv_usejoystick2.string);
|
||||
if (atoi(cv_usejoystick[1].string) > I_NumJoys())
|
||||
compareval2 = atoi(cv_usejoystick[1].string);
|
||||
else
|
||||
compareval2 = cv_usejoystick2.value;
|
||||
compareval2 = cv_usejoystick[1].value;
|
||||
|
||||
if (atoi(cv_usejoystick.string) > I_NumJoys())
|
||||
compareval = atoi(cv_usejoystick.string);
|
||||
if (atoi(cv_usejoystick[0].string) > I_NumJoys())
|
||||
compareval = atoi(cv_usejoystick[0].string);
|
||||
else
|
||||
compareval = cv_usejoystick.value;
|
||||
compareval = cv_usejoystick[0].value;
|
||||
#else
|
||||
compareval4 = cv_usejoystick4.value;
|
||||
compareval3 = cv_usejoystick3.value;
|
||||
compareval2 = cv_usejoystick2.value;
|
||||
compareval = cv_usejoystick.value;
|
||||
compareval4 = cv_usejoystick[3].value;
|
||||
compareval3 = cv_usejoystick[2].value;
|
||||
compareval2 = cv_usejoystick[1].value;
|
||||
compareval = cv_usejoystick[0].value;
|
||||
#endif
|
||||
|
||||
if ((setupcontrolplayer == 4 && (i == compareval4))
|
||||
@@ -11865,14 +11865,14 @@ void M_SetupJoystickMenu(INT32 choice)
|
||||
//
|
||||
// Update cv_usejoystick.string here so that the user can
|
||||
// properly change this value.
|
||||
if (i == cv_usejoystick.value)
|
||||
CV_SetValue(&cv_usejoystick, i);
|
||||
if (i == cv_usejoystick2.value)
|
||||
CV_SetValue(&cv_usejoystick2, i);
|
||||
if (i == cv_usejoystick3.value)
|
||||
CV_SetValue(&cv_usejoystick3, i);
|
||||
if (i == cv_usejoystick4.value)
|
||||
CV_SetValue(&cv_usejoystick4, i);
|
||||
if (i == cv_usejoystick[0].value)
|
||||
CV_SetValue(&cv_usejoystick[0], i);
|
||||
if (i == cv_usejoystick[1].value)
|
||||
CV_SetValue(&cv_usejoystick[1], i);
|
||||
if (i == cv_usejoystick[2].value)
|
||||
CV_SetValue(&cv_usejoystick[2], i);
|
||||
if (i == cv_usejoystick[3].value)
|
||||
CV_SetValue(&cv_usejoystick[3], i);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11915,27 +11915,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
|
||||
if (setupcontrolplayer == 4)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value;
|
||||
CV_SetValue(&cv_usejoystick4, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[3].string) > numjoys ? atoi(cv_usejoystick[3].string) : cv_usejoystick[3].value;
|
||||
CV_SetValue(&cv_usejoystick[3], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
CV_SetValue(&cv_usejoystick[3], cv_usejoystick[3].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick4.value;
|
||||
oldchoice = cv_usejoystick[3].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick4, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[3], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick4.string) > numjoys ? atoi(cv_usejoystick4.string) : cv_usejoystick4.value))
|
||||
(atoi(cv_usejoystick[3].string) > numjoys ? atoi(cv_usejoystick[3].string) : cv_usejoystick[3].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -11945,27 +11945,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
else if (setupcontrolplayer == 3)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value;
|
||||
CV_SetValue(&cv_usejoystick3, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[2].string) > numjoys ? atoi(cv_usejoystick[2].string) : cv_usejoystick[2].value;
|
||||
CV_SetValue(&cv_usejoystick[2], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
|
||||
CV_SetValue(&cv_usejoystick[2], cv_usejoystick[2].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick3.value;
|
||||
oldchoice = cv_usejoystick[2].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick3, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[2], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick3.string) > numjoys ? atoi(cv_usejoystick3.string) : cv_usejoystick3.value))
|
||||
(atoi(cv_usejoystick[2].string) > numjoys ? atoi(cv_usejoystick[2].string) : cv_usejoystick[2].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -11975,27 +11975,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
else if (setupcontrolplayer == 2)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value;
|
||||
CV_SetValue(&cv_usejoystick2, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[1].string) > numjoys ? atoi(cv_usejoystick[1].string) : cv_usejoystick[1].value;
|
||||
CV_SetValue(&cv_usejoystick[1], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
|
||||
CV_SetValue(&cv_usejoystick[1], cv_usejoystick[1].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick2.value;
|
||||
oldchoice = cv_usejoystick[1].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick2, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[1], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick2.string) > numjoys ? atoi(cv_usejoystick2.string) : cv_usejoystick2.value))
|
||||
(atoi(cv_usejoystick[1].string) > numjoys ? atoi(cv_usejoystick[1].string) : cv_usejoystick[1].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -12005,27 +12005,27 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
else if (setupcontrolplayer == 1)
|
||||
{
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value;
|
||||
CV_SetValue(&cv_usejoystick, choice);
|
||||
oldchoice = oldstringchoice = atoi(cv_usejoystick[0].string) > numjoys ? atoi(cv_usejoystick[0].string) : cv_usejoystick[0].value;
|
||||
CV_SetValue(&cv_usejoystick[0], choice);
|
||||
|
||||
// Just in case last-minute changes were made to cv_usejoystick.value,
|
||||
// update the string too
|
||||
// But don't do this if we're intentionally setting higher than numjoys
|
||||
if (choice <= numjoys)
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
|
||||
CV_SetValue(&cv_usejoystick[0], cv_usejoystick[0].value);
|
||||
|
||||
// reset this so the comparison is valid
|
||||
if (oldchoice > numjoys)
|
||||
oldchoice = cv_usejoystick.value;
|
||||
oldchoice = cv_usejoystick[0].value;
|
||||
|
||||
if (oldchoice != choice)
|
||||
{
|
||||
if (choice && oldstringchoice > numjoys) // if we did not select "None", we likely selected a used device
|
||||
CV_SetValue(&cv_usejoystick, (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
CV_SetValue(&cv_usejoystick[0], (oldstringchoice > numjoys ? oldstringchoice : oldchoice));
|
||||
|
||||
if (oldstringchoice ==
|
||||
(atoi(cv_usejoystick.string) > numjoys ? atoi(cv_usejoystick.string) : cv_usejoystick.value))
|
||||
(atoi(cv_usejoystick[0].string) > numjoys ? atoi(cv_usejoystick[0].string) : cv_usejoystick[0].value))
|
||||
M_StartMessage("This joystick is used by another\n"
|
||||
"player. Reset the joystick\n"
|
||||
"for that player first.\n\n"
|
||||
@@ -12035,13 +12035,13 @@ static void M_AssignJoystick(INT32 choice)
|
||||
}
|
||||
#else
|
||||
if (setupcontrolplayer == 4)
|
||||
CV_SetValue(&cv_usejoystick4, choice);
|
||||
CV_SetValue(&cv_usejoystick[3], choice);
|
||||
else if (setupcontrolplayer == 3)
|
||||
CV_SetValue(&cv_usejoystick3, choice);
|
||||
CV_SetValue(&cv_usejoystick[2], choice);
|
||||
else if (setupcontrolplayer == 2)
|
||||
CV_SetValue(&cv_usejoystick2, choice);
|
||||
CV_SetValue(&cv_usejoystick[1], choice);
|
||||
else if (setupcontrolplayer == 1)
|
||||
CV_SetValue(&cv_usejoystick, choice);
|
||||
CV_SetValue(&cv_usejoystick[0], choice);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12395,49 +12395,49 @@ static void M_ResetControlsResponse(INT32 ch)
|
||||
switch (setupcontrolplayer)
|
||||
{
|
||||
case 4:
|
||||
CV_StealthSet(&cv_usejoystick4, cv_usejoystick4.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis4, cv_turnaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis4, cv_moveaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis4, cv_brakeaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis4, cv_aimaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis4, cv_lookaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis4, cv_fireaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis4, cv_driftaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis4, cv_lookbackaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[3], cv_usejoystick[3].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[3], cv_turnaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[3], cv_moveaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[3], cv_brakeaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[3], cv_aimaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[3], cv_lookaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[3], cv_fireaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[3], cv_driftaxis[3].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[3], cv_lookbackaxis[3].defaultvalue);
|
||||
break;
|
||||
case 3:
|
||||
CV_StealthSet(&cv_usejoystick3, cv_usejoystick3.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis3, cv_turnaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis3, cv_moveaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis3, cv_brakeaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis3, cv_aimaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis3, cv_lookaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis3, cv_fireaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis3, cv_driftaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis3, cv_lookbackaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[2], cv_usejoystick[2].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[2], cv_turnaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[2], cv_moveaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[2], cv_brakeaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[2], cv_aimaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[2], cv_lookaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[2], cv_fireaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[2], cv_driftaxis[2].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[2], cv_lookbackaxis[2].defaultvalue);
|
||||
break;
|
||||
case 2:
|
||||
CV_StealthSet(&cv_usejoystick2, cv_usejoystick2.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis2, cv_turnaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis2, cv_moveaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis2, cv_brakeaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis2, cv_aimaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis2, cv_lookaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis2, cv_fireaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis2, cv_driftaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis2, cv_lookbackaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[1], cv_usejoystick[1].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[1], cv_turnaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[1], cv_moveaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[1], cv_brakeaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[1], cv_aimaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[1], cv_lookaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[1], cv_fireaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[1], cv_driftaxis[1].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[1], cv_lookbackaxis[1].defaultvalue);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
CV_StealthSet(&cv_usejoystick, cv_usejoystick.defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis, cv_turnaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis, cv_moveaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis, cv_brakeaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis, cv_aimaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis, cv_lookaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis, cv_fireaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis, cv_driftaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis, cv_lookbackaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_usejoystick[0], cv_usejoystick[0].defaultvalue);
|
||||
CV_StealthSet(&cv_turnaxis[0], cv_turnaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_moveaxis[0], cv_moveaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_brakeaxis[0], cv_brakeaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_aimaxis[0], cv_aimaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_lookaxis[0], cv_lookaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis[0], cv_fireaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis[0], cv_driftaxis[0].defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis[0], cv_lookbackaxis[0].defaultvalue);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -345,7 +345,7 @@ static inline void P_DeviceRumbleTick(void)
|
||||
if (!P_IsLocalPlayer(player))
|
||||
continue;
|
||||
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (cv_usejoystick[i].value == 0)
|
||||
continue;
|
||||
|
||||
if (!playeringame[displayplayers[i]] || player->spectator)
|
||||
@@ -644,7 +644,7 @@ void P_Ticker(boolean run)
|
||||
G_WriteAllGhostTics();
|
||||
|
||||
if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick.value && axis > 0)))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
//if there are no players left at all, stop demo recording
|
||||
|
||||
+1
-1
@@ -3045,7 +3045,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
|
||||
mouseaiming = true;
|
||||
invertmouse = cv_invertmouse.value;
|
||||
lookaxis = cv_lookaxis.value;
|
||||
lookaxis = cv_lookaxis[0].value;
|
||||
|
||||
usejoystick = true;
|
||||
turnright = InputDown(gc_turnright, 1);
|
||||
|
||||
+144
-1335
File diff suppressed because it is too large.
Load diff
+99
-317
@@ -671,90 +671,37 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
||||
{
|
||||
// -32768 to 32767
|
||||
INT32 raxis = axis/32;
|
||||
UINT8 pid;
|
||||
|
||||
if (which == ev_joystick)
|
||||
{
|
||||
if (Joystick.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else
|
||||
raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo.scale!=1?((raxis/JoyInfo.scale)*JoyInfo.scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pid = 0;
|
||||
else if (which == ev_joystick2)
|
||||
{
|
||||
if (Joystick2.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo2.scale!=1?((raxis/JoyInfo2.scale)*JoyInfo2.scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pid = 1;
|
||||
else if (which == ev_joystick3)
|
||||
{
|
||||
if (Joystick3.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo3.scale!=1?((raxis/JoyInfo3.scale)*JoyInfo3.scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
pid = 2;
|
||||
else if (which == ev_joystick4)
|
||||
pid = 3;
|
||||
else
|
||||
return 0;
|
||||
|
||||
if (Joystick[pid].bGamepadStyle)
|
||||
{
|
||||
if (Joystick4.bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo4.scale!=1?((raxis/JoyInfo4.scale)*JoyInfo4.scale):raxis;
|
||||
raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo[pid].scale!=1?((raxis/JoyInfo[pid].scale)*JoyInfo[pid].scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return raxis;
|
||||
}
|
||||
@@ -1041,12 +988,13 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[4];
|
||||
INT32 value;
|
||||
UINT8 i;
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
joyid[0] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo.dev));
|
||||
joyid[1] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo2.dev));
|
||||
joyid[2] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo3.dev));
|
||||
joyid[3] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo4.dev));
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev));
|
||||
}
|
||||
|
||||
event.data1 = event.data2 = event.data3 = INT32_MAX;
|
||||
|
||||
@@ -1067,9 +1015,11 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
|
||||
event.type = ev_joystick4;
|
||||
}
|
||||
else return;
|
||||
|
||||
//axis
|
||||
if (evt.axis > JOYAXISSET*2)
|
||||
return;
|
||||
|
||||
//vaule
|
||||
value = SDLJoyAxis(evt.value, event.type);
|
||||
switch (evt.axis)
|
||||
@@ -1104,43 +1054,17 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void Impl_HandleJoystickHatEvent(SDL_JoyHatEvent evt)
|
||||
{
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[2];
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
joyid[0] = SDL_JoystickInstanceID(JoyInfo.dev);
|
||||
joyid[1] = SDL_JoystickInstanceID(JoyInfo2.dev);
|
||||
|
||||
if (evt.hat >= JOYHATS)
|
||||
return; // ignore hats with too high an index
|
||||
|
||||
if (evt.which == joyid[0])
|
||||
{
|
||||
event.data1 = KEY_HAT1 + (evt.hat*4);
|
||||
}
|
||||
else if (evt.which == joyid[1])
|
||||
{
|
||||
event.data1 = KEY_2HAT1 + (evt.hat*4);
|
||||
}
|
||||
else return;
|
||||
|
||||
// NOTE: UNFINISHED
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint32 type)
|
||||
{
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[4];
|
||||
UINT8 i;
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
joyid[0] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo.dev));
|
||||
joyid[1] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo2.dev));
|
||||
joyid[2] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo3.dev));
|
||||
joyid[3] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo4.dev));
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
joyid[i] = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev));
|
||||
}
|
||||
|
||||
if (evt.button == SDL_CONTROLLER_BUTTON_DPAD_UP
|
||||
|| evt.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN
|
||||
@@ -1187,8 +1111,6 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint
|
||||
if (event.type != ev_console) D_PostEvent(&event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void I_GetEvent(void)
|
||||
{
|
||||
SDL_Event evt;
|
||||
@@ -1196,6 +1118,7 @@ void I_GetEvent(void)
|
||||
// We only want the first motion event,
|
||||
// otherwise we'll end up catching the warp back to center.
|
||||
//int mouseMotionOnce = 0;
|
||||
INT32 i;
|
||||
|
||||
if (!graphics_started)
|
||||
{
|
||||
@@ -1261,77 +1184,42 @@ void I_GetEvent(void)
|
||||
// * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 1
|
||||
//////////////////////////////
|
||||
|
||||
if (newcontroller && (!JoyInfo.dev || !SDL_GameControllerGetAttached(JoyInfo.dev))
|
||||
&& JoyInfo2.dev != newcontroller && JoyInfo3.dev != newcontroller && JoyInfo4.dev != newcontroller) // don't override a currently active device
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
cv_usejoystick.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(1);
|
||||
}
|
||||
if (newcontroller && (!JoyInfo[i].dev || !SDL_GameControllerGetAttached(JoyInfo[i].dev)))
|
||||
{
|
||||
UINT8 j;
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 2
|
||||
//////////////////////////////
|
||||
for (j = 0; j < MAXSPLITSCREENPLAYERS; j++)
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
|
||||
else if (newcontroller && (!JoyInfo2.dev || !SDL_GameControllerGetAttached(JoyInfo2.dev))
|
||||
&& JoyInfo.dev != newcontroller && JoyInfo3.dev != newcontroller && JoyInfo4.dev != newcontroller) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick2.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(2);
|
||||
}
|
||||
if (JoyInfo[j].dev == newcontroller)
|
||||
break;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 3
|
||||
//////////////////////////////
|
||||
|
||||
else if (newcontroller && (!JoyInfo3.dev || !SDL_GameControllerGetAttached(JoyInfo3.dev))
|
||||
&& JoyInfo.dev != newcontroller && JoyInfo2.dev != newcontroller && JoyInfo4.dev != newcontroller) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick3.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(3);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// PLAYER 4
|
||||
//////////////////////////////
|
||||
|
||||
else if (newcontroller && (!JoyInfo4.dev || !SDL_GameControllerGetAttached(JoyInfo4.dev))
|
||||
&& JoyInfo.dev != newcontroller && JoyInfo2.dev != newcontroller && JoyInfo3.dev != newcontroller) // don't override a currently active device
|
||||
{
|
||||
cv_usejoystick4.value = evt.cdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(4);
|
||||
if (j == MAXSPLITSCREENPLAYERS)
|
||||
{
|
||||
// ensures we aren't overriding a currently active device
|
||||
cv_usejoystick[i].value = evt.jdevice.which + 1;
|
||||
I_UpdateJoystickDeviceIndices(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Was cv_usejoystick disabled in settings?
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (!strcmp(cv_usejoystick.string, "0") || !cv_usejoystick.value)
|
||||
cv_usejoystick.value = 0;
|
||||
else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick2.string, "0") || !cv_usejoystick2.value)
|
||||
cv_usejoystick2.value = 0;
|
||||
else if (atoi(cv_usejoystick2.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick2.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick3.string, "0") || !cv_usejoystick3.value)
|
||||
cv_usejoystick3.value = 0;
|
||||
else if (atoi(cv_usejoystick3.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick3.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick4.string, "0") || !cv_usejoystick4.value)
|
||||
cv_usejoystick4.value = 0;
|
||||
else if (atoi(cv_usejoystick4.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick4.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!strcmp(cv_usejoystick[i].string, "0") || !cv_usejoystick[i].value)
|
||||
cv_usejoystick[i].value = 0;
|
||||
else if (atoi(cv_usejoystick[i].string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick[i].value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Update all joysticks' init states
|
||||
@@ -1340,23 +1228,25 @@ void I_GetEvent(void)
|
||||
// if the device is already active, this should do nothing, effectively.
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
I_InitJoystick();
|
||||
I_InitJoystick2();
|
||||
I_InitJoystick3();
|
||||
I_InitJoystick4();
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
I_InitJoystick(i);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick4 device index: %d\n", JoyInfo4.oldjoy);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
|
||||
// update the menu
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
M_SetupJoystickMenu(0);
|
||||
|
||||
if (JoyInfo.dev != newcontroller && JoyInfo2.dev != newcontroller && JoyInfo3.dev != newcontroller && JoyInfo4.dev != newcontroller)
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (JoyInfo[i].dev == newcontroller)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == MAXSPLITSCREENPLAYERS)
|
||||
SDL_GameControllerClose(newcontroller);
|
||||
}
|
||||
break;
|
||||
@@ -1364,28 +1254,13 @@ void I_GetEvent(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
case SDL_CONTROLLERDEVICEREMOVED:
|
||||
if (JoyInfo.dev && !SDL_GameControllerGetAttached(JoyInfo.dev))
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 removed, device index: %d\n", JoyInfo.oldjoy);
|
||||
I_ShutdownJoystick();
|
||||
}
|
||||
|
||||
if (JoyInfo2.dev && !SDL_GameControllerGetAttached(JoyInfo2.dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 removed, device index: %d\n", JoyInfo2.oldjoy);
|
||||
I_ShutdownJoystick2();
|
||||
}
|
||||
|
||||
if (JoyInfo3.dev && !SDL_GameControllerGetAttached(JoyInfo3.dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 removed, device index: %d\n", JoyInfo3.oldjoy);
|
||||
I_ShutdownJoystick3();
|
||||
}
|
||||
|
||||
if (JoyInfo4.dev && !SDL_GameControllerGetAttached(JoyInfo4.dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick4 removed, device index: %d\n", JoyInfo4.oldjoy);
|
||||
I_ShutdownJoystick4();
|
||||
if (JoyInfo[i].dev && !SDL_GameControllerGetAttached(JoyInfo[i].dev))
|
||||
{
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d removed, device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
I_ShutdownJoystick(i);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -1394,124 +1269,32 @@ void I_GetEvent(void)
|
||||
// * BUT: If that default index is being occupied, use ANOTHER cv_usejoystick's default value!
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (JoyInfo.dev)
|
||||
cv_usejoystick.value = JoyInfo.oldjoy = I_GetJoystickDeviceIndex(JoyInfo.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick.value = 0;
|
||||
|
||||
if (JoyInfo2.dev)
|
||||
cv_usejoystick2.value = JoyInfo2.oldjoy = I_GetJoystickDeviceIndex(JoyInfo2.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick2.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick2.value = 0;
|
||||
|
||||
if (JoyInfo3.dev)
|
||||
cv_usejoystick3.value = JoyInfo3.oldjoy = I_GetJoystickDeviceIndex(JoyInfo3.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo4.oldjoy)
|
||||
cv_usejoystick3.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick3.value = 0;
|
||||
|
||||
if (JoyInfo4.dev)
|
||||
cv_usejoystick4.value = JoyInfo4.oldjoy = I_GetJoystickDeviceIndex(JoyInfo4.dev) + 1;
|
||||
else if (atoi(cv_usejoystick.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick.string);
|
||||
else if (atoi(cv_usejoystick2.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick2.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick2.string);
|
||||
else if (atoi(cv_usejoystick3.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick3.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick3.string);
|
||||
else if (atoi(cv_usejoystick4.string) != JoyInfo.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo2.oldjoy
|
||||
&& atoi(cv_usejoystick4.string) != JoyInfo3.oldjoy)
|
||||
cv_usejoystick4.value = atoi(cv_usejoystick4.string);
|
||||
else // we tried...
|
||||
cv_usejoystick4.value = 0;
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
I_UpdateJoystickDeviceIndex(i);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Was cv_usejoystick disabled in settings?
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
if (!strcmp(cv_usejoystick.string, "0"))
|
||||
cv_usejoystick.value = 0;
|
||||
else if (atoi(cv_usejoystick.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick, cv_usejoystick.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick2.string, "0"))
|
||||
cv_usejoystick2.value = 0;
|
||||
else if (atoi(cv_usejoystick2.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick2.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick2, cv_usejoystick2.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick3.string, "0"))
|
||||
cv_usejoystick3.value = 0;
|
||||
else if (atoi(cv_usejoystick3.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick3.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick3, cv_usejoystick3.value);
|
||||
|
||||
if (!strcmp(cv_usejoystick4.string, "0"))
|
||||
cv_usejoystick4.value = 0;
|
||||
else if (atoi(cv_usejoystick4.string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick4.value) // update the cvar ONLY if a device exists
|
||||
CV_SetValue(&cv_usejoystick4, cv_usejoystick4.value);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!strcmp(cv_usejoystick[i].string, "0"))
|
||||
{
|
||||
cv_usejoystick[i].value = 0;
|
||||
}
|
||||
else if (atoi(cv_usejoystick[i].string) <= I_NumJoys() // don't mess if we intentionally set higher than NumJoys
|
||||
&& cv_usejoystick[i].value) // update the cvar ONLY if a device exists
|
||||
{
|
||||
CV_SetValue(&cv_usejoystick[i], cv_usejoystick[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device index: %d\n", JoyInfo.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick2 device index: %d\n", JoyInfo2.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick3 device index: %d\n", JoyInfo3.oldjoy);
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick4 device index: %d\n", JoyInfo4.oldjoy);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
CONS_Debug(DBG_GAMELOGIC, "Joystick%d device index: %d\n", i+1, JoyInfo[i].oldjoy);
|
||||
|
||||
// update the menu
|
||||
if (currentMenu == &OP_JoystickSetDef)
|
||||
@@ -1573,16 +1356,15 @@ void I_StartupMouse(void)
|
||||
void I_OsPolling(void)
|
||||
{
|
||||
SDL_Keymod mod;
|
||||
INT32 i;
|
||||
|
||||
if (consolevent)
|
||||
I_GetConsoleEvents();
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) == (SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER))
|
||||
{
|
||||
SDL_GameControllerUpdate();
|
||||
I_GetJoystickEvents();
|
||||
I_GetJoystick2Events();
|
||||
I_GetJoystick3Events();
|
||||
I_GetJoystick4Events();
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
I_GetJoystickEvents(i);
|
||||
}
|
||||
|
||||
I_GetMouseEvents();
|
||||
|
||||
+4
-18
@@ -59,38 +59,24 @@ typedef struct SDLJoyInfo_s
|
||||
|
||||
/** \brief SDL info about controller 1
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo;
|
||||
extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
|
||||
|
||||
/** \brief joystick axis deadzone
|
||||
*/
|
||||
#define SDL_JDEADZONE 153
|
||||
#undef SDL_JDEADZONE
|
||||
|
||||
/** \brief SDL inof about controller 2
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo2;
|
||||
|
||||
/** \brief SDL inof about controller 3
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo3;
|
||||
|
||||
/** \brief SDL inof about controller 4
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo4;
|
||||
|
||||
void I_GetConsoleEvents(void);
|
||||
|
||||
// So we can call this from i_video event loop
|
||||
void I_ShutdownJoystick(void);
|
||||
void I_ShutdownJoystick2(void);
|
||||
void I_ShutdownJoystick3(void);
|
||||
void I_ShutdownJoystick4(void);
|
||||
void I_ShutdownJoystick(UINT8 index);
|
||||
|
||||
// Cheat to get the device index for a game controller handle
|
||||
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev);
|
||||
|
||||
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
|
||||
void I_UpdateJoystickDeviceIndices(INT32 player);
|
||||
void I_UpdateJoystickDeviceIndex(UINT8 player);
|
||||
void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer);
|
||||
|
||||
void I_GetConsoleEvents(void);
|
||||
|
||||
|
||||
+1
-1
@@ -611,7 +611,7 @@ void Y_Ticker(void)
|
||||
{
|
||||
INT32 axis = JoyAxis(AXISLOOKBACK, 1);
|
||||
|
||||
if (demo.savemode == DSM_NOTSAVING && (InputDown(gc_lookback, 1) || (cv_usejoystick.value && axis > 0)))
|
||||
if (demo.savemode == DSM_NOTSAVING && (InputDown(gc_lookback, 1) || (cv_usejoystick[0].value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
|
||||
Reference in new issue
Block a user