- backported some 3D floor changes from GZDoom.

SVN r2517 (trunk)
This commit is contained in:
Christoph Oelckers 2010-08-12 07:05:31 +00:00
parent e9c43fe908
commit 185bd2f15d
4 changed files with 47 additions and 24 deletions

View file

@ -680,5 +680,32 @@ void P_Spawn3DFloors (void)
}
//==========================================================================
//
// Returns a 3D floorplane appropriate for the given coordinates
//
//==========================================================================
secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z)
{
secplane_t retplane = sector->floorplane;
if (sector->e) // apparently this can be called when the data is already gone
{
for(unsigned int i=0;i<sector->e->XFloor.ffloors.Size();i++)
{
F3DFloor * rover= sector->e->XFloor.ffloors[i];
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if (rover->top.plane->ZatPoint(x, y) == z)
{
retplane = *rover->top.plane;
if (retplane.c<0) retplane.FlipVert();
break;
}
}
}
return retplane;
}
#endif

View file

@ -125,6 +125,8 @@ struct FLineOpening;
void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy);
secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z);
#else
@ -156,6 +158,8 @@ struct FLineOpening;
inline void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy) {}
//secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z){return sector->floorplane;}
#endif

View file

@ -655,8 +655,14 @@ bool PIT_CheckLine (line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
if (!(tm.thing->flags & MF_DROPOFF) &&
!(tm.thing->flags & (MF_NOGRAVITY|MF_NOCLIP)))
{
if (ld->frontsector->floorplane.c < STEEPSLOPE ||
ld->backsector->floorplane.c < STEEPSLOPE)
secplane_t frontplane = ld->frontsector->floorplane;
secplane_t backplane = ld->backsector->floorplane;
#ifdef _3DFLOORS
// Check 3D floors as well
frontplane = P_FindFloorPlane(ld->frontsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
backplane = P_FindFloorPlane(ld->backsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
#endif
if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE)
{
const msecnode_t *node = tm.thing->touching_sectorlist;
bool allow = false;

View file

@ -3178,41 +3178,27 @@ void AActor::Tick ()
velz <= 0 &&
floorz == z)
{
const secplane_t * floorplane = &floorsector->floorplane;
static secplane_t copyplane;
secplane_t floorplane = floorsector->floorplane;
#ifdef _3DFLOORS
// Check 3D floors as well
if (floorsector->e) // apparently this can be called when the data is already gone-
for(unsigned int i=0;i<floorsector->e->XFloor.ffloors.Size();i++)
{
F3DFloor * rover= floorsector->e->XFloor.ffloors[i];
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if (rover->top.plane->ZatPoint(x, y) == floorz)
{
copyplane = *rover->top.plane;
if (copyplane.c<0) copyplane.FlipVert();
floorplane = &copyplane;
break;
}
}
floorplane = P_FindFloorPlane(floorsector, x, y, floorz);
#endif
if (floorplane->c < STEEPSLOPE &&
floorplane->ZatPoint (x, y) <= floorz)
if (floorplane.c < STEEPSLOPE &&
floorplane.ZatPoint (x, y) <= floorz)
{
const msecnode_t *node;
bool dopush = true;
if (floorplane->c > STEEPSLOPE*2/3)
if (floorplane.c > STEEPSLOPE*2/3)
{
for (node = touching_sectorlist; node; node = node->m_tnext)
{
const sector_t *sec = node->m_sector;
if (sec->floorplane.c >= STEEPSLOPE)
{
if (floorplane->ZatPoint (x, y) >= z - MaxStepHeight)
if (floorplane.ZatPoint (x, y) >= z - MaxStepHeight)
{
dopush = false;
break;
@ -3222,8 +3208,8 @@ void AActor::Tick ()
}
if (dopush)
{
velx += floorplane->a;
vely += floorplane->b;
velx += floorplane.a;
vely += floorplane.b;
}
}
}