Skip to content

Commit

Permalink
Allow setting vanilla fake contrast
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed Nov 27, 2023
1 parent 1e16a58 commit d613a9a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 12 additions & 8 deletions src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand All @@ -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},
Expand Down
4 changes: 2 additions & 2 deletions src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
},

{
Expand Down
43 changes: 26 additions & 17 deletions src/r_segs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d613a9a

Please sign in to comment.