mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'no-turn-easing' into 'master'
Remove turn easing code See merge request KartKrew/Kart!401
This commit is contained in:
commit
e0da1d7a7d
4 changed files with 22 additions and 49 deletions
|
|
@ -3658,7 +3658,6 @@ void G_StopDemo(void)
|
||||||
democam.soundmobj = NULL;
|
democam.soundmobj = NULL;
|
||||||
democam.localangle = 0;
|
democam.localangle = 0;
|
||||||
democam.localaiming = 0;
|
democam.localaiming = 0;
|
||||||
democam.turnheld = false;
|
|
||||||
democam.keyboardlook = false;
|
democam.keyboardlook = false;
|
||||||
|
|
||||||
if (gamestate == GS_INTERMISSION)
|
if (gamestate == GS_INTERMISSION)
|
||||||
|
|
|
||||||
38
src/g_game.c
38
src/g_game.c
|
|
@ -867,8 +867,6 @@ static void G_HandleAxisDeadZone(UINT8 splitnum, joystickvector2_t *joystickvect
|
||||||
INT32 localaiming[MAXSPLITSCREENPLAYERS];
|
INT32 localaiming[MAXSPLITSCREENPLAYERS];
|
||||||
angle_t localangle[MAXSPLITSCREENPLAYERS];
|
angle_t localangle[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
static INT32 angleturn[2] = {KART_FULLTURN, KART_FULLTURN / 4}; // + slow turn
|
|
||||||
|
|
||||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
{
|
{
|
||||||
const UINT8 forplayer = ssplayer-1;
|
const UINT8 forplayer = ssplayer-1;
|
||||||
|
|
@ -879,11 +877,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
const boolean gamepadjoystickmove = cv_usejoystick[forplayer].value && Joystick[forplayer].bGamepadStyle;
|
const boolean gamepadjoystickmove = cv_usejoystick[forplayer].value && Joystick[forplayer].bGamepadStyle;
|
||||||
const boolean usejoystick = (analogjoystickmove || gamepadjoystickmove);
|
const boolean usejoystick = (analogjoystickmove || gamepadjoystickmove);
|
||||||
|
|
||||||
static INT32 turnheld[MAXSPLITSCREENPLAYERS]; // for accelerative turning
|
|
||||||
static boolean keyboard_look[MAXSPLITSCREENPLAYERS]; // true if lookup/down using keyboard
|
static boolean keyboard_look[MAXSPLITSCREENPLAYERS]; // true if lookup/down using keyboard
|
||||||
static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame
|
static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame
|
||||||
|
|
||||||
INT32 tspeed, forward, axis;
|
INT32 forward, axis;
|
||||||
|
|
||||||
joystickvector2_t joystickvector;
|
joystickvector2_t joystickvector;
|
||||||
|
|
||||||
|
|
@ -891,11 +888,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
|
|
||||||
player_t *player = &players[g_localplayers[forplayer]];
|
player_t *player = &players[g_localplayers[forplayer]];
|
||||||
camera_t *thiscam = &camera[forplayer];
|
camera_t *thiscam = &camera[forplayer];
|
||||||
INT32 *th = &turnheld[forplayer];
|
|
||||||
boolean *kbl = &keyboard_look[forplayer];
|
boolean *kbl = &keyboard_look[forplayer];
|
||||||
boolean *rd = &resetdown[forplayer];
|
boolean *rd = &resetdown[forplayer];
|
||||||
const boolean mouseaiming = player->spectator;
|
const boolean mouseaiming = player->spectator;
|
||||||
|
|
||||||
|
(void)realtics;
|
||||||
|
|
||||||
if (demo.playback) return;
|
if (demo.playback) return;
|
||||||
|
|
||||||
// Is there any reason this can't just be I_BaseTiccmd?
|
// Is there any reason this can't just be I_BaseTiccmd?
|
||||||
|
|
@ -958,39 +956,27 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
}
|
}
|
||||||
forward = 0;
|
forward = 0;
|
||||||
|
|
||||||
// use two stage accelerative turning
|
|
||||||
// on the keyboard and joystick
|
|
||||||
if (turnleft || turnright)
|
|
||||||
*th += realtics;
|
|
||||||
else
|
|
||||||
*th = 0;
|
|
||||||
|
|
||||||
if (*th < SLOWTURNTICS)
|
|
||||||
tspeed = 1; // slow turn
|
|
||||||
else
|
|
||||||
tspeed = 0;
|
|
||||||
|
|
||||||
cmd->turning = 0;
|
cmd->turning = 0;
|
||||||
|
|
||||||
// let movement keys cancel each other out
|
// let movement keys cancel each other out
|
||||||
if (turnright && !(turnleft))
|
if (turnright && !(turnleft))
|
||||||
{
|
{
|
||||||
cmd->turning = (INT16)(cmd->turning - (angleturn[tspeed]));
|
cmd->turning -= KART_FULLTURN;
|
||||||
}
|
}
|
||||||
else if (turnleft && !(turnright))
|
else if (turnleft && !(turnright))
|
||||||
{
|
{
|
||||||
cmd->turning = (INT16)(cmd->turning + (angleturn[tspeed]));
|
cmd->turning += KART_FULLTURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (analogjoystickmove && joystickvector.xaxis != 0)
|
if (analogjoystickmove && joystickvector.xaxis != 0)
|
||||||
{
|
{
|
||||||
cmd->turning = (INT16)(cmd->turning - (((joystickvector.xaxis * angleturn[0]) >> 10)));
|
cmd->turning -= (joystickvector.xaxis * KART_FULLTURN) >> 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specator mouse turning
|
// Specator mouse turning
|
||||||
if (player->spectator)
|
if (player->spectator)
|
||||||
{
|
{
|
||||||
cmd->turning = (INT16)(cmd->turning - ((mousex*(encoremode ? -1 : 1)*8)));
|
cmd->turning -= (mousex * 8) * (encoremode ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
|
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
|
||||||
|
|
@ -1125,7 +1111,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
|
|
||||||
cmd->forwardmove += (SINT8)forward;
|
cmd->forwardmove += (SINT8)forward;
|
||||||
|
|
||||||
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
|
cmd->latency = (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
|
||||||
cmd->flags = 0;
|
cmd->flags = 0;
|
||||||
|
|
||||||
if (chat_on || CON_Ready())
|
if (chat_on || CON_Ready())
|
||||||
|
|
@ -1156,10 +1142,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
else if (cmd->forwardmove < -MAXPLMOVE)
|
else if (cmd->forwardmove < -MAXPLMOVE)
|
||||||
cmd->forwardmove = -MAXPLMOVE;
|
cmd->forwardmove = -MAXPLMOVE;
|
||||||
|
|
||||||
if (cmd->turning > (angleturn[0]))
|
if (cmd->turning > KART_FULLTURN)
|
||||||
cmd->turning = (angleturn[0]);
|
cmd->turning = KART_FULLTURN;
|
||||||
else if (cmd->turning < (-angleturn[0]))
|
else if (cmd->turning < -KART_FULLTURN)
|
||||||
cmd->turning = (-angleturn[0]);
|
cmd->turning = -KART_FULLTURN;
|
||||||
|
|
||||||
// Reset away view if a command is given.
|
// Reset away view if a command is given.
|
||||||
if ((cmd->forwardmove || cmd->buttons)
|
if ((cmd->forwardmove || cmd->buttons)
|
||||||
|
|
|
||||||
|
|
@ -6146,7 +6146,6 @@ static void M_PlaybackToggleFreecam(INT32 choice)
|
||||||
demo.freecam = false;
|
demo.freecam = false;
|
||||||
// reset democam vars:
|
// reset democam vars:
|
||||||
democam.cam = NULL;
|
democam.cam = NULL;
|
||||||
democam.turnheld = false;
|
|
||||||
democam.keyboardlook = false; // reset only these. localangle / aiming gets set before the cam does anything anyway
|
democam.keyboardlook = false; // reset only these. localangle / aiming gets set before the cam does anything anyway
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
src/p_user.c
31
src/p_user.c
|
|
@ -2771,9 +2771,7 @@ fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
|
||||||
|
|
||||||
// Heavily simplified version of G_BuildTicCmd that only takes the local first player's control input and converts it to readable ticcmd_t
|
// Heavily simplified version of G_BuildTicCmd that only takes the local first player's control input and converts it to readable ticcmd_t
|
||||||
// we then throw that ticcmd garbage in the camera and make it move
|
// we then throw that ticcmd garbage in the camera and make it move
|
||||||
|
// TODO: please just use the normal ticcmd function somehow
|
||||||
// redefine this
|
|
||||||
static fixed_t angleturn[2] = {KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
|
||||||
|
|
||||||
static ticcmd_t cameracmd;
|
static ticcmd_t cameracmd;
|
||||||
|
|
||||||
|
|
@ -2787,7 +2785,7 @@ void P_InitCameraCmd(void)
|
||||||
|
|
||||||
static ticcmd_t *P_CameraCmd(camera_t *cam)
|
static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
{
|
{
|
||||||
INT32 th, tspeed, forward, axis; //i
|
INT32 forward, axis; //i
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, mouseaiming;
|
boolean turnleft, turnright, mouseaiming;
|
||||||
boolean invertmouse, lookaxis, usejoystick, kbl;
|
boolean invertmouse, lookaxis, usejoystick, kbl;
|
||||||
|
|
@ -2800,7 +2798,6 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
if (!demo.playback)
|
if (!demo.playback)
|
||||||
return cmd; // empty cmd, no.
|
return cmd; // empty cmd, no.
|
||||||
|
|
||||||
th = democam.turnheld;
|
|
||||||
kbl = democam.keyboardlook;
|
kbl = democam.keyboardlook;
|
||||||
|
|
||||||
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
|
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
|
||||||
|
|
@ -2830,31 +2827,19 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
}
|
}
|
||||||
forward = 0;
|
forward = 0;
|
||||||
|
|
||||||
// use two stage accelerative turning
|
|
||||||
// on the keyboard and joystick
|
|
||||||
if (turnleft || turnright)
|
|
||||||
th += 1;
|
|
||||||
else
|
|
||||||
th = 0;
|
|
||||||
|
|
||||||
if (th < SLOWTURNTICS)
|
|
||||||
tspeed = 1; // slow turn
|
|
||||||
else
|
|
||||||
tspeed = 0;
|
|
||||||
|
|
||||||
cmd->turning = 0;
|
cmd->turning = 0;
|
||||||
|
|
||||||
// let movement keys cancel each other out
|
// let movement keys cancel each other out
|
||||||
if (turnright && !(turnleft))
|
if (turnright && !(turnleft))
|
||||||
{
|
{
|
||||||
cmd->turning = (INT16)(cmd->turning - (angleturn[tspeed]));
|
cmd->turning -= KART_FULLTURN;
|
||||||
}
|
}
|
||||||
else if (turnleft && !(turnright))
|
else if (turnleft && !(turnright))
|
||||||
{
|
{
|
||||||
cmd->turning = (INT16)(cmd->turning + (angleturn[tspeed]));
|
cmd->turning += KART_FULLTURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->turning = (INT16)(cmd->turning - ((mousex*(encoremode ? -1 : 1)*8)));
|
cmd->turning -= (mousex * 8) * (encoremode ? -1 : 1);
|
||||||
|
|
||||||
axis = PlayerJoyAxis(1, AXISMOVE);
|
axis = PlayerJoyAxis(1, AXISMOVE);
|
||||||
if (PlayerInputDown(1, gc_accelerate) || (usejoystick && axis > 0))
|
if (PlayerInputDown(1, gc_accelerate) || (usejoystick && axis > 0))
|
||||||
|
|
@ -2912,7 +2897,11 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
else if (cmd->forwardmove < -MAXPLMOVE)
|
else if (cmd->forwardmove < -MAXPLMOVE)
|
||||||
cmd->forwardmove = -MAXPLMOVE;
|
cmd->forwardmove = -MAXPLMOVE;
|
||||||
|
|
||||||
democam.turnheld = th;
|
if (cmd->turning > KART_FULLTURN)
|
||||||
|
cmd->turning = KART_FULLTURN;
|
||||||
|
else if (cmd->turning < -KART_FULLTURN)
|
||||||
|
cmd->turning = -KART_FULLTURN;
|
||||||
|
|
||||||
democam.keyboardlook = kbl;
|
democam.keyboardlook = kbl;
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue