mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-19 07:51:19 +00:00
Added axis support
This commit is contained in:
parent
ec84b46bb4
commit
98fa8c1409
3 changed files with 17 additions and 15 deletions
14
src/g_game.c
14
src/g_game.c
|
@ -416,18 +416,6 @@ consvar_t cv_useranalog3 = {"useranalog3", "Off", CV_SAVE|CV_CALL, CV_OnOff, Use
|
||||||
consvar_t cv_useranalog4 = {"useranalog4", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_useranalog4 = {"useranalog4", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog4_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
AXISNONE = 0,
|
|
||||||
AXISTURN,
|
|
||||||
AXISMOVE,
|
|
||||||
AXISLOOK,
|
|
||||||
AXISSTRAFE,
|
|
||||||
AXISDEAD, //Axises that don't want deadzones
|
|
||||||
AXISFIRE,
|
|
||||||
AXISFIRENORMAL,
|
|
||||||
} axis_input_e;
|
|
||||||
|
|
||||||
#if defined (_WII) || defined (WMINPUT)
|
#if defined (_WII) || defined (WMINPUT)
|
||||||
consvar_t cv_turnaxis = {"joyaxis_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_turnaxis = {"joyaxis_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_moveaxis = {"joyaxis_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_moveaxis = {"joyaxis_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -1166,7 +1154,7 @@ static boolean InputDown(INT32 gc, UINT8 p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT32 JoyAxis(axis_input_e axissel, UINT8 p)
|
INT32 JoyAxis(axis_input_e axissel, UINT8 p)
|
||||||
{
|
{
|
||||||
switch (p)
|
switch (p)
|
||||||
{
|
{
|
||||||
|
|
14
src/g_game.h
14
src/g_game.h
|
@ -62,6 +62,18 @@ extern consvar_t cv_sideaxis3,cv_turnaxis3,cv_moveaxis3,cv_lookaxis3,cv_fireaxis
|
||||||
extern consvar_t cv_sideaxis4,cv_turnaxis4,cv_moveaxis4,cv_lookaxis4,cv_fireaxis4,cv_firenaxis4;
|
extern consvar_t cv_sideaxis4,cv_turnaxis4,cv_moveaxis4,cv_lookaxis4,cv_fireaxis4,cv_firenaxis4;
|
||||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
AXISNONE = 0,
|
||||||
|
AXISTURN,
|
||||||
|
AXISMOVE,
|
||||||
|
AXISLOOK,
|
||||||
|
AXISSTRAFE,
|
||||||
|
AXISDEAD, //Axises that don't want deadzones
|
||||||
|
AXISFIRE,
|
||||||
|
AXISFIRENORMAL,
|
||||||
|
} axis_input_e;
|
||||||
|
|
||||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||||
#define KB_LOOKSPEED (1<<25)
|
#define KB_LOOKSPEED (1<<25)
|
||||||
#define MAXPLMOVE (50)
|
#define MAXPLMOVE (50)
|
||||||
|
@ -80,6 +92,8 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n);
|
||||||
INT16 G_ClipAimingPitch(INT32 *aiming);
|
INT16 G_ClipAimingPitch(INT32 *aiming);
|
||||||
INT16 G_SoftwareClipAimingPitch(INT32 *aiming);
|
INT16 G_SoftwareClipAimingPitch(INT32 *aiming);
|
||||||
|
|
||||||
|
INT32 JoyAxis(axis_input_e axissel, UINT8 p);
|
||||||
|
|
||||||
extern angle_t localangle, localangle2, localangle3, localangle4;
|
extern angle_t localangle, localangle2, localangle3, localangle4;
|
||||||
extern INT32 localaiming, localaiming2, localaiming3, localaiming4; // should be an angle_t but signed
|
extern INT32 localaiming, localaiming2, localaiming3, localaiming4; // should be an angle_t but signed
|
||||||
extern boolean camspin, camspin2, camspin3, camspin4; // SRB2Kart
|
extern boolean camspin, camspin2, camspin3, camspin4; // SRB2Kart
|
||||||
|
|
|
@ -2320,12 +2320,12 @@ void Y_VoteTicker(void)
|
||||||
D_ModifyClientVote(-1);
|
D_ModifyClientVote(-1);
|
||||||
else if (pickedvote == -1 && votes[consoleplayer] == -1 && !voteclient.delay)
|
else if (pickedvote == -1 && votes[consoleplayer] == -1 && !voteclient.delay)
|
||||||
{
|
{
|
||||||
if (PLAYER1INPUTDOWN(gc_aimforward))
|
if (PLAYER1INPUTDOWN(gc_aimforward) || JoyAxis(AXISMOVE, 1) < 0)
|
||||||
{
|
{
|
||||||
voteclient.selection--;
|
voteclient.selection--;
|
||||||
pressed = true;
|
pressed = true;
|
||||||
}
|
}
|
||||||
if (PLAYER1INPUTDOWN(gc_aimbackward) && !pressed)
|
if ((PLAYER1INPUTDOWN(gc_aimbackward) || JoyAxis(AXISMOVE, 1) > 0) && !pressed)
|
||||||
{
|
{
|
||||||
voteclient.selection++;
|
voteclient.selection++;
|
||||||
pressed = true;
|
pressed = true;
|
||||||
|
|
Loading…
Reference in a new issue