From 680c063e3ad6e7cb58f777fd120f38b7c04fb32e Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Thu, 12 Oct 2023 21:07:04 -0700 Subject: [PATCH] =?UTF-8?q?"DARKNESS"=20mapheader=20option=C2=A0for=20Shri?= =?UTF-8?q?nk=20lighting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/deh_soc.c | 2 ++ src/doomstat.h | 2 ++ src/p_setup.c | 1 + src/r_debug.cpp | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 76488462e..f91429ab2 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1290,6 +1290,8 @@ void readlevelheader(MYFILE *f, char * name) mapheaderinfo[num]->skybox_scaley = (INT16)i; else if (fastcmp(word, "SKYBOXSCALEZ")) mapheaderinfo[num]->skybox_scalez = (INT16)i; + else if (fastcmp(word, "DARKNESS")) + mapheaderinfo[num]->darkness = FloatToFixed(atof(word2)); else if (fastcmp(word, "LEVELFLAGS")) mapheaderinfo[num]->levelflags = get_number(word2); else if (fastcmp(word, "MENUFLAGS")) diff --git a/src/doomstat.h b/src/doomstat.h index 3dd1eb1a4..ce80df3e4 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -507,6 +507,8 @@ struct mapheader_t INT16 skybox_scaley; ///< Skybox Y axis scale. INT16 skybox_scalez; ///< Skybox Z axis scale. + fixed_t darkness; ///< Pohbee darkness multiplier + // Distance information fixed_t mobj_scale; ///< Defines the size all object calculations are relative to fixed_t default_waypoint_radius; ///< 0 is a special value for DEFAULT_WAYPOINT_RADIUS, but scaled with mobjscale diff --git a/src/p_setup.c b/src/p_setup.c index dbd3060d7..b8eae1c28 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -436,6 +436,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 num) mapheaderinfo[num]->skybox_scalex = 16; mapheaderinfo[num]->skybox_scaley = 16; mapheaderinfo[num]->skybox_scalez = 16; + mapheaderinfo[num]->darkness = FRACUNIT; mapheaderinfo[num]->runsoc[0] = '#'; mapheaderinfo[num]->scriptname[0] = '#'; mapheaderinfo[num]->precutscenenum = 0; diff --git a/src/r_debug.cpp b/src/r_debug.cpp index b4a767944..f4774f9fc 100644 --- a/src/r_debug.cpp +++ b/src/r_debug.cpp @@ -43,7 +43,7 @@ INT32 R_AdjustLightLevel(INT32 light) if (!debugrender_highlight && cv_debugrender_contrast.value == 0) { - const fixed_t darken = FixedMul(darkness, kRange); + const fixed_t darken = FixedMul(FixedMul(darkness, mapheaderinfo[gamemap-1]->darkness), kRange); return std::clamp((light * FRACUNIT) - darken, 0, kRange) / FRACUNIT; }