mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 13:51:43 +00:00
Delete old pic_t format from Doom Legacy
This commit is contained in:
parent
62db9f17d2
commit
76c7dccd00
6 changed files with 4 additions and 257 deletions
|
@ -970,138 +970,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;
|
||||
|
||||
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 = V_GetColor(texel);
|
||||
memcpy(dest, &col, sizeof(RGBA_t)-sizeof(UINT8));
|
||||
dest += sizeof(RGBA_t)-sizeof(UINT8);
|
||||
break;
|
||||
case 4 :
|
||||
memcpy(dest, &V_GetColor(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;
|
||||
|
|
|
@ -653,46 +653,10 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
||||
{
|
||||
FOutVector v[4];
|
||||
const patch_t *patch;
|
||||
|
||||
// make pic ready in hardware cache
|
||||
patch = HWR_GetPic(lumpnum);
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
// |/ |
|
||||
// 0--1
|
||||
|
||||
v[0].x = v[3].x = 2.0f * (float)x/vid.width - 1;
|
||||
v[2].x = v[1].x = 2.0f * (float)(x + patch->width*FIXED_TO_FLOAT(vid.fdup))/vid.width - 1;
|
||||
v[0].y = v[1].y = 1.0f - 2.0f * (float)y/vid.height;
|
||||
v[2].y = v[3].y = 1.0f - 2.0f * (float)(y + patch->height*FIXED_TO_FLOAT(vid.fdup))/vid.height;
|
||||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = 0;
|
||||
v[2].s = v[1].s = ((GLPatch_t *)patch->hardware)->max_s;
|
||||
v[0].t = v[1].t = 0;
|
||||
v[2].t = v[3].t = ((GLPatch_t *)patch->hardware)->max_t;
|
||||
|
||||
|
||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
||||
// it not a problem since they don't have any transparent pixel
|
||||
// if I'm right !?
|
||||
// But then, the question is: why not 0 instead of PF_Masked ?
|
||||
// or maybe PF_Environment ??? (like what I said above)
|
||||
// BP: PF_Environment don't change anything ! and 0 is undifined
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_Translucent | PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// V_VIDEO.C STUFF
|
||||
// ==========================================================================
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Fills a box of pixels using a flat texture as a pattern
|
||||
// --------------------------------------------------------------------------
|
||||
|
|
15
src/m_menu.c
15
src/m_menu.c
|
@ -6331,18 +6331,11 @@ static void M_StopMessage(INT32 choice)
|
|||
// You can even put multiple images in one menu!
|
||||
static void M_DrawImageDef(void)
|
||||
{
|
||||
// Grr. Need to autodetect for pic_ts.
|
||||
pic_t *pictest = (pic_t *)W_CacheLumpName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
||||
if (!pictest->zero)
|
||||
V_DrawScaledPic(0,0,0,W_GetNumForName(currentMenu->menuitems[itemOn].text));
|
||||
patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text, PU_PATCH);
|
||||
if (patch->width <= BASEVIDWIDTH)
|
||||
V_DrawScaledPatch(0,0,0,patch);
|
||||
else
|
||||
{
|
||||
patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_PATCH);
|
||||
if (patch->width <= BASEVIDWIDTH)
|
||||
V_DrawScaledPatch(0,0,0,patch);
|
||||
else
|
||||
V_DrawSmallScaledPatch(0,0,0,patch);
|
||||
}
|
||||
V_DrawSmallScaledPatch(0,0,0,patch);
|
||||
|
||||
if (currentMenu->numitems > 1)
|
||||
V_DrawString(0,192,V_TRANSLUCENT, va("PAGE %d of %hd", itemOn+1, currentMenu->numitems));
|
||||
|
|
20
src/r_defs.h
20
src/r_defs.h
|
@ -893,26 +893,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
|
||||
|
|
|
@ -1094,61 +1094,6 @@ void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const
|
|||
}
|
||||
}
|
||||
|
||||
static void V_BlitScaledPic(INT32 px1, INT32 py1, INT32 scrn, pic_t *pic);
|
||||
// Draw a linear pic, scaled, TOTALLY CRAP CODE!!! OPTIMISE AND ASM!!
|
||||
//
|
||||
void V_DrawScaledPic(INT32 rx1, INT32 ry1, INT32 scrn, INT32 lumpnum)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
{
|
||||
HWR_DrawPic(rx1, ry1, lumpnum);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
V_BlitScaledPic(rx1, ry1, scrn, W_CacheLumpNum(lumpnum, PU_CACHE));
|
||||
}
|
||||
|
||||
static void V_BlitScaledPic(INT32 rx1, INT32 ry1, INT32 scrn, pic_t * pic)
|
||||
{
|
||||
INT32 dupx, dupy;
|
||||
INT32 x, y;
|
||||
UINT8 *src, *dest;
|
||||
INT32 width, height;
|
||||
|
||||
width = SHORT(pic->width);
|
||||
height = SHORT(pic->height);
|
||||
scrn &= V_PARAMMASK;
|
||||
|
||||
if (pic->mode != 0)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "pic mode %d not supported in Software\n", pic->mode);
|
||||
return;
|
||||
}
|
||||
|
||||
dest = screens[scrn] + max(0, ry1 * vid.width) + max(0, rx1);
|
||||
// y cliping to the screen
|
||||
if (ry1 + height * vid.dup >= vid.width)
|
||||
height = (vid.width - ry1) / vid.dup - 1;
|
||||
// WARNING no x clipping (not needed for the moment)
|
||||
|
||||
for (y = max(0, -ry1 / vid.dup); y < height; y++)
|
||||
{
|
||||
for (dupy = vid.dup; dupy; dupy--)
|
||||
{
|
||||
src = pic->data + y * width;
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
for (dupx = vid.dup; dupx; dupx--)
|
||||
*dest++ = *src;
|
||||
src++;
|
||||
}
|
||||
dest += vid.width - vid.dup * width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fills a box of pixels with a single color, NOTE: scaled to screen size
|
||||
//
|
||||
|
|
|
@ -178,9 +178,6 @@ void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT16 ski
|
|||
// Draw a linear block of pixels into the view buffer.
|
||||
void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const UINT8 *src);
|
||||
|
||||
// draw a pic_t, SCALED
|
||||
void V_DrawScaledPic (INT32 px1, INT32 py1, INT32 scrn, INT32 lumpnum);
|
||||
|
||||
// fill a box with a single color
|
||||
void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
||||
void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
||||
|
|
Loading…
Reference in a new issue