- roughly 50 more, mostly search and replace.

This commit is contained in:
Christoph Oelckers 2019-01-27 19:16:14 +01:00
commit b4a95ccaa9
12 changed files with 74 additions and 65 deletions

View file

@ -47,7 +47,7 @@ void DLightningThinker::Construct()
LightningFlashCount = 0;
NextLightningFlash = ((pr_lightning()&15)+5)*35; // don't flash at level start
LightningLightLevels.Resize(level.sectors.Size());
LightningLightLevels.Resize(Level->sectors.Size());
fillshort(&LightningLightLevels[0], LightningLightLevels.Size(), SHRT_MAX);
}
@ -88,8 +88,8 @@ void DLightningThinker::LightningFlash ()
LightningFlashCount--;
if (LightningFlashCount)
{ // reduce the brightness of the flash
tempSec = &level.sectors[0];
for (i = level.sectors.Size(), j = 0; i > 0; ++j, --i, ++tempSec)
tempSec = &Level->sectors[0];
for (i = Level->sectors.Size(), j = 0; i > 0; ++j, --i, ++tempSec)
{
// [RH] Checking this sector's applicability to lightning now
// is not enough to know if we should lower its light level,
@ -104,24 +104,24 @@ void DLightningThinker::LightningFlash ()
}
else
{ // remove the alternate lightning flash special
tempSec = &level.sectors[0];
for (i = level.sectors.Size(), j = 0; i > 0; ++j, --i, ++tempSec)
tempSec = &Level->sectors[0];
for (i = Level->sectors.Size(), j = 0; i > 0; ++j, --i, ++tempSec)
{
if (LightningLightLevels[j] != SHRT_MAX)
{
tempSec->SetLightLevel(LightningLightLevels[j]);
}
}
fillshort(&LightningLightLevels[0], level.sectors.Size(), SHRT_MAX);
level.flags &= ~LEVEL_SWAPSKIES;
fillshort(&LightningLightLevels[0], Level->sectors.Size(), SHRT_MAX);
Level->flags &= ~LEVEL_SWAPSKIES;
}
return;
}
LightningFlashCount = (pr_lightning()&7)+8;
flashLight = 200+(pr_lightning()&31);
tempSec = &level.sectors[0];
for (i = level.sectors.Size(), j = 0; i > 0; ++j, --i, ++tempSec)
tempSec = &Level->sectors[0];
for (i = Level->sectors.Size(), j = 0; i > 0; ++j, --i, ++tempSec)
{
// allow combination of the lightning sector specials with bit masks
int special = tempSec->special;
@ -151,12 +151,12 @@ void DLightningThinker::LightningFlash ()
}
}
level.flags |= LEVEL_SWAPSKIES; // set alternate sky
Level->flags |= LEVEL_SWAPSKIES; // set alternate sky
S_Sound (CHAN_AUTO, "world/thunder", 1.0, ATTN_NONE);
// [ZZ] just in case
E_WorldLightning();
// start LIGHTNING scripts
level.Behaviors.StartTypedScripts (SCRIPT_Lightning, NULL, false); // [RH] Run lightning scripts
Level->Behaviors.StartTypedScripts (SCRIPT_Lightning, NULL, false); // [RH] Run lightning scripts
// Calculate the next lighting flash
if (!NextLightningFlash)
@ -167,7 +167,7 @@ void DLightningThinker::LightningFlash ()
}
else
{
if (pr_lightning() < 128 && !(level.time&32))
if (pr_lightning() < 128 && !(Level->time&32))
{
NextLightningFlash = ((pr_lightning()&7)+2)*35;
}
@ -202,16 +202,16 @@ static DLightningThinker *LocateLightning ()
return iterator.Next ();
}
void P_StartLightning ()
void FLevelLocals::StartLightning ()
{
const bool isOriginalHexen = (gameinfo.gametype == GAME_Hexen)
&& (level.flags2 & LEVEL2_HEXENHACK);
&& (flags2 & LEVEL2_HEXENHACK);
if (isOriginalHexen)
{
bool hasLightning = false;
for (const sector_t &sector : level.sectors)
for (const sector_t &sector : sectors)
{
hasLightning = sector.GetTexture(sector_t::ceiling) == skyflatnum
|| sector.special == Light_IndoorLightning1
@ -225,7 +225,7 @@ void P_StartLightning ()
if (!hasLightning)
{
level.flags &= ~LEVEL_STARTLIGHTNING;
flags &= ~LEVEL_STARTLIGHTNING;
return;
}
}
@ -233,16 +233,16 @@ void P_StartLightning ()
DLightningThinker *lightning = LocateLightning ();
if (lightning == nullptr)
{
level.CreateThinker<DLightningThinker>();
CreateThinker<DLightningThinker>();
}
}
void P_ForceLightning (int mode)
void FLevelLocals::ForceLightning (int mode)
{
DLightningThinker *lightning = LocateLightning ();
if (lightning == nullptr)
{
lightning = level.CreateThinker<DLightningThinker>();
lightning = CreateThinker<DLightningThinker>();
}
if (lightning != nullptr)
{