Implement Outrun terrain type with a twist!
Since I want to keep the v1 style speed cap, I am going to use a timer set alongside the outrun to enable/disable the ground speed cap so the speed boost doesn\'t get neuterd hard
This commit is contained in:
parent
1182b037b7
commit
443737fc9d
6 changed files with 57 additions and 18 deletions
|
|
@ -548,6 +548,9 @@ typedef struct player_s
|
|||
UINT8 typing_duration; // How long since resumed timer
|
||||
|
||||
UINT8 kickstartaccel;
|
||||
|
||||
fixed_t outrun; // Milky Way road effect
|
||||
UINT8 outruntime; // Used to bypass the speed cap for fall off
|
||||
|
||||
#ifdef HWRENDER
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
|
|
|
|||
10
src/k_kart.c
10
src/k_kart.c
|
|
@ -2933,6 +2933,13 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower, boolean dorubberb
|
|||
if (doboostpower)
|
||||
finalspeed = FixedMul(finalspeed, player->boostpower+player->speedboost);
|
||||
|
||||
if (player->outrun != 0)
|
||||
{
|
||||
// Milky Way's roads
|
||||
finalspeed += FixedMul(player->outrun, player->mo->scale);
|
||||
}
|
||||
|
||||
|
||||
return finalspeed;
|
||||
}
|
||||
|
||||
|
|
@ -6770,6 +6777,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
if (player->justbumped > 0)
|
||||
player->justbumped--;
|
||||
|
||||
if (player->outruntime > 0)
|
||||
player->outruntime--;
|
||||
|
||||
K_UpdateTripwire(player);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "deh_soc.h" // get_mobjtype
|
||||
#include "doomdata.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "doomtype.h"
|
||||
#include "fastcmp.h"
|
||||
#include "m_fixed.h"
|
||||
|
|
@ -493,6 +494,16 @@ void K_ProcessTerrainEffect(mobj_t *mo)
|
|||
// maybe can support regualar mobjs later? :)
|
||||
return;
|
||||
}
|
||||
|
||||
// Milky Way road effect
|
||||
player->outrun = terrain->outrun;
|
||||
|
||||
if (terrain->outrun)
|
||||
{
|
||||
// This is a hack to make speedloss after outrun feel more natural
|
||||
CONS_Printf("Adding outruntime!\n");
|
||||
player->outruntime = sneakertime;
|
||||
}
|
||||
|
||||
// Damage effects
|
||||
if (terrain->damageType > 0)
|
||||
|
|
@ -1591,10 +1602,6 @@ static void K_ParseTerrainParameter(size_t i, char *param, char *val)
|
|||
{
|
||||
terrain->pogoSpring = FLOAT_TO_FIXED(atof(val));
|
||||
}
|
||||
else if (stricmp(param, "floorClip") == 0)
|
||||
{
|
||||
terrain->floorClip = FLOAT_TO_FIXED(atof(val));
|
||||
}
|
||||
else if (stricmp(param, "speedPad") == 0)
|
||||
{
|
||||
terrain->speedPad = FLOAT_TO_FIXED(atof(val));
|
||||
|
|
@ -1620,6 +1627,10 @@ static void K_ParseTerrainParameter(size_t i, char *param, char *val)
|
|||
FLOAT_TO_FIXED(15.625 * pow(1.6, fval));
|
||||
}
|
||||
}
|
||||
else if (stricmp(param, "outrun") == 0 || stricmp(param, "speedIncrease") == 0)
|
||||
{
|
||||
terrain->outrun = FLOAT_TO_FIXED(atof(val));
|
||||
}
|
||||
else if (stricmp(param, "floorClip") == 0)
|
||||
{
|
||||
terrain->floorClip = FLOAT_TO_FIXED(atof(val));
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ typedef struct terrain_s
|
|||
fixed_t speedPad; // Speed pad strength
|
||||
angle_t speedPadAngle; // Speed pad angle
|
||||
fixed_t springStrength; // Spring strength
|
||||
fixed_t outrun; // Raise top speed by this amount, for super fast road.
|
||||
fixed_t floorClip; // Offset for sprites on this ground
|
||||
UINT32 flags; // Flag values (see: terrain_flags_t)
|
||||
} terrain_t;
|
||||
|
|
|
|||
|
|
@ -368,6 +368,9 @@ static void P_NetArchivePlayers(void)
|
|||
WRITEUINT32(save_p, players[i].botvars.itemdelay);
|
||||
WRITEUINT32(save_p, players[i].botvars.itemconfirm);
|
||||
WRITESINT8(save_p, players[i].botvars.turnconfirm);
|
||||
|
||||
WRITEFIXED(save_p, players[i].outrun);
|
||||
WRITEUINT8(save_p, players[i].outruntime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -635,6 +638,9 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].botvars.itemdelay = READUINT32(save_p);
|
||||
players[i].botvars.itemconfirm = READUINT32(save_p);
|
||||
players[i].botvars.turnconfirm = READSINT8(save_p);
|
||||
|
||||
players[i].outrun = READFIXED(save_p);
|
||||
players[i].outruntime = READUINT8(save_p);
|
||||
|
||||
//players[i].viewheight = P_GetPlayerViewHeight(players[i]); // scale cannot be factored in at this point
|
||||
}
|
||||
|
|
|
|||
36
src/p_user.c
36
src/p_user.c
|
|
@ -1960,26 +1960,29 @@ static void P_3dMovement(player_t *player)
|
|||
// If "no" to 1, we're not reaching any limits yet, so ignore this entirely!
|
||||
// -Shadow Hog
|
||||
newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
|
||||
if (newMagnitude > K_GetKartSpeed(player, true, true)) //topspeed)
|
||||
if ((player->outruntime == 0) || (player->offroad > 0))
|
||||
{
|
||||
fixed_t tempmomx, tempmomy;
|
||||
if (oldMagnitude > K_GetKartSpeed(player, true, true) && onground) // SRB2Kart: onground check for air speed cap
|
||||
if (newMagnitude > K_GetKartSpeed(player, true, true)) //topspeed)
|
||||
{
|
||||
if (newMagnitude > oldMagnitude)
|
||||
fixed_t tempmomx, tempmomy;
|
||||
if (oldMagnitude > K_GetKartSpeed(player, true, true) && onground) // SRB2Kart: onground check for air speed cap
|
||||
{
|
||||
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), oldMagnitude);
|
||||
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), oldMagnitude);
|
||||
if (newMagnitude > oldMagnitude)
|
||||
{
|
||||
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), oldMagnitude);
|
||||
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), oldMagnitude);
|
||||
player->mo->momx = tempmomx + player->cmomx;
|
||||
player->mo->momy = tempmomy + player->cmomy;
|
||||
}
|
||||
// else do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), K_GetKartSpeed(player, true, true)); //topspeed)
|
||||
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), K_GetKartSpeed(player, true, true)); //topspeed)
|
||||
player->mo->momx = tempmomx + player->cmomx;
|
||||
player->mo->momy = tempmomy + player->cmomy;
|
||||
}
|
||||
// else do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), K_GetKartSpeed(player, true, true)); //topspeed)
|
||||
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), K_GetKartSpeed(player, true, true)); //topspeed)
|
||||
player->mo->momx = tempmomx + player->cmomx;
|
||||
player->mo->momy = tempmomy + player->cmomy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4532,6 +4535,11 @@ void P_PlayerAfterThink(player_t *player)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (P_IsObjectOnGround(player->mo) == true)
|
||||
{
|
||||
player->outrun = 0;
|
||||
}
|
||||
|
||||
#ifdef SECTORSPECIALSAFTERTHINK
|
||||
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
|
||||
player->onconveyor = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue