change how randomized light works
so it doesent kill actual soc set randomlight if you toggle it
This commit is contained in:
1 parent
f8d1bf0811
commit
e5e7205c95
6 files changed
+37
-41
No files matched your search
+4
-4
@@ -183,13 +183,13 @@ static void D_GamePadMenuScrollTicker(void)
|
||||
int key = 0; // butt-on output
|
||||
|
||||
// wish i had a switch ono
|
||||
if (DPADUPSCROLL)
|
||||
if (DPADUPSCROLL)
|
||||
key = KEY_UPARROW;
|
||||
else if (DPADDOWNSCROLL)
|
||||
else if (DPADDOWNSCROLL)
|
||||
key = KEY_DOWNARROW;
|
||||
else if (DPADLEFTSCROLL)
|
||||
else if (DPADLEFTSCROLL)
|
||||
key = KEY_LEFTARROW;
|
||||
else if (DPADRIGHTSCROLL)
|
||||
else if (DPADRIGHTSCROLL)
|
||||
key = KEY_RIGHTARROW;
|
||||
|
||||
if (key)
|
||||
|
||||
@@ -986,10 +986,12 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
else if (fastcmp(word, "LIGHTCONTRAST"))
|
||||
{
|
||||
mapheaderinfo[num-1]->light_contrast = (UINT8)i;
|
||||
mapheaderinfo[num-1]->use_custom_light = true;
|
||||
}
|
||||
else if (fastcmp(word, "SPRITEBACKLIGHT"))
|
||||
{
|
||||
mapheaderinfo[num-1]->sprite_backlight = (SINT8)i;
|
||||
mapheaderinfo[num-1]->use_custom_light = true;
|
||||
}
|
||||
else if (fastcmp(word, "LIGHTANGLE"))
|
||||
{
|
||||
@@ -1003,6 +1005,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
mapheaderinfo[num-1]->use_light_angle = true;
|
||||
mapheaderinfo[num-1]->light_angle = FixedAngle(FloatToFixed(atof(word2)));
|
||||
}
|
||||
mapheaderinfo[num-1]->use_custom_light = true;
|
||||
}
|
||||
|
||||
// Individual triggers for level flags, for ease of use (and 2.0 compatibility)
|
||||
|
||||
@@ -259,6 +259,7 @@ typedef struct
|
||||
//boolean automap; ///< Displays a level's white map outline in modified games
|
||||
fixed_t mobj_scale; ///< Replacement for TOL_ERZ3
|
||||
|
||||
boolean use_custom_light;
|
||||
UINT8 light_contrast; ///< Range of wall lighting. 0 is no lighting.
|
||||
SINT8 sprite_backlight; ///< Subtract from wall lighting for sprites only.
|
||||
boolean use_light_angle; ///< When false, wall lighting is evenly distributed. When true, wall lighting is directional.
|
||||
|
||||
+5
-10
@@ -324,17 +324,13 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||
// SRB2Kart
|
||||
//mapheaderinfo[num]->automap = false;
|
||||
mapheaderinfo[num]->mobj_scale = FRACUNIT;
|
||||
// an even further impossibility, delfile custom opts support
|
||||
|
||||
mapheaderinfo[num]->customopts = NULL;
|
||||
mapheaderinfo[num]->numCustomOptions = 0;
|
||||
}
|
||||
|
||||
void P_ClearDirectionalLightMapHeaderInfo(INT16 i) // lol dont always reset this on every map load
|
||||
{
|
||||
mapheaderinfo[i]->light_contrast = cv_randomdirlight.value ? M_RandomRange(0, 58) : 8;
|
||||
mapheaderinfo[i]->sprite_backlight = 0;
|
||||
mapheaderinfo[i]->use_light_angle = cv_randomdirlight.value ? true : false;
|
||||
mapheaderinfo[i]->light_angle = cv_randomdirlight.value ? M_RandomRange(-382, 382) : 0;
|
||||
mapheaderinfo[num]->light_contrast = 8;
|
||||
mapheaderinfo[num]->sprite_backlight = 0;
|
||||
mapheaderinfo[num]->use_light_angle = false;
|
||||
mapheaderinfo[num]->light_angle = 0;
|
||||
}
|
||||
|
||||
/** Allocates a new map-header structure.
|
||||
@@ -347,7 +343,6 @@ void P_AllocMapHeader(INT16 i)
|
||||
{
|
||||
mapheaderinfo[i] = Z_Malloc(sizeof(mapheader_t), PU_STATIC, NULL);
|
||||
mapheaderinfo[i]->grades = NULL;
|
||||
P_ClearDirectionalLightMapHeaderInfo(i);
|
||||
}
|
||||
P_ClearSingleMapHeaderInfo(i + 1);
|
||||
}
|
||||
|
||||
+23
-4
@@ -5225,6 +5225,28 @@ static void P_RunLevelLoadExecutors(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void P_SetupDirectionalLight(void)
|
||||
{
|
||||
if (cv_randomdirlight.value && mapheaderinfo[gamemap-1]->use_custom_light == false)
|
||||
{
|
||||
static INT16 oldmap = 0; // dont reset stuff when you restart a map
|
||||
if (gamemap != oldmap)
|
||||
{
|
||||
maplighting.contrast = M_RandomRange(0, 58);
|
||||
maplighting.backlight = 0;
|
||||
maplighting.directional = M_RandomRange(0, 1); // either on or off
|
||||
maplighting.angle = M_RandomRange(-382, 382);
|
||||
}
|
||||
oldmap = gamemap;
|
||||
return;
|
||||
}
|
||||
|
||||
maplighting.contrast = mapheaderinfo[gamemap-1]->light_contrast;
|
||||
maplighting.backlight = mapheaderinfo[gamemap-1]->sprite_backlight;
|
||||
maplighting.directional = mapheaderinfo[gamemap-1]->use_light_angle;
|
||||
maplighting.angle = mapheaderinfo[gamemap-1]->light_angle;
|
||||
}
|
||||
|
||||
/** After the map has loaded, scans for specials that spawn 3Dfloors and
|
||||
* thinkers.
|
||||
*
|
||||
@@ -5251,10 +5273,7 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
||||
gravity = (FRACUNIT*8)/10;
|
||||
|
||||
// Set map lighting settings.
|
||||
maplighting.contrast = mapheaderinfo[gamemap-1]->light_contrast;
|
||||
maplighting.backlight = mapheaderinfo[gamemap-1]->sprite_backlight;
|
||||
maplighting.directional = mapheaderinfo[gamemap-1]->use_light_angle;
|
||||
maplighting.angle = mapheaderinfo[gamemap-1]->light_angle;
|
||||
P_SetupDirectionalLight();
|
||||
|
||||
// Defaults in case levels don't have them set.
|
||||
sstimer = 90*TICRATE + 6;
|
||||
|
||||
+1
-23
@@ -159,8 +159,6 @@ void SendWeaponPref2(void);
|
||||
void SendWeaponPref3(void);
|
||||
void SendWeaponPref4(void);
|
||||
|
||||
static void DirLight_OnChange(void);
|
||||
|
||||
static void Precipstuff_OnChange(void);
|
||||
|
||||
consvar_t cv_tailspickup = {"tailspickup", "On", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -209,27 +207,7 @@ consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL
|
||||
consvar_t cv_maxportals = {"maxportals", "2", CV_SAVE, maxportals_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// randomized directional lightning
|
||||
consvar_t cv_randomdirlight = {"randomdirectionallight", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, DirLight_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void DirLight_OnChange(void)
|
||||
{
|
||||
for (int i = 0; i < NUMMAPS; i++)
|
||||
{
|
||||
if (!mapheaderinfo[i])
|
||||
continue;
|
||||
|
||||
P_ClearDirectionalLightMapHeaderInfo(i);
|
||||
}
|
||||
|
||||
//current map
|
||||
if (mapheaderinfo[gamemap-1])
|
||||
{
|
||||
maplighting.contrast = mapheaderinfo[gamemap-1]->light_contrast;
|
||||
maplighting.backlight = mapheaderinfo[gamemap-1]->sprite_backlight;
|
||||
maplighting.directional = mapheaderinfo[gamemap-1]->use_light_angle;
|
||||
maplighting.angle = mapheaderinfo[gamemap-1]->light_angle;
|
||||
}
|
||||
}
|
||||
consvar_t cv_randomdirlight = {"randomdirectionallight", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void SplitScreen_OnChange(void)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user