mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-19 16:01:35 +00:00
Delete the last remnants of Doom Legacy's pic_t format
This commit is contained in:
parent
5a46f12c62
commit
6cdaf24a27
5 changed files with 2 additions and 157 deletions
|
@ -972,139 +972,6 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
|||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
static const INT32 picmode2GR[] =
|
||||
{
|
||||
GL_TEXFMT_P_8, // PALETTE
|
||||
0, // INTENSITY (unsupported yet)
|
||||
GL_TEXFMT_ALPHA_INTENSITY_88, // INTENSITY_ALPHA (corona use this)
|
||||
0, // RGB24 (unsupported yet)
|
||||
GL_TEXFMT_RGBA, // RGBA32 (opengl only)
|
||||
};
|
||||
|
||||
static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheight,
|
||||
INT32 blockmodulo, pic_t *pic, INT32 bpp)
|
||||
{
|
||||
INT32 i,j;
|
||||
fixed_t posx, posy, stepx, stepy;
|
||||
UINT8 *dest, *src, texel;
|
||||
UINT16 texelu16;
|
||||
INT32 picbpp;
|
||||
RGBA_t col;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
stepy = ((INT32)SHORT(pic->height)<<FRACBITS)/pblockheight;
|
||||
stepx = ((INT32)SHORT(pic->width)<<FRACBITS)/pblockwidth;
|
||||
picbpp = format2bpp(picmode2GR[pic->mode]);
|
||||
posy = 0;
|
||||
for (j = 0; j < pblockheight; j++)
|
||||
{
|
||||
posx = 0;
|
||||
dest = &block[j*blockmodulo];
|
||||
src = &pic->data[(posy>>FRACBITS)*SHORT(pic->width)*picbpp];
|
||||
for (i = 0; i < pblockwidth;i++)
|
||||
{
|
||||
switch (pic->mode)
|
||||
{ // source bpp
|
||||
case PALETTE :
|
||||
texel = src[(posx+FRACUNIT/2)>>FRACBITS];
|
||||
switch (bpp)
|
||||
{ // destination bpp
|
||||
case 1 :
|
||||
*dest++ = texel; break;
|
||||
case 2 :
|
||||
texelu16 = (UINT16)(texel | 0xff00);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
dest += sizeof(UINT16);
|
||||
break;
|
||||
case 3 :
|
||||
col = palette[texel];
|
||||
memcpy(dest, &col, sizeof(RGBA_t)-sizeof(UINT8));
|
||||
dest += sizeof(RGBA_t)-sizeof(UINT8);
|
||||
break;
|
||||
case 4 :
|
||||
memcpy(dest, &palette[texel], sizeof(RGBA_t));
|
||||
dest += sizeof(RGBA_t);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case INTENSITY :
|
||||
*dest++ = src[(posx+FRACUNIT/2)>>FRACBITS];
|
||||
break;
|
||||
case INTENSITY_ALPHA : // assume dest bpp = 2
|
||||
memcpy(dest, src + ((posx+FRACUNIT/2)>>FRACBITS)*sizeof(UINT16), sizeof(UINT16));
|
||||
dest += sizeof(UINT16);
|
||||
break;
|
||||
case RGB24 :
|
||||
break; // not supported yet
|
||||
case RGBA32 : // assume dest bpp = 4
|
||||
dest += sizeof(UINT32);
|
||||
memcpy(dest, src + ((posx+FRACUNIT/2)>>FRACBITS)*sizeof(UINT32), sizeof(UINT32));
|
||||
break;
|
||||
}
|
||||
posx += stepx;
|
||||
}
|
||||
posy += stepy;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_GetPic : Download a Doom pic (raw row encoded with no 'holes')
|
||||
// Returns :
|
||||
// -----------------+
|
||||
patch_t *HWR_GetPic(lumpnum_t lumpnum)
|
||||
{
|
||||
patch_t *patch = HWR_GetCachedGLPatch(lumpnum);
|
||||
GLPatch_t *grPatch = (GLPatch_t *)(patch->hardware);
|
||||
|
||||
if (!grPatch->mipmap->downloaded && !grPatch->mipmap->data)
|
||||
{
|
||||
pic_t *pic;
|
||||
UINT8 *block;
|
||||
size_t len;
|
||||
|
||||
pic = W_CacheLumpNum(lumpnum, PU_CACHE);
|
||||
patch->width = SHORT(pic->width);
|
||||
patch->height = SHORT(pic->height);
|
||||
len = W_LumpLength(lumpnum) - sizeof (pic_t);
|
||||
|
||||
grPatch->mipmap->width = (UINT16)patch->width;
|
||||
grPatch->mipmap->height = (UINT16)patch->height;
|
||||
|
||||
if (pic->mode == PALETTE)
|
||||
grPatch->mipmap->format = textureformat; // can be set by driver
|
||||
else
|
||||
grPatch->mipmap->format = picmode2GR[pic->mode];
|
||||
|
||||
Z_Free(grPatch->mipmap->data);
|
||||
|
||||
// allocate block
|
||||
block = MakeBlock(grPatch->mipmap);
|
||||
|
||||
if (patch->width == SHORT(pic->width) &&
|
||||
patch->height == SHORT(pic->height) &&
|
||||
format2bpp(grPatch->mipmap->format) == format2bpp(picmode2GR[pic->mode]))
|
||||
{
|
||||
// no conversion needed
|
||||
M_Memcpy(grPatch->mipmap->data, pic->data,len);
|
||||
}
|
||||
else
|
||||
HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height),
|
||||
SHORT(pic->width)*format2bpp(grPatch->mipmap->format),
|
||||
pic,
|
||||
format2bpp(grPatch->mipmap->format));
|
||||
|
||||
Z_Unlock(pic);
|
||||
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
grPatch->mipmap->flags = 0;
|
||||
grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
}
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grPatch->mipmap->data, grPatch->mipmap->downloaded);
|
||||
|
||||
return patch;
|
||||
}
|
||||
|
||||
patch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
{
|
||||
lumpcache_t *lumpcache = wadfiles[wadnum]->patchcache;
|
||||
|
|
|
@ -119,7 +119,6 @@ patch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
|
|||
void HWR_GetPatch(patch_t *patch);
|
||||
void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap);
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
||||
patch_t *HWR_GetPic(lumpnum_t lumpnum);
|
||||
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex);
|
||||
void HWR_GetLevelFlat(levelflat_t *levelflat);
|
||||
|
|
|
@ -1055,7 +1055,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr)
|
|||
light[3].y = cy+size*1.33f+p_lspr->light_yoffset;
|
||||
light[3].s = 0.0f; light[3].t = 1.0f;
|
||||
|
||||
HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
// HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Corona | PF_NoDepthTest);
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ void HWR_DrawCoronas(void)
|
|||
if (!cv_glcoronas.value || dynlights->nb <= 0 || coronalumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
// HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
for (j = 0;j < dynlights->nb;j++)
|
||||
{
|
||||
FOutVector light[4];
|
||||
|
|
|
@ -45,7 +45,6 @@ void HWR_CreateStaticLightmaps(INT32 bspnum);
|
|||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||
void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength);
|
||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right.
|
||||
void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum);
|
||||
|
||||
UINT8 *HWR_GetScreenshot(void);
|
||||
boolean HWR_Screenshot(const char *pathname);
|
||||
|
|
20
src/r_defs.h
20
src/r_defs.h
|
@ -906,26 +906,6 @@ typedef struct
|
|||
// the [0] is &columnofs[width]
|
||||
} ATTRPACK softwarepatch_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4200)
|
||||
#endif
|
||||
|
||||
// a pic is an unmasked block of pixels, stored in horizontal way
|
||||
typedef struct
|
||||
{
|
||||
INT16 width;
|
||||
UINT8 zero; // set to 0 allow autodetection of pic_t
|
||||
// mode instead of patch or raw
|
||||
UINT8 mode; // see pic_mode_t above
|
||||
INT16 height;
|
||||
INT16 reserved1; // set to 0
|
||||
UINT8 data[0];
|
||||
} ATTRPACK pic_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default : 4200)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue