mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 17:21:10 +00:00
Added LightningSound MAPINFO property.
Also added a tempSound parameter to ForceLightning(). Allowing for changing the specific sound that particular thunderbolt makes when it hits.
This commit is contained in:
parent
ecdf6f7cb2
commit
ce2a0c9295
8 changed files with 41 additions and 12 deletions
|
@ -1854,6 +1854,7 @@ void FLevelLocals::Init()
|
|||
flags2 |= info->flags2;
|
||||
flags3 |= info->flags3;
|
||||
levelnum = info->levelnum;
|
||||
LightningSound = info->LightningSound;
|
||||
Music = info->Music;
|
||||
musicorder = info->musicorder;
|
||||
MusicVolume = 1.f;
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
AActor *SpawnMapThing(int index, FMapThing *mt, int position);
|
||||
AActor *SpawnPlayer(FPlayerStart *mthing, int playernum, int flags = 0);
|
||||
void StartLightning();
|
||||
void ForceLightning(int mode);
|
||||
void ForceLightning(int mode, const FString& tempSound = "");
|
||||
void ClearDynamic3DFloorData();
|
||||
void WorldDone(void);
|
||||
void AirControlChanged();
|
||||
|
@ -631,6 +631,7 @@ public:
|
|||
uint32_t hazardcolor; // what color strife hazard blends the screen color as
|
||||
uint32_t hazardflash; // what color strife hazard flashes the screen color as
|
||||
|
||||
FString LightningSound = "world/thunder";
|
||||
FString Music;
|
||||
int musicorder;
|
||||
int cdtrack;
|
||||
|
|
|
@ -250,6 +250,7 @@ void level_info_t::Reset()
|
|||
else
|
||||
flags2 = LEVEL2_LAXMONSTERACTIVATION;
|
||||
flags3 = 0;
|
||||
LightningSound = "world/thunder";
|
||||
Music = "";
|
||||
LevelName = "";
|
||||
AuthorName = "";
|
||||
|
@ -997,6 +998,13 @@ DEFINE_MAP_OPTION(next, true)
|
|||
parse.ParseNextMap(info->NextMap);
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(lightningsound, true)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetString();
|
||||
info->LightningSound = parse.sc.String;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(author, true)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
|
|
|
@ -344,6 +344,7 @@ struct level_info_t
|
|||
uint32_t flags2;
|
||||
uint32_t flags3;
|
||||
|
||||
FString LightningSound = "world/thunder";
|
||||
FString Music;
|
||||
FString LevelName;
|
||||
FString AuthorName;
|
||||
|
|
|
@ -48,11 +48,12 @@ IMPLEMENT_CLASS(DLightningThinker, false, false)
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void DLightningThinker::Construct()
|
||||
void DLightningThinker::Construct(const FString& tempSound)
|
||||
{
|
||||
Stopped = false;
|
||||
LightningFlashCount = 0;
|
||||
NextLightningFlash = ((pr_lightning()&15)+5)*TICRATE; // don't flash at level start
|
||||
TempLightningSound = tempSound;
|
||||
|
||||
LightningLightLevels.Resize(Level->sectors.Size());
|
||||
fillshort(&LightningLightLevels[0], LightningLightLevels.Size(), SHRT_MAX);
|
||||
|
@ -74,7 +75,8 @@ void DLightningThinker::Serialize(FSerializer &arc)
|
|||
arc("stopped", Stopped)
|
||||
("next", NextLightningFlash)
|
||||
("count", LightningFlashCount)
|
||||
("levels", LightningLightLevels);
|
||||
("levels", LightningLightLevels)
|
||||
("tempsound", TempLightningSound);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -177,7 +179,15 @@ void DLightningThinker::LightningFlash ()
|
|||
}
|
||||
|
||||
Level->flags |= LEVEL_SWAPSKIES; // set alternate sky
|
||||
S_Sound (CHAN_AUTO, 0, "world/thunder", 1.0, ATTN_NONE);
|
||||
if (TempLightningSound.IsEmpty())
|
||||
{
|
||||
S_Sound(CHAN_AUTO, 0, Level->LightningSound, 1.0, ATTN_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_Sound(CHAN_AUTO, 0, TempLightningSound, 1.0, ATTN_NONE);
|
||||
TempLightningSound = "";
|
||||
}
|
||||
// [ZZ] just in case
|
||||
Level->localEventManager->WorldLightning();
|
||||
// start LIGHTNING scripts
|
||||
|
@ -210,16 +220,18 @@ void DLightningThinker::LightningFlash ()
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void DLightningThinker::ForceLightning (int mode)
|
||||
void DLightningThinker::ForceLightning (int mode, const FString& tempSound)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
NextLightningFlash = 0;
|
||||
TempLightningSound = tempSound;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
NextLightningFlash = 0;
|
||||
TempLightningSound = tempSound;
|
||||
// Fall through
|
||||
case 2:
|
||||
Stopped = true;
|
||||
|
@ -286,16 +298,16 @@ void FLevelLocals::StartLightning ()
|
|||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void FLevelLocals::ForceLightning (int mode)
|
||||
void FLevelLocals::ForceLightning (int mode, const FString& tempSound)
|
||||
{
|
||||
DLightningThinker *lightning = LocateLightning (this);
|
||||
if (lightning == nullptr)
|
||||
{
|
||||
lightning = CreateThinker<DLightningThinker>();
|
||||
lightning = CreateThinker<DLightningThinker>(tempSound);
|
||||
}
|
||||
if (lightning != nullptr)
|
||||
{
|
||||
lightning->ForceLightning (mode);
|
||||
lightning->ForceLightning (mode, tempSound);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,6 +315,7 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, ForceLightning)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
PARAM_INT(mode);
|
||||
self->ForceLightning(mode);
|
||||
PARAM_STRING(tempSound);
|
||||
self->ForceLightning(mode,tempSound);
|
||||
return 0;
|
||||
}
|
|
@ -12,11 +12,11 @@ class DLightningThinker : public DThinker
|
|||
DECLARE_CLASS (DLightningThinker, DThinker);
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_LIGHTNING;
|
||||
void Construct();
|
||||
void Construct(const FString& tempSound = "");
|
||||
~DLightningThinker ();
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
void ForceLightning (int mode);
|
||||
void ForceLightning (int mode, const FString& tempSound = "");
|
||||
void TerminateLightning();
|
||||
|
||||
protected:
|
||||
|
@ -25,6 +25,7 @@ protected:
|
|||
int NextLightningFlash;
|
||||
int LightningFlashCount;
|
||||
bool Stopped;
|
||||
FString TempLightningSound;
|
||||
TArray<short> LightningLightLevels;
|
||||
};
|
||||
|
||||
|
|
|
@ -2764,6 +2764,7 @@ DEFINE_FIELD_X(LevelInfo, level_info_t, flags)
|
|||
DEFINE_FIELD_X(LevelInfo, level_info_t, flags2)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, flags3)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, Music)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, LightningSound)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, LevelName)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, AuthorName)
|
||||
DEFINE_FIELD_X(LevelInfo, level_info_t, musicorder)
|
||||
|
@ -2807,6 +2808,7 @@ DEFINE_FIELD(FLevelLocals, NextSecretMap)
|
|||
DEFINE_FIELD(FLevelLocals, F1Pic)
|
||||
DEFINE_FIELD(FLevelLocals, AuthorName)
|
||||
DEFINE_FIELD(FLevelLocals, maptype)
|
||||
DEFINE_FIELD(FLevelLocals, LightningSound)
|
||||
DEFINE_FIELD(FLevelLocals, Music)
|
||||
DEFINE_FIELD(FLevelLocals, musicorder)
|
||||
DEFINE_FIELD(FLevelLocals, skytexture1)
|
||||
|
|
|
@ -337,6 +337,7 @@ struct LevelInfo native
|
|||
native readonly int flags;
|
||||
native readonly int flags2;
|
||||
native readonly int flags3;
|
||||
native readonly String LightningSound;
|
||||
native readonly String Music;
|
||||
native readonly String LevelName;
|
||||
native readonly String AuthorName;
|
||||
|
@ -428,6 +429,7 @@ struct LevelLocals native
|
|||
native readonly String F1Pic;
|
||||
native readonly int maptype;
|
||||
native readonly String AuthorName;
|
||||
native String LightningSound;
|
||||
native readonly String Music;
|
||||
native readonly int musicorder;
|
||||
native readonly TextureID skytexture1;
|
||||
|
@ -524,7 +526,7 @@ struct LevelLocals native
|
|||
native String GetChecksum() const;
|
||||
|
||||
native void ChangeSky(TextureID sky1, TextureID sky2 );
|
||||
native void ForceLightning(int mode = 0);
|
||||
native void ForceLightning(int mode = 0, string tempSound = "");
|
||||
|
||||
native SectorTagIterator CreateSectorTagIterator(int tag, line defline = null);
|
||||
native LineIdIterator CreateLineIdIterator(int tag);
|
||||
|
|
Loading…
Reference in a new issue