mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +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
|
// [RH] Load sound environments
|
||||||
S_ParseReverbDef ();
|
S_ParseReverbDef ();
|
||||||
|
|
||||||
|
// [RH] Parse any SNDINFO lumps
|
||||||
|
Printf ("S_InitData: Load sound definitions.\n");
|
||||||
|
S_InitData ();
|
||||||
|
|
||||||
// [RH] Parse through all loaded mapinfo lumps
|
// [RH] Parse through all loaded mapinfo lumps
|
||||||
Printf ("G_ParseMapInfo: Load map definitions.\n");
|
Printf ("G_ParseMapInfo: Load map definitions.\n");
|
||||||
G_ParseMapInfo (iwad_info->MapInfo);
|
G_ParseMapInfo (iwad_info->MapInfo);
|
||||||
ReadStatistics();
|
ReadStatistics();
|
||||||
|
|
||||||
// [RH] Parse any SNDINFO lumps
|
|
||||||
Printf ("S_InitData: Load sound definitions.\n");
|
|
||||||
S_InitData ();
|
|
||||||
|
|
||||||
Printf ("Texman.Init: Init texture manager.\n");
|
Printf ("Texman.Init: Init texture manager.\n");
|
||||||
TexMan.Init();
|
TexMan.Init();
|
||||||
C_InitConback();
|
C_InitConback();
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
//#include "autosegs.h"
|
|
||||||
#include "sc_man.h"
|
#include "sc_man.h"
|
||||||
|
#include "s_sound.h"
|
||||||
|
|
||||||
struct level_info_t;
|
struct level_info_t;
|
||||||
struct cluster_info_t;
|
struct cluster_info_t;
|
||||||
|
@ -327,6 +327,8 @@ struct level_info_t
|
||||||
|
|
||||||
TArray<FSpecialAction> specialactions;
|
TArray<FSpecialAction> specialactions;
|
||||||
|
|
||||||
|
TArray<FSoundID> PrecacheSounds;
|
||||||
|
|
||||||
level_info_t()
|
level_info_t()
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
|
|
|
@ -269,6 +269,7 @@ void level_info_t::Reset()
|
||||||
teamdamage = 0.f;
|
teamdamage = 0.f;
|
||||||
specialactions.Clear();
|
specialactions.Clear();
|
||||||
DefaultEnvironment = 0;
|
DefaultEnvironment = 0;
|
||||||
|
PrecacheSounds.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1029,7 +1030,7 @@ DEFINE_MAP_OPTION(specialaction, true)
|
||||||
sa->Action = P_FindLineSpecial(parse.sc.String, &min_arg, &max_arg);
|
sa->Action = P_FindLineSpecial(parse.sc.String, &min_arg, &max_arg);
|
||||||
if (sa->Action == 0 || min_arg < 0)
|
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;
|
int j = 0;
|
||||||
while (j < 5 && parse.sc.CheckString(","))
|
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);
|
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)
|
DEFINE_MAP_OPTION(redirect, true)
|
||||||
{
|
{
|
||||||
parse.ParseAssign();
|
parse.ParseAssign();
|
||||||
|
|
|
@ -477,6 +477,7 @@ void S_PrecacheLevel ()
|
||||||
AActor *actor;
|
AActor *actor;
|
||||||
TThinkerIterator<AActor> iterator;
|
TThinkerIterator<AActor> iterator;
|
||||||
|
|
||||||
|
// Precache all sounds known to be used by the currently spawned actors.
|
||||||
while ( (actor = iterator.Next()) != NULL )
|
while ( (actor = iterator.Next()) != NULL )
|
||||||
{
|
{
|
||||||
S_sfx[actor->SeeSound].bUsed = true;
|
S_sfx[actor->SeeSound].bUsed = true;
|
||||||
|
@ -486,6 +487,11 @@ void S_PrecacheLevel ()
|
||||||
S_sfx[actor->ActiveSound].bUsed = true;
|
S_sfx[actor->ActiveSound].bUsed = true;
|
||||||
S_sfx[actor->UseSound].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)
|
for (i = 1; i < S_sfx.Size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue