mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-17 10:11:12 +00:00
Red shell rework, they always instathrust to their top speed in their current movement direction.
When they get close their top speed starts to decrease to the player's current speed. Movement direction ends up being adjusted in A_RedShellChase where it Thrusts towards the player at its acceleration speed.
This commit is contained in:
parent
10aa83e614
commit
a46093fe9d
1 changed files with 28 additions and 6 deletions
34
src/p_mobj.c
34
src/p_mobj.c
|
@ -35,6 +35,8 @@
|
||||||
#include "p_slopes.h"
|
#include "p_slopes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "k_kart.h"
|
||||||
|
|
||||||
// protos.
|
// protos.
|
||||||
static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_viewheight = {"viewheight", VIEWHEIGHTS, 0, viewheight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_viewheight = {"viewheight", VIEWHEIGHTS, 0, viewheight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -7505,19 +7507,39 @@ void P_MobjThinker(mobj_t *mobj)
|
||||||
break;
|
break;
|
||||||
case MT_REDITEM:
|
case MT_REDITEM:
|
||||||
{
|
{
|
||||||
fixed_t magnitude;
|
fixed_t topspeed = 64*FRACUNIT;
|
||||||
|
fixed_t distbarrier = 512*FRACUNIT;
|
||||||
|
fixed_t distaway;
|
||||||
if (mobj->threshold > 0)
|
if (mobj->threshold > 0)
|
||||||
mobj->threshold--;
|
mobj->threshold--;
|
||||||
if (leveltime % 7 == 0)
|
if (leveltime % 7 == 0)
|
||||||
S_StartSound(mobj, mobj->info->activesound);
|
S_StartSound(mobj, mobj->info->activesound);
|
||||||
|
|
||||||
// Do a similar thing to what is done to the player to keep the red shell at a speed cap
|
if (cv_kartcc.value == 50)
|
||||||
magnitude = P_AproxDistance(mobj->momx, mobj->momy);
|
|
||||||
if (magnitude > 64*FRACUNIT)
|
|
||||||
{
|
{
|
||||||
mobj->momx = FixedMul(FixedDiv(mobj->momx, magnitude), 64*FRACUNIT);
|
topspeed = FixedMul(topspeed, FRACUNIT-FRACUNIT/4);
|
||||||
mobj->momy = FixedMul(FixedDiv(mobj->momy, magnitude), 64*FRACUNIT);
|
distbarrier = FixedMul(distbarrier, FRACUNIT-FRACUNIT/4);
|
||||||
}
|
}
|
||||||
|
else if (cv_kartcc.value == 150)
|
||||||
|
{
|
||||||
|
topspeed = FixedMul(topspeed, FRACUNIT+FRACUNIT/4);
|
||||||
|
distbarrier = FixedMul(distbarrier, FRACUNIT+FRACUNIT/4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobj->tracer)
|
||||||
|
{
|
||||||
|
distaway = P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y);
|
||||||
|
if (distaway < distbarrier)
|
||||||
|
{
|
||||||
|
if (mobj->tracer->player)
|
||||||
|
{
|
||||||
|
fixed_t speeddifference = abs(topspeed - min(mobj->tracer->player->speed, K_GetKartSpeed(mobj->tracer->player, false)));
|
||||||
|
topspeed = topspeed - FixedMul(speeddifference, FRACUNIT-FixedDiv(distaway, distbarrier));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
P_InstaThrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy), topspeed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MT_REDITEMDUD:
|
case MT_REDITEMDUD:
|
||||||
|
|
Loading…
Reference in a new issue