- Added more options to Light_ForceLightning: Setting the first arg to 0

will behave as before, setting it to 1 will create exactly one lighting
  and setting it to 2 will terminate lightning for the current level
  completely. And it will also work on maps that don't have lightning set
  in MAPINFO now.


SVN r837 (trunk)
This commit is contained in:
Christoph Oelckers 2008-03-22 12:41:36 +00:00
commit eef724b58e
5 changed files with 33 additions and 18 deletions

View file

@ -14,6 +14,7 @@ IMPLEMENT_CLASS (DLightningThinker)
DLightningThinker::DLightningThinker ()
: DThinker (STAT_LIGHTNING)
{
Stopped = false;
LightningLightLevels = NULL;
LightningFlashCount = 0;
NextLightningFlash = ((pr_lightning()&15)+5)*35; // don't flash at level start
@ -37,7 +38,7 @@ void DLightningThinker::Serialize (FArchive &arc)
Super::Serialize (arc);
arc << NextLightningFlash << LightningFlashCount;
arc << Stopped << NextLightningFlash << LightningFlashCount;
if (arc.IsLoading ())
{
@ -63,6 +64,7 @@ void DLightningThinker::Tick ()
else
{
--NextLightningFlash;
if (Stopped) Destroy();
}
}
@ -166,9 +168,21 @@ void DLightningThinker::LightningFlash ()
}
}
void DLightningThinker::ForceLightning ()
void DLightningThinker::ForceLightning (int mode)
{
NextLightningFlash = 0;
switch (mode)
{
default:
NextLightningFlash = 0;
break;
case 1:
NextLightningFlash = 0;
// Fall through
case 2:
Stopped = true;
break;
}
}
static DLightningThinker *LocateLightning ()
@ -186,20 +200,15 @@ void P_StartLightning ()
}
}
void P_StopLightning ()
void P_ForceLightning (int mode)
{
DLightningThinker *lightning = LocateLightning ();
if (lightning == NULL)
{
lightning = new DLightningThinker ();
}
if (lightning != NULL)
{
lightning->Destroy ();
}
}
void P_ForceLightning ()
{
DLightningThinker *lightning = LocateLightning ();
if (lightning != NULL)
{
lightning->ForceLightning ();
lightning->ForceLightning (mode);
}
}

View file

@ -15,18 +15,19 @@ public:
~DLightningThinker ();
void Serialize (FArchive &arc);
void Tick ();
void ForceLightning ();
void ForceLightning (int mode);
void TerminateLightning();
protected:
void LightningFlash ();
int NextLightningFlash;
int LightningFlashCount;
bool Stopped;
BYTE *LightningLightLevels;
};
void P_StartLightning ();
void P_StopLightning ();
void P_ForceLightning ();
void P_ForceLightning (int mode);
#endif //__A_LIGHTNING_H__

View file

@ -1666,9 +1666,9 @@ FUNC(LS_Elevator_LowerToNearest)
}
FUNC(LS_Light_ForceLightning)
// Light_ForceLightning (tag)
// Light_ForceLightning (mode)
{
P_ForceLightning ();
P_ForceLightning (arg0);
return true;
}

View file

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 836
#define MINSAVEVER 837
#if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need