mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-21 19:41:11 +00:00
- removed the string constructors from FSoundID.
Due to C++ conversion rules this was a bit too volatile. There's really not enough places where being able to pass a string directly into the sound API was beneficial - the two most frequent functions now got overloaded variants.
This commit is contained in:
parent
b89c4affae
commit
65a26d6779
26 changed files with 66 additions and 70 deletions
|
@ -1463,7 +1463,7 @@ void SoundEngine::Reset()
|
||||||
// Given a logical name, find the sound's index in S_sfx.
|
// Given a logical name, find the sound's index in S_sfx.
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
int SoundEngine::GetSoundIndex(const char* logicalname)
|
FSoundID SoundEngine::FindSound(const char* logicalname)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1474,11 +1474,11 @@ int SoundEngine::GetSoundIndex(const char* logicalname)
|
||||||
while ((i != 0) && stricmp(S_sfx[i].name, logicalname))
|
while ((i != 0) && stricmp(S_sfx[i].name, logicalname))
|
||||||
i = S_sfx[i].next;
|
i = S_sfx[i].next;
|
||||||
|
|
||||||
return i;
|
return FSoundID::fromInt(i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return 0;
|
return NO_SOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,6 @@ public:
|
||||||
{
|
{
|
||||||
return FSoundID(i);
|
return FSoundID(i);
|
||||||
}
|
}
|
||||||
FSoundID(const char *name)
|
|
||||||
{
|
|
||||||
ID = GetSoundIndex(name);
|
|
||||||
}
|
|
||||||
FSoundID(const FString &name)
|
|
||||||
{
|
|
||||||
ID = GetSoundIndex(name.GetChars());
|
|
||||||
}
|
|
||||||
FSoundID(const FSoundID &other) = default;
|
FSoundID(const FSoundID &other) = default;
|
||||||
FSoundID &operator=(const FSoundID &other) = default;
|
FSoundID &operator=(const FSoundID &other) = default;
|
||||||
bool operator !=(FSoundID other) const
|
bool operator !=(FSoundID other) const
|
||||||
|
@ -63,7 +55,6 @@ public:
|
||||||
return ID > 0;
|
return ID > 0;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
static inline int GetSoundIndex(const char* name);
|
|
||||||
|
|
||||||
int ID;
|
int ID;
|
||||||
};
|
};
|
||||||
|
@ -223,8 +214,6 @@ private:
|
||||||
// Checks if a copy of this sound is already playing.
|
// Checks if a copy of this sound is already playing.
|
||||||
bool CheckSingular(FSoundID sound_id);
|
bool CheckSingular(FSoundID sound_id);
|
||||||
virtual TArray<uint8_t> ReadSound(int lumpnum) = 0;
|
virtual TArray<uint8_t> ReadSound(int lumpnum) = 0;
|
||||||
int GetSoundIndex(const char* logicalname); // this is only for setting up FSoundID
|
|
||||||
friend class FSoundID;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool CheckSoundLimit(sfxinfo_t* sfx, const FVector3& pos, int near_limit, float limit_range, int sourcetype, const void* actor, int channel, float attenuation);
|
virtual bool CheckSoundLimit(sfxinfo_t* sfx, const FVector3& pos, int near_limit, float limit_range, int sourcetype, const void* actor, int channel, float attenuation);
|
||||||
|
@ -398,10 +387,7 @@ public:
|
||||||
virtual void SoundDone(FISoundChannel* ichan); // gets called when the sound has been completely taken down.
|
virtual void SoundDone(FISoundChannel* ichan); // gets called when the sound has been completely taken down.
|
||||||
|
|
||||||
// Lookup utilities.
|
// Lookup utilities.
|
||||||
inline FSoundID FindSound(const char* logicalname)
|
FSoundID FindSound(const char* logicalname);
|
||||||
{
|
|
||||||
return FSoundID::fromInt(GetSoundIndex(logicalname));
|
|
||||||
}
|
|
||||||
FSoundID FindSoundByResID(int rid);
|
FSoundID FindSoundByResID(int rid);
|
||||||
FSoundID FindSoundNoHash(const char* logicalname);
|
FSoundID FindSoundNoHash(const char* logicalname);
|
||||||
FSoundID FindSoundByLump(int lump);
|
FSoundID FindSoundByLump(int lump);
|
||||||
|
@ -436,9 +422,4 @@ inline FSoundID S_FindSound(const char* name)
|
||||||
return soundEngine->FindSound(name);
|
return soundEngine->FindSound(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int FSoundID::GetSoundIndex(const char* name)
|
|
||||||
{
|
|
||||||
return soundEngine->GetSoundIndex(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int SoundEnabled();
|
int SoundEnabled();
|
||||||
|
|
|
@ -72,6 +72,12 @@ public:
|
||||||
return Buttons[x].bWentUp;
|
return Buttons[x].bWentUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ButtonSet(int x) const
|
||||||
|
{
|
||||||
|
Buttons[x].bDown = Buttons[x].bWentDown = true;
|
||||||
|
Buttons[x].bWentUp = false;
|
||||||
|
}
|
||||||
|
|
||||||
void ClearButton(int x)
|
void ClearButton(int x)
|
||||||
{
|
{
|
||||||
Buttons[x].Reset();
|
Buttons[x].Reset();
|
||||||
|
|
|
@ -1354,7 +1354,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI
|
||||||
assert(val->IsString() || val->IsNull());
|
assert(val->IsString() || val->IsNull());
|
||||||
if (val->IsString())
|
if (val->IsString())
|
||||||
{
|
{
|
||||||
sid = UnicodeToString(val->GetString());
|
sid = S_FindSound(UnicodeToString(val->GetString()));
|
||||||
}
|
}
|
||||||
else if (val->IsNull())
|
else if (val->IsNull())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1475,7 +1475,7 @@ FxExpression *FxSoundCast::Resolve(FCompileContext &ctx)
|
||||||
if (basex->isConstant())
|
if (basex->isConstant())
|
||||||
{
|
{
|
||||||
ExpVal constval = static_cast<FxConstant *>(basex)->GetValue();
|
ExpVal constval = static_cast<FxConstant *>(basex)->GetValue();
|
||||||
FxExpression *x = new FxConstant(FSoundID(constval.GetString()), ScriptPosition);
|
FxExpression *x = new FxConstant(S_FindSound(constval.GetString()), ScriptPosition);
|
||||||
delete this;
|
delete this;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1351,7 +1351,7 @@ bool PSound::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(FSoundID *)addr = FSoundID(cptr);
|
*(FSoundID *)addr = S_FindSound(cptr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,8 +254,8 @@ static void ParseLock(FScanner &sc, int ¤tnumber)
|
||||||
|
|
||||||
auto lock = keynum == -1? &sink : &Locks.InsertNew(keynum);
|
auto lock = keynum == -1? &sink : &Locks.InsertNew(keynum);
|
||||||
|
|
||||||
lock->locksound.Push("*keytry");
|
lock->locksound.Push(S_FindSound("*keytry"));
|
||||||
lock->locksound.Push("misc/keytry");
|
lock->locksound.Push(S_FindSound("misc/keytry"));
|
||||||
|
|
||||||
while (!sc.CheckString("}"))
|
while (!sc.CheckString("}"))
|
||||||
{
|
{
|
||||||
|
@ -298,7 +298,7 @@ static void ParseLock(FScanner &sc, int ¤tnumber)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
lock->locksound.Push(sc.String);
|
lock->locksound.Push(S_FindSound(sc.String));
|
||||||
if (!sc.GetString())
|
if (!sc.GetString())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
@ -469,7 +469,7 @@ int P_CheckKeys (AActor *owner, int keynum, bool remote, bool quiet)
|
||||||
// Just a safety precaution. The messages should have been initialized upon game start.
|
// Just a safety precaution. The messages should have been initialized upon game start.
|
||||||
if (!keysdone) P_InitKeyMessages();
|
if (!keysdone) P_InitKeyMessages();
|
||||||
|
|
||||||
FSoundID failage[2] = { "*keytry", "misc/keytry" };
|
FSoundID failage[2] = { S_FindSound("*keytry"), S_FindSound("misc/keytry") };
|
||||||
|
|
||||||
auto lock = Locks.CheckKey(keynum);
|
auto lock = Locks.CheckKey(keynum);
|
||||||
if (!lock)
|
if (!lock)
|
||||||
|
|
|
@ -1394,7 +1394,7 @@ static int PatchThing (int thingy)
|
||||||
{ // Sound was not a (valid) number,
|
{ // Sound was not a (valid) number,
|
||||||
// so treat it as an actual sound name.
|
// so treat it as an actual sound name.
|
||||||
stripwhite (Line2);
|
stripwhite (Line2);
|
||||||
snd = Line2;
|
snd = S_FindSound(Line2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1242,7 +1242,7 @@ DEFINE_MAP_OPTION(PrecacheSounds, true)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
parse.sc.MustGetString();
|
parse.sc.MustGetString();
|
||||||
FSoundID snd = parse.sc.String;
|
FSoundID snd = S_FindSound(parse.sc.String);
|
||||||
if (snd == NO_SOUND)
|
if (snd == NO_SOUND)
|
||||||
{
|
{
|
||||||
parse.sc.ScriptMessage("Unknown sound \"%s\"", parse.sc.String);
|
parse.sc.ScriptMessage("Unknown sound \"%s\"", parse.sc.String);
|
||||||
|
|
|
@ -537,7 +537,7 @@ static void GenericParse (FScanner &sc, FGenericParse *parser, const char **keyw
|
||||||
|
|
||||||
case GEN_Sound:
|
case GEN_Sound:
|
||||||
sc.MustGetString ();
|
sc.MustGetString ();
|
||||||
SET_FIELD (FSoundID, FSoundID(sc.String));
|
SET_FIELD (FSoundID, S_FindSound(sc.String));
|
||||||
/* unknown sounds never produce errors anywhere else so they shouldn't here either.
|
/* unknown sounds never produce errors anywhere else so they shouldn't here either.
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -242,7 +242,7 @@ FSwitchDef *FTextureAnimator::ParseSwitchDef (FScanner &sc, bool ignoreBad)
|
||||||
sc.ScriptError ("Switch state already has a sound");
|
sc.ScriptError ("Switch state already has a sound");
|
||||||
}
|
}
|
||||||
sc.MustGetString ();
|
sc.MustGetString ();
|
||||||
sound = sc.String;
|
sound = S_FindSound(sc.String);
|
||||||
}
|
}
|
||||||
else if (sc.Compare ("pic"))
|
else if (sc.Compare ("pic"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -503,7 +503,7 @@ void DIntermissionScreenCast::Init(FIntermissionAction *desc, bool first)
|
||||||
{
|
{
|
||||||
mCastSounds[i].mSequence = static_cast<FIntermissionActionCast*>(desc)->mCastSounds[i].mSequence;
|
mCastSounds[i].mSequence = static_cast<FIntermissionActionCast*>(desc)->mCastSounds[i].mSequence;
|
||||||
mCastSounds[i].mIndex = static_cast<FIntermissionActionCast*>(desc)->mCastSounds[i].mIndex;
|
mCastSounds[i].mIndex = static_cast<FIntermissionActionCast*>(desc)->mCastSounds[i].mIndex;
|
||||||
mCastSounds[i].mSound = static_cast<FIntermissionActionCast*>(desc)->mCastSounds[i].mSound;
|
mCastSounds[i].mSound = S_FindSound(static_cast<FIntermissionActionCast*>(desc)->mCastSounds[i].mSound);
|
||||||
}
|
}
|
||||||
caststate = mDefaults->SeeState;
|
caststate = mDefaults->SeeState;
|
||||||
if (mClass->IsDescendantOf(NAME_PlayerPawn))
|
if (mClass->IsDescendantOf(NAME_PlayerPawn))
|
||||||
|
@ -551,7 +551,7 @@ int DIntermissionScreenCast::Responder (FInputEvent *ev)
|
||||||
|
|
||||||
if (mClass->IsDescendantOf(NAME_PlayerPawn))
|
if (mClass->IsDescendantOf(NAME_PlayerPawn))
|
||||||
{
|
{
|
||||||
auto snd = S_FindSkinnedSound(players[consoleplayer].mo, "*death");
|
auto snd = S_FindSkinnedSound(players[consoleplayer].mo, S_FindSound("*death"));
|
||||||
if (snd != NO_SOUND) S_Sound (CHAN_VOICE, CHANF_UI, snd, 1, ATTN_NONE);
|
if (snd != NO_SOUND) S_Sound (CHAN_VOICE, CHANF_UI, snd, 1, ATTN_NONE);
|
||||||
}
|
}
|
||||||
else if (mDefaults->DeathSound.isvalid())
|
else if (mDefaults->DeathSound.isvalid())
|
||||||
|
|
|
@ -319,7 +319,7 @@ FStrifeDialogueNode *MapLoader::ReadRetailNode (const char *name, FileReader &lu
|
||||||
// The speaker's voice for this node, if any.
|
// The speaker's voice for this node, if any.
|
||||||
speech.Backdrop[0] = 0; //speech.Sound[8] = 0;
|
speech.Backdrop[0] = 0; //speech.Sound[8] = 0;
|
||||||
mysnprintf (fullsound, countof(fullsound), "svox/%s", speech.Sound);
|
mysnprintf (fullsound, countof(fullsound), "svox/%s", speech.Sound);
|
||||||
node->SpeakerVoice = fullsound;
|
node->SpeakerVoice = S_FindSound(fullsound);
|
||||||
|
|
||||||
// The speaker's name, if any.
|
// The speaker's name, if any.
|
||||||
speech.Sound[0] = 0; //speech.Name[16] = 0;
|
speech.Sound[0] = 0; //speech.Name[16] = 0;
|
||||||
|
@ -415,7 +415,7 @@ FStrifeDialogueNode *MapLoader::ReadTeaserNode (const char *name, FileReader &lu
|
||||||
if (speech.VoiceNumber != 0)
|
if (speech.VoiceNumber != 0)
|
||||||
{
|
{
|
||||||
mysnprintf (fullsound, countof(fullsound), "svox/voc%u", speech.VoiceNumber);
|
mysnprintf (fullsound, countof(fullsound), "svox/voc%u", speech.VoiceNumber);
|
||||||
node->SpeakerVoice = fullsound;
|
node->SpeakerVoice = S_FindSound(fullsound);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -4200,23 +4200,23 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APROP_SeeSound:
|
case APROP_SeeSound:
|
||||||
actor->SeeSound = Level->Behaviors.LookupString(value);
|
actor->SeeSound = S_FindSound(Level->Behaviors.LookupString(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APROP_AttackSound:
|
case APROP_AttackSound:
|
||||||
actor->AttackSound = Level->Behaviors.LookupString(value);
|
actor->AttackSound = S_FindSound(Level->Behaviors.LookupString(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APROP_PainSound:
|
case APROP_PainSound:
|
||||||
actor->PainSound = Level->Behaviors.LookupString(value);
|
actor->PainSound = S_FindSound(Level->Behaviors.LookupString(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APROP_DeathSound:
|
case APROP_DeathSound:
|
||||||
actor->DeathSound = Level->Behaviors.LookupString(value);
|
actor->DeathSound = S_FindSound(Level->Behaviors.LookupString(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APROP_ActiveSound:
|
case APROP_ActiveSound:
|
||||||
actor->ActiveSound = Level->Behaviors.LookupString(value);
|
actor->ActiveSound = S_FindSound(Level->Behaviors.LookupString(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case APROP_Species:
|
case APROP_Species:
|
||||||
|
@ -5623,7 +5623,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
case ACSF_Radius_Quake2:
|
case ACSF_Radius_Quake2:
|
||||||
P_StartQuake(Level, activator, args[0], args[1], args[2], args[3], args[4], Level->Behaviors.LookupString(args[5]));
|
P_StartQuake(Level, activator, args[0], args[1], args[2], args[3], args[4], S_FindSound(Level->Behaviors.LookupString(args[5])));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACSF_CheckActorClass:
|
case ACSF_CheckActorClass:
|
||||||
|
@ -5910,7 +5910,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
||||||
const char *lookup = Level->Behaviors.LookupString(args[1]);
|
const char *lookup = Level->Behaviors.LookupString(args[1]);
|
||||||
if (lookup != NULL)
|
if (lookup != NULL)
|
||||||
{
|
{
|
||||||
sid = lookup;
|
sid = S_FindSound(lookup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sid != NO_SOUND || funcIndex == ACSF_PlayActorSound)
|
if (sid != NO_SOUND || funcIndex == ACSF_PlayActorSound)
|
||||||
|
@ -6196,7 +6196,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
||||||
|
|
||||||
case ACSF_QuakeEx:
|
case ACSF_QuakeEx:
|
||||||
{
|
{
|
||||||
return P_StartQuakeXYZ(Level, activator, args[0], args[1], args[2], args[3], args[4], args[5], args[6], Level->Behaviors.LookupString(args[7]),
|
return P_StartQuakeXYZ(Level, activator, args[0], args[1], args[2], args[3], args[4], args[5], args[6], S_FindSound(Level->Behaviors.LookupString(args[7])),
|
||||||
argCount > 8 ? args[8] : 0,
|
argCount > 8 ? args[8] : 0,
|
||||||
argCount > 9 ? ACSToDouble(args[9]) : 1.0,
|
argCount > 9 ? ACSToDouble(args[9]) : 1.0,
|
||||||
argCount > 10 ? ACSToDouble(args[10]) : 1.0,
|
argCount > 10 ? ACSToDouble(args[10]) : 1.0,
|
||||||
|
@ -6737,7 +6737,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
||||||
const char* lookup = Level->Behaviors.LookupString(args[1]);
|
const char* lookup = Level->Behaviors.LookupString(args[1]);
|
||||||
if (lookup != nullptr)
|
if (lookup != nullptr)
|
||||||
{
|
{
|
||||||
sid = lookup;
|
sid = S_FindSound(lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
activator->player->SetSubtitle(logNum, sid);
|
activator->player->SetSubtitle(logNum, sid);
|
||||||
|
@ -8871,7 +8871,7 @@ scriptwait:
|
||||||
S_Sound (
|
S_Sound (
|
||||||
activationline->frontsector,
|
activationline->frontsector,
|
||||||
CHAN_AUTO, 0, // Not CHAN_AREA, because that'd probably break existing scripts.
|
CHAN_AUTO, 0, // Not CHAN_AREA, because that'd probably break existing scripts.
|
||||||
lookup,
|
S_FindSound(lookup),
|
||||||
(float)(STACK(1)) / 127.f,
|
(float)(STACK(1)) / 127.f,
|
||||||
ATTN_NORM);
|
ATTN_NORM);
|
||||||
}
|
}
|
||||||
|
|
|
@ -720,7 +720,7 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
|
||||||
if (!source->player) sound = source->AttackSound;
|
if (!source->player) sound = source->AttackSound;
|
||||||
else if (source->player->ReadyWeapon) sound = source->player->ReadyWeapon->AttackSound;
|
else if (source->player->ReadyWeapon) sound = source->player->ReadyWeapon->AttackSound;
|
||||||
else sound = NO_SOUND;
|
else sound = NO_SOUND;
|
||||||
if (!sound.isvalid()) sound = "weapons/railgf";
|
if (!sound.isvalid()) sound = S_FindSound("weapons/railgf");
|
||||||
|
|
||||||
// The railgun's sound is special. It gets played from the
|
// The railgun's sound is special. It gets played from the
|
||||||
// point on the slug's trail that is closest to the hearing player.
|
// point on the slug's trail that is closest to the hearing player.
|
||||||
|
|
|
@ -2836,7 +2836,7 @@ bool P_CheckForResurrection(AActor* self, bool usevilestates, FState* state = nu
|
||||||
self->SetState(archvile->FindState(NAME_Heal));
|
self->SetState(archvile->FindState(NAME_Heal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sound == NO_SOUND) sound = "vile/raise";
|
if (sound == NO_SOUND) sound = S_FindSound("vile/raise");
|
||||||
S_Sound(corpsehit, CHAN_BODY, 0, sound, 1, ATTN_IDLE);
|
S_Sound(corpsehit, CHAN_BODY, 0, sound, 1, ATTN_IDLE);
|
||||||
info = corpsehit->GetDefault();
|
info = corpsehit->GetDefault();
|
||||||
|
|
||||||
|
@ -3131,18 +3131,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_Pain)
|
||||||
FString pain_sound = pain_amount;
|
FString pain_sound = pain_amount;
|
||||||
pain_sound += '-';
|
pain_sound += '-';
|
||||||
pain_sound += self->player->LastDamageType.GetChars();
|
pain_sound += self->player->LastDamageType.GetChars();
|
||||||
sfx_id = pain_sound;
|
sfx_id = S_FindSound(pain_sound);
|
||||||
if (sfx_id == NO_SOUND)
|
if (sfx_id == NO_SOUND)
|
||||||
{
|
{
|
||||||
// Try again without a specific pain amount.
|
// Try again without a specific pain amount.
|
||||||
pain_sound = "*pain-";
|
pain_sound = "*pain-";
|
||||||
pain_sound += self->player->LastDamageType.GetChars();
|
pain_sound += self->player->LastDamageType.GetChars();
|
||||||
sfx_id = pain_sound;
|
sfx_id = S_FindSound(pain_sound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sfx_id == NO_SOUND)
|
if (sfx_id == NO_SOUND)
|
||||||
{
|
{
|
||||||
sfx_id = pain_amount;
|
sfx_id = S_FindSound(pain_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
S_Sound (self, CHAN_VOICE, 0, sfx_id, 1, ATTN_NORM);
|
S_Sound (self, CHAN_VOICE, 0, sfx_id, 1, ATTN_NORM);
|
||||||
|
|
|
@ -2161,7 +2161,7 @@ FUNC(LS_Light_Stop)
|
||||||
FUNC(LS_Radius_Quake)
|
FUNC(LS_Radius_Quake)
|
||||||
// Radius_Quake (intensity, duration, damrad, tremrad, tid)
|
// Radius_Quake (intensity, duration, damrad, tremrad, tid)
|
||||||
{
|
{
|
||||||
return P_StartQuake (Level, it, arg4, arg0, arg1, arg2*64, arg3*64, "world/quake");
|
return P_StartQuake (Level, it, arg4, arg0, arg1, arg2*64, arg3*64, S_FindSound("world/quake"));
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNC(LS_UsePuzzleItem)
|
FUNC(LS_UsePuzzleItem)
|
||||||
|
@ -3218,8 +3218,9 @@ FUNC(LS_SendToCommunicator)
|
||||||
if (it->CheckLocalView())
|
if (it->CheckLocalView())
|
||||||
{
|
{
|
||||||
S_StopSound (CHAN_VOICE);
|
S_StopSound (CHAN_VOICE);
|
||||||
it->player->SetSubtitle(arg0, name);
|
auto snd = S_FindSound(name);
|
||||||
S_Sound (CHAN_VOICE, 0, name, 1, ATTN_NORM);
|
it->player->SetSubtitle(arg0, snd);
|
||||||
|
S_Sound (CHAN_VOICE, 0, snd, 1, ATTN_NORM);
|
||||||
|
|
||||||
// Get the message from the LANGUAGE lump.
|
// Get the message from the LANGUAGE lump.
|
||||||
FString msg;
|
FString msg;
|
||||||
|
|
|
@ -404,7 +404,7 @@ void DActiveButton::Tick ()
|
||||||
{
|
{
|
||||||
m_Frame = -1;
|
m_Frame = -1;
|
||||||
S_Sound (Level, DVector3(m_Pos, 0), CHAN_VOICE, CHANF_LISTENERZ,
|
S_Sound (Level, DVector3(m_Pos, 0), CHAN_VOICE, CHANF_LISTENERZ,
|
||||||
def->Sound != NO_SOUND ? FSoundID(def->Sound) : FSoundID("switches/normbutn"),
|
def->Sound != NO_SOUND ? FSoundID(def->Sound) : S_FindSound("switches/normbutn"),
|
||||||
1, ATTN_STATIC);
|
1, ATTN_STATIC);
|
||||||
bFlippable = false;
|
bFlippable = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -908,7 +908,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
|
||||||
(DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX)) &&
|
(DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX)) &&
|
||||||
self->Vel.Z <= -39)
|
self->Vel.Z <= -39)
|
||||||
{
|
{
|
||||||
sound = S_FindSkinnedSound (self, "*splat");
|
sound = S_FindSkinnedSound (self, S_FindSound("*splat"));
|
||||||
chan = CHAN_BODY;
|
chan = CHAN_BODY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,7 +1169,7 @@ void P_CheckEnvironment(player_t *player)
|
||||||
player->mo->Vel.Z >= -player->mo->FloatVar(NAME_FallingScreamMaxSpeed) && !player->morphTics &&
|
player->mo->Vel.Z >= -player->mo->FloatVar(NAME_FallingScreamMaxSpeed) && !player->morphTics &&
|
||||||
player->mo->waterlevel == 0)
|
player->mo->waterlevel == 0)
|
||||||
{
|
{
|
||||||
auto id = S_FindSkinnedSound(player->mo, "*falling");
|
auto id = S_FindSkinnedSound(player->mo, S_FindSound("*falling"));
|
||||||
if (id != NO_SOUND && !S_IsActorPlayingSomething(player->mo, CHAN_VOICE, id))
|
if (id != NO_SOUND && !S_IsActorPlayingSomething(player->mo, CHAN_VOICE, id))
|
||||||
{
|
{
|
||||||
S_Sound(player->mo, CHAN_VOICE, 0, id, 1, ATTN_NORM);
|
S_Sound(player->mo, CHAN_VOICE, 0, id, 1, ATTN_NORM);
|
||||||
|
|
|
@ -583,7 +583,7 @@ void R_InitSkins (void)
|
||||||
|
|
||||||
for (j = 0; j < NUMSKINSOUNDS; ++j)
|
for (j = 0; j < NUMSKINSOUNDS; ++j)
|
||||||
{
|
{
|
||||||
playersoundrefs[j] = skinsoundnames[j][1];
|
playersoundrefs[j] = S_FindSound(skinsoundnames[j][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((base = fileSystem.FindLump ("S_SKIN", &lastlump, true)) != -1)
|
while ((base = fileSystem.FindLump ("S_SKIN", &lastlump, true)) != -1)
|
||||||
|
|
|
@ -504,17 +504,17 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
|
||||||
sc.Compare ("DeathSound"))
|
sc.Compare ("DeathSound"))
|
||||||
{
|
{
|
||||||
sc.MustGetString ();
|
sc.MustGetString ();
|
||||||
defaults->DeathSound = sc.String;
|
defaults->DeathSound = S_FindSound(sc.String);
|
||||||
}
|
}
|
||||||
else if (def == DEF_BreakableDecoration && sc.Compare ("BurnDeathSound"))
|
else if (def == DEF_BreakableDecoration && sc.Compare ("BurnDeathSound"))
|
||||||
{
|
{
|
||||||
sc.MustGetString ();
|
sc.MustGetString ();
|
||||||
defaults->ActiveSound = sc.String;
|
defaults->ActiveSound = S_FindSound(sc.String);
|
||||||
}
|
}
|
||||||
else if (def == DEF_Projectile && sc.Compare ("SpawnSound"))
|
else if (def == DEF_Projectile && sc.Compare ("SpawnSound"))
|
||||||
{
|
{
|
||||||
sc.MustGetString ();
|
sc.MustGetString ();
|
||||||
defaults->SeeSound = sc.String;
|
defaults->SeeSound = S_FindSound(sc.String);
|
||||||
}
|
}
|
||||||
else if (def == DEF_Projectile && sc.Compare ("DoomBounce"))
|
else if (def == DEF_Projectile && sc.Compare ("DoomBounce"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type)
|
||||||
if (type == TypeSound)
|
if (type == TypeSound)
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
x = new FxConstant(FSoundID(sc.String), sc);
|
x = new FxConstant(S_FindSound(sc.String), sc);
|
||||||
}
|
}
|
||||||
else if (type == TypeBool || type == TypeSInt32 || type == TypeFloat64)
|
else if (type == TypeBool || type == TypeSInt32 || type == TypeFloat64)
|
||||||
{
|
{
|
||||||
|
@ -879,7 +879,7 @@ static void DispatchScriptProperty(FScanner &sc, PProperty *prop, AActor *defaul
|
||||||
else if (f->Type == TypeSound)
|
else if (f->Type == TypeSound)
|
||||||
{
|
{
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
*(FSoundID*)addr = sc.String;
|
*(FSoundID*)addr = S_FindSound(sc.String);
|
||||||
}
|
}
|
||||||
else if (f->Type == TypeColor)
|
else if (f->Type == TypeColor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -467,7 +467,7 @@ void ZCCDoomCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *
|
||||||
}
|
}
|
||||||
else if (f->Type == TypeSound)
|
else if (f->Type == TypeSound)
|
||||||
{
|
{
|
||||||
*(FSoundID*)addr = GetStringConst(ex, ctx);
|
*(FSoundID*)addr = S_FindSound(GetStringConst(ex, ctx));
|
||||||
}
|
}
|
||||||
else if (f->Type == TypeColor && ex->ValueType == TypeString) // colors can also be specified as ints.
|
else if (f->Type == TypeColor && ex->ValueType == TypeString) // colors can also be specified as ints.
|
||||||
{
|
{
|
||||||
|
|
|
@ -1514,11 +1514,11 @@ FSoundID S_FindSkinnedSoundEx (AActor *actor, const char *name, const char *exte
|
||||||
fullname = name;
|
fullname = name;
|
||||||
fullname += '-';
|
fullname += '-';
|
||||||
fullname += extendedname;
|
fullname += extendedname;
|
||||||
FSoundID id = fullname;
|
FSoundID id = S_FindSound(fullname);
|
||||||
|
|
||||||
if (!id.isvalid())
|
if (!id.isvalid())
|
||||||
{ // Look for "name"
|
{ // Look for "name"
|
||||||
id = name;
|
id = S_FindSound(name);
|
||||||
}
|
}
|
||||||
return S_FindSkinnedSound (actor, id);
|
return S_FindSkinnedSound (actor, id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1386,7 +1386,7 @@ CCMD (playsound)
|
||||||
{
|
{
|
||||||
if (argv.argc() > 1)
|
if (argv.argc() > 1)
|
||||||
{
|
{
|
||||||
FSoundID id = argv[1];
|
FSoundID id = S_FindSound(argv[1]);
|
||||||
if (!id.isvalid())
|
if (!id.isvalid())
|
||||||
{
|
{
|
||||||
Printf("'%s' is not a sound\n", argv[1]);
|
Printf("'%s' is not a sound\n", argv[1]);
|
||||||
|
@ -1408,7 +1408,7 @@ CCMD (loopsound)
|
||||||
{
|
{
|
||||||
if (players[consoleplayer].mo != nullptr && !netgame && argv.argc() > 1)
|
if (players[consoleplayer].mo != nullptr && !netgame && argv.argc() > 1)
|
||||||
{
|
{
|
||||||
FSoundID id = argv[1];
|
FSoundID id = S_FindSound(argv[1]);
|
||||||
if (!id.isvalid())
|
if (!id.isvalid())
|
||||||
{
|
{
|
||||||
Printf("'%s' is not a sound\n", argv[1]);
|
Printf("'%s' is not a sound\n", argv[1]);
|
||||||
|
|
|
@ -16,10 +16,18 @@ void S_PrecacheLevel(FLevelLocals* l);
|
||||||
|
|
||||||
// Start sound for thing at <ent>
|
// Start sound for thing at <ent>
|
||||||
void S_Sound(int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
void S_Sound(int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
||||||
|
inline void S_Sound(int channel, EChanFlags flags, const char* sfxid, float volume, float attenuation)
|
||||||
|
{
|
||||||
|
S_Sound(channel, flags, S_FindSound(sfxid), volume, attenuation);
|
||||||
|
}
|
||||||
void S_SoundPitch(int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation, float pitch, float startTime = 0.f);
|
void S_SoundPitch(int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation, float pitch, float startTime = 0.f);
|
||||||
|
|
||||||
|
|
||||||
void S_Sound (AActor *ent, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
void S_Sound (AActor *ent, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
||||||
|
inline void S_Sound(AActor* ent, int channel, EChanFlags flags, const char* sfxid, float volume, float attenuation)
|
||||||
|
{
|
||||||
|
S_Sound(ent, channel, flags, S_FindSound(sfxid), volume, attenuation);
|
||||||
|
}
|
||||||
void S_SoundMinMaxDist (AActor *ent, int channel, EChanFlags flags, FSoundID sfxid, float volume, float mindist, float maxdist);
|
void S_SoundMinMaxDist (AActor *ent, int channel, EChanFlags flags, FSoundID sfxid, float volume, float mindist, float maxdist);
|
||||||
void S_Sound (const FPolyObj *poly, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
void S_Sound (const FPolyObj *poly, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
||||||
void S_Sound (const sector_t *sec, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
void S_Sound (const sector_t *sec, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
|
||||||
|
|
Loading…
Reference in a new issue