From d613a9abaa50124b39ef60d3f697c57d58c86086 Mon Sep 17 00:00:00 2001 From: Alaux <73968015+MrAlaux@users.noreply.github.com> Date: Mon, 27 Nov 2023 03:07:46 -0300 Subject: [PATCH] Allow setting vanilla fake contrast --- CHANGELOG.md | 1 + src/m_menu.c | 20 ++++++++++++-------- src/m_misc.c | 4 ++-- src/r_segs.c | 43 ++++++++++++++++++++++++++----------------- 4 files changed, 41 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6802302c9..e409dfcbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - **Support for intermediate resolutions** (e.g. 3X, 5X) **and 9X (1800p)** - **_Background for all menus_** setting +- **_Vanilla Fake Contrast_** setting - **Minimap mode for Automap** - **NUGHUD:** - Ammo and Health icons; diff --git a/src/m_menu.c b/src/m_menu.c index 3b776a2b0..ce28580ec 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4878,6 +4878,10 @@ setup_menu_t gen_settings6[] = { {0,S_SKIP|S_END,m_null} }; +static const char *fake_contrast_styles[] = { + "Off", "Smooth", "Vanilla", NULL +}; + static const char *s_clipping_dists[] = { "1200", "2400", NULL }; @@ -4890,14 +4894,14 @@ setup_menu_t gen_settings7[] = { {"Nugget - Display", S_SKIP|S_TITLE, m_null, M_X, M_Y + gen7_title1 * M_SPC}, - {"Background For All Menus", S_YESNO, m_null, M_X, M_Y + gen7_menubgall * M_SPC, {"menu_background_all"}}, - {"Disable Palette Tint in Menus", S_YESNO|S_STRICT, m_null, M_X, M_Y + gen7_menutint * M_SPC, {"no_menu_tint"}}, - {"Disable Berserk Tint", S_YESNO|S_STRICT, m_null, M_X, M_Y + gen7_berserktint * M_SPC, {"no_berserk_tint"}}, - {"Disable Radiation Suit Tint", S_YESNO|S_STRICT, m_null, M_X, M_Y + gen7_radsuittint * M_SPC, {"no_radsuit_tint"}}, - {"Damage Tint Cap", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_dmgcountcap * M_SPC, {"damagecount_cap"}}, - {"Bonus Tint Cap", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_boncountcap * M_SPC, {"bonuscount_cap"}}, - {"Fake Contrast", S_YESNO|S_STRICT, m_null, M_X, M_Y + gen7_fakecontrast * M_SPC, {"fake_contrast"}}, - {"Screen Wipe Speed Percentage", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_wipespeed * M_SPC, {"wipe_speed_percentage"}}, + {"Background For All Menus", S_YESNO, m_null, M_X, M_Y + gen7_menubgall * M_SPC, {"menu_background_all"}}, + {"Disable Palette Tint in Menus", S_YESNO |S_STRICT, m_null, M_X, M_Y + gen7_menutint * M_SPC, {"no_menu_tint"}}, + {"Disable Berserk Tint", S_YESNO |S_STRICT, m_null, M_X, M_Y + gen7_berserktint * M_SPC, {"no_berserk_tint"}}, + {"Disable Radiation Suit Tint", S_YESNO |S_STRICT, m_null, M_X, M_Y + gen7_radsuittint * M_SPC, {"no_radsuit_tint"}}, + {"Damage Tint Cap", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_dmgcountcap * M_SPC, {"damagecount_cap"}}, + {"Bonus Tint Cap", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_boncountcap * M_SPC, {"bonuscount_cap"}}, + {"Fake Contrast", S_CHOICE|S_STRICT, m_null, M_X, M_Y + gen7_fakecontrast * M_SPC, {"fake_contrast"}, 0, NULL, fake_contrast_styles}, + {"Screen Wipe Speed Percentage", S_NUM |S_STRICT, m_null, M_X, M_Y + gen7_wipespeed * M_SPC, {"wipe_speed_percentage"}}, {"", S_SKIP, m_null, M_X, M_Y + gen7_stub1 * M_SPC}, {"Nugget - Miscellaneous", S_SKIP|S_TITLE, m_null, M_X, M_Y + gen7_title2 * M_SPC}, diff --git a/src/m_misc.c b/src/m_misc.c index bb3f0895e..2efa3831e 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -866,8 +866,8 @@ default_t defaults[] = { { "fake_contrast", (config_t *) &fake_contrast, NULL, - {1}, {0,1}, number, ss_gen, wad_yes, - "1 to apply fake contrast to walls" + {1}, {0,2}, number, ss_gen, wad_yes, + "Fake contrast for walls (0 = Off, 1 = Smooth, 2 = Vanilla)" }, { diff --git a/src/r_segs.c b/src/r_segs.c index 18836dba7..45ed6dfa9 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -113,15 +113,19 @@ void R_RenderMaskedSegRange(drawseg_t *ds, int x1, int x2) ->lightlevel >> LIGHTSEGSHIFT)+extralight; // [crispy] smoother fake contrast - if (NOTSTRICTMODE(fake_contrast)) // [Nugget] - { lightnum += curline->fakecontrast; } -#if 0 - if (curline->v1->y == curline->v2->y) - lightnum--; - else - if (curline->v1->x == curline->v2->x) - lightnum++; -#endif + if (BETWEEN(strictmode, 2, fake_contrast) == 1) // [Nugget] + { + lightnum += curline->fakecontrast; + } + // [Nugget] Vanilla effect + else if (BETWEEN(strictmode, 2, fake_contrast) == 2) + { + if (curline->v1->y == curline->v2->y) + lightnum--; + else + if (curline->v1->x == curline->v2->x) + lightnum++; + } walllights = lightnum >= LIGHTLEVELS ? scalelight[LIGHTLEVELS-1] : lightnum < 0 ? scalelight[0] : scalelight[lightnum]; @@ -777,14 +781,19 @@ void R_StoreWallRange(const int start, const int stop) int lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT)+extralight; // [crispy] smoother fake contrast - if (NOTSTRICTMODE(fake_contrast)) // [Nugget] - { lightnum += curline->fakecontrast; } -#if 0 - if (curline->v1->y == curline->v2->y) - lightnum--; - else if (curline->v1->x == curline->v2->x) - lightnum++; -#endif + if (BETWEEN(strictmode, 2, fake_contrast) == 1) // [Nugget] + { + lightnum += curline->fakecontrast; + } + // [Nugget] Vanilla effect + else if (BETWEEN(strictmode, 2, fake_contrast) == 2) + { + if (curline->v1->y == curline->v2->y) + lightnum--; + else if (curline->v1->x == curline->v2->x) + lightnum++; + } + if (lightnum < 0) walllights = scalelight[0]; else if (lightnum >= LIGHTLEVELS)