Implement dark automap overlay (#813)

* Implement dark automap overlay

* Second implementation

* Third implementation

* Fourth implementation

* Introduce `M_MenuIsShaded()`
This commit is contained in:
Alaux 2022-11-28 04:31:08 -03:00 committed by GitHub
parent 31dd96a2ec
commit a599174b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 78 additions and 36 deletions

View File

@ -40,6 +40,7 @@
#include "dstrings.h" #include "dstrings.h"
#include "d_deh.h" // Ty 03/27/98 - externalizations #include "d_deh.h" // Ty 03/27/98 - externalizations
#include "m_input.h" #include "m_input.h"
#include "m_menu.h"
//jff 1/7/98 default automap colors added //jff 1/7/98 default automap colors added
int mapcolor_back; // map background int mapcolor_back; // map background
@ -247,7 +248,7 @@ int automap_grid = 0;
boolean automapactive = false; boolean automapactive = false;
boolean automapoverlay = false; overlay_t automapoverlay = overlay_off;
// location of window on screen // location of window on screen
static int f_x; static int f_x;
@ -943,11 +944,15 @@ boolean AM_Responder
else else
if (M_InputActivated(input_map_overlay)) if (M_InputActivated(input_map_overlay))
{ {
automapoverlay = !automapoverlay; if (++automapoverlay > overlay_dark)
if (automapoverlay) automapoverlay = overlay_off;
plr->message = s_AMSTR_OVERLAYON;
else switch (automapoverlay)
plr->message = s_AMSTR_OVERLAYOFF; {
case 2: plr->message = "Dark Overlay On"; break;
case 1: plr->message = s_AMSTR_OVERLAYON; break;
default: plr->message = s_AMSTR_OVERLAYOFF; break;
}
} }
else if (M_InputActivated(input_map_rotate)) else if (M_InputActivated(input_map_rotate))
{ {
@ -2309,6 +2314,10 @@ void AM_Drawer (void)
AM_clearFB(mapcolor_back); //jff 1/5/98 background default color AM_clearFB(mapcolor_back); //jff 1/5/98 background default color
pspr_interp = false; pspr_interp = false;
} }
// [Alaux] Dark automap overlay
else if (automapoverlay == overlay_dark && !M_MenuIsShaded())
V_ShadeScreen();
if (automap_grid) // killough 2/28/98: change var name if (automap_grid) // killough 2/28/98: change var name
AM_drawGrid(mapcolor_grid); //jff 1/7/98 grid default color AM_drawGrid(mapcolor_grid); //jff 1/7/98 grid default color
AM_drawWalls(); AM_drawWalls();

View File

@ -255,7 +255,7 @@ void D_Display (void)
case GS_LEVEL: case GS_LEVEL:
if (!gametic) if (!gametic)
break; break;
if (automapactive) if (automapactive && !automapoverlay)
{ {
// [FG] update automap while playing // [FG] update automap while playing
R_RenderPlayerView (&players[displayplayer]); R_RenderPlayerView (&players[displayplayer]);
@ -279,7 +279,7 @@ void D_Display (void)
} }
// draw the view directly // draw the view directly
if (gamestate == GS_LEVEL && !automapactive && gametic) if (gamestate == GS_LEVEL && (!automapactive || automapoverlay) && gametic)
R_RenderPlayerView (&players[displayplayer]); R_RenderPlayerView (&players[displayplayer]);
if (gamestate == GS_LEVEL && gametic) if (gamestate == GS_LEVEL && gametic)
@ -316,6 +316,7 @@ void D_Display (void)
if (gamestate == GS_LEVEL && automapactive && automapoverlay) if (gamestate == GS_LEVEL && automapactive && automapoverlay)
{ {
AM_Drawer(); AM_Drawer();
ST_Drawer(scaledviewheight == 200, redrawsbar);
HU_Drawer(); HU_Drawer();
// [crispy] force redraw of status bar and border // [crispy] force redraw of status bar and border

View File

@ -248,7 +248,15 @@ extern int snd_DesiredSfxDevice;
extern boolean statusbaractive; extern boolean statusbaractive;
extern boolean automapactive; // In AutoMap mode? extern boolean automapactive; // In AutoMap mode?
extern boolean automapoverlay;
typedef enum
{
overlay_off,
overlay_on,
overlay_dark,
} overlay_t;
extern overlay_t automapoverlay;
extern boolean automaprotate; extern boolean automaprotate;
extern boolean menuactive; // Menu overlayed? extern boolean menuactive; // Menu overlayed?
extern boolean paused; // Game Pause? extern boolean paused; // Game Pause?

View File

@ -3429,6 +3429,10 @@ enum {
auto1_flash, auto1_flash,
}; };
static const char *overlay_strings[] = {
"Off", "On", "Dark", NULL
};
// [FG] show level statistics and level time widgets // [FG] show level statistics and level time widgets
static const char *show_widgets_strings[] = { static const char *show_widgets_strings[] = {
"Off", "On Automap", "Always", NULL "Off", "On Automap", "Always", NULL
@ -3439,9 +3443,9 @@ extern void AM_enableSmoothLines(void);
setup_menu_t auto_settings1[] = // 1st AutoMap Settings screen setup_menu_t auto_settings1[] = // 1st AutoMap Settings screen
{ {
{"Modes",S_SKIP|S_TITLE,m_null,M_X,M_Y}, {"Modes",S_SKIP|S_TITLE,m_null,M_X,M_Y},
{"Follow Player" ,S_YESNO,m_null,M_X,M_Y+auto1_follow*M_SPC, {"followplayer"}}, {"Follow Player" ,S_YESNO ,m_null,M_X,M_Y+auto1_follow*M_SPC, {"followplayer"}},
{"Rotate Automap" ,S_YESNO,m_null,M_X,M_Y+auto1_rotate*M_SPC, {"automaprotate"}}, {"Rotate Automap" ,S_YESNO ,m_null,M_X,M_Y+auto1_rotate*M_SPC, {"automaprotate"}},
{"Overlay Automap" ,S_YESNO,m_null,M_X,M_Y+auto1_overlay*M_SPC, {"automapoverlay"}}, {"Overlay Automap" ,S_CHOICE,m_null,M_X,M_Y+auto1_overlay*M_SPC, {"automapoverlay"}, 0, NULL, overlay_strings},
{"",S_SKIP,m_null,M_X,M_Y+auto1_stub1*M_SPC}, {"",S_SKIP,m_null,M_X,M_Y+auto1_stub1*M_SPC},
@ -6527,29 +6531,15 @@ void M_StartControlPanel (void)
// killough 9/29/98: Significantly reformatted source // killough 9/29/98: Significantly reformatted source
// //
boolean M_MenuIsShaded(void)
{
return setup_active && menu_background == 2;
}
void M_Drawer (void) void M_Drawer (void)
{ {
static int menushade; if (M_MenuIsShaded())
V_ShadeScreen();
if (setup_active && menu_background == 2)
{
int y;
byte *dest = screens[0];
static int firsttic;
for (y = 0; y < (SCREENWIDTH << hires) * (SCREENHEIGHT << hires); y++)
{
dest[y] = colormaps[0][menushade * 256 + dest[y]];
}
if (menushade < 16 && gametic != firsttic)
{
menushade += 2;
firsttic = gametic;
}
}
else if (menushade)
menushade = 0;
inhelpscreens = false; inhelpscreens = false;

View File

@ -184,6 +184,9 @@ typedef struct setup_menu_s
const char **selectstrings; // [FG] selection of choices const char **selectstrings; // [FG] selection of choices
} setup_menu_t; } setup_menu_t;
extern int menu_background;
extern boolean M_MenuIsShaded(void);
#endif #endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -108,7 +108,6 @@ extern boolean screen_melt;
extern boolean hangsolid; extern boolean hangsolid;
extern boolean blockmapfix; extern boolean blockmapfix;
extern int extra_level_brightness; extern int extra_level_brightness;
extern int menu_background;
extern char *chat_macros[]; // killough 10/98 extern char *chat_macros[]; // killough 10/98
@ -1815,8 +1814,8 @@ default_t defaults[] = {
{ {
"automapoverlay", "automapoverlay",
(config_t *) &automapoverlay, NULL, (config_t *) &automapoverlay, NULL,
{0}, {0,1}, number, ss_auto, wad_no, {0}, {0,2}, number, ss_auto, wad_no,
"1 to enable automap overlay mode" "automap overlay mode (1 = on, 2 = dark)"
}, },
{ {

View File

@ -858,6 +858,36 @@ void V_DrawHorizLine(int x, int y, int scrn, int width, byte color)
} }
} }
void V_ShadeScreen(void)
{
int y;
byte *dest = screens[0];
const int targshade = 20;
static int oldtic = -1;
static int screenshade;
// [FG] longer than one tic ago? start a new sequence
if (gametic - oldtic > 1)
{
screenshade = 0;
}
for (y = 0; y < (SCREENWIDTH << hires) * (SCREENHEIGHT << hires); y++)
{
dest[y] = colormaps[0][screenshade * 256 + dest[y]];
}
if (screenshade < targshade && gametic != oldtic)
{
screenshade += 2;
if (screenshade > targshade)
screenshade = targshade;
}
oldtic = gametic;
}
// //
// V_Init // V_Init
// //

View File

@ -135,6 +135,8 @@ void V_PutBlock(int x, int y, int scrn, int width, int height, byte *src);
void V_DrawHorizLine(int x, int y, int scrn, int width, byte color); void V_DrawHorizLine(int x, int y, int scrn, int width, byte color);
void V_ShadeScreen(void);
// [FG] colored blood and gibs // [FG] colored blood and gibs
int V_BloodColor(int blood); int V_BloodColor(int blood);