mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-25 17:32:27 +00:00
InputDown -> PlayerInputDown, JoyAxis -> PlayerJoyAxis
This commit is contained in:
parent
fc10bf1d9a
commit
8071ec92e8
5 changed files with 52 additions and 52 deletions
60
src/g_game.c
60
src/g_game.c
|
|
@ -724,7 +724,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
|
|||
return (INT16)((*aiming)>>16);
|
||||
}
|
||||
|
||||
static INT32 PlayerJoyAxis(UINT8 player, axis_input_e axissel)
|
||||
INT32 PlayerJoyAxis(UINT8 player, axis_input_e axissel)
|
||||
{
|
||||
INT32 retaxis;
|
||||
INT32 axisval;
|
||||
|
|
@ -935,8 +935,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
return;
|
||||
}
|
||||
|
||||
turnright = PLAYERINPUTDOWN(ssplayer, gc_turnright);
|
||||
turnleft = PLAYERINPUTDOWN(ssplayer, gc_turnleft);
|
||||
turnright = PlayerInputDown(ssplayer, gc_turnright);
|
||||
turnleft = PlayerInputDown(ssplayer, gc_turnleft);
|
||||
|
||||
joystickvector.xaxis = PlayerJoyAxis(ssplayer, AXISTURN);
|
||||
joystickvector.yaxis = PlayerJoyAxis(ssplayer, AXISAIM);
|
||||
|
|
@ -999,23 +999,23 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
|
||||
{
|
||||
axis = JoyAxis(AXISMOVE, ssplayer);
|
||||
if (InputDown(gc_accelerate, ssplayer) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISMOVE);
|
||||
if (PlayerInputDown(ssplayer, gc_accelerate) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
axis = JoyAxis(AXISBRAKE, ssplayer);
|
||||
if (InputDown(gc_brake, ssplayer) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISBRAKE);
|
||||
if (PlayerInputDown(ssplayer, gc_brake) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
axis = JoyAxis(AXISAIM, ssplayer);
|
||||
if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISAIM);
|
||||
if (PlayerInputDown(ssplayer, gc_aimforward) || (usejoystick && axis < 0))
|
||||
forward += forwardmove[1];
|
||||
if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0))
|
||||
if (PlayerInputDown(ssplayer, gc_aimbackward) || (usejoystick && axis > 0))
|
||||
forward -= forwardmove[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
// forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward.
|
||||
axis = JoyAxis(AXISMOVE, ssplayer);
|
||||
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || EITHERSNEAKER(player))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISMOVE);
|
||||
if (PlayerInputDown(ssplayer, gc_accelerate) || (gamepadjoystickmove && axis > 0) || EITHERSNEAKER(player))
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
forward = forwardmove[1]; // 50
|
||||
|
|
@ -1027,8 +1027,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
forward += ((axis * forwardmove[1]) >> 10)*2;
|
||||
}
|
||||
|
||||
axis = JoyAxis(AXISBRAKE, ssplayer);
|
||||
if (InputDown(gc_brake, ssplayer) || (gamepadjoystickmove && axis > 0))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISBRAKE);
|
||||
if (PlayerInputDown(ssplayer, gc_brake) || (gamepadjoystickmove && axis > 0))
|
||||
{
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
||||
|
|
@ -1043,37 +1043,37 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
}
|
||||
|
||||
// But forward/backward IS used for aiming.
|
||||
if (InputDown(gc_aimforward, ssplayer) || (joystickvector.yaxis < 0))
|
||||
if (PlayerInputDown(ssplayer, gc_aimforward) || (joystickvector.yaxis < 0))
|
||||
cmd->buttons |= BT_FORWARD;
|
||||
if (InputDown(gc_aimbackward, ssplayer) || (joystickvector.yaxis > 0))
|
||||
if (PlayerInputDown(ssplayer, gc_aimbackward) || (joystickvector.yaxis > 0))
|
||||
cmd->buttons |= BT_BACKWARD;
|
||||
}
|
||||
|
||||
// fire with any button/key
|
||||
axis = JoyAxis(AXISFIRE, ssplayer);
|
||||
if (InputDown(gc_fire, ssplayer) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISFIRE);
|
||||
if (PlayerInputDown(ssplayer, gc_fire) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
|
||||
// drift with any button/key
|
||||
axis = JoyAxis(AXISDRIFT, ssplayer);
|
||||
if (InputDown(gc_drift, ssplayer) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISDRIFT);
|
||||
if (PlayerInputDown(ssplayer, gc_drift) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
|
||||
// rear view with any button/key
|
||||
axis = JoyAxis(AXISLOOKBACK, ssplayer);
|
||||
if (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(ssplayer, AXISLOOKBACK);
|
||||
if (PlayerInputDown(ssplayer, gc_lookback) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_LOOKBACK;
|
||||
|
||||
// Lua scriptable buttons
|
||||
if (InputDown(gc_custom1, ssplayer))
|
||||
if (PlayerInputDown(ssplayer, gc_custom1))
|
||||
cmd->buttons |= BT_CUSTOM1;
|
||||
if (InputDown(gc_custom2, ssplayer))
|
||||
if (PlayerInputDown(ssplayer, gc_custom2))
|
||||
cmd->buttons |= BT_CUSTOM2;
|
||||
if (InputDown(gc_custom3, ssplayer))
|
||||
if (PlayerInputDown(ssplayer, gc_custom3))
|
||||
cmd->buttons |= BT_CUSTOM3;
|
||||
|
||||
// Reset camera
|
||||
if (InputDown(gc_camreset, ssplayer))
|
||||
if (PlayerInputDown(ssplayer, gc_camreset))
|
||||
{
|
||||
if (thiscam->chase && *rd == false)
|
||||
P_ResetCamera(player, thiscam);
|
||||
|
|
@ -1100,7 +1100,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
*laim += (mlooky<<19)*player_invert*screen_invert;
|
||||
}
|
||||
|
||||
axis = JoyAxis(AXISLOOK, ssplayer);
|
||||
axis = PlayerJoyAxis(ssplayer, AXISLOOK);
|
||||
if (analogjoystickmove && axis != 0 && lookaxis && player->spectator)
|
||||
*laim += (axis<<16) * screen_invert;
|
||||
|
||||
|
|
@ -1110,19 +1110,19 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
if (player->spectator)
|
||||
{
|
||||
if (InputDown(gc_lookup, ssplayer) || (gamepadjoystickmove && axis < 0))
|
||||
if (PlayerInputDown(ssplayer, gc_lookup) || (gamepadjoystickmove && axis < 0))
|
||||
{
|
||||
*laim += KB_LOOKSPEED * screen_invert;
|
||||
*kbl = true;
|
||||
}
|
||||
else if (InputDown(gc_lookdown, ssplayer) || (gamepadjoystickmove && axis > 0))
|
||||
else if (PlayerInputDown(ssplayer, gc_lookdown) || (gamepadjoystickmove && axis > 0))
|
||||
{
|
||||
*laim -= KB_LOOKSPEED * screen_invert;
|
||||
*kbl = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (InputDown(gc_centerview, ssplayer)) // No need to put a spectator limit on this one though :V
|
||||
if (PlayerInputDown(ssplayer, gc_centerview)) // No need to put a spectator limit on this one though :V
|
||||
*laim = 0;
|
||||
|
||||
// accept no mlook for network games
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ extern UINT8 gamekeydown[NUMINPUTS];
|
|||
// two key codes (or virtual key) per game control
|
||||
extern INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
|
||||
extern INT32 gamecontroldefault[MAXSPLITSCREENPLAYERS][num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention
|
||||
#define PLAYERINPUTDOWN(p, gc) (gamekeydown[p-1][gamecontrol[gc][0]] || gamekeydown[p-1][gamecontrol[gc][1]])
|
||||
#define PlayerInputDown(p, gc) (gamekeydown[p-1][gamecontrol[gc][0]] || gamekeydown[p-1][gamecontrol[gc][1]])
|
||||
|
||||
#define num_gcl_accelerate 1
|
||||
#define num_gcl_brake 1
|
||||
|
|
|
|||
|
|
@ -807,7 +807,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))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && PlayerInputDown(1, gc_lookback))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
}
|
||||
else if (demo.playback) // Use Ghost data for consistency checks.
|
||||
|
|
|
|||
32
src/p_user.c
32
src/p_user.c
|
|
@ -3010,10 +3010,10 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
lookaxis = cv_lookaxis.value;
|
||||
|
||||
usejoystick = true;
|
||||
turnright = InputDown(gc_turnright, 1);
|
||||
turnleft = InputDown(gc_turnleft, 1);
|
||||
turnright = PlayerInputDown(1, gc_turnright);
|
||||
turnleft = PlayerInputDown(1, gc_turnleft);
|
||||
|
||||
axis = JoyAxis(AXISTURN, 1);
|
||||
axis = PlayerJoyAxis(1, AXISTURN);
|
||||
|
||||
if (encoremode)
|
||||
{
|
||||
|
|
@ -3056,21 +3056,21 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
||||
|
||||
axis = JoyAxis(AXISMOVE, 1);
|
||||
if (InputDown(gc_accelerate, 1) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(1, AXISMOVE);
|
||||
if (PlayerInputDown(1, gc_accelerate) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
axis = JoyAxis(AXISBRAKE, 1);
|
||||
if (InputDown(gc_brake, 1) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(1, AXISBRAKE);
|
||||
if (PlayerInputDown(1, gc_brake) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
axis = JoyAxis(AXISAIM, 1);
|
||||
if (InputDown(gc_aimforward, 1) || (usejoystick && axis < 0))
|
||||
axis = PlayerJoyAxis(1, AXISAIM);
|
||||
if (PlayerInputDown(1, gc_aimforward) || (usejoystick && axis < 0))
|
||||
forward += forwardmove[1];
|
||||
if (InputDown(gc_aimbackward, 1) || (usejoystick && axis > 0))
|
||||
if (PlayerInputDown(1, gc_aimbackward) || (usejoystick && axis > 0))
|
||||
forward -= forwardmove[1];
|
||||
|
||||
// fire with any button/key
|
||||
axis = JoyAxis(AXISFIRE, 1);
|
||||
if (InputDown(gc_fire, 1) || (usejoystick && axis > 0))
|
||||
axis = PlayerJoyAxis(1, AXISFIRE);
|
||||
if (PlayerInputDown(1, gc_fire) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
|
||||
// spectator aiming shit, ahhhh...
|
||||
|
|
@ -3083,24 +3083,24 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
// looking up/down
|
||||
laim += (mlooky<<19)*player_invert*screen_invert;
|
||||
|
||||
axis = JoyAxis(AXISLOOK, 1);
|
||||
axis = PlayerJoyAxis(1, AXISLOOK);
|
||||
|
||||
// spring back if not using keyboard neither mouselookin'
|
||||
if (!kbl && !lookaxis && !mouseaiming)
|
||||
laim = 0;
|
||||
|
||||
if (InputDown(gc_lookup, 1) || (axis < 0))
|
||||
if (PlayerInputDown(1, gc_lookup) || (axis < 0))
|
||||
{
|
||||
laim += KB_LOOKSPEED * screen_invert;
|
||||
kbl = true;
|
||||
}
|
||||
else if (InputDown(gc_lookdown, 1) || (axis > 0))
|
||||
else if (PlayerInputDown(1, gc_lookdown) || (axis > 0))
|
||||
{
|
||||
laim -= KB_LOOKSPEED * screen_invert;
|
||||
kbl = true;
|
||||
}
|
||||
|
||||
if (InputDown(gc_centerview, 1)) // No need to put a spectator limit on this one though :V
|
||||
if (PlayerInputDown(1, gc_centerview)) // No need to put a spectator limit on this one though :V
|
||||
laim = 0;
|
||||
|
||||
cmd->aiming = G_ClipAimingPitch(&laim);
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ void Y_Ticker(void)
|
|||
|
||||
if (demo.recording)
|
||||
{
|
||||
if (demo.savemode == DSM_NOTSAVING && InputDown(gc_lookback, 1))
|
||||
if (demo.savemode == DSM_NOTSAVING && PlayerInputDown(1, gc_lookback))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
|
|
@ -1768,13 +1768,13 @@ void Y_VoteTicker(void)
|
|||
&& !voteclient.playerinfo[i].delay
|
||||
&& pickedvote == -1 && votes[p] == -1)
|
||||
{
|
||||
if (InputDown(gc_aimforward, i+1) || JoyAxis(AXISAIM, i+1) < 0)
|
||||
if (PlayerInputDown(i+1, gc_aimforward) || PlayerJoyAxis(i+1. AXISAIM) < 0)
|
||||
{
|
||||
voteclient.playerinfo[i].selection--;
|
||||
pressed = true;
|
||||
}
|
||||
|
||||
if ((InputDown(gc_aimbackward, i+1) || JoyAxis(AXISAIM, i+1) > 0) && !pressed)
|
||||
if ((PlayerInputDown(i+1, gc_aimbackward) || PlayerJoyAxis(i+1, AXISAIM) > 0) && !pressed)
|
||||
{
|
||||
voteclient.playerinfo[i].selection++;
|
||||
pressed = true;
|
||||
|
|
@ -1785,7 +1785,7 @@ void Y_VoteTicker(void)
|
|||
if (voteclient.playerinfo[i].selection > 3)
|
||||
voteclient.playerinfo[i].selection = 0;
|
||||
|
||||
if ((InputDown(gc_accelerate, i+1) || JoyAxis(AXISMOVE, i+1) > 0) && !pressed)
|
||||
if ((PlayerInputDown(i+1, gc_accelerate) || PlayerJoyAxis(i+1, AXISMOVE) > 0) && !pressed)
|
||||
{
|
||||
D_ModifyClientVote(consoleplayer, voteclient.playerinfo[i].selection, i);
|
||||
pressed = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue