- Restored the old drawseg/sprite distance check from 2.0.63. The code that

replaced it did the check at the center of the area intersected by the
  sprite and the drawseg, whereas 2.0.63 only did the check at the location
  of the sprite on the map.


SVN r1411 (trunk)
This commit is contained in:
Randy Heit 2009-02-07 03:01:38 +00:00
parent 1aed25f666
commit 0c9f735357
5 changed files with 19 additions and 8 deletions

View file

@ -1,4 +1,8 @@
February 6, 2009
- Restored the old drawseg/sprite distance check from 2.0.63. The code that
replaced it did the check at the center of the area intersected by the
sprite and the drawseg, whereas 2.0.63 only did the check at the location
of the sprite on the map.
- Commented out the CALL_ACTION(A_Look, actor) for targetless friendly
monsters in A_DoChase(). They can still find new targets without this,
and with it, they got stuck on the first frame of their see state.

View file

@ -35,6 +35,7 @@ struct drawseg_t
short sx1, sx2; // left, right of parent seg on screen
fixed_t sz1, sz2; // z for left, right of parent seg on screen
fixed_t siz1, siz2; // 1/z for left, right of parent seg on screen
fixed_t cx, cy, cdx, cdy;
BYTE silhouette; // 0=none, 1=bottom, 2=top, 3=both
BYTE bFogBoundary;
int shade;

View file

@ -915,6 +915,7 @@ struct vissprite_t
fixed_t startfrac; // horizontal position of x1
fixed_t xscale, yscale;
fixed_t xiscale; // negative if flipped
fixed_t depth;
fixed_t idepth; // 1/z
fixed_t texturemid;
DWORD FillColor;

View file

@ -1533,6 +1533,10 @@ void R_StoreWallRange (int start, int stop)
ds_p->sx2 = WallSX2;
ds_p->sz1 = WallSZ1;
ds_p->sz2 = WallSZ2;
ds_p->cx = WallTX1;
ds_p->cy = WallTY1;
ds_p->cdx = WallTX2 - WallTX1;
ds_p->cdy = WallTY2 - WallTY1;
ds_p->siz1 = (DWORD)DivScale32 (1, WallSZ1) >> 1;
ds_p->siz2 = (DWORD)DivScale32 (1, WallSZ2) >> 1;
ds_p->x1 = rw_x = start;

View file

@ -1403,6 +1403,7 @@ void R_ProjectSprite (AActor *thing, int fakeside)
vis->FillColor = thing->fillcolor;
vis->xscale = xscale;
vis->yscale = Scale (InvZtoScale, yscale, tz)>>4;
vis->depth = tz;
vis->idepth = (DWORD)DivScale32 (1, tz) >> 1; // tz is 20.12, so idepth ought to be 12.20, but
vis->cx = tx2; // signed math makes it 13.19
vis->gx = fx;
@ -2115,20 +2116,19 @@ void R_DrawSprite (vissprite_t *spr)
r1 = MAX<int> (ds->x1, spr->x1);
r2 = MIN<int> (ds->x2, spr->x2);
fixed_t nearidepth, faridepth;
if (ds->siz1 > ds->siz2)
fixed_t neardepth, fardepth;
if (ds->sz1 < ds->sz2)
{
nearidepth = ds->siz1, faridepth = ds->siz2;
neardepth = ds->sz1, fardepth = ds->sz2;
}
else
{
nearidepth = ds->siz2, faridepth = ds->siz1;
neardepth = ds->sz2, fardepth = ds->sz1;
}
// (siz2 - siz1)*(rx - sx1)/(sx2 - sx1)
// Lower values are further away
if (nearidepth < spr->idepth || (faridepth < spr->idepth &&
if (neardepth > spr->depth || (fardepth > spr->depth &&
// Check if sprite is in front of draw seg:
Scale (ds->siz2 - ds->siz1, (r1+r2)/2 - ds->sx1, ds->sx2 - ds->sx1) + ds->siz1 < spr->idepth))
DMulScale24 (spr->depth - ds->cy, ds->cdx, ds->cdy, ds->cx - spr->cx) < 0))
{
// seg is behind sprite, so draw the mid texture if it has one
if (ds->maskedtexturecol != -1 || ds->bFogBoundary)
@ -2430,6 +2430,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
vis->xscale = xscale;
// vis->yscale = FixedMul (xscale, InvZtoScale);
vis->yscale = xscale;
vis->depth = tz;
vis->idepth = (DWORD)DivScale32 (1, tz) >> 1;
vis->cx = tx;
vis->gx = particle->x;