Merge branch 'offroad-stuff' into 'next'

Offroad & wipeout stuff (AKA: piss off salty Metal mains even more)

See merge request KartKrew/Kart-Public!40
This commit is contained in:
Sal 2019-01-29 23:17:00 -05:00
commit 1c5e0a3714
7 changed files with 38 additions and 43 deletions

View file

@ -214,7 +214,7 @@ static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NU
static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}}; static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}};
static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}}; static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}};
static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}};
static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"}, static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"},
{3, "None"}, {0, NULL}}; {3, "None"}, {0, NULL}};
@ -447,7 +447,7 @@ consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL
consvar_t cv_pause = {"pausepermission", "Server", CV_NETVAR, pause_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_pause = {"pausepermission", "Server", CV_NETVAR, pause_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sleep = {"cpusleep", "-1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL}; consvar_t cv_sleep = {"cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL};
INT16 gametype = GT_RACE; // SRB2kart INT16 gametype = GT_RACE; // SRB2kart
boolean forceresetplayers = false; boolean forceresetplayers = false;

View file

@ -1211,8 +1211,8 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
mobj1->player->kartstuff[k_justbumped] = bumptime; mobj1->player->kartstuff[k_justbumped] = bumptime;
if (mobj1->player->kartstuff[k_spinouttimer]) if (mobj1->player->kartstuff[k_spinouttimer])
{ {
mobj1->player->kartstuff[k_wipeoutslow] += wipeoutslowtime+1; mobj1->player->kartstuff[k_wipeoutslow] = wipeoutslowtime+1;
mobj1->player->kartstuff[k_spinouttimer] += wipeoutslowtime+1; mobj1->player->kartstuff[k_spinouttimer] = max(wipeoutslowtime+1, mobj1->player->kartstuff[k_spinouttimer]);
} }
} }
@ -1223,8 +1223,8 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
mobj2->player->kartstuff[k_justbumped] = bumptime; mobj2->player->kartstuff[k_justbumped] = bumptime;
if (mobj2->player->kartstuff[k_spinouttimer]) if (mobj2->player->kartstuff[k_spinouttimer])
{ {
mobj2->player->kartstuff[k_wipeoutslow] += wipeoutslowtime+1; mobj2->player->kartstuff[k_wipeoutslow] = wipeoutslowtime+1;
mobj2->player->kartstuff[k_spinouttimer] += wipeoutslowtime+1; mobj2->player->kartstuff[k_spinouttimer] = max(wipeoutslowtime+1, mobj2->player->kartstuff[k_spinouttimer]);
} }
} }
} }
@ -1264,7 +1264,6 @@ static UINT8 K_CheckOffroadCollide(mobj_t *mo, sector_t *sec)
*/ */
static void K_UpdateOffroad(player_t *player) static void K_UpdateOffroad(player_t *player)
{ {
fixed_t kartweight = player->kartweight;
fixed_t offroad; fixed_t offroad;
sector_t *nextsector = R_PointInSubsector( sector_t *nextsector = R_PointInSubsector(
player->mo->x + player->mo->momx*2, player->mo->y + player->mo->momy*2)->sector; player->mo->x + player->mo->momx*2, player->mo->y + player->mo->momy*2)->sector;
@ -1284,13 +1283,11 @@ static void K_UpdateOffroad(player_t *player)
if (offroadstrength) if (offroadstrength)
{ {
if (K_CheckOffroadCollide(player->mo, player->mo->subsector->sector) && player->kartstuff[k_offroad] == 0) if (K_CheckOffroadCollide(player->mo, player->mo->subsector->sector) && player->kartstuff[k_offroad] == 0)
player->kartstuff[k_offroad] = 16; player->kartstuff[k_offroad] = (TICRATE/2);
if (player->kartstuff[k_offroad] > 0) if (player->kartstuff[k_offroad] > 0)
{ {
// 1872 is the magic number - 35 frames adds up to approximately 65536. 1872/4 = 468/3 = 156 offroad = (FRACUNIT * offroadstrength) / (TICRATE/2);
// A higher kart weight means you can stay offroad for longer without losing speed
offroad = (1872 + 5*156 - kartweight*156)*offroadstrength;
//if (player->kartstuff[k_growshrinktimer] > 1) // grow slows down half as fast //if (player->kartstuff[k_growshrinktimer] > 1) // grow slows down half as fast
// offroad /= 2; // offroad /= 2;
@ -4670,8 +4667,6 @@ static void K_KartDrift(player_t *player, boolean onground)
player->kartstuff[k_driftend] = 0; player->kartstuff[k_driftend] = 0;
} }
// Incease/decrease the drift value to continue drifting in that direction // Incease/decrease the drift value to continue drifting in that direction
if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0) if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0)
{ {
@ -4703,7 +4698,7 @@ static void K_KartDrift(player_t *player, boolean onground)
// Disable drift-sparks until you're going fast enough // Disable drift-sparks until you're going fast enough
if (player->kartstuff[k_getsparks] == 0) if (player->kartstuff[k_getsparks] == 0)
driftadditive = 0; driftadditive = 0;
if (player->speed > minspeed*2) if (player->speed > minspeed*2 && !player->kartstuff[k_offroad])
player->kartstuff[k_getsparks] = 1; player->kartstuff[k_getsparks] = 1;
// This spawns the drift sparks // This spawns the drift sparks
@ -5428,10 +5423,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
} }
// Friction // Friction
if (!player->kartstuff[k_offroad])
{
if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392) if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392)
player->mo->friction += 4608; player->mo->friction += 4608;
if (player->speed > 0 && cmd->forwardmove < 0 && player->mo->friction == 59392) if (player->speed > 0 && cmd->forwardmove < 0 && player->mo->friction == 59392)
player->mo->friction += 1608; player->mo->friction += 1608;
}
// Karma ice physics
if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0)
{ {
player->mo->friction += 1228; player->mo->friction += 1228;
@ -5451,11 +5451,14 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->mo->movefactor < 32) if (player->mo->movefactor < 32)
player->mo->movefactor = 32; player->mo->movefactor = 32;
} }
// Wipeout slowdown
if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow]) if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow])
{ {
player->mo->friction -= FixedMul(1228, player->kartstuff[k_offroad]); if (player->kartstuff[k_offroad])
if (player->kartstuff[k_wipeoutslow] == 1)
player->mo->friction -= 4912; player->mo->friction -= 4912;
if (player->kartstuff[k_wipeoutslow] == 1)
player->mo->friction -= 9824;
} }
K_KartDrift(player, onground); K_KartDrift(player, onground);
@ -7108,16 +7111,12 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
&& tab[i].num != serverplayer) && tab[i].num != serverplayer)
HU_drawPing(x + ((i < 8) ? -19 : rightoffset + 13), y+2, playerpingtable[tab[i].num], false); HU_drawPing(x + ((i < 8) ? -19 : rightoffset + 13), y+2, playerpingtable[tab[i].num], false);
if (scorelines > 8)
strlcpy(strtime, tab[i].name, 6);
else
STRBUFCPY(strtime, tab[i].name); STRBUFCPY(strtime, tab[i].name);
V_DrawString(x + 20, y, if (scorelines > 8)
((tab[i].num == whiteplayer) V_DrawThinString(x + 20, y, ((tab[i].num == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime);
? hilicol|V_ALLOWLOWERCASE else
: V_ALLOWLOWERCASE), V_DrawString(x + 20, y, ((tab[i].num == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime);
strtime);
if (players[tab[i].num].mo->color) if (players[tab[i].num].mo->color)
{ {

View file

@ -3018,7 +3018,7 @@ void I_StartupTimer(void)
void I_Sleep(void) void I_Sleep(void)
{ {
if (cv_sleep.value != -1) if (cv_sleep.value > 0)
SDL_Delay(cv_sleep.value); SDL_Delay(cv_sleep.value);
} }

View file

@ -2914,7 +2914,7 @@ void I_StartupTimer(void)
void I_Sleep(void) void I_Sleep(void)
{ {
#if !(defined (_arch_dreamcast) || defined (_XBOX)) #if !(defined (_arch_dreamcast) || defined (_XBOX))
if (cv_sleep.value != -1) if (cv_sleep.value > 0)
SDL_Delay(cv_sleep.value); SDL_Delay(cv_sleep.value);
#endif #endif
} }

View file

@ -261,7 +261,7 @@ tic_t I_GetTime(void)
void I_Sleep(void) void I_Sleep(void)
{ {
if (cv_sleep.value != -1) if (cv_sleep.value > 0)
Sleep(cv_sleep.value); Sleep(cv_sleep.value);
} }

View file

@ -265,7 +265,7 @@ tic_t I_GetTime(void)
void I_Sleep(void) void I_Sleep(void)
{ {
if (cv_sleep.value != -1) if (cv_sleep.value > 0)
Sleep(cv_sleep.value); Sleep(cv_sleep.value);
} }

View file

@ -474,16 +474,12 @@ void Y_IntermissionDrawer(void)
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE)); V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_CACHE));
} }
if (!gutter)
strlcpy(strtime, data.match.name[i], 6);
else
STRBUFCPY(strtime, data.match.name[i]); STRBUFCPY(strtime, data.match.name[i]);
V_DrawString(x+36, y, if (!gutter)
((data.match.num[i] == whiteplayer) V_DrawThinString(x+36, y, ((data.match.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, strtime);
? hilicol|V_ALLOWLOWERCASE else
: V_ALLOWLOWERCASE), V_DrawString(x+36, y, ((data.match.num[i] == whiteplayer) ? hilicol : 0)|V_ALLOWLOWERCASE, strtime);
strtime);
if (data.match.rankingsmode) if (data.match.rankingsmode)
{ {