From 4a8dd8031e50a8a27e083621e2b322cea6c1f336 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 23 Nov 2015 17:01:10 +0000 Subject: [PATCH] dispoffset now works in OpenGL --- src/hardware/hw_glob.h | 1 + src/hardware/hw_main.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 88786bc1..83dff02f 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -79,6 +79,7 @@ typedef struct gr_vissprite_s boolean vflip; //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; + INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing } gr_vissprite_t; // -------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4afd7998..7d6caa04 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3998,6 +3998,7 @@ static void HWR_SortVisSprites(void) gr_vissprite_t *best = NULL; gr_vissprite_t unsorted; float bestdist; + INT32 bestdispoffset; if (!gr_visspritecount) return; @@ -4025,11 +4026,19 @@ static void HWR_SortVisSprites(void) for (i = 0; i < gr_visspritecount; i++) { bestdist = ZCLIP_PLANE-1; + bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { if (ds->tz > bestdist) { 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; } } @@ -4653,6 +4662,7 @@ static void HWR_ProjectSprite(mobj_t *thing) #endif vis->x2 = tx; vis->tz = tz; + vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = thing; @@ -4769,6 +4779,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) vis->x1 = x1; vis->x2 = tx; vis->tz = tz; + vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = (mobj_t *)thing;