mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-20 19:12:07 +00:00
- handle all remaining places of sound ID conversions after removing the conversion operators.
This commit is contained in:
parent
160633a4a2
commit
d173c0453c
19 changed files with 68 additions and 71 deletions
|
@ -385,7 +385,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
sfxinfo_t *sfx;
|
||||
EChanFlags chanflags = flags;
|
||||
int basepriority;
|
||||
int org_id;
|
||||
FSoundID org_id;
|
||||
int pitch;
|
||||
FSoundChan *chan;
|
||||
FVector3 pos, vel;
|
||||
|
@ -397,7 +397,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
// prevent crashes.
|
||||
if (type == SOURCE_Unattached && pt == nullptr) type = SOURCE_None;
|
||||
|
||||
org_id = sound_id.index();
|
||||
org_id = sound_id;
|
||||
|
||||
CalcPosVel(type, source, &pt->X, channel, chanflags, sound_id, &pos, &vel, nullptr);
|
||||
|
||||
|
@ -406,7 +406,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
sfx = &S_sfx[org_id];
|
||||
sfx = &S_sfx[sound_id.index()];
|
||||
|
||||
// Scale volume according to SNDINFO data.
|
||||
volume = min(volume * sfx->Volume, 1.f);
|
||||
|
@ -595,7 +595,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
if (chan != NULL)
|
||||
{
|
||||
chan->SoundID = sound_id;
|
||||
chan->OrgID = FSoundID(org_id);
|
||||
chan->OrgID = org_id;
|
||||
chan->EntChannel = channel;
|
||||
chan->Volume = float(volume);
|
||||
chan->ChanFlags |= chanflags;
|
||||
|
@ -1485,7 +1485,7 @@ int SoundEngine::GetSoundIndex(const char* logicalname)
|
|||
FSoundID SoundEngine::FindSoundByResID(int resid)
|
||||
{
|
||||
auto p = ResIdMap.CheckKey(resid);
|
||||
return p ? *p : 0;
|
||||
return p ? *p : NO_SOUND;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1504,10 +1504,10 @@ FSoundID SoundEngine::FindSoundNoHash(const char* logicalname)
|
|||
{
|
||||
if (stricmp(S_sfx[i].name, logicalname) == 0)
|
||||
{
|
||||
return i;
|
||||
return FSoundID::fromInt(i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return NO_SOUND;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1525,9 +1525,9 @@ FSoundID SoundEngine::FindSoundByLump(int lump)
|
|||
|
||||
for (i = 1; i < S_sfx.Size(); i++)
|
||||
if (S_sfx[i].lumpnum == lump)
|
||||
return i;
|
||||
return FSoundID::fromInt(i);
|
||||
}
|
||||
return 0;
|
||||
return NO_SOUND;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1549,9 +1549,10 @@ FSoundID SoundEngine::AddSoundLump(const char* logicalname, int lump, int Curren
|
|||
newsfx.NearLimit = nearlimit;
|
||||
newsfx.ResourceId = resid;
|
||||
newsfx.bTentative = false;
|
||||
auto id = FSoundID::fromInt(S_sfx.Size() - 1);
|
||||
|
||||
if (resid >= 0) ResIdMap[resid] = S_sfx.Size() - 1;
|
||||
return (int)S_sfx.Size()-1;
|
||||
if (resid >= 0) ResIdMap[resid] = id;
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1736,8 +1737,8 @@ CCMD(cachesound)
|
|||
}
|
||||
for (int i = 1; i < argv.argc(); ++i)
|
||||
{
|
||||
FSoundID sfxnum = argv[i];
|
||||
if (sfxnum != FSoundID(0))
|
||||
FSoundID sfxnum = S_FindSound(argv[i]);
|
||||
if (sfxnum != NO_SOUND)
|
||||
{
|
||||
soundEngine->CacheSound(sfxnum);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,11 @@ class FSoundID
|
|||
public:
|
||||
FSoundID() = default;
|
||||
|
||||
private:
|
||||
constexpr FSoundID(int id) : ID(id)
|
||||
{
|
||||
}
|
||||
public:
|
||||
static constexpr FSoundID fromInt(int i)
|
||||
{
|
||||
return FSoundID(i);
|
||||
|
@ -62,12 +64,6 @@ public:
|
|||
}
|
||||
bool operator ==(int other) const = delete;
|
||||
bool operator !=(int other) const = delete;
|
||||
/*
|
||||
operator int() const
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
*/
|
||||
constexpr int index() const
|
||||
{
|
||||
return ID;
|
||||
|
@ -82,10 +78,13 @@ private:
|
|||
int ID;
|
||||
};
|
||||
|
||||
constexpr FSoundID NO_SOUND = FSoundID::fromInt(0);
|
||||
constexpr FSoundID INVALID_SOUND = FSoundID::fromInt(-1);
|
||||
|
||||
struct FRandomSoundList
|
||||
{
|
||||
TArray<FSoundID> Choices;
|
||||
FSoundID Owner = 0;
|
||||
FSoundID Owner = NO_SOUND;
|
||||
};
|
||||
|
||||
|
||||
|
@ -130,9 +129,6 @@ private:
|
|||
float Attenuation = 1.f; // Multiplies the attenuation passed to S_Sound.
|
||||
};
|
||||
|
||||
constexpr FSoundID NO_SOUND = FSoundID::fromInt(0);
|
||||
constexpr FSoundID INVALID_SOUND = FSoundID::fromInt(-1);
|
||||
|
||||
|
||||
struct FSoundChan : public FISoundChannel
|
||||
{
|
||||
|
@ -215,7 +211,7 @@ protected:
|
|||
TArray<sfxinfo_t> S_sfx;
|
||||
FRolloffInfo S_Rolloff{};
|
||||
TArray<uint8_t> S_SoundCurve;
|
||||
TMap<int, int> ResIdMap;
|
||||
TMap<int, FSoundID> ResIdMap;
|
||||
TArray<FRandomSoundList> S_rnd;
|
||||
bool blockNewSounds = false;
|
||||
|
||||
|
|
|
@ -210,14 +210,14 @@ public:
|
|||
{
|
||||
if (animSnd[i] == curframe)
|
||||
{
|
||||
int sound = animSnd[i+1];
|
||||
if (sound == -1)
|
||||
auto sound = FSoundID::fromInt(animSnd[i+1]);
|
||||
if (sound == INVALID_SOUND)
|
||||
soundEngine->StopAllChannels();
|
||||
else
|
||||
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, nostopsound? CHANF_UI : CHANF_NONE, sound, 1.f, ATTN_NONE);
|
||||
}
|
||||
}
|
||||
if (!nostopsound && curframe == numframes && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, -1)) return true;
|
||||
if (!nostopsound && curframe == numframes && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, INVALID_SOUND)) return true;
|
||||
curframe++;
|
||||
return curframe < numframes;
|
||||
}
|
||||
|
@ -586,8 +586,8 @@ public:
|
|||
{
|
||||
if (animSnd[i] == soundframe)
|
||||
{
|
||||
int sound = animSnd[i + 1];
|
||||
if (sound == -1)
|
||||
auto sound = FSoundID::fromInt(animSnd[i + 1]);
|
||||
if (sound == INVALID_SOUND)
|
||||
soundEngine->StopAllChannels();
|
||||
else
|
||||
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, nostopsound ? CHANF_UI : CHANF_NONE, sound, 1.f, ATTN_NONE);
|
||||
|
@ -790,8 +790,8 @@ public:
|
|||
{
|
||||
if (animSnd[i] == nFrame)
|
||||
{
|
||||
int sound = animSnd[i + 1];
|
||||
if (sound == -1)
|
||||
auto sound = FSoundID::fromInt(animSnd[i + 1]);
|
||||
if (sound == INVALID_SOUND)
|
||||
soundEngine->StopAllChannels();
|
||||
else
|
||||
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, nostopsound ? CHANF_UI : CHANF_NONE, sound, 1.f, ATTN_NONE);
|
||||
|
|
|
@ -1334,7 +1334,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI
|
|||
//If sound name here is not reliable, we need to save by index instead.
|
||||
int id = sid.index();
|
||||
Serialize(arc, key, id, nullptr);
|
||||
if (arc.isReading()) sid = FSoundID(id);
|
||||
if (arc.isReading()) sid = FSoundID::fromInt(id);
|
||||
}
|
||||
else if (arc.isWriting())
|
||||
{
|
||||
|
|
|
@ -1299,7 +1299,7 @@ FxExpression *FxStringCast::Resolve(FCompileContext &ctx)
|
|||
if (basex->isConstant())
|
||||
{
|
||||
ExpVal constval = static_cast<FxConstant *>(basex)->GetValue();
|
||||
FxExpression *x = new FxConstant(soundEngine->GetSoundName(constval.GetInt()), ScriptPosition);
|
||||
FxExpression *x = new FxConstant(soundEngine->GetSoundName(FSoundID::fromInt(constval.GetInt())), ScriptPosition);
|
||||
delete this;
|
||||
return x;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ static void CastN2S(FString *a, int b) { FName name = FName(ENamedName(b)); *a =
|
|||
static int CastS2Co(FString *b) { return V_GetColor(*b); }
|
||||
static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %02x", c.r, c.g, c.b); }
|
||||
static int CastS2So(FString *b) { return S_FindSound(*b).index(); }
|
||||
static void CastSo2S(FString* a, int b) { *a = soundEngine->GetSoundName(b); }
|
||||
static void CastSo2S(FString* a, int b) { *a = soundEngine->GetSoundName(FSoundID::fromInt(b)); }
|
||||
static void CastSID2S(FString* a, unsigned int b) { VM_CastSpriteIDToString(a, b); }
|
||||
static void CastTID2S(FString *a, int b) { auto tex = TexMan.GetGameTexture(*(FTextureID*)&b); *a = (tex == nullptr) ? "(null)" : tex->GetName().GetChars(); }
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ bool AssertObject(void * ob);
|
|||
#define PARAM_UINT_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); unsigned x = param[p].i;
|
||||
#define PARAM_BOOL_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); bool x = !!param[p].i;
|
||||
#define PARAM_NAME_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FName x = ENamedName(param[p].i);
|
||||
#define PARAM_SOUND_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FSoundID x = param[p].i;
|
||||
#define PARAM_SOUND_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); FSoundID x = FSoundID::fromInt(param[p].i);
|
||||
#define PARAM_COLOR_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_INT); PalEntry x = param[p].i;
|
||||
#define PARAM_FLOAT_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); double x = param[p].f;
|
||||
#define PARAM_ANGLE_AT(p,x) assert((p) < numparam); assert(reginfo[p] == REGT_FLOAT); DAngle x = DAngle::fromDeg(param[p].f);
|
||||
|
|
|
@ -2127,7 +2127,7 @@ static void DoCast(const VMRegisters ®, const VMFrame *f, int a, int b, int c
|
|||
|
||||
case CAST_So2S:
|
||||
ASSERTS(a); ASSERTD(b);
|
||||
reg.s[a] = soundEngine->GetSoundName(reg.d[b]);
|
||||
reg.s[a] = soundEngine->GetSoundName(FSoundID::fromInt(reg.d[b]));
|
||||
break;
|
||||
|
||||
case CAST_SID2S:
|
||||
|
|
|
@ -1386,7 +1386,7 @@ static int PatchThing (int thingy)
|
|||
}
|
||||
else if (stricmp (Line1 + linelen - 6, " sound") == 0)
|
||||
{
|
||||
FSoundID snd = 0;
|
||||
FSoundID snd = NO_SOUND;
|
||||
|
||||
if (val == 0 || val >= SoundMap.Size())
|
||||
{
|
||||
|
|
|
@ -229,7 +229,7 @@ FSwitchDef *FTextureAnimator::ParseSwitchDef (FScanner &sc, bool ignoreBad)
|
|||
FSwitchDef::frame thisframe;
|
||||
FTextureID picnum;
|
||||
bool bad;
|
||||
FSoundID sound = 0;
|
||||
FSoundID sound = NO_SOUND;
|
||||
|
||||
bad = false;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ struct FStrifeDialogueNode
|
|||
|
||||
PClassActor *SpeakerType = nullptr;
|
||||
FString SpeakerName;
|
||||
FSoundID SpeakerVoice = 0;
|
||||
FSoundID SpeakerVoice = NO_SOUND;
|
||||
FString Backdrop;
|
||||
FString Dialogue;
|
||||
FString Goodbye; // must init to null for binary scripts to work as intended
|
||||
|
|
|
@ -4673,7 +4673,7 @@ static FSoundID GetActorSound(AActor *actor, int soundtype)
|
|||
case SOUND_CrushPain: return actor->CrushPainSound;
|
||||
case SOUND_Howl: return actor->SoundVar(NAME_HowlSound);
|
||||
case SOUND_Push: return actor->SoundVar(NAME_PushSound);
|
||||
default: return 0;
|
||||
default: return NO_SOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5292,7 +5292,7 @@ int DLevelScript::SwapActorTeleFog(AActor *activator, int tid)
|
|||
}
|
||||
else if (rettype == TypeSound)
|
||||
{
|
||||
retval = GlobalACSStrings.AddString(S_GetSoundName(FSoundID(retval)));
|
||||
retval = GlobalACSStrings.AddString(S_GetSoundName(FSoundID::fromInt(retval)));
|
||||
}
|
||||
}
|
||||
else if (rettype == TypeFloat64)
|
||||
|
@ -5903,7 +5903,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
case ACSF_PlayActorSound:
|
||||
// PlaySound(tid, "SoundName", channel, volume, looping, attenuation, local)
|
||||
{
|
||||
FSoundID sid = 0;
|
||||
FSoundID sid = NO_SOUND;
|
||||
|
||||
if (funcIndex == ACSF_PlaySound)
|
||||
{
|
||||
|
@ -6732,7 +6732,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
if (activator != nullptr && activator->player != nullptr)
|
||||
{
|
||||
int logNum = args[0];
|
||||
FSoundID sid = 0;
|
||||
FSoundID sid = NO_SOUND;
|
||||
|
||||
const char* lookup = Level->Behaviors.LookupString(args[1]);
|
||||
if (lookup != nullptr)
|
||||
|
|
|
@ -2735,7 +2735,7 @@ bool P_CanResurrect(AActor *raiser, AActor *thing)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool P_CheckForResurrection(AActor* self, bool usevilestates, FState* state = nullptr, FSoundID sound = 0)
|
||||
bool P_CheckForResurrection(AActor* self, bool usevilestates, FState* state = nullptr, FSoundID sound = NO_SOUND)
|
||||
{
|
||||
const AActor *info;
|
||||
AActor *temp;
|
||||
|
@ -3114,7 +3114,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Pain)
|
|||
if (self->player && self->player->morphTics == 0)
|
||||
{
|
||||
const char *pain_amount;
|
||||
FSoundID sfx_id = 0;
|
||||
FSoundID sfx_id = NO_SOUND;
|
||||
|
||||
if (self->health < 25)
|
||||
pain_amount = "*pain25";
|
||||
|
|
|
@ -3299,7 +3299,7 @@ void AActor::AlterWeaponSprite(visstyle_t *vis)
|
|||
|
||||
void AActor::PlayActiveSound ()
|
||||
{
|
||||
if (ActiveSound.isvalid() && !S_IsActorPlayingSomething(this, CHAN_VOICE, -1))
|
||||
if (ActiveSound.isvalid() && !S_IsActorPlayingSomething(this, CHAN_VOICE))
|
||||
{
|
||||
S_Sound (this, CHAN_VOICE, 0, ActiveSound, 1,
|
||||
(flags3 & MF3_FULLVOLACTIVE) ? ATTN_NONE : ATTN_IDLE);
|
||||
|
|
|
@ -887,7 +887,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
|
|||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
FSoundID sound = 0;
|
||||
FSoundID sound = NO_SOUND;
|
||||
int chan = CHAN_VOICE;
|
||||
|
||||
if (self->player == NULL || self->DeathSound != NO_SOUND)
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
DVector2 AM_GetPosition();
|
||||
int Net_GetLatency(int *ld, int *ad);
|
||||
void PrintPickupMessage(bool localview, const FString &str);
|
||||
bool P_CheckForResurrection(AActor* self, bool usevilestates, FState* state = nullptr, FSoundID sound = 0);
|
||||
bool P_CheckForResurrection(AActor* self, bool usevilestates, FState* state = nullptr, FSoundID sound = NO_SOUND);
|
||||
|
||||
// FCheckPosition requires explicit construction and destruction when used in the VM
|
||||
|
||||
|
@ -201,7 +201,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StartSound, A_StartSound)
|
|||
|
||||
void A_StartSoundIfNotSame(AActor *self, int soundid, int checksoundid, int channel, int flags, double volume, double attenuation, double pitch, double startTime)
|
||||
{
|
||||
if (!S_AreSoundsEquivalent (self, soundid, checksoundid))
|
||||
if (!S_AreSoundsEquivalent (self, FSoundID::fromInt(soundid), FSoundID::fromInt(checksoundid)))
|
||||
A_StartSound(self, soundid, channel, flags, volume, attenuation, pitch, startTime);
|
||||
}
|
||||
|
||||
|
@ -1621,7 +1621,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_ExtChase, A_ExtChase)
|
|||
|
||||
int CheckForResurrection(AActor *self, FState* state, int sound)
|
||||
{
|
||||
return P_CheckForResurrection(self, false, state, sound);
|
||||
return P_CheckForResurrection(self, false, state, FSoundID::fromInt(sound));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_CheckForResurrection, CheckForResurrection)
|
||||
|
@ -1629,7 +1629,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_CheckForResurrection, CheckForResurrecti
|
|||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_STATE(state);
|
||||
PARAM_INT(sound);
|
||||
ACTION_RETURN_BOOL(P_CheckForResurrection(self, false, state, sound));
|
||||
ACTION_RETURN_BOOL(CheckForResurrection(self, state, sound));
|
||||
}
|
||||
|
||||
static void ZS_Face(AActor *self, AActor *faceto, double max_turn, double max_pitch, double ang_offset, double pitch_offset, int flags, double z_add)
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
FSoundID LookupSound(FSoundID player_sound_id)
|
||||
{
|
||||
auto v = map.CheckKey(player_sound_id.index());
|
||||
return v ? *v : FSoundID(0);
|
||||
return v ? *v : NO_SOUND;
|
||||
}
|
||||
void MarkUsed()
|
||||
{
|
||||
|
@ -327,14 +327,14 @@ void S_CheckIntegrity()
|
|||
memset(&broken[0], 0, sizeof(bool) * soundEngine->GetNumSounds());
|
||||
for (unsigned i = 0; i < soundEngine->GetNumSounds(); i++)
|
||||
{
|
||||
auto &sfx = *soundEngine->GetWritableSfx(i);
|
||||
auto &sfx = *soundEngine->GetWritableSfx(FSoundID::fromInt(i));
|
||||
broken[i] = !S_CheckSound(&sfx, &sfx, chain);
|
||||
}
|
||||
for (unsigned i = 0; i < soundEngine->GetNumSounds(); i++)
|
||||
{
|
||||
if (broken[i])
|
||||
{
|
||||
auto& sfx = *soundEngine->GetWritableSfx(i);
|
||||
auto& sfx = *soundEngine->GetWritableSfx(FSoundID::fromInt(i));
|
||||
Printf(TEXTCOLOR_RED "Sound %s has been disabled\n", sfx.name.GetChars());
|
||||
sfx.bRandomHeader = false;
|
||||
sfx.link = 0; // link to the empty sound.
|
||||
|
@ -486,7 +486,7 @@ FSoundID S_AddPlayerSound (const char *pclass, int gender, FSoundID refid, int l
|
|||
FSoundID id;
|
||||
|
||||
auto sfx = soundEngine->GetSfx(refid);
|
||||
if (refid == NO_SOUND || !sfx) return 0;
|
||||
if (refid == NO_SOUND || !sfx) return NO_SOUND;
|
||||
|
||||
fakename = pclass;
|
||||
fakename += '"';
|
||||
|
@ -517,7 +517,7 @@ FSoundID S_AddPlayerSoundExisting (const char *pclass, int gender, FSoundID refi
|
|||
int classnum = S_AddPlayerClass (pclass);
|
||||
int soundlist = S_AddPlayerGender (classnum, gender);
|
||||
auto sfx = soundEngine->GetSfx(refid);
|
||||
if (refid == NO_SOUND || !sfx) return 0;
|
||||
if (refid == NO_SOUND || !sfx) return NO_SOUND;
|
||||
|
||||
PlayerSounds[soundlist].AddSound (sfx->link, aliasto);
|
||||
|
||||
|
@ -1332,12 +1332,12 @@ static FSoundID S_LookupPlayerSound (int classidx, int gender, FSoundID refid)
|
|||
{
|
||||
return S_LookupPlayerSound (DefPlayerClass, gender, refid);
|
||||
}
|
||||
return 0;
|
||||
return NO_SOUND;
|
||||
}
|
||||
gender = g;
|
||||
}
|
||||
auto sfxp = soundEngine->GetWritableSfx(refid);
|
||||
if (!sfxp) return 0;
|
||||
if (!sfxp) return NO_SOUND;
|
||||
|
||||
FSoundID sndnum = PlayerSounds[listidx].LookupSound (sfxp->link);
|
||||
sfxp = soundEngine->GetWritableSfx(sndnum);
|
||||
|
@ -1562,7 +1562,7 @@ CCMD (soundlinks)
|
|||
|
||||
for (i = 0; i < soundEngine->GetNumSounds(); i++)
|
||||
{
|
||||
const sfxinfo_t* sfx = soundEngine->GetSfx(i);
|
||||
const sfxinfo_t* sfx = soundEngine->GetSfx(FSoundID::fromInt(i));
|
||||
|
||||
if (sfx->link != sfxinfo_t::NO_LINK &&
|
||||
!sfx->bRandomHeader &&
|
||||
|
@ -1589,7 +1589,7 @@ CCMD (playersounds)
|
|||
memset (reserveNames, 0, sizeof(reserveNames));
|
||||
for (i = j = 0; j < NumPlayerReserves && i < soundEngine->GetNumSounds(); ++i)
|
||||
{
|
||||
auto sfx = soundEngine->GetSfx(i);
|
||||
auto sfx = soundEngine->GetSfx(FSoundID::fromInt(i));
|
||||
if (sfx->UserData[0] & SND_PlayerReserve)
|
||||
{
|
||||
++j;
|
||||
|
@ -1606,7 +1606,7 @@ CCMD (playersounds)
|
|||
Printf ("\n%s, %s:\n", PlayerClassLookups[i].Name.GetChars(), GenderNames[j]);
|
||||
for (k = 0; k < NumPlayerReserves; ++k)
|
||||
{
|
||||
auto sndid = PlayerSounds[l].LookupSound(k);
|
||||
auto sndid = PlayerSounds[l].LookupSound(FSoundID::fromInt(k));
|
||||
auto sfx = soundEngine->GetSfx(sndid);
|
||||
Printf (" %-16s%s\n", reserveNames[k], sfx->name.GetChars());
|
||||
}
|
||||
|
@ -1691,7 +1691,7 @@ DEFINE_ACTION_FUNCTION(AAmbientSound, Tick)
|
|||
loop = CHANF_LOOP;
|
||||
}
|
||||
|
||||
if (ambient->sound != FSoundID(0))
|
||||
if (ambient->sound != NO_SOUND)
|
||||
{
|
||||
// The second argument scales the ambient sound's volume.
|
||||
// 0 and 100 are normal volume. The maximum volume level
|
||||
|
|
|
@ -1339,7 +1339,7 @@ void DoomSoundEngine::PrintSoundList()
|
|||
lumpname[8] = 0;
|
||||
for (i = 0; i < soundEngine->GetNumSounds(); i++)
|
||||
{
|
||||
const sfxinfo_t* sfx = soundEngine->GetSfx(i);
|
||||
const sfxinfo_t* sfx = soundEngine->GetSfx(FSoundID::fromInt(i));
|
||||
if (sfx->bRandomHeader)
|
||||
{
|
||||
Printf("%3d. %s -> #%d {", i, sfx->name.GetChars(), sfx->link);
|
||||
|
|
|
@ -313,7 +313,7 @@ void DSeqNode::Serialize(FSerializer &arc)
|
|||
unsigned int i;
|
||||
FName seqName = NAME_None;
|
||||
int delayTics = 0;
|
||||
FSoundID id = 0;
|
||||
FSoundID id = NO_SOUND;
|
||||
float volume;
|
||||
float atten = ATTN_NORM;
|
||||
int seqnum;
|
||||
|
@ -796,13 +796,13 @@ static void AddSequence (int curseq, FName seqname, FName slot, int stopsound, c
|
|||
Sequences[curseq] = (FSoundSequence *)M_Malloc (sizeof(FSoundSequence) + sizeof(uint32_t)*ScriptTemp.Size());
|
||||
Sequences[curseq]->SeqName = seqname;
|
||||
Sequences[curseq]->Slot = slot;
|
||||
Sequences[curseq]->StopSound = FSoundID(stopsound);
|
||||
Sequences[curseq]->StopSound = FSoundID::fromInt(stopsound);
|
||||
memcpy (Sequences[curseq]->Script, &ScriptTemp[0], sizeof(uint32_t)*ScriptTemp.Size());
|
||||
Sequences[curseq]->Script[ScriptTemp.Size()] = MakeCommand(SS_CMD_END, 0);
|
||||
}
|
||||
|
||||
DSeqNode::DSeqNode (FLevelLocals *l, int sequence, int modenum)
|
||||
: m_CurrentSoundID(0), m_ModeNum(modenum), m_SequenceChoices(0)
|
||||
: m_CurrentSoundID(NO_SOUND), m_ModeNum(modenum), m_SequenceChoices(0)
|
||||
{
|
||||
Level = l;
|
||||
ActivateSequence (sequence);
|
||||
|
@ -1204,7 +1204,7 @@ void DSeqNode::Tick ()
|
|||
case SS_CMD_PLAY:
|
||||
if (!IsPlaying())
|
||||
{
|
||||
m_CurrentSoundID = FSoundID(GetData(*m_SequencePtr));
|
||||
m_CurrentSoundID = FSoundID::fromInt(GetData(*m_SequencePtr));
|
||||
MakeSound (0, m_CurrentSoundID);
|
||||
}
|
||||
m_SequencePtr++;
|
||||
|
@ -1226,7 +1226,7 @@ void DSeqNode::Tick ()
|
|||
if (!IsPlaying())
|
||||
{
|
||||
// Does not advance sequencePtr, so it will repeat as necessary.
|
||||
m_CurrentSoundID = FSoundID(GetData(*m_SequencePtr));
|
||||
m_CurrentSoundID = FSoundID::fromInt(GetData(*m_SequencePtr));
|
||||
MakeSound (CHANF_LOOP, m_CurrentSoundID);
|
||||
}
|
||||
return;
|
||||
|
@ -1234,7 +1234,7 @@ void DSeqNode::Tick ()
|
|||
case SS_CMD_PLAYLOOP:
|
||||
// Like SS_CMD_PLAYREPEAT, sequencePtr is not advanced, so this
|
||||
// command will repeat until the sequence is stopped.
|
||||
m_CurrentSoundID = FSoundID(GetData(m_SequencePtr[0]));
|
||||
m_CurrentSoundID = FSoundID::fromInt(GetData(m_SequencePtr[0]));
|
||||
MakeSound (0, m_CurrentSoundID);
|
||||
m_DelayTics = m_SequencePtr[1];
|
||||
return;
|
||||
|
@ -1444,7 +1444,7 @@ void SN_MarkPrecacheSounds(int sequence, seqtype_t type)
|
|||
int cmd = GetCommand(seq->Script[i]);
|
||||
if (cmd == SS_CMD_PLAY || cmd == SS_CMD_PLAYREPEAT || cmd == SS_CMD_PLAYLOOP)
|
||||
{
|
||||
soundEngine->MarkUsed(GetData(seq->Script[i]));
|
||||
soundEngine->MarkUsed(FSoundID::fromInt(GetData(seq->Script[i])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1468,7 +1468,7 @@ DEFINE_ACTION_FUNCTION(DSeqNode, MarkPrecacheSounds)
|
|||
//==========================================================================
|
||||
|
||||
void SN_ChangeNodeData (FLevelLocals *Level, int nodeNum, int seqOffset, int delayTics, float volume,
|
||||
int currentSoundID)
|
||||
FSoundID currentSoundID)
|
||||
{
|
||||
int i;
|
||||
DSeqNode *node;
|
||||
|
|
Loading…
Reference in a new issue