- refactored the global sectors array into a more VM friendly type and moved it into FLevelLocals.

This commit is contained in:
Christoph Oelckers 2017-01-07 19:32:24 +01:00
commit c02281a439
57 changed files with 438 additions and 456 deletions

View file

@ -22,8 +22,8 @@ DLightningThinker::DLightningThinker ()
LightningFlashCount = 0;
NextLightningFlash = ((pr_lightning()&15)+5)*35; // don't flash at level start
LightningLightLevels.Resize(numsectors);
fillshort(&LightningLightLevels[0], numsectors, SHRT_MAX);
LightningLightLevels.Resize(level.sectors.Size());
fillshort(&LightningLightLevels[0], LightningLightLevels.Size(), SHRT_MAX);
}
DLightningThinker::~DLightningThinker ()
@ -63,8 +63,8 @@ void DLightningThinker::LightningFlash ()
LightningFlashCount--;
if (LightningFlashCount)
{ // reduce the brightness of the flash
tempSec = sectors;
for (i = numsectors, 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,
@ -79,15 +79,15 @@ void DLightningThinker::LightningFlash ()
}
else
{ // remove the alternate lightning flash special
tempSec = sectors;
for (i = numsectors, 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], numsectors, SHRT_MAX);
fillshort(&LightningLightLevels[0], level.sectors.Size(), SHRT_MAX);
level.flags &= ~LEVEL_SWAPSKIES;
}
return;
@ -95,8 +95,8 @@ void DLightningThinker::LightningFlash ()
LightningFlashCount = (pr_lightning()&7)+8;
flashLight = 200+(pr_lightning()&31);
tempSec = sectors;
for (i = numsectors, j = 0; i > 0; --i, ++j, ++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;