From b6f184491b44117136c2daac0224d4c2fc2febd3 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 4 Apr 2018 16:46:01 +0300 Subject: [PATCH] Restored vanilla behavior of lightning for original Hexen https://forum.zdoom.org/viewtopic.php?t=60103 --- src/g_shared/a_lightning.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index aedcd7e6d..625059993 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -36,6 +36,7 @@ #include "serializer.h" #include "g_levellocals.h" #include "events.h" +#include "gi.h" static FRandom pr_lightning ("Lightning"); @@ -205,6 +206,32 @@ static DLightningThinker *LocateLightning () void P_StartLightning () { + const bool isOriginalHexen = (gameinfo.gametype == GAME_Hexen) + && (level.flags2 & LEVEL2_HEXENHACK); + + if (isOriginalHexen) + { + bool hasLightning = false; + + for (const sector_t §or : level.sectors) + { + hasLightning = sector.GetTexture(sector_t::ceiling) == skyflatnum + || sector.special == Light_IndoorLightning1 + || sector.special == Light_IndoorLightning2; + + if (hasLightning) + { + break; + } + } + + if (!hasLightning) + { + level.flags &= ~LEVEL_STARTLIGHTNING; + return; + } + } + DLightningThinker *lightning = LocateLightning (); if (lightning == NULL) {