fix hwrpatch grabbing the wrong patch

getmapped patch needs to be called before this is referenced to avoid potential issues
This commit is contained in:
Alug committed 2025-04-18 22:45:27 +02:00
1 parent 3fe77da35f
commit f03a12241d
1 file changed
+17 -14
+17 -14
View File
@@ -3329,7 +3329,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch)
float offset = 0;
GLPatch_t *hwrpatch;
hwrpatch = (GLPatch_t *)(gpatch->hardware);
hwrpatch = ((GLPatch_t *)gpatch->hardware);
// technically this_scale gets multiplied and added to sprite y/x scale, but this thing needs it for some crap so ill just throw it in here again
const boolean hires = (spr->mobj && spr->mobj->skin && K_GetMobjSkin(spr->mobj)->flags & SF_HIRES);
@@ -3604,13 +3604,14 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
INT32 shader = SHADER_NONE;
gpatch = spr->gpatch;
hwrpatch = (GLPatch_t *)(gpatch->hardware);
// cache the patch in the graphics card memory
//12/12/99: Hurdler: same comment as above (for md2)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
hwrpatch = ((GLPatch_t *)gpatch->hardware);
// Draw shadow BEFORE sprite
if (cv_shadow.value // Shadows enabled
&& (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
@@ -3881,7 +3882,13 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
// in memory and we add the md2 model if it exists for that sprite
gpatch = spr->gpatch;
hwrpatch = (GLPatch_t *)(gpatch->hardware);
// cache the patch in the graphics card memory
//12/12/99: Hurdler: same comment as above (for md2)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
hwrpatch = ((GLPatch_t *)gpatch->hardware);
// create the sprite billboard
//
@@ -3924,11 +3931,6 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
wallVerts[0].t = wallVerts[1].t = hwrpatch->max_t;
}
// cache the patch in the graphics card memory
//12/12/99: Hurdler: same comment as above (for md2)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
// Draw shadow BEFORE sprite
if (cv_shadow.value // Shadows enabled
&& (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
@@ -4018,7 +4020,13 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
// cache sprite graphics
gpatch = spr->gpatch;
hwrpatch = (GLPatch_t *)(gpatch->hardware);
// cache the patch in the graphics card memory
//12/12/99: Hurdler: same comment as above (for md2)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
hwrpatch = ((GLPatch_t *)gpatch->hardware);
// create the sprite billboard
//
@@ -4044,11 +4052,6 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr)
wallVerts[3].t = wallVerts[2].t = 0;
wallVerts[0].t = wallVerts[1].t = hwrpatch->max_t;
// cache the patch in the graphics card memory
//12/12/99: Hurdler: same comment as above (for md2)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
// colormap test
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = 255;