- Added actors' BounceSound, WallBounceSound, and CrushPainSound to preloading.

- Moved marking of actor sounds for precaching into a virtual Actor function.

SVN r3838 (trunk)
This commit is contained in:
Randy Heit 2012-08-22 23:17:49 +00:00
parent 9d82c7fa0e
commit 625482aaeb
4 changed files with 28 additions and 15 deletions

View file

@ -585,13 +585,12 @@ public:
// Returns true if this actor is within melee range of its target
bool CheckMeleeRange();
// BeginPlay: Called just after the actor is created
virtual void BeginPlay ();
virtual void PostBeginPlay ();
// LevelSpawned: Called after BeginPlay if this actor was spawned by the world
virtual void LevelSpawned ();
// Translates SpawnFlags into in-game flags.
virtual void HandleSpawnFlags ();
virtual void BeginPlay(); // Called immediately after the actor is created
virtual void PostBeginPlay(); // Called immediately before the actor's first tick
virtual void LevelSpawned(); // Called after BeginPlay if this actor was spawned by the world
virtual void HandleSpawnFlags(); // Translates SpawnFlags into in-game flags.
virtual void MarkPrecacheSounds() const; // Marks sounds used by this actor for precaching.
virtual void Activate (AActor *activator);
virtual void Deactivate (AActor *activator);

View file

@ -3993,6 +3993,19 @@ void AActor::PostBeginPlay ()
PrevAngle = angle;
}
void AActor::MarkPrecacheSounds() const
{
SeeSound.MarkUsed();
AttackSound.MarkUsed();
PainSound.MarkUsed();
DeathSound.MarkUsed();
ActiveSound.MarkUsed();
UseSound.MarkUsed();
BounceSound.MarkUsed();
WallBounceSound.MarkUsed();
CrushPainSound.MarkUsed();
}
bool AActor::isFast()
{
if (flags5&MF5_ALWAYSFAST) return true;

View file

@ -480,17 +480,12 @@ void S_PrecacheLevel ()
// 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;
S_sfx[actor->PainSound].bUsed = true;
S_sfx[actor->DeathSound].bUsed = true;
S_sfx[actor->ActiveSound].bUsed = true;
S_sfx[actor->UseSound].bUsed = true;
actor->MarkPrecacheSounds();
}
// 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;
level.info->PrecacheSounds[i].MarkUsed();
}
for (i = 1; i < S_sfx.Size(); ++i)

View file

@ -65,6 +65,8 @@ struct sfxinfo_t
FRolloffInfo Rolloff;
float Attenuation; // Multiplies the attenuation passed to S_Sound.
void MarkUsed(); // Marks this sound as used.
};
// Rolloff types
@ -132,6 +134,10 @@ public:
{
return ID ? S_sfx[ID].name.GetChars() : NULL;
}
void MarkUsed() const
{
S_sfx[ID].MarkUsed();
}
private:
int ID;
protected: