- Fixed: The onlyspawnpos handling in P_FindFloorCeiling would fail to adjust an actor's floorz

(and related) to a 3D midtex beneath its Z if it also touched a 3D midtex above its Z.

SVN r3548 (trunk)
This commit is contained in:
Randy Heit 2012-04-10 03:18:04 +00:00
parent d81542752a
commit da21075480
5 changed files with 19 additions and 14 deletions

View file

@ -256,7 +256,7 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f
// //
//============================================================================ //============================================================================
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &open) bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &open, bool restrict)
{ {
fixed_t tt, tb; fixed_t tt, tb;
@ -273,7 +273,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
} }
else else
{ {
if (tt > open.bottom) if (tt > open.bottom && (!restrict || thing->z >= tt))
{ {
open.bottom = tt; open.bottom = tt;
open.abovemidtex = true; open.abovemidtex = true;

View file

@ -14,7 +14,7 @@ void P_Start3dMidtexInterpolations(TArray<DInterpolation *> &list, sector_t *sec
void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling); void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling);
bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot); bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot);
bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side); bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side);
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open); bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open, bool restrict=false);
bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling); bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling);
void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling); void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling);

View file

@ -259,7 +259,7 @@ struct FLineOpening
bool abovemidtex; bool abovemidtex;
}; };
void P_LineOpening (FLineOpening &open, AActor *thing, const line_t *linedef, fixed_t x, fixed_t y, fixed_t refx=FIXED_MIN, fixed_t refy=0, bool only3d=false); void P_LineOpening (FLineOpening &open, AActor *thing, const line_t *linedef, fixed_t x, fixed_t y, fixed_t refx=FIXED_MIN, fixed_t refy=0, int flags=0);
class FBoundingBox; class FBoundingBox;
struct polyblock_t; struct polyblock_t;
@ -438,6 +438,7 @@ enum
FFCF_ONLYSPAWNPOS = 1, FFCF_ONLYSPAWNPOS = 1,
FFCF_SAMESECTOR = 2, FFCF_SAMESECTOR = 2,
FFCF_ONLY3DFLOORS = 4, // includes 3D midtexes FFCF_ONLY3DFLOORS = 4, // includes 3D midtexes
FFCF_3DMIDTEXRESTRICT = 8, // ignore 3D midtex's whose floorz are above thing's z
}; };
void P_FindFloorCeiling (AActor *actor, int flags=0); void P_FindFloorCeiling (AActor *actor, int flags=0);

View file

@ -87,7 +87,7 @@ msecnode_t* sector_list = NULL; // phares 3/16/98
// //
//========================================================================== //==========================================================================
static bool PIT_FindFloorCeiling (line_t *ld, const FBoundingBox &box, FCheckPosition &tmf, bool only3d) static bool PIT_FindFloorCeiling (line_t *ld, const FBoundingBox &box, FCheckPosition &tmf, int flags)
{ {
if (box.Right() <= ld->bbox[BOXLEFT] if (box.Right() <= ld->bbox[BOXLEFT]
|| box.Left() >= ld->bbox[BOXRIGHT] || box.Left() >= ld->bbox[BOXRIGHT]
@ -115,7 +115,7 @@ static bool PIT_FindFloorCeiling (line_t *ld, const FBoundingBox &box, FCheckPos
(ld->backsector->ceilingplane.a | ld->backsector->ceilingplane.b)) == 0) (ld->backsector->ceilingplane.a | ld->backsector->ceilingplane.b)) == 0)
&& ld->backsector->e->XFloor.ffloors.Size()==0 && ld->frontsector->e->XFloor.ffloors.Size()==0) && ld->backsector->e->XFloor.ffloors.Size()==0 && ld->frontsector->e->XFloor.ffloors.Size()==0)
{ {
P_LineOpening (open, tmf.thing, ld, sx=tmf.x, sy=tmf.y, tmf.x, tmf.y, only3d); P_LineOpening (open, tmf.thing, ld, sx=tmf.x, sy=tmf.y, tmf.x, tmf.y, flags);
} }
else else
{ // Find the point on the line closest to the actor's center, and use { // Find the point on the line closest to the actor's center, and use
@ -127,16 +127,16 @@ static bool PIT_FindFloorCeiling (line_t *ld, const FBoundingBox &box, FCheckPos
(dx*dx + dy*dy) * 16777216.f); (dx*dx + dy*dy) * 16777216.f);
if (r <= 0) if (r <= 0)
{ {
P_LineOpening (open, tmf.thing, ld, sx=ld->v1->x, sy=ld->v1->y, tmf.x, tmf.y, only3d); P_LineOpening (open, tmf.thing, ld, sx=ld->v1->x, sy=ld->v1->y, tmf.x, tmf.y, flags);
} }
else if (r >= (1<<24)) else if (r >= (1<<24))
{ {
P_LineOpening (open, tmf.thing, ld, sx=ld->v2->x, sy=ld->v2->y, tmf.thing->x, tmf.thing->y, only3d); P_LineOpening (open, tmf.thing, ld, sx=ld->v2->x, sy=ld->v2->y, tmf.thing->x, tmf.thing->y, flags);
} }
else else
{ {
P_LineOpening (open, tmf.thing, ld, sx=ld->v1->x + MulScale24 (r, ld->dx), P_LineOpening (open, tmf.thing, ld, sx=ld->v1->x + MulScale24 (r, ld->dx),
sy=ld->v1->y + MulScale24 (r, ld->dy), tmf.x, tmf.y, only3d); sy=ld->v1->y + MulScale24 (r, ld->dy), tmf.x, tmf.y, flags);
} }
} }
@ -233,6 +233,10 @@ void P_FindFloorCeiling (AActor *actor, int flags)
tmf.y = actor->y; tmf.y = actor->y;
tmf.z = actor->z; tmf.z = actor->z;
if (flags & FFCF_ONLYSPAWNPOS)
{
flags |= FFCF_3DMIDTEXRESTRICT;
}
if (!(flags & FFCF_ONLYSPAWNPOS)) if (!(flags & FFCF_ONLYSPAWNPOS))
{ {
P_GetFloorCeilingZ(tmf, flags); P_GetFloorCeilingZ(tmf, flags);
@ -266,7 +270,7 @@ void P_FindFloorCeiling (AActor *actor, int flags)
while ((ld = it.Next())) while ((ld = it.Next()))
{ {
PIT_FindFloorCeiling(ld, box, tmf, !!(flags & FFCF_ONLY3DFLOORS)); PIT_FindFloorCeiling(ld, box, tmf, flags);
} }
if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz; if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz;
@ -342,7 +346,7 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
thing->z = z; thing->z = z;
while ((ld = it.Next())) while ((ld = it.Next()))
{ {
PIT_FindFloorCeiling(ld, box, tmf, false); PIT_FindFloorCeiling(ld, box, tmf, 0);
} }
thing->z = savedz; thing->z = savedz;

View file

@ -139,9 +139,9 @@ fixed_t P_InterceptVector (const divline_t *v2, const divline_t *v1)
//========================================================================== //==========================================================================
void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool only3d) fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, int flags)
{ {
if (!only3d) if (!(flags & FFCF_ONLY3DFLOORS))
{ {
sector_t *front, *back; sector_t *front, *back;
fixed_t fc, ff, bc, bf; fixed_t fc, ff, bc, bf;
@ -224,7 +224,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
if (actor != NULL && linedef->frontsector != NULL && linedef->backsector != NULL && if (actor != NULL && linedef->frontsector != NULL && linedef->backsector != NULL &&
linedef->flags & ML_3DMIDTEX) linedef->flags & ML_3DMIDTEX)
{ {
open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open); open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open, !!(flags & FFCF_3DMIDTEXRESTRICT));
} }
else else
{ {