Merge branch 'darken-header' into 'master'

"DARKNESS" mapheader option for Shrink lighting

See merge request KartKrew/Kart!1549
This commit is contained in:
Gunla 2023-10-14 21:34:42 +00:00
commit cbbb820414
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;
}