mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 04:29:34 -04:00
optional solid color status bar background for widescreen mode (#655)
* optional solid-colored status bar background Fixes #651 * Update m_misc.c * parametrize "analyzation depth" * tune down to half saturation * minor clean-up
This commit is contained in:
parent
399e88c97e
commit
b9abe20746
@ -3801,6 +3801,7 @@ enum {
|
|||||||
general_swirl,
|
general_swirl,
|
||||||
general_smoothlight,
|
general_smoothlight,
|
||||||
general_brightmaps,
|
general_brightmaps,
|
||||||
|
general_solidbackground,
|
||||||
general_stub2,
|
general_stub2,
|
||||||
general_diskicon,
|
general_diskicon,
|
||||||
general_hom,
|
general_hom,
|
||||||
@ -3928,6 +3929,9 @@ setup_menu_t gen_settings2[] = { // General Settings screen2
|
|||||||
{"Brightmaps for Textures and Sprites", S_YESNO, m_null, M_X,
|
{"Brightmaps for Textures and Sprites", S_YESNO, m_null, M_X,
|
||||||
G_Y3 + general_brightmaps*M_SPC, {"brightmaps"}},
|
G_Y3 + general_brightmaps*M_SPC, {"brightmaps"}},
|
||||||
|
|
||||||
|
{"Solid Status Bar Background", S_YESNO, m_null, M_X,
|
||||||
|
G_Y3 + general_solidbackground*M_SPC, {"st_solidbackground"}},
|
||||||
|
|
||||||
{"", S_SKIP, m_null, M_X, M_Y + general_stub2*M_SPC},
|
{"", S_SKIP, m_null, M_X, M_Y + general_stub2*M_SPC},
|
||||||
|
|
||||||
{"Flash Icon During Disk IO", S_YESNO, m_null, M_X,
|
{"Flash Icon During Disk IO", S_YESNO, m_null, M_X,
|
||||||
|
@ -255,7 +255,14 @@ default_t defaults[] = {
|
|||||||
{0}, {0,1}, number, ss_gen, wad_yes,
|
{0}, {0,1}, number, ss_gen, wad_yes,
|
||||||
"1 to enable brightmaps for textures and sprites"
|
"1 to enable brightmaps for textures and sprites"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"st_solidbackground",
|
||||||
|
(config_t *) &st_solidbackground, NULL,
|
||||||
|
{0}, {0,1}, number, ss_gen, wad_yes,
|
||||||
|
"1 for solid color status bar background in widescreen mode"
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"gamma2",
|
"gamma2",
|
||||||
(config_t *) &gamma2, NULL,
|
(config_t *) &gamma2, NULL,
|
||||||
|
115
src/st_stuff.c
115
src/st_stuff.c
@ -333,52 +333,109 @@ extern char *mapnames[];
|
|||||||
|
|
||||||
void ST_Stop(void);
|
void ST_Stop(void);
|
||||||
|
|
||||||
|
int st_solidbackground;
|
||||||
|
|
||||||
void ST_refreshBackground(boolean force)
|
void ST_refreshBackground(boolean force)
|
||||||
{
|
{
|
||||||
if (st_classicstatusbar)
|
if (st_classicstatusbar)
|
||||||
{
|
{
|
||||||
// [crispy] this is our own local copy of R_FillBackScreen() to
|
|
||||||
// fill the entire background of st_backing_screen with the bezel pattern,
|
|
||||||
// so it appears to the left and right of the status bar in widescreen mode
|
|
||||||
if (SCREENWIDTH != ST_WIDTH)
|
if (SCREENWIDTH != ST_WIDTH)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
byte *src;
|
byte *dest = screens[BG];
|
||||||
byte *dest;
|
|
||||||
const char *name = (gamemode == commercial) ? "GRNROCK" : "FLOOR7_2";
|
|
||||||
|
|
||||||
src = W_CacheLumpNum(firstflat + R_FlatNumForName(name), PU_CACHE);
|
if (st_solidbackground)
|
||||||
dest = screens[BG];
|
|
||||||
|
|
||||||
if (hires)
|
|
||||||
{
|
{
|
||||||
for (y = (SCREENHEIGHT-ST_HEIGHT)<<1; y < SCREENHEIGHT<<1; y++)
|
// [FG] calculate average color of the 16px left and right of the status bar
|
||||||
for (x = 0; x < SCREENWIDTH<<1; x += 2)
|
const int vstep[][2] = {{0, 1}, {1, 2}, {2, ST_HEIGHT}};
|
||||||
{
|
const int hstep = hires ? (4 * SCREENWIDTH) : SCREENWIDTH;
|
||||||
const byte dot = src[(((y>>1)&63)<<6) + ((x>>1)&63)];
|
const int w = SHORT(sbar->width);
|
||||||
|
const int depth = 16;
|
||||||
|
byte *pal = W_CacheLumpName("PLAYPAL", PU_STATIC);
|
||||||
|
int v;
|
||||||
|
|
||||||
*dest++ = dot;
|
// [FG] temporarily draw status bar to background buffer
|
||||||
*dest++ = dot;
|
V_DrawPatch(ST_X, 0, BG, sbar);
|
||||||
|
|
||||||
|
// [FG] separate colors for the top rows
|
||||||
|
for (v = 0; v < arrlen(vstep); v++)
|
||||||
|
{
|
||||||
|
const int v0 = vstep[v][0], v1 = vstep[v][1];
|
||||||
|
unsigned r = 0, g = 0, b = 0;
|
||||||
|
byte col;
|
||||||
|
|
||||||
|
for (y = v0; y < v1; y++)
|
||||||
|
{
|
||||||
|
for (x = 0; x < depth; x++)
|
||||||
|
{
|
||||||
|
byte *c = dest + y * hstep + ((x + WIDESCREENDELTA) << hires);
|
||||||
|
r += pal[3 * c[0] + 0];
|
||||||
|
g += pal[3 * c[0] + 1];
|
||||||
|
b += pal[3 * c[0] + 2];
|
||||||
|
|
||||||
|
c += (w - 2 * x - 1) << hires;
|
||||||
|
r += pal[3 * c[0] + 0];
|
||||||
|
g += pal[3 * c[0] + 1];
|
||||||
|
b += pal[3 * c[0] + 2];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r /= 2 * depth * (v1 - v0);
|
||||||
|
g /= 2 * depth * (v1 - v0);
|
||||||
|
b /= 2 * depth * (v1 - v0);
|
||||||
|
|
||||||
|
// [FG] tune down to half saturation (for empiric reasons)
|
||||||
|
col = I_GetPaletteIndex(pal, r/2, g/2, b/2);
|
||||||
|
|
||||||
|
// [FG] fill background buffer with average status bar color
|
||||||
|
for (y = (v0 << hires); y < (v1 << hires); y++)
|
||||||
|
{
|
||||||
|
memset(dest + y * (SCREENWIDTH << hires), col, (SCREENWIDTH << hires));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Z_ChangeTag (pal, PU_CACHE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (y = SCREENHEIGHT-ST_HEIGHT; y < SCREENHEIGHT; y++)
|
// [crispy] this is our own local copy of R_FillBackScreen() to
|
||||||
for (x = 0; x < SCREENWIDTH; x++)
|
// fill the entire background of st_backing_screen with the bezel pattern,
|
||||||
{
|
// so it appears to the left and right of the status bar in widescreen mode
|
||||||
*dest++ = src[((y&63)<<6) + (x&63)];
|
byte *src;
|
||||||
}
|
const char *name = (gamemode == commercial) ? "GRNROCK" : "FLOOR7_2";
|
||||||
}
|
|
||||||
|
|
||||||
// [crispy] preserve bezel bottom edge
|
src = W_CacheLumpNum(firstflat + R_FlatNumForName(name), PU_CACHE);
|
||||||
if (scaledviewwidth == SCREENWIDTH)
|
|
||||||
{
|
|
||||||
patch_t *const patch = W_CacheLumpName("brdr_b", PU_CACHE);
|
|
||||||
|
|
||||||
for (x = 0; x < WIDESCREENDELTA; x += 8)
|
if (hires)
|
||||||
{
|
{
|
||||||
V_DrawPatch(x - WIDESCREENDELTA, 0, BG, patch);
|
for (y = (SCREENHEIGHT-ST_HEIGHT)<<1; y < SCREENHEIGHT<<1; y++)
|
||||||
V_DrawPatch(ORIGWIDTH + WIDESCREENDELTA - x - 8, 0, BG, patch);
|
for (x = 0; x < SCREENWIDTH<<1; x += 2)
|
||||||
|
{
|
||||||
|
const byte dot = src[(((y>>1)&63)<<6) + ((x>>1)&63)];
|
||||||
|
|
||||||
|
*dest++ = dot;
|
||||||
|
*dest++ = dot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (y = SCREENHEIGHT-ST_HEIGHT; y < SCREENHEIGHT; y++)
|
||||||
|
for (x = 0; x < SCREENWIDTH; x++)
|
||||||
|
{
|
||||||
|
*dest++ = src[((y&63)<<6) + (x&63)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// [crispy] preserve bezel bottom edge
|
||||||
|
if (scaledviewwidth == SCREENWIDTH)
|
||||||
|
{
|
||||||
|
patch_t *const patch = W_CacheLumpName("brdr_b", PU_CACHE);
|
||||||
|
|
||||||
|
for (x = 0; x < WIDESCREENDELTA; x += 8)
|
||||||
|
{
|
||||||
|
V_DrawPatch(x - WIDESCREENDELTA, 0, BG, patch);
|
||||||
|
V_DrawPatch(ORIGWIDTH + WIDESCREENDELTA - x - 8, 0, BG, patch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,8 @@ extern int sts_traditional_keys; // display keys the traditional way
|
|||||||
extern int hud_backpack_thresholds; // backpack changes thresholds
|
extern int hud_backpack_thresholds; // backpack changes thresholds
|
||||||
extern int hud_armor_type; // color of armor depends on type
|
extern int hud_armor_type; // color of armor depends on type
|
||||||
|
|
||||||
|
extern int st_solidbackground;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user