mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- 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:
parent
9d82c7fa0e
commit
625482aaeb
4 changed files with 28 additions and 15 deletions
13
src/actor.h
13
src/actor.h
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue