Remove start boosts, let you roam, kill you for crossing the line before the start

This commit is contained in:
Sally Coolatta 2020-07-24 02:59:47 -04:00
parent e6cc99c8c8
commit fc89f2cc47
6 changed files with 55 additions and 112 deletions

View file

@ -1588,12 +1588,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->angleturn *= realtics;
// SRB2kart - no additional angle if not moving
if ((player->mo && player->speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|| (player->respawn.state != RESPAWNST_NONE) // Respawning
|| (player->spectator || objectplacing)) // Not a physical player
lang += (cmd->angleturn<<16);
lang += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(lang >> 16);
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
@ -5176,14 +5171,7 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
G_CopyTiccmd(cmd, &oldcmd[playernum], 1);
// SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam
if (((players[displayplayers[0]].mo && players[displayplayers[0]].speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|| (players[displayplayers[0]].respawn.state != RESPAWNST_NONE) // Respawning
|| (players[displayplayers[0]].spectator || objectplacing)) // Not a physical player
&& !(players[displayplayers[0]].kartstuff[k_spinouttimer]
&& players[displayplayers[0]].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout
localangle[0] += (cmd->angleturn<<16);
localangle[0] += (cmd->angleturn<<16);
if (!(demoflags & DF_GHOST) && *demo_p == DEMOMARKER)
{

View file

@ -700,11 +700,13 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
{
tic_t boosthold = starttime - TICRATE;
cmd->buttons |= BT_ACCELERATE|BT_BRAKE;
boosthold -= (MAXBOTDIFFICULTY - player->botvars.difficulty);
if (leveltime >= boosthold)
{
cmd->buttons |= BT_ACCELERATE;
cmd->buttons |= BT_DRIFT;
}
return;

View file

@ -27,6 +27,7 @@
#include "f_finale.h"
#include "lua_hud.h" // For Lua hud checks
#include "lua_hook.h" // For MobjDamage and ShouldDamage
#include "m_cheat.h" // objectplacing
#include "k_waypoint.h"
#include "k_bot.h"
@ -5145,8 +5146,10 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
#endif
return;
if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->respawn.state == RESPAWNST_DROP)) // Startup boosts
if (player->respawn.state == RESPAWNST_DROP) // Dropdashing
targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0);
else if (K_PlayerEBrake(player)) // Spindashing
targetsnd = ((cmd->buttons & BT_DRIFT) ? 12 : 0);
else
targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapobjectscale)/5))/2;
@ -5733,8 +5736,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_spindashboost] <= 0)
{
player->kartstuff[k_spindashspeed] = FRACUNIT;
player->kartstuff[k_spindashboost] = 0;
player->kartstuff[k_spindashspeed] = player->kartstuff[k_spindashboost] = 0;
}
}
@ -6385,15 +6387,37 @@ static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
{
fixed_t p_maxspeed = K_GetKartSpeed(player, false);
fixed_t p_speed = min(player->speed, (p_maxspeed * 2));
fixed_t weightadjust = FixedDiv((p_maxspeed * 3) - p_speed, (p_maxspeed * 3) + (player->kartweight * FRACUNIT));
fixed_t p_maxspeed;
fixed_t p_speed;
fixed_t weightadjust;
if (player->spectator)
if ((player->mo == NULL || P_MobjWasRemoved(player->mo)))
{
return 0;
}
if (player->spectator || objectplacing)
{
return turnvalue;
}
if (leveltime < introtime)
{
return 0;
}
// SRB2kart - no additional angle if not moving
if ((player->speed <= 0) // Not moving
&& ((player->cmd.buttons & BT_EBRAKEMASK) != BT_EBRAKEMASK) // not e-braking
&& (player->respawn.state == RESPAWNST_NONE)) // Not respawning
{
return 0;
}
p_maxspeed = K_GetKartSpeed(player, false);
p_speed = min(player->speed, (p_maxspeed * 2));
weightadjust = FixedDiv((p_maxspeed * 3) - p_speed, (p_maxspeed * 3) + (player->kartweight * FRACUNIT));
if (K_PlayerUsesBotMovement(player))
{
turnvalue = 5*turnvalue/4; // Base increase to turning
@ -6864,8 +6888,7 @@ boolean K_PlayerEBrake(player_t *player)
&& !player->kartstuff[k_boostcharge]
&& !(player->kartstuff[k_spindash] < 0)
&& !player->kartstuff[k_spindashboost]
&& !player->powers[pw_nocontrol]
&& leveltime > starttime;
&& !player->powers[pw_nocontrol];
}
static void K_KartSpindash(player_t *player)
@ -6990,7 +7013,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
else if (cmd->buttons & BT_ATTACK)
player->pflags |= PF_ATTACKDOWN;
if (player && player->mo && player->mo->health > 0 && !player->spectator && !mapreset && leveltime > starttime
if (player && player->mo && player->mo->health > 0 && !player->spectator && !mapreset && leveltime > introtime
&& player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0 && (player->respawn.state == RESPAWNST_NONE))
{
// First, the really specific, finicky items that function without the item being directly in your item slot.
@ -7711,76 +7734,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
S_StopMusic(); // The GO! sound stops the level start ambience
}
}
// Start charging once you're given the opportunity.
if (leveltime >= starttime-(2*TICRATE) && leveltime <= starttime)
{
if (cmd->buttons & BT_ACCELERATE)
{
if (player->kartstuff[k_boostcharge] == 0)
player->kartstuff[k_boostcharge] = cmd->latency;
player->kartstuff[k_boostcharge]++;
}
else
player->kartstuff[k_boostcharge] = 0;
}
// Increase your size while charging your engine.
if (leveltime < starttime+10)
{
player->mo->scalespeed = mapobjectscale/12;
player->mo->destscale = mapobjectscale + (player->kartstuff[k_boostcharge]*131);
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
player->mo->destscale = (6*player->mo->destscale)/8;
}
// Determine the outcome of your charge.
if (leveltime > starttime && player->kartstuff[k_boostcharge])
{
// Not even trying?
if (player->kartstuff[k_boostcharge] < 35)
{
if (player->kartstuff[k_boostcharge] > 17)
S_StartSound(player->mo, sfx_cdfm00); // chosen instead of a conventional skid because it's more engine-like
}
// Get an instant boost!
else if (player->kartstuff[k_boostcharge] <= 50)
{
player->kartstuff[k_startboost] = (50-player->kartstuff[k_boostcharge])+20;
if (player->kartstuff[k_boostcharge] <= 36)
{
player->kartstuff[k_startboost] = 0;
K_DoSneaker(player, 0);
player->kartstuff[k_sneakertimer] = 70; // PERFECT BOOST!!
if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) // Let everyone hear this one
S_StartSound(player->mo, sfx_s25f);
}
else
{
K_SpawnDashDustRelease(player); // already handled for perfect boosts by K_DoSneaker
if ((!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) && P_IsDisplayPlayer(player))
{
if (player->kartstuff[k_boostcharge] <= 40)
S_StartSound(player->mo, sfx_cdfm01); // You were almost there!
else
S_StartSound(player->mo, sfx_s23c); // Nope, better luck next time.
}
}
}
// You overcharged your engine? Those things are expensive!!!
else if (player->kartstuff[k_boostcharge] > 50)
{
player->powers[pw_nocontrol] = 40;
//S_StartSound(player->mo, sfx_kc34);
S_StartSound(player->mo, sfx_s3k83);
player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse
}
player->kartstuff[k_boostcharge] = 0;
}
}
void K_CheckSpectateStatus(void)

View file

@ -808,10 +808,10 @@ void A_Look(mobj_t *actor)
return;
#endif
if (!P_LookForPlayers(actor, locvar1 & 65535, false , FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)))
if (leveltime < starttime) // SRB2kart - no looking before race starts
return;
if (leveltime < starttime) // SRB2kart - no looking before race starts
if (!P_LookForPlayers(actor, locvar1 & 65535, false , FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)))
return;
// go into chase state

View file

@ -2184,6 +2184,14 @@ static void K_HandleLapIncrement(player_t *player)
{
S_StartSound(player->mo, sfx_s26d);
}
if (leveltime < starttime)
{
// LATER: replace with the rotatey knockback whenever we get around to it
player->powers[pw_nocontrol] = (starttime - leveltime) + 50;
player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse
S_StartSound(player->mo, sfx_s3k83);
}
}
}

View file

@ -5784,18 +5784,10 @@ static void P_MovePlayer(player_t *player)
boolean add_delta = true;
// Kart: store the current turn range for later use
if ((player->mo && player->speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_EBRAKEMASK) == BT_EBRAKEMASK) // Rubber-burn turn
|| (player->respawn.state != RESPAWNST_NONE) // Respawning
|| (player->spectator || objectplacing)) // Not a physical player
{
player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1;
player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1;
} else {
player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0;
}
player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1;
player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1;
if (leveltime >= starttime)
if (leveltime >= introtime)
{
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
@ -7727,7 +7719,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
if (timeover)
angle = mo->angle + FixedAngle(camrotate*FRACUNIT);
else if (leveltime < starttime)
else if (leveltime < introtime)
angle = focusangle + FixedAngle(camrotate*FRACUNIT);
else if (camstill || resetcalled || player->playerstate == PST_DEAD)
angle = thiscam->angle;
@ -7750,7 +7742,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
}
if (!resetcalled && (leveltime > starttime && timeover != 2)
if (!resetcalled && (leveltime >= introtime && timeover != 2)
&& ((thiscam == &camera[0] && t_cam_rotate != -42)
|| (thiscam == &camera[1] && t_cam2_rotate != -42)
|| (thiscam == &camera[2] && t_cam3_rotate != -42)
@ -8067,7 +8059,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
else if (player->exiting || timeover == 2)
thiscam->momx = thiscam->momy = thiscam->momz = 0;
else if (leveltime < starttime)
else if (leveltime < introtime)
{
thiscam->momx = FixedMul(x - thiscam->x, camspeed);
thiscam->momy = FixedMul(y - thiscam->y, camspeed);
@ -8871,7 +8863,7 @@ void P_PlayerThink(player_t *player)
}
// SRB2kart 010217
if (leveltime < starttime)
if (leveltime < introtime)
{
player->powers[pw_nocontrol] = 2;
}