diff --git a/prboom2/src/am_map.c b/prboom2/src/am_map.c index 708f69c3e..e44228241 100644 --- a/prboom2/src/am_map.c +++ b/prboom2/src/am_map.c @@ -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) { diff --git a/prboom2/src/gl_main.c b/prboom2/src/gl_main.c index 8df8f6038..1624704c7 100644 --- a/prboom2/src/gl_main.c +++ b/prboom2/src/gl_main.c @@ -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(); @@ -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) diff --git a/prboom2/src/m_menu.c b/prboom2/src/m_menu.c index e8ea566d1..1ea0535e2 100644 --- a/prboom2/src/m_menu.c +++ b/prboom2/src/m_menu.c @@ -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; @@ -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, @@ -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; diff --git a/prboom2/src/m_menu.h b/prboom2/src/m_menu.h index 98d58f098..2048b4000 100644 --- a/prboom2/src/m_menu.h +++ b/prboom2/src/m_menu.h @@ -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. diff --git a/prboom2/src/v_video.c b/prboom2/src/v_video.c index 26130a76e..1a17df5b3 100644 --- a/prboom2/src/v_video.c +++ b/prboom2/src/v_video.c @@ -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) { @@ -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; } @@ -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) {} @@ -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; diff --git a/prboom2/src/v_video.h b/prboom2/src/v_video.h index 3524cc2cb..8f5e62988 100644 --- a/prboom2/src/v_video.h +++ b/prboom2/src/v_video.h @@ -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.