Skip to content

Commit

Permalink
Continued work on low detail automap
Browse files Browse the repository at this point in the history
Almost there...
  • Loading branch information
bradharding committed Oct 28, 2023
1 parent 310f2e2 commit 9918ef0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
29 changes: 17 additions & 12 deletions src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "m_misc.h"
#include "p_local.h"
#include "st_stuff.h"
#include "v_video.h"

// Automap color priorities
#define WALLPRIORITY 9
Expand Down Expand Up @@ -1304,7 +1305,7 @@ static inline void PUTBIGDOT(unsigned int x, unsigned int y, const byte *color)
const bool atbottom = (y < (unsigned int)MAPBOTTOM);

if (attop)
*dot = *(*dot + color);
_PUTDOT(dot, color);

if (atbottom)
_PUTDOT(dot + MAPWIDTH, color);
Expand All @@ -1315,24 +1316,18 @@ static inline void PUTBIGDOT(unsigned int x, unsigned int y, const byte *color)
_PUTDOT(dot + 1, color);

if (atbottom)
{
dot += (size_t)MAPWIDTH + 1;
*dot = *(*dot + color);
}
_PUTDOT(dot + MAPWIDTH + 1, color);
}
}
else if (++x < (unsigned int)MAPWIDTH)
{
byte *dot = mapscreen + y + x;

if (y < MAPAREA)
*dot = *(*dot + color);
_PUTDOT(dot, color);

if (y < (unsigned int)MAPBOTTOM)
{
dot += MAPWIDTH;
*dot = *(*dot + color);
}
_PUTDOT(dot + MAPWIDTH, color);
}
}

Expand Down Expand Up @@ -2198,12 +2193,22 @@ void AM_Drawer(void)
if (things)
AM_DrawThings();

if (nummarks)
if (nummarks && r_detail == r_detail_high)
AM_DrawMarks();

AM_DrawPlayer();

if (am_antialiasing)
if (r_detail == r_detail_low)
{
if (am_antialiasing)
V_LowGraphicDetail_2x2_Antialiased(0, 0, MAPWIDTH, MAPAREA, 2, 2);
else
V_LowGraphicDetail_2x2(0, 0, MAPWIDTH, MAPAREA, 2, 2);

if (nummarks)
AM_DrawMarks();
}
else if (am_antialiasing)
AM_ApplyAntialiasing();

if (!(am_followmode || consoleactive))
Expand Down
1 change: 1 addition & 0 deletions src/c_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -8311,6 +8311,7 @@ static void vanilla_cmd_func2(char *cmd, char *parms)
C_HideConsole();

I_RestartGraphics(false);
AM_InitPixelSize();

nobindoutput = false;
togglingvanilla = false;
Expand Down
13 changes: 8 additions & 5 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,15 @@ void D_Display(void)
R_FillBackScreen();

// see if the border needs to be updated to the screen
if (!automapactive && viewwidth != SCREENWIDTH)
R_DrawViewBorder();
if (!automapactive)
{
if (viewwidth != SCREENWIDTH)
R_DrawViewBorder();

if (r_detail == r_detail_low)
postprocessfunc(viewwindowx, viewwindowy * SCREENWIDTH, viewwindowx + viewwidth,
(viewwindowy + viewheight) * SCREENWIDTH, lowpixelwidth, lowpixelheight);
if (r_detail == r_detail_low)
postprocessfunc(viewwindowx, viewwindowy * SCREENWIDTH, viewwindowx + viewwidth,
(viewwindowy + viewheight) * SCREENWIDTH, lowpixelwidth, lowpixelheight);
}

HU_Drawer();
}
Expand Down
4 changes: 2 additions & 2 deletions src/v_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ static void V_LowGraphicDetail_Antialiased(int left, int top, int width, int hei
}
}

static void V_LowGraphicDetail_2x2(int left, int top, int width, int height, int pixelwidth, int pixelheight)
void V_LowGraphicDetail_2x2(int left, int top, int width, int height, int pixelwidth, int pixelheight)
{
for (int y = top; y < height; y += 2 * SCREENWIDTH)
for (int x = left; x < width; x += 2)
Expand All @@ -1666,7 +1666,7 @@ static void V_LowGraphicDetail_2x2(int left, int top, int width, int height, int
}
}

static void V_LowGraphicDetail_2x2_Antialiased(int left, int top, int width, int height, int pixelwidth, int pixelheight)
void V_LowGraphicDetail_2x2_Antialiased(int left, int top, int width, int height, int pixelwidth, int pixelheight)
{
for (int y = top; y < height; y += 2 * SCREENWIDTH)
for (int x = left; x < width; x += 2)
Expand Down
3 changes: 3 additions & 0 deletions src/v_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ void V_DrawPagePatch(int screen, patch_t *patch);

void V_DrawPixel(int x, int y, byte color, bool highlight, bool shadow);

void V_LowGraphicDetail_2x2(int left, int top, int width, int height, int pixelwidth, int pixelheight);
void V_LowGraphicDetail_2x2_Antialiased(int left, int top, int width, int height, int pixelwidth, int pixelheight);

void GetPixelSize(void);
void V_InvertScreen(void);

Expand Down

0 comments on commit 9918ef0

Please sign in to comment.