Dashmode fixes:

- Don't force the player's default normalspeed and jumpfactor while not in dashmode
- Properly trim the fuse for followmobj ghosts spawned during dashmode
- Add deliberate dashmode ghosts for Metal's jet fume
This commit is contained in:
lachwright 2020-05-01 08:26:23 +08:00
parent 279ad0707e
commit 165b6c2435
3 changed files with 30 additions and 2 deletions

View file

@ -2377,6 +2377,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
fixed_t height;
fixed_t spinheight;
INT32 exiting;
tic_t dashmode;
INT16 numboxes;
INT16 totalring;
UINT8 laps;
@ -2411,6 +2412,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
if (!(netgame || multiplayer))
pflags |= (players[player].pflags & (PF_GODMODE|PF_NOCLIP|PF_INVIS));
dashmode = players[player].dashmode;
numboxes = players[player].numboxes;
laps = players[player].laps;
totalring = players[player].totalring;
@ -2509,6 +2512,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
p->spinheight = spinheight;
p->exiting = exiting;
p->dashmode = dashmode;
p->numboxes = numboxes;
p->laps = laps;
p->totalring = totalring;

View file

@ -11393,6 +11393,14 @@ void P_SpawnPlayer(INT32 playernum)
p->realtime = leveltime;
p->followitem = skins[p->skin].followitem;
// Make sure player's stats are reset if they were in dashmode!
if (p->dashmode)
{
p->dashmode = 0;
p->normalspeed = skins[p->skin].normalspeed;
p->jumpfactor = skins[p->skin].jumpfactor;
}
//awayview stuff
p->awayviewmobj = NULL;
p->awayviewtics = 0;

View file

@ -11485,6 +11485,13 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
fume->y = mo->y + P_ReturnThrustY(fume, angle, dist);
fume->z = mo->z + ((mo->height - fume->height) >> 1);
P_SetThingPosition(fume);
// If dashmode is high enough, spawn a trail
if (!(fume->flags2 & MF2_DONTDRAW) && player->normalspeed >= skins[player->skin].normalspeed*2)
{
mobj_t *ghost = P_SpawnGhostMobj(fume);
ghost->tics = 4;
}
}
//
@ -12279,6 +12286,7 @@ void P_PlayerThink(player_t *player)
// Dash mode - thanks be to VelocitOni
if ((player->charflags & SF_DASHMODE) && !player->gotflag && !player->powers[pw_carry] && !player->exiting && !(maptol & TOL_NIGHTS) && !metalrecording) // woo, dashmode! no nights tho.
{
tic_t prevdashmode = dashmode;
boolean totallyradical = player->speed >= FixedMul(player->runspeed, player->mo->scale);
boolean floating = (player->secondjump == 1);
@ -12303,8 +12311,11 @@ void P_PlayerThink(player_t *player)
if (dashmode < DASHMODE_THRESHOLD) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair.
{
player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode.
player->jumpfactor = skins[player->skin].jumpfactor;
if (prevdashmode >= DASHMODE_THRESHOLD)
{
player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode.
player->jumpfactor = skins[player->skin].jumpfactor;
}
}
else if (P_IsObjectOnGround(player->mo)) // Activate dash mode if we're on the ground.
{
@ -12319,6 +12330,10 @@ void P_PlayerThink(player_t *player)
{
mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages
ghost->fuse = 2; // Makes the images fade quickly
if (ghost->tracer)
{
ghost->tracer->fuse = ghost->fuse;
}
}
}
else if (dashmode)