mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- fixed sound issues with DSDHacked.
* forward declarations must be allowed. * this must disable map-local SNDINFOs because the added sounds would get lost otherwise.
This commit is contained in:
parent
f72da434a8
commit
2fe0a7c60d
4 changed files with 22 additions and 2 deletions
|
@ -3358,6 +3358,8 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
|
|||
if (!batchrun) Printf ("DecalLibrary: Load decals.\n");
|
||||
DecalLibrary.ReadAllDecals ();
|
||||
|
||||
auto numbasesounds = soundEngine->GetNumSounds();
|
||||
|
||||
// Load embedded Dehacked patches
|
||||
D_LoadDehLumps(FromIWAD);
|
||||
|
||||
|
@ -3387,6 +3389,9 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
|
|||
// Create replacements for dehacked pickups
|
||||
FinishDehPatch();
|
||||
|
||||
auto numdehsounds = soundEngine->GetNumSounds();
|
||||
if (numbasesounds < numdehsounds) S_LockLocalSndinfo(); // DSDHacked sounds are not compatible with map-local SNDINFOs.
|
||||
|
||||
if (!batchrun) Printf("M_Init: Init menus.\n");
|
||||
SetDefaultMenuColors();
|
||||
M_Init();
|
||||
|
|
|
@ -270,7 +270,7 @@ struct MBFParamState
|
|||
FSoundID GetSoundArg(int i, int def = 0)
|
||||
{
|
||||
int num = argsused & (1 << i) ? (int)args[i] : def;
|
||||
return DehFindSound(num-1, true);
|
||||
return DehFindSound(num-1);
|
||||
}
|
||||
|
||||
double GetFloatArg(int i, double def = 0)
|
||||
|
|
|
@ -172,6 +172,7 @@ struct FSavedPlayerSoundInfo
|
|||
|
||||
// This specifies whether Timidity or Windows playback is preferred for a certain song (only useful for Windows.)
|
||||
MusicAliasMap MusicAliases;
|
||||
static bool sndinfo_locked;
|
||||
|
||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||
|
||||
|
@ -581,7 +582,10 @@ void S_ParseSndInfo (bool redefine)
|
|||
{
|
||||
int lump;
|
||||
|
||||
if (!redefine) SavedPlayerSounds.Clear(); // clear skin sounds only for initial parsing.
|
||||
if (redefine && sndinfo_locked) return;
|
||||
|
||||
SavedPlayerSounds.Clear(); // clear skin sounds only for initial parsing.
|
||||
|
||||
S_ClearSoundData(); // remove old sound data first!
|
||||
|
||||
CurrentPitchMask = 0;
|
||||
|
@ -610,6 +614,11 @@ void S_ParseSndInfo (bool redefine)
|
|||
S_CheckIntegrity();
|
||||
}
|
||||
|
||||
void S_LockLocalSndinfo()
|
||||
{
|
||||
sndinfo_locked = true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Adds a level specific SNDINFO lump
|
||||
|
@ -618,6 +627,11 @@ void S_ParseSndInfo (bool redefine)
|
|||
|
||||
void S_AddLocalSndInfo(int lump)
|
||||
{
|
||||
if (sndinfo_locked)
|
||||
{
|
||||
Printf("Local SNDINFO cannot be combined with DSDHacked sounds!");
|
||||
return;
|
||||
}
|
||||
S_AddSNDINFO(lump);
|
||||
soundEngine->HashSounds ();
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ extern MusicAliasMap MusicAliases;
|
|||
// [RH] S_sfx "maintenance" routines
|
||||
void S_ClearSoundData();
|
||||
void S_ParseSndInfo (bool redefine);
|
||||
void S_LockLocalSndinfo();
|
||||
|
||||
bool S_AreSoundsEquivalent (AActor *actor, FSoundID id1, FSoundID id2);
|
||||
FSoundID S_LookupPlayerSound (const char *playerclass, int gender, FSoundID refid);
|
||||
|
|
Loading…
Reference in a new issue