- added Gez's patch for proper splash checks with 3D-floors.
SVN r3295 (trunk)
This commit is contained in:
parent
c12538c346
commit
a0bb1c2546
5 changed files with 101 additions and 33 deletions
|
|
@ -59,7 +59,9 @@ struct FTraceInfo
|
|||
int sectorsel;
|
||||
|
||||
bool TraceTraverse (int ptflags);
|
||||
bool CheckPlane(const secplane_t &plane);
|
||||
bool CheckSectorPlane (const sector_t *sector, bool checkFloor);
|
||||
bool Check3DFloorPlane(const F3DFloor *ffloor, bool checkBottom);
|
||||
};
|
||||
|
||||
static bool EditTraceResult (DWORD flags, FTraceResults &res);
|
||||
|
|
@ -90,17 +92,18 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
|
|||
inf.EnterDist = 0;
|
||||
inf.TraceCallback = callback;
|
||||
inf.TraceFlags = flags;
|
||||
res.CrossedWater = NULL;
|
||||
inf.Results = &res;
|
||||
inf.inshootthrough = true;
|
||||
|
||||
res.HitType = TRACE_HitNone;
|
||||
|
||||
// Do a 3D floor check in the starting sector
|
||||
memset(&res, 0, sizeof(res));
|
||||
inf.sectorsel=0;
|
||||
memset(&res, 0, sizeof(res));
|
||||
/* // Redundant with the memset
|
||||
res.HitType = TRACE_HitNone;
|
||||
res.CrossedWater = NULL;
|
||||
res.Crossed3DWater = NULL;
|
||||
*/
|
||||
|
||||
#ifdef _3DFLOORS
|
||||
// Do a 3D floor check in the starting sector
|
||||
TDeletingArray<F3DFloor*> &ff = sector->e->XFloor.ffloors;
|
||||
|
||||
if (ff.Size())
|
||||
|
|
@ -114,8 +117,16 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
|
|||
for(unsigned int i=0;i<ff.Size();i++)
|
||||
{
|
||||
F3DFloor * rover=ff[i];
|
||||
if (!(rover->flags&FF_EXISTS))
|
||||
continue;
|
||||
|
||||
if (!(rover->flags&FF_SHOOTTHROUGH) && rover->flags&FF_EXISTS)
|
||||
if (rover->flags&FF_SWIMMABLE && res.Crossed3DWater == NULL)
|
||||
{
|
||||
if (inf.Check3DFloorPlane(rover, false))
|
||||
res.Crossed3DWater = rover;
|
||||
}
|
||||
|
||||
if (!(rover->flags&FF_SHOOTTHROUGH))
|
||||
{
|
||||
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(x, y);
|
||||
fixed_t ff_top=rover->top.plane->ZatPoint(x, y);
|
||||
|
|
@ -243,6 +254,26 @@ bool FTraceInfo::TraceTraverse (int ptflags)
|
|||
fixed_t hitx, hity, hitz;
|
||||
fixed_t dist;
|
||||
|
||||
// Deal with splashes in 3D floors
|
||||
#ifdef _3DFLOORS
|
||||
if (CurSector->e->XFloor.ffloors.Size())
|
||||
{
|
||||
for(unsigned int i=0;i<CurSector->e->XFloor.ffloors.Size();i++)
|
||||
{
|
||||
F3DFloor * rover=CurSector->e->XFloor.ffloors[i];
|
||||
if (!(rover->flags&FF_EXISTS))
|
||||
continue;
|
||||
|
||||
// Deal with splashy stuff
|
||||
if (rover->flags&FF_SWIMMABLE && Results->Crossed3DWater == NULL)
|
||||
{
|
||||
if (Check3DFloorPlane(rover, false))
|
||||
Results->Crossed3DWater = rover;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (in->isaline)
|
||||
{
|
||||
int lineside;
|
||||
|
|
@ -287,7 +318,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
|
|||
entersector = (lineside == 0) ? in->d.line->backsector : in->d.line->frontsector;
|
||||
|
||||
// For backwards compatibility: Ignore lines with the same sector on both sides.
|
||||
// This is the way Doom.exe did it and some WADs (e.g. Alien Vendetta MAP15 need it.
|
||||
// This is the way Doom.exe did it and some WADs (e.g. Alien Vendetta MAP15) need it.
|
||||
if (i_compatflags & COMPATF_TRACE && in->d.line->backsector == in->d.line->frontsector)
|
||||
{
|
||||
// We must check special activation here because the code below is never reached.
|
||||
|
|
@ -587,19 +618,8 @@ cont1:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FTraceInfo::CheckSectorPlane (const sector_t *sector, bool checkFloor)
|
||||
bool FTraceInfo::CheckPlane (const secplane_t &plane)
|
||||
{
|
||||
secplane_t plane;
|
||||
|
||||
if (checkFloor)
|
||||
{
|
||||
plane = sector->floorplane;
|
||||
}
|
||||
else
|
||||
{
|
||||
plane = sector->ceilingplane;
|
||||
}
|
||||
|
||||
fixed_t den = TMulScale16 (plane.a, Vx, plane.b, Vy, plane.c, Vz);
|
||||
|
||||
if (den != 0)
|
||||
|
|
@ -623,6 +643,38 @@ bool FTraceInfo::CheckSectorPlane (const sector_t *sector, bool checkFloor)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool FTraceInfo::CheckSectorPlane (const sector_t *sector, bool checkFloor)
|
||||
{
|
||||
secplane_t plane;
|
||||
|
||||
if (checkFloor)
|
||||
{
|
||||
plane = sector->floorplane;
|
||||
}
|
||||
else
|
||||
{
|
||||
plane = sector->ceilingplane;
|
||||
}
|
||||
|
||||
return CheckPlane(plane);
|
||||
}
|
||||
|
||||
bool FTraceInfo::Check3DFloorPlane (const F3DFloor *ffloor, bool checkBottom)
|
||||
{
|
||||
secplane_t plane;
|
||||
|
||||
if (checkBottom)
|
||||
{
|
||||
plane = *(ffloor->bottom.plane);
|
||||
}
|
||||
else
|
||||
{
|
||||
plane = *(ffloor->top.plane);
|
||||
}
|
||||
|
||||
return CheckPlane(plane);
|
||||
}
|
||||
|
||||
static bool EditTraceResult (DWORD flags, FTraceResults &res)
|
||||
{
|
||||
if (flags & TRACE_NoSky)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue