"DARKNESS" mapheader option for Shrink lighting

This commit is contained in:
AJ Martinez 2023-10-12 21:07:04 -07:00
parent c72a2cf94a
commit 680c063e3a
4 changed files with 6 additions and 1 deletions

View file

@ -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"))

View file

@ -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

View file

@ -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;

View file

@ -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;
}