reinit random maplight on mapchange when toggled

the condition may otherwise not change the light if you restart the same map
This commit is contained in:
Alug committed 2025-01-11 08:52:49 +01:00
1 parent 96b7a4efe6
commit a07c2f4c32
3 files changed
+15 -2

No files matched your search

+1
View File
@@ -93,6 +93,7 @@ void P_WriteThings(lumpnum_t lump);
fixed_t P_SegLength(seg_t *seg);
#endif
extern boolean reinitmaplight;
void P_UpdateSegLightOffset(seg_t *li);
boolean P_ApplyLightOffset(UINT8 baselightnum, const sector_t *sector);
boolean P_ApplyLightOffsetFine(UINT8 baselightlevel, const sector_t *sector);
+5 -1
View File
@@ -5225,6 +5225,8 @@ static void P_RunLevelLoadExecutors(void)
}
}
// dumb thing to reset maplight on next map change when its toggled
boolean reinitmaplight = false;
static void P_SetupDirectionalLight(void)
{
mapheader_lighting_t *lighting = &mapheaderinfo[gamemap-1]->lighting;
@@ -5239,12 +5241,14 @@ static void P_SetupDirectionalLight(void)
static INT16 oldmap = 0; // dont reset stuff when you restart a map
static boolean oldencore = false;
if (gamemap != oldmap || encoremode != oldencore)
if (gamemap != oldmap || encoremode != oldencore || reinitmaplight)
{
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);
reinitmaplight = false;
}
oldmap = gamemap;
+9 -1
View File
@@ -159,6 +159,8 @@ 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};
@@ -207,7 +209,13 @@ 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_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_randomdirlight = {"randomdirectionallight", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, DirLight_OnChange, 0, NULL, NULL, 0, 0, NULL};
// tells to reset the maplight at next map change
static void DirLight_OnChange(void)
{
reinitmaplight = true;
}
void SplitScreen_OnChange(void)
{