From 97b09ba9c1a736efc92c02b761299001d329b603 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 12 Sep 2019 14:23:45 -0400 Subject: [PATCH] Grease part 2 --- src/g_game.c | 2 +- src/info.c | 6 +++--- src/p_map.c | 55 ++++++++++++++++++++-------------------------------- 3 files changed, 25 insertions(+), 38 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index f4711592d..e890627aa 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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; diff --git a/src/info.c b/src/info.c index 0a9c0cced..9e949d24c 100644 --- a/src/info.c +++ b/src/info.c @@ -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 diff --git a/src/p_map.c b/src/p_map.c index fbee5abf0..eb9ff8cc8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -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);