- migrate a large part of the sound code to FSoundIDs.

This has always been a wild mixture of IDs and ints.
This commit is contained in:
Christoph Oelckers 2022-11-24 15:22:07 +01:00
commit 160633a4a2
35 changed files with 224 additions and 205 deletions

View file

@ -446,7 +446,7 @@ void player_t::SetSubtitle(int num, FSoundID soundid)
if (text != nullptr)
{
SubtitleText = lumpname;
int sl = soundid == 0 ? 7000 : max<int>(7000, S_GetMSLength(soundid));
int sl = soundid == NO_SOUND ? 7000 : max<int>(7000, S_GetMSLength(soundid));
SubtitleCounter = sl * TICRATE / 1000;
}
}
@ -887,12 +887,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
{
PARAM_SELF_PROLOGUE(AActor);
int sound = 0;
FSoundID sound = 0;
int chan = CHAN_VOICE;
if (self->player == NULL || self->DeathSound != 0)
if (self->player == NULL || self->DeathSound != NO_SOUND)
{
if (self->DeathSound != 0)
if (self->DeathSound != NO_SOUND)
{
S_Sound (self, CHAN_VOICE, 0, self->DeathSound, 1, ATTN_NORM);
}
@ -912,27 +912,27 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
chan = CHAN_BODY;
}
if (!sound && self->special1<10)
if (!sound.isvalid() && self->special1<10)
{ // Wimpy death sound
sound = S_FindSkinnedSoundEx (self, "*wimpydeath", self->player->LastDamageType.GetChars());
}
if (!sound && self->health <= -50)
if (!sound.isvalid() && self->health <= -50)
{
if (self->health > -100)
{ // Crazy death sound
sound = S_FindSkinnedSoundEx (self, "*crazydeath", self->player->LastDamageType.GetChars());
}
if (!sound)
if (!sound.isvalid())
{ // Extreme death sound
sound = S_FindSkinnedSoundEx (self, "*xdeath", self->player->LastDamageType.GetChars());
if (!sound)
if (!sound.isvalid())
{
sound = S_FindSkinnedSoundEx (self, "*gibbed", self->player->LastDamageType.GetChars());
chan = CHAN_BODY;
}
}
}
if (!sound)
if (!sound.isvalid())
{ // Normal death sound
sound = S_FindSkinnedSoundEx (self, "*death", self->player->LastDamageType.GetChars());
}
@ -1169,8 +1169,8 @@ void P_CheckEnvironment(player_t *player)
player->mo->Vel.Z >= -player->mo->FloatVar(NAME_FallingScreamMaxSpeed) && !player->morphTics &&
player->mo->waterlevel == 0)
{
int id = S_FindSkinnedSound(player->mo, "*falling");
if (id != 0 && !S_IsActorPlayingSomething(player->mo, CHAN_VOICE, id))
auto id = S_FindSkinnedSound(player->mo, "*falling");
if (id != NO_SOUND && !S_IsActorPlayingSomething(player->mo, CHAN_VOICE, id))
{
S_Sound(player->mo, CHAN_VOICE, 0, id, 1, ATTN_NORM);
}