- Fixed: In P_LineOpening_3dMidtex(), set the floorpic or ceilingpic to the 3D midtex if it

alters the opening. This fixes things such as removing a projectile when it hits a 3D midtex
  instead of exploding it because the real floor or ceiling is sky.

SVN r3490 (trunk)
This commit is contained in:
Randy Heit 2012-03-29 05:09:56 +00:00
parent 60e0eca047
commit c445f684fc
4 changed files with 23 additions and 14 deletions

View file

@ -256,23 +256,28 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f
//
//============================================================================
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, fixed_t &opentop, fixed_t &openbottom, bool *above)
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &open)
{
fixed_t tt, tb;
*above = false;
open.abovemidtex = false;
if (P_GetMidTexturePosition(linedef, 0, &tt, &tb))
{
if (thing->z + (thing->height/2) < (tt + tb)/2)
{
if(tb < opentop) opentop = tb;
if (tb < open.top)
{
open.top = tb;
open.ceilingpic = linedef->sidedef[0]->GetTexture(side_t::mid);
}
}
else
{
if(tt > openbottom)
if (tt > open.bottom)
{
openbottom = tt;
*above = true;
open.bottom = tt;
open.abovemidtex = true;
open.floorpic = linedef->sidedef[0]->GetTexture(side_t::mid);
}
// returns true if it touches the midtexture
return (abs(thing->z - tt) <= thing->MaxStepHeight);

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, fixed_t &opentop, fixed_t &openbottom, bool *above);
bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open);
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

@ -212,9 +212,12 @@ 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.top, open.bottom, &open.abovemidtex);
open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open);
}
else
{
open.abovemidtex = open.touchmidtex = false;
}
else open.abovemidtex = open.touchmidtex = false;
open.range = open.top - open.bottom;
}

View file

@ -1195,8 +1195,9 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
checker.Push (mobj);
if ((mobj->flags&MF_SOLID) && !(mobj->flags&MF_NOCLIP))
{
fixed_t top = -INT_MAX, bottom = INT_MAX;
bool above;
FLineOpening open;
open.top = -INT_MAX;
open.bottom = INT_MAX;
// [TN] Check wether this actor gets blocked by the line.
if (ld->backsector != NULL &&
!(ld->flags & (ML_BLOCKING|ML_BLOCKEVERYTHING))
@ -1204,9 +1205,9 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
&& !(ld->flags & ML_BLOCKMONSTERS && mobj->flags3 & MF3_ISMONSTER)
&& !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS))
&& (!(ld->flags & ML_3DMIDTEX) ||
(!P_LineOpening_3dMidtex(mobj, ld, bottom, top, &above) &&
(mobj->z + mobj->height < bottom)
) || (above && mobj->z > mobj->floorz))
(!P_LineOpening_3dMidtex(mobj, ld, open) &&
(mobj->z + mobj->height < open.bottom)
) || (open.abovemidtex && mobj->z > mobj->floorz))
)
{
continue;