mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-06 08:22:01 +00:00
Noticed some sorting issues, so introduced the sortscale struct variable. (SORRY, NO FLAG YET)
This commit is contained in:
parent
ce8ae48222
commit
430d7cfbd2
2 changed files with 17 additions and 13 deletions
|
@ -1027,7 +1027,7 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
|
||||||
if (testheight <= sprite->gz)
|
if (testheight <= sprite->gz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cutfrac = (INT16)((centeryfrac - FixedMul(testheight - viewz, sprite->scale))>>FRACBITS);
|
cutfrac = (INT16)((centeryfrac - FixedMul(testheight - viewz, sprite->sortscale))>>FRACBITS);
|
||||||
if (cutfrac < 0)
|
if (cutfrac < 0)
|
||||||
continue;
|
continue;
|
||||||
if (cutfrac > viewheight)
|
if (cutfrac > viewheight)
|
||||||
|
@ -1100,7 +1100,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
fixed_t tr_x, tr_y;
|
fixed_t tr_x, tr_y;
|
||||||
fixed_t gxt, gyt;
|
fixed_t gxt, gyt;
|
||||||
fixed_t tx, tz;
|
fixed_t tx, tz;
|
||||||
fixed_t xscale, yscale; //added : 02-02-98 : aaargll..if I were a math-guy!!!
|
fixed_t xscale, yscale, sortscale; //added : 02-02-98 : aaargll..if I were a math-guy!!!
|
||||||
|
|
||||||
INT32 x1, x2;
|
INT32 x1, x2;
|
||||||
|
|
||||||
|
@ -1152,7 +1152,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
|
|
||||||
// aspect ratio stuff
|
// aspect ratio stuff
|
||||||
xscale = FixedDiv(projection, tz);
|
xscale = FixedDiv(projection, tz);
|
||||||
yscale = FixedDiv(projectiony, tz);
|
sortscale = FixedDiv(projectiony, tz);
|
||||||
|
|
||||||
// decide which patch to use for sprite relative to player
|
// decide which patch to use for sprite relative to player
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
|
@ -1294,7 +1294,10 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
scalestep = (yscale2 - yscale)/range;
|
scalestep = (yscale2 - yscale)/range;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
yscale = sortscale;
|
||||||
scalestep = 0;
|
scalestep = 0;
|
||||||
|
}
|
||||||
|
|
||||||
xscale = FixedMul(xscale, ang_scale);
|
xscale = FixedMul(xscale, ang_scale);
|
||||||
|
|
||||||
|
@ -1379,6 +1382,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
vis->heightsec = heightsec; //SoM: 3/17/2000
|
vis->heightsec = heightsec; //SoM: 3/17/2000
|
||||||
vis->mobjflags = thing->flags;
|
vis->mobjflags = thing->flags;
|
||||||
vis->scale = yscale; //<<detailshift;
|
vis->scale = yscale; //<<detailshift;
|
||||||
|
vis->sortscale = sortscale;
|
||||||
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15
|
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15
|
||||||
vis->gx = thing->x;
|
vis->gx = thing->x;
|
||||||
vis->gy = thing->y;
|
vis->gy = thing->y;
|
||||||
|
@ -1778,14 +1782,14 @@ void R_SortVisSprites(void)
|
||||||
bestscale = bestdispoffset = INT32_MAX;
|
bestscale = bestdispoffset = INT32_MAX;
|
||||||
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
|
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
|
||||||
{
|
{
|
||||||
if (ds->scale < bestscale)
|
if (ds->sortscale < bestscale)
|
||||||
{
|
{
|
||||||
bestscale = ds->scale;
|
bestscale = ds->sortscale;
|
||||||
bestdispoffset = ds->dispoffset;
|
bestdispoffset = ds->dispoffset;
|
||||||
best = ds;
|
best = ds;
|
||||||
}
|
}
|
||||||
// order visprites of same scale by dispoffset, smallest first
|
// order visprites of same scale by dispoffset, smallest first
|
||||||
else if (ds->scale == bestscale && ds->dispoffset < bestdispoffset)
|
else if (ds->sortscale == bestscale && ds->dispoffset < bestdispoffset)
|
||||||
{
|
{
|
||||||
bestdispoffset = ds->dispoffset;
|
bestdispoffset = ds->dispoffset;
|
||||||
best = ds;
|
best = ds;
|
||||||
|
@ -2039,8 +2043,8 @@ static void R_CreateDrawNodes(void)
|
||||||
if (r2->sprite->szt > rover->sz || r2->sprite->sz < rover->szt)
|
if (r2->sprite->szt > rover->sz || r2->sprite->sz < rover->szt)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (r2->sprite->scale > rover->scale
|
if (r2->sprite->sortscale > rover->scale
|
||||||
|| (r2->sprite->scale == rover->scale && r2->sprite->dispoffset > rover->dispoffset))
|
|| (r2->sprite->sortscale == rover->scale && r2->sprite->dispoffset > rover->dispoffset))
|
||||||
{
|
{
|
||||||
entry = R_CreateDrawNode(NULL);
|
entry = R_CreateDrawNode(NULL);
|
||||||
(entry->prev = r2->prev)->next = entry;
|
(entry->prev = r2->prev)->next = entry;
|
||||||
|
@ -2193,8 +2197,8 @@ void R_ClipSprites(void)
|
||||||
scale = ds->scale2;
|
scale = ds->scale2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scale < spr->scale ||
|
if (scale < spr->sortscale ||
|
||||||
(lowscale < spr->scale &&
|
(lowscale < spr->sortscale &&
|
||||||
!R_PointOnSegSide (spr->gx, spr->gy, ds->curline)))
|
!R_PointOnSegSide (spr->gx, spr->gy, ds->curline)))
|
||||||
{
|
{
|
||||||
// masked mid texture?
|
// masked mid texture?
|
||||||
|
@ -2245,7 +2249,7 @@ void R_ClipSprites(void)
|
||||||
fixed_t mh, h;
|
fixed_t mh, h;
|
||||||
INT32 phs = viewplayer->mo->subsector->sector->heightsec;
|
INT32 phs = viewplayer->mo->subsector->sector->heightsec;
|
||||||
if ((mh = sectors[spr->heightsec].floorheight) > spr->gz &&
|
if ((mh = sectors[spr->heightsec].floorheight) > spr->gz &&
|
||||||
(h = centeryfrac - FixedMul(mh -= viewz, spr->scale)) >= 0 &&
|
(h = centeryfrac - FixedMul(mh -= viewz, spr->sortscale)) >= 0 &&
|
||||||
(h >>= FRACBITS) < viewheight)
|
(h >>= FRACBITS) < viewheight)
|
||||||
{
|
{
|
||||||
if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight))
|
if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight))
|
||||||
|
@ -2263,7 +2267,7 @@ void R_ClipSprites(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt &&
|
if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt &&
|
||||||
(h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 &&
|
(h = centeryfrac - FixedMul(mh-viewz, spr->sortscale)) >= 0 &&
|
||||||
(h >>= FRACBITS) < viewheight)
|
(h >>= FRACBITS) < viewheight)
|
||||||
{
|
{
|
||||||
if (phs != -1 && viewz >= sectors[phs].ceilingheight)
|
if (phs != -1 && viewz >= sectors[phs].ceilingheight)
|
||||||
|
|
|
@ -135,7 +135,7 @@ typedef struct vissprite_s
|
||||||
fixed_t pz, pzt; // physical bottom/top for sorting with 3D floors
|
fixed_t pz, pzt; // physical bottom/top for sorting with 3D floors
|
||||||
|
|
||||||
fixed_t startfrac; // horizontal position of x1
|
fixed_t startfrac; // horizontal position of x1
|
||||||
fixed_t scale;
|
fixed_t scale, sortscale; // sortscale only differs from scale for flat sprites
|
||||||
fixed_t scalestep; // only for flat sprites, 0 otherwise
|
fixed_t scalestep; // only for flat sprites, 0 otherwise
|
||||||
fixed_t xiscale; // negative if flipped
|
fixed_t xiscale; // negative if flipped
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue