Merge branch 'polyobj-collide-fix' into 'master'
Polyobject collide fix See merge request STJr/SRB2Internal!288
This commit is contained in:
commit
24526d4758
227
src/p_maputl.c
227
src/p_maputl.c
|
@ -419,10 +419,6 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
if (front->ffloors || back->ffloors)
|
if (front->ffloors || back->ffloors)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
fixed_t highestceiling = highceiling;
|
|
||||||
fixed_t lowestceiling = opentop;
|
|
||||||
fixed_t highestfloor = openbottom;
|
|
||||||
fixed_t lowestfloor = lowfloor;
|
|
||||||
fixed_t delta1, delta2;
|
fixed_t delta1, delta2;
|
||||||
|
|
||||||
// Check for frontsector's fake floors
|
// Check for frontsector's fake floors
|
||||||
|
@ -438,15 +434,15 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
|
|
||||||
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
|
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
|
||||||
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
||||||
if (bottomheight < lowestceiling && delta1 >= delta2)
|
if (bottomheight < opentop && delta1 >= delta2)
|
||||||
lowestceiling = bottomheight;
|
opentop = bottomheight;
|
||||||
else if (bottomheight < highestceiling && delta1 >= delta2)
|
else if (bottomheight < highceiling && delta1 >= delta2)
|
||||||
highestceiling = bottomheight;
|
highceiling = bottomheight;
|
||||||
|
|
||||||
if (topheight > highestfloor && delta1 < delta2)
|
if (topheight > openbottom && delta1 < delta2)
|
||||||
highestfloor = topheight;
|
openbottom = topheight;
|
||||||
else if (topheight > lowestfloor && delta1 < delta2)
|
else if (topheight > lowfloor && delta1 < delta2)
|
||||||
lowestfloor = topheight;
|
lowfloor = topheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for backsectors fake floors
|
// Check for backsectors fake floors
|
||||||
|
@ -462,28 +458,16 @@ void P_CameraLineOpening(line_t *linedef)
|
||||||
|
|
||||||
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
|
delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2)));
|
||||||
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
|
||||||
if (bottomheight < lowestceiling && delta1 >= delta2)
|
if (bottomheight < opentop && delta1 >= delta2)
|
||||||
lowestceiling = bottomheight;
|
opentop = bottomheight;
|
||||||
else if (bottomheight < highestceiling && delta1 >= delta2)
|
else if (bottomheight < highceiling && delta1 >= delta2)
|
||||||
highestceiling = bottomheight;
|
highceiling = bottomheight;
|
||||||
|
|
||||||
if (topheight > highestfloor && delta1 < delta2)
|
if (topheight > openbottom && delta1 < delta2)
|
||||||
highestfloor = topheight;
|
openbottom = topheight;
|
||||||
else if (topheight > lowestfloor && delta1 < delta2)
|
else if (topheight > lowfloor && delta1 < delta2)
|
||||||
lowestfloor = topheight;
|
lowfloor = topheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highestceiling < highceiling)
|
|
||||||
highceiling = highestceiling;
|
|
||||||
|
|
||||||
if (highestfloor > openbottom)
|
|
||||||
openbottom = highestfloor;
|
|
||||||
|
|
||||||
if (lowestceiling < opentop)
|
|
||||||
opentop = lowestceiling;
|
|
||||||
|
|
||||||
if (lowestfloor > lowfloor)
|
|
||||||
lowfloor = lowestfloor;
|
|
||||||
}
|
}
|
||||||
openrange = opentop - openbottom;
|
openrange = opentop - openbottom;
|
||||||
return;
|
return;
|
||||||
|
@ -501,25 +485,27 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Treat polyobjects kind of like 3D Floors
|
|
||||||
#ifdef POLYOBJECTS
|
|
||||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
|
|
||||||
{
|
|
||||||
front = linedef->frontsector;
|
|
||||||
back = linedef->frontsector;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
front = linedef->frontsector;
|
front = linedef->frontsector;
|
||||||
back = linedef->backsector;
|
back = linedef->backsector;
|
||||||
}
|
|
||||||
|
|
||||||
I_Assert(front != NULL);
|
I_Assert(front != NULL);
|
||||||
I_Assert(back != NULL);
|
I_Assert(back != NULL);
|
||||||
|
|
||||||
openfloorrover = openceilingrover = NULL;
|
openfloorrover = openceilingrover = NULL;
|
||||||
|
#ifdef POLYOBJECTS
|
||||||
|
if (linedef->polyobj)
|
||||||
|
{
|
||||||
|
// set these defaults so that polyobjects don't interfere with collision above or below them
|
||||||
|
opentop = INT32_MAX;
|
||||||
|
openbottom = INT32_MIN;
|
||||||
|
highceiling = INT32_MIN;
|
||||||
|
lowfloor = INT32_MAX;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
opentopslope = openbottomslope = NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
{ // Set open and high/low values here
|
{ // Set open and high/low values here
|
||||||
fixed_t frontheight, backheight;
|
fixed_t frontheight, backheight;
|
||||||
|
|
||||||
|
@ -625,27 +611,49 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for fake floors in the sector.
|
|
||||||
if (front->ffloors || back->ffloors
|
|
||||||
#ifdef POLYOBJECTS
|
#ifdef POLYOBJECTS
|
||||||
|| linedef->polyobj
|
if (linedef->polyobj)
|
||||||
|
{
|
||||||
|
// Treat polyobj's backsector like a 3D Floor
|
||||||
|
if (linedef->polyobj->flags & POF_TESTHEIGHT)
|
||||||
|
{
|
||||||
|
const sector_t *polysec = linedef->backsector;
|
||||||
|
fixed_t polytop, polybottom;
|
||||||
|
fixed_t delta1, delta2;
|
||||||
|
|
||||||
|
if (linedef->polyobj->flags & POF_CLIPPLANES)
|
||||||
|
{
|
||||||
|
polytop = polysec->ceilingheight;
|
||||||
|
polybottom = polysec->floorheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
polytop = INT32_MAX;
|
||||||
|
polybottom = INT32_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
delta1 = abs(mobj->z - (polybottom + ((polytop - polybottom)/2)));
|
||||||
|
delta2 = abs(thingtop - (polybottom + ((polytop - polybottom)/2)));
|
||||||
|
|
||||||
|
if (polybottom < opentop && delta1 >= delta2)
|
||||||
|
opentop = polybottom;
|
||||||
|
else if (polybottom < highceiling && delta1 >= delta2)
|
||||||
|
highceiling = polybottom;
|
||||||
|
|
||||||
|
if (polytop > openbottom && delta1 < delta2)
|
||||||
|
openbottom = polytop;
|
||||||
|
else if (polytop > lowfloor && delta1 < delta2)
|
||||||
|
lowfloor = polytop;
|
||||||
|
}
|
||||||
|
// otherwise don't do anything special, pretend there's nothing else there
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
)
|
// Check for fake floors in the sector.
|
||||||
|
if (front->ffloors || back->ffloors)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
|
|
||||||
fixed_t highestceiling = highceiling;
|
|
||||||
fixed_t lowestceiling = opentop;
|
|
||||||
fixed_t highestfloor = openbottom;
|
|
||||||
fixed_t lowestfloor = lowfloor;
|
|
||||||
fixed_t delta1, delta2;
|
fixed_t delta1, delta2;
|
||||||
#ifdef ESLOPE
|
|
||||||
pslope_t *ceilingslope = opentopslope;
|
|
||||||
pslope_t *floorslope = openbottomslope;
|
|
||||||
#endif
|
|
||||||
ffloor_t *floorrover = NULL;
|
|
||||||
ffloor_t *ceilingrover = NULL;
|
|
||||||
|
|
||||||
// Check for frontsector's fake floors
|
// Check for frontsector's fake floors
|
||||||
for (rover = front->ffloors; rover; rover = rover->next)
|
for (rover = front->ffloors; rover; rover = rover->next)
|
||||||
|
@ -668,28 +676,28 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
||||||
|
|
||||||
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
||||||
{
|
{
|
||||||
if (bottomheight < lowestceiling) {
|
if (bottomheight < opentop) {
|
||||||
lowestceiling = bottomheight;
|
opentop = bottomheight;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
ceilingslope = *rover->b_slope;
|
opentopslope = *rover->b_slope;
|
||||||
#endif
|
#endif
|
||||||
ceilingrover = rover;
|
openceilingrover = rover;
|
||||||
}
|
}
|
||||||
else if (bottomheight < highestceiling)
|
else if (bottomheight < highceiling)
|
||||||
highestceiling = bottomheight;
|
highceiling = bottomheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
||||||
{
|
{
|
||||||
if (topheight > highestfloor) {
|
if (topheight > openbottom) {
|
||||||
highestfloor = topheight;
|
openbottom = topheight;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
floorslope = *rover->t_slope;
|
openbottomslope = *rover->t_slope;
|
||||||
#endif
|
#endif
|
||||||
floorrover = rover;
|
openfloorrover = rover;
|
||||||
}
|
}
|
||||||
else if (topheight > lowestfloor)
|
else if (topheight > lowfloor)
|
||||||
lowestfloor = topheight;
|
lowfloor = topheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,81 +722,30 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
||||||
|
|
||||||
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
|
||||||
{
|
{
|
||||||
if (bottomheight < lowestceiling) {
|
if (bottomheight < opentop) {
|
||||||
lowestceiling = bottomheight;
|
opentop = bottomheight;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
ceilingslope = *rover->b_slope;
|
opentopslope = *rover->b_slope;
|
||||||
#endif
|
#endif
|
||||||
ceilingrover = rover;
|
openceilingrover = rover;
|
||||||
}
|
}
|
||||||
else if (bottomheight < highestceiling)
|
else if (bottomheight < highceiling)
|
||||||
highestceiling = bottomheight;
|
highceiling = bottomheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF
|
||||||
{
|
{
|
||||||
if (topheight > highestfloor) {
|
if (topheight > openbottom) {
|
||||||
highestfloor = topheight;
|
openbottom = topheight;
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
floorslope = *rover->t_slope;
|
openbottomslope = *rover->t_slope;
|
||||||
#endif
|
#endif
|
||||||
floorrover = rover;
|
openfloorrover = rover;
|
||||||
}
|
}
|
||||||
else if (topheight > lowestfloor)
|
else if (topheight > lowfloor)
|
||||||
lowestfloor = topheight;
|
lowfloor = topheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef POLYOBJECTS
|
|
||||||
// Treat polyobj's backsector like a 3D Floor
|
|
||||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
|
|
||||||
{
|
|
||||||
const sector_t *polysec = linedef->backsector;
|
|
||||||
|
|
||||||
delta1 = abs(mobj->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
|
|
||||||
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
|
|
||||||
if (polysec->floorheight < lowestceiling && delta1 >= delta2) {
|
|
||||||
lowestceiling = polysec->floorheight;
|
|
||||||
#ifdef ESLOPE
|
|
||||||
ceilingslope = NULL;
|
|
||||||
#endif
|
|
||||||
ceilingrover = NULL;
|
|
||||||
}
|
|
||||||
else if (polysec->floorheight < highestceiling && delta1 >= delta2)
|
|
||||||
highestceiling = polysec->floorheight;
|
|
||||||
|
|
||||||
if (polysec->ceilingheight > highestfloor && delta1 < delta2) {
|
|
||||||
highestfloor = polysec->ceilingheight;
|
|
||||||
#ifdef ESLOPE
|
|
||||||
floorslope = NULL;
|
|
||||||
#endif
|
|
||||||
floorrover = NULL;
|
|
||||||
}
|
|
||||||
else if (polysec->ceilingheight > lowestfloor && delta1 < delta2)
|
|
||||||
lowestfloor = polysec->ceilingheight;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (highestceiling < highceiling)
|
|
||||||
highceiling = highestceiling;
|
|
||||||
|
|
||||||
if (highestfloor > openbottom) {
|
|
||||||
openbottom = highestfloor;
|
|
||||||
#ifdef ESLOPE
|
|
||||||
openbottomslope = floorslope;
|
|
||||||
#endif
|
|
||||||
openfloorrover = floorrover;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lowestceiling < opentop) {
|
|
||||||
opentop = lowestceiling;
|
|
||||||
#ifdef ESLOPE
|
|
||||||
opentopslope = ceilingslope;
|
|
||||||
#endif
|
|
||||||
openceilingrover = ceilingrover;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lowestfloor > lowfloor)
|
|
||||||
lowfloor = lowestfloor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue