clear maplight on toggling

so you only have to wait until nextmap for effect to do smth instead of game restart
This commit is contained in:
Alug committed 2024-12-08 04:07:03 +01:00
1 parent bc29d77aff
commit d84f887be8
3 files changed
+28 -2

No files matched your search

+1 -1
View File
@@ -327,7 +327,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->numCustomOptions = 0;
}
static void P_ClearDirectionalLightMapHeaderInfo(INT16 i) // lol dont always reset this on every map load
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;
+2
View File
@@ -98,6 +98,8 @@ boolean P_ApplyLightOffset(UINT8 baselightnum, const sector_t *sector);
boolean P_ApplyLightOffsetFine(UINT8 baselightlevel, const sector_t *sector);
boolean P_SectorUsesDirectionalLighting(const sector_t *sector);
size_t P_PrecacheLevelFlats(void);
void P_ClearDirectionalLightMapHeaderInfo(INT16 i);
void P_AllocMapHeader(INT16 i);
#endif
+25 -1
View File
@@ -29,6 +29,7 @@
#include "d_main.h"
#include "v_video.h"
#include "p_spec.h" // skyboxmo
#include "p_setup.h"
#include "z_zone.h"
#include "m_random.h" // quake camera shake
#include "r_portal.h"
@@ -158,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};
@@ -205,7 +208,28 @@ 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};
consvar_t cv_randomdirlight = {"randomdirectionallight", "Off", CV_SAVE, CV_OnOff, 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;
}
}
void SplitScreen_OnChange(void)
{