mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- Removed the S_Sound() variant that allows for pointing the origin at an
arbitrary point. It has been replaced with a variant that takes a polyobject as a source, since that was the only use that couldn't be rewritten with the other variants. This also fixes the bug that polyobject sounds were not successfully saved and caused a crash when reloading the game. Note that this is a significant change to how equality of sound sources is determined, so some things may not behave quite the same as before. (Which would be a bug, but hopefully everything still sounds the same.) SVN r1059 (trunk)
This commit is contained in:
parent
601a6ad04c
commit
a3e8a0cefd
39 changed files with 477 additions and 255 deletions
|
@ -1,4 +1,12 @@
|
||||||
June 30, 2008
|
June 30, 2008
|
||||||
|
- Removed the S_Sound() variant that allows for pointing the origin at an
|
||||||
|
arbitrary point. It has been replaced with a variant that takes a polyobject
|
||||||
|
as a source, since that was the only use that couldn't be rewritten with the
|
||||||
|
other variants. This also fixes the bug that polyobject sounds were not
|
||||||
|
successfully saved and caused a crash when reloading the game. Note that
|
||||||
|
this is a significant change to how equality of sound sources is determined,
|
||||||
|
so some things may not behave quite the same as before. (Which would be a
|
||||||
|
bug, but hopefully everything still sounds the same.)
|
||||||
- Adjusted the noise debug table so that fractional volume levels do not
|
- Adjusted the noise debug table so that fractional volume levels do not
|
||||||
run into the adjacent columns.
|
run into the adjacent columns.
|
||||||
- Added a NullSoundRenderer so that most of the checks against a NULL GSnd
|
- Added a NullSoundRenderer so that most of the checks against a NULL GSnd
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "a_doomglobal.h"
|
#include "a_doomglobal.h"
|
||||||
|
|
||||||
static FRandom pr_botdofire ("BotDoFire");
|
static FRandom pr_botdofire ("BotDoFire");
|
||||||
|
|
|
@ -62,7 +62,6 @@
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "d_gui.h"
|
#include "d_gui.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "vectors.h"
|
|
||||||
|
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "thingdef/thingdef.h"
|
#include "thingdef/thingdef.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "dobject.h"
|
#include "dobject.h"
|
||||||
#include "r_translate.h"
|
#include "r_translate.h"
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "zstring.h"
|
#include "zstring.h"
|
||||||
#include "name.h"
|
#include "name.h"
|
||||||
|
#include "vectors.h"
|
||||||
|
|
||||||
// Since this file is included by everything, it seems an appropriate place
|
// Since this file is included by everything, it seems an appropriate place
|
||||||
// to check the NOASM/USEASM macros.
|
// to check the NOASM/USEASM macros.
|
||||||
|
|
|
@ -349,7 +349,7 @@ void F_Ticker ()
|
||||||
}
|
}
|
||||||
else if (FinaleStage == 5 && FinaleCount > FinaleEndCount)
|
else if (FinaleStage == 5 && FinaleCount > FinaleEndCount)
|
||||||
{
|
{
|
||||||
S_StopSound ((fixed_t *)NULL, CHAN_VOICE);
|
S_StopSound (CHAN_VOICE);
|
||||||
F_AdvanceSlideshow ();
|
F_AdvanceSlideshow ();
|
||||||
FinaleCount = 0;
|
FinaleCount = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,6 @@
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "m_menu.h"
|
#include "m_menu.h"
|
||||||
#include "statnums.h"
|
#include "statnums.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "sbarinfo.h"
|
#include "sbarinfo.h"
|
||||||
#include "r_translate.h"
|
#include "r_translate.h"
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "vectors.h"
|
|
||||||
|
|
||||||
class ADoomBuilderCamera : public AActor
|
class ADoomBuilderCamera : public AActor
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
#include "vectors.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
== InterpolationPoint: node along a camera's path
|
== InterpolationPoint: node along a camera's path
|
||||||
|
|
|
@ -385,7 +385,7 @@ void A_AcolyteDie (AActor *self)
|
||||||
|
|
||||||
players[0].mo->GiveInventoryType (QuestItemClasses[6]);
|
players[0].mo->GiveInventoryType (QuestItemClasses[6]);
|
||||||
players[0].SetLogNumber (14);
|
players[0].SetLogNumber (14);
|
||||||
S_StopSound ((fixed_t *)NULL, CHAN_VOICE);
|
S_StopSound (CHAN_VOICE);
|
||||||
S_Sound (CHAN_VOICE, "svox/voc14", 1, ATTN_NORM);
|
S_Sound (CHAN_VOICE, "svox/voc14", 1, ATTN_NORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "p_enemy.h"
|
#include "p_enemy.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "vectors.h"
|
|
||||||
|
|
||||||
static FRandom pr_atk1 ("FooMelee");
|
static FRandom pr_atk1 ("FooMelee");
|
||||||
|
|
||||||
|
|
|
@ -2687,7 +2687,7 @@ void M_StartMessage (const char *string, void (*routine)(int), bool input)
|
||||||
}
|
}
|
||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
S_StopSound ((AActor *)NULL, CHAN_VOICE);
|
S_StopSound (CHAN_VOICE);
|
||||||
S_Sound (CHAN_VOICE, "menu/prompt", 1, ATTN_NONE);
|
S_Sound (CHAN_VOICE, "menu/prompt", 1, ATTN_NONE);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "i_movie.h"
|
#include "i_movie.h"
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "a_doomglobal.h"
|
#include "a_doomglobal.h"
|
||||||
|
@ -4127,8 +4126,8 @@ int DLevelScript::RunScript ()
|
||||||
if (activationline)
|
if (activationline)
|
||||||
{
|
{
|
||||||
S_Sound (
|
S_Sound (
|
||||||
activationline->frontsector->soundorg,
|
activationline->frontsector,
|
||||||
CHAN_AUTO,
|
CHAN_AUTO, // 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);
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "v_palette.h"
|
#include "v_palette.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
|
|
@ -2721,7 +2721,7 @@ FUNC(LS_SendToCommunicator)
|
||||||
|
|
||||||
if (it->CheckLocalView (consoleplayer))
|
if (it->CheckLocalView (consoleplayer))
|
||||||
{
|
{
|
||||||
S_StopSound ((fixed_t *)NULL, CHAN_VOICE);
|
S_StopSound (CHAN_VOICE);
|
||||||
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM);
|
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM);
|
||||||
if (arg2 == 0)
|
if (arg2 == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -488,7 +488,6 @@ enum
|
||||||
PO_SPAWNHURT_TYPE
|
PO_SPAWNHURT_TYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FPolyObj *polyobjs; // list of all poly-objects on the level
|
|
||||||
extern int po_NumPolyobjs;
|
extern int po_NumPolyobjs;
|
||||||
extern polyspawns_t *polyspawns; // [RH] list of polyobject things to spawn
|
extern polyspawns_t *polyspawns; // [RH] list of polyobject things to spawn
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "vectors.h"
|
|
||||||
|
|
||||||
#include "m_alloc.h"
|
#include "m_alloc.h"
|
||||||
#include "m_bbox.h"
|
#include "m_bbox.h"
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
// State.
|
// State.
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "vectors.h"
|
|
||||||
|
|
||||||
static AActor *RoughBlockCheck (AActor *mo, int index);
|
static AActor *RoughBlockCheck (AActor *mo, int index);
|
||||||
|
|
||||||
|
|
|
@ -4491,7 +4491,7 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner)
|
||||||
// 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->x, CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM);
|
S_Sound (missile->x, missile->y, missile->z, CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "p_acs.h"
|
#include "p_acs.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "announcer.h"
|
#include "announcer.h"
|
||||||
#include "wi_stuff.h"
|
#include "wi_stuff.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
|
|
@ -577,20 +577,19 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
|
||||||
// which wasn't necessarily anywhere near the switch if it was
|
// which wasn't necessarily anywhere near the switch if it was
|
||||||
// facing a big sector (and which wasn't necessarily for the
|
// facing a big sector (and which wasn't necessarily for the
|
||||||
// button just activated, either).
|
// button just activated, either).
|
||||||
fixed_t pt[3];
|
fixed_t pt[2];
|
||||||
line_t *line = &lines[side->linenum];
|
line_t *line = &lines[side->linenum];
|
||||||
bool playsound;
|
bool playsound;
|
||||||
|
|
||||||
pt[0] = line->v1->x + (line->dx >> 1);
|
pt[0] = line->v1->x + (line->dx >> 1);
|
||||||
pt[1] = line->v1->y + (line->dy >> 1);
|
pt[1] = line->v1->y + (line->dy >> 1);
|
||||||
pt[2] = 0;
|
|
||||||
side->SetTexture(texture, SwitchList[i]->u[0].Texture);
|
side->SetTexture(texture, SwitchList[i]->u[0].Texture);
|
||||||
if (useAgain || SwitchList[i]->NumFrames > 1)
|
if (useAgain || SwitchList[i]->NumFrames > 1)
|
||||||
playsound = P_StartButton (side, texture, i, pt[0], pt[1], !!useAgain);
|
playsound = P_StartButton (side, texture, i, pt[0], pt[1], !!useAgain);
|
||||||
else
|
else
|
||||||
playsound = true;
|
playsound = true;
|
||||||
if (playsound)
|
if (playsound)
|
||||||
S_Sound (pt, CHAN_VOICE|CHAN_LISTENERZ|CHAN_IMMOBILE, sound, 1, ATTN_STATIC);
|
S_Sound (pt[0], pt[1], 0, CHAN_VOICE|CHAN_LISTENERZ, sound, 1, ATTN_STATIC);
|
||||||
if (quest != NULL)
|
if (quest != NULL)
|
||||||
{
|
{
|
||||||
*quest = SwitchList[i]->QuestPanel;
|
*quest = SwitchList[i]->QuestPanel;
|
||||||
|
@ -648,16 +647,12 @@ void DActiveButton::Tick ()
|
||||||
FSwitchDef *def = SwitchList[m_SwitchDef];
|
FSwitchDef *def = SwitchList[m_SwitchDef];
|
||||||
if (m_Frame == def->NumFrames - 1)
|
if (m_Frame == def->NumFrames - 1)
|
||||||
{
|
{
|
||||||
fixed_t pt[3];
|
|
||||||
|
|
||||||
m_SwitchDef = def->PairIndex;
|
m_SwitchDef = def->PairIndex;
|
||||||
if (m_SwitchDef != 65535)
|
if (m_SwitchDef != 65535)
|
||||||
{
|
{
|
||||||
def = SwitchList[def->PairIndex];
|
def = SwitchList[def->PairIndex];
|
||||||
m_Frame = 65535;
|
m_Frame = 65535;
|
||||||
pt[0] = m_X;
|
S_Sound (m_X, m_Y, 0, CHAN_VOICE|CHAN_LISTENERZ,
|
||||||
pt[1] = m_Y;
|
|
||||||
S_Sound (pt, CHAN_VOICE|CHAN_LISTENERZ|CHAN_IMMOBILE,
|
|
||||||
def->Sound != 0 ? def->Sound : FSoundID("switches/normbutn"),
|
def->Sound != 0 ? def->Sound : FSoundID("switches/normbutn"),
|
||||||
1, ATTN_STATIC);
|
1, ATTN_STATIC);
|
||||||
bFlippable = false;
|
bFlippable = false;
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "p_lnspec.h"
|
#include "p_lnspec.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
|
|
15
src/r_defs.h
15
src/r_defs.h
|
@ -486,7 +486,7 @@ struct sector_t
|
||||||
int sky;
|
int sky;
|
||||||
short seqType; // this sector's sound sequence
|
short seqType; // this sector's sound sequence
|
||||||
|
|
||||||
fixed_t soundorg[3]; // origin for any sounds played by the sector
|
fixed_t soundorg[2]; // origin for any sounds played by the sector
|
||||||
int validcount; // if == validcount, already checked
|
int validcount; // if == validcount, already checked
|
||||||
AActor* thinglist; // list of mobjs in sector
|
AActor* thinglist; // list of mobjs in sector
|
||||||
|
|
||||||
|
@ -786,8 +786,19 @@ struct FPolyObj
|
||||||
~FPolyObj();
|
~FPolyObj();
|
||||||
DInterpolation *SetInterpolation();
|
DInterpolation *SetInterpolation();
|
||||||
void StopInterpolation();
|
void StopInterpolation();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
extern FPolyObj *polyobjs; // list of all poly-objects on the level
|
||||||
|
|
||||||
|
inline FArchive &operator<< (FArchive &arc, FPolyObj *&poly)
|
||||||
|
{
|
||||||
|
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline FArchive &operator<< (FArchive &arc, const FPolyObj *&poly)
|
||||||
|
{
|
||||||
|
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// BSP node.
|
// BSP node.
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "i_video.h"
|
#include "i_video.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "r_translate.h"
|
#include "r_translate.h"
|
||||||
#include "p_3dmidtex.h"
|
#include "p_3dmidtex.h"
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
|
|
||||||
#include "m_alloc.h"
|
#include "m_alloc.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,11 @@ inline FArchive &operator<< (FArchive &arc, sector_t *&sec)
|
||||||
return arc.SerializePointer (sectors, (BYTE **)&sec, sizeof(*sectors));
|
return arc.SerializePointer (sectors, (BYTE **)&sec, sizeof(*sectors));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline FArchive &operator<< (FArchive &arc, const sector_t *&sec)
|
||||||
|
{
|
||||||
|
return arc.SerializePointer (sectors, (BYTE **)&sec, sizeof(*sectors));
|
||||||
|
}
|
||||||
|
|
||||||
inline FArchive &operator<< (FArchive &arc, line_t *&line)
|
inline FArchive &operator<< (FArchive &arc, line_t *&line)
|
||||||
{
|
{
|
||||||
return arc.SerializePointer (lines, (BYTE **)&line, sizeof(*lines));
|
return arc.SerializePointer (lines, (BYTE **)&line, sizeof(*lines));
|
||||||
|
|
|
@ -132,11 +132,11 @@ public:
|
||||||
void Serialize(FArchive &arc);
|
void Serialize(FArchive &arc);
|
||||||
void MakeSound(int loop, FSoundID id)
|
void MakeSound(int loop, FSoundID id)
|
||||||
{
|
{
|
||||||
S_Sound (&m_Poly->startSpot[0], CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten);
|
S_Sound (m_Poly, CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten);
|
||||||
}
|
}
|
||||||
bool IsPlaying()
|
bool IsPlaying()
|
||||||
{
|
{
|
||||||
return S_GetSoundPlayingInfo (&m_Poly->startSpot[0], m_CurrentSoundID);
|
return S_GetSoundPlayingInfo (m_Poly, m_CurrentSoundID);
|
||||||
}
|
}
|
||||||
void *Source()
|
void *Source()
|
||||||
{
|
{
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
}
|
}
|
||||||
bool IsPlaying()
|
bool IsPlaying()
|
||||||
{
|
{
|
||||||
return S_GetSoundPlayingInfo (m_Sector->soundorg, m_CurrentSoundID);
|
return S_GetSoundPlayingInfo (m_Sector, m_CurrentSoundID);
|
||||||
}
|
}
|
||||||
void *Source()
|
void *Source()
|
||||||
{
|
{
|
||||||
|
@ -423,7 +423,7 @@ IMPLEMENT_CLASS (DSeqPolyNode)
|
||||||
void DSeqPolyNode::Serialize (FArchive &arc)
|
void DSeqPolyNode::Serialize (FArchive &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
arc.SerializePointer (polyobjs, (BYTE **)&m_Poly, sizeof(*polyobjs));
|
arc << m_Poly;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_CLASS (DSeqSectorNode)
|
IMPLEMENT_CLASS (DSeqSectorNode)
|
||||||
|
@ -982,7 +982,7 @@ void DSeqActorNode::Destroy ()
|
||||||
void DSeqSectorNode::Destroy ()
|
void DSeqSectorNode::Destroy ()
|
||||||
{
|
{
|
||||||
if (m_StopSound >= 0)
|
if (m_StopSound >= 0)
|
||||||
S_StopSound (m_Sector->soundorg, Channel & 7);
|
S_StopSound (m_Sector, Channel & 7);
|
||||||
if (m_StopSound >= 1)
|
if (m_StopSound >= 1)
|
||||||
MakeSound (0, m_StopSound);
|
MakeSound (0, m_StopSound);
|
||||||
Super::Destroy();
|
Super::Destroy();
|
||||||
|
@ -991,7 +991,7 @@ void DSeqSectorNode::Destroy ()
|
||||||
void DSeqPolyNode::Destroy ()
|
void DSeqPolyNode::Destroy ()
|
||||||
{
|
{
|
||||||
if (m_StopSound >= 0)
|
if (m_StopSound >= 0)
|
||||||
S_StopSound (m_Poly->startSpot, CHAN_BODY);
|
S_StopSound (m_Poly, CHAN_BODY);
|
||||||
if (m_StopSound >= 1)
|
if (m_StopSound >= 1)
|
||||||
MakeSound (0, m_StopSound);
|
MakeSound (0, m_StopSound);
|
||||||
Super::Destroy();
|
Super::Destroy();
|
||||||
|
|
551
src/s_sound.cpp
551
src/s_sound.cpp
|
@ -46,7 +46,6 @@
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "gstrings.h"
|
#include "gstrings.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "gi.h"
|
#include "gi.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "zstring.h"
|
#include "zstring.h"
|
||||||
|
@ -84,6 +83,15 @@ struct MusPlayingInfo
|
||||||
bool loop;
|
bool loop;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SOURCE_None, // Sound is always on top of the listener.
|
||||||
|
SOURCE_Actor, // Sound is coming from an actor.
|
||||||
|
SOURCE_Sector, // Sound is coming from a sector.
|
||||||
|
SOURCE_Polyobj, // Sound is coming from a polyobject.
|
||||||
|
SOURCE_Unattached, // Sound is not attached to any particular emitter.
|
||||||
|
};
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
extern float S_GetMusicVolume (const char *music);
|
extern float S_GetMusicVolume (const char *music);
|
||||||
|
@ -92,12 +100,13 @@ extern float S_GetMusicVolume (const char *music);
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
static bool S_CheckSoundLimit(sfxinfo_t *sfx, float pos[3], int near_limit);
|
static bool S_CheckSoundLimit(sfxinfo_t *sfx, const FVector3 &pos, int near_limit);
|
||||||
static void S_ActivatePlayList(bool goBack);
|
static void S_ActivatePlayList(bool goBack);
|
||||||
static void CalcPosVel(fixed_t *pt, AActor *mover, int constz, float pos[3],
|
static void CalcPosVel(const FSoundChan *chan, FVector3 *pos, FVector3 *vel);
|
||||||
float vel[3]);
|
static void CalcPosVel(int type, const AActor *actor, const sector_t *sector, const FPolyObj *poly,
|
||||||
static FSoundChan *S_StartSound(fixed_t *pt, AActor *mover, sector_t *sec,
|
const FVector3 *pt, int constz, FVector3 *pos, FVector3 *vel);
|
||||||
int channel, FSoundID sound_id, float volume, float attenuation);
|
static FSoundChan *S_StartSound(AActor *mover, const sector_t *sec, const FPolyObj *poly,
|
||||||
|
const FVector3 *pt, int channel, FSoundID sound_id, float volume, float attenuation);
|
||||||
static sfxinfo_t *S_LoadSound(sfxinfo_t *sfx);
|
static sfxinfo_t *S_LoadSound(sfxinfo_t *sfx);
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
@ -138,7 +147,7 @@ void S_NoiseDebug (void)
|
||||||
{
|
{
|
||||||
FSoundChan *chan;
|
FSoundChan *chan;
|
||||||
FVector3 listener;
|
FVector3 listener;
|
||||||
fixed_t ox, oy, oz;
|
FVector3 origin;
|
||||||
int y, color;
|
int y, color;
|
||||||
|
|
||||||
y = 32 * CleanYfac;
|
y = 32 * CleanYfac;
|
||||||
|
@ -161,8 +170,8 @@ void S_NoiseDebug (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.X = FIXED2FLOAT(players[consoleplayer].camera->x);
|
listener.X = FIXED2FLOAT(players[consoleplayer].camera->x);
|
||||||
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->y);
|
listener.Y = FIXED2FLOAT(players[consoleplayer].camera->z);
|
||||||
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->z);
|
listener.Z = FIXED2FLOAT(players[consoleplayer].camera->y);
|
||||||
|
|
||||||
// Display the oldest channel first.
|
// Display the oldest channel first.
|
||||||
for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan)
|
for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan)
|
||||||
|
@ -171,10 +180,7 @@ void S_NoiseDebug (void)
|
||||||
{
|
{
|
||||||
char temp[32];
|
char temp[32];
|
||||||
|
|
||||||
assert(chan->Pt != NULL);
|
CalcPosVel(chan, &origin, NULL);
|
||||||
ox = chan->Pt[0];
|
|
||||||
oy = chan->Pt[1];
|
|
||||||
oz = chan->Pt[2];
|
|
||||||
color = (chan->ChanFlags & CHAN_LOOP) ? CR_BROWN : CR_GREY;
|
color = (chan->ChanFlags & CHAN_LOOP) ? CR_BROWN : CR_GREY;
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
|
@ -192,23 +198,22 @@ void S_NoiseDebug (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// X coordinate
|
// X coordinate
|
||||||
sprintf (temp, "%d", ox >> FRACBITS);
|
sprintf (temp, "%.0f", origin.X);
|
||||||
screen->DrawText (color, 70, y, temp, TAG_DONE);
|
screen->DrawText (color, 70, y, temp, TAG_DONE);
|
||||||
|
|
||||||
// Y coordinate
|
// Y coordinate
|
||||||
sprintf (temp, "%d", oy >> FRACBITS);
|
sprintf (temp, "%.0f", origin.Z);
|
||||||
screen->DrawText (color, 120, y, temp, TAG_DONE);
|
screen->DrawText (color, 120, y, temp, TAG_DONE);
|
||||||
|
|
||||||
// Z coordinate
|
// Z coordinate
|
||||||
sprintf (temp, "%d", oz >> FRACBITS);
|
sprintf (temp, "%.0f", origin.Y);
|
||||||
screen->DrawText (color, 170, y, temp, TAG_DONE);
|
screen->DrawText (color, 170, y, temp, TAG_DONE);
|
||||||
|
|
||||||
// Distance
|
// Distance
|
||||||
if (chan->DistanceScale > 0)
|
if (chan->DistanceScale > 0)
|
||||||
{
|
{
|
||||||
FVector3 sound(ox, oy, oz);
|
origin /= FRACUNIT;
|
||||||
sound /= FRACUNIT;
|
sprintf (temp, "%.0f", (origin - listener).Length());
|
||||||
sprintf (temp, "%.0f", (sound - listener).Length());
|
|
||||||
screen->DrawText (color, 260, y, temp, TAG_DONE);
|
screen->DrawText (color, 260, y, temp, TAG_DONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -226,10 +231,10 @@ void S_NoiseDebug (void)
|
||||||
screen->DrawText (color, 300, y, temp, TAG_DONE);
|
screen->DrawText (color, 300, y, temp, TAG_DONE);
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
sprintf (temp, "%s3%sZ%sI%sM%sN%sA%sL%sE",
|
sprintf (temp, "%s3%sZ%sU%sM%sN%sA%sL%sE",
|
||||||
(chan->ChanFlags & CHAN_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHAN_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||||
(chan->ChanFlags & CHAN_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHAN_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||||
(chan->ChanFlags & CHAN_IMMOBILE) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHAN_UI) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||||
(chan->ChanFlags & CHAN_MAYBE_LOCAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHAN_MAYBE_LOCAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||||
(chan->ChanFlags & CHAN_NOPAUSE) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHAN_NOPAUSE) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||||
(chan->ChanFlags & CHAN_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
(chan->ChanFlags & CHAN_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
|
||||||
|
@ -547,9 +552,9 @@ FSoundChan *S_GetChannel(void *syschan)
|
||||||
|
|
||||||
void S_ReturnChannel(FSoundChan *chan)
|
void S_ReturnChannel(FSoundChan *chan)
|
||||||
{
|
{
|
||||||
if (chan->Mover != NULL)
|
if (chan->SourceType == SOURCE_Actor && chan->Actor != NULL)
|
||||||
{
|
{
|
||||||
chan->Mover->SoundChans &= ~(1 << chan->EntChannel);
|
chan->Actor->SoundChans &= ~(1 << chan->EntChannel);
|
||||||
}
|
}
|
||||||
S_UnlinkChannel(chan);
|
S_UnlinkChannel(chan);
|
||||||
memset(chan, 0, sizeof(*chan));
|
memset(chan, 0, sizeof(*chan));
|
||||||
|
@ -596,33 +601,164 @@ void S_LinkChannel(FSoundChan *chan, FSoundChan **head)
|
||||||
//
|
//
|
||||||
// CalcPosVel
|
// CalcPosVel
|
||||||
//
|
//
|
||||||
// Calculates a sound's position and velocity for 3D sounds.
|
// Retrieves a sound's position and velocity for 3D sounds. This version
|
||||||
|
// is for an already playing sound.
|
||||||
|
//
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
void CalcPosVel (fixed_t *pt, AActor *mover, int constz,
|
void CalcPosVel(const FSoundChan *chan, FVector3 *pos, FVector3 *vel)
|
||||||
float pos[3], float vel[3])
|
|
||||||
{
|
{
|
||||||
if (mover != NULL)
|
if (pos != NULL)
|
||||||
{
|
{
|
||||||
vel[0] = FIXED2FLOAT(mover->momx) * TICRATE;
|
fixed_t x, y, z;
|
||||||
vel[1] = FIXED2FLOAT(mover->momz) * TICRATE;
|
|
||||||
vel[2] = FIXED2FLOAT(mover->momy) * TICRATE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vel[0] = vel[1] = vel[2] = 0.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos[0] = FIXED2FLOAT (pt[0]);
|
switch (chan->SourceType)
|
||||||
pos[2] = FIXED2FLOAT (pt[1]);
|
{
|
||||||
if (constz)
|
case SOURCE_None:
|
||||||
{
|
default:
|
||||||
pos[1] = FIXED2FLOAT(players[consoleplayer].camera->z);
|
if (players[consoleplayer].camera != NULL)
|
||||||
vel[1] = 0.f;
|
{
|
||||||
|
x = players[consoleplayer].camera->x;
|
||||||
|
y = players[consoleplayer].camera->z;
|
||||||
|
z = players[consoleplayer].camera->y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
z = y = x = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Actor:
|
||||||
|
x = chan->Actor->x;
|
||||||
|
y = chan->Actor->z;
|
||||||
|
z = chan->Actor->y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Sector:
|
||||||
|
x = chan->Sector->soundorg[0];
|
||||||
|
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->z : 0;
|
||||||
|
z = chan->Sector->soundorg[1];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Polyobj:
|
||||||
|
x = chan->Poly->startSpot[0];
|
||||||
|
y = chan->Poly->startSpot[2];
|
||||||
|
z = chan->Poly->startSpot[1];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Unattached:
|
||||||
|
pos->X = chan->Point[0];
|
||||||
|
pos->Y = !(chan->ChanFlags & CHAN_LISTENERZ) ? chan->Point[1]
|
||||||
|
: FIXED2FLOAT(players[consoleplayer].camera->z);
|
||||||
|
pos->Z = chan->Point[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (chan->SourceType != SOURCE_Unattached)
|
||||||
|
{
|
||||||
|
if (chan->ChanFlags & CHAN_LISTENERZ)
|
||||||
|
{
|
||||||
|
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->z : 0;
|
||||||
|
}
|
||||||
|
pos->X = FIXED2FLOAT(x);
|
||||||
|
pos->Y = FIXED2FLOAT(y);
|
||||||
|
pos->Z = FIXED2FLOAT(z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
if (vel != NULL)
|
||||||
{
|
{
|
||||||
pos[1] = FIXED2FLOAT(pt[2]);
|
// Only actors maintain velocity information.
|
||||||
|
if (chan->SourceType == SOURCE_Actor)
|
||||||
|
{
|
||||||
|
vel->X = FIXED2FLOAT(chan->Actor->momx) * TICRATE;
|
||||||
|
vel->Y = FIXED2FLOAT(chan->Actor->momz) * TICRATE;
|
||||||
|
vel->Z = FIXED2FLOAT(chan->Actor->momy) * TICRATE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vel->Zero();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
//
|
||||||
|
// CalcPosVel
|
||||||
|
//
|
||||||
|
// This version is for sounds that haven't started yet so have no channel.
|
||||||
|
//
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
static void CalcPosVel(int type, const AActor *actor, const sector_t *sector,
|
||||||
|
const FPolyObj *poly, const FVector3 *pt, int constz, FVector3 *pos, FVector3 *vel)
|
||||||
|
{
|
||||||
|
if (pos != NULL)
|
||||||
|
{
|
||||||
|
fixed_t x, y, z;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case SOURCE_None:
|
||||||
|
default:
|
||||||
|
if (players[consoleplayer].camera != NULL)
|
||||||
|
{
|
||||||
|
x = players[consoleplayer].camera->x;
|
||||||
|
y = players[consoleplayer].camera->z;
|
||||||
|
z = players[consoleplayer].camera->y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
z = y = x = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Actor:
|
||||||
|
x = actor->x;
|
||||||
|
y = actor->z;
|
||||||
|
z = actor->y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Sector:
|
||||||
|
x = sector->soundorg[0];
|
||||||
|
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->z : 0;
|
||||||
|
z = sector->soundorg[1];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Polyobj:
|
||||||
|
x = poly->startSpot[0];
|
||||||
|
y = poly->startSpot[2];
|
||||||
|
z = poly->startSpot[1];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOURCE_Unattached:
|
||||||
|
pos->X = pt->X;
|
||||||
|
pos->Y = !constz ? pt->Y : FIXED2FLOAT(players[consoleplayer].camera->z);
|
||||||
|
pos->Z = pt->Z;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (type != SOURCE_Unattached)
|
||||||
|
{
|
||||||
|
if (constz)
|
||||||
|
{
|
||||||
|
y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->z : 0;
|
||||||
|
}
|
||||||
|
pos->X = FIXED2FLOAT(x);
|
||||||
|
pos->Y = FIXED2FLOAT(y);
|
||||||
|
pos->Z = FIXED2FLOAT(z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (vel != NULL)
|
||||||
|
{
|
||||||
|
// Only actors maintain velocity information.
|
||||||
|
if (type == SOURCE_Actor)
|
||||||
|
{
|
||||||
|
vel->X = FIXED2FLOAT(actor->momx) * TICRATE;
|
||||||
|
vel->Y = FIXED2FLOAT(actor->momz) * TICRATE;
|
||||||
|
vel->Z = FIXED2FLOAT(actor->momy) * TICRATE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vel->Zero();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,50 +766,54 @@ void CalcPosVel (fixed_t *pt, AActor *mover, int constz,
|
||||||
//
|
//
|
||||||
// S_StartSound
|
// S_StartSound
|
||||||
//
|
//
|
||||||
// 0 attenuation means full volume over whole level
|
// 0 attenuation means full volume over whole level.
|
||||||
// 0<attenuation<=1 means to scale the distance by that amount when
|
// 0 < attenuation means to scale the distance by that amount when
|
||||||
// calculating volume
|
// calculating volume.
|
||||||
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyObj *poly,
|
||||||
int channel, FSoundID sound_id, float volume, float attenuation)
|
const FVector3 *pt, int channel, FSoundID sound_id, float volume, float attenuation)
|
||||||
{
|
{
|
||||||
sfxinfo_t *sfx;
|
sfxinfo_t *sfx;
|
||||||
int chanflags;
|
int chanflags;
|
||||||
int basepriority;
|
int basepriority;
|
||||||
int org_id;
|
int org_id;
|
||||||
int pitch;
|
int pitch;
|
||||||
fixed_t x, y, z;
|
|
||||||
FSoundChan *chan;
|
FSoundChan *chan;
|
||||||
float pos[3];
|
FVector3 pos, vel;
|
||||||
float vel[3];
|
|
||||||
|
|
||||||
if (sound_id <= 0 || volume <= 0)
|
if (sound_id <= 0 || volume <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
org_id = sound_id;
|
int type;
|
||||||
chanflags = channel & ~7;
|
|
||||||
|
|
||||||
if (pt == NULL)
|
if (actor != NULL)
|
||||||
{
|
{
|
||||||
attenuation = 0;
|
type = SOURCE_Actor;
|
||||||
// Give these variables values, although they don't really matter
|
}
|
||||||
x = y = z = 0;
|
else if (sec != NULL)
|
||||||
fixed_t pt2[3] = { 0, 0, 0 };
|
{
|
||||||
CalcPosVel (pt2, mover, chanflags & CHAN_LISTENERZ, pos, vel);
|
type = SOURCE_Sector;
|
||||||
|
}
|
||||||
|
else if (poly != NULL)
|
||||||
|
{
|
||||||
|
type = SOURCE_Polyobj;
|
||||||
|
}
|
||||||
|
else if (pt != NULL)
|
||||||
|
{
|
||||||
|
type = SOURCE_Unattached;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = pt[0];
|
type = SOURCE_None;
|
||||||
y = pt[1];
|
|
||||||
z = pt[2];
|
|
||||||
CalcPosVel (pt, mover, chanflags & CHAN_LISTENERZ, pos, vel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chanflags & CHAN_IMMOBILE)
|
org_id = sound_id;
|
||||||
{
|
chanflags = channel & ~7;
|
||||||
pt = NULL;
|
|
||||||
}
|
CalcPosVel(type, actor, sec, poly, pt, chanflags & CHAN_LISTENERZ, &pos, &vel);
|
||||||
|
|
||||||
if (i_compatflags & COMPATF_MAGICSILENCE)
|
if (i_compatflags & COMPATF_MAGICSILENCE)
|
||||||
{ // For people who just can't play without a silent BFG.
|
{ // For people who just can't play without a silent BFG.
|
||||||
channel = CHAN_WEAPON;
|
channel = CHAN_WEAPON;
|
||||||
|
@ -682,7 +822,7 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
{
|
{
|
||||||
if ((channel & CHAN_MAYBE_LOCAL) && (i_compatflags & COMPATF_SILENTPICKUP))
|
if ((channel & CHAN_MAYBE_LOCAL) && (i_compatflags & COMPATF_SILENTPICKUP))
|
||||||
{
|
{
|
||||||
if (mover != NULL && mover != players[consoleplayer].camera)
|
if (actor != NULL && actor != players[consoleplayer].camera)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -706,7 +846,7 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
{
|
{
|
||||||
if (sfx->bPlayerReserve)
|
if (sfx->bPlayerReserve)
|
||||||
{
|
{
|
||||||
sound_id = FSoundID(S_FindSkinnedSound (mover, sound_id));
|
sound_id = FSoundID(S_FindSkinnedSound (actor, sound_id));
|
||||||
near_limit = S_sfx[sound_id].NearLimit;
|
near_limit = S_sfx[sound_id].NearLimit;
|
||||||
}
|
}
|
||||||
else if (sfx->bRandomHeader)
|
else if (sfx->bRandomHeader)
|
||||||
|
@ -730,7 +870,7 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
|
|
||||||
// If the sound is unpositioned or comes from the listener, it is
|
// If the sound is unpositioned or comes from the listener, it is
|
||||||
// never limited.
|
// never limited.
|
||||||
if (pt == NULL || mover == players[consoleplayer].camera)
|
if (type == SOURCE_None || actor == players[consoleplayer].camera)
|
||||||
{
|
{
|
||||||
near_limit = 0;
|
near_limit = 0;
|
||||||
}
|
}
|
||||||
|
@ -760,7 +900,7 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select priority.
|
// Select priority.
|
||||||
if (attenuation <= 0 || mover == players[consoleplayer].camera)
|
if (type == SOURCE_None || actor == players[consoleplayer].camera)
|
||||||
{
|
{
|
||||||
basepriority = 40;
|
basepriority = 40;
|
||||||
}
|
}
|
||||||
|
@ -769,9 +909,9 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
basepriority = 0;
|
basepriority = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mover != NULL && channel == CHAN_AUTO)
|
if (actor != NULL && channel == CHAN_AUTO)
|
||||||
{ // Select a channel that isn't already playing something.
|
{ // Select a channel that isn't already playing something.
|
||||||
BYTE mask = mover->SoundChans;
|
BYTE mask = actor->SoundChans;
|
||||||
|
|
||||||
// Try channel 0 first, then travel from channel 7 down.
|
// Try channel 0 first, then travel from channel 7 down.
|
||||||
if ((mask & 1) == 0)
|
if ((mask & 1) == 0)
|
||||||
|
@ -795,14 +935,28 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 ((mover == NULL && channel != CHAN_AUTO) || (mover != NULL && mover->SoundChans & (1 << channel)))
|
if ((actor == NULL && channel != CHAN_AUTO) || (actor != NULL && actor->SoundChans & (1 << channel)))
|
||||||
{
|
{
|
||||||
for (chan = Channels; chan != NULL; chan = chan->NextChan)
|
for (chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
{
|
{
|
||||||
if (((mover != NULL && chan->Mover == mover) || (chan->Pt == pt)) && chan->EntChannel == channel)
|
if (chan->SourceType == type && chan->EntChannel == channel)
|
||||||
{
|
{
|
||||||
GSnd->StopSound(chan);
|
bool foundit;
|
||||||
break;
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case SOURCE_None: foundit = true; break;
|
||||||
|
case SOURCE_Actor: foundit = (chan->Actor == actor); break;
|
||||||
|
case SOURCE_Sector: foundit = (chan->Sector == sec); break;
|
||||||
|
case SOURCE_Polyobj: foundit = (chan->Poly == poly); break;
|
||||||
|
case SOURCE_Unattached: foundit = (chan->Point[0] == pt->X && chan->Point[2] == pt->Z && chan->Point[1] == pt->Y); break;
|
||||||
|
default: foundit = false; break;
|
||||||
|
}
|
||||||
|
if (foundit)
|
||||||
|
{
|
||||||
|
GSnd->StopSound(chan);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -810,7 +964,7 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
// Vary the sfx pitches.
|
// Vary the sfx pitches.
|
||||||
if (sfx->PitchMask != 0)
|
if (sfx->PitchMask != 0)
|
||||||
{
|
{
|
||||||
pitch = NORM_PITCH - (M_Random()&sfx->PitchMask) + (M_Random()&sfx->PitchMask);
|
pitch = NORM_PITCH - (M_Random() & sfx->PitchMask) + (M_Random() & sfx->PitchMask);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -846,23 +1000,22 @@ static FSoundChan *S_StartSound (fixed_t *pt, AActor *mover, sector_t *sec,
|
||||||
{
|
{
|
||||||
chan->SoundID = sound_id;
|
chan->SoundID = sound_id;
|
||||||
chan->OrgID = FSoundID(org_id);
|
chan->OrgID = FSoundID(org_id);
|
||||||
chan->Mover = mover;
|
|
||||||
chan->Pt = pt != NULL ? pt : &chan->X;
|
|
||||||
chan->Sector = sec;
|
|
||||||
chan->SfxInfo = sfx;
|
chan->SfxInfo = sfx;
|
||||||
chan->EntChannel = channel;
|
chan->EntChannel = channel;
|
||||||
chan->Volume = volume;
|
chan->Volume = volume;
|
||||||
chan->X = x;
|
|
||||||
chan->Y = y;
|
|
||||||
chan->Z = z;
|
|
||||||
chan->ChanFlags |= chanflags;
|
chan->ChanFlags |= chanflags;
|
||||||
chan->NearLimit = near_limit;
|
chan->NearLimit = near_limit;
|
||||||
chan->Pitch = pitch;
|
chan->Pitch = pitch;
|
||||||
chan->Priority = basepriority;
|
chan->Priority = basepriority;
|
||||||
chan->DistanceScale = attenuation;
|
chan->DistanceScale = attenuation;
|
||||||
if (mover != NULL)
|
chan->SourceType = type;
|
||||||
|
switch (type)
|
||||||
{
|
{
|
||||||
mover->SoundChans |= 1 << channel;
|
case SOURCE_Actor: chan->Actor = actor; actor->SoundChans |= 1 << channel; break;
|
||||||
|
case SOURCE_Sector: chan->Sector = sec; break;
|
||||||
|
case SOURCE_Polyobj: chan->Poly = poly; break;
|
||||||
|
case SOURCE_Unattached: chan->Point[0] = pt->X; chan->Point[1] = pt->Y; chan->Point[2] = pt->Z; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return chan;
|
return chan;
|
||||||
|
@ -898,9 +1051,9 @@ void S_RestartSound(FSoundChan *chan)
|
||||||
|
|
||||||
if (chan->ChanFlags & CHAN_IS3D)
|
if (chan->ChanFlags & CHAN_IS3D)
|
||||||
{
|
{
|
||||||
float pos[3], vel[3];
|
FVector3 pos, vel;
|
||||||
|
|
||||||
CalcPosVel(chan->Pt, chan->Mover, chan->ChanFlags & CHAN_LISTENERZ, pos, vel);
|
CalcPosVel(chan, &pos, &vel);
|
||||||
|
|
||||||
// If this sound doesn't like playing near itself, don't play it if
|
// If this sound doesn't like playing near itself, don't play it if
|
||||||
// that's what would happen.
|
// that's what would happen.
|
||||||
|
@ -923,9 +1076,9 @@ void S_RestartSound(FSoundChan *chan)
|
||||||
// When called from the savegame loader, the actor's SoundChans
|
// When called from the savegame loader, the actor's SoundChans
|
||||||
// flags will be cleared. During normal gameplay, they should still
|
// flags will be cleared. During normal gameplay, they should still
|
||||||
// be set.
|
// be set.
|
||||||
if (ochan->Mover != NULL)
|
if (ochan->SourceType == SOURCE_Actor)
|
||||||
{
|
{
|
||||||
ochan->Mover->SoundChans |= 1 << ochan->EntChannel;
|
ochan->Actor->SoundChans |= 1 << ochan->EntChannel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -938,12 +1091,12 @@ void S_RestartSound(FSoundChan *chan)
|
||||||
|
|
||||||
void S_Sound (int channel, FSoundID sound_id, float volume, float attenuation)
|
void S_Sound (int channel, FSoundID sound_id, float volume, float attenuation)
|
||||||
{
|
{
|
||||||
S_StartSound ((fixed_t *)NULL, NULL, NULL, channel, sound_id, volume, attenuation);
|
S_StartSound (NULL, NULL, NULL, NULL, channel, sound_id, volume, attenuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// S_Sound - Actor is source
|
// S_Sound - An actor is source
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
@ -951,18 +1104,18 @@ void S_Sound (AActor *ent, int channel, FSoundID sound_id, float volume, float a
|
||||||
{
|
{
|
||||||
if (ent->Sector->Flags & SECF_SILENT)
|
if (ent->Sector->Flags & SECF_SILENT)
|
||||||
return;
|
return;
|
||||||
S_StartSound (&ent->x, ent, NULL, channel, sound_id, volume, attenuation);
|
S_StartSound (ent, NULL, NULL, NULL, channel, sound_id, volume, attenuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// S_Sound - A random coordinate is source
|
// S_Sound - A polyobject is source
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void S_Sound (fixed_t *pt, int channel, FSoundID sound_id, float volume, float attenuation)
|
void S_Sound (const FPolyObj *poly, int channel, FSoundID sound_id, float volume, float attenuation)
|
||||||
{
|
{
|
||||||
S_StartSound (pt, NULL, NULL, channel, sound_id, volume, attenuation);
|
S_StartSound (NULL, NULL, poly, NULL, channel, sound_id, volume, attenuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -973,11 +1126,8 @@ void S_Sound (fixed_t *pt, int channel, FSoundID sound_id, float volume, float a
|
||||||
|
|
||||||
void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sound_id, float volume, float attenuation)
|
void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sound_id, float volume, float attenuation)
|
||||||
{
|
{
|
||||||
fixed_t pt[3];
|
FVector3 pt(FIXED2FLOAT(x), FIXED2FLOAT(z), FIXED2FLOAT(y));
|
||||||
pt[0] = x;
|
S_StartSound (NULL, NULL, NULL, &pt, channel, sound_id, volume, attenuation);
|
||||||
pt[1] = y;
|
|
||||||
pt[2] = z;
|
|
||||||
S_StartSound (pt, NULL, NULL, channel|CHAN_IMMOBILE, sound_id, volume, attenuation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -986,9 +1136,9 @@ void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sound_id, f
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void S_Sound (sector_t *sec, int channel, FSoundID sfxid, float volume, float attenuation)
|
void S_Sound (const sector_t *sec, int channel, FSoundID sfxid, float volume, float attenuation)
|
||||||
{
|
{
|
||||||
S_StartSound (sec->soundorg, NULL, sec, channel, sfxid, volume, attenuation);
|
S_StartSound (NULL, sec, NULL, NULL, channel, sfxid, volume, attenuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1043,7 +1193,7 @@ bool S_CheckSingular(int sound_id)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool S_CheckSoundLimit(sfxinfo_t *sfx, float pos[3], int near_limit)
|
bool S_CheckSoundLimit(sfxinfo_t *sfx, const FVector3 &pos, int near_limit)
|
||||||
{
|
{
|
||||||
FSoundChan *chan;
|
FSoundChan *chan;
|
||||||
int count;
|
int count;
|
||||||
|
@ -1052,10 +1202,10 @@ bool S_CheckSoundLimit(sfxinfo_t *sfx, float pos[3], int near_limit)
|
||||||
{
|
{
|
||||||
if (!(chan->ChanFlags & CHAN_EVICTED) && chan->SfxInfo == sfx)
|
if (!(chan->ChanFlags & CHAN_EVICTED) && chan->SfxInfo == sfx)
|
||||||
{
|
{
|
||||||
double dx = FIXED2FLOAT(chan->Pt[0]) - pos[0];
|
FVector3 chanorigin;
|
||||||
double dy = FIXED2FLOAT(chan->Pt[1]) - pos[2];
|
|
||||||
double dz = FIXED2FLOAT(chan->Pt[2]) - pos[1];
|
CalcPosVel(chan, &chanorigin, NULL);
|
||||||
if (dx*dx + dy*dy + dz*dz <= 256.0*256.0)
|
if ((chanorigin - pos).LengthSquared() <= 256.0*256.0)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -1068,27 +1218,86 @@ bool S_CheckSoundLimit(sfxinfo_t *sfx, float pos[3], int near_limit)
|
||||||
//
|
//
|
||||||
// S_StopSound
|
// S_StopSound
|
||||||
//
|
//
|
||||||
// Stops a sound from a single source playing on a specific channel.
|
// Stops an unpositioned sound from playing on a specific channel.
|
||||||
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void S_StopSound (fixed_t *pt, int channel)
|
void S_StopSound (int channel)
|
||||||
{
|
{
|
||||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
{
|
{
|
||||||
if (((pt == NULL && chan->Pt == &chan->X) || chan->Pt == pt) &&
|
if (chan->SourceType == SOURCE_None &&
|
||||||
((i_compatflags & COMPATF_MAGICSILENCE) || chan->EntChannel == channel))
|
(chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE)))
|
||||||
{
|
{
|
||||||
GSnd->StopSound(chan);
|
GSnd->StopSound(chan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_StopSound (AActor *ent, int channel)
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// S_StopSound
|
||||||
|
//
|
||||||
|
// Stops a sound from a single actor from playing on a specific channel.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void S_StopSound (AActor *actor, int channel)
|
||||||
{
|
{
|
||||||
// No need to search every channel if we know it's not playing anything.
|
// No need to search every channel if we know it's not playing anything.
|
||||||
if (ent != NULL && ent->SoundChans & (1 << channel))
|
if (actor != NULL && actor->SoundChans & (1 << channel))
|
||||||
{
|
{
|
||||||
S_StopSound (&ent->x, channel);
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
|
{
|
||||||
|
if (chan->SourceType == SOURCE_Actor &&
|
||||||
|
chan->Actor == actor &&
|
||||||
|
(chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE)))
|
||||||
|
{
|
||||||
|
GSnd->StopSound(chan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// S_StopSound
|
||||||
|
//
|
||||||
|
// Stops a sound from a single sector from playing on a specific channel.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void S_StopSound (const sector_t *sec, int channel)
|
||||||
|
{
|
||||||
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
|
{
|
||||||
|
if (chan->SourceType == SOURCE_Sector &&
|
||||||
|
chan->Sector == sec &&
|
||||||
|
(chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE)))
|
||||||
|
{
|
||||||
|
GSnd->StopSound(chan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// S_StopSound
|
||||||
|
//
|
||||||
|
// Stops a sound from a single polyobject from playing on a specific channel.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void S_StopSound (const FPolyObj *poly, int channel)
|
||||||
|
{
|
||||||
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
|
{
|
||||||
|
if (chan->SourceType == SOURCE_Polyobj &&
|
||||||
|
chan->Poly == poly &&
|
||||||
|
(chan->EntChannel == channel || (i_compatflags & COMPATF_MAGICSILENCE)))
|
||||||
|
{
|
||||||
|
GSnd->StopSound(chan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,18 +1332,18 @@ void S_RelinkSound (AActor *from, AActor *to)
|
||||||
|
|
||||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
{
|
{
|
||||||
if (chan->Mover == from)
|
if (chan->SourceType == SOURCE_Actor && chan->Actor == from)
|
||||||
{
|
{
|
||||||
if (to != NULL || !(chan->ChanFlags & CHAN_LOOP))
|
if (to != NULL)
|
||||||
{
|
{
|
||||||
if (chan->Pt == &from->x)
|
chan->Actor = to;
|
||||||
{
|
}
|
||||||
chan->Pt = to ? &to->x : &chan->X;
|
else if (!(chan->ChanFlags & CHAN_LOOP))
|
||||||
chan->X = from->x;
|
{
|
||||||
chan->Y = from->y;
|
chan->SourceType = SOURCE_Unattached;
|
||||||
chan->Z = from->z;
|
chan->Point[0] = FIXED2FLOAT(from->x);
|
||||||
}
|
chan->Point[1] = FIXED2FLOAT(from->z);
|
||||||
chan->Mover = to;
|
chan->Point[2] = FIXED2FLOAT(from->y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1148,25 +1357,58 @@ void S_RelinkSound (AActor *from, AActor *to)
|
||||||
//
|
//
|
||||||
// S_GetSoundPlayingInfo
|
// S_GetSoundPlayingInfo
|
||||||
//
|
//
|
||||||
// Is a sound being played by a specific actor/point?
|
// Is a sound being played by a specific emitter?
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool S_GetSoundPlayingInfo (fixed_t *pt, int sound_id)
|
bool S_GetSoundPlayingInfo (const AActor *actor, int sound_id)
|
||||||
{
|
{
|
||||||
if (sound_id > 0)
|
if (sound_id > 0)
|
||||||
{
|
{
|
||||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
{
|
{
|
||||||
if (chan->Pt == pt && chan->OrgID == sound_id)
|
if (chan->OrgID == sound_id &&
|
||||||
|
chan->SourceType == SOURCE_Actor &&
|
||||||
|
chan->Actor == actor)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool S_GetSoundPlayingInfo (AActor *ent, int sound_id)
|
bool S_GetSoundPlayingInfo (const sector_t *sec, int sound_id)
|
||||||
{
|
{
|
||||||
return S_GetSoundPlayingInfo (ent ? &ent->x : NULL, sound_id);
|
if (sound_id > 0)
|
||||||
|
{
|
||||||
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
|
{
|
||||||
|
if (chan->OrgID == sound_id &&
|
||||||
|
chan->SourceType == SOURCE_Sector &&
|
||||||
|
chan->Sector == sec)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool S_GetSoundPlayingInfo (const FPolyObj *poly, int sound_id)
|
||||||
|
{
|
||||||
|
if (sound_id > 0)
|
||||||
|
{
|
||||||
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
|
{
|
||||||
|
if (chan->OrgID == sound_id &&
|
||||||
|
chan->SourceType == SOURCE_Polyobj &&
|
||||||
|
chan->Poly == poly)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1189,7 +1431,7 @@ bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id)
|
||||||
|
|
||||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
{
|
{
|
||||||
if (chan->Pt == &actor->x)
|
if (chan->SourceType == SOURCE_Actor && chan->Actor == actor)
|
||||||
{
|
{
|
||||||
if (channel == 0 || chan->EntChannel == channel)
|
if (channel == 0 || chan->EntChannel == channel)
|
||||||
{
|
{
|
||||||
|
@ -1319,7 +1561,7 @@ void S_RestoreEvictedChannels()
|
||||||
|
|
||||||
void S_UpdateSounds (void *listener_p)
|
void S_UpdateSounds (void *listener_p)
|
||||||
{
|
{
|
||||||
float pos[3], vel[3];
|
FVector3 pos, vel;
|
||||||
|
|
||||||
I_UpdateMusic();
|
I_UpdateMusic();
|
||||||
|
|
||||||
|
@ -1338,7 +1580,7 @@ void S_UpdateSounds (void *listener_p)
|
||||||
{
|
{
|
||||||
if ((chan->ChanFlags & (CHAN_EVICTED | CHAN_IS3D)) == CHAN_IS3D)
|
if ((chan->ChanFlags & (CHAN_EVICTED | CHAN_IS3D)) == CHAN_IS3D)
|
||||||
{
|
{
|
||||||
CalcPosVel(chan->Pt, chan->Mover, chan->ChanFlags & CHAN_LISTENERZ, pos, vel);
|
CalcPosVel(chan, &pos, &vel);
|
||||||
GSnd->UpdateSoundParams3D(chan, pos, vel);
|
GSnd->UpdateSoundParams3D(chan, pos, vel);
|
||||||
}
|
}
|
||||||
chan->ChanFlags &= ~CHAN_JUSTSTARTED;
|
chan->ChanFlags &= ~CHAN_JUSTSTARTED;
|
||||||
|
@ -1379,31 +1621,16 @@ FArchive &operator<<(FArchive &arc, FSoundID &sid)
|
||||||
|
|
||||||
static FArchive &operator<<(FArchive &arc, FSoundChan &chan)
|
static FArchive &operator<<(FArchive &arc, FSoundChan &chan)
|
||||||
{
|
{
|
||||||
BYTE pt_type;
|
arc << chan.SourceType;
|
||||||
|
switch (chan.SourceType)
|
||||||
if (arc.IsStoring())
|
|
||||||
{
|
{
|
||||||
if (chan.Pt == &chan.X)
|
case SOURCE_None: break;
|
||||||
{
|
case SOURCE_Actor: arc << chan.Actor; break;
|
||||||
pt_type = 2;
|
case SOURCE_Sector: arc << chan.Sector; break;
|
||||||
}
|
case SOURCE_Polyobj: arc << chan.Poly; break;
|
||||||
else if (chan.Pt == &chan.Mover->x)
|
case SOURCE_Unattached: arc << chan.Point[0] << chan.Point[1] << chan.Point[2]; break;
|
||||||
{
|
default: I_Error("Unknown sound source type %d\n", chan.SourceType); break;
|
||||||
pt_type = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // WTF?
|
|
||||||
assert(0);
|
|
||||||
pt_type = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arc << pt_type;
|
|
||||||
arc << chan.Mover;
|
|
||||||
arc << chan.Sector;
|
|
||||||
arc << chan.X;
|
|
||||||
arc << chan.Y;
|
|
||||||
arc << chan.Z;
|
|
||||||
arc << chan.SoundID;
|
arc << chan.SoundID;
|
||||||
arc << chan.OrgID;
|
arc << chan.OrgID;
|
||||||
arc << chan.Volume;
|
arc << chan.Volume;
|
||||||
|
@ -1418,18 +1645,6 @@ static FArchive &operator<<(FArchive &arc, FSoundChan &chan)
|
||||||
if (arc.IsLoading())
|
if (arc.IsLoading())
|
||||||
{
|
{
|
||||||
chan.SfxInfo = &S_sfx[chan.SoundID];
|
chan.SfxInfo = &S_sfx[chan.SoundID];
|
||||||
if (pt_type == 1)
|
|
||||||
{
|
|
||||||
chan.Pt = &chan.Mover->x;
|
|
||||||
}
|
|
||||||
else if (pt_type == 2)
|
|
||||||
{
|
|
||||||
chan.Pt = &chan.X;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
chan.Pt = &chan.Mover->x;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,26 +167,31 @@ extern int S_SoundCurveSize;
|
||||||
|
|
||||||
// Information about one playing sound.
|
// Information about one playing sound.
|
||||||
struct sector_t;
|
struct sector_t;
|
||||||
|
struct FPolyObj;
|
||||||
struct FSoundChan
|
struct FSoundChan
|
||||||
{
|
{
|
||||||
void *SysChannel;// Channel information from the system interface.
|
void *SysChannel;// Channel information from the system interface.
|
||||||
FSoundChan *NextChan; // Next channel in this list.
|
FSoundChan *NextChan; // Next channel in this list.
|
||||||
FSoundChan **PrevChan; // Previous channel in this list.
|
FSoundChan **PrevChan; // Previous channel in this list.
|
||||||
AActor *Mover; // Used for velocity.
|
|
||||||
sector_t *Sector; // Sector for area sounds.
|
|
||||||
fixed_t *Pt; // Origin of sound.
|
|
||||||
sfxinfo_t *SfxInfo; // Sound information.
|
sfxinfo_t *SfxInfo; // Sound information.
|
||||||
fixed_t X,Y,Z; // Origin if Mover is NULL.
|
QWORD_UNION StartTime; // Sound start time in DSP clocks.
|
||||||
FSoundID SoundID; // Sound ID of playing sound.
|
FSoundID SoundID; // Sound ID of playing sound.
|
||||||
FSoundID OrgID; // Sound ID of sound used to start this channel.
|
FSoundID OrgID; // Sound ID of sound used to start this channel.
|
||||||
float Volume;
|
float Volume;
|
||||||
float DistanceScale;
|
float DistanceScale;
|
||||||
int Pitch; // Pitch variation.
|
|
||||||
int ChanFlags;
|
int ChanFlags;
|
||||||
|
SWORD Pitch; // Pitch variation.
|
||||||
BYTE EntChannel; // Actor's sound channel.
|
BYTE EntChannel; // Actor's sound channel.
|
||||||
SBYTE Priority;
|
SBYTE Priority;
|
||||||
SWORD NearLimit;
|
SWORD NearLimit;
|
||||||
QWORD_UNION StartTime; // Sound start time in DSP clocks.
|
BYTE SourceType;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
AActor *Actor; // Used for position and velocity.
|
||||||
|
const sector_t *Sector; // Sector for area sounds.
|
||||||
|
const FPolyObj *Poly; // Polyobject sound source.
|
||||||
|
float Point[3]; // Sound is not attached to any source.
|
||||||
|
};
|
||||||
};
|
};
|
||||||
extern FSoundChan *Channels;
|
extern FSoundChan *Channels;
|
||||||
|
|
||||||
|
@ -219,9 +224,9 @@ void S_CacheSound (sfxinfo_t *sfx);
|
||||||
// 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, FSoundID sfxid, float volume, float attenuation);
|
||||||
void S_Sound (AActor *ent, int channel, FSoundID sfxid, float volume, float attenuation);
|
void S_Sound (AActor *ent, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||||
void S_Sound (fixed_t *pt, int channel, FSoundID sfxid, float volume, float attenuation);
|
void S_Sound (const FPolyObj *poly, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||||
|
void S_Sound (const sector_t *sec, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||||
void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sfxid, float volume, float attenuation);
|
void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||||
void S_Sound (sector_t *sec, int channel, FSoundID sfxid, float volume, float attenuation);
|
|
||||||
|
|
||||||
// sound channels
|
// sound channels
|
||||||
// channel 0 never willingly overrides
|
// channel 0 never willingly overrides
|
||||||
|
@ -249,8 +254,8 @@ void S_Sound (sector_t *sec, int channel, FSoundID sfxid, float volume, float at
|
||||||
|
|
||||||
// modifier flags
|
// modifier flags
|
||||||
#define CHAN_LISTENERZ 8
|
#define CHAN_LISTENERZ 8
|
||||||
#define CHAN_IMMOBILE 16
|
#define CHAN_MAYBE_LOCAL 16
|
||||||
#define CHAN_MAYBE_LOCAL 32
|
#define CHAN_UI 32 // Do not record sound in savegames.
|
||||||
#define CHAN_NOPAUSE 64 // Do not pause this sound in menus.
|
#define CHAN_NOPAUSE 64 // Do not pause this sound in menus.
|
||||||
#define CHAN_AREA 128 // Sound plays from all around. Only valid with sector sounds.
|
#define CHAN_AREA 128 // Sound plays from all around. Only valid with sector sounds.
|
||||||
#define CHAN_LOOP 256
|
#define CHAN_LOOP 256
|
||||||
|
@ -274,16 +279,22 @@ void S_CacheRandomSound (sfxinfo_t *sfx);
|
||||||
// Checks if a copy of this sound is already playing.
|
// Checks if a copy of this sound is already playing.
|
||||||
bool S_CheckSingular (int sound_id);
|
bool S_CheckSingular (int sound_id);
|
||||||
|
|
||||||
// Stops a sound emanating from one of an entity'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);
|
||||||
void S_StopSound (fixed_t *pt, int channel);
|
void S_StopSound (const sector_t *sec, int channel);
|
||||||
|
void S_StopSound (const FPolyObj *poly, int channel);
|
||||||
|
|
||||||
|
// Stops an origin-less sound from playing from this channel.
|
||||||
|
void S_StopSound (int channel);
|
||||||
|
|
||||||
// Stop sound for all channels
|
// Stop sound for all channels
|
||||||
void S_StopAllChannels (void);
|
void S_StopAllChannels (void);
|
||||||
|
|
||||||
// Is the sound playing on one of the entity's channels?
|
// Is the sound playing on one of the emitter's channels?
|
||||||
bool S_GetSoundPlayingInfo (AActor *ent, int sound_id);
|
bool S_GetSoundPlayingInfo (const AActor *actor, int sound_id);
|
||||||
bool S_GetSoundPlayingInfo (fixed_t *pt, int sound_id);
|
bool S_GetSoundPlayingInfo (const sector_t *sector, int sound_id);
|
||||||
|
bool S_GetSoundPlayingInfo (const FPolyObj *poly, int sound_id);
|
||||||
|
|
||||||
bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id);
|
bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id);
|
||||||
|
|
||||||
// Moves all sounds from one mobj to another
|
// Moves all sounds from one mobj to another
|
||||||
|
|
|
@ -67,8 +67,6 @@ extern HWND Window;
|
||||||
// Just some extra for music and whatever
|
// Just some extra for music and whatever
|
||||||
#define NUM_EXTRA_SOFTWARE_CHANNELS 1
|
#define NUM_EXTRA_SOFTWARE_CHANNELS 1
|
||||||
|
|
||||||
#define FIXED2FLOAT(x) ((x)/65536.f)
|
|
||||||
|
|
||||||
#define MAX_CHANNELS 256
|
#define MAX_CHANNELS 256
|
||||||
|
|
||||||
#define SPECTRUM_SIZE 256
|
#define SPECTRUM_SIZE 256
|
||||||
|
@ -1408,8 +1406,8 @@ FSoundChan *FMODSoundRenderer::StartSound(sfxinfo_t *sfx, float vol, int pitch,
|
||||||
CVAR(Float, snd_3dspread, 180, 0)
|
CVAR(Float, snd_3dspread, 180, 0)
|
||||||
|
|
||||||
FSoundChan *FMODSoundRenderer::StartSound3D(sfxinfo_t *sfx, float vol, float distscale,
|
FSoundChan *FMODSoundRenderer::StartSound3D(sfxinfo_t *sfx, float vol, float distscale,
|
||||||
int pitch, int priority, float pos[3], float vel[3], sector_t *sector, int channum, int chanflags,
|
int pitch, int priority, const FVector3 &pos, const FVector3 &vel, const sector_t *sector,
|
||||||
FSoundChan *reuse_chan)
|
int channum, int chanflags, FSoundChan *reuse_chan)
|
||||||
{
|
{
|
||||||
int id = int(sfx - &S_sfx[0]);
|
int id = int(sfx - &S_sfx[0]);
|
||||||
FMOD_RESULT result;
|
FMOD_RESULT result;
|
||||||
|
@ -1480,7 +1478,7 @@ FSoundChan *FMODSoundRenderer::StartSound3D(sfxinfo_t *sfx, float vol, float dis
|
||||||
chan->setVolume(vol);
|
chan->setVolume(vol);
|
||||||
if (mode & FMOD_3D)
|
if (mode & FMOD_3D)
|
||||||
{
|
{
|
||||||
chan->set3DAttributes((FMOD_VECTOR *)pos, (FMOD_VECTOR *)vel);
|
chan->set3DAttributes((FMOD_VECTOR *)&pos[0], (FMOD_VECTOR *)&vel[0]);
|
||||||
chan->set3DSpread(snd_3dspread);
|
chan->set3DSpread(snd_3dspread);
|
||||||
}
|
}
|
||||||
HandleChannelDelay(chan, reuse_chan, freq);
|
HandleChannelDelay(chan, reuse_chan, freq);
|
||||||
|
@ -1546,16 +1544,17 @@ void FMODSoundRenderer::HandleChannelDelay(FMOD::Channel *chan, FSoundChan *reus
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t *sfx, float pos[3], int channum, int chanflags, sector_t *sec, FMOD_MODE oldmode) const
|
FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t *sfx, const FVector3 &pos, int channum, int chanflags, const sector_t *sec, FMOD_MODE oldmode) const
|
||||||
{
|
{
|
||||||
if (players[consoleplayer].camera == NULL)
|
if (players[consoleplayer].camera == NULL)
|
||||||
{
|
{
|
||||||
return oldmode;
|
return oldmode;
|
||||||
}
|
}
|
||||||
float cpos[3];
|
FVector3 cpos, mpos;
|
||||||
cpos[0] = FIXED2FLOAT(players[consoleplayer].camera->x);
|
cpos.X = FIXED2FLOAT(players[consoleplayer].camera->x);
|
||||||
cpos[2] = FIXED2FLOAT(players[consoleplayer].camera->y);
|
cpos.Y = FIXED2FLOAT(players[consoleplayer].camera->z);
|
||||||
cpos[1] = FIXED2FLOAT(players[consoleplayer].camera->z);
|
cpos.Z = FIXED2FLOAT(players[consoleplayer].camera->y);
|
||||||
|
mpos = pos;
|
||||||
|
|
||||||
if ((chanflags & CHAN_AREA) && sec != NULL)
|
if ((chanflags & CHAN_AREA) && sec != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1567,8 +1566,8 @@ FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t
|
||||||
// Are we inside the sector? If yes, the closest point is the one we're on.
|
// Are we inside the sector? If yes, the closest point is the one we're on.
|
||||||
if (P_PointInSector(players[consoleplayer].camera->x, players[consoleplayer].camera->y) == sec)
|
if (P_PointInSector(players[consoleplayer].camera->x, players[consoleplayer].camera->y) == sec)
|
||||||
{
|
{
|
||||||
pos[0] = cpos[0];
|
mpos[0] = cpos[0];
|
||||||
pos[2] = cpos[2];
|
mpos[2] = cpos[2];
|
||||||
cx = players[consoleplayer].camera->x;
|
cx = players[consoleplayer].camera->x;
|
||||||
cy = players[consoleplayer].camera->y;
|
cy = players[consoleplayer].camera->y;
|
||||||
}
|
}
|
||||||
|
@ -1577,8 +1576,8 @@ FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t
|
||||||
// Find the closest point on the sector's boundary lines and use
|
// Find the closest point on the sector's boundary lines and use
|
||||||
// that as the perceived origin of the sound.
|
// that as the perceived origin of the sound.
|
||||||
sec->ClosestPoint(players[consoleplayer].camera->x, players[consoleplayer].camera->y, cx, cy);
|
sec->ClosestPoint(players[consoleplayer].camera->x, players[consoleplayer].camera->y, cx, cy);
|
||||||
pos[0] = FIXED2FLOAT(cx);
|
mpos[0] = FIXED2FLOAT(cx);
|
||||||
pos[2] = FIXED2FLOAT(cy);
|
mpos[2] = FIXED2FLOAT(cy);
|
||||||
}
|
}
|
||||||
// Set sound height based on channel.
|
// Set sound height based on channel.
|
||||||
if (channum == CHAN_FLOOR)
|
if (channum == CHAN_FLOOR)
|
||||||
|
@ -1598,13 +1597,12 @@ FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t
|
||||||
{
|
{
|
||||||
cz = players[consoleplayer].camera->z;
|
cz = players[consoleplayer].camera->z;
|
||||||
}
|
}
|
||||||
pos[1] = FIXED2FLOAT(cz);
|
mpos[1] = FIXED2FLOAT(cz);
|
||||||
|
|
||||||
// How far are we from the perceived sound origin? Within a certain
|
// How far are we from the perceived sound origin? Within a certain
|
||||||
// short distance, we interpolate between 2D panning and full 3D panning.
|
// short distance, we interpolate between 2D panning and full 3D panning.
|
||||||
const double interp_range = 32.0;
|
const double interp_range = 32.0;
|
||||||
double dx = cpos[0] - pos[0], dy = cpos[1] - pos[1], dz = cpos[2] - pos[2];
|
double dist_sqr = (cpos - mpos).LengthSquared();
|
||||||
double dist_sqr = dx*dx + dy*dy + dz*dz;
|
|
||||||
|
|
||||||
if (dist_sqr == 0)
|
if (dist_sqr == 0)
|
||||||
{
|
{
|
||||||
|
@ -1630,7 +1628,7 @@ FMOD_MODE FMODSoundRenderer::SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t
|
||||||
}
|
}
|
||||||
return oldmode;
|
return oldmode;
|
||||||
}
|
}
|
||||||
else if (cpos[0] == pos[0] && cpos[1] == pos[1] && cpos[2] == pos[2])
|
else if (cpos == mpos)
|
||||||
{ // Head relative
|
{ // Head relative
|
||||||
return (oldmode & ~FMOD_3D) | FMOD_2D;
|
return (oldmode & ~FMOD_3D) | FMOD_2D;
|
||||||
}
|
}
|
||||||
|
@ -1754,7 +1752,7 @@ void FMODSoundRenderer::SetInactive(bool inactive)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FMODSoundRenderer::UpdateSoundParams3D(FSoundChan *chan, float pos[3], float vel[3])
|
void FMODSoundRenderer::UpdateSoundParams3D(FSoundChan *chan, const FVector3 &pos, const FVector3 &vel)
|
||||||
{
|
{
|
||||||
if (chan == NULL || chan->SysChannel == NULL)
|
if (chan == NULL || chan->SysChannel == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -1771,7 +1769,7 @@ void FMODSoundRenderer::UpdateSoundParams3D(FSoundChan *chan, float pos[3], floa
|
||||||
{ // Only set the mode if it changed.
|
{ // Only set the mode if it changed.
|
||||||
fchan->setMode(mode);
|
fchan->setMode(mode);
|
||||||
}
|
}
|
||||||
fchan->set3DAttributes((FMOD_VECTOR *)pos, (FMOD_VECTOR *)vel);
|
fchan->set3DAttributes((FMOD_VECTOR *)&pos[0], (FMOD_VECTOR *)&vel[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
// Starts a sound.
|
// Starts a sound.
|
||||||
FSoundChan *StartSound (sfxinfo_t *sfx, float vol, int pitch, int chanflags, FSoundChan *reuse_chan);
|
FSoundChan *StartSound (sfxinfo_t *sfx, float vol, int pitch, int chanflags, FSoundChan *reuse_chan);
|
||||||
FSoundChan *StartSound3D (sfxinfo_t *sfx, float vol, float distscale, int pitch, int priority, float pos[3], float vel[3], sector_t *sector, int channum, int chanflags, FSoundChan *reuse_chan);
|
FSoundChan *StartSound3D (sfxinfo_t *sfx, float vol, float distscale, int pitch, int priority, const FVector3 &pos, const FVector3 &vel, const sector_t *sector, int channum, int chanflags, FSoundChan *reuse_chan);
|
||||||
|
|
||||||
// Stops a sound channel.
|
// Stops a sound channel.
|
||||||
void StopSound (FSoundChan *chan);
|
void StopSound (FSoundChan *chan);
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
void SetInactive (bool inactive);
|
void SetInactive (bool inactive);
|
||||||
|
|
||||||
// Updates the position of a sound channel.
|
// Updates the position of a sound channel.
|
||||||
void UpdateSoundParams3D (FSoundChan *chan, float pos[3], float vel[3]);
|
void UpdateSoundParams3D (FSoundChan *chan, const FVector3 &pos, const FVector3 &vel);
|
||||||
|
|
||||||
void UpdateListener ();
|
void UpdateListener ();
|
||||||
void UpdateSounds ();
|
void UpdateSounds ();
|
||||||
|
@ -69,7 +69,7 @@ private:
|
||||||
|
|
||||||
void HandleChannelDelay(FMOD::Channel *chan, FSoundChan *reuse_chan, float freq) const;
|
void HandleChannelDelay(FMOD::Channel *chan, FSoundChan *reuse_chan, float freq) const;
|
||||||
FSoundChan *CommonChannelSetup(FMOD::Channel *chan, FSoundChan *reuse_chan) const;
|
FSoundChan *CommonChannelSetup(FMOD::Channel *chan, FSoundChan *reuse_chan) const;
|
||||||
FMOD_MODE SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t *sfx, float pos[3], int channum, int chanflags, sector_t *sec, FMOD_MODE oldmode) const;
|
FMOD_MODE SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t *sfx, const FVector3 &pos, int channum, int chanflags, const sector_t *sec, FMOD_MODE oldmode) const;
|
||||||
void DoLoad (void **slot, sfxinfo_t *sfx);
|
void DoLoad (void **slot, sfxinfo_t *sfx);
|
||||||
void getsfx (sfxinfo_t *sfx);
|
void getsfx (sfxinfo_t *sfx);
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ public:
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
FSoundChan *StartSound3D (sfxinfo_t *sfx, float vol, float distscale, int pitch, int priority, float pos[3], float vel[3], sector_t *sector, int channum, int chanflags, FSoundChan *reuse_chan)
|
FSoundChan *StartSound3D (sfxinfo_t *sfx, float vol, float distscale, int pitch, int priority, const FVector3 &pos, const FVector3 &vel, const sector_t *sector, int channum, int chanflags, FSoundChan *reuse_chan)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the volume, separation, and pitch of a sound channel.
|
// Updates the volume, separation, and pitch of a sound channel.
|
||||||
void UpdateSoundParams3D (FSoundChan *chan, float pos[3], float vel[3])
|
void UpdateSoundParams3D (FSoundChan *chan, const FVector3 &pos, const FVector3 &vel)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
|
|
||||||
// Starts a sound.
|
// Starts a sound.
|
||||||
virtual FSoundChan *StartSound (sfxinfo_t *sfx, float vol, int pitch, int chanflags, FSoundChan *reuse_chan) = 0;
|
virtual FSoundChan *StartSound (sfxinfo_t *sfx, float vol, int pitch, int chanflags, FSoundChan *reuse_chan) = 0;
|
||||||
virtual FSoundChan *StartSound3D (sfxinfo_t *sfx, float vol, float distscale, int pitch, int priority, float pos[3], float vel[3], sector_t *sector, int channum, int chanflags, FSoundChan *reuse_chan) = 0;
|
virtual FSoundChan *StartSound3D (sfxinfo_t *sfx, float vol, float distscale, int pitch, int priority, const FVector3 &pos, const FVector3 &vel, const sector_t *sector, int channum, int chanflags, FSoundChan *reuse_chan) = 0;
|
||||||
|
|
||||||
// Stops a sound channel.
|
// Stops a sound channel.
|
||||||
virtual void StopSound (FSoundChan *chan) = 0;
|
virtual void StopSound (FSoundChan *chan) = 0;
|
||||||
|
@ -108,7 +108,7 @@ public:
|
||||||
virtual void SetInactive(bool inactive) = 0;
|
virtual void SetInactive(bool inactive) = 0;
|
||||||
|
|
||||||
// Updates the volume, separation, and pitch of a sound channel.
|
// Updates the volume, separation, and pitch of a sound channel.
|
||||||
virtual void UpdateSoundParams3D (FSoundChan *chan, float pos[3], float vel[3]) = 0;
|
virtual void UpdateSoundParams3D (FSoundChan *chan, const FVector3 &pos, const FVector3 &vel) = 0;
|
||||||
|
|
||||||
virtual void UpdateListener () = 0;
|
virtual void UpdateListener () = 0;
|
||||||
virtual void UpdateSounds () = 0;
|
virtual void UpdateSounds () = 0;
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include "st_start.h"
|
#include "st_start.h"
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "r_translate.h"
|
#include "r_translate.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "decallib.h"
|
#include "decallib.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "thingdef.h"
|
#include "thingdef.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "r_translate.h"
|
#include "r_translate.h"
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "c_console.h"
|
#include "c_console.h"
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "a_sharedglobal.h"
|
#include "a_sharedglobal.h"
|
||||||
#include "a_doomglobal.h"
|
#include "a_doomglobal.h"
|
||||||
#include "thingdef/thingdef.h"
|
#include "thingdef/thingdef.h"
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "vectors.h"
|
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "thingdef.h"
|
#include "thingdef.h"
|
||||||
#include "vectors.h"
|
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue