- fixed: Explosions directly under a water surface would not hurt any actor directly above this surface.

- cleaned up P_CheckSight flag handling.


SVN r2249 (trunk)
This commit is contained in:
Christoph Oelckers 2010-03-27 07:42:31 +00:00
commit a357a70f82
8 changed files with 56 additions and 42 deletions

View file

@ -53,7 +53,7 @@ class SightCheck
fixed_t lastzbottom; // z at last line
sector_t * lastsector; // last sector being entered by trace
fixed_t topslope, bottomslope; // slopes to top and bottom of target
int SeePastBlockEverything, SeePastShootableLines;
int Flags;
divline_t trace;
int myseethrough;
@ -73,9 +73,8 @@ public:
seeingthing=t2;
bottomslope = t2->z - sightzstart;
topslope = bottomslope + t2->height;
Flags = flags;
SeePastBlockEverything = flags & 6;
SeePastShootableLines = flags & 4;
myseethrough = FF_SEETHROUGH;
}
};
@ -144,6 +143,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
F3DFloor* rover=s->e->XFloor.ffloors[j];
if((rover->flags & FF_SEETHROUGH) == myseethrough || !(rover->flags & FF_EXISTS)) continue;
if ((Flags & SF_IGNOREWATERBOUNDARY) && (rover->flags & FF_SOLID) == 0) continue;
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(trX, trY);
fixed_t ff_top=rover->top.plane->ZatPoint(trX, trY);
@ -176,6 +176,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
F3DFloor* rover2=sb->e->XFloor.ffloors[k];
if((rover2->flags & FF_SEETHROUGH) == myseethrough || !(rover2->flags & FF_EXISTS)) continue;
if ((Flags & SF_IGNOREWATERBOUNDARY) && (rover->flags & FF_SOLID) == 0) continue;
fixed_t ffb_bottom=rover2->bottom.plane->ZatPoint(trX, trY);
fixed_t ffb_top=rover2->top.plane->ZatPoint(trX, trY);
@ -255,7 +256,7 @@ bool SightCheck::P_SightCheckLine (line_t *ld)
// [RH] don't see past block everything lines
if (ld->flags & ML_BLOCKEVERYTHING)
{
if (!SeePastBlockEverything)
if (!(Flags & SF_SEEPASTBLOCKEVERYTHING))
{
return false;
}
@ -263,7 +264,7 @@ bool SightCheck::P_SightCheckLine (line_t *ld)
// that runs a script on the current map. Used to prevent monsters
// from trying to attack through a block everything line unless
// there's a chance their attack will make it nonblocking.
if (!SeePastShootableLines)
if (!(Flags & SF_SEEPASTSHOOTABLELINES))
{
if (!(ld->activation & SPAC_Impact))
{
@ -407,6 +408,7 @@ bool SightCheck::P_SightTraverseIntercepts ()
F3DFloor* rover = lastsector->e->XFloor.ffloors[i];
if((rover->flags & FF_SOLID) == myseethrough || !(rover->flags & FF_EXISTS)) continue;
if ((Flags & SF_IGNOREWATERBOUNDARY) && (rover->flags & FF_SOLID) == 0) continue;
fixed_t ff_bottom=rover->bottom.plane->ZatPoint(seeingthing->x, seeingthing->y);
fixed_t ff_top=rover->top.plane->ZatPoint(seeingthing->x, seeingthing->y);
@ -670,7 +672,7 @@ sightcounts[0]++;
//
// [RH] Andy Baker's stealth monsters:
// Cannot see an invisible object
if ((flags & 1) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->alpha)))
if ((flags & SF_IGNOREVISIBILITY) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->alpha)))
{ // small chance of an attack being made anyway
if ((bglobal.m_Thinking ? pr_botchecksight() : pr_checksight()) > 50)
{
@ -681,20 +683,23 @@ sightcounts[0]++;
// killough 4/19/98: make fake floors and ceilings block monster view
if ((s1->GetHeightSec() &&
((t1->z + t1->height <= s1->heightsec->floorplane.ZatPoint (t1->x, t1->y) &&
t2->z >= s1->heightsec->floorplane.ZatPoint (t2->x, t2->y)) ||
(t1->z >= s1->heightsec->ceilingplane.ZatPoint (t1->x, t1->y) &&
t2->z + t1->height <= s1->heightsec->ceilingplane.ZatPoint (t2->x, t2->y))))
||
(s2->GetHeightSec() &&
((t2->z + t2->height <= s2->heightsec->floorplane.ZatPoint (t2->x, t2->y) &&
t1->z >= s2->heightsec->floorplane.ZatPoint (t1->x, t1->y)) ||
(t2->z >= s2->heightsec->ceilingplane.ZatPoint (t2->x, t2->y) &&
t1->z + t2->height <= s2->heightsec->ceilingplane.ZatPoint (t1->x, t1->y)))))
if (!(flags & SF_IGNOREWATERBOUNDARY))
{
res = false;
goto done;
if ((s1->GetHeightSec() &&
((t1->z + t1->height <= s1->heightsec->floorplane.ZatPoint (t1->x, t1->y) &&
t2->z >= s1->heightsec->floorplane.ZatPoint (t2->x, t2->y)) ||
(t1->z >= s1->heightsec->ceilingplane.ZatPoint (t1->x, t1->y) &&
t2->z + t1->height <= s1->heightsec->ceilingplane.ZatPoint (t2->x, t2->y))))
||
(s2->GetHeightSec() &&
((t2->z + t2->height <= s2->heightsec->floorplane.ZatPoint (t2->x, t2->y) &&
t1->z >= s2->heightsec->floorplane.ZatPoint (t1->x, t1->y)) ||
(t2->z >= s2->heightsec->ceilingplane.ZatPoint (t2->x, t2->y) &&
t1->z + t2->height <= s2->heightsec->ceilingplane.ZatPoint (t1->x, t1->y)))))
{
res = false;
goto done;
}
}
// An unobstructed LOS is possible.