Skip to content

Commit

Permalink
Support intermediate resolutions, and 9X
Browse files Browse the repository at this point in the history
commit 57fdfd4
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Fri Nov 24 22:00:57 2023 -0300

    Update documentation

commit ddc22b9
Merge: c42b1cd 25f9410
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Wed Nov 22 22:42:09 2023 -0300

    Merge branch 'master' into res_mult

commit c42b1cd
Merge: 360b654 57f9f91
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Mon Nov 20 20:02:04 2023 -0300

    Merge branch 'master' into res_mult

commit 360b654
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Mon Nov 20 07:31:36 2023 -0300

    Fix wipe speeds, mostly

commit 62ded58
Merge: 05e2d98 49ec730
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Thu Nov 16 03:53:31 2023 -0300

    Merge branch 'master' into res_mult

commit 05e2d98
Merge: 32a3dfa 41b5505
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Sat Nov 11 03:47:00 2023 -0300

    Merge branch 'master' into res_mult

commit 32a3dfa
Merge: b58ed91 236b586
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Fri Nov 10 06:45:59 2023 -0300

    Merge branch 'master' into res_mult

commit b58ed91
Merge: 699444c 445385a
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Thu Nov 9 07:48:19 2023 -0300

    Merge branch 'master' into res_mult

commit 699444c
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Thu Nov 9 07:43:41 2023 -0300

    Allow up to 9X resolution

    This allows for proper 4K resolution:

    W = 240 * (16/9) * 9 = 3840
    H = 200 * 1.2 * 9 = 2160

commit 5c525ab
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Tue Nov 7 19:37:38 2023 -0300

    Remove unused constant

commit e50ad3a
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Tue Nov 7 19:35:28 2023 -0300

    Fix blocky fuzz with non-power-of-2 multipliers

commit 8560c4b
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Mon Nov 6 02:36:26 2023 -0300

    Fix some issues

    More specifically:
    - Distorted screen with uneven multipliers in 16:9
    - Incorrect lighting
    - Excessive Automap line thickening

commit c940ff6
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Mon Nov 6 00:15:20 2023 -0300

    Get rid of `HIRES` width and height macros

commit 1a177ed
Author: Alaux <73968015+MrAlaux@users.noreply.github.com>
Date:   Mon Nov 6 00:04:50 2023 -0300

    First attempt
  • Loading branch information
MrAlaux committed Nov 25, 2023
1 parent 541b255 commit 1e16a58
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 209 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## New Features

- **Support for intermediate resolutions** (e.g. 3X, 5X) **and 9X (1800p)**
- **_Background for all menus_** setting
- **Minimap mode for Automap**
- **NUGHUD:**
Expand All @@ -17,6 +18,7 @@
- Let Ammo, Health and Armor icons fall back to vanilla sprites;
- Made Patches and icons alignable horizontally and vertically;
- Disabled Armor icon by default.
- **Speed of non-Melt wipes is now independent of resolution**
- **Implemented Teleporter Zoom for multiplayer respawning**
- **MDK Fist attacks now prioritize enemies over friends**
- **Current resolution is now reported by some video-related menu items**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For these settings, their CVAR names are provided alongside the _CFG-Only_ label

### General

- **Support for higher resolutions:** 4X (800p) and 8X (1600p) [by _ceski_]
- **Support for higher resolutions:** 3X (600p), 4X (800p)... up to 9X (1800p) [by _ceski_]
- **Selection of widescreen ratios** in the setup menu itself [i.b. Crispy Doom]
- Toggle to **stretch viewport to fit window** (CFG-Only: `stretch_to_fit`) [i.b. and partially p.f. Crispy Doom; i.b. ZDoom]
- **Gamma Correction slider ranging from 0.50 to 2.0 in steps of 0.05**
Expand Down
48 changes: 24 additions & 24 deletions src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,16 +643,16 @@ static void AM_LevelInit(void)
// [Nugget] Minimap
if (automapactive == AM_MINI)
{
f_x = 8 << hires;
f_y = (((message_list ? hud_msg_lines : 1) + 1) * 8 + 1) << hires;
f_w = f_h = 80 << hires;
f_x = 8 * hires;
f_y = (((message_list ? hud_msg_lines : 1) + 1) * 8 + 1) * hires;
f_w = f_h = 80 * hires;
}
else {
f_w = (SCREENWIDTH) << hires;
f_w = (SCREENWIDTH * hires);
if (automapoverlay && scaledviewheight == SCREENHEIGHT)
f_h = (SCREENHEIGHT) << hires;
f_h = (SCREENHEIGHT * hires);
else
f_h = (SCREENHEIGHT-ST_HEIGHT) << hires;
f_h = (SCREENHEIGHT-ST_HEIGHT) * hires;
}

AM_enableSmoothLines();
Expand Down Expand Up @@ -960,9 +960,9 @@ boolean AM_Responder
}

if (automapoverlay && scaledviewheight == SCREENHEIGHT)
f_h = (SCREENHEIGHT) << hires;
f_h = (SCREENHEIGHT * hires);
else
f_h = (SCREENHEIGHT-ST_HEIGHT) << hires;
f_h = (SCREENHEIGHT-ST_HEIGHT) * hires;

AM_activateNewScale();
}
Expand Down Expand Up @@ -1066,14 +1066,14 @@ boolean AM_Responder
if (!followplayer)
{
if (buttons_state[PAN_RIGHT])
m_paninc.x += FTOM(f_paninc << hires);
m_paninc.x += FTOM(f_paninc * hires);
if (buttons_state[PAN_LEFT])
m_paninc.x += -FTOM(f_paninc << hires);
m_paninc.x += -FTOM(f_paninc * hires);

if (buttons_state[PAN_UP])
m_paninc.y += FTOM(f_paninc << hires);
m_paninc.y += FTOM(f_paninc * hires);
if (buttons_state[PAN_DOWN])
m_paninc.y += -FTOM(f_paninc << hires);
m_paninc.y += -FTOM(f_paninc * hires);
}

if (!mousewheelzoom)
Expand Down Expand Up @@ -1243,7 +1243,7 @@ static void AM_clearFB(int color)

for (x = f_x; x < f_x+f_w; x++)
for (y = f_y; y < f_y+f_h; y++)
fb[y * (SCREENWIDTH << hires) + x] = color;
fb[y * (SCREENWIDTH * hires) + x] = color;
}

//
Expand Down Expand Up @@ -1393,12 +1393,12 @@ void PUTDOT(int x, int y, int color)
{
if (need_downscaling && !smooth_scaling)
{
for (int i = 0; i < MAX(1, 2 << (hires-2)) && (f_x <= x+i && x+i < f_x+f_w); i++)
for (int j = 0; j < MAX(1, 2 << (hires-2)) && (f_y <= y+j && y+j < f_y+f_h); j++)
fb[(y + j) * (SCREENWIDTH << hires) + (x + i)] = color;
for (int i = 0; i < MAX(1, hires-2) && (f_x <= x+i && x+i < f_x+f_w); i++)
for (int j = 0; j < MAX(1, hires-2) && (f_y <= y+j && y+j < f_y+f_h); j++)
fb[(y + j) * (SCREENWIDTH * hires) + (x + i)] = color;
}
else if ((f_x <= x && x < f_x+f_w) && (f_y <= y && y < f_y+f_h))
fb[y * (SCREENWIDTH<<hires) + x] = color;
fb[y * (SCREENWIDTH * hires) + x] = color;
}

//
Expand Down Expand Up @@ -2413,8 +2413,8 @@ static void AM_drawMarks(void)
for (i=0;i<markpointnum;i++) // killough 2/22/98: remove automap mark limit
if (markpoints[i].x != -1)
{
int w = 5 << hires;
int h = 6 << hires;
int w = 5 * hires;
int h = 6 * hires;
int fx;
int fy;
int j = i;
Expand All @@ -2434,16 +2434,16 @@ static void AM_drawMarks(void)
int d = j % 10;

if (d==1) // killough 2/22/98: less spacing for '1'
fx += 1<<hires;
fx += hires;

// [Nugget] Minimap: take `f_x` and `f_y` into account
if (fx >= f_x && fx < f_x+f_w - w && fy >= f_y && fy < f_y+f_h - h)
// [Nugget] Blink marks
V_DrawPatchTranslated((fx >> hires) - WIDESCREENDELTA,
fy >> hires, FB, marknums[d],
V_DrawPatchTranslated((fx / hires) - WIDESCREENDELTA,
fy / hires, FB, marknums[d],
(markblinktimer & 8) ? cr_dark : NULL);

fx -= w - (1<<hires); // killough 2/22/98: 1 space backwards
fx -= w - hires; // killough 2/22/98: 1 space backwards

j /= 10;
}
Expand Down Expand Up @@ -2478,7 +2478,7 @@ void AM_shadeScreen(void)

for (x = f_x; x < f_x+f_w; x++)
for (y = f_y; y < f_y+f_h; y++) {
pixel = y * (SCREENWIDTH << hires) + x;
pixel = y * (SCREENWIDTH * hires) + x;
fb[pixel] = colormaps[0][automap_overlay_darkening * 256 + fb[pixel]];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ void D_Display (void)
if (paused)
{
int y = 4;
int x = (viewwindowx>>hires);
int x = (viewwindowx/hires);
patch_t *patch = W_CacheLumpName("M_PAUSE", PU_CACHE);

if (!automapactive)
y += (viewwindowy>>hires);
y += (viewwindowy/hires);
V_DrawPatchDirect(x + (scaledviewwidth - SHORT(patch->width)) / 2 - WIDESCREENDELTA,
y, 0, patch);
}
Expand Down
7 changes: 4 additions & 3 deletions src/doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ typedef enum
#define ORIGWIDTH 320 // [crispy]
#define ORIGHEIGHT 200 // [crispy]

#define MAX_HIRES 3
#define MAX_SCREENWIDTH (576 << MAX_HIRES) // [FG] corresponds to 2.4:1 in hires mode
#define MAX_SCREENHEIGHT (ORIGHEIGHT << MAX_HIRES) // [crispy]
// [Nugget] We now multiply and divide by `hires` rather than bit-shifting
#define MAX_HIRES 9
#define MAX_SCREENWIDTH (576 * MAX_HIRES) // [FG] corresponds to 2.4:1 in hires mode
#define MAX_SCREENHEIGHT (ORIGHEIGHT * MAX_HIRES) // [crispy]

// The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4
Expand Down
17 changes: 8 additions & 9 deletions src/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,21 +902,20 @@ static void F_DrawPatchCol(int x, patch_t *patch, int col)
(const column_t *)((byte *) patch + LONG(patch->columnofs[col]));

// step through the posts in a column
if (hires)
if (hires > 1)
while (column->topdelta != 0xff)
{
int i, pos;
const int hires_size = 1 << hires;
byte *desttop = screens[0] + (x << hires);
byte *desttop = screens[0] + (x * hires);
const byte *source = (byte *) column + 3;
byte *dest = desttop + column->topdelta * (SCREENWIDTH << (2 * hires));
byte *dest = desttop + column->topdelta * (SCREENWIDTH * hires*hires);
int count = column->length;
for ( ; count--; dest += (SCREENWIDTH << (2 * hires)))
for ( ; count--; dest += (SCREENWIDTH * hires*hires))
{
for (pos = 0, i = 0; i < hires_size; i++)
for (pos = 0, i = 0; i < hires; i++)
{
memset(&dest[pos], *source, hires_size);
pos += SCREENWIDTH << hires;
memset(&dest[pos], *source, hires);
pos += (SCREENWIDTH * hires);
}
source++;
}
Expand Down Expand Up @@ -964,7 +963,7 @@ void F_BunnyScroll (void)
if (pillar_width > 0)
{
// [crispy] fill pillarboxes in widescreen mode
memset(screens[0], 0, (SCREENWIDTH<<hires) * (SCREENHEIGHT<<hires));
memset(screens[0], 0, (SCREENWIDTH * hires) * (SCREENHEIGHT * hires));
}
else
{
Expand Down
43 changes: 24 additions & 19 deletions src/f_wipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ static int wipe_doColorXForm(int width, int height, int ticks)
byte *e = wipe_scr_end;
byte *end = wipe_scr+width*height;

// [Nugget] Speed it up
ticks <<= 3;
ticks >>= hires;
ticks = MAX(1, ticks);
ticks *= 8; // [Nugget] Speed it up, to match "Melt" wipe speed

// [Nugget] Screen Wipe speed
if (!strictmode && wipe_speed_percentage != 100)
{ ticks = MAX(1, ticks * wipe_speed_percentage / 100); }

for (;w != end; w++, e++)
if (*w != *e)
Expand All @@ -85,7 +86,6 @@ static int *y;
static int wipe_initMelt(int width, int height, int ticks)
{
int i;
const int hires_size = 1 << hires;

// copy start screen to main screen
memcpy(wipe_scr, wipe_scr_start, width*height);
Expand All @@ -97,16 +97,16 @@ static int wipe_initMelt(int width, int height, int ticks)

// setup initial column positions (y<0 => not ready to scroll yet)
y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0);
y[0] = -(M_Random()%16) * hires_size;
y[0] = -(M_Random()%16) * hires;
for (i=1;i<width;i++)
{
int r = ((M_Random()%3) - 1) * hires_size;
int r = ((M_Random()%3) - 1) * hires;
y[i] = y[i-1] + r;
if (y[i] > 0)
y[i] = 0;
else
if (y[i] == -16 * hires_size)
y[i] = -15 * hires_size;
if (y[i] == -16 * hires)
y[i] = -15 * hires;
}
return 0;
}
Expand All @@ -118,6 +118,12 @@ static int wipe_doMelt(int width, int height, int ticks)

width /= 2;

ticks *= hires; // [Nugget] Hires support: brought from `wipe_ScreenWipe()`

// [Nugget] Screen Wipe speed
if (!strictmode && wipe_speed_percentage != 100)
{ ticks = MAX(1, ticks * wipe_speed_percentage / 100); }

while (ticks--)
for (i=0;i<width;i++)
if (y[i]<0)
Expand Down Expand Up @@ -178,10 +184,11 @@ static int wipe_doFade(int width, int height, int ticks)
static int screenshade = 1;
static const int targshade = 31;

// [Nugget] Speed it up
ticks <<= 1;
ticks >>= hires;
ticks = MAX(1, ticks);
ticks *= 2; // Speed it up, to match "Melt" wipe speed

// [Nugget] Screen Wipe speed
if (!strictmode && wipe_speed_percentage != 100)
{ ticks = MAX(1, ticks * wipe_speed_percentage / 100); }

memcpy(wipe_scr, fadeIn ? wipe_scr_end : wipe_scr_start, width * height);

Expand Down Expand Up @@ -255,12 +262,10 @@ int wipe_ScreenWipe(int wipeno, int x, int y, int width, int height, int ticks)
{
static boolean go; // when zero, stop the wipe

if (hires) // killough 11/98: hires support
width <<= hires, height <<= hires, ticks <<= hires;

// [Nugget] Screen Wipe speed
if (!strictmode && wipe_speed_percentage != 100)
{ ticks = MAX(1, ticks * wipe_speed_percentage / 100); }
// killough 11/98: hires support
// [Nugget] `ticks` is now calculated in `wipe_doMelt()`,
// since that's the only wipe style where it matters
width *= hires, height *= hires;

if (!go) // initial stuff
{
Expand Down
8 changes: 4 additions & 4 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1606,15 +1606,15 @@ static void HU_UpdateCrosshair(void)

void HU_UpdateCrosshairLock(int x, int y)
{
int w = (crosshair.w << hires);
int h = (crosshair.h << hires);
int w = (crosshair.w * hires);
int h = (crosshair.h * hires);

x = viewwindowx + BETWEEN(w, viewwidth - w - 1, x);
y = viewwindowy + BETWEEN(h, viewheight - h - 1, y);

if (hud_crosshair_lockon == crosslockon_full) // [Nugget]
{ crosshair.x = (x >> hires) - WIDESCREENDELTA; }
crosshair.y = (y >> hires);
{ crosshair.x = (x / hires) - WIDESCREENDELTA; }
crosshair.y = (y / hires);
}

void HU_DrawCrosshair(void)
Expand Down
Loading

0 comments on commit 1e16a58

Please sign in to comment.