mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 09:11:17 +00:00
- Added PrecacheSounds mapinfo option. This takes a list of sounds to preload when the level is
loaded. SVN r3837 (trunk)
This commit is contained in:
parent
8a021c4b4b
commit
9d82c7fa0e
4 changed files with 35 additions and 7 deletions
|
@ -2209,15 +2209,15 @@ void D_DoomMain (void)
|
|||
// [RH] Load sound environments
|
||||
S_ParseReverbDef ();
|
||||
|
||||
// [RH] Parse any SNDINFO lumps
|
||||
Printf ("S_InitData: Load sound definitions.\n");
|
||||
S_InitData ();
|
||||
|
||||
// [RH] Parse through all loaded mapinfo lumps
|
||||
Printf ("G_ParseMapInfo: Load map definitions.\n");
|
||||
G_ParseMapInfo (iwad_info->MapInfo);
|
||||
ReadStatistics();
|
||||
|
||||
// [RH] Parse any SNDINFO lumps
|
||||
Printf ("S_InitData: Load sound definitions.\n");
|
||||
S_InitData ();
|
||||
|
||||
Printf ("Texman.Init: Init texture manager.\n");
|
||||
TexMan.Init();
|
||||
C_InitConback();
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "doomdef.h"
|
||||
//#include "autosegs.h"
|
||||
#include "sc_man.h"
|
||||
#include "s_sound.h"
|
||||
|
||||
struct level_info_t;
|
||||
struct cluster_info_t;
|
||||
|
@ -327,6 +327,8 @@ struct level_info_t
|
|||
|
||||
TArray<FSpecialAction> specialactions;
|
||||
|
||||
TArray<FSoundID> PrecacheSounds;
|
||||
|
||||
level_info_t()
|
||||
{
|
||||
Reset();
|
||||
|
|
|
@ -269,6 +269,7 @@ void level_info_t::Reset()
|
|||
teamdamage = 0.f;
|
||||
specialactions.Clear();
|
||||
DefaultEnvironment = 0;
|
||||
PrecacheSounds.Clear();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1029,7 +1030,7 @@ DEFINE_MAP_OPTION(specialaction, true)
|
|||
sa->Action = P_FindLineSpecial(parse.sc.String, &min_arg, &max_arg);
|
||||
if (sa->Action == 0 || min_arg < 0)
|
||||
{
|
||||
parse.sc.ScriptError("Unknown specialaction '%s'");
|
||||
parse.sc.ScriptError("Unknown specialaction '%s'", parse.sc.String);
|
||||
}
|
||||
int j = 0;
|
||||
while (j < 5 && parse.sc.CheckString(","))
|
||||
|
@ -1040,6 +1041,25 @@ DEFINE_MAP_OPTION(specialaction, true)
|
|||
if (parse.format_type == parse.FMT_Old) parse.sc.SetCMode(false);
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(PrecacheSounds, true)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
|
||||
do
|
||||
{
|
||||
parse.sc.MustGetString();
|
||||
FSoundID snd = parse.sc.String;
|
||||
if (snd == 0)
|
||||
{
|
||||
parse.sc.ScriptMessage("Unknown sound \"%s\"", parse.sc.String);
|
||||
}
|
||||
else
|
||||
{
|
||||
info->PrecacheSounds.Push(snd);
|
||||
}
|
||||
} while (parse.sc.CheckString(","));
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(redirect, true)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
|
|
|
@ -477,7 +477,8 @@ void S_PrecacheLevel ()
|
|||
AActor *actor;
|
||||
TThinkerIterator<AActor> iterator;
|
||||
|
||||
while ( (actor = iterator.Next ()) != NULL )
|
||||
// Precache all sounds known to be used by the currently spawned actors.
|
||||
while ( (actor = iterator.Next()) != NULL )
|
||||
{
|
||||
S_sfx[actor->SeeSound].bUsed = true;
|
||||
S_sfx[actor->AttackSound].bUsed = true;
|
||||
|
@ -486,6 +487,11 @@ void S_PrecacheLevel ()
|
|||
S_sfx[actor->ActiveSound].bUsed = true;
|
||||
S_sfx[actor->UseSound].bUsed = true;
|
||||
}
|
||||
// Precache all extra sounds requested by this map.
|
||||
for (i = 0; i < level.info->PrecacheSounds.Size(); ++i)
|
||||
{
|
||||
S_sfx[level.info->PrecacheSounds[i]].bUsed = true;
|
||||
}
|
||||
|
||||
for (i = 1; i < S_sfx.Size(); ++i)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue