From fa002e58ad0f11f362a5bdfdb0629c9494906a1b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 31 May 2016 15:01:19 +0100 Subject: [PATCH 01/31] Did a bunch of things to/for slopes. *The No Physics flag now works (Red, you might want to doublecheck this to see whether I haven't missed any eosteric stuff out). Going downhill is a little bumpy, and I'm not sure whether that's good or not. Someone help me out here? *The SRB2CB typeshims are now behind #ifdef ESLOPE_TYPESHIM instead of #if 1 for easier disabling. *Slopes' downhill thrusts are now scaled with regards to object gravity. This is actually untested in gravities other than normal and reverse normal but it's one line which can be easily reverted in that circumstance. I also checked with MI to make sure this is how it's calculated elsewhere, so fingers crossed this doesn't cause any edge cases. *As a consequence of the above point, there's now a function in p_mobj.c/h that returns an object's internal gravity - seperated out from the logic of P_CheckGravity, which really didn't need to be so monolithic. Multiply by global gravity to get the thrust. This should probably be available to Lua somehow, but I have absolutely no idea where to start with that. Wolfs, maybe? Non-comprehensive test file available at /toaster/slptst3.wad on the ftp. --- src/doomdef.h | 6 ++++++ src/p_mobj.c | 31 ++++++++++++++++++++++--------- src/p_mobj.h | 3 +++ src/p_slopes.c | 50 ++++++++++++++++++++++++++++++++++---------------- src/p_user.c | 8 ++++---- 5 files changed, 69 insertions(+), 29 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 9a1e5af9..e645c084 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -431,6 +431,12 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Kalaron/Eternity Engine slope code (SRB2CB ported) #define ESLOPE +#if defined(ESLOPE) +/// Backwards compatibility with SRB2CB's slope linedef types. +/// \note A simple shim that prints a warning. +#define ESLOPE_TYPESHIM +#endif + /// Delete file while the game is running. /// \note EXTREMELY buggy, tends to crash game. //#define DELFILE diff --git a/src/p_mobj.c b/src/p_mobj.c index 68fb1696..775cd9d6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1252,13 +1252,12 @@ static void P_PlayerFlip(mobj_t *mo) } // -// P_CheckGravity +// P_GetMobjGravity // -// Checks the current gravity state -// of the object. If affect is true, -// a gravity force will be applied. +// Returns the current gravity +// value of the object. // -void P_CheckGravity(mobj_t *mo, boolean affect) +fixed_t P_GetMobjGravity(mobj_t *mo) { fixed_t gravityadd = 0; boolean no3dfloorgrav = true; // Custom gravity @@ -1400,11 +1399,25 @@ void P_CheckGravity(mobj_t *mo, boolean affect) if (goopgravity) gravityadd = -gravityadd/5; - if (affect) - mo->momz += FixedMul(gravityadd, mo->scale); - if (mo->player && !!(mo->eflags & MFE_VERTICALFLIP) != wasflip) P_PlayerFlip(mo); + + return gravityadd; +} + +// +// P_CheckGravity +// +// Checks the current gravity state +// of the object. If affect is true, +// a gravity force will be applied. +// +void P_CheckGravity(mobj_t *mo, boolean affect) +{ + fixed_t gravityadd = P_GetMobjGravity(mo); + + if (affect) + mo->momz += FixedMul(gravityadd, mo->scale); if (mo->type == MT_SKIM && mo->z + mo->momz <= mo->watertop && mo->z >= mo->watertop) { @@ -1480,7 +1493,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING)) #ifdef ESLOPE - && !(player->mo->standingslope && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2) + && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)) #endif ) { diff --git a/src/p_mobj.h b/src/p_mobj.h index 9542ce8b..de7f0c8d 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -425,6 +425,9 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum); // check mobj against water content, before movement code void P_MobjCheckWater(mobj_t *mobj); +// get mobj gravity +fixed_t P_GetMobjGravity(mobj_t *mo); + // Player spawn points void P_SpawnPlayer(INT32 playernum); void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing); diff --git a/src/p_slopes.c b/src/p_slopes.c index 6393ca4b..f4ef4dcc 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -16,6 +16,7 @@ #include "m_bbox.h" #include "z_zone.h" #include "p_local.h" +#include "p_mobj.h" #include "p_spec.h" #include "p_slopes.h" #include "p_setup.h" @@ -881,7 +882,7 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) // Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes void P_ResetDynamicSlopes(void) { size_t i; -#if 1 // Rewrite old specials to new ones, and give a console warning +#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning boolean warned = false; #endif @@ -894,7 +895,7 @@ void P_ResetDynamicSlopes(void) { { switch (lines[i].special) { -#if 1 // Rewrite old specials to new ones, and give a console warning +#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning #define WARNME if (!warned) {warned = true; CONS_Alert(CONS_WARNING, "This level uses old slope specials.\nA conversion will be needed before 2.2's release.\n");} case 386: case 387: @@ -1018,6 +1019,9 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y) // When given a vector, rotates it and aligns it to a slope void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { + if (slope->flags & SL_NOPHYSICS) + return; // No physics, no quantizing. + vector3_t axis; axis.x = -slope->d.y; axis.y = slope->d.x; @@ -1032,26 +1036,37 @@ void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) // Handles slope ejection for objects void P_SlopeLaunch(mobj_t *mo) { - // Double the pre-rotation Z, then halve the post-rotation Z. This reduces the - // vertical launch given from slopes while increasing the horizontal launch - // given. Good for SRB2's gravity and horizontal speeds. - vector3_t slopemom; - slopemom.x = mo->momx; - slopemom.y = mo->momy; - slopemom.z = mo->momz*2; - P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); - - mo->momx = slopemom.x; - mo->momy = slopemom.y; - mo->momz = slopemom.z/2; + if (!(mo->standingslope->flags & SL_NOPHYSICS)) // If there's physics, time for launching. + { + // Double the pre-rotation Z, then halve the post-rotation Z. This reduces the + // vertical launch given from slopes while increasing the horizontal launch + // given. Good for SRB2's gravity and horizontal speeds. + vector3_t slopemom; + slopemom.x = mo->momx; + slopemom.y = mo->momy; + slopemom.z = mo->momz*2; + P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); + mo->momx = slopemom.x; + mo->momy = slopemom.y; + mo->momz = slopemom.z/2; + } + //CONS_Printf("Launched off of slope.\n"); mo->standingslope = NULL; } // Function to help handle landing on slopes void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) -{ +{ + if (slope->flags & SL_NOPHYSICS) { // No physics, no need to make anything complicated. + if (P_MobjFlip(thing)*(thing->momz) < 0) { // falling, land on slope + thing->momz = -P_MobjFlip(thing); + thing->standingslope = slope; + } + return; + } + vector3_t mom; mom.x = thing->momx; mom.y = thing->momy; @@ -1081,6 +1096,9 @@ void P_ButteredSlope(mobj_t *mo) if (!mo->standingslope) return; + + if (mo->standingslope->flags & SL_NOPHYSICS) + return; // No physics, no butter. if (mo->flags & (MF_NOCLIPHEIGHT|MF_NOGRAVITY)) return; // don't slide down slopes if you can't touch them or you're not affected by gravity @@ -1116,7 +1134,7 @@ void P_ButteredSlope(mobj_t *mo) // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down // Multiply by gravity - thrust = FixedMul(thrust, gravity); // TODO account for per-sector gravity etc + thrust = FixedMul(thrust, FixedMul(gravity, abs(P_GetMobjGravity(mo)))); // Now uses the absolute of mobj gravity. You're welcome. // Multiply by scale (gravity strength depends on mobj scale) thrust = FixedMul(thrust, mo->scale); diff --git a/src/p_user.c b/src/p_user.c index 4117cfc4..461497bc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3741,7 +3741,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) { if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING) #ifdef ESLOPE - && (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) + && (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) #endif ) { @@ -3774,7 +3774,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) else if ((cmd->buttons & BT_USE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20)) && !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<mo->scale) #ifdef ESLOPE - || (player->mo->standingslope && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2) + || (player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2) #endif ) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)) { @@ -3790,7 +3790,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH) && player->speed < FixedMul(5*FRACUNIT,player->mo->scale) #ifdef ESLOPE - && (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) + && (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) #endif ) { @@ -4776,7 +4776,7 @@ static void P_3dMovement(player_t *player) #ifdef ESLOPE if ((totalthrust.x || totalthrust.y) - && player->mo->standingslope && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { + && player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { // Factor thrust to slope, but only for the part pushing up it! // The rest is unaffected. angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection; From ad61050bb07825453b83fdd8735c2e85460d6ac2 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 31 May 2016 16:01:05 +0100 Subject: [PATCH 02/31] Whitespace removal. --- src/p_mobj.c | 2 +- src/p_slopes.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 775cd9d6..35d8f1ad 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1401,7 +1401,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if (mo->player && !!(mo->eflags & MFE_VERTICALFLIP) != wasflip) P_PlayerFlip(mo); - + return gravityadd; } diff --git a/src/p_slopes.c b/src/p_slopes.c index f4ef4dcc..462f7c3c 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1021,7 +1021,7 @@ void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { if (slope->flags & SL_NOPHYSICS) return; // No physics, no quantizing. - + vector3_t axis; axis.x = -slope->d.y; axis.y = slope->d.x; @@ -1051,14 +1051,14 @@ void P_SlopeLaunch(mobj_t *mo) mo->momy = slopemom.y; mo->momz = slopemom.z/2; } - + //CONS_Printf("Launched off of slope.\n"); mo->standingslope = NULL; } // Function to help handle landing on slopes void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) -{ +{ if (slope->flags & SL_NOPHYSICS) { // No physics, no need to make anything complicated. if (P_MobjFlip(thing)*(thing->momz) < 0) { // falling, land on slope thing->momz = -P_MobjFlip(thing); @@ -1096,7 +1096,7 @@ void P_ButteredSlope(mobj_t *mo) if (!mo->standingslope) return; - + if (mo->standingslope->flags & SL_NOPHYSICS) return; // No physics, no butter. From 6058eec1c9c4c0b5129c72f94dce0e4a7dca01d8 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 31 May 2016 16:14:21 +0100 Subject: [PATCH 03/31] Holy shit. I spent two hours staring at how garbage this code was and didn't even realise it was #ifdef'd out behind a define not even mentioned in doomdef.h. It's not actually used anywhere (superseded entirely by the much nicer, much more relevant P_NewVertexSlope()... out with you, ancient, foul demons who should've been SPRINGCLEANed long ago. --- src/p_slopes.c | 255 ------------------------------------------------- src/p_slopes.h | 20 ---- 2 files changed, 275 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 462f7c3c..cb5f07b2 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -624,261 +624,6 @@ pslope_t *P_SlopeById(UINT16 id) return ret; } -#ifdef SPRINGCLEAN -#include "byteptr.h" - -#include "p_setup.h" -#include "p_local.h" - -//========================================================================== -// -// P_SetSlopesFromVertexHeights -// -//========================================================================== -void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) -{ - mapthing_t *mt; - boolean vt_found = false; - size_t i, j, k, l, q; - - //size_t i; - //mapthing_t *mt; - char *data; - char *datastart; - - // SRB2CBTODO: WHAT IS (5 * sizeof (short))?! It = 10 - // anything else seems to make a map not load properly, - // but this hard-coded value MUST have some reason for being what it is - size_t snummapthings = W_LumpLength(lumpnum) / (5 * sizeof (short)); - mapthing_t *smapthings = Z_Calloc(snummapthings * sizeof (*smapthings), PU_LEVEL, NULL); - fixed_t x, y; - sector_t *sector; - // Spawn axis points first so they are - // at the front of the list for fast searching. - data = datastart = W_CacheLumpNum(lumpnum, PU_LEVEL); - mt = smapthings; - for (i = 0; i < snummapthings; i++, mt++) - { - mt->x = READINT16(data); - mt->y = READINT16(data); - mt->angle = READINT16(data); - mt->type = READINT16(data); - mt->options = READINT16(data); - // mt->z hasn't been set yet! - //mt->extrainfo = (byte)(mt->type >> 12); // slope things are special, they have a bigger range of types - - //mt->type &= 4095; // SRB2CBTODO: WHAT IS THIS???? Mobj type limits?!!!! - x = mt->x*FRACUNIT; - y = mt->y*FRACUNIT; - sector = R_PointInSubsector(x, y)->sector; - // Z for objects -#ifdef ESLOPE - if (sector->f_slope) - mt->z = (short)(P_GetZAt(sector->f_slope, x, y)>>FRACBITS); - else -#endif - mt->z = (short)(sector->floorheight>>FRACBITS); - - mt->z = mt->z + (mt->options >> ZSHIFT); - - if (mt->type == THING_VertexFloorZ || mt->type == THING_VertexCeilingZ) // THING_VertexFloorZ - { - for(l = 0; l < numvertexes; l++) - { - if (vertexes[l].x == mt->x*FRACUNIT && vertexes[l].y == mt->y*FRACUNIT) - { - if (mt->type == THING_VertexFloorZ) - { - vertexes[l].z = mt->z*FRACUNIT; - //I_Error("Z value: %i", vertexes[l].z/FRACUNIT); - - } - else - { - vertexes[l].z = mt->z*FRACUNIT; // celing floor - } - vt_found = true; - } - } - //mt->type = 0; // VPHYSICS: Dynamic slopes - - - - - - - if (vt_found) - { - for (k = 0; k < numsectors; k++) - { - sector_t *sec = §ors[k]; - if (sec->linecount != 3) continue; // only works with triangular sectors - - v3float_t vt1, vt2, vt3; // cross = ret->normalf - v3float_t vec1, vec2; - - int vi1, vi2, vi3; - - vi1 = (int)(sec->lines[0]->v1 - vertexes); - vi2 = (int)(sec->lines[0]->v2 - vertexes); - vi3 = (sec->lines[1]->v1 == sec->lines[0]->v1 || sec->lines[1]->v1 == sec->lines[0]->v2)? - (int)(sec->lines[1]->v2 - vertexes) : (int)(sec->lines[1]->v1 - vertexes); - - //if (vertexes[vi1].z) - // I_Error("OSNAP %i", vertexes[vi1].z/FRACUNIT); - //if (vertexes[vi2].z) - // I_Error("OSNAP %i", vertexes[vi2].z/FRACUNIT); - //if (vertexes[vi3].z) - // I_Error("OSNAP %i", vertexes[vi3].z/FRACUNIT); - - //I_Error("%i, %i", mt->z*FRACUNIT, vertexes[vi1].z); - - //I_Error("%i, %i, %i", mt->x, mt->y, mt->z); - //P_SpawnMobj(mt->x*FRACUNIT, mt->y*FRACUNIT, mt->z*FRACUNIT, MT_RING); - - // TODO: Make sure not to spawn in the same place 2x! (we need an object in every vertex of the - // triangle sector to setup the real vertex slopes - // Check for the vertexes of all sectors - for(q = 0; q < numvertexes; q++) - { - if (vertexes[q].x == mt->x*FRACUNIT && vertexes[q].y == mt->y*FRACUNIT) - { - //I_Error("yeah %i", vertexes[q].z); - P_SpawnMobj(vertexes[q].x, vertexes[q].y, vertexes[q].z, MT_RING); -#if 0 - if ((mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z) - && !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z) - && !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z)) - P_SpawnMobj(vertexes[vi1].x, vertexes[vi1].y, vertexes[vi1].z, MT_RING); - else if ((mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z) - && !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z) - && !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z)) - P_SpawnMobj(vertexes[vi2].x, vertexes[vi2].y, vertexes[vi2].z, MT_BOUNCETV); - else if ((mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z) - && !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z) - && !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z)) - P_SpawnMobj(vertexes[vi3].x, vertexes[vi3].y, vertexes[vi3].z, MT_GFZFLOWER1); - else -#endif - continue; - } - } - - vt1.x = FIXED_TO_FLOAT(vertexes[vi1].x); - vt1.y = FIXED_TO_FLOAT(vertexes[vi1].y); - vt2.x = FIXED_TO_FLOAT(vertexes[vi2].x); - vt2.y = FIXED_TO_FLOAT(vertexes[vi2].y); - vt3.x = FIXED_TO_FLOAT(vertexes[vi3].x); - vt3.y = FIXED_TO_FLOAT(vertexes[vi3].y); - - for(j = 0; j < 2; j++) - { - - fixed_t z3; - //I_Error("Lo hicimos"); - - vt1.z = mt->z;//FIXED_TO_FLOAT(j==0 ? sec->floorheight : sec->ceilingheight); - vt2.z = mt->z;//FIXED_TO_FLOAT(j==0? sec->floorheight : sec->ceilingheight); - z3 = mt->z;//j==0? sec->floorheight : sec->ceilingheight; // Destination height - vt3.z = FIXED_TO_FLOAT(z3); - - if (P_PointOnLineSide(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0) - { - vec1.x = vt2.x - vt3.x; - vec1.y = vt2.y - vt3.y; - vec1.z = vt2.z - vt3.z; - - vec2.x = vt1.x - vt3.x; - vec2.y = vt1.y - vt3.y; - vec2.z = vt1.z - vt3.z; - } - else - { - vec1.x = vt1.x - vt3.x; - vec1.y = vt1.y - vt3.y; - vec1.z = vt1.z - vt3.z; - - vec2.x = vt2.x - vt3.x; - vec2.y = vt2.y - vt3.y; - vec2.z = vt2.z - vt3.z; - } - - - pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); - memset(ret, 0, sizeof(*ret)); - - { - M_CrossProduct3f(&ret->normalf, &vec1, &vec2); - - // Cross product length - float len = (float)sqrt(ret->normalf.x * ret->normalf.x + - ret->normalf.y * ret->normalf.y + - ret->normalf.z * ret->normalf.z); - - if (len == 0) - { - // Only happens when all vertices in this sector are on the same line. - // Let's just ignore this case. - //CONS_Printf("Slope thing at (%d,%d) lies directly on its target line.\n", (int)(x>>16), (int)(y>>16)); - return; - } - // cross/len - ret->normalf.x /= len; - ret->normalf.y /= len; - ret->normalf.z /= len; - - // ZDoom cross = ret->normalf - // Fix backward normals - if ((ret->normalf.z < 0 && j == 0) || (ret->normalf.z > 0 && j == 1)) - { - // cross = -cross - ret->normalf.x = -ret->normalf.x; - ret->normalf.y = -ret->normalf.x; - ret->normalf.z = -ret->normalf.x; - } - } - - secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); - - srcplane->a = FLOAT_TO_FIXED (ret->normalf.x); - srcplane->b = FLOAT_TO_FIXED (ret->normalf.y); - srcplane->c = FLOAT_TO_FIXED (ret->normalf.z); - //srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); - srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].x, - srcplane->b, vertexes[vi3].y, - srcplane->c, z3); - - if (j == 0) - { - sec->f_slope = ret; - sec->f_slope->secplane = *srcplane; - } - else if (j == 1) - { - sec->c_slope = ret; - sec->c_slope->secplane = *srcplane; - } - } - } - } - - - - - - - - - } - } - Z_Free(datastart); - - - - -} -#endif - // Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes void P_ResetDynamicSlopes(void) { size_t i; diff --git a/src/p_slopes.h b/src/p_slopes.h index 80921a84..dd9b6f2d 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -21,26 +21,6 @@ void P_RunDynamicSlopes(void); // sectors. void P_SpawnSlope_Line(int linenum); -#ifdef SPRINGCLEAN -// Loads just map objects that make slopes, -// terrain affecting objects have to be spawned first -void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum); - -typedef enum -{ - THING_SlopeFloorPointLine = 9500, - THING_SlopeCeilingPointLine = 9501, - THING_SetFloorSlope = 9502, - THING_SetCeilingSlope = 9503, - THING_CopyFloorPlane = 9510, - THING_CopyCeilingPlane = 9511, - THING_VavoomFloor=1500, - THING_VavoomCeiling=1501, - THING_VertexFloorZ=1504, - THING_VertexCeilingZ=1505, -} slopething_e; -#endif - // // P_CopySectorSlope // From da2abbb39ff5302ee7a86e0dd717f1185af0a00a Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 31 May 2016 16:24:51 +0100 Subject: [PATCH 04/31] Failed a build because C is an obnoxious language. --- src/p_slopes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index cb5f07b2..bd354c50 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -764,10 +764,11 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y) // When given a vector, rotates it and aligns it to a slope void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { + vector3_t axis; // Fuck you, C90. + if (slope->flags & SL_NOPHYSICS) return; // No physics, no quantizing. - vector3_t axis; axis.x = -slope->d.y; axis.y = slope->d.x; axis.z = 0; @@ -804,6 +805,8 @@ void P_SlopeLaunch(mobj_t *mo) // Function to help handle landing on slopes void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) { + vector3_t mom; // Ditto. + if (slope->flags & SL_NOPHYSICS) { // No physics, no need to make anything complicated. if (P_MobjFlip(thing)*(thing->momz) < 0) { // falling, land on slope thing->momz = -P_MobjFlip(thing); @@ -812,7 +815,6 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) return; } - vector3_t mom; mom.x = thing->momx; mom.y = thing->momy; mom.z = thing->momz*2; From d998ddfae46f0250d1336488fe3e99ca1d2c4c95 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 31 May 2016 17:07:28 +0100 Subject: [PATCH 05/31] When you haven't found all the vertices, it's just not safe to carry on. Hit them with a descriptive I_Error so they don't get confused as hell like Glaber did. http://mb.srb2.org/showthread.php?t=41455 for reference. Also took the opportunity to nuke or otherwise neuter a bunch of Kalaron's bizzare ramblings (most are questions which have long-been answered by Red's efforts) at the same time. --- src/p_slopes.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index bd354c50..659f8b33 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -200,7 +200,6 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line) // Find furthest vertex from the reference line. It, along with the two ends // of the line, will define the plane. - // SRB2CBTODO: Use a formula to get the slope to slide objects depending on how steep for(i = 0; i < sector->linecount; i++) { line_t *li = sector->lines[i]; @@ -232,7 +231,6 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line) // // Creates one or more slopes based on the given line type and front/back // sectors. -// Kalaron: Check if dynamic slopes need recalculation // void P_SpawnSlope_Line(int linenum) { @@ -277,7 +275,7 @@ void P_SpawnSlope_Line(int linenum) ny = -FixedDiv(line->dx, len); } - // SRB2CBTODO: Transform origin relative to the bounds of an individual FOF + // TODO: Transform origin relative to the bounds of an individual FOF origin.x = line->v1->x + (line->v2->x - line->v1->x)/2; origin.y = line->v1->y + (line->v2->y - line->v1->y)/2; @@ -328,7 +326,7 @@ void P_SpawnSlope_Line(int linenum) // fslope->normal is a 3D line perpendicular to the 3D vector // Sync the linedata of the line that started this slope - // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + // TODO: Anything special for control sector based slopes later? fslope->sourceline = line; // To find the real highz/lowz of a slope, you need to check all the vertexes @@ -380,7 +378,7 @@ void P_SpawnSlope_Line(int linenum) cslope->refpos = 2; // Sync the linedata of the line that started this slope - // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + // TODO: Anything special for control sector based slopes later? cslope->sourceline = line; // Remember the way the slope is formed @@ -446,7 +444,7 @@ void P_SpawnSlope_Line(int linenum) fslope->refpos = 3; // Sync the linedata of the line that started this slope - // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + // TODO: Anything special for control sector based slopes later? fslope->sourceline = line; // Remember the way the slope is formed @@ -489,7 +487,7 @@ void P_SpawnSlope_Line(int linenum) cslope->refpos = 4; // Sync the linedata of the line that started this slope - // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + // TODO: Anything special for control sector based slopes later? cslope->sourceline = line; // Remember the way the slope is formed @@ -555,16 +553,11 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag ret->vertices[2] = mt; } - if (!ret->vertices[0]) - CONS_Printf("PANIC 0\n"); - if (!ret->vertices[1]) - CONS_Printf("PANIC 1\n"); - if (!ret->vertices[2]) - CONS_Printf("PANIC 2\n"); - // Now set heights for each vertex, because they haven't been set yet for (i = 0; i < 3; i++) { mt = ret->vertices[i]; + if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?) + I_Error("Slope vertex %d (for linedef tag %d) not found.", i, tag1); if (mt->extrainfo) mt->z = mt->options; else From d4d44777f43297f398247f8db81302d493f25763 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 31 May 2016 17:43:27 +0100 Subject: [PATCH 06/31] Okay, now vertex slopes aren't placement-order-dependent any more. Hopefully this is the best way to handle things. --- src/p_slopes.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/p_slopes.c b/src/p_slopes.c index 659f8b33..d9e2cef6 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -546,9 +546,17 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag continue; if (!ret->vertices[0] && mt->angle == tag1) + { ret->vertices[0] = mt; + mt = mapthings; + i = 0; + } else if (!ret->vertices[1] && mt->angle == tag2) + { ret->vertices[1] = mt; + mt = mapthings; + i = 0; + } else if (!ret->vertices[2] && mt->angle == tag3) ret->vertices[2] = mt; } From 7071fbe29e5c078631c6dae366ca81bcbc570e34 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 31 May 2016 18:13:17 +0100 Subject: [PATCH 07/31] I made a mistake. Fuck git reverts, they are a nightmare, let's just do this the old fashioned way. --- src/p_slopes.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index d9e2cef6..659f8b33 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -546,17 +546,9 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag continue; if (!ret->vertices[0] && mt->angle == tag1) - { ret->vertices[0] = mt; - mt = mapthings; - i = 0; - } else if (!ret->vertices[1] && mt->angle == tag2) - { ret->vertices[1] = mt; - mt = mapthings; - i = 0; - } else if (!ret->vertices[2] && mt->angle == tag3) ret->vertices[2] = mt; } From 62c4338d60740d8147fab5503f23130f7604444f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 1 Jun 2016 13:19:44 +0100 Subject: [PATCH 08/31] Added P_GetMobjGravity to Lua. Check /toaster/gravitytest.lua for sample script. --- src/lua_baselib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 7678c7c4..05ba00d6 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -13,6 +13,7 @@ #include "doomdef.h" #ifdef HAVE_BLUA #include "p_local.h" +#include "p_mobj.h" // So we can have P_GetMobjGravity #include "p_setup.h" // So we can have P_SetupLevelSky #include "z_zone.h" #include "r_main.h" @@ -437,6 +438,16 @@ static int lib_pMobjFlip(lua_State *L) return 1; } +static int lib_pGetMobjGravity(lua_State *L) +{ + mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + //HUDSAFE + if (!mobj) + return LUA_ErrInvalid(L, "mobj_t"); + lua_pushinteger(L, P_GetMobjGravity(mobj)); + return 1; +} + static int lib_pWeaponOrPanel(lua_State *L) { mobjtype_t type = luaL_checkinteger(L, 1); @@ -2008,6 +2019,7 @@ static luaL_Reg lib[] = { {"P_SPMAngle",lib_pSPMAngle}, {"P_SpawnPlayerMissile",lib_pSpawnPlayerMissile}, {"P_MobjFlip",lib_pMobjFlip}, + {"P_GetMobjGravity",lib_pGetMobjGravity}, {"P_WeaponOrPanel",lib_pWeaponOrPanel}, {"P_FlashPal",lib_pFlashPal}, {"P_GetClosestAxis",lib_pGetClosestAxis}, From 76d108d760a004a6e522c3364452c89074c68f0b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 1 Jun 2016 14:49:14 +0100 Subject: [PATCH 09/31] Whoops, didn't realise pushing fixed and integer were different. My mistake. --- src/lua_baselib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 05ba00d6..c88ece50 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -444,7 +444,7 @@ static int lib_pGetMobjGravity(lua_State *L) //HUDSAFE if (!mobj) return LUA_ErrInvalid(L, "mobj_t"); - lua_pushinteger(L, P_GetMobjGravity(mobj)); + lua_pushfixed(L, P_GetMobjGravity(mobj)); return 1; } From ae8b45965c4eb13856faffa1d4330634d200250d Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 1 Jun 2016 16:45:10 +0100 Subject: [PATCH 10/31] No Size_t --> int in an I_Error print! [/rhyme] --- src/p_slopes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 659f8b33..4a8eadc5 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -557,7 +557,7 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag for (i = 0; i < 3; i++) { mt = ret->vertices[i]; if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?) - I_Error("Slope vertex %d (for linedef tag %d) not found.", i, tag1); + I_Error("Slope vertex %s (for linedef tag %d) not found.", sizeu1(i), tag1); if (mt->extrainfo) mt->z = mt->options; else From 44a6e8bb54db02e7085ddf7098fad38c56928210 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 1 Jun 2016 19:52:12 +0100 Subject: [PATCH 11/31] I_Error description syntax consistency (buzzword buzzword buzzword). --- src/p_slopes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 4a8eadc5..72abf02b 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -557,7 +557,7 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag for (i = 0; i < 3; i++) { mt = ret->vertices[i]; if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?) - I_Error("Slope vertex %s (for linedef tag %d) not found.", sizeu1(i), tag1); + I_Error("P_NewVertexSlope: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1); if (mt->extrainfo) mt->z = mt->options; else From 1493537dfc7f0d2544d621fbf30157a34693d29d Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 2 Jun 2016 14:39:41 +0100 Subject: [PATCH 12/31] Moved the standingslope check in P_ZMovement to after the FOF and height adjustment as it is in P_PlayerZMovement, as reccomended. Doesn't actually stop Crawla jittering, but might as well make it happen for consistency's sake. --- src/p_mobj.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 35d8f1ad..acf5b1b3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2165,16 +2165,6 @@ static boolean P_ZMovement(mobj_t *mo) I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); -#ifdef ESLOPE - if (mo->standingslope) - { - if (mo->flags & MF_NOCLIPHEIGHT) - mo->standingslope = NULL; - else if (!P_IsObjectOnGround(mo)) - P_SlopeLaunch(mo); - } -#endif - // Intercept the stupid 'fall through 3dfloors' bug if (mo->subsector->sector->ffloors) P_AdjustMobjFloorZ_FFloors(mo, mo->subsector->sector, 0); @@ -2189,6 +2179,16 @@ static boolean P_ZMovement(mobj_t *mo) } mo->z += mo->momz; +#ifdef ESLOPE + if (mo->standingslope) + { + if (mo->flags & MF_NOCLIPHEIGHT) + mo->standingslope = NULL; + else if (!P_IsObjectOnGround(mo)) + P_SlopeLaunch(mo); + } +#endif + switch (mo->type) { case MT_THROWNBOUNCE: From 213a9632ca4b5cd68902bc805cc625d5b24d3e41 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 2 Jun 2016 16:09:33 +0100 Subject: [PATCH 13/31] Let's multiply the thrust by the mobj's friction. You should have less chance of purchase on a slippery slope (tee hee) and more on a rough one, but the slopes were basically identical during testing before I implemented this change. --- src/p_slopes.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 72abf02b..ec07ab2f 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -864,8 +864,6 @@ void P_ButteredSlope(mobj_t *mo) mult = FINECOSINE(angle >> ANGLETOFINESHIFT); } - //CONS_Printf("%d\n", mult); - thrust = FixedMul(thrust, FRACUNIT*2/3 + mult/8); } @@ -873,11 +871,18 @@ void P_ButteredSlope(mobj_t *mo) thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down - // Multiply by gravity - thrust = FixedMul(thrust, FixedMul(gravity, abs(P_GetMobjGravity(mo)))); // Now uses the absolute of mobj gravity. You're welcome. - // Multiply by scale (gravity strength depends on mobj scale) + // The strength of gravity depends on the global gravity base setting... + thrust = FixedMul(thrust, gravity); + + // ...the sector-based gravity strength... + thrust = FixedMul(thrust, abs(P_GetMobjGravity(mo))); + + // ...and the scale of the object. thrust = FixedMul(thrust, mo->scale); + // Let's also multiply by friction for good measure. + thrust = FixedMul(thrust, mo->friction); + P_Thrust(mo, mo->standingslope->xydirection, thrust); } From 882622d2e70616376e81f82b8471645a1ac75721 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 2 Jun 2016 16:42:07 +0100 Subject: [PATCH 14/31] ...I made two major mistakes with P_GetMobjGravity. *Didn't take into account object scale *Doubled force when on the ground (ignore what the comment of the line I moved says, it was relevant for slopes...) This also led to a mistake with slopes, where I was double-multiplying by the gravity constant to get half (because of a quirk of numbers...) --- src/p_mobj.c | 10 ++++++---- src/p_slopes.c | 12 +++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index acf5b1b3..843123d5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1316,9 +1316,6 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if (mo->eflags & MFE_UNDERWATER && !goopgravity) gravityadd = gravityadd/3; - if (!mo->momz) // mobj at stop, no floor, so feel the push of gravity! - gravityadd <<= 1; - if (mo->player) { if (mo->player->charability == CA_FLY && (mo->player->powers[pw_tailsfly] @@ -1402,6 +1399,8 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if (mo->player && !!(mo->eflags & MFE_VERTICALFLIP) != wasflip) P_PlayerFlip(mo); + gravityadd = FixedMul(gravityadd, mo->scale); + return gravityadd; } @@ -1416,8 +1415,11 @@ void P_CheckGravity(mobj_t *mo, boolean affect) { fixed_t gravityadd = P_GetMobjGravity(mo); + if (!mo->momz) // mobj at stop, no floor, so feel the push of gravity! + gravityadd <<= 1; + if (affect) - mo->momz += FixedMul(gravityadd, mo->scale); + mo->momz += gravityadd; if (mo->type == MT_SKIM && mo->z + mo->momz <= mo->watertop && mo->z >= mo->watertop) { diff --git a/src/p_slopes.c b/src/p_slopes.c index ec07ab2f..ed25f00f 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -812,7 +812,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) mom.y = thing->momy; mom.z = thing->momz*2; - //CONS_Printf("langing on slope\n"); + //CONS_Printf("Landing on slope\n"); // Reverse quantizing might could use its own function later slope->zangle = ANGLE_MAX-slope->zangle; @@ -871,16 +871,10 @@ void P_ButteredSlope(mobj_t *mo) thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down - // The strength of gravity depends on the global gravity base setting... - thrust = FixedMul(thrust, gravity); - - // ...the sector-based gravity strength... + // Let's get the gravity strength for the object... thrust = FixedMul(thrust, abs(P_GetMobjGravity(mo))); - // ...and the scale of the object. - thrust = FixedMul(thrust, mo->scale); - - // Let's also multiply by friction for good measure. + // ... and its friction against the ground for good measure. thrust = FixedMul(thrust, mo->friction); P_Thrust(mo, mo->standingslope->xydirection, thrust); From c1caf2132328985fc5abdbe65f08dc22bbd0aa8e Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 2 Jun 2016 16:51:12 +0100 Subject: [PATCH 15/31] Reccomended by MI: Dividing by the original friction value just so slopes with normal friction don't behave differently between next and this branch. --- src/p_slopes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index ed25f00f..797c6a55 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -874,8 +874,8 @@ void P_ButteredSlope(mobj_t *mo) // Let's get the gravity strength for the object... thrust = FixedMul(thrust, abs(P_GetMobjGravity(mo))); - // ... and its friction against the ground for good measure. - thrust = FixedMul(thrust, mo->friction); + // ... and its friction against the ground for good measure (divided by original friction to keep behaviour for normal slopes the same). + thrust = FixedMul(thrust, FixedDiv(mo->friction, ORIG_FRICTION)); P_Thrust(mo, mo->standingslope->xydirection, thrust); } From ba528a075ee578bd4b10d4f1bb56b424c6e1ae44 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 4 Jun 2016 19:47:40 +0100 Subject: [PATCH 16/31] Last few changes as reccomended by Red. (<3 u, no hetero) --- src/doomdef.h | 2 +- src/p_slopes.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index e645c084..cec46a32 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -431,7 +431,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Kalaron/Eternity Engine slope code (SRB2CB ported) #define ESLOPE -#if defined(ESLOPE) +#ifdef ESLOPE /// Backwards compatibility with SRB2CB's slope linedef types. /// \note A simple shim that prints a warning. #define ESLOPE_TYPESHIM diff --git a/src/p_slopes.c b/src/p_slopes.c index 797c6a55..b6338d95 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -275,7 +275,6 @@ void P_SpawnSlope_Line(int linenum) ny = -FixedDiv(line->dx, len); } - // TODO: Transform origin relative to the bounds of an individual FOF origin.x = line->v1->x + (line->v2->x - line->v1->x)/2; origin.y = line->v1->y + (line->v2->y - line->v1->y)/2; From 9d221f4f3f7817c567ad2a7f750ad58b57d1971c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 7 Jun 2016 17:37:25 +0100 Subject: [PATCH 17/31] Teetering now supports slopes properly. Behaves ALMOST as you'd expect. It gets the z position of the slope at the player coordinates when it comes to the sectorlist check (which is first), though, so there's a few oddities that are amplified with steep slopes: * If the slope's sloping away from you at a steep angle, you might not be able to step down onto it, but you won't teeter (because it's at a step-down-able height if it extended to directly beneath you) * If the slope's sloping towards you at a steep angle, you might end up in teetering frames when you're able to step down onto it (because it's NOT at a step-down-able height if it extended to directly beneath you) HOWEVER, it would be pretty obnoxious to hold back code which is functionally superior in every way otherwise, and it doesn't really seem like there's a good way to get that checked tbph --- src/p_user.c | 202 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 132 insertions(+), 70 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 461497bc..346dd3de 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2853,90 +2853,124 @@ static void P_DoTeeter(player_t *player) boolean teeter = false; boolean roverfloor; // solid 3d floors? boolean checkedforteeter = false; + fixed_t floorheight, ceilingheight; + fixed_t topheight, bottomheight; // for 3d floor usage const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter. - for (node = player->mo->touching_sectorlist; node; node = node->m_snext) +#define maxzdelta 3<<(FRACBITS-2) // 3/4 on the fixed scale + if (player->mo->standingslope && player->mo->standingslope->zdelta >= maxzdelta) // Always teeter if the slope is too steep. + teeter = true; +#undef maxzdelta + else // Let's do some checks... { - // Ledge teetering. Check if any nearby sectors are low enough from your current one. - checkedforteeter = true; - roverfloor = false; - if (node->m_sector->ffloors) + for (node = player->mo->touching_sectorlist; node; node = node->m_snext) { - ffloor_t *rover; - for (rover = node->m_sector->ffloors; rover; rover = rover->next) + // Ledge teetering. Check if any nearby sectors are low enough from your current one. + checkedforteeter = true; + roverfloor = false; + + ceilingheight = node->m_sector->ceilingheight; + floorheight = node->m_sector->floorheight; +#ifdef ESLOPE + if (node->m_sector->c_slope) + ceilingheight = P_GetZAt(node->m_sector->c_slope, player->mo->x, player->mo->y) + FixedMul(node->m_sector->c_slope->zdelta, tiptop); + if (node->m_sector->f_slope) + floorheight = P_GetZAt(node->m_sector->f_slope, player->mo->x, player->mo->y); +#endif + + if (node->m_sector->ffloors) { - if (!(rover->flags & FF_EXISTS)) continue; - - if (P_CheckSolidLava(player->mo, rover)) - ; - else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) - continue; // intangible 3d floor - - if (player->mo->eflags & MFE_VERTICALFLIP) + ffloor_t *rover; + for (rover = node->m_sector->ffloors; rover; rover = rover->next) { - if (*rover->bottomheight > node->m_sector->ceilingheight) // Above the ceiling - continue; + if (!(rover->flags & FF_EXISTS)) continue; - if (*rover->bottomheight > player->mo->z + player->mo->height + tiptop - || (*rover->topheight < player->mo->z - && player->mo->z + player->mo->height < node->m_sector->ceilingheight - tiptop)) + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; + +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y); + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); +#endif + + if (P_CheckSolidLava(player->mo, rover)) + ; + else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) + continue; // intangible 3d floor + + if (player->mo->eflags & MFE_VERTICALFLIP) { - teeter = true; - roverfloor = true; + if (bottomheight > ceilingheight) // Above the ceiling + continue; + + if (bottomheight > player->mo->z + player->mo->height + tiptop + || (topheight < player->mo->z + && player->mo->z + player->mo->height < ceilingheight - tiptop)) + { + teeter = true; + roverfloor = true; + } + else + { + teeter = false; + roverfloor = true; + break; + } } else { - teeter = false; - roverfloor = true; - break; + if (topheight < floorheight) // Below the floor + continue; + + if (topheight < player->mo->z - tiptop + || (bottomheight > player->mo->z + player->mo->height + && player->mo->z > floorheight + tiptop)) + { + teeter = true; + roverfloor = true; + } + else + { + teeter = false; + roverfloor = true; + break; + } } } + } + + if (!teeter && !roverfloor) + { + if (player->mo->eflags & MFE_VERTICALFLIP) + { + if (ceilingheight > player->mo->z + player->mo->height + tiptop) + teeter = true; + } else { - if (*rover->topheight < node->m_sector->floorheight) // Below the floor - continue; - - if (*rover->topheight < player->mo->z - tiptop - || (*rover->bottomheight > player->mo->z + player->mo->height - && player->mo->z > node->m_sector->floorheight + tiptop)) - { + if (floorheight < player->mo->z - tiptop) teeter = true; - roverfloor = true; - } - else - { - teeter = false; - roverfloor = true; - break; - } } } } - - if (!teeter && !roverfloor) - { - if (player->mo->eflags & MFE_VERTICALFLIP) - { - if (node->m_sector->ceilingheight > player->mo->z + player->mo->height + tiptop) - teeter = true; - } - else - { - if (node->m_sector->floorheight < player->mo->z - tiptop) - teeter = true; - } - } } if (checkedforteeter && !teeter) // Backup code { subsector_t *subsec[4]; // changed abcd into array instead + fixed_t subsecfloorheight[4]; + fixed_t subsecceilingheight[4]; UINT8 i; + // Following is replaced by xsign and ysign code + /* subsec[0] = R_PointInSubsector(player->mo->x + FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y + FixedMul(5*FRACUNIT, player->mo->scale)); subsec[1] = R_PointInSubsector(player->mo->x - FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y + FixedMul(5*FRACUNIT, player->mo->scale)); subsec[2] = R_PointInSubsector(player->mo->x + FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y - FixedMul(5*FRACUNIT, player->mo->scale)); subsec[3] = R_PointInSubsector(player->mo->x - FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y - FixedMul(5*FRACUNIT, player->mo->scale)); + */ teeter = false; roverfloor = false; @@ -2944,6 +2978,24 @@ static void P_DoTeeter(player_t *player) { ffloor_t *rover; +#define xsign ((i & 1) ? -1 : 1) // 0 -> 1 | 1 -> -1 | 2 -> 1 | 3 -> -1 +#define ysign ((i & 2) ? 1 : -1) // 0 -> 1 | 1 -> 1 | 2 -> -1 | 3 -> -1 + fixed_t checkx = player->mo->x + (xsign*FixedMul(5*FRACUNIT, player->mo->scale)); + fixed_t checky = player->mo->y + (ysign*FixedMul(5*FRACUNIT, player->mo->scale)); + + subsec[i] = R_PointInSubsector(checkx, checky); + + subsecceilingheight[i] = subsec[i]->sector->ceilingheight; + subsecfloorheight[i] = subsec[i]->sector->floorheight; +#ifdef ESLOPE + if (subsec[i]->sector->c_slope) + subsecceilingheight[i] = P_GetZAt(subsec[i]->sector->c_slope, checkx, checky); + if (subsec[i]->sector->f_slope) + subsecfloorheight[i] = P_GetZAt(subsec[i]->sector->f_slope, checkx, checky); +#endif +#undef xsign +#undef ysign + if (!(subsec[i]->sector->ffloors)) continue; // move on to the next subsector @@ -2951,6 +3003,16 @@ static void P_DoTeeter(player_t *player) { if (!(rover->flags & FF_EXISTS)) continue; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; + +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y); + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); +#endif + if (P_CheckSolidLava(player->mo, rover)) ; else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) @@ -2958,12 +3020,12 @@ static void P_DoTeeter(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { - if (*rover->bottomheight > subsec[i]->sector->ceilingheight) // Above the ceiling + if (bottomheight > subsecceilingheight[i]) // Above the ceiling continue; - if (*rover->bottomheight > player->mo->z + player->mo->height + tiptop - || (*rover->topheight < player->mo->z - && player->mo->z + player->mo->height < subsec[i]->sector->ceilingheight - tiptop)) + if (bottomheight > player->mo->z + player->mo->height + tiptop + || (topheight < player->mo->z + && player->mo->z + player->mo->height < subsecceilingheight[i] - tiptop)) { teeter = true; roverfloor = true; @@ -2977,12 +3039,12 @@ static void P_DoTeeter(player_t *player) } else { - if (*rover->topheight < subsec[i]->sector->floorheight) // Below the floor + if (topheight < subsecfloorheight[i]) // Below the floor continue; - if (*rover->topheight < player->mo->z - tiptop - || (*rover->bottomheight > player->mo->z + player->mo->height - && player->mo->z > subsec[i]->sector->floorheight + tiptop)) + if (topheight < player->mo->z - tiptop + || (bottomheight > player->mo->z + player->mo->height + && player->mo->z > subsecfloorheight[i] + tiptop)) { teeter = true; roverfloor = true; @@ -3000,18 +3062,18 @@ static void P_DoTeeter(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { - if (!teeter && !roverfloor && (subsec[0]->sector->ceilingheight > player->mo->ceilingz + tiptop - || subsec[1]->sector->ceilingheight > player->mo->ceilingz + tiptop - || subsec[2]->sector->ceilingheight > player->mo->ceilingz + tiptop - || subsec[3]->sector->ceilingheight > player->mo->ceilingz + tiptop)) + if (!teeter && !roverfloor && (subsecceilingheight[0] > player->mo->ceilingz + tiptop + || subsecceilingheight[1] > player->mo->ceilingz + tiptop + || subsecceilingheight[2] > player->mo->ceilingz + tiptop + || subsecceilingheight[3] > player->mo->ceilingz + tiptop)) teeter = true; } else { - if (!teeter && !roverfloor && (subsec[0]->sector->floorheight < player->mo->floorz - tiptop - || subsec[1]->sector->floorheight < player->mo->floorz - tiptop - || subsec[2]->sector->floorheight < player->mo->floorz - tiptop - || subsec[3]->sector->floorheight < player->mo->floorz - tiptop)) + if (!teeter && !roverfloor && (subsecfloorheight[0] < player->mo->floorz - tiptop + || subsecfloorheight[1] < player->mo->floorz - tiptop + || subsecfloorheight[2] < player->mo->floorz - tiptop + || subsecfloorheight[3] < player->mo->floorz - tiptop)) teeter = true; } } From 9df72a966e8b5e3668f704bc6ba7a54b1edd4931 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 7 Jun 2016 17:55:03 +0100 Subject: [PATCH 18/31] Some simplifications after MI pointed out that the sector heights are the only thing accessed outside of the iteration. --- src/p_user.c | 56 ++++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 346dd3de..ba252b49 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2959,19 +2959,11 @@ static void P_DoTeeter(player_t *player) if (checkedforteeter && !teeter) // Backup code { - subsector_t *subsec[4]; // changed abcd into array instead - fixed_t subsecfloorheight[4]; - fixed_t subsecceilingheight[4]; + sector_t *sec; + fixed_t secfloorheight[4]; + fixed_t secceilingheight[4]; UINT8 i; - // Following is replaced by xsign and ysign code - /* - subsec[0] = R_PointInSubsector(player->mo->x + FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y + FixedMul(5*FRACUNIT, player->mo->scale)); - subsec[1] = R_PointInSubsector(player->mo->x - FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y + FixedMul(5*FRACUNIT, player->mo->scale)); - subsec[2] = R_PointInSubsector(player->mo->x + FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y - FixedMul(5*FRACUNIT, player->mo->scale)); - subsec[3] = R_PointInSubsector(player->mo->x - FixedMul(5*FRACUNIT, player->mo->scale), player->mo->y - FixedMul(5*FRACUNIT, player->mo->scale)); - */ - teeter = false; roverfloor = false; for (i = 0; i < 4; i++) @@ -2983,23 +2975,23 @@ static void P_DoTeeter(player_t *player) fixed_t checkx = player->mo->x + (xsign*FixedMul(5*FRACUNIT, player->mo->scale)); fixed_t checky = player->mo->y + (ysign*FixedMul(5*FRACUNIT, player->mo->scale)); - subsec[i] = R_PointInSubsector(checkx, checky); + sec = R_PointInSubsector(checkx, checky)->sector; - subsecceilingheight[i] = subsec[i]->sector->ceilingheight; - subsecfloorheight[i] = subsec[i]->sector->floorheight; + secceilingheight[i] = sec->ceilingheight; + secfloorheight[i] = sec->floorheight; #ifdef ESLOPE - if (subsec[i]->sector->c_slope) - subsecceilingheight[i] = P_GetZAt(subsec[i]->sector->c_slope, checkx, checky); - if (subsec[i]->sector->f_slope) - subsecfloorheight[i] = P_GetZAt(subsec[i]->sector->f_slope, checkx, checky); + if (sec->c_slope) + secceilingheight[i] = P_GetZAt(sec->c_slope, checkx, checky); + if (sec->f_slope) + secfloorheight[i] = P_GetZAt(sec->f_slope, checkx, checky); #endif #undef xsign #undef ysign - if (!(subsec[i]->sector->ffloors)) + if (!(sec->ffloors)) continue; // move on to the next subsector - for (rover = subsec[i]->sector->ffloors; rover; rover = rover->next) + for (rover = sec->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS)) continue; @@ -3020,12 +3012,12 @@ static void P_DoTeeter(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { - if (bottomheight > subsecceilingheight[i]) // Above the ceiling + if (bottomheight > secceilingheight[i]) // Above the ceiling continue; if (bottomheight > player->mo->z + player->mo->height + tiptop || (topheight < player->mo->z - && player->mo->z + player->mo->height < subsecceilingheight[i] - tiptop)) + && player->mo->z + player->mo->height < secceilingheight[i] - tiptop)) { teeter = true; roverfloor = true; @@ -3039,12 +3031,12 @@ static void P_DoTeeter(player_t *player) } else { - if (topheight < subsecfloorheight[i]) // Below the floor + if (topheight < secfloorheight[i]) // Below the floor continue; if (topheight < player->mo->z - tiptop || (bottomheight > player->mo->z + player->mo->height - && player->mo->z > subsecfloorheight[i] + tiptop)) + && player->mo->z > secfloorheight[i] + tiptop)) { teeter = true; roverfloor = true; @@ -3062,18 +3054,18 @@ static void P_DoTeeter(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { - if (!teeter && !roverfloor && (subsecceilingheight[0] > player->mo->ceilingz + tiptop - || subsecceilingheight[1] > player->mo->ceilingz + tiptop - || subsecceilingheight[2] > player->mo->ceilingz + tiptop - || subsecceilingheight[3] > player->mo->ceilingz + tiptop)) + if (!teeter && !roverfloor && (secceilingheight[0] > player->mo->ceilingz + tiptop + || secceilingheight[1] > player->mo->ceilingz + tiptop + || secceilingheight[2] > player->mo->ceilingz + tiptop + || secceilingheight[3] > player->mo->ceilingz + tiptop)) teeter = true; } else { - if (!teeter && !roverfloor && (subsecfloorheight[0] < player->mo->floorz - tiptop - || subsecfloorheight[1] < player->mo->floorz - tiptop - || subsecfloorheight[2] < player->mo->floorz - tiptop - || subsecfloorheight[3] < player->mo->floorz - tiptop)) + if (!teeter && !roverfloor && (secfloorheight[0] < player->mo->floorz - tiptop + || secfloorheight[1] < player->mo->floorz - tiptop + || secfloorheight[2] < player->mo->floorz - tiptop + || secfloorheight[3] < player->mo->floorz - tiptop)) teeter = true; } } From aa113045d7c10dc8d412549eab7dea8feb6c8628 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 7 Jun 2016 18:18:47 +0100 Subject: [PATCH 19/31] MI pointed out opportunity for more optimisation, and who could resist? --- src/p_user.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ba252b49..9eff0ae2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2960,9 +2960,9 @@ static void P_DoTeeter(player_t *player) if (checkedforteeter && !teeter) // Backup code { sector_t *sec; - fixed_t secfloorheight[4]; - fixed_t secceilingheight[4]; UINT8 i; + fixed_t highestceilingheight = INT32_MIN; + fixed_t lowestfloorheight = INT32_MAX; teeter = false; roverfloor = false; @@ -2977,14 +2977,16 @@ static void P_DoTeeter(player_t *player) sec = R_PointInSubsector(checkx, checky)->sector; - secceilingheight[i] = sec->ceilingheight; - secfloorheight[i] = sec->floorheight; + fixed_t ceilingheight = sec->ceilingheight; + fixed_t floorheight = sec->floorheight; #ifdef ESLOPE if (sec->c_slope) - secceilingheight[i] = P_GetZAt(sec->c_slope, checkx, checky); + ceilingheight = P_GetZAt(sec->c_slope, checkx, checky); if (sec->f_slope) - secfloorheight[i] = P_GetZAt(sec->f_slope, checkx, checky); + floorheight = P_GetZAt(sec->f_slope, checkx, checky); #endif + highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight; + lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight; #undef xsign #undef ysign @@ -3012,12 +3014,12 @@ static void P_DoTeeter(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { - if (bottomheight > secceilingheight[i]) // Above the ceiling + if (bottomheight > ceilingheight) // Above the ceiling continue; if (bottomheight > player->mo->z + player->mo->height + tiptop || (topheight < player->mo->z - && player->mo->z + player->mo->height < secceilingheight[i] - tiptop)) + && player->mo->z + player->mo->height < ceilingheight - tiptop)) { teeter = true; roverfloor = true; @@ -3031,12 +3033,12 @@ static void P_DoTeeter(player_t *player) } else { - if (topheight < secfloorheight[i]) // Below the floor + if (topheight < floorheight) // Below the floor continue; if (topheight < player->mo->z - tiptop || (bottomheight > player->mo->z + player->mo->height - && player->mo->z > secfloorheight[i] + tiptop)) + && player->mo->z > floorheight + tiptop)) { teeter = true; roverfloor = true; @@ -3054,18 +3056,12 @@ static void P_DoTeeter(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { - if (!teeter && !roverfloor && (secceilingheight[0] > player->mo->ceilingz + tiptop - || secceilingheight[1] > player->mo->ceilingz + tiptop - || secceilingheight[2] > player->mo->ceilingz + tiptop - || secceilingheight[3] > player->mo->ceilingz + tiptop)) + if (!teeter && !roverfloor && (highestceilingheight > player->mo->ceilingz + tiptop)) teeter = true; } else { - if (!teeter && !roverfloor && (secfloorheight[0] < player->mo->floorz - tiptop - || secfloorheight[1] < player->mo->floorz - tiptop - || secfloorheight[2] < player->mo->floorz - tiptop - || secfloorheight[3] < player->mo->floorz - tiptop)) + if (!teeter && !roverfloor && (lowestfloorheight < player->mo->floorz - tiptop)) teeter = true; } } From 51c769247a41de31d734f5d1996776ea8d2fdfb9 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 7 Jun 2016 19:44:43 +0100 Subject: [PATCH 20/31] Compiling fixes. --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 9eff0ae2..2e9f0b29 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2977,8 +2977,8 @@ static void P_DoTeeter(player_t *player) sec = R_PointInSubsector(checkx, checky)->sector; - fixed_t ceilingheight = sec->ceilingheight; - fixed_t floorheight = sec->floorheight; + ceilingheight = sec->ceilingheight; + floorheight = sec->floorheight; #ifdef ESLOPE if (sec->c_slope) ceilingheight = P_GetZAt(sec->c_slope, checkx, checky); From 19b186e52e004098f6b43bff78e6ea82d01c8127 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 9 Jun 2016 15:16:25 +0100 Subject: [PATCH 21/31] Changed teetering to match the discoveries made about it in the sectorlist_traversal branch in a way that matches my revamps here, since I DID change a lot. --- src/p_user.c | 104 ++------------------------------------------------- 1 file changed, 4 insertions(+), 100 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 2e9f0b29..313dad1d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2852,8 +2852,8 @@ static void P_DoTeeter(player_t *player) msecnode_t *node; boolean teeter = false; boolean roverfloor; // solid 3d floors? - boolean checkedforteeter = false; fixed_t floorheight, ceilingheight; + fixed_t highestceilingheight, lowestfloorheight; fixed_t topheight, bottomheight; // for 3d floor usage const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter. @@ -2862,107 +2862,11 @@ static void P_DoTeeter(player_t *player) teeter = true; #undef maxzdelta else // Let's do some checks... - { - for (node = player->mo->touching_sectorlist; node; node = node->m_snext) - { - // Ledge teetering. Check if any nearby sectors are low enough from your current one. - checkedforteeter = true; - roverfloor = false; - - ceilingheight = node->m_sector->ceilingheight; - floorheight = node->m_sector->floorheight; -#ifdef ESLOPE - if (node->m_sector->c_slope) - ceilingheight = P_GetZAt(node->m_sector->c_slope, player->mo->x, player->mo->y) + FixedMul(node->m_sector->c_slope->zdelta, tiptop); - if (node->m_sector->f_slope) - floorheight = P_GetZAt(node->m_sector->f_slope, player->mo->x, player->mo->y); -#endif - - if (node->m_sector->ffloors) - { - ffloor_t *rover; - for (rover = node->m_sector->ffloors; rover; rover = rover->next) - { - if (!(rover->flags & FF_EXISTS)) continue; - - topheight = *rover->topheight; - bottomheight = *rover->bottomheight; - -#ifdef ESLOPE - if (*rover->t_slope) - topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y); - if (*rover->b_slope) - bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); -#endif - - if (P_CheckSolidLava(player->mo, rover)) - ; - else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) - continue; // intangible 3d floor - - if (player->mo->eflags & MFE_VERTICALFLIP) - { - if (bottomheight > ceilingheight) // Above the ceiling - continue; - - if (bottomheight > player->mo->z + player->mo->height + tiptop - || (topheight < player->mo->z - && player->mo->z + player->mo->height < ceilingheight - tiptop)) - { - teeter = true; - roverfloor = true; - } - else - { - teeter = false; - roverfloor = true; - break; - } - } - else - { - if (topheight < floorheight) // Below the floor - continue; - - if (topheight < player->mo->z - tiptop - || (bottomheight > player->mo->z + player->mo->height - && player->mo->z > floorheight + tiptop)) - { - teeter = true; - roverfloor = true; - } - else - { - teeter = false; - roverfloor = true; - break; - } - } - } - } - - if (!teeter && !roverfloor) - { - if (player->mo->eflags & MFE_VERTICALFLIP) - { - if (ceilingheight > player->mo->z + player->mo->height + tiptop) - teeter = true; - } - else - { - if (floorheight < player->mo->z - tiptop) - teeter = true; - } - } - } - } - - if (checkedforteeter && !teeter) // Backup code { sector_t *sec; UINT8 i; - fixed_t highestceilingheight = INT32_MIN; - fixed_t lowestfloorheight = INT32_MAX; + highestceilingheight = INT32_MIN; + lowestfloorheight = INT32_MAX; teeter = false; roverfloor = false; @@ -3197,7 +3101,7 @@ teeterdone: if ((player->mo->state == &states[S_PLAY_STND] || player->mo->state == &states[S_PLAY_TAP1] || player->mo->state == &states[S_PLAY_TAP2] || player->mo->state == &states[S_PLAY_SUPERSTAND])) P_SetPlayerMobjState(player->mo, S_PLAY_TEETER1); } - else if (checkedforteeter && (player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER])) + else if ((player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER])) P_SetPlayerMobjState(player->mo, S_PLAY_STND); } From c5ff41d6a640f34d833a61c6bc05472938efc7d4 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 9 Jun 2016 15:20:45 +0100 Subject: [PATCH 22/31] Fixed compile error and placed the #undefs for xsign and ysign in more logical places. --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 313dad1d..ca022413 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2878,6 +2878,8 @@ static void P_DoTeeter(player_t *player) #define ysign ((i & 2) ? 1 : -1) // 0 -> 1 | 1 -> 1 | 2 -> -1 | 3 -> -1 fixed_t checkx = player->mo->x + (xsign*FixedMul(5*FRACUNIT, player->mo->scale)); fixed_t checky = player->mo->y + (ysign*FixedMul(5*FRACUNIT, player->mo->scale)); +#undef xsign +#undef ysign sec = R_PointInSubsector(checkx, checky)->sector; @@ -2891,8 +2893,6 @@ static void P_DoTeeter(player_t *player) #endif highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight; lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight; -#undef xsign -#undef ysign if (!(sec->ffloors)) continue; // move on to the next subsector From 1723bb55f9cd5a579670c9c1fe594c449691ef83 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 9 Jun 2016 15:24:23 +0100 Subject: [PATCH 23/31] Okay, NOW I fixed the compile error. Forgot to stage this. --- src/p_user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index ca022413..49996679 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2849,7 +2849,6 @@ static boolean PIT_CheckSolidsTeeter(mobj_t *thing) // static void P_DoTeeter(player_t *player) { - msecnode_t *node; boolean teeter = false; boolean roverfloor; // solid 3d floors? fixed_t floorheight, ceilingheight; From 661da15146d4385891fbc4d7e82a518b2bc23034 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 9 Jun 2016 18:16:13 +0100 Subject: [PATCH 24/31] Reinforcing encapsulation I originally broke down to allow for P_GetMobjGravity. When I first wrote this, I thought the .h file that contained a function declaration needed to have the same name as the .c file the function was in. Now I know that's not the case, off to p_local.h with you. --- src/lua_baselib.c | 1 - src/p_local.h | 1 + src/p_mobj.h | 3 --- src/p_slopes.c | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index c88ece50..e8e8fd02 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -13,7 +13,6 @@ #include "doomdef.h" #ifdef HAVE_BLUA #include "p_local.h" -#include "p_mobj.h" // So we can have P_GetMobjGravity #include "p_setup.h" // So we can have P_SetupLevelSky #include "z_zone.h" #include "r_main.h" diff --git a/src/p_local.h b/src/p_local.h index c8930aed..5ffd473f 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -251,6 +251,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype #endif void P_ColorTeamMissile(mobj_t *missile, player_t *source); SINT8 P_MobjFlip(mobj_t *mobj); +fixed_t P_GetMobjGravity(mobj_t *mo); boolean P_WeaponOrPanel(mobjtype_t type); boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled); diff --git a/src/p_mobj.h b/src/p_mobj.h index de7f0c8d..9542ce8b 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -425,9 +425,6 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum); // check mobj against water content, before movement code void P_MobjCheckWater(mobj_t *mobj); -// get mobj gravity -fixed_t P_GetMobjGravity(mobj_t *mo); - // Player spawn points void P_SpawnPlayer(INT32 playernum); void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing); diff --git a/src/p_slopes.c b/src/p_slopes.c index b6338d95..8df94e75 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -16,7 +16,6 @@ #include "m_bbox.h" #include "z_zone.h" #include "p_local.h" -#include "p_mobj.h" #include "p_spec.h" #include "p_slopes.h" #include "p_setup.h" From 9e87f6d85d9e9b874dcfa876a35272720cdb1b12 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 10 Jun 2016 22:45:42 +0100 Subject: [PATCH 25/31] i did so much in this branch, so UPGRADE ME TO PROGRAMMER note: once this is merged into internal, you should probably remove me from "programming assistance" so i'm not duplicated for no clear reason. unless you want me to slowly take over every section in the credits >:3c --- src/f_finale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/f_finale.c b/src/f_finale.c index 776bec98..efc2a127 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -973,6 +973,7 @@ static const char *credits[] = { "Callum Dickinson", "Scott \"Graue\" Feeney", "Nathan \"Jazz\" Giroux", + "Vivian \"toaster\" Grannell", "Thomas \"Shadow Hog\" Igoe", "\"Monster\" Iestyn Jealous", "Ronald \"Furyhunter\" Kinard", // The SDL2 port From 2c676eea433f883b5812a6f712e189dab2fc9a49 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 12 Jun 2016 19:27:34 +0100 Subject: [PATCH 26/31] P_ReverseQuantiseMomentumToSlope is now a function. (I was thinking about a macro, but couldn't get it down.) Also, the teetering angle on slopes is now FRACUNIT/2 because there's literally no way to stand still on a slope that steep unless it doesn't have physics. --- src/p_mobj.c | 5 +---- src/p_slopes.c | 18 ++++++++++++------ src/p_slopes.h | 1 + src/p_user.c | 10 +++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 843123d5..2cf94e83 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2377,10 +2377,7 @@ static boolean P_ZMovement(mobj_t *mo) if ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) { mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope; - // Reverse quantizing might could use its own function later - mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle; - P_QuantizeMomentumToSlope(&mom, mo->standingslope); - mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle; + P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope); } #endif diff --git a/src/p_slopes.c b/src/p_slopes.c index 8df94e75..d939fee9 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -767,6 +767,17 @@ void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) FV3_Rotate(momentum, &axis, slope->zangle >> ANGLETOFINESHIFT); } +// +// P_ReverseQuantizeMomentumToSlope +// +// When given a vector, rotates and aligns it to a flat surface (from being relative to a given slope) +void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) +{ + slope->zangle = InvAngle(slope->zangle); + P_QuantizeMomentumToSlope(momentum, slope); + slope->zangle = InvAngle(slope->zangle); +} + // // P_SlopeLaunch // @@ -810,12 +821,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) mom.y = thing->momy; mom.z = thing->momz*2; - //CONS_Printf("Landing on slope\n"); - - // Reverse quantizing might could use its own function later - slope->zangle = ANGLE_MAX-slope->zangle; - P_QuantizeMomentumToSlope(&mom, slope); - slope->zangle = ANGLE_MAX-slope->zangle; + P_ReverseQuantizeMomentumToSlope(&mom, slope); if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope thing->momx = mom.x; diff --git a/src/p_slopes.h b/src/p_slopes.h index dd9b6f2d..de38f1d9 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -35,6 +35,7 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y); // Lots of physics-based bullshit void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); +void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); void P_SlopeLaunch(mobj_t *mo); void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope); void P_ButteredSlope(mobj_t *mo); diff --git a/src/p_user.c b/src/p_user.c index 49996679..7bf2b1f6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1851,12 +1851,8 @@ static void P_CheckBouncySectors(player_t *player) momentum.y = player->mo->momy; momentum.z = player->mo->momz*2; - if (slope) { - // Reverse quantizing might could use its own function later - slope->zangle = ANGLE_MAX-slope->zangle; - P_QuantizeMomentumToSlope(&momentum, slope); - slope->zangle = ANGLE_MAX-slope->zangle; - } + if (slope) + P_ReverseQuantizeMomentumToSlope(&momentum, slope); newmom = momentum.z = -FixedMul(momentum.z,linedist)/2; #else @@ -2856,7 +2852,7 @@ static void P_DoTeeter(player_t *player) fixed_t topheight, bottomheight; // for 3d floor usage const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter. -#define maxzdelta 3<<(FRACBITS-2) // 3/4 on the fixed scale +#define maxzdelta 1<<(FRACBITS-1) // 1/2 on the fixed scale if (player->mo->standingslope && player->mo->standingslope->zdelta >= maxzdelta) // Always teeter if the slope is too steep. teeter = true; #undef maxzdelta From 3fe87eff97641ca484010f8dba91c2065395f8d2 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 18 Jun 2016 23:55:43 +0100 Subject: [PATCH 27/31] Disabling the functionality of SL_NOPHYSICS for 2.1 patches by never applying it --- src/p_slopes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index d939fee9..f134b20e 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -250,7 +250,7 @@ void P_SpawnSlope_Line(int linenum) UINT8 flags = 0; // Slope flags if (line->flags & ML_NOSONIC) - flags |= SL_NOPHYSICS; + ; // flags |= SL_NOPHYSICS; - disabled for 2.1 if (line->flags & ML_NOTAILS) flags |= SL_NODYNAMIC; if (line->flags & ML_NOKNUX) @@ -686,7 +686,7 @@ void P_ResetDynamicSlopes(void) { UINT8 flags = SL_VERTEXSLOPE; if (lines[i].flags & ML_NOSONIC) - flags |= SL_NOPHYSICS; + ; // flags |= SL_NOPHYSICS; - disabled for 2.1 if (!(lines[i].flags & ML_NOTAILS)) flags |= SL_NODYNAMIC; From f5f2c4ad48a8d3f6236f9578089559ea96d6f3d9 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 19 Jun 2016 16:38:04 +0100 Subject: [PATCH 28/31] Revert "Okay, NOW I fixed the compile error. Forgot to stage this." This reverts commit 1723bb55f9cd5a579670c9c1fe594c449691ef83. --- src/p_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_user.c b/src/p_user.c index 7bf2b1f6..36cf71b0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2845,6 +2845,7 @@ static boolean PIT_CheckSolidsTeeter(mobj_t *thing) // static void P_DoTeeter(player_t *player) { + msecnode_t *node; boolean teeter = false; boolean roverfloor; // solid 3d floors? fixed_t floorheight, ceilingheight; From 1147428904e2bcec78758d4a7796ada0de65bbde Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 19 Jun 2016 16:38:11 +0100 Subject: [PATCH 29/31] Revert "Changed teetering to match the discoveries made about it in the sectorlist_traversal branch in a way that matches my revamps here, since I DID change a lot." This reverts commit 19b186e52e004098f6b43bff78e6ea82d01c8127. --- src/p_user.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 100 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 36cf71b0..317523a3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2848,8 +2848,8 @@ static void P_DoTeeter(player_t *player) msecnode_t *node; boolean teeter = false; boolean roverfloor; // solid 3d floors? + boolean checkedforteeter = false; fixed_t floorheight, ceilingheight; - fixed_t highestceilingheight, lowestfloorheight; fixed_t topheight, bottomheight; // for 3d floor usage const fixed_t tiptop = FixedMul(MAXSTEPMOVE, player->mo->scale); // Distance you have to be above the ground in order to teeter. @@ -2858,11 +2858,107 @@ static void P_DoTeeter(player_t *player) teeter = true; #undef maxzdelta else // Let's do some checks... + { + for (node = player->mo->touching_sectorlist; node; node = node->m_snext) + { + // Ledge teetering. Check if any nearby sectors are low enough from your current one. + checkedforteeter = true; + roverfloor = false; + + ceilingheight = node->m_sector->ceilingheight; + floorheight = node->m_sector->floorheight; +#ifdef ESLOPE + if (node->m_sector->c_slope) + ceilingheight = P_GetZAt(node->m_sector->c_slope, player->mo->x, player->mo->y) + FixedMul(node->m_sector->c_slope->zdelta, tiptop); + if (node->m_sector->f_slope) + floorheight = P_GetZAt(node->m_sector->f_slope, player->mo->x, player->mo->y); +#endif + + if (node->m_sector->ffloors) + { + ffloor_t *rover; + for (rover = node->m_sector->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS)) continue; + + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; + +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y); + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); +#endif + + if (P_CheckSolidLava(player->mo, rover)) + ; + else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) + continue; // intangible 3d floor + + if (player->mo->eflags & MFE_VERTICALFLIP) + { + if (bottomheight > ceilingheight) // Above the ceiling + continue; + + if (bottomheight > player->mo->z + player->mo->height + tiptop + || (topheight < player->mo->z + && player->mo->z + player->mo->height < ceilingheight - tiptop)) + { + teeter = true; + roverfloor = true; + } + else + { + teeter = false; + roverfloor = true; + break; + } + } + else + { + if (topheight < floorheight) // Below the floor + continue; + + if (topheight < player->mo->z - tiptop + || (bottomheight > player->mo->z + player->mo->height + && player->mo->z > floorheight + tiptop)) + { + teeter = true; + roverfloor = true; + } + else + { + teeter = false; + roverfloor = true; + break; + } + } + } + } + + if (!teeter && !roverfloor) + { + if (player->mo->eflags & MFE_VERTICALFLIP) + { + if (ceilingheight > player->mo->z + player->mo->height + tiptop) + teeter = true; + } + else + { + if (floorheight < player->mo->z - tiptop) + teeter = true; + } + } + } + } + + if (checkedforteeter && !teeter) // Backup code { sector_t *sec; UINT8 i; - highestceilingheight = INT32_MIN; - lowestfloorheight = INT32_MAX; + fixed_t highestceilingheight = INT32_MIN; + fixed_t lowestfloorheight = INT32_MAX; teeter = false; roverfloor = false; @@ -3097,7 +3193,7 @@ teeterdone: if ((player->mo->state == &states[S_PLAY_STND] || player->mo->state == &states[S_PLAY_TAP1] || player->mo->state == &states[S_PLAY_TAP2] || player->mo->state == &states[S_PLAY_SUPERSTAND])) P_SetPlayerMobjState(player->mo, S_PLAY_TEETER1); } - else if ((player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER])) + else if (checkedforteeter && (player->mo->state == &states[S_PLAY_TEETER1] || player->mo->state == &states[S_PLAY_TEETER2] || player->mo->state == &states[S_PLAY_SUPERTEETER])) P_SetPlayerMobjState(player->mo, S_PLAY_STND); } From 86721f1457b059b04474ca2b26ee43b920723a18 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 19 Jun 2016 17:29:04 +0100 Subject: [PATCH 30/31] Compilation fix of the patch to disable this feature ( :c ). --- src/p_slopes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index f134b20e..936af442 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -249,8 +249,8 @@ void P_SpawnSlope_Line(int linenum) boolean backceil = (special == 711 || special == 712 || special == 703); UINT8 flags = 0; // Slope flags - if (line->flags & ML_NOSONIC) - ; // flags |= SL_NOPHYSICS; - disabled for 2.1 + /*if (line->flags & ML_NOSONIC) + flags |= SL_NOPHYSICS; - disabled for 2.1*/ if (line->flags & ML_NOTAILS) flags |= SL_NODYNAMIC; if (line->flags & ML_NOKNUX) @@ -685,8 +685,8 @@ void P_ResetDynamicSlopes(void) { size_t which = lines[i].special; UINT8 flags = SL_VERTEXSLOPE; - if (lines[i].flags & ML_NOSONIC) - ; // flags |= SL_NOPHYSICS; - disabled for 2.1 + /*if (line->flags & ML_NOSONIC) + flags |= SL_NOPHYSICS; - disabled for 2.1*/ if (!(lines[i].flags & ML_NOTAILS)) flags |= SL_NODYNAMIC; From 71f5d4ea85d12356aacc15b5bd0e34e26af10e72 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 20 Jun 2016 00:20:20 +0100 Subject: [PATCH 31/31] ...completely misunderstood the reasons we weren't merging toast_slopes, mom holy fuck i'm stupid and bad Enjoy your slopes without physics, people :D --- src/f_finale.c | 2 +- src/p_slopes.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index efc2a127..784d8204 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -973,7 +973,6 @@ static const char *credits[] = { "Callum Dickinson", "Scott \"Graue\" Feeney", "Nathan \"Jazz\" Giroux", - "Vivian \"toaster\" Grannell", "Thomas \"Shadow Hog\" Igoe", "\"Monster\" Iestyn Jealous", "Ronald \"Furyhunter\" Kinard", // The SDL2 port @@ -987,6 +986,7 @@ static const char *credits[] = { "\"chi.miru\"", // Red's secret weapon, the REAL reason slopes exist (also helped port drawing code from ZDoom) "Andrew \"orospakr\" Clunis", "Gregor \"Oogaland\" Dick", + "Vivian \"toaster\" Grannell", "Julio \"Chaos Zero 64\" Guir", "\"Kalaron\"", // Coded some of Sryder13's collection of OpenGL fixes, especially fog "Matthew \"Shuffle\" Marsalko", diff --git a/src/p_slopes.c b/src/p_slopes.c index 936af442..d939fee9 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -249,8 +249,8 @@ void P_SpawnSlope_Line(int linenum) boolean backceil = (special == 711 || special == 712 || special == 703); UINT8 flags = 0; // Slope flags - /*if (line->flags & ML_NOSONIC) - flags |= SL_NOPHYSICS; - disabled for 2.1*/ + if (line->flags & ML_NOSONIC) + flags |= SL_NOPHYSICS; if (line->flags & ML_NOTAILS) flags |= SL_NODYNAMIC; if (line->flags & ML_NOKNUX) @@ -685,8 +685,8 @@ void P_ResetDynamicSlopes(void) { size_t which = lines[i].special; UINT8 flags = SL_VERTEXSLOPE; - /*if (line->flags & ML_NOSONIC) - flags |= SL_NOPHYSICS; - disabled for 2.1*/ + if (lines[i].flags & ML_NOSONIC) + flags |= SL_NOPHYSICS; if (!(lines[i].flags & ML_NOTAILS)) flags |= SL_NODYNAMIC;