Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Oct 4, 2024
1 parent d0d6d9f commit ac1ed33
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 30 deletions.
40 changes: 17 additions & 23 deletions src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ static byte *am_crosshaircolor2;

// how much the automap moves window per tic in map coordinates
// moves 140 pixels in 1 second
#define F_PANINC ((uint64_t)8 << speedtoggle)
#define F_PANINC (8 << speedtoggle)

// how much zoom-in per tic
// goes to 2x in 1 second
#define M_ZOOMIN (fixed_t)((uint64_t)FRACUNIT * (1.0 + F_PANINC / 100.0))
#define M_ZOOMIN (fixed_t)(FRACUNIT * (1.0 + F_PANINC / 100.0))

// how much zoom-out per tic
// pulls out to 0.5x in 1 second
#define M_ZOOMOUT (fixed_t)((uint64_t)FRACUNIT / (1.0 + F_PANINC / 100.0))
#define M_ZOOMOUT (fixed_t)(FRACUNIT / (1.0 + F_PANINC / 100.0))

#define PLAYERRADIUS (16 * (1 << MAPBITS))

Expand All @@ -119,8 +119,8 @@ static byte *am_crosshaircolor2;
#define MTOF(x) (fixed_t)((((int64_t)(x) * scale_mtof) >> FRACBITS) >> FRACBITS)

// translates between frame-buffer and map coordinates
#define CXMTOF(x) MTOF((int64_t)(x) - m_x)
#define CYMTOF(y) (MAPHEIGHT - MTOF((int64_t)(y) - m_y))
#define CXMTOF(x) MTOF((x) - m_x)
#define CYMTOF(y) (MAPHEIGHT - MTOF((y) - m_y))

#define AM_CORRECTASPECTRATIO (5 * FRACUNIT / 6)

Expand Down Expand Up @@ -1451,12 +1451,6 @@ static void AM_DrawGrid(void)
int64_t endx = startx + minlen;
int64_t endy = starty + minlen;

if (am_correctaspectratio)
{
starty += starty * 6 / 5;
endy += endy * 6 / 5;
}

// Draw vertical gridlines
for (int64_t x = startx - ((startx - (bmaporgx >> FRACTOMAPBITS)) % gridwidth); x < endx; x += gridwidth)
{
Expand Down Expand Up @@ -2174,26 +2168,26 @@ static void AM_SetFrameVariables(void)
const fixed_t x = m_x + dx;
const fixed_t y = m_y + dy;
const fixed_t r = (fixed_t)sqrt((double)dx * dx + (double)dy * dy);
int angle = 0;

if (am_rotatemode)
{
angle = (ANG90 - viewangle) >> ANGLETOFINESHIFT;
rotatelinefunc = &AM_RotateLine;
}
else
rotatelinefunc = &AM_DoNotRotateLine;

am_frame.center.x = x;
am_frame.center.y = y;

am_frame.sin = finesine[angle];
am_frame.cos = finecosine[angle];

am_frame.bbox[BOXLEFT] = x - r;
am_frame.bbox[BOXRIGHT] = x + r;
am_frame.bbox[BOXBOTTOM] = y - r;
am_frame.bbox[BOXTOP] = y + r;

if (am_rotatemode)
{
const int angle = (ANG90 - viewangle) >> ANGLETOFINESHIFT;

am_frame.sin = finesine[angle];
am_frame.cos = finecosine[angle];

rotatelinefunc = &AM_RotateLine;
}
else
rotatelinefunc = &AM_DoNotRotateLine;
}

static void AM_ApplyAntialiasing(void)
Expand Down
10 changes: 5 additions & 5 deletions src/c_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ void C_UpdateFPSOverlay(void)
{
char buffer[32];
char *temp = commify(framespersecond);
const byte *tinttab = (r_hud_translucency ? (automapactive ? tinttab70 : tinttab50) : NULL);
const byte *tinttab = (r_hud_translucency ? (automapactive ? tinttab80 : tinttab50) : NULL);

M_snprintf(buffer, sizeof(buffer), "%s FPS", temp);

Expand All @@ -1347,7 +1347,7 @@ void C_UpdateTimerOverlay(void)
{
static char buffer[10];
static int prevtime = -1;
const byte *tinttab = (r_hud_translucency ? (automapactive ? tinttab70 : tinttab50) : NULL);
const byte *tinttab = (r_hud_translucency ? (automapactive ? tinttab80 : tinttab50) : NULL);
int y = OVERLAYTEXTY;

if (vid_showfps && framespersecond)
Expand Down Expand Up @@ -1376,7 +1376,7 @@ void C_UpdatePlayerPositionOverlay(void)
const int x = SCREENWIDTH - OVERLAYTEXTX + 1;
int y = OVERLAYTEXTY;
const int color = C_GetOverlayTextColor();
const byte *tinttab = (r_hud_translucency ? (automapactive ? tinttab70 : tinttab50) : NULL);
const byte *tinttab = (r_hud_translucency ? (automapactive ? tinttab80 : tinttab50) : NULL);
static char angle[32];
static char coordinates[32];

Expand Down Expand Up @@ -1457,7 +1457,7 @@ void C_UpdatePathOverlay(void)
y += OVERLAYLINEHEIGHT * 2 + OVERLAYSPACING;
}

C_DrawOverlayText(mapscreen, MAPWIDTH, x - width, y, (r_hud_translucency ? tinttab70 : NULL),
C_DrawOverlayText(mapscreen, MAPWIDTH, x - width, y, (r_hud_translucency ? tinttab80 : NULL),
distance, C_GetOverlayTextColor(), true);

pathoverlay = true;
Expand All @@ -1471,7 +1471,7 @@ void C_UpdatePlayerStatsOverlay(void)
int x;
int y;
const int color = C_GetOverlayTextColor();
const byte *tinttab = (r_hud_translucency ? tinttab70 : NULL);
const byte *tinttab = (r_hud_translucency ? tinttab80 : NULL);
static char time[10];
static int prevmaptime = -1;
static int width;
Expand Down
9 changes: 7 additions & 2 deletions src/hu_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,18 @@ static void HUlib_DrawAltHUDTextLine(hu_textline_t *l)
int color = (message_secret ? nearestgold : (message_warning ? nearestred :
(r_hud_translucency ? nearestwhite : nearestlightgray)));
const int len = l->len;
byte *tinttab = (automapactive ? tinttab75 : tinttab50);
byte *tinttab;

if (!automapactive)
if (automapactive)
tinttab = tinttab80;
else
{
color = (r_textures ? (viewplayer->fixedcolormap == INVERSECOLORMAP ?
colormaps[0][32 * 256 + color] : color) : (viewplayer->fixedcolormap == INVERSECOLORMAP ?
colormaps[0][32 * 256 + color] : (message_secret ? nearestgold : (message_warning ?
nearestred : nearestblack))));
tinttab = tinttab50;
}

if (fade)
{
Expand Down

0 comments on commit ac1ed33

Please sign in to comment.