From 5c0a57fe9f217aabfd109f7d1b2dc0f603cabd19 Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Fri, 10 Jan 2025 01:07:42 -0300 Subject: [PATCH] Low-res pixel width/height settings, and more Also added another debugging cheat. --- CHANGELOG.md | 1 + README.md | 1 + src/m_cheat.c | 14 ++++++++++-- src/r_main.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 651ab8bb3..5384ec6f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - **_Message Fadeout_** setting - **_Weapon Bob Speed_** setting - **_Bob [Weapon] While Switching_** setting +- **Low-resolution pixel width/height** settings - **_[Color] Contrast_** setting [by @pvictress] ## Changes diff --git a/README.md b/README.md index 01b431085..b3a0770a7 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ For these settings, their CVAR names are provided alongside the _CFG-only_ label - **_No palette tint in menus_** setting [i.b. Crispy Doom] - **_HUD/Menu Shadows_** setting (translucency determined by the CFG-only `hud_menu_shadows_filter_pct` CVAR) [i.b. CRL] - **_Flip Levels_** setting +- **Low-resolution pixel width/height** settings, to enlarge pixels when using 100% resolution (CFG-only: `lowres_pixel_width`, `lowres_pixel_height`) [i.b. Doom Retro] - **_No Berserk Tint_** setting - **_No Radiation Suit Tint_** setting - **_Night-Vision Visor Effect_** setting [i.b. International Doom] diff --git a/src/m_cheat.c b/src/m_cheat.c index b489fac98..f0dcce153 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -65,10 +65,17 @@ //#define NUGMAGIC #ifdef NUGMAGIC -static void cheat_magic() + +static void cheat_magic(void) +{ + +} + +static void cheat_magic2(void) { } + #endif // [Nugget] --------------------------/ @@ -440,7 +447,10 @@ struct cheat_s cheat[] = { {"idgaf", NULL, not_net | not_demo, {cheat_idgaf} }, #ifdef NUGMAGIC - {"ggg", NULL, 0, {cheat_magic}}, + + {"ggg", NULL, 0, {.v = cheat_magic}}, + {"hhh", NULL, 0, {.v = cheat_magic2}}, + #endif // [Nugget] ---------------------------------------------------------------/ diff --git a/src/r_main.c b/src/r_main.c index 1944c7efb..eeb850b77 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -141,6 +141,8 @@ int extra_level_brightness; // level brightness feature // CVARs --------------------------------------------------------------------- boolean flip_levels; +static int lowres_pixel_width; +static int lowres_pixel_height; boolean nightvision_visor; int fake_contrast; boolean diminished_lighting; @@ -1752,6 +1754,55 @@ void R_RenderPlayerView (player_t* player) R_SetFuzzPosDraw(); R_DrawMasked (); + // [Nugget] + if (!strictmode && current_video_height == SCREENHEIGHT + && (lowres_pixel_width > 1 || lowres_pixel_height > 1)) + { + int y, x, y2; + + const int pw = lowres_pixel_width, + ph = lowres_pixel_height; + + int first_y = ((viewheight % ph) / 2), + first_x; + + byte *const dest = I_VideoBuffer; + + for (y = viewwindowy; y < (viewwindowy + viewheight);) + { + first_x = (viewwidth % pw) / 2; + + for (x = viewwindowx; x < (viewwindowx + viewwidth);) + { + for (y2 = 0; y2 < (first_y ? first_y : MIN(ph, (viewwindowy + viewheight) - y)); y2++) + { + memset( + dest + ((y + y2) * video.pitch) + x, + dest[ + ( (first_y ? viewwindowy + first_y + : y + ((y < viewwindowy + viewheight/2) ? ph-1 : 0)) * video.pitch) + + (first_x ? viewwindowx + first_x + : x + ((x < viewwindowx + viewwidth/2) ? pw-1 : 0)) + ], + first_x ? first_x : MIN(pw, (viewwindowx + viewwidth) - x) + ); + } + + if (first_x) { + x += first_x; + first_x = 0; + } + else { x += pw; } + } + + if (first_y) { + y += first_y; + first_y = 0; + } + else { y += ph; } + } + } + // Check for new console commands. NetUpdate (); } @@ -1797,6 +1848,16 @@ void R_BindRenderVariables(void) BIND_BOOL_GENERAL(flip_levels, false, "Flip levels horizontally (visual filter)"); + // (CFG-only) + M_BindNum("lowres_pixel_width", &lowres_pixel_width, NULL, + 1, 1, 8, ss_none, wad_yes, + "Width multiplier for pixels at 100% resolution"); + + // (CFG-only) + M_BindNum("lowres_pixel_height", &lowres_pixel_height, NULL, + 1, 1, 8, ss_none, wad_yes, + "Height multiplier for pixels at 100% resolution"); + BIND_BOOL_GENERAL(no_berserk_tint, false, "Disable Berserk tint"); BIND_BOOL_GENERAL(no_radsuit_tint, false, "Disable Radiation Suit tint");