clean up patch drawers a little
esp for software
This commit is contained in:
1 parent
c64e10083b
commit
d1552e7b71
4 files changed
+68
-314
No files matched your search
+10
-4
@@ -217,8 +217,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
const UINT8 *source = (const UINT8 *)(column) + 3;
|
||||
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
const UINT8 *source = (const UINT8 *)(column) + 3;
|
||||
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||
}
|
||||
Z_Free(realpatch);
|
||||
}
|
||||
// centre screen
|
||||
@@ -365,8 +368,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
const UINT8 *source = (const UINT8 *)(column) + 3;
|
||||
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
const UINT8 *source = (const UINT8 *)(column) + 3;
|
||||
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||
}
|
||||
Z_Free(realpatch);
|
||||
}
|
||||
// centre screen
|
||||
|
||||
+1
-6
@@ -4133,15 +4133,10 @@ void M_Drawer(void)
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl"));
|
||||
}
|
||||
#endif
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
|
||||
}
|
||||
|
||||
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-274
@@ -211,280 +211,6 @@ void R_InitTranslationTables(void)
|
||||
W_ReadLump(W_GetNumForName("TRANS90"), transtables+0x80000);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Generates a translation colormap.
|
||||
|
||||
\param dest_colormap colormap to populate
|
||||
\param skinnum number of skin, TC_DEFAULT or TC_BOSS
|
||||
\param color translation color
|
||||
|
||||
\return void
|
||||
*/
|
||||
/*
|
||||
static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color)
|
||||
{
|
||||
// Table of indices into the palette of the first entries of each translated ramp
|
||||
const UINT8 skinbasecolors[] = {
|
||||
0x00, // SKINCOLOR_WHITE
|
||||
0x03, // SKINCOLOR_SILVER
|
||||
0x08, // SKINCOLOR_GREY
|
||||
0x18, // SKINCOLOR_BLACK
|
||||
0xd0, // SKINCOLOR_CYAN
|
||||
0xdc, // SKINCOLOR_TEAL
|
||||
0xc8, // SKINCOLOR_STEEL
|
||||
0xe2, // SKINCOLOR_BLUE
|
||||
0x40, // SKINCOLOR_PEACH
|
||||
0x48, // SKINCOLOR_TAN
|
||||
0x90, // SKINCOLOR_PINK
|
||||
0xf8, // SKINCOLOR_LAVENDER
|
||||
0xc0, // SKINCOLOR_PURPLE
|
||||
0x52, // SKINCOLOR_ORANGE
|
||||
0x5c, // SKINCOLOR_ROSEWOOD
|
||||
0x20, // SKINCOLOR_BEIGE
|
||||
0x30, // SKINCOLOR_BROWN
|
||||
0x7d, // SKINCOLOR_RED
|
||||
0x85, // SKINCOLOR_DARKRED
|
||||
0xb8, // SKINCOLOR_NEONGREEN
|
||||
0xa0, // SKINCOLOR_GREEN
|
||||
0xb0, // SKINCOLOR_ZIM
|
||||
0x69, // SKINCOLOR_OLIVE
|
||||
0x67, // SKINCOLOR_YELLOW
|
||||
0x70, // SKINCOLOR_GOLD
|
||||
};
|
||||
INT32 i;
|
||||
INT32 starttranscolor;
|
||||
|
||||
// Handle a couple of simple special cases
|
||||
if (skinnum == TC_BOSS || skinnum == TC_ALLWHITE || skinnum == TC_METALSONIC || color == SKINCOLOR_NONE)
|
||||
{
|
||||
for (i = 0; i < NUM_PALETTE_ENTRIES; i++)
|
||||
{
|
||||
if (skinnum == TC_ALLWHITE) dest_colormap[i] = 0;
|
||||
else dest_colormap[i] = (UINT8)i;
|
||||
}
|
||||
|
||||
// White!
|
||||
if (skinnum == TC_BOSS)
|
||||
dest_colormap[31] = 0;
|
||||
else if (skinnum == TC_METALSONIC)
|
||||
dest_colormap[239] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR;
|
||||
|
||||
// Fill in the entries of the palette that are fixed
|
||||
for (i = 0; i < starttranscolor; i++)
|
||||
dest_colormap[i] = (UINT8)i;
|
||||
|
||||
for (i = (UINT8)(starttranscolor + 16); i < NUM_PALETTE_ENTRIES; i++)
|
||||
dest_colormap[i] = (UINT8)i;
|
||||
|
||||
// Build the translated ramp
|
||||
switch (color)
|
||||
{
|
||||
case SKINCOLOR_SILVER:
|
||||
case SKINCOLOR_GREY:
|
||||
case SKINCOLOR_PEACH:
|
||||
case SKINCOLOR_BEIGE:
|
||||
case SKINCOLOR_BROWN:
|
||||
case SKINCOLOR_RED:
|
||||
case SKINCOLOR_GREEN:
|
||||
case SKINCOLOR_BLUE:
|
||||
// 16 color ramp
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_ORANGE:
|
||||
// 14 colors of orange + brown
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH-2; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i);
|
||||
for (i = 0; i < 2; i++)
|
||||
dest_colormap[starttranscolor + (i+SKIN_RAMP_LENGTH-2)] = (UINT8)(152 + i);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_CYAN:
|
||||
// 12 color ramp
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_WHITE:
|
||||
case SKINCOLOR_BLACK:
|
||||
case SKINCOLOR_STEEL:
|
||||
case SKINCOLOR_PINK:
|
||||
case SKINCOLOR_LAVENDER:
|
||||
case SKINCOLOR_PURPLE:
|
||||
case SKINCOLOR_DARKRED:
|
||||
case SKINCOLOR_ZIM:
|
||||
case SKINCOLOR_YELLOW:
|
||||
case SKINCOLOR_GOLD:
|
||||
// 8 color ramp
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TEAL:
|
||||
// 5 color ramp
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
{
|
||||
if (5*i/16 == 0)
|
||||
dest_colormap[starttranscolor + i] = 0xf7;
|
||||
else
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (5*i/SKIN_RAMP_LENGTH) - 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case SKINCOLOR_OLIVE:
|
||||
// 7 color ramp
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (7*i/SKIN_RAMP_LENGTH));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TAN:
|
||||
// 16 color ramp, from two color ranges
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH/2; i++) // Peach half
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i);
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH/2; i++) // Brown half
|
||||
dest_colormap[starttranscolor + (i+8)] = (UINT8)(48 + i);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_ROSEWOOD:
|
||||
// 12 color ramp, from two color ranges!
|
||||
for (i = 0; i < 6; i++) // Orange ...third?
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH));
|
||||
for (i = 0; i < 10; i++) // Rosewood two-thirds-ish
|
||||
dest_colormap[starttranscolor + (i+6)] = (UINT8)(152 + (12*i/SKIN_RAMP_LENGTH));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_NEONGREEN:
|
||||
// Multi-color ramp
|
||||
dest_colormap[starttranscolor] = 0xA0; // Brighter green
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH-1; i++) // Neon Green
|
||||
dest_colormap[starttranscolor + (i+1)] = (UINT8)(skinbasecolors[color - 1] + (6*i/(SKIN_RAMP_LENGTH-1)));
|
||||
break;
|
||||
|
||||
// Super colors, from lightest to darkest!
|
||||
case SKINCOLOR_SUPER1:
|
||||
// Super White
|
||||
for (i = 0; i < 10; i++)
|
||||
dest_colormap[starttranscolor + i] = 120; // True white
|
||||
for (; i < SKIN_RAMP_LENGTH; i++) // White-yellow fade
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(96 + (i-10));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_SUPER2:
|
||||
// Super Bright
|
||||
for (i = 0; i < 5; i++) // White-yellow fade
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(96 + i);
|
||||
dest_colormap[starttranscolor + 5] = 112; // Golden shine
|
||||
for (i = 0; i < 8; i++) // Yellow
|
||||
dest_colormap[starttranscolor + (i+6)] = (UINT8)(101 + (i>>1));
|
||||
for (i = 0; i < 2; i++) // With a fine golden finish! :3
|
||||
dest_colormap[starttranscolor + (i+14)] = (UINT8)(113 + i);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_SUPER3:
|
||||
// Super Yellow
|
||||
for (i = 0; i < 3; i++) // White-yellow fade
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(98 + i);
|
||||
dest_colormap[starttranscolor + 3] = 112; // Golden shine
|
||||
for (i = 0; i < 8; i++) // Yellow
|
||||
dest_colormap[starttranscolor + (i+4)] = (UINT8)(101 + (i>>1));
|
||||
for (i = 0; i < 4; i++) // With a fine golden finish! :3
|
||||
dest_colormap[starttranscolor + (i+12)] = (UINT8)(113 + i);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_SUPER4:
|
||||
// "The SSNTails"
|
||||
dest_colormap[starttranscolor] = 112; // Golden shine
|
||||
for (i = 0; i < 8; i++) // Yellow
|
||||
dest_colormap[starttranscolor + (i+1)] = (UINT8)(101 + (i>>1));
|
||||
for (i = 0; i < 7; i++) // With a fine golden finish! :3
|
||||
dest_colormap[starttranscolor + (i+9)] = (UINT8)(113 + i);
|
||||
break;
|
||||
|
||||
case SKINCOLOR_SUPER5:
|
||||
// Golden Delicious
|
||||
for (i = 0; i < 8; i++) // Yellow
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(101 + (i>>1));
|
||||
for (i = 0; i < 7; i++) // With a fine golden finish! :3
|
||||
dest_colormap[starttranscolor + (i+8)] = (UINT8)(113 + i);
|
||||
dest_colormap[starttranscolor + 15] = 155;
|
||||
break;
|
||||
|
||||
// Super Tails
|
||||
case SKINCOLOR_TSUPER1:
|
||||
for (i = 0; i < 10; i++) // white
|
||||
dest_colormap[starttranscolor + i] = 120;
|
||||
for (; i < SKIN_RAMP_LENGTH; i++) // orange
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(80 + (i-10));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TSUPER2:
|
||||
for (i = 0; i < 4; i++) // white
|
||||
dest_colormap[starttranscolor + i] = 120;
|
||||
for (; i < SKIN_RAMP_LENGTH; i++) // orange
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(80 + ((i-4)>>1));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TSUPER3:
|
||||
dest_colormap[starttranscolor] = 120; // pure white
|
||||
dest_colormap[starttranscolor+1] = 120;
|
||||
for (i = 2; i < SKIN_RAMP_LENGTH; i++) // orange
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(80 + ((i-2)>>1));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TSUPER4:
|
||||
dest_colormap[starttranscolor] = 120; // pure white
|
||||
for (i = 1; i < 9; i++) // orange
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(80 + (i-1));
|
||||
for (; i < SKIN_RAMP_LENGTH; i++) // gold
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(115 + (5*(i-9)/7));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_TSUPER5:
|
||||
for (i = 0; i < 8; i++) // orange
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(80 + i);
|
||||
for (; i < SKIN_RAMP_LENGTH; i++) // gold
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(115 + (5*(i-8)/8));
|
||||
break;
|
||||
|
||||
// Super Knuckles
|
||||
case SKINCOLOR_KSUPER1:
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(120 + (i >> 2));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_KSUPER2:
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(120 + (6*i/SKIN_RAMP_LENGTH));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_KSUPER3:
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(120 + (i >> 1));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_KSUPER4:
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(121 + (i >> 1));
|
||||
break;
|
||||
|
||||
case SKINCOLOR_KSUPER5:
|
||||
for (i = 0; i < SKIN_RAMP_LENGTH; i++)
|
||||
dest_colormap[starttranscolor + i] = (UINT8)(122 + (i >> 1));
|
||||
break;
|
||||
|
||||
default:
|
||||
I_Error("Invalid skin color #%hu.", (UINT16)color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/** \brief Retrieves a translation colormap from the cache.
|
||||
|
||||
\param skinnum number of skin, TC_DEFAULT or TC_BOSS
|
||||
|
||||
+57
-30
@@ -398,7 +398,7 @@ void V_SetPalette(INT32 palettenum)
|
||||
LoadMapPalette();
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
if (rendermode == render_opengl)
|
||||
HWR_SetPalette(&pLocalPalette[palettenum*256]);
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
else
|
||||
@@ -412,7 +412,7 @@ void V_SetPaletteLump(const char *pal)
|
||||
{
|
||||
LoadPalette(pal);
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft && rendermode != render_none)
|
||||
if (rendermode == render_opengl)
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
else
|
||||
@@ -516,16 +516,17 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - hudtrans;
|
||||
/*else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[hudtrans];*/
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
}
|
||||
if (alphalevel)
|
||||
{
|
||||
v_translevel = transtables + ((alphalevel-1)<<FF_TRANSSHIFT);
|
||||
patchdrawfunc = translucentpdraw;
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
v_translevel = transtables + ((alphalevel-1)<<FF_TRANSSHIFT);
|
||||
patchdrawfunc = translucentpdraw;
|
||||
}
|
||||
}
|
||||
|
||||
v_colormap = NULL;
|
||||
@@ -577,7 +578,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
|
||||
// top offset
|
||||
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
|
||||
offsety = FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
|
||||
offsety = FixedMul(SHORT(patch->topoffset)<<FRACBITS, vscale);
|
||||
|
||||
if ((scrn & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
|
||||
{
|
||||
@@ -619,16 +620,16 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
// Center it if necessary
|
||||
if (!(scrn & V_SCALEPATCHMASK))
|
||||
{
|
||||
// if it's meant to cover the whole screen, black out the rest
|
||||
// BAD, BAD, BAD, FUCK OFF, STOP, EW, AAAAAAA
|
||||
// This does NOT account for transparent pixels
|
||||
/*if (x == 0 && FixedMul(SHORT(patch->width)<<FRACBITS, pscale)>>FRACBITS == BASEVIDWIDTH
|
||||
&& y == 0 && FixedMul(SHORT(patch->height)<<FRACBITS, pscale)>>FRACBITS == BASEVIDHEIGHT)
|
||||
// if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT)
|
||||
if (x == 0 && SHORT(patch->width) == BASEVIDWIDTH && y == 0 && SHORT(patch->height) == BASEVIDHEIGHT)
|
||||
{
|
||||
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[0]));
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||
}*/
|
||||
if (!column->topdelta)
|
||||
{
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, source[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (vid.width != BASEVIDWIDTH * dupx)
|
||||
{
|
||||
@@ -714,6 +715,10 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
|
||||
// Draws a patch cropped and scaled to arbitrary size.
|
||||
void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t *patch, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
{
|
||||
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
|
||||
UINT32 alphalevel = 0;
|
||||
// boolean flip = false;
|
||||
|
||||
fixed_t col, ofs, colfrac, rowfrac, fdup;
|
||||
INT32 dupx, dupy;
|
||||
const column_t *column;
|
||||
@@ -731,6 +736,28 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
}
|
||||
#endif
|
||||
|
||||
patchdrawfunc = standardpdraw;
|
||||
|
||||
v_translevel = NULL;
|
||||
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[hudtrans];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - hudtrans;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[hudtrans];
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
v_translevel = transtables + ((alphalevel-1)<<FF_TRANSSHIFT);
|
||||
patchdrawfunc = translucentpdraw;
|
||||
}
|
||||
}
|
||||
|
||||
// only use one dup, to avoid stretching (har har)
|
||||
dupx = dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||
fdup = FixedMul(dupx<<FRACBITS, pscale);
|
||||
@@ -763,14 +790,8 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
if (!(scrn & V_SCALEPATCHMASK))
|
||||
{
|
||||
// if it's meant to cover the whole screen, black out the rest
|
||||
// BAD, BAD, BAD, FUCK OFF, STOP, EW, AAAAAAA
|
||||
// This does NOT account for transparent pixels
|
||||
/*if (x == 0 && SHORT(patch->width) == BASEVIDWIDTH && y == 0 && SHORT(patch->height) == BASEVIDHEIGHT)
|
||||
{
|
||||
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[0]));
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||
}*/
|
||||
// no the patch is cropped do not do this ever
|
||||
|
||||
if (vid.width != BASEVIDWIDTH * dupx)
|
||||
{
|
||||
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
|
||||
@@ -793,7 +814,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
desttop += (y*vid.width) + x;
|
||||
}
|
||||
|
||||
for (col = sx<<FRACBITS; (col>>FRACBITS) < SHORT(patch->width) && (col>>FRACBITS) < w; col += colfrac, ++x, desttop++)
|
||||
for (col = sx<<FRACBITS; (col>>FRACBITS) < SHORT(patch->width) && ((col>>FRACBITS) - sx) < w; col += colfrac, ++x, desttop++)
|
||||
{
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
if (x < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||
@@ -810,12 +831,18 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||
prevdelta = topdelta;
|
||||
source = (const UINT8 *)(column) + 3;
|
||||
dest = desttop;
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width;
|
||||
if (topdelta-sy > 0)
|
||||
{
|
||||
dest += FixedInt(FixedMul((topdelta-sy)<<FRACBITS,fdup))*vid.width;
|
||||
ofs = 0;
|
||||
}
|
||||
else
|
||||
ofs = (sy-topdelta)<<FRACBITS;
|
||||
|
||||
for (ofs = sy<<FRACBITS; dest < deststop && (ofs>>FRACBITS) < column->length && (ofs>>FRACBITS) < h; ofs += rowfrac)
|
||||
for (; dest < deststop && (ofs>>FRACBITS) < column->length && (((ofs>>FRACBITS) - sy) + topdelta) < h; ofs += rowfrac)
|
||||
{
|
||||
if (dest >= screens[scrn&V_PARAMMASK]) // don't draw off the top of the screen (CRASH PREVENTION)
|
||||
*dest = source[ofs>>FRACBITS];
|
||||
*dest = patchdrawfunc(dest, source, ofs);
|
||||
dest += vid.width;
|
||||
}
|
||||
column = (const column_t *)((const UINT8 *)column + column->length + 4);
|
||||
|
||||
Reference in new issue
Block a user