From a10b52132c751b5ee8a555341693762af25f4289 Mon Sep 17 00:00:00 2001 From: Noseey Date: Wed, 18 Dec 2024 12:34:00 +0100 Subject: [PATCH] Doom: Reconstruct maxlight if no a11y_sector_lighting when unarchiving thinker. --- src/doom/p_extsaveg.c | 39 ++++----------------------------------- src/doom/p_saveg.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/doom/p_extsaveg.c b/src/doom/p_extsaveg.c index 9564170356..8ec9da9963 100644 --- a/src/doom/p_extsaveg.c +++ b/src/doom/p_extsaveg.c @@ -32,6 +32,7 @@ #include "s_sound.h" #include "s_musinfo.h" #include "z_zone.h" +#include "a11y.h"" #define MAX_LINE_LEN 260 #define MAX_STRING_LEN 80 @@ -164,6 +165,9 @@ static void P_ReadFireFlicker (const char *key) flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker; + if (!a11y_sector_lighting) + flick->sector->rlightlevel = flick->maxlight; + P_AddThinker(&flick->thinker); } } @@ -236,40 +240,6 @@ static void P_ReadOldSpecial (const char *key) } } -// sector->rlightlevel - -static void P_WriteRLightlevel (const char *key) -{ - int i; - sector_t *sector; - - for (i = 0, sector = sectors; i < numsectors; i++, sector++) - { - if (sector->rlightlevel != sector->lightlevel) - { - M_snprintf(line, MAX_LINE_LEN, "%s %d %d\n", - key, - i, - (int)sector->rlightlevel); - fputs(line, save_stream); - } - } -} - -static void P_ReadRLightlevel (const char *key) -{ - int sector, rlightlevel; - - if (sscanf(line, "%s %d %d\n", - string, - §or, - &rlightlevel) == 3 && - !strncmp(string, key, MAX_STRING_LEN)) - { - sectors[sector].rlightlevel = (short)rlightlevel; - } -} - // buttonlist[] extern void P_StartButton (line_t *line, bwhere_e w, int texture, int time); @@ -484,7 +454,6 @@ static const extsavegdata_t extsavegdata[] = {"fireflicker", P_WriteFireFlicker, P_ReadFireFlicker, 1}, {"soundtarget", P_WriteSoundTarget, P_ReadSoundTarget, 1}, {"oldspecial", P_WriteOldSpecial, P_ReadOldSpecial, 1}, - {"rlightlevel", P_WriteRLightlevel, P_ReadRLightlevel, 1}, {"button", P_WriteButton, P_ReadButton, 1}, {"braintarget", P_WriteBrainTarget, P_ReadBrainTarget, 1}, {"markpoints", P_WriteMarkPoints, P_ReadMarkPoints, 1}, diff --git a/src/doom/p_saveg.c b/src/doom/p_saveg.c index ed9fbac8e3..d6813bde3d 100644 --- a/src/doom/p_saveg.c +++ b/src/doom/p_saveg.c @@ -26,6 +26,7 @@ #include "z_zone.h" #include "p_local.h" #include "p_saveg.h" +#include "a11y.h" // State. #include "doomstat.h" @@ -1283,6 +1284,9 @@ static void saveg_read_lightflash_t(lightflash_t *str) // int mintime; str->mintime = saveg_read32(); + + if (!a11y_sector_lighting) + str->sector->rlightlevel = str->maxlight; } static void saveg_write_lightflash_t(lightflash_t *str) @@ -1338,6 +1342,9 @@ static void saveg_read_strobe_t(strobe_t *str) // int brighttime; str->brighttime = saveg_read32(); + + if (!a11y_sector_lighting) + str->sector->rlightlevel = str->maxlight; } static void saveg_write_strobe_t(strobe_t *str) @@ -1387,6 +1394,9 @@ static void saveg_read_glow_t(glow_t *str) // int direction; str->direction = saveg_read32(); + + if (!a11y_sector_lighting) + str->sector->rlightlevel = str->maxlight; } static void saveg_write_glow_t(glow_t *str)