- In P_SpawnMapThing(), pass the same flags to P_FindFloorCeiling() as the respawn functions do.

- Rename FFCF_3DMIDTEXRESTRICT to FF_3DRESTRICT and make it work with 3D floors too.

SVN r3562 (trunk)
This commit is contained in:
Randy Heit 2012-04-14 03:55:46 +00:00
parent f19a6a2a29
commit 280ca05554
7 changed files with 13 additions and 13 deletions

View file

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

View file

@ -691,7 +691,7 @@ lightlist_t * P_GetPlaneLight(sector_t * sector, secplane_t * plane, bool unders
//==========================================================================
void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef,
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy)
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict)
{
if(thing)
{
@ -737,7 +737,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
lowestceilingpic = *rover->bottom.texture;
}
if(ff_top > highestfloor && delta1 < delta2)
if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->z >= ff_top))
{
highestfloor = ff_top;
highestfloorpic = *rover->top.texture;

View file

@ -137,7 +137,7 @@ void P_Spawn3DFloors( void );
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);
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict);
secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z);
int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz);
@ -170,7 +170,7 @@ inline void P_Spawn3DFloors( void ) {}
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) {}
fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict) {}
//secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z){return sector->floorplane;}

View file

@ -438,7 +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
FFCF_3DRESTRICT = 8, // ignore 3D midtexes and floors whose floorz are above thing's z
};
void P_FindFloorCeiling (AActor *actor, int flags=0);

View file

@ -203,13 +203,13 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags)
if (ff_top > tmf.floorz)
{
if (ff_top < tmf.z || (tmf.thing != NULL && ff_bottom < tmf.z && ff_top < tmf.z + tmf.thing->MaxStepHeight))
if (ff_top <= tmf.z || (!(flags && FFCF_3DRESTRICT) && (tmf.thing != NULL && ff_bottom < tmf.z && ff_top < tmf.z + tmf.thing->MaxStepHeight)))
{
tmf.dropoffz = tmf.floorz = ff_top;
tmf.floorpic = *rover->top.texture;
}
}
if (ff_bottom < tmf.ceilingz && ff_bottom > tmf.z + tmf.thing->height)
if (ff_bottom <= tmf.ceilingz && ff_bottom > tmf.z + tmf.thing->height)
{
tmf.ceilingz = ff_bottom;
tmf.ceilingpic = *rover->bottom.texture;
@ -235,7 +235,7 @@ void P_FindFloorCeiling (AActor *actor, int flags)
if (flags & FFCF_ONLYSPAWNPOS)
{
flags |= FFCF_3DMIDTEXRESTRICT;
flags |= FFCF_3DRESTRICT;
}
if (!(flags & FFCF_ONLYSPAWNPOS))
{

View file

@ -218,13 +218,13 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
// Check 3D floors
if (actor != NULL)
{
P_LineOpening_XFloors(open, actor, linedef, x, y, refx, refy);
P_LineOpening_XFloors(open, actor, linedef, x, y, refx, refy, !!(flags & FFCF_3DRESTRICT));
}
if (actor != NULL && linedef->frontsector != NULL && linedef->backsector != NULL &&
linedef->flags & ML_3DMIDTEX)
{
open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open, !!(flags & FFCF_3DMIDTEXRESTRICT));
open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open, !!(flags & FFCF_3DRESTRICT));
}
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 | FFCF_3DMIDTEXRESTRICT);
P_FindFloorCeiling(mo, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
if (z == ONFLOORZ)
{
@ -4519,7 +4519,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->SpawnPoint[2] = mthing->z;
mobj->SpawnAngle = mthing->angle;
mobj->SpawnFlags = mthing->flags;
P_FindFloorCeiling(mobj, FFCF_ONLYSPAWNPOS);
P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
if (!(mobj->flags2 & MF2_ARGSDEFINED))
{