Allow adjusting map contrast

This commit is contained in:
Sally Coolatta 2022-05-24 23:04:48 -04:00
parent dc890caef3
commit b6ed17d9fc
6 changed files with 40 additions and 2 deletions

View file

@ -1566,6 +1566,23 @@ void readlevelheader(MYFILE *f, INT32 num)
mapheaderinfo[num-1]->mobj_scale = get_number(word2);
else if (fastcmp(word, "DEFAULTWAYPOINTRADIUS"))
mapheaderinfo[num-1]->default_waypoint_radius = get_number(word2);
else if (fastcmp(word, "LIGHTCONTRAST"))
{
mapheaderinfo[num-1]->light_contrast = (UINT8)i;
}
else if (fastcmp(word, "LIGHTANGLE"))
{
if (fastcmp(word2, "EVEN"))
{
mapheaderinfo[num-1]->use_light_angle = false;
mapheaderinfo[num-1]->light_angle = 0;
}
else
{
mapheaderinfo[num-1]->use_light_angle = true;
mapheaderinfo[num-1]->light_angle = FixedAngle(FloatToFixed(atof(word2)));
}
}
// Individual triggers for level flags, for ease of use (and 2.0 compatibility)
else if (fastcmp(word, "SCRIPTISFILE"))
{

View file

@ -386,6 +386,10 @@ typedef struct
fixed_t mobj_scale; ///< Replacement for TOL_ERZ3
fixed_t default_waypoint_radius; ///< 0 is a special value for DEFAULT_WAYPOINT_RADIUS, but scaled with mobjscale
UINT8 light_contrast; ///< Range of wall lighting. 0 is no lighting.
boolean use_light_angle; ///< When false, wall lighting is evenly distributed. When true, wall lighting is directional.
angle_t light_angle; ///< Angle of directional wall lighting.
// Music stuff.
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
char musintername[7]; ///< Intermission screen music.
@ -666,6 +670,13 @@ extern tic_t racecountdown, exitcountdown;
extern fixed_t gravity;
extern fixed_t mapobjectscale;
extern struct maplighting
{
UINT8 contrast;
boolean directional;
angle_t angle;
} maplighting;
//for CTF balancing
extern INT16 autobalance;
extern INT16 teamscramble;

View file

@ -288,6 +288,8 @@ tic_t racecountdown, exitcountdown; // for racing
fixed_t gravity;
fixed_t mapobjectscale;
struct maplighting maplighting;
INT16 autobalance; //for CTF team balance
INT16 teamscramble; //for CTF team scramble
INT16 scrambleplayers[MAXPLAYERS]; //for CTF team scramble

View file

@ -413,6 +413,9 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->menuflags = 0;
mapheaderinfo[num]->mobj_scale = FRACUNIT;
mapheaderinfo[num]->default_waypoint_radius = 0;
mapheaderinfo[num]->light_contrast = 0;
mapheaderinfo[num]->use_light_angle = false;
mapheaderinfo[num]->light_angle = 0;
#if 1 // equivalent to "FlickyList = DEMO"
P_SetDemoFlickies(num);
#else // equivalent to "FlickyList = NONE"
@ -2322,7 +2325,7 @@ static inline float P_SegLengthFloat(seg_t *seg)
*/
void P_UpdateSegLightOffset(seg_t *li)
{
const UINT8 contrast = 16;
const UINT8 contrast = maplighting.contrast;
fixed_t extralight = 0;
extralight = -((fixed_t)contrast*FRACUNIT) +

View file

@ -35,7 +35,7 @@ static void P_SetupAnchoredSlopes (void);
void P_UpdateSlopeLightOffset(pslope_t *slope)
{
const boolean ceiling = (slope->normal.z < 0);
const UINT8 contrast = 16;
const UINT8 contrast = maplighting.contrast;
fixed_t contrastFixed = (contrast * FRACUNIT);
fixed_t zMul = FRACUNIT;

View file

@ -5884,6 +5884,11 @@ void P_InitSpecials(void)
// Set the default gravity. Custom gravity overrides this setting.
gravity = mapheaderinfo[gamemap-1]->gravity;
// Set map lighting settings.
maplighting.contrast = mapheaderinfo[gamemap-1]->light_contrast;
maplighting.directional = mapheaderinfo[gamemap-1]->use_light_angle;
maplighting.angle = mapheaderinfo[gamemap-1]->light_angle;
// Defaults in case levels don't have them set.
sstimer = mapheaderinfo[gamemap-1]->sstimer*TICRATE + 6;
ssspheres = mapheaderinfo[gamemap-1]->ssspheres;