From 1e16a58b7df287cdf825e4432c882e87fd7f775d Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Fri, 24 Nov 2023 22:02:41 -0300 Subject: [PATCH] Support intermediate resolutions, and 9X commit 57fdfd4d97576fa0b8951f5201a3286693f7f65f Author: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Fri Nov 24 22:00:57 2023 -0300 Update documentation commit ddc22b9c4af47433eecdd9db1716ab72644ca3bd 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 c42b1cd6c0c14616a0a260f6d01e9a8c8d7480e5 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 360b6540158c5e8be6b354303b0774d368681935 Author: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Mon Nov 20 07:31:36 2023 -0300 Fix wipe speeds, mostly commit 62ded5834777d42eba192eaeeb5517bab1dbb40c 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 05e2d981c08e6f276aba4bcd2bcd513ac5619ee9 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 32a3dfa642e1933245e57bd21e9ff7affd40560f 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 b58ed916e97fbe9540714bc91bfa1d947b985d7f 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 699444c08ddf98c3ab68648da90c571381fb246e 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 5c525ab06b03bd031601044f2e48cf1f1d913571 Author: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Tue Nov 7 19:37:38 2023 -0300 Remove unused constant commit e50ad3a70d7e046381e2aa0695f4103625f0152b 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 8560c4b3fc6ecba474be728bc2657aad90cc8a3c 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 c940ff6728707a70e49c58f41e811565d1ca8fd2 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 1a177ed96a1bbca6d6663353c4b4c8bd3c6b2fc8 Author: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Mon Nov 6 00:04:50 2023 -0300 First attempt --- CHANGELOG.md | 2 + README.md | 2 +- src/am_map.c | 48 +++++++++++------------ src/d_main.c | 4 +- src/doomdef.h | 7 ++-- src/f_finale.c | 17 ++++----- src/f_wipe.c | 43 +++++++++++---------- src/hu_stuff.c | 8 ++-- src/i_video.c | 52 ++++++++++++------------- src/m_menu.c | 12 ++++-- src/m_misc.c | 5 ++- src/m_snapshot.c | 26 ++++++------- src/r_draw.c | 59 ++++++++++++++--------------- src/r_main.c | 12 +++--- src/r_segs.c | 4 +- src/r_things.c | 2 +- src/st_stuff.c | 23 ++++++----- src/v_video.c | 99 +++++++++++++++++++++++------------------------- 18 files changed, 216 insertions(+), 209 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e99c5f311..6802302c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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:** @@ -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** diff --git a/README.md b/README.md index 9bdadbdf5..234aa4c22 100644 --- a/README.md +++ b/README.md @@ -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** diff --git a/src/am_map.c b/src/am_map.c index 1bda2ddca..272a94ac8 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -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(); @@ -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(); } @@ -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) @@ -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; } // @@ -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<= 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); + 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); } diff --git a/src/doomdef.h b/src/doomdef.h index cc8f4ece0..eb81f0dab 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -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 diff --git a/src/f_finale.c b/src/f_finale.c index 748f707b1..d9597888b 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -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++; } @@ -964,7 +963,7 @@ void F_BunnyScroll (void) if (pillar_width > 0) { // [crispy] fill pillarboxes in widescreen mode - memset(screens[0], 0, (SCREENWIDTH<>= 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) @@ -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); @@ -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 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; } @@ -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>= 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); @@ -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 { diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 646415e97..d4642eb46 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -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) diff --git a/src/i_video.c b/src/i_video.c index 03ce1a9f0..c601b3304 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -345,8 +345,8 @@ static void I_ToggleFullScreen(void) { if (WindowOutOfBounds()) { - const int w = SCREENWIDTH << hires; - const int h = SCREENHEIGHT << hires; + const int w = (SCREENWIDTH * hires); + const int h = (SCREENHEIGHT * hires); if (!FindMinWindowSize(w, h, &window_width, &window_height)) { window_width = w; @@ -538,29 +538,28 @@ void I_FinishUpdate(void) lasttic = i; if (tics > 20) tics = 20; - if (hires) // killough 11/98: hires support + if (hires > 1) // killough 11/98: hires support { int j; - const int hires_size = 1 << hires; - const int pos0 = ((SCREENHEIGHT - 1) << hires) * (SCREENWIDTH << hires); + const int pos0 = ((SCREENHEIGHT - 1) * hires) * (SCREENWIDTH * hires); for (i = 0; i < tics * 2; i += 2) { - const int pos1 = pos0 + (i << hires); + const int pos1 = pos0 + (i * hires); int pos2 = 0; - for (j = 0; j < hires_size; j++) + for (j = 0; j < hires; j++) { - memset(&s[pos1 + pos2], 0xFF, hires_size); - pos2 += SCREENWIDTH << hires; + memset(&s[pos1 + pos2], 0xFF, hires); + pos2 += (SCREENWIDTH * hires); } } for ( ; i < 20 * 2; i += 2) { - const int pos1 = pos0 + (i << hires); + const int pos1 = pos0 + (i * hires); int pos2 = 0; - for (j = 0; j < hires_size; j++) + for (j = 0; j < hires; j++) { - memset(&s[pos1 + pos2], 0x0, hires_size); - pos2 += SCREENWIDTH << hires; + memset(&s[pos1 + pos2], 0x0, hires); + pos2 += (SCREENWIDTH * hires); } } } @@ -638,7 +637,7 @@ void I_FinishUpdate(void) void I_ReadScreen(byte *scr) { - const int size = SCREENWIDTH * (SCREENHEIGHT << (2 * hires)); + const int size = SCREENWIDTH * (SCREENHEIGHT * hires*hires); // haleyjd memcpy(scr, *screens, size); @@ -652,7 +651,7 @@ static byte *diskflash, *old_data; static void I_InitDiskFlash(void) { - byte temp[(16 * 16) << (2 * MAX_HIRES)]; + byte temp[(16 * 16) * MAX_HIRES*MAX_HIRES]; if (diskflash) { @@ -660,8 +659,8 @@ static void I_InitDiskFlash(void) Z_Free(old_data); } - diskflash = Z_Malloc((16< 1) { - SCREENWIDTH = ((SCREENWIDTH << hires) & (int)~3) / (1 << hires); + // [Nugget] Since we have uneven resolution multipliers, mask it twice + SCREENWIDTH = (((SCREENWIDTH * hires) & (int)~3) / hires + 3) & (int)~3; } else { SCREENWIDTH = (SCREENWIDTH + 3) & (int)~3; } // [crispy] ... but never exceeds MAX_SCREENWIDTH (array size!) - SCREENWIDTH = MIN(SCREENWIDTH, MAX_SCREENWIDTH >> MAX_HIRES); + SCREENWIDTH = MIN(SCREENWIDTH, MAX_SCREENWIDTH / MAX_HIRES); } WIDESCREENDELTA = (SCREENWIDTH - NONWIDEWIDTH) / 2; @@ -1044,8 +1044,8 @@ static void CreateUpscaledTexture(boolean force) int w, h, w_upscale, h_upscale; static int h_upscale_old, w_upscale_old; - const int screen_width = (SCREENWIDTH << hires); - const int screen_height = (SCREENHEIGHT << hires); + const int screen_width = (SCREENWIDTH * hires); + const int screen_height = (SCREENHEIGHT * hires); SDL_GetRendererInfo(renderer, &info); @@ -1139,7 +1139,7 @@ static boolean NeedDownscaling(void) SDL_RendererInfo info; int w, h; - const int screen_width = SCREENWIDTH << hires; + const int screen_width = (SCREENWIDTH * hires); SDL_GetRendererInfo(renderer, &info); if (info.flags & SDL_RENDERER_SOFTWARE) @@ -1180,8 +1180,8 @@ static void I_ResetGraphicsMode(void) I_GetScreenDimensions(); - w = (SCREENWIDTH << hires); - h = (SCREENHEIGHT << hires); + w = (SCREENWIDTH * hires); + h = (SCREENHEIGHT * hires); blit_rect.w = w; blit_rect.h = h; diff --git a/src/m_menu.c b/src/m_menu.c index 89021b634..3b776a2b0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2681,8 +2681,8 @@ void M_DrawInstructions() char str[48]; M_snprintf(str, sizeof(str), "Current Resolution: %ix%i", - (SCREENWIDTH << hires), - (use_aspect ? (6 * SCREENHEIGHT / 5) : SCREENHEIGHT) << hires); + (SCREENWIDTH * hires), + (use_aspect ? (6 * SCREENHEIGHT / 5) : SCREENHEIGHT) * hires); M_DrawString((ORIGWIDTH / 2) - (M_GetPixelWidth(str) / 2), M_Y + (14 * M_SPC), CR_GOLD, str); @@ -4357,7 +4357,11 @@ static void M_ResetScreen(void) } static const char *hires_strings[] = { - "1X (200p)", "2X (400p)", "4X (800p)", "8X (1600p)", NULL + NULL, + "1X (200p)", "2X (400p)", "3X (600p)", + "4X (800p)", "5X (1000p)", "6X (1200p)", + "7X (1400p)", "8X (1600p)", "9X (1800p)", + NULL }; setup_menu_t gen_settings1[] = { // General Settings screen1 @@ -8067,7 +8071,7 @@ void M_ResetSetupMenu(void) void M_ResetSetupMenuVideo(void) { - DISABLE_ITEM(!hires, enem_settings1[enem1_fuzz]); + DISABLE_ITEM(hires == 1, enem_settings1[enem1_fuzz]); M_EnableDisableFPSLimit(); } diff --git a/src/m_misc.c b/src/m_misc.c index 574251e74..bb3f0895e 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -165,9 +165,10 @@ default_t defaults[] = { // { // killough 11/98: hires + // [Nugget] Now a multiplier "hires", (config_t *) &default_hires, NULL, - {1}, {0,MAX_HIRES}, number, ss_none, wad_no, - "Renderer resolution (0 = 200p, 1 = 400p, 2 = 800p, 3 = 1600p)" + {2}, {1,MAX_HIRES}, number, ss_none, wad_no, + "Renderer resolution multiplier (1 = 200p, 2 = 400p, 3 = 600p...)" }, { diff --git a/src/m_snapshot.c b/src/m_snapshot.c index ed5c16aaa..27abae2d1 100644 --- a/src/m_snapshot.c +++ b/src/m_snapshot.c @@ -103,7 +103,7 @@ char *M_GetSavegameTime (int i) static void M_TakeSnapshot (void) { - const int inc = 1 << hires; + const int inc = hires; int x, y; byte *p; const byte *s = screens[0]; @@ -119,11 +119,11 @@ static void M_TakeSnapshot (void) } p = current_snapshot; - for (y = 0; y < (SCREENHEIGHT << hires); y += inc) + for (y = 0; y < (SCREENHEIGHT * hires); y += inc) { - for (x = 0; x < (NONWIDEWIDTH << hires); x += inc) + for (x = 0; x < (NONWIDEWIDTH * hires); x += inc) { - *p++ = s[y * (SCREENWIDTH << hires) + (WIDESCREENDELTA << hires) + x]; + *p++ = s[y * (SCREENWIDTH * hires) + (WIDESCREENDELTA * hires) + x]; } } @@ -146,34 +146,34 @@ void M_WriteSnapshot (byte *p) boolean M_DrawSnapshot (int n, int x, int y, int w, int h) { - byte *dest = screens[0] + y * (SCREENWIDTH << (2 * hires)) + (x << hires); + byte *dest = screens[0] + y * (SCREENWIDTH * hires*hires) + (x * hires); if (!snapshots[n]) { int desty; - for (desty = 0; desty < (h << hires); desty++) + for (desty = 0; desty < (h * hires); desty++) { - memset(dest, 0, w << hires); - dest += SCREENWIDTH << hires; + memset(dest, 0, w * hires); + dest += (SCREENWIDTH * hires); } return false; } else { - const fixed_t step_x = (ORIGWIDTH << FRACBITS) / (w << hires); - const fixed_t step_y = (ORIGHEIGHT << FRACBITS) / (h << hires); + const fixed_t step_x = (ORIGWIDTH << FRACBITS) / (w * hires); + const fixed_t step_y = (ORIGHEIGHT << FRACBITS) / (h * hires); int destx, desty; fixed_t srcx, srcy; byte *destline, *srcline; - for (desty = 0, srcy = 0; desty < (h << hires); desty++, srcy += step_y) + for (desty = 0, srcy = 0; desty < (h * hires); desty++, srcy += step_y) { - destline = dest + desty * (SCREENWIDTH << hires); + destline = dest + desty * (SCREENWIDTH * hires); srcline = snapshots[n] + (srcy >> FRACBITS) * ORIGWIDTH; - for (destx = 0, srcx = 0; destx < (w << hires); destx++, srcx += step_x) + for (destx = 0, srcx = 0; destx < (w * hires); destx++, srcx += step_x) { *destline++ = srcline[srcx >> FRACBITS]; } diff --git a/src/r_draw.c b/src/r_draw.c index bb32cea09..4909af9f5 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -552,16 +552,15 @@ static void R_DrawFuzzColumn_block(void) int count; byte *dest; boolean cutoff_yl, cutoff_yh; - const int hires_size = 1 << hires; - const int hires_mult = hires_size - 1; // [FG] draw only even columns - if (dc_x & hires_mult) + if (dc_x % hires) return; // [FG] draw only even pixels - dc_yl = (dc_yl + hires_mult) & ~hires_mult; - dc_yh &= (int)~hires_mult; + dc_yl += hires; + dc_yl -= dc_yl % hires; + dc_yh -= dc_yh % hires; count = dc_yh - dc_yl; @@ -569,7 +568,7 @@ static void R_DrawFuzzColumn_block(void) return; cutoff_yl = (dc_yl == 0); - cutoff_yh = (dc_yh == viewheight - hires_size); + cutoff_yh = (dc_yh == viewheight - hires); #ifdef RANGECHECK if ((unsigned) dc_x >= MAX_SCREENWIDTH @@ -581,7 +580,7 @@ static void R_DrawFuzzColumn_block(void) dest = ylookup[dc_yl] + columnofs[dc_x]; - count >>= hires; + count /= hires; count++; if (cutoff_yh) @@ -589,7 +588,7 @@ static void R_DrawFuzzColumn_block(void) if (count > 0) { - DrawFuzzBlock(FUZZTOP, &dest, hires_size, cutoff_yl ? 0 : -1, 1); + DrawFuzzBlock(FUZZTOP, &dest, hires, cutoff_yl ? 0 : -1, 1); count--; } @@ -597,12 +596,12 @@ static void R_DrawFuzzColumn_block(void) { // [FG] draw only even pixels as 2x2 squares // using the same fuzzoffset value - DrawFuzzBlock(FUZZDARK, &dest, hires_size, -1, 1); + DrawFuzzBlock(FUZZDARK, &dest, hires, -1, 1); } if (cutoff_yh) { - DrawFuzzBlock(FUZZDARK, &dest, hires_size, -1, 0); + DrawFuzzBlock(FUZZDARK, &dest, hires, -1, 0); } } @@ -612,7 +611,7 @@ int fuzzcolumn_mode; void (*R_DrawFuzzColumn) (void) = R_DrawFuzzColumn_orig; void R_SetFuzzColumnMode (void) { - if (fuzzcolumn_mode && hires) + if (fuzzcolumn_mode && hires > 1) R_DrawFuzzColumn = R_DrawFuzzColumn_block; else R_DrawFuzzColumn = R_DrawFuzzColumn_orig; @@ -816,7 +815,7 @@ void R_InitBuffer(int width, int height) { int i; - linesize = SCREENWIDTH << hires; // killough 11/98 + linesize = (SCREENWIDTH * hires); // killough 11/98 // Handle resize, // e.g. smaller view windows @@ -824,22 +823,22 @@ void R_InitBuffer(int width, int height) //viewwindowx = (SCREENWIDTH-width) >> !hires; // killough 11/98 viewwindowx = (SCREENWIDTH - width) >> 1; - viewwindowx <<= hires; + viewwindowx *= hires; // Column offset. For windows. - for (i = width << hires ; i--; ) // killough 11/98 + for (i = width * hires ; i--; ) // killough 11/98 columnofs[i] = viewwindowx + i; // Same with base row offset. viewwindowy = width==SCREENWIDTH ? 0 : (SCREENHEIGHT-SBARHEIGHT-height)>>1; - viewwindowy <<= hires; // killough 11/98 + viewwindowy *= hires; // killough 11/98 // Preclaculate all row offsets. - for (i = height << hires; i--; ) + for (i = height * hires; i--; ) ylookup[i] = screens[0] + (i+viewwindowy)*linesize; // killough 11/98 } @@ -855,15 +854,15 @@ void R_DrawBackground(char *patchname, byte *back_dest) int x, y; byte *src = W_CacheLumpNum(firstflat + R_FlatNumForName(patchname), PU_CACHE); - if (hires) // killough 11/98: hires support + if (hires > 1) // killough 11/98: hires support { int i; - for (y = 0; y < (SCREENHEIGHT << hires); y++) + for (y = 0; y < (SCREENHEIGHT * hires); y++) { - for (x = 0; x < (SCREENWIDTH << hires); x += (1 << hires)) + for (x = 0; x < (SCREENWIDTH * hires); x += hires) { - const byte dot = src[(((y >> hires) & 63) << 6) + ((x >> hires) & 63)]; - for (i = 0; i < (1 << hires); i++) + const byte dot = src[(((y / hires) & 63) << 6) + ((x / hires) & 63)]; + for (i = 0; i < hires; i++) { *back_dest++ = dot; } @@ -927,7 +926,7 @@ void R_FillBackScreen (void) // killough 11/98: use the function in m_menu.c R_DrawBackground(gamemode==commercial ? "GRNROCK" : "FLOOR7_2", screens[1]); - R_DrawBorder(viewwindowx >> hires, viewwindowy >> hires, scaledviewwidth, scaledviewheight, 1); + R_DrawBorder(viewwindowx / hires, viewwindowy / hires, scaledviewwidth, scaledviewheight, 1); } // @@ -936,16 +935,16 @@ void R_FillBackScreen (void) void R_VideoErase(unsigned ofs, int count) { - if (hires) // killough 11/98: hires support + if (hires > 1) // killough 11/98: hires support { int i; const int pos = ofs % SCREENWIDTH; - ofs = (((ofs - pos) << hires) + pos) << hires; // recompose offset - count <<= hires; - for (i = 0; i < (1 << hires); i++) + ofs = (((ofs - pos) * hires) + pos) * hires; // recompose offset + count *= hires; + for (i = 0; i < hires; i++) { memcpy(screens[0]+ofs, screens[1]+ofs, count); // LFB copy. - ofs += SCREENWIDTH << hires; + ofs += (SCREENWIDTH * hires); } return; } @@ -970,11 +969,11 @@ void R_DrawViewBorder(void) return; // copy top - for (ofs = 0, i = viewwindowy >> hires; i--; ofs += SCREENWIDTH) + for (ofs = 0, i = viewwindowy / hires; i--; ofs += SCREENWIDTH) R_VideoErase(ofs, SCREENWIDTH); // copy sides - for (side = viewwindowx >> hires, i = scaledviewheight; i--;) + for (side = viewwindowx / hires, i = scaledviewheight; i--;) { R_VideoErase(ofs, side); ofs += SCREENWIDTH; @@ -982,7 +981,7 @@ void R_DrawViewBorder(void) } // copy bottom - for (i = viewwindowy >> hires; i--; ofs += SCREENWIDTH) + for (i = viewwindowy / hires; i--; ofs += SCREENWIDTH) R_VideoErase(ofs, SCREENWIDTH); } diff --git a/src/r_main.c b/src/r_main.c index babc8cfe3..6e3f86b07 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -597,11 +597,11 @@ void R_ExecuteSetViewSize (void) } } - viewwidth = scaledviewwidth << hires; // killough 11/98 - viewheight = scaledviewheight << hires; // killough 11/98 - viewwidth_nonwide = scaledviewwidth_nonwide << hires; + viewwidth = scaledviewwidth * hires; // killough 11/98 + viewheight = scaledviewheight * hires; // killough 11/98 + viewwidth_nonwide = scaledviewwidth_nonwide * hires; - viewblocks = MIN(setblocks, 10) << hires; + viewblocks = MIN(setblocks, 10) * hires; // [Nugget] FOV changes if (fovchange) @@ -1133,8 +1133,8 @@ void R_RenderPlayerView (player_t* player) c[i] = t=='/' ? color : t; } if (gametic-lastshottic < TICRATE*2 && gametic-lastshottic > TICRATE/8) - V_DrawBlock(((viewwindowx + viewwidth/2) >> hires) - 24, - ((viewwindowy + viewheight/2) >> hires) - 24, 0, 47, 47, c); + V_DrawBlock(((viewwindowx + viewwidth/2) / hires) - 24, + ((viewwindowy + viewheight/2) / hires) - 24, 0, 47, 47, c); R_DrawViewBorder(); } diff --git a/src/r_segs.c b/src/r_segs.c index 3ae3f6bc3..18836dba7 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -159,7 +159,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2) if (!fixedcolormap) // calculate lighting { unsigned index = (int) (spryscale/fovdiff) // [Nugget] - >>(LIGHTSCALESHIFT+hires); // killough 11/98 + / ((1 << LIGHTSCALESHIFT) * hires); // killough 11/98 if (index >= MAXLIGHTSCALE ) index = MAXLIGHTSCALE-1; @@ -377,7 +377,7 @@ static void R_RenderSegLoop (void) // calculate lighting index = (int) (rw_scale/fovdiff) // [Nugget] - >>(LIGHTSCALESHIFT+hires); // killough 11/98 + / ((1 << LIGHTSCALESHIFT) * hires); // killough 11/98 if (index >= MAXLIGHTSCALE ) index = MAXLIGHTSCALE-1; diff --git a/src/r_things.c b/src/r_things.c index c74c92884..d96aeffcf 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -637,7 +637,7 @@ void R_ProjectSprite (mobj_t* thing) vis->colormap[0] = vis->colormap[1] = fullcolormap; // full bright // killough 3/20/98 else { // diminished light - int index = (int) (xscale/fovdiff)>>(LIGHTSCALESHIFT+hires); // killough 11/98 + int index = (int) (xscale/fovdiff) / ((1 << LIGHTSCALESHIFT) * hires); // killough 11/98 if (index >= MAXLIGHTSCALE) index = MAXLIGHTSCALE-1; vis->colormap[0] = spritelights[index]; diff --git a/src/st_stuff.c b/src/st_stuff.c index 81154500b..a43efaa22 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -293,7 +293,7 @@ void ST_refreshBackground(boolean force) { // [FG] calculate average color of the 16px left and right of the status bar const int vstep[][2] = {{0, 1}, {1, 2}, {2, ST_HEIGHT}}; - const int hstep = SCREENWIDTH << (2 * hires); + const int hstep = SCREENWIDTH * hires*hires; const int lo = MAX(st_x + WIDESCREENDELTA - SHORT(sbar->leftoffset), 0); const int w = MIN(SHORT(sbar->width), SCREENWIDTH); const int depth = 16; @@ -314,12 +314,12 @@ void ST_refreshBackground(boolean force) { for (x = 0; x < depth; x++) { - byte *c = dest + y * hstep + ((x + lo) << hires); + byte *c = dest + y * hstep + ((x + lo) * hires); r += pal[3 * c[0] + 0]; g += pal[3 * c[0] + 1]; b += pal[3 * c[0] + 2]; - c += (w - 2 * x - 1) << hires; + c += (w - 2 * x - 1) * hires; r += pal[3 * c[0] + 0]; g += pal[3 * c[0] + 1]; b += pal[3 * c[0] + 2]; @@ -334,9 +334,9 @@ void ST_refreshBackground(boolean force) col = I_GetPaletteIndex(pal, r/2, g/2, b/2); // [FG] fill background buffer with average status bar color - for (y = (v0 << hires); y < (v1 << hires); y++) + for (y = (v0 * hires); y < (v1 * hires); y++) { - memset(dest + y * (SCREENWIDTH << hires), col, (SCREENWIDTH << hires)); + memset(dest + y * (SCREENWIDTH * hires), col, (SCREENWIDTH * hires)); } } @@ -352,16 +352,15 @@ void ST_refreshBackground(boolean force) src = W_CacheLumpNum(firstflat + R_FlatNumForName(name), PU_CACHE); - if (hires) + if (hires > 1) { int i; - const int hires_size = 1 << hires; - for (y = ((SCREENHEIGHT - ST_HEIGHT) << hires); y < (SCREENHEIGHT << hires); y++) + for (y = ((SCREENHEIGHT - ST_HEIGHT) * hires); y < (SCREENHEIGHT * hires); y++) { - for (x = 0; x < (SCREENWIDTH << hires); x += hires_size) + for (x = 0; x < (SCREENWIDTH * hires); x += hires) { - const byte dot = src[(((y >> hires) & 63) << 6) + ((x >> hires) & 63)]; - for (i = 0; i < hires_size; i++) + const byte dot = src[(((y / hires) & 63) << 6) + ((x / hires) & 63)]; + for (i = 0; i < hires; i++) { *dest++ = dot; } @@ -1801,7 +1800,7 @@ void ST_Init(void) ST_loadData(); st_height = StatusBarBufferHeight(); - size = SCREENWIDTH * (st_height << (2 * hires)); + size = SCREENWIDTH * (st_height * hires*hires); if (screens[4]) { diff --git a/src/v_video.c b/src/v_video.c index d588eb7c7..80e6bcd7f 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -316,18 +316,18 @@ void V_CopyRect(int srcx, int srcy, int srcscrn, int width, if (desty + height > SCREENHEIGHT) height = SCREENHEIGHT - desty; - if (hires) // killough 11/98: hires support + if (hires > 1) // killough 11/98: hires support { - width <<= hires; - height <<= hires; - src = screens[srcscrn] + (SCREENWIDTH << (2 * hires)) * srcy + (srcx << hires); - dest = screens[destscrn] + (SCREENWIDTH << (2 * hires)) * desty + (destx << hires); + width *= hires; + height *= hires; + src = screens[srcscrn] + (SCREENWIDTH * hires*hires) * srcy + (srcx * hires); + dest = screens[destscrn] + (SCREENWIDTH * hires*hires) * desty + (destx * hires); for ( ; height>0 ; height--) { memcpy (dest, src, width); - src += SCREENWIDTH << hires; - dest += SCREENWIDTH << hires; + src += (SCREENWIDTH * hires); + dest += (SCREENWIDTH * hires); } } else @@ -384,13 +384,12 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch, return; // killough 1/19/98: commented out printfs #endif - if (hires) // killough 11/98: hires support (well, sorta :) + if (hires > 1) // killough 11/98: hires support (well, sorta :) { int i, j; - const int hires_size = 1 << hires; - byte *desttop = screens[scrn] + y * (SCREENWIDTH << (2 * hires)) + (x << hires); + byte *desttop = screens[scrn] + y * (SCREENWIDTH * hires*hires) + (x * hires); - for ( ; col != colstop ; col += colstep, desttop += hires_size, x++) + for ( ; col != colstop ; col += colstep, desttop += hires, x++) { const column_t *column = (const column_t *)((byte *)patch + LONG(patch->columnofs[col])); @@ -411,7 +410,7 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch, // killough 2/21/98: Unrolled and performance-tuned register const byte *source = (byte *) column + 3; - register byte *dest = desttop + column->topdelta * (SCREENWIDTH << (2 * hires)); + register byte *dest = desttop + column->topdelta * (SCREENWIDTH * hires*hires); register int count = column->length; // [FG] prevent framebuffer overflows @@ -419,7 +418,7 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch, int topy = y + column->topdelta; // [FG] too high while (topy < 0 && count) - count--, source++, dest += (SCREENWIDTH << (2 * hires)), topy++; + count--, source++, dest += (SCREENWIDTH * hires*hires), topy++; // [FG] too low, too tall while (topy + count > SCREENHEIGHT && count) count--; @@ -430,10 +429,10 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch, { for (i = 0; i < 4; i++) { - for (j = 0; j < hires_size; j++) + for (j = 0; j < hires; j++) { - memset(dest, *source, hires_size); - dest += SCREENWIDTH << hires; + memset(dest, *source, hires); + dest += (SCREENWIDTH * hires); } source++; } @@ -442,10 +441,10 @@ void V_DrawPatchGeneral(int x, int y, int scrn, patch_t *patch, if (count+=4) do { - for (i = 0; i < hires_size; i++) + for (i = 0; i < hires; i++) { - memset(dest, *source, hires_size); - dest += SCREENWIDTH << hires; + memset(dest, *source, hires); + dest += (SCREENWIDTH * hires); } source++; } @@ -568,13 +567,12 @@ void V_DrawPatchTranslated(int x, int y, int scrn, patch_t *patch, char *outr) col = 0; w = SHORT(patch->width); - if (hires) // killough 11/98: hires support (well, sorta :) + if (hires > 1) // killough 11/98: hires support (well, sorta :) { int i, j; - const int hires_size = 1 << hires; - byte *desttop = screens[scrn] + y * (SCREENWIDTH << (2 * hires)) + (x << hires); + byte *desttop = screens[scrn] + y * (SCREENWIDTH * hires*hires) + (x * hires); - for ( ; colcolumnofs[col])); @@ -595,7 +593,7 @@ void V_DrawPatchTranslated(int x, int y, int scrn, patch_t *patch, char *outr) // killough 2/21/98: Unrolled and performance-tuned register const byte *source = (byte *) column + 3; - register byte *dest = desttop + column->topdelta * (SCREENWIDTH << (2 * hires)); + register byte *dest = desttop + column->topdelta * (SCREENWIDTH * hires*hires); register int count = column->length; // [FG] prevent framebuffer overflows @@ -603,7 +601,7 @@ void V_DrawPatchTranslated(int x, int y, int scrn, patch_t *patch, char *outr) int topy = y + column->topdelta; // [FG] too high while (topy < 0 && count) - count--, source++, dest += (SCREENWIDTH << (2 * hires)), topy++; + count--, source++, dest += (SCREENWIDTH * hires*hires), topy++; // [FG] too low, too tall while (topy + count > SCREENHEIGHT && count) count--; @@ -614,10 +612,10 @@ void V_DrawPatchTranslated(int x, int y, int scrn, patch_t *patch, char *outr) { for (i = 0; i < 4; i++) { - for (j = 0; j < hires_size; j++) + for (j = 0; j < hires; j++) { - memset(dest, outr[*source], hires_size); - dest += SCREENWIDTH << hires; + memset(dest, outr[*source], hires); + dest += (SCREENWIDTH * hires); } source++; } @@ -626,10 +624,10 @@ void V_DrawPatchTranslated(int x, int y, int scrn, patch_t *patch, char *outr) if (count+=4) do { - for (i = 0; i < hires_size; i++) + for (i = 0; i < hires; i++) { - memset(dest, outr[*source], hires_size); - dest += SCREENWIDTH << hires; + memset(dest, outr[*source], hires); + dest += (SCREENWIDTH * hires); } source++; } @@ -730,7 +728,7 @@ void V_DrawPatchFullScreen(int scrn, patch_t *patch) // [crispy] fill pillarboxes in widescreen mode if (SCREENWIDTH != NONWIDEWIDTH) { - memset(screens[scrn], 0, (SCREENWIDTH< 1) // killough 11/98: hires support { int i, pos; - const int hires_size = 1 << hires; - byte *dest = screens[scrn] + y * (SCREENWIDTH << (2 * hires)) + (x << hires); + byte *dest = screens[scrn] + y * (SCREENWIDTH * hires*hires) + (x * hires); if (width) while (height--) @@ -773,15 +770,15 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height, byte *src) int t = width; do { - for (pos = 0, i = 0; i < hires_size; i++) + for (pos = 0, i = 0; i < hires; i++) { - memset(&d[pos], *src, hires_size); - pos += SCREENWIDTH << hires; + memset(&d[pos], *src, hires); + pos += (SCREENWIDTH * hires); } src++; } - while (d += hires_size, --t); - dest += SCREENWIDTH << (2 * hires); + while (d += hires, --t); + dest += SCREENWIDTH * hires*hires; } } else @@ -820,14 +817,14 @@ void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest) I_Error ("Bad V_DrawBlock"); #endif - if (hires) // killough 11/98: hires support - y <<= (2 * hires), x <<= hires, width <<= hires, height <<= hires; + if (hires > 1) // killough 11/98: hires support + y *= hires*hires, x *= hires, width *= hires, height *= hires; src = screens[scrn] + y*SCREENWIDTH+x; while (height--) { memcpy (dest, src, width); - src += SCREENWIDTH << hires; + src += (SCREENWIDTH * hires); dest += width; } } @@ -847,15 +844,15 @@ void V_PutBlock(int x, int y, int scrn, int width, int height, byte *src) I_Error ("Bad V_DrawBlock"); #endif - if (hires) - y <<= (2 * hires), x <<= hires, width <<= hires, height <<= hires; + if (hires > 1) + y *= hires*hires, x *= hires, width *= hires, height *= hires; dest = screens[scrn] + y*SCREENWIDTH+x; while (height--) { memcpy (dest, src, width); - dest += SCREENWIDTH << hires; + dest += (SCREENWIDTH * hires); src += width; } } @@ -869,15 +866,15 @@ void V_DrawHorizLine(int x, int y, int scrn, int width, byte color) if (x + width > (unsigned)SCREENWIDTH) width = SCREENWIDTH - x; - if (hires) - y <<= (2 * hires), x <<= hires, width <<= hires, height <<= hires; + if (hires > 1) + y *= hires*hires, x *= hires, width *= hires, height *= hires; dest = screens[scrn] + y * SCREENWIDTH + x; while (height--) { memset(dest, color, width); - dest += SCREENWIDTH << hires; + dest += (SCREENWIDTH * hires); } } @@ -895,7 +892,7 @@ void V_ShadeScreen(const int targshade) // [Nugget] Parameterized screenshade = 0; } - for (y = 0; y < (SCREENWIDTH << hires) * (SCREENHEIGHT << hires); y++) + for (y = 0; y < (SCREENWIDTH * hires) * (SCREENHEIGHT * hires); y++) { dest[y] = colormaps[0][screenshade * 256 + dest[y]]; } @@ -925,7 +922,7 @@ void V_ShadeScreen(const int targshade) // [Nugget] Parameterized void V_Init(void) { // haleyjd - const int size = SCREENWIDTH * (SCREENHEIGHT << (2 * hires)); + const int size = SCREENWIDTH * (SCREENHEIGHT * hires*hires); static byte *s; if(s)