mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 17:22:12 +00:00
Merge branch 'kill-these-please' into 'master'
Kill the new compiler errors (since GCC 9?) See merge request STJr/SRB2Internal!448
This commit is contained in:
commit
c85f471911
7 changed files with 106 additions and 98 deletions
|
@ -825,10 +825,10 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
|||
{
|
||||
GLPatch_t* const grpatch = patch;
|
||||
(void)patchnum; //unused
|
||||
while (grpatch->mipmap.nextcolormap)
|
||||
while (grpatch->mipmap->nextcolormap)
|
||||
{
|
||||
GLMipmap_t *grmip = grpatch->mipmap.nextcolormap;
|
||||
grpatch->mipmap.nextcolormap = grmip->nextcolormap;
|
||||
GLMipmap_t *grmip = grpatch->mipmap->nextcolormap;
|
||||
grpatch->mipmap->nextcolormap = grmip->nextcolormap;
|
||||
if (grmip->grInfo.data) Z_Free(grmip->grInfo.data);
|
||||
free(grmip);
|
||||
}
|
||||
|
@ -1005,7 +1005,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
|
@ -1088,22 +1088,22 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
{
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap.downloaded && !gpatch->mipmap.grInfo.data)
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data)
|
||||
{
|
||||
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
||||
// flush the software patch before the conversion! oh yeah I suffered
|
||||
patch_t *ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, gpatch, &gpatch->mipmap, true);
|
||||
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
|
||||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
Z_ChangeTag(gpatch->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
|||
|
||||
// search for the mimmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = &gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
|
@ -1153,7 +1153,7 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
|||
if (!gpatch)
|
||||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
|
||||
|
@ -1241,7 +1241,7 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
|
||||
grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
|
||||
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
{
|
||||
pic_t *pic;
|
||||
UINT8 *block;
|
||||
|
@ -1257,19 +1257,19 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
grpatch->topoffset = 0;
|
||||
|
||||
// find the good 3dfx size (boring spec)
|
||||
HWR_ResizeBlock (grpatch->width, grpatch->height, &grpatch->mipmap.grInfo);
|
||||
grpatch->mipmap.width = (UINT16)blockwidth;
|
||||
grpatch->mipmap.height = (UINT16)blockheight;
|
||||
HWR_ResizeBlock (grpatch->width, grpatch->height, &grpatch->mipmap->grInfo);
|
||||
grpatch->mipmap->width = (UINT16)blockwidth;
|
||||
grpatch->mipmap->height = (UINT16)blockheight;
|
||||
|
||||
if (pic->mode == PALETTE)
|
||||
grpatch->mipmap.grInfo.format = textureformat; // can be set by driver
|
||||
grpatch->mipmap->grInfo.format = textureformat; // can be set by driver
|
||||
else
|
||||
grpatch->mipmap.grInfo.format = picmode2GR[pic->mode];
|
||||
grpatch->mipmap->grInfo.format = picmode2GR[pic->mode];
|
||||
|
||||
Z_Free(grpatch->mipmap.grInfo.data);
|
||||
Z_Free(grpatch->mipmap->grInfo.data);
|
||||
|
||||
// allocate block
|
||||
block = MakeBlock(&grpatch->mipmap);
|
||||
block = MakeBlock(grpatch->mipmap);
|
||||
|
||||
// if rounddown, rounddown patches as well as textures
|
||||
if (cv_grrounddown.value)
|
||||
|
@ -1299,25 +1299,25 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
|
||||
if (grpatch->width == blockwidth &&
|
||||
grpatch->height == blockheight &&
|
||||
format2bpp[grpatch->mipmap.grInfo.format] == format2bpp[picmode2GR[pic->mode]])
|
||||
format2bpp[grpatch->mipmap->grInfo.format] == format2bpp[picmode2GR[pic->mode]])
|
||||
{
|
||||
// no conversion needed
|
||||
M_Memcpy(grpatch->mipmap.grInfo.data, pic->data,len);
|
||||
M_Memcpy(grpatch->mipmap->grInfo.data, pic->data,len);
|
||||
}
|
||||
else
|
||||
HWR_DrawPicInCache(block, newwidth, newheight,
|
||||
blockwidth*format2bpp[grpatch->mipmap.grInfo.format],
|
||||
blockwidth*format2bpp[grpatch->mipmap->grInfo.format],
|
||||
pic,
|
||||
format2bpp[grpatch->mipmap.grInfo.format]);
|
||||
format2bpp[grpatch->mipmap->grInfo.format]);
|
||||
|
||||
Z_Unlock(pic);
|
||||
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
grpatch->mipmap.flags = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
grpatch->max_s = (float)newwidth / (float)blockwidth;
|
||||
grpatch->max_t = (float)newheight / (float)blockheight;
|
||||
}
|
||||
HWD.pfnSetTexture(&grpatch->mipmap);
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.grInfo.data, grpatch->mipmap.downloaded);
|
||||
|
||||
return grpatch;
|
||||
|
@ -1333,6 +1333,7 @@ GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
|||
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
grpatch->wadnum = wadnum;
|
||||
grpatch->lumpnum = lumpnum;
|
||||
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, grpatch);
|
||||
}
|
||||
|
||||
|
@ -1436,7 +1437,7 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
grmip = &HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
HWR_CacheFadeMask(grmip, fademasklumpnum);
|
||||
|
|
|
@ -83,8 +83,8 @@ struct GLPatch_s
|
|||
float max_s,max_t;
|
||||
UINT16 wadnum; // the software patch lump num for when the hardware patch
|
||||
UINT16 lumpnum; // was flushed, and we need to re-create it
|
||||
GLMipmap_t mipmap;
|
||||
};
|
||||
GLMipmap_t *mipmap;
|
||||
} ATTRPACK;
|
||||
typedef struct GLPatch_s GLPatch_t;
|
||||
|
||||
#endif //_HWR_DATA_
|
||||
|
|
|
@ -1205,7 +1205,8 @@ void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch)
|
|||
dynlights->nb++;
|
||||
}
|
||||
|
||||
static GLPatch_t lightmappatch;
|
||||
static GLMipmap_t lightmappatchmipmap;
|
||||
static GLPatch_t lightmappatch = { .mipmap = &lightmappatchmipmap };
|
||||
|
||||
void HWR_InitLight(void)
|
||||
{
|
||||
|
@ -1215,7 +1216,7 @@ void HWR_InitLight(void)
|
|||
for (i = 0;i < NUMLIGHTS;i++)
|
||||
lspr[i].dynamic_sqrradius = lspr[i].dynamic_radius*lspr[i].dynamic_radius;
|
||||
|
||||
lightmappatch.mipmap.downloaded = false;
|
||||
lightmappatch.mipmap->downloaded = false;
|
||||
coronalumpnum = W_CheckNumForName("CORONA");
|
||||
}
|
||||
|
||||
|
@ -1226,10 +1227,10 @@ static void HWR_SetLight(void)
|
|||
{
|
||||
int i, j;
|
||||
|
||||
if (!lightmappatch.mipmap.downloaded && !lightmappatch.mipmap.grInfo.data)
|
||||
if (!lightmappatch.mipmap->downloaded && !lightmappatch.mipmap->grInfo.data)
|
||||
{
|
||||
|
||||
UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap.grInfo.data);
|
||||
UINT16 *Data = Z_Malloc(129*128*sizeof (UINT16), PU_HWRCACHE, &lightmappatch.mipmap->grInfo.data);
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
|
@ -1242,23 +1243,23 @@ static void HWR_SetLight(void)
|
|||
Data[i*128+j] = 0;
|
||||
}
|
||||
}
|
||||
lightmappatch.mipmap.grInfo.format = GR_TEXFMT_ALPHA_INTENSITY_88;
|
||||
lightmappatch.mipmap->grInfo.format = GR_TEXFMT_ALPHA_INTENSITY_88;
|
||||
|
||||
lightmappatch.width = 128;
|
||||
lightmappatch.height = 128;
|
||||
lightmappatch.mipmap.width = 128;
|
||||
lightmappatch.mipmap.height = 128;
|
||||
lightmappatch.mipmap->width = 128;
|
||||
lightmappatch.mipmap->height = 128;
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
lightmappatch.mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
lightmappatch.mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
lightmappatch.mipmap.flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw !
|
||||
lightmappatch.mipmap->flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw !
|
||||
}
|
||||
HWD.pfnSetTexture(&lightmappatch.mipmap);
|
||||
HWD.pfnSetTexture(lightmappatch.mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(lightmappatch.mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(lightmappatch.mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
|
|
|
@ -567,7 +567,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
|||
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
|
||||
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
|
||||
fclose(png_FILE);
|
||||
Z_Free(grpatch->mipmap.grInfo.data);
|
||||
Z_Free(grpatch->mipmap->grInfo.data);
|
||||
return 0;
|
||||
}
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
|
@ -608,7 +608,7 @@ static GrTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
|||
|
||||
{
|
||||
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap.grInfo.data);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
|
||||
for (i = 0; i < height; i++)
|
||||
row_pointers[i] = PNG_image + i*pitch;
|
||||
|
@ -682,7 +682,7 @@ static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
|||
|
||||
pw = *w = header.xmax - header.xmin + 1;
|
||||
ph = *h = header.ymax - header.ymin + 1;
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap.grInfo.data);
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->grInfo.data);
|
||||
|
||||
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
|
||||
{
|
||||
|
@ -730,39 +730,42 @@ static void md2_loadTexture(md2_t *model)
|
|||
if (model->grpatch)
|
||||
{
|
||||
grpatch = model->grpatch;
|
||||
Z_Free(grpatch->mipmap.grInfo.data);
|
||||
Z_Free(grpatch->mipmap->grInfo.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->grpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
|
||||
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap.grInfo.format == 0)
|
||||
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
#endif
|
||||
grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap.grInfo.format == 0)
|
||||
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
return;
|
||||
|
||||
grpatch->mipmap.downloaded = 0;
|
||||
grpatch->mipmap.flags = 0;
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap.width = (UINT16)w;
|
||||
grpatch->mipmap.height = (UINT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(&grpatch->mipmap);
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
}
|
||||
|
||||
|
@ -780,42 +783,45 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
if (model->blendgrpatch)
|
||||
{
|
||||
grpatch = model->blendgrpatch;
|
||||
Z_Free(grpatch->mipmap.grInfo.data);
|
||||
Z_Free(grpatch->mipmap->grInfo.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->blendgrpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
|
||||
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap.grInfo.format == 0)
|
||||
grpatch->mipmap->grInfo.format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
#endif
|
||||
grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap.grInfo.format == 0)
|
||||
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
{
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap.downloaded = 0;
|
||||
grpatch->mipmap.flags = 0;
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap.width = (UINT16)w;
|
||||
grpatch->mipmap.height = (UINT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(&grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
|
@ -1029,8 +1035,8 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap.grInfo.data;
|
||||
blendimage = blendgpatch->mipmap.grInfo.data;
|
||||
image = gpatch->mipmap->grInfo.data;
|
||||
blendimage = blendgpatch->mipmap->grInfo.data;
|
||||
|
||||
// Average all of the translation's colors
|
||||
if (color == SKINCOLOR_NONE || color >= MAXTRANSLATIONS)
|
||||
|
@ -1145,13 +1151,13 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
|||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// skip the first (no colormap translated)
|
||||
for (grmip = &gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
|
@ -1371,18 +1377,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->grpatch;
|
||||
if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded)
|
||||
if (!gpatch || !gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded)
|
||||
md2_loadTexture(md2);
|
||||
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
|
||||
if ((gpatch && gpatch->mipmap.grInfo.format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap.downloaded))
|
||||
if ((gpatch && gpatch->mipmap->grInfo.format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded))
|
||||
md2_loadBlendTexture(md2);
|
||||
|
||||
if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||
{
|
||||
INT32 skinnum = TC_DEFAULT;
|
||||
|
@ -1413,7 +1419,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
|||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
24
src/r_data.c
24
src/r_data.c
|
@ -459,7 +459,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
int x, x1, x2, i, width, height;
|
||||
size_t blocksize;
|
||||
column_t *patchcol;
|
||||
UINT32 *colofs;
|
||||
UINT8 *colofs;
|
||||
|
||||
UINT16 wadnum;
|
||||
lumpnum_t lumpnum;
|
||||
|
@ -496,10 +496,10 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
// Check the patch for holes.
|
||||
if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height))
|
||||
holey = true;
|
||||
colofs = (UINT32 *)realpatch->columnofs;
|
||||
colofs = (UINT8 *)realpatch->columnofs;
|
||||
for (x = 0; x < texture->width && !holey; x++)
|
||||
{
|
||||
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(colofs[x]));
|
||||
column_t *col = (column_t *)((UINT8 *)realpatch + LONG(*(UINT32 *)&colofs[x<<2]));
|
||||
INT32 topdelta, prevdelta = -1, y = 0;
|
||||
while (col->topdelta != 0xff)
|
||||
{
|
||||
|
@ -528,19 +528,19 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
texturememory += blocksize;
|
||||
|
||||
// use the patch's column lookup
|
||||
colofs = (UINT32 *)(void *)(block + 8);
|
||||
texturecolumnofs[texnum] = colofs;
|
||||
colofs = (block + 8);
|
||||
texturecolumnofs[texnum] = (UINT32 *)colofs;
|
||||
blocktex = block;
|
||||
if (patch->flip & 1) // flip the patch horizontally
|
||||
{
|
||||
UINT32 *realcolofs = (UINT32 *)realpatch->columnofs;
|
||||
UINT8 *realcolofs = (UINT8 *)realpatch->columnofs;
|
||||
for (x = 0; x < texture->width; x++)
|
||||
colofs[x] = realcolofs[texture->width-1-x]; // swap with the offset of the other side of the texture
|
||||
*(UINT32 *)&colofs[x<<2] = realcolofs[( texture->width-1-x )<<2]; // swap with the offset of the other side of the texture
|
||||
}
|
||||
// we can't as easily flip the patch vertically sadly though,
|
||||
// we have wait until the texture itself is drawn to do that
|
||||
for (x = 0; x < texture->width; x++)
|
||||
colofs[x] = LONG(LONG(colofs[x]) + 3);
|
||||
*(UINT32 *)&colofs[x<<2] = LONG(LONG(*(UINT32 *)&colofs[x<<2]) + 3);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -560,8 +560,8 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
memset(block, TRANSPARENTPIXEL, blocksize+1); // Transparency hack
|
||||
|
||||
// columns lookup table
|
||||
colofs = (UINT32 *)(void *)block;
|
||||
texturecolumnofs[texnum] = colofs;
|
||||
colofs = block;
|
||||
texturecolumnofs[texnum] = (UINT32 *)colofs;
|
||||
|
||||
// texture data after the lookup table
|
||||
blocktex = block + (texture->width*4);
|
||||
|
@ -616,8 +616,8 @@ static UINT8 *R_GenerateTexture(size_t texnum)
|
|||
patchcol = (column_t *)((UINT8 *)realpatch + LONG(realpatch->columnofs[x-x1]));
|
||||
|
||||
// generate column ofset lookup
|
||||
colofs[x] = LONG((x * texture->height) + (texture->width*4));
|
||||
ColumnDrawerPointer(patchcol, block + LONG(colofs[x]), patch, texture->height, height);
|
||||
*(UINT32 *)&colofs[x<<2] = LONG((x * texture->height) + (texture->width*4));
|
||||
ColumnDrawerPointer(patchcol, block + LONG(*(UINT32 *)&colofs[x<<2]), patch, texture->height, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1565,22 +1565,22 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
|||
|
||||
grPatch = HWR_GetCachedGLPatchPwad(wad, lump);
|
||||
|
||||
if (grPatch->mipmap.grInfo.data)
|
||||
if (grPatch->mipmap->grInfo.data)
|
||||
{
|
||||
if (tag == PU_CACHE)
|
||||
tag = PU_HWRCACHE;
|
||||
Z_ChangeTag(grPatch->mipmap.grInfo.data, tag);
|
||||
Z_ChangeTag(grPatch->mipmap->grInfo.data, tag);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch_t *ptr = NULL;
|
||||
|
||||
// Only load the patch if we haven't initialised the grPatch yet
|
||||
if (grPatch->mipmap.width == 0)
|
||||
if (grPatch->mipmap->width == 0)
|
||||
ptr = W_CacheLumpNumPwad(grPatch->wadnum, grPatch->lumpnum, PU_STATIC);
|
||||
|
||||
// Run HWR_MakePatch in all cases, to recalculate some things
|
||||
HWR_MakePatch(ptr, grPatch, &grPatch->mipmap, false);
|
||||
HWR_MakePatch(ptr, grPatch, grPatch->mipmap, false);
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -2131,7 +2131,7 @@ static void Y_AwardSpecialStageBonus(void)
|
|||
|
||||
data.spec.score = players[consoleplayer].score;
|
||||
memset(data.spec.bonuses, 0, sizeof(data.spec.bonuses));
|
||||
memset(data.spec.bonuspatches, 0, sizeof(data.coop.bonuspatches));
|
||||
memset(data.spec.bonuspatches, 0, sizeof(data.spec.bonuspatches));
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue