- fixed: 3D floor ceiling calculation didn't take into account that an actor's top may just be slightly inside a 3D floor and returned the next highest one instead.

For floors this change is deliberately not done because it might cause problems with the movement code.
This commit is contained in:
Christoph Oelckers 2016-03-14 16:38:17 +01:00
commit d07bf08e56
4 changed files with 17 additions and 21 deletions

View file

@ -932,7 +932,7 @@ fixed_t sector_t::LowestFloorAt(fixed_t x, fixed_t y, sector_t **resultsec)
}
fixed_t sector_t::NextHighestCeilingAt(fixed_t x, fixed_t y, fixed_t z, int flags, sector_t **resultsec, F3DFloor **resultffloor)
fixed_t sector_t::NextHighestCeilingAt(fixed_t x, fixed_t y, fixed_t bottomz, fixed_t topz, int flags, sector_t **resultsec, F3DFloor **resultffloor)
{
sector_t *sec = this;
fixed_t planeheight = FIXED_MIN;
@ -943,14 +943,20 @@ fixed_t sector_t::NextHighestCeilingAt(fixed_t x, fixed_t y, fixed_t z, int flag
fixed_t realceil = sec->ceilingplane.ZatPoint(x, y);
for (int i = sec->e->XFloor.ffloors.Size() - 1; i >= 0; --i)
{
F3DFloor *ff = sec->e->XFloor.ffloors[i];
F3DFloor *rover = sec->e->XFloor.ffloors[i];
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
fixed_t ffz = ff->bottom.plane->ZatPoint(x, y);
if (ffz < realceil && ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) && z <= ffz))
{ // This floor is above our eyes.
fixed_t ff_bottom = rover->bottom.plane->ZatPoint(x, y);
fixed_t ff_top = rover->top.plane->ZatPoint(x, y);
fixed_t delta1 = bottomz - (ff_bottom + ((ff_top - ff_bottom) / 2));
fixed_t delta2 = topz - (ff_bottom + ((ff_top - ff_bottom) / 2));
if (ff_bottom < realceil && abs(delta1) >= abs(delta2))
{
if (resultsec) *resultsec = sec;
if (resultffloor) *resultffloor = ff;
return ffz;
if (resultffloor) *resultffloor = rover;
return ff_bottom;
}
}
if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(ceiling) || planeheight >= sec->SkyBoxes[ceiling]->threshold)