dispoffset now works in OpenGL

This commit is contained in:
Monster Iestyn 2015-11-23 17:01:10 +00:00 committed by Inuyasha
parent 049689334d
commit 4a8dd8031e
2 changed files with 12 additions and 0 deletions

View file

@ -79,6 +79,7 @@ typedef struct gr_vissprite_s
boolean vflip; boolean vflip;
//Hurdler: 25/04/2000: now support colormap in hardware mode //Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap; UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gr_vissprite_t; } gr_vissprite_t;
// -------- // --------

View file

@ -3998,6 +3998,7 @@ static void HWR_SortVisSprites(void)
gr_vissprite_t *best = NULL; gr_vissprite_t *best = NULL;
gr_vissprite_t unsorted; gr_vissprite_t unsorted;
float bestdist; float bestdist;
INT32 bestdispoffset;
if (!gr_visspritecount) if (!gr_visspritecount)
return; return;
@ -4025,11 +4026,19 @@ static void HWR_SortVisSprites(void)
for (i = 0; i < gr_visspritecount; i++) for (i = 0; i < gr_visspritecount; i++)
{ {
bestdist = ZCLIP_PLANE-1; bestdist = ZCLIP_PLANE-1;
bestdispoffset = INT32_MAX;
for (ds = unsorted.next; ds != &unsorted; ds = ds->next) for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
{ {
if (ds->tz > bestdist) if (ds->tz > bestdist)
{ {
bestdist = ds->tz; bestdist = ds->tz;
bestdispoffset = ds->dispoffset;
best = ds;
}
// order visprites of same scale by dispoffset, smallest first
else if (ds->tz == bestdist && ds->dispoffset < bestdispoffset)
{
bestdispoffset = ds->dispoffset;
best = ds; best = ds;
} }
} }
@ -4653,6 +4662,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
#endif #endif
vis->x2 = tx; vis->x2 = tx;
vis->tz = tz; vis->tz = tz;
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
vis->patchlumpnum = sprframe->lumppat[rot]; vis->patchlumpnum = sprframe->lumppat[rot];
vis->flip = flip; vis->flip = flip;
vis->mobj = thing; vis->mobj = thing;
@ -4769,6 +4779,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->x1 = x1; vis->x1 = x1;
vis->x2 = tx; vis->x2 = tx;
vis->tz = tz; vis->tz = tz;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
vis->patchlumpnum = sprframe->lumppat[rot]; vis->patchlumpnum = sprframe->lumppat[rot];
vis->flip = flip; vis->flip = flip;
vis->mobj = (mobj_t *)thing; vis->mobj = (mobj_t *)thing;