Permit a lightsnaking player to go into RESPAWNST_DROP (the final second of lightsnake) early at any time after the initail bring-back-to-last-waypoint.

Needs balance testing, but resolves #299.
This commit is contained in:
toaster 2023-01-06 13:16:11 +00:00
parent c068013022
commit 1213836564
4 changed files with 40 additions and 9 deletions

View file

@ -308,6 +308,7 @@ struct respawnvars_t
tic_t dropdash; // Drop Dash charge timer
boolean truedeath; // Your soul has left your body
boolean manual; // Respawn coords were manually set, please respawn exactly there
boolean init;
};
// player_t struct for all bot variables

View file

@ -9406,17 +9406,28 @@ static INT32 K_FlameShieldMax(player_t *player)
boolean K_PlayerEBrake(player_t *player)
{
if (player->respawn.state != RESPAWNST_NONE
&& player->respawn.init == true)
{
return false;
}
if (player->fastfall != 0)
{
return true;
}
return (K_GetKartButtons(player) & BT_EBRAKEMASK) == BT_EBRAKEMASK
if ((K_GetKartButtons(player) & BT_EBRAKEMASK) == BT_EBRAKEMASK
&& player->drift == 0
&& P_PlayerInPain(player) == false
&& player->justbumped == 0
&& player->spindashboost == 0
&& player->nocontrol == 0;
&& player->nocontrol == 0)
{
return true;
}
return false;
}
SINT8 K_Sliptiding(player_t *player)
@ -9444,10 +9455,13 @@ void K_KartEbrakeVisuals(player_t *p)
{
wave = P_SpawnMobj(p->mo->x, p->mo->y, p->mo->z, MT_SOFTLANDING);
P_SetScale(wave, p->mo->scale);
wave->momx = p->mo->momx;
wave->momy = p->mo->momy;
wave->momz = p->mo->momz;
wave->standingslope = p->mo->standingslope;
if (p->respawn.state == RESPAWNST_NONE)
{
wave->momx = p->mo->momx;
wave->momy = p->mo->momy;
wave->momz = p->mo->momz;
wave->standingslope = p->mo->standingslope;
}
K_ReduceVFX(wave, p);
}
@ -9688,7 +9702,12 @@ static void K_KartSpindash(player_t *player)
}
// Handle fast falling behaviors first.
if (onGround == false)
if (player->respawn.state != RESPAWNST_NONE)
{
// This is handled in K_MovePlayerToRespawnPoint.
return;
}
else if (onGround == false)
{
// Update fastfall.
player->fastfall = player->mo->momz;

View file

@ -269,6 +269,7 @@ void K_DoIngameRespawn(player_t *player)
player->respawn.timer = RESPAWN_TIME;
player->respawn.state = RESPAWNST_MOVE;
player->respawn.init = true;
player->respawn.airtimer = player->airtime;
player->respawn.truedeath = false;
@ -337,7 +338,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->momx = player->mo->momy = player->mo->momz = 0;
player->flashing = 2;
player->nocontrol = max(2, player->nocontrol);
//player->nocontrol = max(2, player->nocontrol);
if (leveltime % 8 == 0 && !mapreset)
{
@ -366,6 +367,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->z = dest.z;
P_SetThingPosition(player->mo);
// At the first valid waypoint, permit extra player control options.
player->respawn.init = false;
// Find the next waypoint to head towards
if (player->respawn.wp != NULL)
{
@ -446,6 +450,13 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->momz = step.z;
}
if (player->respawn.init == false && K_PlayerEBrake(player) == true)
{
// Manual drop!
player->respawn.state = RESPAWNST_DROP;
return;
}
// NOW THEN, time for loads of dumb duplication!
// "Emulate" the rest of the path, that way we can spawn a particle a certain distance ahead of you.

View file

@ -2219,7 +2219,7 @@ void P_MovePlayer(player_t *player)
runspd = FixedMul(runspd, player->mo->movefactor);
// Control relinquishing stuff!
if (player->nocontrol)
if (player->nocontrol || player->respawn.state == RESPAWNST_MOVE)
player->pflags |= PF_STASIS;
// note: don't unset stasis here