From b8345aaf27ab32dd7cee8960143fc63bd666f5c2 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 22 Sep 2016 00:13:34 +0100 Subject: [PATCH 1/6] Solid objects are now no longer selectively intangible on slopes. HOWEVER, since these changes to PIT_CheckThing do raise questions about whether there may be unintended side effects here. As a result, I may remake this for internal only if necessary. --- src/p_map.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index c4616db48..13496bef9 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -985,7 +985,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } - topz = thing->z - FixedMul(FRACUNIT, thing->scale); + topz = thing->z - thing->scale; // block only when jumping not high enough, // (dont climb max. 24units while already in air) @@ -996,7 +996,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_SPRING) ; - else if (topz < tmceilingz && tmthing->z+tmthing->height <= thing->z+thing->height) + else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) { tmceilingz = topz; #ifdef ESLOPE @@ -1022,7 +1022,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } - topz = thing->z + thing->height + FixedMul(FRACUNIT, thing->scale); + topz = thing->z + thing->height + thing->scale; // block only when jumping not high enough, // (dont climb max. 24units while already in air) @@ -1032,7 +1032,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_SPRING) ; - else if (topz > tmfloorz && tmthing->z >= thing->z) + else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) { tmfloorz = topz; #ifdef ESLOPE From fa16abf7ae8cf0468bb3237047687eefca997e6e Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 22 Sep 2016 11:15:08 +0100 Subject: [PATCH 2/6] Fixed the thing where if you thok into a solid object you spin really fast in the air without moving OR losing your momentum. --- src/p_map.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 13496bef9..a3f34aa8a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -989,12 +989,18 @@ static boolean PIT_CheckThing(mobj_t *thing) // block only when jumping not high enough, // (dont climb max. 24units while already in air) - // if not in air, let P_TryMove() decide if it's not too high + // since return false doesn't handle momentum properly, + // we lie to P_TryMove() so it's always too high if (tmthing->player && tmthing->z + tmthing->height > topz && tmthing->z + tmthing->height < tmthing->ceilingz) - return false; // block while in air - - if (thing->flags & MF_SPRING) + { + tmceilingz = INT32_MIN; // block while in air +#ifdef ESLOPE + tmceilingslope = NULL; +#endif + tmfloorthing = thing; // needed for side collision + } + else if (thing->flags & MF_SPRING) ; else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) { @@ -1026,11 +1032,18 @@ static boolean PIT_CheckThing(mobj_t *thing) // block only when jumping not high enough, // (dont climb max. 24units while already in air) - // if not in air, let P_TryMove() decide if it's not too high - if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz) - return false; // block while in air - - if (thing->flags & MF_SPRING) + // since return false doesn't handle momentum properly, + // we lie to P_TryMove() so it's always too high + if (tmthing->player && tmthing->z < topz + && tmthing->z > tmthing->floorz) + { + tmfloorz = INT32_MAX; // block while in air +#ifdef ESLOPE + tmfloorslope = NULL; +#endif + tmfloorthing = thing; // needed for side collision + } + else if (thing->flags & MF_SPRING) ; else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) { From 0568712a5e3bee3335e5e0f9256c1ad07f78d25a Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 22 Sep 2016 12:01:13 +0100 Subject: [PATCH 3/6] Prevent overflow when attempting to calculate the space between floor and ceiling. (I didn't notice any bugs as a result of the previous behvaiour, but you never know.) --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index a3f34aa8a..8b8c6c07d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -994,7 +994,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->player && tmthing->z + tmthing->height > topz && tmthing->z + tmthing->height < tmthing->ceilingz) { - tmceilingz = INT32_MIN; // block while in air + tmfloorz = tmceilingz = INT32_MIN; // block while in air #ifdef ESLOPE tmceilingslope = NULL; #endif @@ -1037,7 +1037,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz) { - tmfloorz = INT32_MAX; // block while in air + tmfloorz = tmceilingz = INT32_MAX; // block while in air #ifdef ESLOPE tmfloorslope = NULL; #endif From 8ad72232bea1b1b093fe9a36ca189e1c90db5127 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 22 Sep 2016 21:15:12 +0100 Subject: [PATCH 4/6] Helpful explanatory comments to assauge MI's fears. --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 8b8c6c07d..6a555953e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -985,7 +985,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } - topz = thing->z - thing->scale; + topz = thing->z - thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways // block only when jumping not high enough, // (dont climb max. 24units while already in air) @@ -1028,7 +1028,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; } - topz = thing->z + thing->height + thing->scale; + topz = thing->z + thing->height + thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways // block only when jumping not high enough, // (dont climb max. 24units while already in air) From 8881a413f3c3a652675e4f451ebb849f17a8ac10 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 27 Sep 2016 17:17:23 +0100 Subject: [PATCH 5/6] Fixed that really annoying bug where you disappear when spindashing on top of a FOF whilst wearing a multi-layer shield. (the problem was that MT_OVERLAY's default radius and height were never getting changed from 1*FRACUNIT, and that meant that when you spindashed, the game considered it completely below the surface of the flat you were standing on. Since you're not usually clipped on flats that don't belong to FOFs, we didn't notice this issue sooner.) --- src/p_mobj.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5e5961d41..b35b72867 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5930,6 +5930,8 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) P_UnsetThingPosition(thing); thing->x = thing->target->x; thing->y = thing->target->y; + thing->radius = thing->target->radius; + thing->height = thing->target->height; if (thing->eflags & MFE_VERTICALFLIP) thing->z = thing->target->z + thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) - FixedMul(2*FRACUNIT, thing->target->scale); else @@ -6048,6 +6050,8 @@ void P_RunOverlays(void) P_UnsetThingPosition(mo); mo->x = destx; mo->y = desty; + mo->radius = mo->target->radius; + mo->height = mo->target->height; if (mo->eflags & MFE_VERTICALFLIP) mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs; else From 8025ef2f79ec32e71053e7d9eaeb4e7f8c89972a Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 29 Oct 2016 16:08:06 +0100 Subject: [PATCH 6/6] At MI's suggestion (shields don't NEED to be tweaked, just overlays) --- src/p_mobj.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index b35b72867..b3842da15 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5930,8 +5930,6 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) P_UnsetThingPosition(thing); thing->x = thing->target->x; thing->y = thing->target->y; - thing->radius = thing->target->radius; - thing->height = thing->target->height; if (thing->eflags & MFE_VERTICALFLIP) thing->z = thing->target->z + thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) - FixedMul(2*FRACUNIT, thing->target->scale); else