mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
Implement dark automap overlay (#813)
* Implement dark automap overlay * Second implementation * Third implementation * Fourth implementation * Introduce `M_MenuIsShaded()`
This commit is contained in:
parent
31dd96a2ec
commit
a599174b61
21
src/am_map.c
21
src/am_map.c
@ -40,6 +40,7 @@
|
||||
#include "dstrings.h"
|
||||
#include "d_deh.h" // Ty 03/27/98 - externalizations
|
||||
#include "m_input.h"
|
||||
#include "m_menu.h"
|
||||
|
||||
//jff 1/7/98 default automap colors added
|
||||
int mapcolor_back; // map background
|
||||
@ -247,7 +248,7 @@ int automap_grid = 0;
|
||||
|
||||
boolean automapactive = false;
|
||||
|
||||
boolean automapoverlay = false;
|
||||
overlay_t automapoverlay = overlay_off;
|
||||
|
||||
// location of window on screen
|
||||
static int f_x;
|
||||
@ -943,11 +944,15 @@ boolean AM_Responder
|
||||
else
|
||||
if (M_InputActivated(input_map_overlay))
|
||||
{
|
||||
automapoverlay = !automapoverlay;
|
||||
if (automapoverlay)
|
||||
plr->message = s_AMSTR_OVERLAYON;
|
||||
else
|
||||
plr->message = s_AMSTR_OVERLAYOFF;
|
||||
if (++automapoverlay > overlay_dark)
|
||||
automapoverlay = overlay_off;
|
||||
|
||||
switch (automapoverlay)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -2309,6 +2314,10 @@ void AM_Drawer (void)
|
||||
AM_clearFB(mapcolor_back); //jff 1/5/98 background default color
|
||||
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
|
||||
AM_drawGrid(mapcolor_grid); //jff 1/7/98 grid default color
|
||||
AM_drawWalls();
|
||||
|
@ -255,7 +255,7 @@ void D_Display (void)
|
||||
case GS_LEVEL:
|
||||
if (!gametic)
|
||||
break;
|
||||
if (automapactive)
|
||||
if (automapactive && !automapoverlay)
|
||||
{
|
||||
// [FG] update automap while playing
|
||||
R_RenderPlayerView (&players[displayplayer]);
|
||||
@ -279,7 +279,7 @@ void D_Display (void)
|
||||
}
|
||||
|
||||
// draw the view directly
|
||||
if (gamestate == GS_LEVEL && !automapactive && gametic)
|
||||
if (gamestate == GS_LEVEL && (!automapactive || automapoverlay) && gametic)
|
||||
R_RenderPlayerView (&players[displayplayer]);
|
||||
|
||||
if (gamestate == GS_LEVEL && gametic)
|
||||
@ -316,6 +316,7 @@ void D_Display (void)
|
||||
if (gamestate == GS_LEVEL && automapactive && automapoverlay)
|
||||
{
|
||||
AM_Drawer();
|
||||
ST_Drawer(scaledviewheight == 200, redrawsbar);
|
||||
HU_Drawer();
|
||||
|
||||
// [crispy] force redraw of status bar and border
|
||||
|
@ -248,7 +248,15 @@ extern int snd_DesiredSfxDevice;
|
||||
extern boolean statusbaractive;
|
||||
|
||||
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 menuactive; // Menu overlayed?
|
||||
extern boolean paused; // Game Pause?
|
||||
|
34
src/m_menu.c
34
src/m_menu.c
@ -3429,6 +3429,10 @@ enum {
|
||||
auto1_flash,
|
||||
};
|
||||
|
||||
static const char *overlay_strings[] = {
|
||||
"Off", "On", "Dark", NULL
|
||||
};
|
||||
|
||||
// [FG] show level statistics and level time widgets
|
||||
static const char *show_widgets_strings[] = {
|
||||
"Off", "On Automap", "Always", NULL
|
||||
@ -3441,7 +3445,7 @@ setup_menu_t auto_settings1[] = // 1st AutoMap Settings screen
|
||||
{"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"}},
|
||||
{"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},
|
||||
|
||||
@ -6527,29 +6531,15 @@ void M_StartControlPanel (void)
|
||||
// killough 9/29/98: Significantly reformatted source
|
||||
//
|
||||
|
||||
boolean M_MenuIsShaded(void)
|
||||
{
|
||||
return setup_active && menu_background == 2;
|
||||
}
|
||||
|
||||
void M_Drawer (void)
|
||||
{
|
||||
static int menushade;
|
||||
|
||||
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;
|
||||
if (M_MenuIsShaded())
|
||||
V_ShadeScreen();
|
||||
|
||||
inhelpscreens = false;
|
||||
|
||||
|
@ -184,6 +184,9 @@ typedef struct setup_menu_s
|
||||
const char **selectstrings; // [FG] selection of choices
|
||||
} setup_menu_t;
|
||||
|
||||
extern int menu_background;
|
||||
extern boolean M_MenuIsShaded(void);
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -108,7 +108,6 @@ extern boolean screen_melt;
|
||||
extern boolean hangsolid;
|
||||
extern boolean blockmapfix;
|
||||
extern int extra_level_brightness;
|
||||
extern int menu_background;
|
||||
|
||||
extern char *chat_macros[]; // killough 10/98
|
||||
|
||||
@ -1815,8 +1814,8 @@ default_t defaults[] = {
|
||||
{
|
||||
"automapoverlay",
|
||||
(config_t *) &automapoverlay, NULL,
|
||||
{0}, {0,1}, number, ss_auto, wad_no,
|
||||
"1 to enable automap overlay mode"
|
||||
{0}, {0,2}, number, ss_auto, wad_no,
|
||||
"automap overlay mode (1 = on, 2 = dark)"
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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_ShadeScreen(void);
|
||||
|
||||
// [FG] colored blood and gibs
|
||||
|
||||
int V_BloodColor(int blood);
|
||||
|
Loading…
x
Reference in New Issue
Block a user