Skip to content

Commit

Permalink
Low-res pixel width/height settings, and more
Browse files Browse the repository at this point in the history
Also added another debugging cheat.
  • Loading branch information
MrAlaux committed Jan 10, 2025
1 parent bcbc382 commit 5c0a57f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
14 changes: 12 additions & 2 deletions src/m_cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@
//#define NUGMAGIC

#ifdef NUGMAGIC
static void cheat_magic()

static void cheat_magic(void)
{

}

static void cheat_magic2(void)
{

}

#endif

// [Nugget] --------------------------/
Expand Down Expand Up @@ -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] ---------------------------------------------------------------/
Expand Down
61 changes: 61 additions & 0 deletions src/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ();
}
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit 5c0a57f

Please sign in to comment.