Skip to content

Commit

Permalink
Remove Animated Fade logic for Dark Overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
andrikpowell committed Dec 4, 2024
1 parent 8435941 commit bab964b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 63 deletions.
2 changes: 1 addition & 1 deletion prboom2/src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -2801,7 +2801,7 @@ void AM_Drawer (dboolean minimap)
if (!automap_overlay) // cph - If not overlay mode, clear background for the automap
V_FillRect(FB, f_x, f_y, f_w, f_h, (byte)mapcolor_p->back); //jff 1/5/98 background default color
if (automap_overlay==2 && !M_MenuIsShaded())
V_DrawShaded(FB, f_x, f_y, f_w, f_h, false);
V_DrawShaded(FB, f_x, f_y, f_w, f_h, screenshade);

if (map_textured)
{
Expand Down
28 changes: 1 addition & 27 deletions prboom2/src/gl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,19 +848,9 @@ void gld_FillBlock(int x, int y, int width, int height, int col)
glsl_PopNullShader();
}

void gld_DrawShaded(int x, int y, int width, int height, int col, dboolean animate)
void gld_DrawShaded(int x, int y, int width, int height, int col, int screenshade)
{
color_rgb_t color = gld_LookupIndexedColor(col, V_IsUILightmodeIndexed() || V_IsAutomapLightmodeIndexed());
const int targshade = 20;
const int step = 2;
static int oldtic = -1;
static int screenshade;

// [FG] start a new sequence
if (gametic - oldtic > targshade / step)
{
screenshade = 0;
}

glsl_PushNullShader();

Expand All @@ -881,22 +871,6 @@ void gld_DrawShaded(int x, int y, int width, int height, int col, dboolean anima
gld_EnableTexture2D(GL_TEXTURE0_ARB, true);

glsl_PopNullShader();

if (!animate)
{
screenshade = targshade;
}
else if (screenshade < targshade && gametic != oldtic)
{
const int sign = ((screenshade - targshade) < 0) ? 1 : -1;

screenshade += step*sign;

if (screenshade*sign > targshade*sign)
screenshade = targshade;
}

oldtic = gametic;
}

void gld_SetPalette(int palette)
Expand Down
16 changes: 15 additions & 1 deletion prboom2/src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5825,6 +5825,15 @@ void M_StartControlPanel (void)
itemOn = currentMenu->lastOn; // JDC
}


/////////////////////////////////////////////////////////////////////////////
//
// Menu Shaded Overlay Stuff
//
// This displays a dark overlay under certain screens of the menus

int screenshade = 20;

dboolean fadeBG(void)
{
return dsda_IntConfig(dsda_config_menu_background)==1;
Expand All @@ -5836,6 +5845,11 @@ dboolean M_MenuIsShaded(void)
return fadeBG() && Options;
}

static void M_ShadedScreen(int scrn)
{
V_DrawShaded(scrn, 0, 0, SCREENWIDTH, SCREENHEIGHT, screenshade);
}

//
// M_Drawer
// Called after the view has been rendered,
Expand All @@ -5849,7 +5863,7 @@ void M_Drawer (void)
V_BeginUIDraw();

if (M_MenuIsShaded())
V_DrawShaded(0, 0, 0, SCREENWIDTH, SCREENHEIGHT, false);
M_ShadedScreen(0);

inhelpscreens = false;

Expand Down
1 change: 1 addition & 0 deletions prboom2/src/m_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dboolean M_Responder (event_t *ev);

dboolean fadeBG(void);
dboolean M_MenuIsShaded(void);
extern int screenshade;

// Called by main loop,
// only used for menu (skull cursor) animation.
Expand Down
39 changes: 6 additions & 33 deletions prboom2/src/v_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,25 +621,14 @@ static void V_DrawMemPatch(int x, int y, int scrn, const rpatch_t *patch,
//
// Adapted from Woof.
//
// This uses a dark colormap to create a dark faded
// background under all of the menus. You can also
// add a gradual fade by setting "animate" to true.
// This uses a dark colormap to create
// a dark faded background under menus.
//
static void FUNC_V_DrawShaded(int scrn, int x, int y, int width, int height, dboolean animate)
static void FUNC_V_DrawShaded(int scrn, int x, int y, int width, int height, int screenshade)
{
extern const lighttable_t **colormaps;
byte* dest;
int ix, iy;
const int targshade = 20;
const int step = 2;
static int oldtic = -1;
static int screenshade;

// [FG] start a new sequence
if (gametic - oldtic > targshade / step)
{
screenshade = 0;
}

for (iy = y; iy < y + height; ++iy)
{
Expand All @@ -651,22 +640,6 @@ static void FUNC_V_DrawShaded(int scrn, int x, int y, int width, int height, dbo
dest++;
}
}

if (!animate)
{
screenshade = targshade;
}
else if (screenshade < targshade && gametic != oldtic)
{
const int sign = ((screenshade - targshade) < 0) ? 1 : -1;

screenshade += step*sign;

if (screenshade*sign > targshade*sign)
screenshade = targshade;
}

oldtic = gametic;
}


Expand Down Expand Up @@ -797,9 +770,9 @@ static void WRAP_gld_DrawLine(fline_t* fl, int color)
{
gld_DrawLine_f(fl->a.fx, fl->a.fy, fl->b.fx, fl->b.fy, color);
}
static void WRAP_gld_DrawShaded(int scrn, int x, int y, int width, int height, dboolean animate)
static void WRAP_gld_DrawShaded(int scrn, int x, int y, int width, int height, int screenshade)
{
gld_DrawShaded(x, y, width, height, playpal_black, animate);
gld_DrawShaded(x, y, width, height, playpal_black, screenshade);
}

static void NULL_BeginUIDraw(void) {}
Expand All @@ -817,7 +790,7 @@ static void NULL_PlotPixel(int scrn, int x, int y, byte color) {}
static void NULL_PlotPixelWu(int scrn, int x, int y, byte color, int weight) {}
static void NULL_DrawLine(fline_t* fl, int color) {}
static void NULL_DrawLineWu(fline_t* fl, int color) {}
static void NULL_DrawShaded(int scrn, int x, int y, int width, int height, dboolean animate) {}
static void NULL_DrawShaded(int scrn, int x, int y, int width, int height, int screenshade) {}

static video_mode_t current_videomode = VID_MODESW;

Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/v_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ extern V_FillPatch_f V_FillPatch;
typedef void (*V_DrawBackground_f)(const char* flatname, int scrn);
extern V_DrawBackground_f V_DrawBackground;

typedef void (*V_DrawShaded_f)(int scrn, int x, int y, int width, int height, dboolean animate);
typedef void (*V_DrawShaded_f)(int scrn, int x, int y, int width, int height, int screenshade);
extern V_DrawShaded_f V_DrawShaded;

// CPhipps - function to set the palette to palette number pal.
Expand Down

0 comments on commit bab964b

Please sign in to comment.