- separated the channel number from the flags in the sound interface so that the 8 channel limit can be eliminated.

- added Marisa Kirisame's CHAN_OVERLAP flag.
- exported S_IsActorPlayingSomething to ZScript.

The sound API change required deprecating A_PlaySound and S_Sound. There are now new variants S_StartSound and A_StartSound which have two distinct parameters for channel and flags.
This commit is contained in:
Christoph Oelckers 2019-12-16 23:52:39 +01:00
parent b09e9f10ed
commit e82565373f
43 changed files with 339 additions and 280 deletions

View file

@ -185,7 +185,7 @@ void DoVoiceAnnounce (const char *sound)
if (LastAnnounceTime == 0 || LastAnnounceTime <= primaryLevel->time-5) if (LastAnnounceTime == 0 || LastAnnounceTime <= primaryLevel->time-5)
{ {
LastAnnounceTime = primaryLevel->time; LastAnnounceTime = primaryLevel->time;
S_Sound (CHAN_VOICE, sound, 1, ATTN_NONE); S_Sound (CHAN_VOICE, 0, sound, 1, ATTN_NONE);
} }
} }

View file

@ -1214,7 +1214,7 @@ void D_DoStrifeAdvanceDemo ()
pagetic = 10 * TICRATE/35; pagetic = 10 * TICRATE/35;
pagename = ""; // PANEL0, but strife0.wad doesn't have it, so don't use it. pagename = ""; // PANEL0, but strife0.wad doesn't have it, so don't use it.
PageBlank = true; PageBlank = true;
S_Sound (CHAN_VOICE | CHAN_UI, "bishop/active", 1, ATTN_NORM); S_Sound (CHAN_VOICE, CHANF_UI, "bishop/active", 1, ATTN_NORM);
break; break;
case 2: case 2:
@ -1226,7 +1226,7 @@ void D_DoStrifeAdvanceDemo ()
pagetic = 7 * TICRATE; pagetic = 7 * TICRATE;
pagename = "PANEL1"; pagename = "PANEL1";
subtitle = "TXT_SUB_INTRO1"; subtitle = "TXT_SUB_INTRO1";
S_Sound (CHAN_VOICE | CHAN_UI, voices[0], 1, ATTN_NORM); S_Sound (CHAN_VOICE, CHANF_UI, voices[0], 1, ATTN_NORM);
// The new Strife teaser has D_FMINTR. // The new Strife teaser has D_FMINTR.
// The full retail Strife has D_INTRO. // The full retail Strife has D_INTRO.
// And the old Strife teaser has both. (I do not know which one it actually uses, nor do I care.) // And the old Strife teaser has both. (I do not know which one it actually uses, nor do I care.)
@ -1237,35 +1237,35 @@ void D_DoStrifeAdvanceDemo ()
pagetic = 9 * TICRATE; pagetic = 9 * TICRATE;
pagename = "PANEL2"; pagename = "PANEL2";
subtitle = "TXT_SUB_INTRO2"; subtitle = "TXT_SUB_INTRO2";
S_Sound (CHAN_VOICE | CHAN_UI, voices[1], 1, ATTN_NORM); S_Sound (CHAN_VOICE, CHANF_UI, voices[1], 1, ATTN_NORM);
break; break;
case 5: case 5:
pagetic = 12 * TICRATE; pagetic = 12 * TICRATE;
pagename = "PANEL3"; pagename = "PANEL3";
subtitle = "TXT_SUB_INTRO3"; subtitle = "TXT_SUB_INTRO3";
S_Sound (CHAN_VOICE | CHAN_UI, voices[2], 1, ATTN_NORM); S_Sound (CHAN_VOICE, CHANF_UI, voices[2], 1, ATTN_NORM);
break; break;
case 6: case 6:
pagetic = 11 * TICRATE; pagetic = 11 * TICRATE;
pagename = "PANEL4"; pagename = "PANEL4";
subtitle = "TXT_SUB_INTRO4"; subtitle = "TXT_SUB_INTRO4";
S_Sound (CHAN_VOICE | CHAN_UI, voices[3], 1, ATTN_NORM); S_Sound (CHAN_VOICE, CHANF_UI, voices[3], 1, ATTN_NORM);
break; break;
case 7: case 7:
pagetic = 10 * TICRATE; pagetic = 10 * TICRATE;
pagename = "PANEL5"; pagename = "PANEL5";
subtitle = "TXT_SUB_INTRO5"; subtitle = "TXT_SUB_INTRO5";
S_Sound (CHAN_VOICE | CHAN_UI, voices[4], 1, ATTN_NORM); S_Sound (CHAN_VOICE, CHANF_UI, voices[4], 1, ATTN_NORM);
break; break;
case 8: case 8:
pagetic = 16 * TICRATE; pagetic = 16 * TICRATE;
pagename = "PANEL6"; pagename = "PANEL6";
subtitle = "TXT_SUB_INTRO6"; subtitle = "TXT_SUB_INTRO6";
S_Sound (CHAN_VOICE | CHAN_UI, voices[5], 1, ATTN_NORM); S_Sound (CHAN_VOICE, CHANF_UI, voices[5], 1, ATTN_NORM);
break; break;
case 9: case 9:
@ -2770,7 +2770,7 @@ static int D_DoomMain_Internal (void)
delete StartScreen; delete StartScreen;
StartScreen = NULL; StartScreen = NULL;
S_Sound (CHAN_BODY, "misc/startupdone", 1, ATTN_NONE); S_Sound (CHAN_BODY, 0, "misc/startupdone", 1, ATTN_NONE);
if (Args->CheckParm("-norun") || batchrun) if (Args->CheckParm("-norun") || batchrun)
{ {

View file

@ -2186,7 +2186,7 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
{ {
Printf (PRINT_CHAT, "%s" TEXTCOLOR_CHAT ": %s" TEXTCOLOR_CHAT "\n", name, s); Printf (PRINT_CHAT, "%s" TEXTCOLOR_CHAT ": %s" TEXTCOLOR_CHAT "\n", name, s);
} }
S_Sound (CHAN_VOICE | CHAN_UI, gameinfo.chatSound, 1, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, gameinfo.chatSound, 1, ATTN_NONE);
} }
else if (players[player].userinfo.GetTeam() == players[consoleplayer].userinfo.GetTeam()) else if (players[player].userinfo.GetTeam() == players[consoleplayer].userinfo.GetTeam())
{ // Said only to members of the player's team { // Said only to members of the player's team
@ -2198,7 +2198,7 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
{ {
Printf (PRINT_TEAMCHAT, "(%s" TEXTCOLOR_TEAMCHAT "): %s" TEXTCOLOR_TEAMCHAT "\n", name, s); Printf (PRINT_TEAMCHAT, "(%s" TEXTCOLOR_TEAMCHAT "): %s" TEXTCOLOR_TEAMCHAT "\n", name, s);
} }
S_Sound (CHAN_VOICE | CHAN_UI, gameinfo.chatSound, 1, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, gameinfo.chatSound, 1, ATTN_NONE);
} }
} }
break; break;

View file

@ -363,7 +363,7 @@ CCMD (weapnext)
} }
if (SendItemUse != players[consoleplayer].ReadyWeapon) if (SendItemUse != players[consoleplayer].ReadyWeapon)
{ {
S_Sound(CHAN_AUTO, "misc/weaponchange", 1.0, ATTN_NONE); S_Sound(CHAN_AUTO, 0, "misc/weaponchange", 1.0, ATTN_NONE);
} }
} }
@ -389,7 +389,7 @@ CCMD (weapprev)
} }
if (SendItemUse != players[consoleplayer].ReadyWeapon) if (SendItemUse != players[consoleplayer].ReadyWeapon)
{ {
S_Sound(CHAN_AUTO, "misc/weaponchange", 1.0, ATTN_NONE); S_Sound(CHAN_AUTO, 0, "misc/weaponchange", 1.0, ATTN_NONE);
} }
} }

View file

@ -506,7 +506,7 @@ int P_CheckKeys (AActor *owner, int keynum, bool remote, bool quiet)
int snd = S_FindSkinnedSound(owner, failsound[i]); int snd = S_FindSkinnedSound(owner, failsound[i]);
if (snd != 0) if (snd != 0)
{ {
S_Sound (owner, CHAN_VOICE, snd, 1, ATTN_NORM); S_Sound (owner, CHAN_VOICE, 0, snd, 1, ATTN_NORM);
break; break;
} }
} }

View file

@ -170,7 +170,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
mBackground = TexMan.CheckForTexture(texname, ETextureType::MiscPatch); mBackground = TexMan.CheckForTexture(texname, ETextureType::MiscPatch);
mFlatfill = desc->mFlatfill; mFlatfill = desc->mFlatfill;
} }
S_Sound (CHAN_VOICE | CHAN_UI, desc->mSound, 1.0f, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, desc->mSound, 1.0f, ATTN_NONE);
mOverlays.Resize(desc->mOverlays.Size()); mOverlays.Resize(desc->mOverlays.Size());
for (unsigned i=0; i < mOverlays.Size(); i++) for (unsigned i=0; i < mOverlays.Size(); i++)
{ {
@ -500,7 +500,7 @@ void DIntermissionScreenCast::Init(FIntermissionAction *desc, bool first)
castattacking = false; castattacking = false;
if (mDefaults->SeeSound) if (mDefaults->SeeSound)
{ {
S_Sound (CHAN_VOICE | CHAN_UI, mDefaults->SeeSound, 1, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, mDefaults->SeeSound, 1, ATTN_NONE);
} }
} }
@ -526,11 +526,11 @@ int DIntermissionScreenCast::Responder (event_t *ev)
if (mClass->IsDescendantOf(NAME_PlayerPawn)) if (mClass->IsDescendantOf(NAME_PlayerPawn))
{ {
int snd = S_FindSkinnedSound(players[consoleplayer].mo, "*death"); int snd = S_FindSkinnedSound(players[consoleplayer].mo, "*death");
if (snd != 0) S_Sound (CHAN_VOICE | CHAN_UI, snd, 1, ATTN_NONE); if (snd != 0) S_Sound (CHAN_VOICE, CHANF_UI, snd, 1, ATTN_NONE);
} }
else if (mDefaults->DeathSound) else if (mDefaults->DeathSound)
{ {
S_Sound (CHAN_VOICE | CHAN_UI, mDefaults->DeathSound, 1, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, mDefaults->DeathSound, 1, ATTN_NONE);
} }
} }
return true; return true;
@ -547,7 +547,7 @@ void DIntermissionScreenCast::PlayAttackSound()
(caststate == basestate + mCastSounds[i].mIndex)) (caststate == basestate + mCastSounds[i].mIndex))
{ {
S_StopAllChannels (); S_StopAllChannels ();
S_Sound (CHAN_WEAPON | CHAN_UI, mCastSounds[i].mSound, 1, ATTN_NONE); S_Sound (CHAN_WEAPON, CHANF_UI, mCastSounds[i].mSound, 1, ATTN_NONE);
return; return;
} }
} }

View file

@ -373,7 +373,7 @@ void M_StartControlPanel (bool makeSound, bool scaleoverride)
if (makeSound) if (makeSound)
{ {
S_Sound (CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
} }
BackbuttonTime = 0; BackbuttonTime = 0;
BackbuttonAlpha = 0; BackbuttonAlpha = 0;
@ -1149,13 +1149,13 @@ EXTERN_CVAR (Int, screenblocks)
CCMD (sizedown) CCMD (sizedown)
{ {
screenblocks = screenblocks - 1; screenblocks = screenblocks - 1;
S_Sound (CHAN_VOICE | CHAN_UI, "menu/change", snd_menuvolume, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, "menu/change", snd_menuvolume, ATTN_NONE);
} }
CCMD (sizeup) CCMD (sizeup)
{ {
screenblocks = screenblocks + 1; screenblocks = screenblocks + 1;
S_Sound (CHAN_VOICE | CHAN_UI, "menu/change", snd_menuvolume, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, "menu/change", snd_menuvolume, ATTN_NONE);
} }
CCMD(menuconsole) CCMD(menuconsole)

View file

@ -116,7 +116,7 @@ CCMD (menu_quit)
{ {
if (gameinfo.quitSound.IsNotEmpty()) if (gameinfo.quitSound.IsNotEmpty())
{ {
S_Sound(CHAN_VOICE | CHAN_UI, gameinfo.quitSound, snd_menuvolume, ATTN_NONE); S_Sound(CHAN_VOICE, CHANF_UI, gameinfo.quitSound, snd_menuvolume, ATTN_NONE);
I_WaitVBL(105); I_WaitVBL(105);
} }
} }
@ -156,12 +156,12 @@ CCMD (menu_endgame)
{ // F7 { // F7
if (!usergame) if (!usergame)
{ {
S_Sound (CHAN_VOICE | CHAN_UI, "menu/invalid", snd_menuvolume, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, "menu/invalid", snd_menuvolume, ATTN_NONE);
return; return;
} }
//M_StartControlPanel (true); //M_StartControlPanel (true);
S_Sound (CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
ActivateEndGameMenu(); ActivateEndGameMenu();
} }
@ -176,7 +176,7 @@ CCMD (quicksave)
{ // F6 { // F6
if (!usergame || (players[consoleplayer].health <= 0 && !multiplayer)) if (!usergame || (players[consoleplayer].health <= 0 && !multiplayer))
{ {
S_Sound (CHAN_VOICE | CHAN_UI, "menu/invalid", snd_menuvolume, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, "menu/invalid", snd_menuvolume, ATTN_NONE);
return; return;
} }
@ -192,7 +192,7 @@ CCMD (quicksave)
if (savegameManager.quickSaveSlot == NULL || savegameManager.quickSaveSlot == (FSaveGameNode*)1) if (savegameManager.quickSaveSlot == NULL || savegameManager.quickSaveSlot == (FSaveGameNode*)1)
{ {
S_Sound(CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); S_Sound(CHAN_VOICE, CHANF_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
M_StartControlPanel(false); M_StartControlPanel(false);
M_SetMenu(NAME_Savegamemenu); M_SetMenu(NAME_Savegamemenu);
return; return;
@ -205,7 +205,7 @@ CCMD (quicksave)
return; return;
} }
S_Sound(CHAN_VOICE | CHAN_UI, "menu/activate", snd_menuvolume, ATTN_NONE); S_Sound(CHAN_VOICE, CHANF_UI, "menu/activate", snd_menuvolume, ATTN_NONE);
FString tempstring = GStrings("QSPROMPT"); FString tempstring = GStrings("QSPROMPT");
tempstring.Substitute("%s", savegameManager.quickSaveSlot->SaveTitle.GetChars()); tempstring.Substitute("%s", savegameManager.quickSaveSlot->SaveTitle.GetChars());
@ -213,7 +213,7 @@ CCMD (quicksave)
DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, false, NAME_None, []() DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, false, NAME_None, []()
{ {
G_SaveGame(savegameManager.quickSaveSlot->Filename.GetChars(), savegameManager.quickSaveSlot->SaveTitle.GetChars()); G_SaveGame(savegameManager.quickSaveSlot->Filename.GetChars(), savegameManager.quickSaveSlot->SaveTitle.GetChars());
S_Sound(CHAN_VOICE | CHAN_UI, "menu/dismiss", snd_menuvolume, ATTN_NONE); S_Sound(CHAN_VOICE, CHANF_UI, "menu/dismiss", snd_menuvolume, ATTN_NONE);
M_ClearMenus(); M_ClearMenus();
}); });
@ -258,7 +258,7 @@ CCMD (quickload)
DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, false, NAME_None, []() DMenu *newmenu = CreateMessageBoxMenu(CurrentMenu, tempstring, 0, false, NAME_None, []()
{ {
G_LoadGame(savegameManager.quickSaveSlot->Filename.GetChars()); G_LoadGame(savegameManager.quickSaveSlot->Filename.GetChars());
S_Sound(CHAN_VOICE | CHAN_UI, "menu/dismiss", snd_menuvolume, ATTN_NONE); S_Sound(CHAN_VOICE, CHANF_UI, "menu/dismiss", snd_menuvolume, ATTN_NONE);
M_ClearMenus(); M_ClearMenus();
}); });
M_ActivateMenu(newmenu); M_ActivateMenu(newmenu);

View file

@ -329,7 +329,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
if (pc->player == Level->GetConsolePlayer()) if (pc->player == Level->GetConsolePlayer())
{ {
S_Sound (CHAN_VOICE | CHAN_UI, gameinfo.chatSound, 1, ATTN_NONE); S_Sound (CHAN_VOICE, CHANF_UI, gameinfo.chatSound, 1, ATTN_NONE);
} }
npc->reactiontime = 2; npc->reactiontime = 2;
@ -380,7 +380,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
if (CurNode->SpeakerVoice != 0) if (CurNode->SpeakerVoice != 0)
{ {
I_SetMusicVolume (dlg_musicvolume); I_SetMusicVolume (dlg_musicvolume);
S_Sound (npc, CHAN_VOICE|CHAN_NOPAUSE, CurNode->SpeakerVoice, 1, ATTN_NORM); S_Sound (npc, CHAN_VOICE, CHANF_NOPAUSE, CurNode->SpeakerVoice, 1, ATTN_NORM);
} }
M_StartControlPanel(false, true); M_StartControlPanel(false, true);

View file

@ -585,7 +585,7 @@ void FParser::SF_Input(void)
void FParser::SF_Beep(void) void FParser::SF_Beep(void)
{ {
S_Sound(CHAN_AUTO, "misc/chat", 1.0f, ATTN_IDLE); S_Sound(CHAN_AUTO, 0, "misc/chat", 1.0f, ATTN_IDLE);
} }
//========================================================================== //==========================================================================
@ -1471,7 +1471,7 @@ void FParser::SF_StartSound(void)
if (mo) if (mo)
{ {
S_Sound(mo, CHAN_BODY, T_FindSound(stringvalue(t_argv[1])), 1, ATTN_NORM); S_Sound(mo, CHAN_BODY, 0, T_FindSound(stringvalue(t_argv[1])), 1, ATTN_NORM);
} }
} }
} }
@ -1497,7 +1497,7 @@ void FParser::SF_StartSectorSound(void)
while ((i = itr.Next()) >= 0) while ((i = itr.Next()) >= 0)
{ {
sector = &Level->sectors[i]; sector = &Level->sectors[i];
S_Sound(sector, CHAN_BODY, T_FindSound(stringvalue(t_argv[1])), 1.0f, ATTN_NORM); S_Sound(sector, CHAN_BODY, 0, T_FindSound(stringvalue(t_argv[1])), 1.0f, ATTN_NORM);
} }
} }
} }
@ -2812,7 +2812,7 @@ void FParser::SF_AmbientSound(void)
{ {
if (CheckArgs(1)) if (CheckArgs(1))
{ {
S_Sound(CHAN_AUTO, T_FindSound(stringvalue(t_argv[0])), 1, ATTN_NORM); S_Sound(CHAN_AUTO, 0, T_FindSound(stringvalue(t_argv[0])), 1, ATTN_NORM);
} }
} }
@ -2911,7 +2911,7 @@ void FParser::SF_SpawnExplosion()
{ {
spawn->ClearCounters(); spawn->ClearCounters();
t_return.value.i = spawn->SetState(spawn->FindState(NAME_Death)); t_return.value.i = spawn->SetState(spawn->FindState(NAME_Death));
if(spawn->DeathSound) S_Sound (spawn, CHAN_BODY, spawn->DeathSound, 1, ATTN_NORM); if(spawn->DeathSound) S_Sound (spawn, CHAN_BODY, 0, spawn->DeathSound, 1, ATTN_NORM);
} }
} }
} }
@ -3738,7 +3738,7 @@ void FParser::SF_SpawnShot2(void)
AActor *mo = Spawn(Level, pclass, source->PosPlusZ(z), ALLOW_REPLACE); AActor *mo = Spawn(Level, pclass, source->PosPlusZ(z), ALLOW_REPLACE);
if (mo) if (mo)
{ {
S_Sound(mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM); S_Sound(mo, CHAN_VOICE, 0, mo->SeeSound, 1, ATTN_NORM);
mo->target = source; mo->target = source;
mo->Angles.Yaw = source->Angles.Yaw; mo->Angles.Yaw = source->Angles.Yaw;
mo->Thrust(); mo->Thrust();

View file

@ -437,7 +437,7 @@ bool FLevelLocals::EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
// if the wrong side of door is pushed, give oof sound // if the wrong side of door is pushed, give oof sound
if (line->sidedef[1] == NULL) // killough if (line->sidedef[1] == NULL) // killough
{ {
S_Sound (thing, CHAN_VOICE, "*usefail", 1, ATTN_NORM); S_Sound (thing, CHAN_VOICE, 0, "*usefail", 1, ATTN_NORM);
return false; return false;
} }

View file

@ -176,7 +176,7 @@ void DLightningThinker::LightningFlash ()
} }
Level->flags |= LEVEL_SWAPSKIES; // set alternate sky Level->flags |= LEVEL_SWAPSKIES; // set alternate sky
S_Sound (CHAN_AUTO, "world/thunder", 1.0, ATTN_NONE); S_Sound (CHAN_AUTO, 0, "world/thunder", 1.0, ATTN_NONE);
// [ZZ] just in case // [ZZ] just in case
Level->localEventManager->WorldLightning(); Level->localEventManager->WorldLightning();
// start LIGHTNING scripts // start LIGHTNING scripts

View file

@ -115,7 +115,7 @@ void DEarthquake::Tick ()
if (!S_IsActorPlayingSomething (m_Spot, CHAN_BODY, m_QuakeSFX)) if (!S_IsActorPlayingSomething (m_Spot, CHAN_BODY, m_QuakeSFX))
{ {
S_Sound (m_Spot, CHAN_BODY | CHAN_LOOP, m_QuakeSFX, 1, ATTN_NORM); S_Sound (m_Spot, CHAN_BODY, CHANF_LOOP, m_QuakeSFX, 1, ATTN_NORM);
} }
if (m_DamageRadius > 0) if (m_DamageRadius > 0)

View file

@ -5910,13 +5910,14 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
} }
if (sid != 0) if (sid != 0)
{ {
// What a mess. I think it's a given that this was used with sound flags so it will forever be restricted to the original 8 channels.
if (!looping) if (!looping)
{ {
S_PlaySound(spot, chan, sid, vol, atten, !!local); S_PlaySound(spot, chan&7, EChanFlags::FromInt(chan&~7), sid, vol, atten, !!local);
} }
else if (!S_IsActorPlayingSomething(spot, chan & 7, sid)) else if (!S_IsActorPlayingSomething(spot, chan & 7, sid))
{ {
S_PlaySound(spot, chan | CHAN_LOOP, sid, vol, atten, !!local); S_PlaySound(spot, chan&7, EChanFlags::FromInt(chan & ~7)|CHANF_LOOP, sid, vol, atten, !!local);
} }
} }
} }
@ -8821,7 +8822,7 @@ scriptwait:
{ {
S_Sound ( S_Sound (
activationline->frontsector, activationline->frontsector,
CHAN_AUTO, // Not CHAN_AREA, because that'd probably break existing scripts. CHAN_AUTO, 0, // Not CHAN_AREA, because that'd probably break existing scripts.
lookup, lookup,
(float)(STACK(1)) / 127.f, (float)(STACK(1)) / 127.f,
ATTN_NORM); ATTN_NORM);
@ -8829,7 +8830,7 @@ scriptwait:
else else
{ {
S_Sound ( S_Sound (
CHAN_AUTO, CHAN_AUTO, 0,
lookup, lookup,
(float)(STACK(1)) / 127.f, (float)(STACK(1)) / 127.f,
ATTN_NORM); ATTN_NORM);
@ -8842,7 +8843,7 @@ scriptwait:
lookup = Level->Behaviors.LookupString (STACK(2)); lookup = Level->Behaviors.LookupString (STACK(2));
if (lookup != NULL) if (lookup != NULL)
{ {
S_Sound (CHAN_AUTO, S_Sound (CHAN_AUTO, 0,
lookup, lookup,
(float)(STACK(1)) / 127.f, ATTN_NONE); (float)(STACK(1)) / 127.f, ATTN_NONE);
} }
@ -8853,7 +8854,7 @@ scriptwait:
lookup = Level->Behaviors.LookupString (STACK(2)); lookup = Level->Behaviors.LookupString (STACK(2));
if (lookup != NULL && activator && activator->CheckLocalView()) if (lookup != NULL && activator && activator->CheckLocalView())
{ {
S_Sound (CHAN_AUTO, S_Sound (CHAN_AUTO, 0,
lookup, lookup,
(float)(STACK(1)) / 127.f, ATTN_NONE); (float)(STACK(1)) / 127.f, ATTN_NONE);
} }
@ -8866,13 +8867,13 @@ scriptwait:
{ {
if (activator != NULL) if (activator != NULL)
{ {
S_Sound (activator, CHAN_AUTO, S_Sound (activator, CHAN_AUTO, 0,
lookup, lookup,
(float)(STACK(1)) / 127.f, ATTN_NORM); (float)(STACK(1)) / 127.f, ATTN_NORM);
} }
else else
{ {
S_Sound (CHAN_AUTO, S_Sound (CHAN_AUTO, 0,
lookup, lookup,
(float)(STACK(1)) / 127.f, ATTN_NONE); (float)(STACK(1)) / 127.f, ATTN_NONE);
} }
@ -9040,7 +9041,7 @@ scriptwait:
while ( (spot = iterator.Next ()) ) while ( (spot = iterator.Next ()) )
{ {
S_Sound (spot, CHAN_AUTO, S_Sound (spot, CHAN_AUTO, 0,
lookup, lookup,
(float)(STACK(1))/127.f, ATTN_NORM); (float)(STACK(1))/127.f, ATTN_NORM);
} }

View file

@ -715,13 +715,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlaySoundEx)
if (!looping) if (!looping)
{ {
S_Sound (self, int(channel) - NAME_Auto, soundid, 1, attenuation); S_Sound (self, int(channel) - NAME_Auto, 0, soundid, 1, attenuation);
} }
else else
{ {
if (!S_IsActorPlayingSomething (self, int(channel) - NAME_Auto, soundid)) if (!S_IsActorPlayingSomething (self, int(channel) - NAME_Auto, soundid))
{ {
S_Sound (self, (int(channel) - NAME_Auto) | CHAN_LOOP, soundid, 1, attenuation); S_Sound (self, (int(channel) - NAME_Auto), CHANF_LOOP, soundid, 1, attenuation);
} }
} }
return 0; return 0;
@ -791,7 +791,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack)
DAngle slope = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE); DAngle slope = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, 0, self->AttackSound, 1, ATTN_NORM);
for (i = self->GetMissileDamage (0, 1); i > 0; --i) for (i = self->GetMissileDamage (0, 1); i > 0; --i)
{ {
DAngle angle = self->Angles.Yaw + pr_cabullet.Random2() * (5.625 / 256.); DAngle angle = self->Angles.Yaw + pr_cabullet.Random2() * (5.625 / 256.);
@ -1075,7 +1075,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomMeleeAttack)
if (self->CheckMeleeRange ()) if (self->CheckMeleeRange ())
{ {
if (meleesound) if (meleesound)
S_Sound (self, CHAN_WEAPON, meleesound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, 0, meleesound, 1, ATTN_NORM);
int newdam = P_DamageMobj (self->target, self, self, damage, damagetype); int newdam = P_DamageMobj (self->target, self, self, damage, damagetype);
if (bleed) if (bleed)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self); P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
@ -1083,7 +1083,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomMeleeAttack)
else else
{ {
if (misssound) if (misssound)
S_Sound (self, CHAN_WEAPON, misssound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, 0, misssound, 1, ATTN_NORM);
} }
return 0; return 0;
} }
@ -1112,7 +1112,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomComboAttack)
if (damagetype == NAME_None) if (damagetype == NAME_None)
damagetype = NAME_Melee; // Melee is the default type damagetype = NAME_Melee; // Melee is the default type
if (meleesound) if (meleesound)
S_Sound (self, CHAN_WEAPON, meleesound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, 0, meleesound, 1, ATTN_NORM);
int newdam = P_DamageMobj (self->target, self, self, damage, damagetype); int newdam = P_DamageMobj (self->target, self, self, damage, damagetype);
if (bleed) if (bleed)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self); P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
@ -3419,7 +3419,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WolfAttack)
} }
// And finally, let's play the sound // And finally, let's play the sound
S_Sound (self, CHAN_WEAPON, sound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, 0, sound, 1, ATTN_NORM);
return 0; return 0;
} }

View file

@ -656,7 +656,7 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
if (fabs(mo->X() - trail[0].start.X) < 20 && fabs(mo->Y() - trail[0].start.Y) < 20) if (fabs(mo->X() - trail[0].start.X) < 20 && fabs(mo->Y() - trail[0].start.Y) < 20)
{ // This player (probably) fired the railgun { // This player (probably) fired the railgun
S_Sound (mo, CHAN_WEAPON, sound, 1, ATTN_NORM); S_Sound (mo, CHAN_WEAPON, 0, sound, 1, ATTN_NORM);
} }
else else
{ {
@ -665,7 +665,7 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
{ {
if (shortest == NULL || shortest->sounddist > seg.sounddist) shortest = &seg; if (shortest == NULL || shortest->sounddist > seg.sounddist) shortest = &seg;
} }
S_Sound (source->Level, DVector3(shortest->soundpos, r_viewpoint.Pos.Z), CHAN_WEAPON, sound, 1, ATTN_NORM); S_Sound (source->Level, DVector3(shortest->soundpos, r_viewpoint.Pos.Z), CHAN_WEAPON, 0, sound, 1, ATTN_NORM);
} }
} }
} }

View file

@ -1848,11 +1848,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look)
{ {
if (self->flags2 & MF2_BOSS) if (self->flags2 & MF2_BOSS)
{ // full volume { // full volume
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NONE); S_Sound (self, CHAN_VOICE, 0, self->SeeSound, 1, ATTN_NONE);
} }
else else
{ {
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, 0, self->SeeSound, 1, ATTN_NORM);
} }
} }
@ -2030,11 +2030,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_LookEx)
{ {
if (flags & LOF_FULLVOLSEESOUND) if (flags & LOF_FULLVOLSEESOUND)
{ // full volume { // full volume
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NONE); S_Sound (self, CHAN_VOICE, 0, self->SeeSound, 1, ATTN_NONE);
} }
else else
{ {
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, 0, self->SeeSound, 1, ATTN_NORM);
} }
} }
@ -2456,7 +2456,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
if (meleestate && actor->CheckMeleeRange ()) if (meleestate && actor->CheckMeleeRange ())
{ {
if (actor->AttackSound) if (actor->AttackSound)
S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM); S_Sound (actor, CHAN_WEAPON, 0, actor->AttackSound, 1, ATTN_NORM);
actor->SetState (meleestate); actor->SetState (meleestate);
actor->flags &= ~MF_INCHASE; actor->flags &= ~MF_INCHASE;
@ -2717,7 +2717,7 @@ bool P_CheckForResurrection(AActor *self, bool usevilestates)
self->SetState(archvile->FindState(NAME_Heal)); self->SetState(archvile->FindState(NAME_Heal));
} }
} }
S_Sound(corpsehit, CHAN_BODY, "vile/raise", 1, ATTN_IDLE); S_Sound(corpsehit, CHAN_BODY, 0, "vile/raise", 1, ATTN_IDLE);
info = corpsehit->GetDefault(); info = corpsehit->GetDefault();
if (GetTranslationType(corpsehit->Translation) == TRANSLATION_Blood) if (GetTranslationType(corpsehit->Translation) == TRANSLATION_Blood)
@ -3025,11 +3025,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Pain)
sfx_id = pain_amount; sfx_id = pain_amount;
} }
S_Sound (self, CHAN_VOICE, sfx_id, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, 0, sfx_id, 1, ATTN_NORM);
} }
else if (self->PainSound) else if (self->PainSound)
{ {
S_Sound (self, CHAN_VOICE, self->PainSound, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, 0, self->PainSound, 1, ATTN_NORM);
} }
return 0; return 0;
} }

View file

@ -1415,7 +1415,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
} }
if (P_GiveBody(source, draindmg)) if (P_GiveBody(source, draindmg))
{ {
S_Sound(source, CHAN_ITEM, "*drainhealth", 1, ATTN_NORM); S_Sound(source, CHAN_ITEM, 0, "*drainhealth", 1, ATTN_NORM);
} }
} }
} }

View file

@ -2173,7 +2173,7 @@ FUNC(LS_UsePuzzleItem)
} }
// [RH] Say "hmm" if you don't have the puzzle item // [RH] Say "hmm" if you don't have the puzzle item
S_Sound (it, CHAN_VOICE, "*puzzfail", 1, ATTN_IDLE); S_Sound (it, CHAN_VOICE, 0, "*puzzfail", 1, ATTN_IDLE);
return false; return false;
} }
@ -3197,7 +3197,7 @@ FUNC(LS_SendToCommunicator)
{ {
S_StopSound (CHAN_VOICE); S_StopSound (CHAN_VOICE);
it->player->SetSubtitle(arg0, name); it->player->SetSubtitle(arg0, name);
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM); S_Sound (CHAN_VOICE, 0, name, 1, ATTN_NORM);
// Get the message from the LANGUAGE lump. // Get the message from the LANGUAGE lump.
FString msg; FString msg;

View file

@ -1526,7 +1526,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
{ // Ok to spawn blood { // Ok to spawn blood
P_RipperBlood(tm.thing, thing); P_RipperBlood(tm.thing, thing);
} }
S_Sound(tm.thing, CHAN_BODY, "misc/ripslop", 1, ATTN_IDLE); S_Sound(tm.thing, CHAN_BODY, 0, "misc/ripslop", 1, ATTN_IDLE);
// Do poisoning (if using new style poison) // Do poisoning (if using new style poison)
if (tm.thing->PoisonDamage > 0 && tm.thing->PoisonDuration != INT_MIN) if (tm.thing->PoisonDamage > 0 && tm.thing->PoisonDuration != INT_MIN)
@ -2841,7 +2841,7 @@ void FSlide::HitSlideLine(line_t* ld)
tmmove.Y /= 2; // absorb half the velocity tmmove.Y /= 2; // absorb half the velocity
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING)) if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
{ {
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff!// ^ S_Sound(slidemo, CHAN_VOICE, 0, "*grunt", 1, ATTN_IDLE); // oooff!// ^
} }
} // | } // |
else // phares else // phares
@ -2857,7 +2857,7 @@ void FSlide::HitSlideLine(line_t* ld)
tmmove.Y = -tmmove.Y / 2; tmmove.Y = -tmmove.Y / 2;
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING)) if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
{ {
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff! S_Sound(slidemo, CHAN_VOICE, 0, "*grunt", 1, ATTN_IDLE); // oooff!
} }
} }
else else
@ -2889,7 +2889,7 @@ void FSlide::HitSlideLine(line_t* ld)
movelen /= 2; // absorb movelen /= 2; // absorb
if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING)) if (slidemo->player && slidemo->health > 0 && !(slidemo->player->cheats & CF_PREDICTING))
{ {
S_Sound(slidemo, CHAN_VOICE, "*grunt", 1, ATTN_IDLE); // oooff! S_Sound(slidemo, CHAN_VOICE, 0, "*grunt", 1, ATTN_IDLE); // oooff!
} }
tmmove = moveangle.ToVector(movelen); tmmove = moveangle.ToVector(movelen);
} }
@ -4517,7 +4517,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
{ // hit nothing { // hit nothing
if (!nointeract && puffDefaults && puffDefaults->ActiveSound) if (!nointeract && puffDefaults && puffDefaults->ActiveSound)
{ // Play miss sound { // Play miss sound
S_Sound(t1, CHAN_WEAPON, puffDefaults->ActiveSound, 1, ATTN_NORM); S_Sound(t1, CHAN_WEAPON, 0, puffDefaults->ActiveSound, 1, ATTN_NORM);
} }
// [MC] LAF_NOINTERACT guarantees puff spawning and returns it directly to the calling function. // [MC] LAF_NOINTERACT guarantees puff spawning and returns it directly to the calling function.
@ -5466,7 +5466,7 @@ bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end,
if (usething->player) if (usething->player)
{ {
S_Sound(usething, CHAN_VOICE, "*usefail", 1, ATTN_IDLE); S_Sound(usething, CHAN_VOICE, 0, "*usefail", 1, ATTN_IDLE);
} }
return true; // can't use through a wall return true; // can't use through a wall
} }
@ -5583,7 +5583,7 @@ void P_UseLines(player_t *player)
if ((!sec->SecActTarget || !sec->TriggerSectorActions(player->mo, spac)) && if ((!sec->SecActTarget || !sec->TriggerSectorActions(player->mo, spac)) &&
P_NoWayTraverse(player->mo, start, end)) P_NoWayTraverse(player->mo, start, end))
{ {
S_Sound(player->mo, CHAN_VOICE, "*usefail", 1, ATTN_IDLE); S_Sound(player->mo, CHAN_VOICE, 0, "*usefail", 1, ATTN_IDLE);
} }
} }
} }
@ -6233,7 +6233,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos)
} }
if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound)) if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound))
{ {
S_Sound(thing, CHAN_VOICE, thing->CrushPainSound, 1.f, ATTN_NORM); S_Sound(thing, CHAN_VOICE, 0, thing->CrushPainSound, 1.f, ATTN_NORM);
} }
} }
} }

View file

@ -1194,7 +1194,7 @@ bool AActor::Grind(bool items)
SetState (state); SetState (state);
if (isgeneric) // Not a custom crush state, so colorize it appropriately. if (isgeneric) // Not a custom crush state, so colorize it appropriately.
{ {
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE); S_Sound (this, CHAN_BODY, 0, "misc/fallingsplat", 1, ATTN_IDLE);
Translation = BloodTranslation; Translation = BloodTranslation;
} }
return false; return false;
@ -1238,7 +1238,7 @@ bool AActor::Grind(bool items)
gib->radius = 0; gib->radius = 0;
gib->Translation = BloodTranslation; gib->Translation = BloodTranslation;
} }
S_Sound (this, CHAN_BODY, "misc/fallingsplat", 1, ATTN_IDLE); S_Sound (this, CHAN_BODY, 0, "misc/fallingsplat", 1, ATTN_IDLE);
} }
if (flags & MF_ICECORPSE) if (flags & MF_ICECORPSE)
{ {
@ -1437,7 +1437,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target, bool onsky, FNa
// play the sound before changing the state, so that AActor::OnDestroy can call S_RelinkSounds on it and the death state can override it. // play the sound before changing the state, so that AActor::OnDestroy can call S_RelinkSounds on it and the death state can override it.
if (mo->DeathSound) if (mo->DeathSound)
{ {
S_Sound (mo, CHAN_VOICE, mo->DeathSound, 1, S_Sound (mo, CHAN_VOICE, 0, mo->DeathSound, 1,
(mo->flags3 & MF3_FULLVOLDEATH) ? ATTN_NONE : ATTN_NORM); (mo->flags3 & MF3_FULLVOLDEATH) ? ATTN_NONE : ATTN_NORM);
} }
@ -1501,15 +1501,15 @@ void AActor::PlayBounceSound(bool onfloor)
{ {
if (BounceFlags & BOUNCE_UseSeeSound) if (BounceFlags & BOUNCE_UseSeeSound)
{ {
S_Sound (this, CHAN_VOICE, SeeSound, 1, ATTN_IDLE); S_Sound (this, CHAN_VOICE, 0, SeeSound, 1, ATTN_IDLE);
} }
else if (onfloor || WallBounceSound <= 0) else if (onfloor || WallBounceSound <= 0)
{ {
S_Sound (this, CHAN_VOICE, BounceSound, 1, ATTN_IDLE); S_Sound (this, CHAN_VOICE, 0, BounceSound, 1, ATTN_IDLE);
} }
else else
{ {
S_Sound (this, CHAN_VOICE, WallBounceSound, 1, ATTN_IDLE); S_Sound (this, CHAN_VOICE, 0, WallBounceSound, 1, ATTN_IDLE);
} }
} }
} }
@ -2786,14 +2786,14 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj)
// Why should this number vary by gravity? // Why should this number vary by gravity?
if (mo->Vel.Z < -mo->player->mo->FloatVar(NAME_GruntSpeed)) if (mo->Vel.Z < -mo->player->mo->FloatVar(NAME_GruntSpeed))
{ {
S_Sound (mo, CHAN_VOICE, "*grunt", 1, ATTN_NORM); S_Sound (mo, CHAN_VOICE, 0, "*grunt", 1, ATTN_NORM);
grunted = true; grunted = true;
} }
if (onmobj != NULL || !Terrains[P_GetThingFloorType (mo)].IsLiquid) if (onmobj != NULL || !Terrains[P_GetThingFloorType (mo)].IsLiquid)
{ {
if (!grunted || !S_AreSoundsEquivalent (mo, "*grunt", "*land")) if (!grunted || !S_AreSoundsEquivalent (mo, "*grunt", "*land"))
{ {
S_Sound (mo, CHAN_AUTO, "*land", 1, ATTN_NORM); S_Sound (mo, CHAN_AUTO, 0, "*land", 1, ATTN_NORM);
} }
} }
} }
@ -3107,7 +3107,7 @@ void AActor::Howl ()
FSoundID howl = SoundVar(NAME_HowlSound); FSoundID howl = SoundVar(NAME_HowlSound);
if (!S_IsActorPlayingSomething(this, CHAN_BODY, howl)) if (!S_IsActorPlayingSomething(this, CHAN_BODY, howl))
{ {
S_Sound (this, CHAN_BODY, howl, 1, ATTN_NORM); S_Sound (this, CHAN_BODY, 0, howl, 1, ATTN_NORM);
} }
} }
@ -3267,7 +3267,7 @@ void AActor::PlayActiveSound ()
{ {
if (ActiveSound && !S_IsActorPlayingSomething (this, CHAN_VOICE, -1)) if (ActiveSound && !S_IsActorPlayingSomething (this, CHAN_VOICE, -1))
{ {
S_Sound (this, CHAN_VOICE, ActiveSound, 1, S_Sound (this, CHAN_VOICE, 0, ActiveSound, 1,
(flags3 & MF3_FULLVOLACTIVE) ? ATTN_NONE : ATTN_IDLE); (flags3 & MF3_FULLVOLACTIVE) ? ATTN_NONE : ATTN_IDLE);
} }
} }
@ -4353,7 +4353,7 @@ bool AActor::UpdateWaterLevel(bool dosplash)
if (oldlevel < 3 && waterlevel == 3) if (oldlevel < 3 && waterlevel == 3)
{ {
// Our head just went under. // Our head just went under.
S_Sound(this, CHAN_VOICE, "*dive", 1, ATTN_NORM); S_Sound(this, CHAN_VOICE, 0, "*dive", 1, ATTN_NORM);
} }
else if (oldlevel == 3 && waterlevel < 3) else if (oldlevel == 3 && waterlevel < 3)
{ {
@ -4361,7 +4361,7 @@ bool AActor::UpdateWaterLevel(bool dosplash)
if (player->air_finished > Level->maptime) if (player->air_finished > Level->maptime)
{ {
// We hadn't run out of air yet. // We hadn't run out of air yet.
S_Sound(this, CHAN_VOICE, "*surface", 1, ATTN_NORM); S_Sound(this, CHAN_VOICE, 0, "*surface", 1, ATTN_NORM);
} }
// If we were running out of air, then ResetAirSupply() will play *gasp. // If we were running out of air, then ResetAirSupply() will play *gasp.
} }
@ -5669,11 +5669,11 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos1
if ((flags & PF_HITTHING) && puff->SeeSound) if ((flags & PF_HITTHING) && puff->SeeSound)
{ // Hit thing sound { // Hit thing sound
S_Sound (puff, CHAN_BODY, puff->SeeSound, 1, ATTN_NORM); S_Sound (puff, CHAN_BODY, 0, puff->SeeSound, 1, ATTN_NORM);
} }
else if (puff->AttackSound) else if (puff->AttackSound)
{ {
S_Sound (puff, CHAN_BODY, puff->AttackSound, 1, ATTN_NORM); S_Sound (puff, CHAN_BODY, 0, puff->AttackSound, 1, ATTN_NORM);
} }
} }
@ -6100,13 +6100,13 @@ foundone:
} }
if (mo) if (mo)
{ {
S_Sound(mo, CHAN_ITEM, smallsplash ? S_Sound(mo, CHAN_ITEM, 0, smallsplash ?
splash->SmallSplashSound : splash->NormalSplashSound, splash->SmallSplashSound : splash->NormalSplashSound,
1, ATTN_IDLE); 1, ATTN_IDLE);
} }
else else
{ {
S_Sound(thing->Level, pos, CHAN_ITEM, smallsplash ? S_Sound(thing->Level, pos, CHAN_ITEM, 0, smallsplash ?
splash->SmallSplashSound : splash->NormalSplashSound, splash->SmallSplashSound : splash->NormalSplashSound,
1, ATTN_IDLE); 1, ATTN_IDLE);
} }
@ -6303,18 +6303,18 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner)
{ {
if (!(missile->flags & MF_SPAWNSOUNDSOURCE)) if (!(missile->flags & MF_SPAWNSOUNDSOURCE))
{ {
S_Sound (missile, CHAN_VOICE, missile->SeeSound, 1, ATTN_NORM); S_Sound (missile, CHAN_VOICE, 0, missile->SeeSound, 1, ATTN_NORM);
} }
else if (spawner != NULL) else if (spawner != NULL)
{ {
S_Sound (spawner, CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM); S_Sound (spawner, CHAN_WEAPON, 0, missile->SeeSound, 1, ATTN_NORM);
} }
else else
{ {
// If there is no spawner use the spawn position. // If there is no spawner use the spawn position.
// But not in a silenced sector. // But not in a silenced sector.
if (!(missile->Sector->Flags & SECF_SILENT)) if (!(missile->Sector->Flags & SECF_SILENT))
S_Sound (missile->Level, missile->Pos(), CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM); S_Sound (missile->Level, missile->Pos(), CHAN_WEAPON, 0, missile->SeeSound, 1, ATTN_NORM);
} }
} }
} }

View file

@ -598,7 +598,7 @@ void P_GiveSecret(FLevelLocals *Level, AActor *actor, bool printmessage, bool pl
Printf(PRINT_NONOTIFY, "Secret found in sector %d\n", sectornum); Printf(PRINT_NONOTIFY, "Secret found in sector %d\n", sectornum);
} }
} }
if (playsound) S_Sound (CHAN_AUTO | CHAN_UI, "misc/secret", 1, ATTN_NORM); if (playsound) S_Sound (CHAN_AUTO, CHANF_UI, "misc/secret", 1, ATTN_NORM);
} }
} }
Level->found_secrets++; Level->found_secrets++;
@ -647,7 +647,7 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType)
} }
if (damage > 0 && Terrains[floorType].Splash != -1) if (damage > 0 && Terrains[floorType].Splash != -1)
{ {
S_Sound (player->mo, CHAN_AUTO, S_Sound (player->mo, CHAN_AUTO, 0,
Splashes[Terrains[floorType].Splash].NormalSplashSound, 1, Splashes[Terrains[floorType].Splash].NormalSplashSound, 1,
ATTN_IDLE); ATTN_IDLE);
} }

View file

@ -306,7 +306,7 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, uint8_t special, bool *q
} }
if (playsound) if (playsound)
{ {
S_Sound (side->GetLevel(), DVector3(pt, 0), CHAN_VOICE|CHAN_LISTENERZ, sound, 1, ATTN_STATIC); S_Sound (side->GetLevel(), DVector3(pt, 0), CHAN_VOICE, CHANF_LISTENERZ, sound, 1, ATTN_STATIC);
} }
if (quest != NULL) if (quest != NULL)
{ {
@ -402,7 +402,7 @@ void DActiveButton::Tick ()
if (def != NULL) if (def != NULL)
{ {
m_Frame = -1; m_Frame = -1;
S_Sound (Level, DVector3(m_Pos, 0), CHAN_VOICE|CHAN_LISTENERZ, S_Sound (Level, DVector3(m_Pos, 0), CHAN_VOICE, CHANF_LISTENERZ,
def->Sound != 0 ? FSoundID(def->Sound) : FSoundID("switches/normbutn"), def->Sound != 0 ? FSoundID(def->Sound) : FSoundID("switches/normbutn"),
1, ATTN_STATIC); 1, ATTN_STATIC);
bFlippable = false; bFlippable = false;

View file

@ -470,7 +470,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser, int flags)
if (!P_CanResurrect(raiser, thing)) if (!P_CanResurrect(raiser, thing))
return false; return false;
S_Sound (thing, CHAN_BODY, "vile/raise", 1, ATTN_IDLE); S_Sound (thing, CHAN_BODY, 0, "vile/raise", 1, ATTN_IDLE);
thing->Revive(); thing->Revive();

View file

@ -892,11 +892,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
{ {
if (self->DeathSound != 0) if (self->DeathSound != 0)
{ {
S_Sound (self, CHAN_VOICE, self->DeathSound, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, 0, self->DeathSound, 1, ATTN_NORM);
} }
else else
{ {
S_Sound (self, CHAN_VOICE, "*death", 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, 0, "*death", 1, ATTN_NORM);
} }
return 0; return 0;
} }
@ -946,7 +946,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
} }
} }
} }
S_Sound (self, chan, sound, 1, ATTN_NORM); S_Sound (self, chan, 0, sound, 1, ATTN_NORM);
return 0; return 0;
} }
@ -1094,7 +1094,7 @@ void P_FallingDamage (AActor *actor)
if (actor->player) if (actor->player)
{ {
S_Sound (actor, CHAN_AUTO, "*land", 1, ATTN_NORM); S_Sound (actor, CHAN_AUTO, 0, "*land", 1, ATTN_NORM);
P_NoiseAlert (actor, actor, true); P_NoiseAlert (actor, actor, true);
if (damage >= TELEFRAG_DAMAGE && ((actor->player->cheats & (CF_GODMODE | CF_BUDDHA) || if (damage >= TELEFRAG_DAMAGE && ((actor->player->cheats & (CF_GODMODE | CF_BUDDHA) ||
(actor->FindInventory(PClass::FindActor(NAME_PowerBuddha), true) != nullptr)))) (actor->FindInventory(PClass::FindActor(NAME_PowerBuddha), true) != nullptr))))
@ -1170,7 +1170,7 @@ void P_CheckEnvironment(player_t *player)
int id = S_FindSkinnedSound(player->mo, "*falling"); int id = S_FindSkinnedSound(player->mo, "*falling");
if (id != 0 && !S_IsActorPlayingSomething(player->mo, CHAN_VOICE, id)) if (id != 0 && !S_IsActorPlayingSomething(player->mo, CHAN_VOICE, id))
{ {
S_Sound(player->mo, CHAN_VOICE, id, 1, ATTN_NORM); S_Sound(player->mo, CHAN_VOICE, 0, id, 1, ATTN_NORM);
} }
} }
} }

View file

@ -174,6 +174,29 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_PlaySound, A_PlaySound)
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StartSound, A_StartSound)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_SOUND(soundid);
PARAM_INT(channel);
PARAM_INT(flags);
PARAM_FLOAT(volume);
PARAM_BOOL(looping);
PARAM_FLOAT(attenuation);
PARAM_BOOL(local);
PARAM_FLOAT(pitch);
A_StartSound(self, soundid, channel, flags, volume, looping, attenuation, local, pitch);
return 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, IsActorPlayingSomething, S_IsActorPlayingSomething)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(channel);
PARAM_SOUND(soundid);
ACTION_RETURN_BOOL(S_IsActorPlayingSomething(self, channel, soundid));
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckKeys, P_CheckKeys) DEFINE_ACTION_FUNCTION_NATIVE(AActor, CheckKeys, P_CheckKeys)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);

View file

@ -7,6 +7,32 @@
#include "tarray.h" #include "tarray.h"
#include "zmusic/sounddecoder.h" #include "zmusic/sounddecoder.h"
#include "../../libraries/music_common/fileio.h" #include "../../libraries/music_common/fileio.h"
#include "tflags.h"
enum EChanFlag
{
// modifier flags
CHANF_LISTENERZ = 8,
CHANF_MAYBE_LOCAL = 16,
CHANF_UI = 32, // Do not record sound in savegames.
CHANF_NOPAUSE = 64, // Do not pause this sound in menus.
CHANF_AREA = 128, // Sound plays from all around. Only valid with sector sounds.
CHANF_LOOP = 256,
CHANF_PICKUP = CHANF_MAYBE_LOCAL,
CHANF_IS3D = 1, // internal: Sound is 3D.
CHANF_EVICTED = 2, // internal: Sound was evicted.
CHANF_FORGETTABLE = 4, // internal: Forget channel data when sound stops.
CHANF_JUSTSTARTED = 512, // internal: Sound has not been updated yet.
CHANF_ABSTIME = 1024, // internal: Start time is absolute and does not depend on current time.
CHANF_VIRTUAL = 2048, // internal: Channel is currently virtual
CHANF_NOSTOP = 4096, // only for A_PlaySound. Does not start if channel is playing something.
CHANF_OVERLAP = 8192, // [MK] Does not stop any sounds in the channel and instead plays over them.
};
typedef TFlags<EChanFlag> EChanFlags;
DEFINE_TFLAGS_OPERATORS(EChanFlags)
class FileReader; class FileReader;
@ -111,7 +137,7 @@ struct FISoundChannel
float DistanceScale; float DistanceScale;
float DistanceSqr; float DistanceSqr;
bool ManualRolloff; bool ManualRolloff;
int ChanFlags; EChanFlags ChanFlags;
}; };

View file

@ -1669,7 +1669,7 @@ void OpenALSoundRenderer::ChannelPitch(FISoundChannel *chan, float pitch)
alDeferUpdatesSOFT(); alDeferUpdatesSOFT();
ALuint source = GET_PTRID(chan->SysChannel); ALuint source = GET_PTRID(chan->SysChannel);
if (WasInWater && !(chan->ChanFlags & CHAN_UI)) if (WasInWater && !(chan->ChanFlags & CHANF_UI))
alSourcef(source, AL_PITCH, MAX(pitch, 0.0001f)*PITCH_MULT); alSourcef(source, AL_PITCH, MAX(pitch, 0.0001f)*PITCH_MULT);
else else
alSourcef(source, AL_PITCH, MAX(pitch, 0.0001f)); alSourcef(source, AL_PITCH, MAX(pitch, 0.0001f));
@ -1947,7 +1947,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
while (schan) while (schan)
{ {
ALuint source = GET_PTRID(schan->SysChannel); ALuint source = GET_PTRID(schan->SysChannel);
if (source && !(schan->ChanFlags & CHAN_UI)) if (source && !(schan->ChanFlags & CHANF_UI))
{ {
alSourcei(source, AL_DIRECT_FILTER, EnvFilters[0]); alSourcei(source, AL_DIRECT_FILTER, EnvFilters[0]);
alSource3i(source, AL_AUXILIARY_SEND_FILTER, EnvSlot, 0, EnvFilters[1]); alSource3i(source, AL_AUXILIARY_SEND_FILTER, EnvSlot, 0, EnvFilters[1]);
@ -1960,7 +1960,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
while (schan) while (schan)
{ {
ALuint source = GET_PTRID(schan->SysChannel); ALuint source = GET_PTRID(schan->SysChannel);
if (source && !(schan->ChanFlags & CHAN_UI)) if (source && !(schan->ChanFlags & CHANF_UI))
alSourcef(source, AL_PITCH, schan->Pitch / 128.0f * PITCH_MULT); alSourcef(source, AL_PITCH, schan->Pitch / 128.0f * PITCH_MULT);
schan = schan->NextChan; schan = schan->NextChan;
} }
@ -1985,7 +1985,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
while (schan) while (schan)
{ {
ALuint source = GET_PTRID(schan->SysChannel); ALuint source = GET_PTRID(schan->SysChannel);
if (source && !(schan->ChanFlags & CHAN_UI)) if (source && !(schan->ChanFlags & CHANF_UI))
{ {
alSourcei(source, AL_DIRECT_FILTER, EnvFilters[0]); alSourcei(source, AL_DIRECT_FILTER, EnvFilters[0]);
alSource3i(source, AL_AUXILIARY_SEND_FILTER, EnvSlot, 0, EnvFilters[1]); alSource3i(source, AL_AUXILIARY_SEND_FILTER, EnvSlot, 0, EnvFilters[1]);
@ -1998,7 +1998,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
while (schan) while (schan)
{ {
ALuint source = GET_PTRID(schan->SysChannel); ALuint source = GET_PTRID(schan->SysChannel);
if (source && !(schan->ChanFlags & CHAN_UI)) if (source && !(schan->ChanFlags & CHANF_UI))
alSourcef(source, AL_PITCH, schan->Pitch / 128.0f); alSourcef(source, AL_PITCH, schan->Pitch / 128.0f);
schan = schan->NextChan; schan = schan->NextChan;
} }

View file

@ -1910,7 +1910,7 @@ DEFINE_ACTION_FUNCTION(AAmbientSound, Tick)
return 0; return 0;
FAmbientSound *ambient; FAmbientSound *ambient;
int loop = 0; EChanFlags loop = 0;
ambient = Ambients.CheckKey(self->args[0]); ambient = Ambients.CheckKey(self->args[0]);
if (ambient == NULL) if (ambient == NULL)
@ -1920,7 +1920,7 @@ DEFINE_ACTION_FUNCTION(AAmbientSound, Tick)
if ((ambient->type & CONTINUOUS) == CONTINUOUS) if ((ambient->type & CONTINUOUS) == CONTINUOUS)
{ {
loop = CHAN_LOOP; loop = CHANF_LOOP;
} }
if (ambient->sound != FSoundID(0)) if (ambient->sound != FSoundID(0))
@ -1937,7 +1937,7 @@ DEFINE_ACTION_FUNCTION(AAmbientSound, Tick)
// use the standard rolloff. // use the standard rolloff.
if ((self->args[2] | self->args[3]) == 0 || self->args[2] > self->args[3]) if ((self->args[2] | self->args[3]) == 0 || self->args[2] > self->args[3])
{ {
S_Sound(self, CHAN_BODY | loop, ambient->sound, usevol, ambient->attenuation); S_Sound(self, CHAN_BODY, loop, ambient->sound, usevol, ambient->attenuation);
} }
else else
{ {
@ -1948,7 +1948,7 @@ DEFINE_ACTION_FUNCTION(AAmbientSound, Tick)
min *= self->args[4]; min *= self->args[4];
max *= self->args[4]; max *= self->args[4];
} }
S_SoundMinMaxDist(self, CHAN_BODY | loop, ambient->sound, usevol, min, max); S_SoundMinMaxDist(self, CHAN_BODY, loop, ambient->sound, usevol, min, max);
} }
if (!loop) if (!loop)
{ {

View file

@ -278,14 +278,14 @@ void S_InitData()
// //
//========================================================================== //==========================================================================
void S_SoundPitch(int channel, FSoundID sound_id, float volume, float attenuation, float pitch) void S_SoundPitch(int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation, float pitch)
{ {
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, channel, sound_id, volume, attenuation, 0, pitch); soundEngine->StartSound(SOURCE_None, nullptr, nullptr, channel, flags, sound_id, volume, attenuation, 0, pitch);
} }
void S_Sound(int channel, FSoundID sound_id, float volume, float attenuation) void S_Sound(int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation)
{ {
soundEngine->StartSound (SOURCE_None, nullptr, nullptr, channel, sound_id, volume, attenuation, 0, 0.f); soundEngine->StartSound (SOURCE_None, nullptr, nullptr, channel, flags, sound_id, volume, attenuation, 0, 0.f);
} }
DEFINE_ACTION_FUNCTION(DObject, S_Sound) DEFINE_ACTION_FUNCTION(DObject, S_Sound)
@ -296,10 +296,24 @@ DEFINE_ACTION_FUNCTION(DObject, S_Sound)
PARAM_FLOAT(volume); PARAM_FLOAT(volume);
PARAM_FLOAT(attn); PARAM_FLOAT(attn);
PARAM_FLOAT(pitch); PARAM_FLOAT(pitch);
S_SoundPitch(channel, id, static_cast<float>(volume), static_cast<float>(attn), static_cast<float>(pitch)); S_SoundPitch(channel & 7, EChanFlags::FromInt(channel & ~7), id, static_cast<float>(volume), static_cast<float>(attn), static_cast<float>(pitch));
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION(DObject, S_StartSound)
{
PARAM_PROLOGUE;
PARAM_SOUND(id);
PARAM_INT(channel);
PARAM_INT(flags);
PARAM_FLOAT(volume);
PARAM_FLOAT(attn);
PARAM_FLOAT(pitch);
S_SoundPitch(channel, EChanFlags::FromInt(flags), id, static_cast<float>(volume), static_cast<float>(attn), static_cast<float>(pitch));
return 0;
}
//========================================================================== //==========================================================================
// //
// //
@ -324,12 +338,12 @@ FSoundID DoomSoundEngine::ResolveSound(const void * ent, int type, FSoundID soun
// //
//========================================================================== //==========================================================================
static bool VerifyActorSound(AActor* ent, FSoundID& sound_id, int& channel) static bool VerifyActorSound(AActor* ent, FSoundID& sound_id, int& channel, EChanFlags flags)
{ {
if (ent == nullptr || ent->Sector->Flags & SECF_SILENT || ent->Level != primaryLevel) if (ent == nullptr || ent->Sector->Flags & SECF_SILENT || ent->Level != primaryLevel)
return false; return false;
if ((channel & CHAN_MAYBE_LOCAL) && (compatflags & COMPATF_SILENTPICKUP)) if ((flags & CHANF_MAYBE_LOCAL) && (compatflags & COMPATF_SILENTPICKUP))
{ {
if (soundEngine->isListener(ent)) if (soundEngine->isListener(ent))
{ {
@ -351,15 +365,15 @@ static bool VerifyActorSound(AActor* ent, FSoundID& sound_id, int& channel)
// //
//========================================================================== //==========================================================================
void S_SoundPitchActor(AActor *ent, int channel, FSoundID sound_id, float volume, float attenuation, float pitch) void S_SoundPitchActor(AActor *ent, int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation, float pitch)
{ {
if (VerifyActorSound(ent, sound_id, channel)) if (VerifyActorSound(ent, sound_id, channel, flags))
soundEngine->StartSound (SOURCE_Actor, ent, nullptr, channel, sound_id, volume, attenuation, 0, pitch); soundEngine->StartSound (SOURCE_Actor, ent, nullptr, channel, flags, sound_id, volume, attenuation, 0, pitch);
} }
void S_Sound(AActor *ent, int channel, FSoundID sound_id, float volume, float attenuation) void S_Sound(AActor *ent, int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation)
{ {
S_SoundPitchActor(ent, channel, sound_id, volume, attenuation, 0.f); S_SoundPitchActor(ent, channel, flags, sound_id, volume, attenuation, 0.f);
} }
//========================================================================== //==========================================================================
@ -370,16 +384,16 @@ void S_Sound(AActor *ent, int channel, FSoundID sound_id, float volume, float at
// //
//========================================================================== //==========================================================================
void S_SoundMinMaxDist(AActor *ent, int channel, FSoundID sound_id, float volume, float mindist, float maxdist) void S_SoundMinMaxDist(AActor *ent, int channel, EChanFlags flags, FSoundID sound_id, float volume, float mindist, float maxdist)
{ {
if (VerifyActorSound(ent, sound_id, channel)) if (VerifyActorSound(ent, sound_id, channel, flags))
{ {
FRolloffInfo rolloff; FRolloffInfo rolloff;
rolloff.RolloffType = ROLLOFF_Linear; rolloff.RolloffType = ROLLOFF_Linear;
rolloff.MinDistance = mindist; rolloff.MinDistance = mindist;
rolloff.MaxDistance = maxdist; rolloff.MaxDistance = maxdist;
soundEngine->StartSound(SOURCE_Actor, ent, nullptr, channel, sound_id, volume, 1, &rolloff); soundEngine->StartSound(SOURCE_Actor, ent, nullptr, channel, flags, sound_id, volume, 1, &rolloff);
} }
} }
@ -389,10 +403,10 @@ void S_SoundMinMaxDist(AActor *ent, int channel, FSoundID sound_id, float volume
// //
//========================================================================== //==========================================================================
void S_Sound (const FPolyObj *poly, int channel, FSoundID sound_id, float volume, float attenuation) void S_Sound (const FPolyObj *poly, int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation)
{ {
if (poly->Level != primaryLevel) return; if (poly->Level != primaryLevel) return;
soundEngine->StartSound (SOURCE_Polyobj, poly, nullptr, channel, sound_id, volume, attenuation); soundEngine->StartSound (SOURCE_Polyobj, poly, nullptr, channel, flags, sound_id, volume, attenuation);
} }
//========================================================================== //==========================================================================
@ -401,12 +415,12 @@ void S_Sound (const FPolyObj *poly, int channel, FSoundID sound_id, float volume
// //
//========================================================================== //==========================================================================
void S_Sound(FLevelLocals *Level, const DVector3 &pos, int channel, FSoundID sound_id, float volume, float attenuation) void S_Sound(FLevelLocals *Level, const DVector3 &pos, int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation)
{ {
if (Level != primaryLevel) return; if (Level != primaryLevel) return;
// The sound system switches Y and Z around. // The sound system switches Y and Z around.
FVector3 p((float)pos.X, (float)pos.Z, (float)pos.Y); FVector3 p((float)pos.X, (float)pos.Z, (float)pos.Y);
soundEngine->StartSound (SOURCE_Unattached, nullptr, &p, channel, sound_id, volume, attenuation); soundEngine->StartSound (SOURCE_Unattached, nullptr, &p, channel, flags, sound_id, volume, attenuation);
} }
//========================================================================== //==========================================================================
@ -415,10 +429,10 @@ void S_Sound(FLevelLocals *Level, const DVector3 &pos, int channel, FSoundID sou
// //
//========================================================================== //==========================================================================
void S_Sound (const sector_t *sec, int channel, FSoundID sfxid, float volume, float attenuation) void S_Sound (const sector_t *sec, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation)
{ {
if (sec->Level != primaryLevel) return; if (sec->Level != primaryLevel) return;
soundEngine->StartSound (SOURCE_Sector, sec, nullptr, channel, sfxid, volume, attenuation); soundEngine->StartSound (SOURCE_Sector, sec, nullptr, channel, flags, sfxid, volume, attenuation);
} }
//========================================================================== //==========================================================================
@ -429,47 +443,52 @@ void S_Sound (const sector_t *sec, int channel, FSoundID sfxid, float volume, fl
// //
//========================================================================== //==========================================================================
void S_PlaySoundPitch(AActor *a, int chan, FSoundID sid, float vol, float atten, bool local, float pitch) void S_PlaySoundPitch(AActor *a, int chan, EChanFlags flags, FSoundID sid, float vol, float atten, bool local, float pitch)
{ {
if (a == nullptr || a->Sector->Flags & SECF_SILENT || a->Level != primaryLevel) if (a == nullptr || a->Sector->Flags & SECF_SILENT || a->Level != primaryLevel)
return; return;
if (!local) if (!local)
{ {
S_SoundPitchActor(a, chan, sid, vol, atten, pitch); S_SoundPitchActor(a, chan, flags, sid, vol, atten, pitch);
} }
else else
{ {
if (a->CheckLocalView()) if (a->CheckLocalView())
{ {
S_SoundPitch(chan, sid, vol, ATTN_NONE, pitch); S_SoundPitch(chan, flags, sid, vol, ATTN_NONE, pitch);
} }
} }
} }
void S_PlaySound(AActor *a, int chan, FSoundID sid, float vol, float atten, bool local) void S_PlaySound(AActor *a, int chan, EChanFlags flags, FSoundID sid, float vol, float atten, bool local)
{ {
S_PlaySoundPitch(a, chan, sid, vol, atten, local, 0.f); S_PlaySoundPitch(a, chan, flags, sid, vol, atten, local, 0.f);
} }
void A_PlaySound(AActor *self, int soundid, int channel, double volume, int looping, double attenuation, int local, double pitch) void A_StartSound(AActor *self, int soundid, int channel, int flags, double volume, int looping, double attenuation, int local, double pitch)
{ {
if (!looping) if (!looping)
{ {
if (!(channel & CHAN_NOSTOP) || !S_IsActorPlayingSomething(self, channel & 7, soundid)) if (!(flags & CHANF_NOSTOP) || !S_IsActorPlayingSomething(self, channel & 7, soundid))
{ {
S_PlaySoundPitch(self, channel, soundid, (float)volume, (float)attenuation, local, (float)pitch); S_PlaySoundPitch(self, channel, EChanFlags::FromInt(flags), soundid, (float)volume, (float)attenuation, local, (float)pitch);
} }
} }
else else
{ {
if (!S_IsActorPlayingSomething(self, channel & 7, soundid)) if (!S_IsActorPlayingSomething(self, channel & 7, soundid))
{ {
S_PlaySoundPitch(self, channel | CHAN_LOOP, soundid, (float)volume, (float)attenuation, local, (float)pitch); S_PlaySoundPitch(self, channel, EChanFlags::FromInt(flags) | CHANF_LOOP, soundid, (float)volume, (float)attenuation, local, (float)pitch);
} }
} }
} }
void A_PlaySound(AActor* self, int soundid, int channel, double volume, int looping, double attenuation, int local, double pitch)
{
A_StartSound(self, soundid, channel & 7, channel & ~7, volume, looping, attenuation, local, pitch);
}
//========================================================================== //==========================================================================
// //
@ -576,7 +595,7 @@ bool S_GetSoundPlayingInfo (const FPolyObj *poly, int sound_id)
// //
//========================================================================== //==========================================================================
bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id) int S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id)
{ {
if (compatflags & COMPATF_MAGICSILENCE) if (compatflags & COMPATF_MAGICSILENCE)
{ {
@ -728,7 +747,7 @@ void S_SerializeSounds(FSerializer &arc)
chan = (FSoundChan*)soundEngine->GetChannel(nullptr); chan = (FSoundChan*)soundEngine->GetChannel(nullptr);
arc(nullptr, *chan); arc(nullptr, *chan);
// Sounds always start out evicted when restored from a save. // Sounds always start out evicted when restored from a save.
chan->ChanFlags |= CHAN_EVICTED | CHAN_ABSTIME; chan->ChanFlags |= CHANF_EVICTED | CHANF_ABSTIME;
} }
arc.EndArray(); arc.EndArray();
} }
@ -902,7 +921,7 @@ void DoomSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
sector_t* sec = primaryLevel->PointInSector(pt[0], pt[2]); sector_t* sec = primaryLevel->PointInSector(pt[0], pt[2]);
DVector2 disp = primaryLevel->Displacements.getOffset(pgroup, sec->PortalGroup); DVector2 disp = primaryLevel->Displacements.getOffset(pgroup, sec->PortalGroup);
pos->X = pt[0] - (float)disp.X; pos->X = pt[0] - (float)disp.X;
pos->Y = !(chanflags & CHAN_LISTENERZ) ? pt[1] : (float)listenpos.Z; pos->Y = !(chanflags & CHANF_LISTENERZ) ? pt[1] : (float)listenpos.Z;
pos->Z = pt[2] - (float)disp.Y; pos->Z = pt[2] - (float)disp.Y;
} }
else else
@ -939,7 +958,7 @@ void DoomSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
if (sector != nullptr) if (sector != nullptr)
{ {
DVector2 disp = primaryLevel->Displacements.getOffset(pgroup, sector->PortalGroup); DVector2 disp = primaryLevel->Displacements.getOffset(pgroup, sector->PortalGroup);
if (chanflags & CHAN_AREA) if (chanflags & CHANF_AREA)
{ {
// listener must be reversely offset to calculate the proper sound origin. // listener must be reversely offset to calculate the proper sound origin.
CalcSectorSoundOrg(listenpos + disp, sector, channum, *pos); CalcSectorSoundOrg(listenpos + disp, sector, channum, *pos);
@ -951,7 +970,7 @@ void DoomSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
pos->X = (float)(sector->centerspot.X - disp.X); pos->X = (float)(sector->centerspot.X - disp.X);
pos->Z = (float)(sector->centerspot.Y - disp.Y); pos->Z = (float)(sector->centerspot.Y - disp.Y);
chanflags |= CHAN_LISTENERZ; chanflags |= CHANF_LISTENERZ;
} }
} }
break; break;
@ -972,7 +991,7 @@ void DoomSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
} }
} }
if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != nullptr) if ((chanflags & CHANF_LISTENERZ) && players[consoleplayer].camera != nullptr)
{ {
pos->Y = (float)listenpos.Z; pos->Y = (float)listenpos.Z;
} }
@ -1108,14 +1127,14 @@ void DoomSoundEngine::NoiseDebug()
char temp[32]; char temp[32];
SoundEngine::CalcPosVel(chan, &origin, nullptr); SoundEngine::CalcPosVel(chan, &origin, nullptr);
color = (chan->ChanFlags & CHAN_LOOP) ? CR_BROWN : CR_GREY; color = (chan->ChanFlags & CHANF_LOOP) ? CR_BROWN : CR_GREY;
// Name // Name
Wads.GetLumpName(temp, S_sfx[chan->SoundID].lumpnum); Wads.GetLumpName(temp, S_sfx[chan->SoundID].lumpnum);
temp[8] = 0; temp[8] = 0;
screen->DrawText(NewConsoleFont, color, 0, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 0, y, temp, TAG_DONE);
if (!(chan->ChanFlags & CHAN_IS3D)) if (!(chan->ChanFlags & CHANF_IS3D))
{ {
screen->DrawText(NewConsoleFont, color, 70, y, "---", TAG_DONE); // X screen->DrawText(NewConsoleFont, color, 70, y, "---", TAG_DONE); // X
screen->DrawText(NewConsoleFont, color, 120, y, "---", TAG_DONE); // Y screen->DrawText(NewConsoleFont, color, 120, y, "---", TAG_DONE); // Y
@ -1162,15 +1181,15 @@ void DoomSoundEngine::NoiseDebug()
// Flags // Flags
mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE%sV", mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE%sV",
(chan->ChanFlags & CHAN_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_UI) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_UI) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_MAYBE_LOCAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_MAYBE_LOCAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_NOPAUSE) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_NOPAUSE) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHANF_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK); (chan->ChanFlags & CHANF_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK);
screen->DrawText(NewConsoleFont, color, 380, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 380, y, temp, TAG_DONE);
// Audibility // Audibility
@ -1266,7 +1285,7 @@ CCMD (playsound)
} }
else else
{ {
S_Sound (CHAN_AUTO | CHAN_UI, id, 1.f, ATTN_NONE); S_Sound (CHAN_AUTO, CHANF_UI, id, 1.f, ATTN_NONE);
} }
} }
} }
@ -1291,7 +1310,7 @@ CCMD (loopsound)
AActor *icon = Spawn(primaryLevel, "SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32.), ALLOW_REPLACE); AActor *icon = Spawn(primaryLevel, "SpeakerIcon", players[consoleplayer].mo->PosPlusZ(32.), ALLOW_REPLACE);
if (icon != nullptr) if (icon != nullptr)
{ {
S_Sound(icon, CHAN_BODY | CHAN_LOOP, id, 1.f, ATTN_IDLE); S_Sound(icon, CHAN_BODY, CHANF_LOOP, id, 1.f, ATTN_IDLE);
} }
} }
} }

View file

@ -16,21 +16,21 @@ void S_SetSoundPaused(int state);
void S_PrecacheLevel(FLevelLocals* l); void S_PrecacheLevel(FLevelLocals* l);
// Start sound for thing at <ent> // Start sound for thing at <ent>
void S_Sound(int channel, FSoundID sfxid, float volume, float attenuation); void S_Sound(int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
void S_SoundPitch(int channel, FSoundID sfxid, float volume, float attenuation, float pitch); void S_SoundPitch(int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation, float pitch);
void S_Sound (AActor *ent, int channel, FSoundID sfxid, float volume, float attenuation); void S_Sound (AActor *ent, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
void S_SoundMinMaxDist (AActor *ent, int channel, 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, 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, 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(FLevelLocals *Level, const DVector3 &pos, int channel, FSoundID sfxid, float volume, float attenuation); void S_Sound(FLevelLocals *Level, const DVector3 &pos, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation);
void S_SoundPitchActor (AActor *ent, int channel, FSoundID sfxid, float volume, float attenuation, float pitch); void S_SoundPitchActor (AActor *ent, int channel, EChanFlags flags, FSoundID sfxid, float volume, float attenuation, float pitch);
// [Nash] Used by ACS and DECORATE // [Nash] Used by ACS and DECORATE
void S_PlaySound(AActor *a, int chan, FSoundID sid, float vol, float atten, bool local); void S_PlaySound(AActor *a, int chan, EChanFlags flags, FSoundID sid, float vol, float atten, bool local);
void S_PlaySoundPitch(AActor *a, int chan, FSoundID sid, float vol, float atten, bool local, float pitch); void S_PlaySoundPitch(AActor *a, int chan, EChanFlags flags, FSoundID sid, float vol, float atten, bool local, float pitch);
// Stops a sound emanating from one of an emitter's channels. // Stops a sound emanating from one of an emitter's channels.
void S_StopSound (AActor *ent, int channel); void S_StopSound (AActor *ent, int channel);
@ -45,7 +45,7 @@ bool S_GetSoundPlayingInfo (const AActor *actor, int sound_id);
bool S_GetSoundPlayingInfo (const sector_t *sector, int sound_id); bool S_GetSoundPlayingInfo (const sector_t *sector, int sound_id);
bool S_GetSoundPlayingInfo (const FPolyObj *poly, int sound_id); bool S_GetSoundPlayingInfo (const FPolyObj *poly, int sound_id);
bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id); int S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id);
// Change a playing sound's volume // Change a playing sound's volume
void S_ChangeActorSoundVolume(AActor *actor, int channel, double volume); void S_ChangeActorSoundVolume(AActor *actor, int channel, double volume);
@ -57,6 +57,7 @@ void S_ChangeActorSoundPitch(AActor *actor, int channel, double pitch);
void S_SerializeSounds(FSerializer &arc); void S_SerializeSounds(FSerializer &arc);
void A_PlaySound(AActor *self, int soundid, int channel, double volume, int looping, double attenuation, int local, double pitch); void A_PlaySound(AActor *self, int soundid, int channel, double volume, int looping, double attenuation, int local, double pitch);
void A_StartSound(AActor* self, int soundid, int flags, int channel, double volume, int looping, double attenuation, int local, double pitch);
static void S_SetListener(AActor *listenactor); static void S_SetListener(AActor *listenactor);
void S_SoundReset(); void S_SoundReset();
void S_ResumeSound(bool state); void S_ResumeSound(bool state);

View file

@ -118,7 +118,7 @@ public:
void Serialize(FSerializer &arc); void Serialize(FSerializer &arc);
void MakeSound(int loop, FSoundID id) void MakeSound(int loop, FSoundID id)
{ {
S_Sound(m_Actor, CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten); S_Sound(m_Actor, CHAN_BODY, EChanFlags::FromInt(loop), id, clamp(m_Volume, 0.f, 1.f), m_Atten);
} }
bool IsPlaying() bool IsPlaying()
{ {
@ -146,7 +146,7 @@ public:
void Serialize(FSerializer &arc); void Serialize(FSerializer &arc);
void MakeSound(int loop, FSoundID id) void MakeSound(int loop, FSoundID id)
{ {
S_Sound (m_Poly, CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten); S_Sound (m_Poly, CHAN_BODY, EChanFlags::FromInt(loop), id, clamp(m_Volume, 0.f, 1.f), m_Atten);
} }
bool IsPlaying() bool IsPlaying()
{ {
@ -174,8 +174,8 @@ public:
void Serialize(FSerializer &arc); void Serialize(FSerializer &arc);
void MakeSound(int loop, FSoundID id) void MakeSound(int loop, FSoundID id)
{ {
Channel = (Channel & 7) | CHAN_AREA | loop; // The Channel here may have CHANF_LOOP encoded into it.
S_Sound(m_Sector, Channel, id, clamp(m_Volume, 0.f, 1.f), m_Atten); S_Sound(m_Sector, Channel & 7, CHANF_AREA | EChanFlags::FromInt(loop| (Channel & ~7)), id, clamp(m_Volume, 0.f, 1.f), m_Atten);
} }
bool IsPlaying() bool IsPlaying()
{ {
@ -1162,7 +1162,7 @@ bool SN_IsMakingLoopingSound (sector_t *sector)
DSeqNode *next = node->NextSequence(); DSeqNode *next = node->NextSequence();
if (node->Source() == (void *)sector) if (node->Source() == (void *)sector)
{ {
return !!(static_cast<DSeqSectorNode *>(node)->Channel & CHAN_LOOP); return !!(static_cast<DSeqSectorNode *>(node)->Channel & CHANF_LOOP);
} }
node = next; node = next;
} }
@ -1222,7 +1222,7 @@ void DSeqNode::Tick ()
{ {
// Does not advance sequencePtr, so it will repeat as necessary. // Does not advance sequencePtr, so it will repeat as necessary.
m_CurrentSoundID = FSoundID(GetData(*m_SequencePtr)); m_CurrentSoundID = FSoundID(GetData(*m_SequencePtr));
MakeSound (CHAN_LOOP, m_CurrentSoundID); MakeSound (CHANF_LOOP, m_CurrentSoundID);
} }
return; return;

View file

@ -5,6 +5,15 @@
#include "dobject.h" #include "dobject.h"
#include "s_sound.h" #include "s_sound.h"
enum
{
// Sound channel aliases for sound sequences.
CHAN_CEILING = CHAN_WEAPON,
CHAN_FLOOR = CHAN_VOICE,
CHAN_INTERIOR = CHAN_ITEM,
CHAN_FULLHEIGHT = CHAN_BODY,
};
typedef enum { typedef enum {
SEQ_PLATFORM, SEQ_PLATFORM,
SEQ_DOOR, SEQ_DOOR,

View file

@ -285,7 +285,7 @@ TArray<FSoundChan*> SoundEngine::AllActiveChannels()
// If the sound is forgettable, this is as good a time as // If the sound is forgettable, this is as good a time as
// any to forget about it. And if it's a UI sound, it shouldn't // any to forget about it. And if it's a UI sound, it shouldn't
// be stored in the savegame. // be stored in the savegame.
if (!(chan->ChanFlags & (CHAN_FORGETTABLE | CHAN_UI))) if (!(chan->ChanFlags & (CHANF_FORGETTABLE | CHANF_UI)))
{ {
chans.Push(chan); chans.Push(chan);
} }
@ -306,7 +306,7 @@ FString SoundEngine::ListSoundChannels()
int count = 0; int count = 0;
for (chan = Channels; chan != nullptr; chan = chan->NextChan) for (chan = Channels; chan != nullptr; chan = chan->NextChan)
{ {
if (!(chan->ChanFlags & CHAN_EVICTED)) if (!(chan->ChanFlags & CHANF_EVICTED))
{ {
FVector3 chanorigin; FVector3 chanorigin;
@ -376,11 +376,11 @@ FSoundID SoundEngine::ResolveSound(const void *, int, FSoundID soundid, float &a
//========================================================================== //==========================================================================
FSoundChan *SoundEngine::StartSound(int type, const void *source, FSoundChan *SoundEngine::StartSound(int type, const void *source,
const FVector3 *pt, int channel, FSoundID sound_id, float volume, float attenuation, const FVector3 *pt, int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation,
FRolloffInfo *forcedrolloff, float spitch) FRolloffInfo *forcedrolloff, float spitch)
{ {
sfxinfo_t *sfx; sfxinfo_t *sfx;
int chanflags; EChanFlags chanflags = flags;
int basepriority; int basepriority;
int org_id; int org_id;
int pitch; int pitch;
@ -396,7 +396,6 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
if (type == SOURCE_Unattached && pt == nullptr) type = SOURCE_None; if (type == SOURCE_Unattached && pt == nullptr) type = SOURCE_None;
org_id = sound_id; org_id = sound_id;
chanflags = channel & ~7;
channel &= 7; channel &= 7;
CalcPosVel(type, source, &pt->X, channel, chanflags, sound_id, &pos, &vel); CalcPosVel(type, source, &pt->X, channel, chanflags, sound_id, &pos, &vel);
@ -461,7 +460,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
// If this is a singular sound, don't play it if it's already playing. // If this is a singular sound, don't play it if it's already playing.
if (sfx->bSingular && CheckSingular(sound_id)) if (sfx->bSingular && CheckSingular(sound_id))
{ {
chanflags |= CHAN_EVICTED; chanflags |= CHANF_EVICTED;
} }
// If the sound is unpositioned or comes from the listener, it is // If the sound is unpositioned or comes from the listener, it is
@ -475,13 +474,13 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
// that's what would happen. (Does this really need the SOURCE_Actor restriction?) // that's what would happen. (Does this really need the SOURCE_Actor restriction?)
if (near_limit > 0 && CheckSoundLimit(sfx, pos, near_limit, limit_range, type, type == SOURCE_Actor? source : nullptr, channel)) if (near_limit > 0 && CheckSoundLimit(sfx, pos, near_limit, limit_range, type, type == SOURCE_Actor? source : nullptr, channel))
{ {
chanflags |= CHAN_EVICTED; chanflags |= CHANF_EVICTED;
} }
// If the sound is blocked and not looped, return now. If the sound // If the sound is blocked and not looped, return now. If the sound
// is blocked and looped, pretend to play it so that it can // is blocked and looped, pretend to play it so that it can
// eventually play for real. // eventually play for real.
if ((chanflags & (CHAN_EVICTED | CHAN_LOOP)) == CHAN_EVICTED) if ((chanflags & (CHANF_EVICTED | CHANF_LOOP)) == CHANF_EVICTED)
{ {
return NULL; return NULL;
} }
@ -531,7 +530,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
} }
// If this actor is already playing something on the selected channel, stop it. // If this actor is already playing something on the selected channel, stop it.
if (type != SOURCE_None && ((source == NULL && channel != CHAN_AUTO) || (source != NULL && IsChannelUsed(type, source, channel, &seen)))) if (!(chanflags & CHANF_OVERLAP) && type != SOURCE_None && ((source == NULL && channel != CHAN_AUTO) || (source != NULL && IsChannelUsed(type, source, channel, &seen))))
{ {
for (chan = Channels; chan != NULL; chan = chan->NextChan) for (chan = Channels; chan != NULL; chan = chan->NextChan)
{ {
@ -552,7 +551,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
// sound is paused and a non-looped sound is being started. // sound is paused and a non-looped sound is being started.
// Such a sound would play right after unpausing which wouldn't sound right. // Such a sound would play right after unpausing which wouldn't sound right.
if (!(chanflags & CHAN_LOOP) && !(chanflags & (CHAN_UI|CHAN_NOPAUSE)) && SoundPaused) if (!(chanflags & CHANF_LOOP) && !(chanflags & (CHANF_UI|CHANF_NOPAUSE)) && SoundPaused)
{ {
return NULL; return NULL;
} }
@ -567,17 +566,17 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
pitch = DEFAULT_PITCH; pitch = DEFAULT_PITCH;
} }
if (chanflags & CHAN_EVICTED) if (chanflags & CHANF_EVICTED)
{ {
chan = NULL; chan = NULL;
} }
else else
{ {
int startflags = 0; int startflags = 0;
if (chanflags & CHAN_LOOP) startflags |= SNDF_LOOP; if (chanflags & CHANF_LOOP) startflags |= SNDF_LOOP;
if (chanflags & CHAN_AREA) startflags |= SNDF_AREA; if (chanflags & CHANF_AREA) startflags |= SNDF_AREA;
if (chanflags & (CHAN_UI|CHAN_NOPAUSE)) startflags |= SNDF_NOPAUSE; if (chanflags & (CHANF_UI|CHANF_NOPAUSE)) startflags |= SNDF_NOPAUSE;
if (chanflags & CHAN_UI) startflags |= SNDF_NOREVERB; if (chanflags & CHANF_UI) startflags |= SNDF_NOREVERB;
if (attenuation > 0) if (attenuation > 0)
{ {
@ -589,19 +588,19 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
chan = (FSoundChan*)GSnd->StartSound (sfx->data, float(volume), pitch, startflags, NULL); chan = (FSoundChan*)GSnd->StartSound (sfx->data, float(volume), pitch, startflags, NULL);
} }
} }
if (chan == NULL && (chanflags & CHAN_LOOP)) if (chan == NULL && (chanflags & CHANF_LOOP))
{ {
chan = (FSoundChan*)GetChannel(NULL); chan = (FSoundChan*)GetChannel(NULL);
GSnd->MarkStartTime(chan); GSnd->MarkStartTime(chan);
chanflags |= CHAN_EVICTED; chanflags |= CHANF_EVICTED;
} }
if (attenuation > 0) if (attenuation > 0)
{ {
chanflags |= CHAN_IS3D | CHAN_JUSTSTARTED; chanflags |= CHANF_IS3D | CHANF_JUSTSTARTED;
} }
else else
{ {
chanflags |= CHAN_LISTENERZ | CHAN_JUSTSTARTED; chanflags |= CHANF_LISTENERZ | CHANF_JUSTSTARTED;
} }
if (chan != NULL) if (chan != NULL)
{ {
@ -642,7 +641,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
void SoundEngine::RestartChannel(FSoundChan *chan) void SoundEngine::RestartChannel(FSoundChan *chan)
{ {
assert(chan->ChanFlags & CHAN_EVICTED); assert(chan->ChanFlags & CHANF_EVICTED);
FSoundChan *ochan; FSoundChan *ochan;
sfxinfo_t *sfx = &S_sfx[chan->SoundID]; sfxinfo_t *sfx = &S_sfx[chan->SoundID];
@ -660,15 +659,15 @@ void SoundEngine::RestartChannel(FSoundChan *chan)
return; return;
} }
int oldflags = chan->ChanFlags; EChanFlags oldflags = chan->ChanFlags;
int startflags = 0; int startflags = 0;
if (chan->ChanFlags & CHAN_LOOP) startflags |= SNDF_LOOP; if (chan->ChanFlags & CHANF_LOOP) startflags |= SNDF_LOOP;
if (chan->ChanFlags & CHAN_AREA) startflags |= SNDF_AREA; if (chan->ChanFlags & CHANF_AREA) startflags |= SNDF_AREA;
if (chan->ChanFlags & (CHAN_UI|CHAN_NOPAUSE)) startflags |= SNDF_NOPAUSE; if (chan->ChanFlags & (CHANF_UI|CHANF_NOPAUSE)) startflags |= SNDF_NOPAUSE;
if (chan->ChanFlags & CHAN_ABSTIME) startflags |= SNDF_ABSTIME; if (chan->ChanFlags & CHANF_ABSTIME) startflags |= SNDF_ABSTIME;
if (chan->ChanFlags & CHAN_IS3D) if (chan->ChanFlags & CHANF_IS3D)
{ {
FVector3 pos, vel; FVector3 pos, vel;
@ -687,13 +686,13 @@ void SoundEngine::RestartChannel(FSoundChan *chan)
} }
LoadSound3D(sfx, &SoundBuffer); LoadSound3D(sfx, &SoundBuffer);
chan->ChanFlags &= ~(CHAN_EVICTED|CHAN_ABSTIME); chan->ChanFlags &= ~(CHANF_EVICTED|CHANF_ABSTIME);
ochan = (FSoundChan*)GSnd->StartSound3D(sfx->data3d, &listener, chan->Volume, &chan->Rolloff, chan->DistanceScale, chan->Pitch, ochan = (FSoundChan*)GSnd->StartSound3D(sfx->data3d, &listener, chan->Volume, &chan->Rolloff, chan->DistanceScale, chan->Pitch,
chan->Priority, pos, vel, chan->EntChannel, startflags, chan); chan->Priority, pos, vel, chan->EntChannel, startflags, chan);
} }
else else
{ {
chan->ChanFlags &= ~(CHAN_EVICTED|CHAN_ABSTIME); chan->ChanFlags &= ~(CHANF_EVICTED|CHANF_ABSTIME);
ochan = (FSoundChan*)GSnd->StartSound(sfx->data, chan->Volume, chan->Pitch, startflags, chan); ochan = (FSoundChan*)GSnd->StartSound(sfx->data, chan->Volume, chan->Pitch, startflags, chan);
} }
assert(ochan == NULL || ochan == chan); assert(ochan == NULL || ochan == chan);
@ -884,7 +883,7 @@ bool SoundEngine::CheckSoundLimit(sfxinfo_t *sfx, const FVector3 &pos, int near_
for (chan = Channels, count = 0; chan != NULL && count < near_limit; chan = chan->NextChan) for (chan = Channels, count = 0; chan != NULL && count < near_limit; chan = chan->NextChan)
{ {
if (!(chan->ChanFlags & CHAN_EVICTED) && &S_sfx[chan->SoundID] == sfx) if (!(chan->ChanFlags & CHANF_EVICTED) && &S_sfx[chan->SoundID] == sfx)
{ {
FVector3 chanorigin; FVector3 chanorigin;
@ -1015,7 +1014,7 @@ void SoundEngine::RelinkSound (int sourcetype, const void *from, const void *to,
{ {
chan->Source = to; chan->Source = to;
} }
else if (!(chan->ChanFlags & CHAN_LOOP) && optpos) else if (!(chan->ChanFlags & CHANF_LOOP) && optpos)
{ {
chan->Source = NULL; chan->Source = NULL;
chan->SourceType = SOURCE_Unattached; chan->SourceType = SOURCE_Unattached;
@ -1183,15 +1182,15 @@ void SoundEngine::EvictAllChannels()
{ {
next = chan->NextChan; next = chan->NextChan;
if (!(chan->ChanFlags & CHAN_EVICTED)) if (!(chan->ChanFlags & CHANF_EVICTED))
{ {
chan->ChanFlags |= CHAN_EVICTED; chan->ChanFlags |= CHANF_EVICTED;
if (chan->SysChannel != NULL) if (chan->SysChannel != NULL)
{ {
if (!(chan->ChanFlags & CHAN_ABSTIME)) if (!(chan->ChanFlags & CHANF_ABSTIME))
{ {
chan->StartTime = GSnd ? GSnd->GetPosition(chan) : 0; chan->StartTime = GSnd ? GSnd->GetPosition(chan) : 0;
chan->ChanFlags |= CHAN_ABSTIME; chan->ChanFlags |= CHANF_ABSTIME;
} }
StopChannel(chan); StopChannel(chan);
} }
@ -1215,22 +1214,22 @@ void SoundEngine::RestoreEvictedChannel(FSoundChan *chan)
return; return;
} }
RestoreEvictedChannel(chan->NextChan); RestoreEvictedChannel(chan->NextChan);
if (chan->ChanFlags & CHAN_EVICTED) if (chan->ChanFlags & CHANF_EVICTED)
{ {
RestartChannel(chan); RestartChannel(chan);
if (!(chan->ChanFlags & CHAN_LOOP)) if (!(chan->ChanFlags & CHANF_LOOP))
{ {
if (chan->ChanFlags & CHAN_EVICTED) if (chan->ChanFlags & CHANF_EVICTED)
{ // Still evicted and not looping? Forget about it. { // Still evicted and not looping? Forget about it.
ReturnChannel(chan); ReturnChannel(chan);
} }
else if (!(chan->ChanFlags & CHAN_JUSTSTARTED)) else if (!(chan->ChanFlags & CHANF_JUSTSTARTED))
{ // Should this sound become evicted again, it's okay to forget about it. { // Should this sound become evicted again, it's okay to forget about it.
chan->ChanFlags |= CHAN_FORGETTABLE; chan->ChanFlags |= CHANF_FORGETTABLE;
} }
} }
} }
else if (chan->SysChannel == NULL && (chan->ChanFlags & (CHAN_FORGETTABLE | CHAN_LOOP)) == CHAN_FORGETTABLE) else if (chan->SysChannel == NULL && (chan->ChanFlags & (CHANF_FORGETTABLE | CHANF_LOOP)) == CHANF_FORGETTABLE)
{ {
ReturnChannel(chan); ReturnChannel(chan);
} }
@ -1264,16 +1263,16 @@ void SoundEngine::UpdateSounds(int time)
for (FSoundChan* chan = Channels; chan != NULL; chan = chan->NextChan) for (FSoundChan* chan = Channels; chan != NULL; chan = chan->NextChan)
{ {
if ((chan->ChanFlags & (CHAN_EVICTED | CHAN_IS3D)) == CHAN_IS3D) if ((chan->ChanFlags & (CHANF_EVICTED | CHANF_IS3D)) == CHANF_IS3D)
{ {
CalcPosVel(chan, &pos, &vel); CalcPosVel(chan, &pos, &vel);
if (ValidatePosVel(chan, pos, vel)) if (ValidatePosVel(chan, pos, vel))
{ {
GSnd->UpdateSoundParams3D(&listener, chan, !!(chan->ChanFlags & CHAN_AREA), pos, vel); GSnd->UpdateSoundParams3D(&listener, chan, !!(chan->ChanFlags & CHANF_AREA), pos, vel);
} }
} }
chan->ChanFlags &= ~CHAN_JUSTSTARTED; chan->ChanFlags &= ~CHANF_JUSTSTARTED;
} }
GSnd->UpdateListener(&listener); GSnd->UpdateListener(&listener);
@ -1342,11 +1341,11 @@ void SoundEngine::ChannelEnded(FISoundChannel *ichan)
// it wasn't evicted. Otherwise, if it's looping, it must have // it wasn't evicted. Otherwise, if it's looping, it must have
// been evicted. If it's not looping, then it was evicted if it // been evicted. If it's not looping, then it was evicted if it
// didn't reach the end of its playback. // didn't reach the end of its playback.
if (schan->ChanFlags & CHAN_FORGETTABLE) if (schan->ChanFlags & CHANF_FORGETTABLE)
{ {
evicted = false; evicted = false;
} }
else if (schan->ChanFlags & (CHAN_LOOP | CHAN_EVICTED)) else if (schan->ChanFlags & (CHANF_LOOP | CHANF_EVICTED))
{ {
evicted = true; evicted = true;
} }
@ -1356,7 +1355,7 @@ void SoundEngine::ChannelEnded(FISoundChannel *ichan)
unsigned int len = GSnd->GetSampleLength(S_sfx[schan->SoundID].data); unsigned int len = GSnd->GetSampleLength(S_sfx[schan->SoundID].data);
if (pos == 0) if (pos == 0)
{ {
evicted = !!(schan->ChanFlags & CHAN_JUSTSTARTED); evicted = !!(schan->ChanFlags & CHANF_JUSTSTARTED);
} }
else else
{ {
@ -1369,7 +1368,7 @@ void SoundEngine::ChannelEnded(FISoundChannel *ichan)
} }
else else
{ {
schan->ChanFlags |= CHAN_EVICTED; schan->ChanFlags |= CHANF_EVICTED;
schan->SysChannel = NULL; schan->SysChannel = NULL;
} }
} }
@ -1386,11 +1385,11 @@ void SoundEngine::ChannelVirtualChanged(FISoundChannel *ichan, bool is_virtual)
FSoundChan *schan = static_cast<FSoundChan*>(ichan); FSoundChan *schan = static_cast<FSoundChan*>(ichan);
if (is_virtual) if (is_virtual)
{ {
schan->ChanFlags |= CHAN_VIRTUAL; schan->ChanFlags |= CHANF_VIRTUAL;
} }
else else
{ {
schan->ChanFlags &= ~CHAN_VIRTUAL; schan->ChanFlags &= ~CHANF_VIRTUAL;
} }
} }
@ -1409,9 +1408,9 @@ void SoundEngine::StopChannel(FSoundChan *chan)
{ {
// S_EvictAllChannels() will set the CHAN_EVICTED flag to indicate // S_EvictAllChannels() will set the CHAN_EVICTED flag to indicate
// that it wants to keep all the channel information around. // that it wants to keep all the channel information around.
if (!(chan->ChanFlags & CHAN_EVICTED)) if (!(chan->ChanFlags & CHANF_EVICTED))
{ {
chan->ChanFlags |= CHAN_FORGETTABLE; chan->ChanFlags |= CHANF_FORGETTABLE;
if (chan->SourceType == SOURCE_Actor) if (chan->SourceType == SOURCE_Actor)
{ {
chan->Source = NULL; chan->Source = NULL;

View file

@ -194,43 +194,20 @@ struct FSoundChan : public FISoundChannel
// CHAN_BODY is for generic body sounds // CHAN_BODY is for generic body sounds
// CHAN_PICKUP can optionally be set as a local sound only for "compatibility" // CHAN_PICKUP can optionally be set as a local sound only for "compatibility"
enum enum EChannel
{ {
CHAN_AUTO = 0, CHAN_AUTO = 0,
CHAN_WEAPON = 1, CHAN_WEAPON = 1,
CHAN_VOICE = 2, CHAN_VOICE = 2,
CHAN_ITEM = 3, CHAN_ITEM = 3,
CHAN_BODY = 4, CHAN_BODY = 4,
CHAN_5 = 5, CHAN_5 = 5,
CHAN_6 = 6, CHAN_6 = 6,
CHAN_7 = 7, CHAN_7 = 7,
// Channel alias for sector sounds. These define how listener height is
// used when calculating 3D sound volume.
CHAN_FLOOR = 1, // Sound comes from the floor.
CHAN_CEILING = 2, // Sound comes from the ceiling.
CHAN_FULLHEIGHT = 3, // Sound comes entire height of the sector.
CHAN_INTERIOR = 4, // Sound comes height between floor and ceiling.
// modifier flags
CHAN_LISTENERZ = 8,
CHAN_MAYBE_LOCAL = 16,
CHAN_UI = 32, // Do not record sound in savegames.
CHAN_NOPAUSE = 64, // Do not pause this sound in menus.
CHAN_AREA = 128, // Sound plays from all around. Only valid with sector sounds.
CHAN_LOOP = 256,
CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL),
CHAN_IS3D = 1, // internal: Sound is 3D.
CHAN_EVICTED = 2, // internal: Sound was evicted.
CHAN_FORGETTABLE = 4, // internal: Forget channel data when sound stops.
CHAN_JUSTSTARTED = 512, // internal: Sound has not been updated yet.
CHAN_ABSTIME = 1024, // internal: Start time is absolute and does not depend on current time.
CHAN_VIRTUAL = 2048, // internal: Channel is currently virtual
CHAN_NOSTOP = 4096, // only for A_PlaySound. Does not start if channel is playing something.
}; };
// sound attenuation values // sound attenuation values
#define ATTN_NONE 0.f // full volume the entire level #define ATTN_NONE 0.f // full volume the entire level
#define ATTN_NORM 1.f #define ATTN_NORM 1.f
@ -329,7 +306,7 @@ public:
void UpdateSounds(int time); void UpdateSounds(int time);
FSoundChan* StartSound(int sourcetype, const void* source, FSoundChan* StartSound(int sourcetype, const void* source,
const FVector3* pt, int channel, FSoundID sound_id, float volume, float attenuation, FRolloffInfo* rolloff = nullptr, float spitch = 0.0f); const FVector3* pt, int channel, EChanFlags flags, FSoundID sound_id, float volume, float attenuation, FRolloffInfo* rolloff = nullptr, float spitch = 0.0f);
// Stops an origin-less sound from playing from this channel. // Stops an origin-less sound from playing from this channel.
void StopSoundID(int sound_id); void StopSoundID(int sound_id);

View file

@ -511,7 +511,7 @@ void FHexenStartupScreen::Progress()
y = ST_PROGRESS_Y; y = ST_PROGRESS_Y;
ST_Util_DrawBlock(StartupBitmap, NotchBits, x, y, ST_NOTCH_WIDTH / 2, ST_NOTCH_HEIGHT); ST_Util_DrawBlock(StartupBitmap, NotchBits, x, y, ST_NOTCH_WIDTH / 2, ST_NOTCH_HEIGHT);
} }
S_Sound(CHAN_BODY, "StartupTick", 1, ATTN_NONE); S_Sound(CHAN_BODY, 0, "StartupTick", 1, ATTN_NONE);
} }
} }
I_GetEvent(); I_GetEvent();
@ -539,7 +539,7 @@ void FHexenStartupScreen::NetProgress(int count)
y = ST_NETPROGRESS_Y; y = ST_NETPROGRESS_Y;
ST_Util_DrawBlock(StartupBitmap, NetNotchBits, x, y, ST_NETNOTCH_WIDTH / 2, ST_NETNOTCH_HEIGHT); ST_Util_DrawBlock(StartupBitmap, NetNotchBits, x, y, ST_NETNOTCH_WIDTH / 2, ST_NETNOTCH_HEIGHT);
} }
S_Sound(CHAN_BODY, "misc/netnotch", 1, ATTN_NONE); S_Sound(CHAN_BODY, 0, "misc/netnotch", 1, ATTN_NONE);
I_GetEvent(); I_GetEvent();
} }
} }
@ -554,7 +554,7 @@ void FHexenStartupScreen::NetProgress(int count)
void FHexenStartupScreen::NetDone() void FHexenStartupScreen::NetDone()
{ {
S_Sound(CHAN_BODY, "PickupWeapon", 1, ATTN_NORM); S_Sound(CHAN_BODY, 0, "PickupWeapon", 1, ATTN_NORM);
FGraphicalStartupScreen::NetDone(); FGraphicalStartupScreen::NetDone();
} }

View file

@ -1054,13 +1054,15 @@ class Actor : Thinker native
deprecated("2.3") native void A_BulletAttack(); deprecated("2.3") native void A_BulletAttack();
native void A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", double snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, double runspeed = 160.0, class<Actor> pufftype = "BulletPuff"); native void A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", double snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, double runspeed = 160.0, class<Actor> pufftype = "BulletPuff");
native clearscope void A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, double volume = 1.0, bool looping = false, double attenuation = ATTN_NORM, bool local = false, double pitch = 0.0); /*deprecated("4.3")*/ native clearscope void A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, double volume = 1.0, bool looping = false, double attenuation = ATTN_NORM, bool local = false, double pitch = 0.0);
native clearscope void A_StartSound(sound whattoplay, int slot, int flags = 0, double volume = 1.0, bool looping = false, double attenuation = ATTN_NORM, bool local = false, double pitch = 0.0);
native void A_SoundVolume(int slot, double volume); native void A_SoundVolume(int slot, double volume);
native void A_SoundPitch(int slot, double pitch); native void A_SoundPitch(int slot, double pitch);
deprecated("2.3") void A_PlayWeaponSound(sound whattoplay) { A_PlaySound(whattoplay, CHAN_WEAPON); } deprecated("2.3") void A_PlayWeaponSound(sound whattoplay) { A_StartSound(whattoplay, CHAN_WEAPON); }
native void A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was... native void A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was...
deprecated("2.3") native void A_PlaySoundEx(sound whattoplay, name slot, bool looping = false, int attenuation = 0); deprecated("2.3") native void A_PlaySoundEx(sound whattoplay, name slot, bool looping = false, int attenuation = 0);
deprecated("2.3") native void A_StopSoundEx(name slot); deprecated("2.3") native void A_StopSoundEx(name slot);
native bool IsActorPlayingSomething(int channel, Sound snd = 0);
native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10);
native action state A_Jump(int chance, statelabel label, ...); native action state A_Jump(int chance, statelabel label, ...);
native Actor A_SpawnProjectile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET); native Actor A_SpawnProjectile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET);

View file

@ -444,7 +444,8 @@ class Object native
{ {
return level.PickPlayerStart(pnum, flags); return level.PickPlayerStart(pnum, flags);
} }
native static void S_Sound (Sound sound_id, int channel, float volume = 1, float attenuation = ATTN_NORM, float pitch = 0.0); deprecated("4.3") native static void S_Sound (Sound sound_id, int channel, float volume = 1, float attenuation = ATTN_NORM, float pitch = 0.0);
native static void S_StartSound (Sound sound_id, int flags, int channel, float volume = 1, float attenuation = ATTN_NORM, float pitch = 0.0);
native static void S_PauseSound (bool notmusic, bool notsfx); native static void S_PauseSound (bool notmusic, bool notsfx);
native static void S_ResumeSound (bool notsfx); native static void S_ResumeSound (bool notsfx);
native static bool S_ChangeMusic(String music_name, int order = 0, bool looping = true, bool force = false); native static bool S_ChangeMusic(String music_name, int order = 0, bool looping = true, bool force = false);

View file

@ -419,7 +419,8 @@ enum ESoundFlags
CHAN_NOPAUSE = 64, CHAN_NOPAUSE = 64,
CHAN_LOOP = 256, CHAN_LOOP = 256,
CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL), CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL),
CHAN_NOSTOP = 4096 CHAN_NOSTOP = 4096,
CHAN_OVERLAP = 8192,
}; };

View file

@ -241,7 +241,7 @@ class ColorpickerMenu : OptionMenu
{ {
mGridPosX = cell_x; mGridPosX = cell_x;
mGridPosY = cell_y; mGridPosY = cell_y;
//S_Sound (CHAN_VOICE | CHAN_UI, "menu/cursor", snd_menuvolume, ATTN_NONE); //S_Sound (CHAN_VOICE, CHANF_UI, "menu/cursor", snd_menuvolume, ATTN_NONE);
} }
mDesc.mSelectedItem = mStartItem+7; mDesc.mSelectedItem = mStartItem+7;
if (type == MOUSE_Release) if (type == MOUSE_Release)

View file

@ -383,7 +383,7 @@ class ConversationMenu : Menu
} }
if (sel != -1 && sel != mSelection) if (sel != -1 && sel != mSelection)
{ {
//S_Sound (CHAN_VOICE | CHAN_UI, "menu/cursor", snd_menuvolume, ATTN_NONE); //S_Sound (CHAN_VOICE, CHANF_UI, "menu/cursor", snd_menuvolume, ATTN_NONE);
} }
mSelection = sel; mSelection = sel;
if (type == MOUSE_Release) if (type == MOUSE_Release)

View file

@ -304,7 +304,7 @@ class MessageBoxMenu : Menu
} }
if (sel != -1 && sel != messageSelection) if (sel != -1 && sel != messageSelection)
{ {
//S_Sound (CHAN_VOICE | CHAN_UI, "menu/cursor", snd_menuvolume, ATTN_NONE); //S_Sound (CHAN_VOICE, CHANF_UI, "menu/cursor", snd_menuvolume, ATTN_NONE);
} }
messageSelection = sel; messageSelection = sel;
if (type == MOUSE_Release) if (type == MOUSE_Release)

View file

@ -393,7 +393,7 @@ class OptionMenu : Menu
if (yline != mDesc.mSelectedItem) if (yline != mDesc.mSelectedItem)
{ {
mDesc.mSelectedItem = yline; mDesc.mSelectedItem = yline;
//S_Sound (CHAN_VOICE | CHAN_UI, "menu/cursor", snd_menuvolume, ATTN_NONE); //S_Sound (CHAN_VOICE, CHANF_UI, "menu/cursor", snd_menuvolume, ATTN_NONE);
} }
mDesc.mItems[yline].MouseEvent(type, x, y); mDesc.mItems[yline].MouseEvent(type, x, y);
return true; return true;