mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-16 09:42:57 +00:00
Clean up dash mode and make multiplayer-compatible
Actionspd is now the running speed in dashmode.
This commit is contained in:
parent
a15a4ace7e
commit
ba8c0dfc6e
1 changed files with 14 additions and 31 deletions
43
src/p_user.c
43
src/p_user.c
|
@ -8671,8 +8671,6 @@ void P_DoPityCheck(player_t *player)
|
||||||
//
|
//
|
||||||
|
|
||||||
boolean playerdeadview; // show match/chaos/tag/capture the flag rankings while in death view
|
boolean playerdeadview; // show match/chaos/tag/capture the flag rankings while in death view
|
||||||
INT32 dashmode = 0; // initial variable set for CA_DASHMODE
|
|
||||||
boolean dashmodeflag = false;
|
|
||||||
|
|
||||||
void P_PlayerThink(player_t *player)
|
void P_PlayerThink(player_t *player)
|
||||||
{
|
{
|
||||||
|
@ -9160,15 +9158,10 @@ void P_PlayerThink(player_t *player)
|
||||||
// Dash mode ability for Metal Sonic
|
// Dash mode ability for Metal Sonic
|
||||||
if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho.
|
if ((player->charability == CA_DASHMODE) && !(maptol & TOL_NIGHTS)) // woo, dashmode! no nights tho.
|
||||||
{
|
{
|
||||||
fixed_t defspeed = skins[player->skin].normalspeed; // Default normalspeed.
|
#define dashmode player->glidetime
|
||||||
fixed_t maxtop = skins[player->skin].normalspeed * 55/36;
|
fixed_t maxtop = skins[player->skin].normalspeed * 55/36;
|
||||||
|
|
||||||
if (!(player->speed > player->normalspeed)) //are we currently exceeding our normalspeed?
|
if (player->speed >= FixedMul(skins[player->skin].normalspeed - 5*FRACUNIT, player->mo->scale) || (player->pflags & PF_STARTDASH))
|
||||||
player->actionspd = player->normalspeed; //if not, force thok to normalspeed
|
|
||||||
else
|
|
||||||
player->actionspd = player->speed; //otherwise, thok at your current speed (this fixes super and speedshoes thok slowing you down)
|
|
||||||
|
|
||||||
if (player->speed >= (defspeed - 5*FRACUNIT) || (player->pflags & PF_STARTDASH))
|
|
||||||
{
|
{
|
||||||
dashmode++; // Counter. Adds 1 to dash mode per tic in top speed.
|
dashmode++; // Counter. Adds 1 to dash mode per tic in top speed.
|
||||||
if (dashmode == 3*TICRATE) // This isn't in the ">=" equation because it'd cause the sound to play infinitely.
|
if (dashmode == 3*TICRATE) // This isn't in the ">=" equation because it'd cause the sound to play infinitely.
|
||||||
|
@ -9176,42 +9169,32 @@ void P_PlayerThink(player_t *player)
|
||||||
}
|
}
|
||||||
else if (!(player->pflags & PF_SPINNING))
|
else if (!(player->pflags & PF_SPINNING))
|
||||||
{
|
{
|
||||||
if (dashmode > 0)
|
if (dashmode > 3)
|
||||||
dashmode = dashmode - 3; // Rather than lose it all, it gently counts back down!
|
dashmode = dashmode - 3; // Rather than lose it all, it gently counts back down!
|
||||||
else if (dashmode < 0)
|
else
|
||||||
dashmode = 0;
|
dashmode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dashmode >= 3*TICRATE && P_IsObjectOnGround(player->mo)) // Dash Mode can continue counting in the air, but will only activate on floor touch.
|
|
||||||
dashmodeflag = true;
|
|
||||||
|
|
||||||
if (dashmode < 3*TICRATE) // Exits Dash Mode if you drop below speed/dash counter tics. Not in the above block so it doesn't keep disabling in midair.
|
if (dashmode < 3*TICRATE) // 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 = defspeed; // Reset to default if not capable of entering dash mode.
|
player->normalspeed = skins[player->skin].normalspeed; // Reset to default if not capable of entering dash mode.
|
||||||
player->jumpfactor = 1*FRACUNIT;
|
player->jumpfactor = skins[player->skin].jumpfactor;
|
||||||
dashmodeflag = false;
|
|
||||||
}
|
}
|
||||||
|
else if (P_IsObjectOnGround(player->mo)) // Activate dash mode if we're on the ground.
|
||||||
//WHEN PARAMETERS ARE MET, REWARD THE DASH MODE EFFECTS
|
|
||||||
if (dashmodeflag)
|
|
||||||
{
|
{
|
||||||
if (player->normalspeed < maxtop) // If the player is not currently at 50 normalspeed in dash mode, add speed each tic
|
if (player->normalspeed < skins[player->skin].actionspd) // If the player normalspeed is not currently at actionspd in dash mode, add speed each tic
|
||||||
{
|
|
||||||
player->normalspeed = player->normalspeed + 1*FRACUNIT/5; // Enter Dash Mode smoothly.
|
player->normalspeed = player->normalspeed + 1*FRACUNIT/5; // Enter Dash Mode smoothly.
|
||||||
if (player->jumpfactor < 5*FRACUNIT/4)
|
|
||||||
player->jumpfactor = player->jumpfactor + 1*FRACUNIT/300; // Boosts his jumpheight. Remember fractions instead of decimals. "1.5*FRACUNIT = 3*FRACUNIT/2"
|
if (player->jumpfactor < FixedMul(skins[player->skin].jumpfactor, 5*FRACUNIT/4)) // Boost jump height.
|
||||||
}
|
player->jumpfactor = player->jumpfactor + 1*FRACUNIT/300;
|
||||||
}
|
}
|
||||||
|
|
||||||
//COSMETIC STUPIDITY!
|
if (player->normalspeed >= skins[player->skin].actionspd)
|
||||||
if (dashmode > 108) //Dash Mode will go down a tic a bit above activation, this makes dust spawn every other tic.
|
|
||||||
dashmode = 107;
|
|
||||||
|
|
||||||
if (player->normalspeed >= maxtop)
|
|
||||||
{
|
{
|
||||||
mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages
|
mobj_t *ghost = P_SpawnGhostMobj(player->mo); // Spawns afterimages
|
||||||
ghost->fuse = 2; // Makes the images fade quickly
|
ghost->fuse = 2; // Makes the images fade quickly
|
||||||
}
|
}
|
||||||
|
#undef dashmode
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue