use FSoundID for script provided sounds instead of FString.

This commit is contained in:
Christoph Oelckers 2024-01-05 17:41:58 +01:00
parent ce2a0c9295
commit e3d13af33b
4 changed files with 12 additions and 11 deletions

View file

@ -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, const FString& tempSound = "");
void ForceLightning(int mode, FSoundID tempSound = NO_SOUND);
void ClearDynamic3DFloorData();
void WorldDone(void);
void AirControlChanged();

View file

@ -48,7 +48,7 @@ IMPLEMENT_CLASS(DLightningThinker, false, false)
//
//----------------------------------------------------------------------------
void DLightningThinker::Construct(const FString& tempSound)
void DLightningThinker::Construct(FSoundID tempSound)
{
Stopped = false;
LightningFlashCount = 0;
@ -179,14 +179,14 @@ void DLightningThinker::LightningFlash ()
}
Level->flags |= LEVEL_SWAPSKIES; // set alternate sky
if (TempLightningSound.IsEmpty())
if (TempLightningSound == NO_SOUND)
{
S_Sound(CHAN_AUTO, 0, Level->LightningSound, 1.0, ATTN_NONE);
}
else
{
S_Sound(CHAN_AUTO, 0, TempLightningSound, 1.0, ATTN_NONE);
TempLightningSound = "";
TempLightningSound = NO_SOUND;
}
// [ZZ] just in case
Level->localEventManager->WorldLightning();
@ -220,7 +220,7 @@ void DLightningThinker::LightningFlash ()
//
//----------------------------------------------------------------------------
void DLightningThinker::ForceLightning (int mode, const FString& tempSound)
void DLightningThinker::ForceLightning (int mode, FSoundID tempSound)
{
switch (mode)
{
@ -298,7 +298,7 @@ void FLevelLocals::StartLightning ()
//
//----------------------------------------------------------------------------
void FLevelLocals::ForceLightning (int mode, const FString& tempSound)
void FLevelLocals::ForceLightning (int mode, FSoundID tempSound)
{
DLightningThinker *lightning = LocateLightning (this);
if (lightning == nullptr)
@ -315,7 +315,7 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, ForceLightning)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_INT(mode);
PARAM_STRING(tempSound);
PARAM_SOUND(tempSound);
self->ForceLightning(mode,tempSound);
return 0;
}

View file

@ -6,17 +6,18 @@
#endif
#include "dthinker.h"
#include "s_soundinternal.h"
class DLightningThinker : public DThinker
{
DECLARE_CLASS (DLightningThinker, DThinker);
public:
static const int DEFAULT_STAT = STAT_LIGHTNING;
void Construct(const FString& tempSound = "");
void Construct(FSoundID tempSound = NO_SOUND);
~DLightningThinker ();
void Serialize(FSerializer &arc);
void Tick ();
void ForceLightning (int mode, const FString& tempSound = "");
void ForceLightning (int mode, FSoundID tempSound = NO_SOUND);
void TerminateLightning();
protected:
@ -25,7 +26,7 @@ protected:
int NextLightningFlash;
int LightningFlashCount;
bool Stopped;
FString TempLightningSound;
FSoundID TempLightningSound;
TArray<short> LightningLightLevels;
};

View file

@ -526,7 +526,7 @@ struct LevelLocals native
native String GetChecksum() const;
native void ChangeSky(TextureID sky1, TextureID sky2 );
native void ForceLightning(int mode = 0, string tempSound = "");
native void ForceLightning(int mode = 0, sound tempSound = "");
native SectorTagIterator CreateSectorTagIterator(int tag, line defline = null);
native LineIdIterator CreateLineIdIterator(int tag);