From aac35d8e8f42282cb581398c1a42d5d337dbc7fe Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 7 Mar 2017 23:47:06 +0000 Subject: [PATCH] Revert speed change to Redshells, but give them a speedcap in their thinker. --- src/info.c | 2 +- src/p_mobj.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 94c9683d..c277798d 100644 --- a/src/info.c +++ b/src/info.c @@ -14695,7 +14695,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_DEADRED, // deathstate S_NULL, // xdeathstate sfx_shbrk, // deathsound - (14*FRACUNIT)/5,// speed + 7*FRACUNIT, // speed 16*FRACUNIT, // radius 32*FRACUNIT, // height 0, // display offset diff --git a/src/p_mobj.c b/src/p_mobj.c index 49489760..ec863705 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7438,11 +7438,21 @@ void P_MobjThinker(mobj_t *mobj) S_StartSound(mobj, mobj->info->activesound); break; case MT_REDITEM: + { if (mobj->threshold > 0) mobj->threshold--; if (leveltime % 7 == 0) 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 + fixed_t magnitude = P_AproxDistance(mobj->momx, mobj->momy); + if (magnitude > 64*FRACUNIT) + { + mobj->momx = FixedMul(FixedDiv(mobj->momx, magnitude), 64*FRACUNIT); + mobj->momy = FixedMul(FixedDiv(mobj->momy, magnitude), 64*FRACUNIT); + } break; + } case MT_REDITEMDUD: mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->x+mobj->momx, mobj->y+mobj->momy); P_InstaThrust(mobj, mobj->angle, mobj->info->speed);