Grease part 2

This commit is contained in:
TehRealSalt 2019-09-12 14:23:45 -04:00
parent 56c9641488
commit 97b09ba9c1
3 changed files with 25 additions and 38 deletions

View file

@ -216,7 +216,7 @@ INT32 sneakertime = TICRATE + (TICRATE/3);
INT32 itemtime = 8*TICRATE;
INT32 comebacktime = 10*TICRATE;
INT32 bumptime = 6;
INT32 greasetics = 2*TICRATE;
INT32 greasetics = 3*TICRATE;
INT32 wipeoutslowtime = 20;
INT32 wantedreduce = 5*TICRATE;
INT32 wantedfrequency = 10*TICRATE;

View file

@ -6245,7 +6245,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
56*FRACUNIT, // height
0, // display offset
0, // mass
36*FRACUNIT, // damage
18*FRACUNIT, // damage
sfx_None, // activesound
MF_SOLID|MF_SPRING|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
S_YHORIZ2 // raisestate
@ -6272,7 +6272,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
56*FRACUNIT, // height
0, // display offset
0, // mass
72*FRACUNIT, // damage
36*FRACUNIT, // damage
sfx_None, // activesound
MF_SOLID|MF_SPRING|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
S_RHORIZ2 // raisestate
@ -6299,7 +6299,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
56*FRACUNIT, // height
0, // display offset
0, // mass
18*FRACUNIT, // damage
9*FRACUNIT, // damage
sfx_None, // activesound
MF_SOLID|MF_SPRING|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
S_BHORIZ2 // raisestate

View file

@ -158,60 +158,50 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
object->z = spring->z + spring->height + 1;
else if (vertispeed < 0)
object->z = spring->z - object->height - 1;
//#ifdef TELEPORTJANK
else
{
fixed_t offx, offy;
// Horizontal springs teleport you in FRONT of them.
object->momx = object->momy = 0;
// Overestimate the distance to position you at
offx = P_ReturnThrustX(spring, spring->angle, (spring->radius + object->radius + 1) * 2);
offy = P_ReturnThrustY(spring, spring->angle, (spring->radius + object->radius + 1) * 2);
// Make it square by clipping
if (offx > (spring->radius + object->radius + 1))
offx = spring->radius + object->radius + 1;
else if (offx < -(spring->radius + object->radius + 1))
offx = -(spring->radius + object->radius + 1);
if (offy > (spring->radius + object->radius + 1))
offy = spring->radius + object->radius + 1;
else if (offy < -(spring->radius + object->radius + 1))
offy = -(spring->radius + object->radius + 1);
offx = P_ReturnThrustX(spring, spring->angle, spring->radius + object->radius + 1);
offy = P_ReturnThrustY(spring, spring->angle, spring->radius + object->radius + 1);
// Set position!
P_TryMove(object, spring->x + offx, spring->y + offy, true);
}
//#endif
if (vertispeed)
{
// Vertical springs
object->momz = FixedMul(vertispeed,FixedSqrt(FixedMul(vscale, spring->scale)));
object->momz = FixedMul(vertispeed, FixedSqrt(FixedMul(vscale, spring->scale)));
// Diagonal springs
if (horizspeed)
{
if (!object->player)
P_InstaThrustEvenIn2D(object, spring->angle, FixedMul(horizspeed,FixedSqrt(FixedMul(hscale, spring->scale))));
else
fixed_t finalSpeed = horizspeed;
if (object->player)
{
fixed_t finalSpeed = FixedDiv(horizspeed, hscale);
fixed_t pSpeed = object->player->speed;
if (pSpeed > finalSpeed)
finalSpeed = pSpeed;
P_InstaThrustEvenIn2D(object, spring->angle, FixedMul(finalSpeed,FixedSqrt(FixedMul(hscale, spring->scale))));
if (object->player->speed > finalSpeed)
finalSpeed = object->player->speed;
}
P_InstaThrustEvenIn2D(object, spring->angle, FixedMul(finalSpeed, FixedSqrt(FixedMul(hscale, spring->scale))));
}
}
else if (horizspeed)
{
// Horizontal springs
P_Thrust(object, spring->angle, FixedMul(FixedDiv(horizspeed, hscale), FixedSqrt(FixedMul(hscale, spring->scale))));
fixed_t finalSpeed = horizspeed;
if (object->player)
{
finalSpeed += object->player->speed;
// Less friction when hitting horizontal springs
object->player->kartstuff[k_tiregrease] = greasetics;
}
// Add speed
P_Thrust(object, spring->angle, FixedMul(finalSpeed, FixedSqrt(FixedMul(hscale, spring->scale))));
}
// Re-solidify
@ -247,9 +237,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
localangle[3] = spring->angle;
}
}
if (!vertispeed) // Less friction when hitting horizontal springs
object->player->kartstuff[k_tiregrease] = greasetics;
}
P_ResetPlayer(object->player);