Fix really weird crash I should've checked for

Make the returning of top kart speed slightly cleaner
This commit is contained in:
Sryder 2017-03-10 03:24:15 +00:00
parent c6814943ec
commit 1ac0f8c5a8
2 changed files with 9 additions and 4 deletions

View file

@ -1273,7 +1273,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
else if (cmd->angleturn < -angleturn[1]) else if (cmd->angleturn < -angleturn[1])
cmd->angleturn = -angleturn[1]; cmd->angleturn = -angleturn[1];
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn); if (player->mo)
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
// SRB2kart - no additional angle if not moving // SRB2kart - no additional angle if not moving
if ((player->mo && player->speed > 0) || (leveltime > 140 && (cmd->buttons & BT_ACCELERATE) && (cmd->buttons & BT_BRAKE))) if ((player->mo && player->speed > 0) || (leveltime > 140 && (cmd->buttons & BT_ACCELERATE) && (cmd->buttons & BT_BRAKE)))
@ -1617,7 +1618,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
else if (cmd->angleturn < -angleturn[1]) else if (cmd->angleturn < -angleturn[1])
cmd->angleturn = -angleturn[1]; cmd->angleturn = -angleturn[1];
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn); if (player->mo)
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
// SRB2kart - no additional angle if not moving // SRB2kart - no additional angle if not moving
if ((player->mo && player->speed > 0) || (leveltime > 140 && (cmd->buttons & BT_ACCELERATE) && (cmd->buttons & BT_BRAKE))) if ((player->mo && player->speed > 0) || (leveltime > 140 && (cmd->buttons & BT_ACCELERATE) && (cmd->buttons & BT_BRAKE)))

View file

@ -1077,6 +1077,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower)
fixed_t k_speed = 150; fixed_t k_speed = 150;
fixed_t g_cc = FRACUNIT; fixed_t g_cc = FRACUNIT;
fixed_t xspd = 3072; // 4.6875 aka 3/64 fixed_t xspd = 3072; // 4.6875 aka 3/64
fixed_t finalspeed;
switch (cv_kartcc.value) switch (cv_kartcc.value)
{ {
@ -1093,9 +1094,11 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower)
k_speed += player->kartspeed*3; // 153 - 177 k_speed += player->kartspeed*3; // 153 - 177
finalspeed = FixedMul(FixedMul(k_speed<<14, g_cc), player->mo->scale);
if (doboostpower) if (doboostpower)
return FixedMul(FixedMul(FixedMul(k_speed<<14, g_cc), K_GetKartBoostPower(player, true)), player->mo->scale); return FixedMul(finalspeed, K_GetKartBoostPower(player, true));
return FixedMul(FixedMul(k_speed<<14, g_cc), player->mo->scale); return finalspeed;
} }
static fixed_t K_GetKartAccel(player_t *player) static fixed_t K_GetKartAccel(player_t *player)