* Updated to ZDoom r3550:

- Use 3D midtexture restrictions when respawning actors.
- Only adjust the ceiling position of solid actors in A_RestoreSpecialPosition.
- 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.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1354 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2012-04-10 09:28:05 +00:00
parent 43a38778cd
commit 51c24013cb
8 changed files with 24 additions and 19 deletions

View file

@ -385,13 +385,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
}
}
// Redo floor/ceiling check, in case of 3D floors
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS);
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DMIDTEXRESTRICT);
if (self->z < self->floorz)
{ // Do not reappear under the floor, even if that's where we were for the
// initial spawn.
self->z = self->floorz;
}
if (self->z + self->height > self->ceilingz)
if ((self->flags & MF_SOLID) && (self->z + self->height > self->ceilingz))
{ // Do the same for the ceiling.
self->z = self->ceilingz - self->height;
}

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;
@ -273,7 +273,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
}
else
{
if (tt > open.bottom)
if (tt > open.bottom && (!restrict || thing->z >= tt))
{
open.bottom = tt;
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);
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_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);
void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling);

View file

@ -259,7 +259,7 @@ struct FLineOpening
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;
struct polyblock_t;
@ -438,6 +438,7 @@ enum
FFCF_ONLYSPAWNPOS = 1,
FFCF_SAMESECTOR = 2,
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);

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]
|| 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->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
{ // 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);
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))
{
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
{
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.z = actor->z;
if (flags & FFCF_ONLYSPAWNPOS)
{
flags |= FFCF_3DMIDTEXRESTRICT;
}
if (!(flags & FFCF_ONLYSPAWNPOS))
{
P_GetFloorCeilingZ(tmf, flags);
@ -266,7 +270,7 @@ void P_FindFloorCeiling (AActor *actor, int flags)
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;
@ -342,7 +346,7 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
thing->z = z;
while ((ld = it.Next()))
{
PIT_FindFloorCeiling(ld, box, tmf, false);
PIT_FindFloorCeiling(ld, box, tmf, 0);
}
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,
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;
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 &&
linedef->flags & ML_3DMIDTEX)
{
open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open);
open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open, !!(flags & FFCF_3DMIDTEXRESTRICT));
}
else
{

View file

@ -2487,7 +2487,7 @@ void P_NightmareRespawn (AActor *mobj)
}
// If there are 3D floors, we need to find floor/ceiling again.
P_FindFloorCeiling(mo, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS);
P_FindFloorCeiling(mo, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DMIDTEXRESTRICT);
if (z == ONFLOORZ)
{

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "3547"
#define ZD_SVN_REVISION_NUMBER 3547
#define ZD_SVN_REVISION_STRING "3550"
#define ZD_SVN_REVISION_NUMBER 3550