mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 02:42:20 +00:00
Replaced the laggy randomised-at-runtime static with sufficiently random low-impact pregenerated static. Requires new patch.dta. https://cdn.discordapp.com/attachments/293238104096112641/372770688890830859/srb20003.gif
This commit is contained in:
parent
9ffb5c0fb0
commit
9a10dfeaee
5 changed files with 85 additions and 58 deletions
|
@ -7331,7 +7331,6 @@ struct {
|
|||
{"V_70TRANS",V_70TRANS},
|
||||
{"V_80TRANS",V_80TRANS},
|
||||
{"V_90TRANS",V_90TRANS},
|
||||
{"V_STATIC",V_STATIC},
|
||||
{"V_HUDTRANSHALF",V_HUDTRANSHALF},
|
||||
{"V_HUDTRANS",V_HUDTRANS},
|
||||
{"V_HUDTRANSDOUBLE",V_HUDTRANSDOUBLE},
|
||||
|
|
64
src/m_menu.c
64
src/m_menu.c
|
@ -3085,6 +3085,26 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines)
|
|||
*/
|
||||
}
|
||||
|
||||
#define scale FRACUNIT/2
|
||||
|
||||
static fixed_t staticalong = 0;
|
||||
|
||||
static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_t h)
|
||||
{
|
||||
patch_t *patch = W_CachePatchName("LSSTATIC", PU_CACHE);
|
||||
INT32 pw = SHORT(patch->width);
|
||||
fixed_t sw = FixedDiv(w, scale);
|
||||
|
||||
if (staticalong >= (pw - sw))
|
||||
staticalong = 0;
|
||||
|
||||
V_DrawCroppedPatch(x<<FRACBITS, y<<FRACBITS, scale, flags, patch, staticalong, 0, sw, FixedDiv(h, scale));
|
||||
|
||||
staticalong += P_RandomRange(sw/2, 2*sw);
|
||||
}
|
||||
|
||||
#undef scale
|
||||
|
||||
//
|
||||
// Draw border for the savegame description
|
||||
//
|
||||
|
@ -4323,7 +4343,10 @@ static void M_DrawLevelPlatterWideMap(UINT8 row, UINT8 col, INT32 x, INT32 y, bo
|
|||
|
||||
// A 564x100 image of the level as entry MAPxxW
|
||||
if (!(levelselect.rows[row].mapavailable[col]))
|
||||
V_DrawSmallScaledPatch(x, y, V_STATIC, levselp[1][2]); // static - make secret maps look ENTICING
|
||||
{
|
||||
V_DrawSmallScaledPatch(x, y, 0, levselp[1][2]);
|
||||
M_DrawStaticBox(x, y, V_80TRANS, 282, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (W_CheckNumForName(va("%sW", G_BuildMapName(map))) != LUMPERROR)
|
||||
|
@ -4351,7 +4374,10 @@ static void M_DrawLevelPlatterMap(UINT8 row, UINT8 col, INT32 x, INT32 y, boolea
|
|||
|
||||
// A 160x100 image of the level as entry MAPxxP
|
||||
if (!(levelselect.rows[row].mapavailable[col]))
|
||||
V_DrawSmallScaledPatch(x, y, V_STATIC, levselp[0][2]); // static - make secret maps look ENTICING
|
||||
{
|
||||
V_DrawSmallScaledPatch(x, y, 0, levselp[0][2]);
|
||||
M_DrawStaticBox(x, y, V_80TRANS, 80, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (W_CheckNumForName(va("%sP", G_BuildMapName(map))) != LUMPERROR)
|
||||
|
@ -6134,12 +6160,14 @@ static void M_DrawLoadGameData(void)
|
|||
if (savetodraw == saveSlotSelected)
|
||||
V_DrawFill(x, y+9, 80, 1, yellowmap[3]);
|
||||
y += 11;
|
||||
V_DrawSmallScaledPatch(x, y, V_STATIC, savselp[4]);
|
||||
V_DrawSmallScaledPatch(x, y, 0, savselp[4]);
|
||||
M_DrawStaticBox(x, y, V_80TRANS, 80, 50);
|
||||
y += 41;
|
||||
if (ultimate_selectable)
|
||||
V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "ULTIMATE.");
|
||||
else
|
||||
V_DrawRightAlignedThinString(x + 79, y, V_GRAYMAP, "DON'T SAVE!");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -6197,28 +6225,28 @@ static void M_DrawLoadGameData(void)
|
|||
|
||||
// level image area
|
||||
{
|
||||
patch_t *patch;
|
||||
INT32 flags = 0;
|
||||
|
||||
if ((savegameinfo[savetodraw].lives == -42)
|
||||
|| (savegameinfo[savetodraw].lives == -666))
|
||||
{
|
||||
patch = savselp[3];
|
||||
flags = V_STATIC;
|
||||
V_DrawFill(x, y, 80, 50, 31);
|
||||
M_DrawStaticBox(x, y, V_80TRANS, 80, 50);
|
||||
}
|
||||
else if (savegameinfo[savetodraw].gamemap & 8192)
|
||||
patch = savselp[6];
|
||||
else
|
||||
{
|
||||
lumpnum_t lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName((savegameinfo[savetodraw].gamemap) & 8191)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
patch = W_CachePatchNum(lumpnum, PU_CACHE);
|
||||
patch_t *patch;
|
||||
if (savegameinfo[savetodraw].gamemap & 8192)
|
||||
patch = savselp[3];
|
||||
else
|
||||
patch = savselp[5];
|
||||
{
|
||||
lumpnum_t lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName((savegameinfo[savetodraw].gamemap) & 8191)));
|
||||
if (lumpnum != LUMPERROR)
|
||||
patch = W_CachePatchNum(lumpnum, PU_CACHE);
|
||||
else
|
||||
patch = savselp[5];
|
||||
}
|
||||
V_DrawSmallScaledPatch(x, y, 0, patch);
|
||||
}
|
||||
|
||||
V_DrawSmallScaledPatch(x, y, flags, patch);
|
||||
|
||||
y += 41;
|
||||
|
||||
if (savegameinfo[savetodraw].lives == -42)
|
||||
|
@ -6569,17 +6597,15 @@ static void M_ReadSaveStrings(void)
|
|||
W_UnlockCachedPatch(savselp[3]);
|
||||
W_UnlockCachedPatch(savselp[4]);
|
||||
W_UnlockCachedPatch(savselp[5]);
|
||||
W_UnlockCachedPatch(savselp[6]);
|
||||
}
|
||||
|
||||
savselp[0] = W_CachePatchName("SAVEBACK", PU_STATIC);
|
||||
savselp[1] = W_CachePatchName("SAVENONE", PU_STATIC);
|
||||
savselp[2] = W_CachePatchName("ULTIMATE", PU_STATIC);
|
||||
|
||||
savselp[3] = W_CachePatchName("BLACKLVL", PU_STATIC);
|
||||
savselp[3] = W_CachePatchName("GAMEDONE", PU_STATIC);
|
||||
savselp[4] = W_CachePatchName("BLACXLVL", PU_STATIC);
|
||||
savselp[5] = W_CachePatchName("BLANKLVL", PU_STATIC);
|
||||
savselp[6] = W_CachePatchName("GAMEDONE", PU_STATIC);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -525,22 +525,6 @@ static inline UINT8 transmappedpdraw(const UINT8 *dest, const UINT8 *source, fix
|
|||
return *(v_translevel + (((*(v_colormap + source[ofs>>FRACBITS]))<<8)&0xff00) + (*dest&0xff));
|
||||
}
|
||||
|
||||
static UINT8 staticstep = 0;
|
||||
static fixed_t staticval = 0;
|
||||
|
||||
static inline UINT8 staticpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs)
|
||||
{
|
||||
UINT8 val = source[ofs>>FRACBITS];
|
||||
(void)dest;
|
||||
if ((++staticstep) >= 4)
|
||||
{
|
||||
staticstep = 0;
|
||||
staticval = M_RandomFixed();
|
||||
}
|
||||
if (val < 7) return val;
|
||||
return ((staticval>>staticstep)&7)+(val-7);
|
||||
}
|
||||
|
||||
// Draws a patch scaled to arbitrary size.
|
||||
void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t *patch, const UINT8 *colormap)
|
||||
{
|
||||
|
@ -571,25 +555,18 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
patchdrawfunc = standardpdraw;
|
||||
|
||||
v_translevel = NULL;
|
||||
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)) == 12) // static
|
||||
if ((alphalevel = ((scrn & V_ALPHAMASK) >> V_ALPHASHIFT)))
|
||||
{
|
||||
alphalevel = 0;
|
||||
patchdrawfunc = staticpdraw;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (alphalevel)
|
||||
{
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[cv_translucenthud.value];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - cv_translucenthud.value;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[cv_translucenthud.value];
|
||||
if (alphalevel == 13)
|
||||
alphalevel = hudminusalpha[cv_translucenthud.value];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - cv_translucenthud.value;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[cv_translucenthud.value];
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
|
||||
if (alphalevel >= 10)
|
||||
return; // invis
|
||||
}
|
||||
if (alphalevel)
|
||||
{
|
||||
v_translevel = transtables + ((alphalevel-1)<<FF_TRANSSHIFT);
|
||||
|
@ -763,6 +740,10 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
|||
// 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;
|
||||
|
@ -781,6 +762,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[cv_translucenthud.value];
|
||||
else if (alphalevel == 14)
|
||||
alphalevel = 10 - cv_translucenthud.value;
|
||||
else if (alphalevel == 15)
|
||||
alphalevel = hudplusalpha[cv_translucenthud.value];
|
||||
|
||||
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);
|
||||
|
@ -844,7 +847,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)
|
||||
|
@ -863,10 +866,10 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
|||
dest = desttop;
|
||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width;
|
||||
|
||||
for (ofs = sy<<FRACBITS; dest < deststop && (ofs>>FRACBITS) < column->length && ((ofs>>FRACBITS) + topdelta) < h; ofs += rowfrac)
|
||||
for (ofs = sy<<FRACBITS; 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);
|
||||
|
|
|
@ -94,7 +94,6 @@ extern RGBA_t *pMasterPalette;
|
|||
#define V_70TRANS 0x00070000
|
||||
#define V_80TRANS 0x00080000 // used to be V_8020TRANS
|
||||
#define V_90TRANS 0x00090000
|
||||
#define V_STATIC 0x000C0000 // ogl unsupported kthnxbai
|
||||
#define V_HUDTRANSHALF 0x000D0000
|
||||
#define V_HUDTRANS 0x000E0000 // draw the hud translucent
|
||||
#define V_HUDTRANSDOUBLE 0x000F0000
|
||||
|
|
|
@ -205,7 +205,7 @@ static void Y_IntermissionTokenDrawer(void)
|
|||
calc = (lowy - y)*2;
|
||||
|
||||
if (calc > 0)
|
||||
V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 32*FRACUNIT, y<<FRACBITS, SHORT(tokenicon->width), calc);
|
||||
V_DrawCroppedPatch(32<<FRACBITS, y<<FRACBITS, FRACUNIT/2, 0, tokenicon, 32<<FRACBITS, y<<FRACBITS, SHORT(tokenicon->width), calc);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue