mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- adapted SW's sound system to actors.
This commit is contained in:
parent
221d9fe28e
commit
0a9792ac28
5 changed files with 30 additions and 30 deletions
|
@ -1813,7 +1813,7 @@ enum
|
|||
short SoundDist(int x, int y, int z, int basedist);
|
||||
short SoundAngle(int x, int y);
|
||||
//void PlaySound(int num, short angle, short vol);
|
||||
int _PlaySound(int num, SPRITEp sprite, PLAYERp player, vec3_t *pos, Voc3D_Flags flags, int channel, EChanFlags sndflags);
|
||||
int _PlaySound(int num, DSWActor* sprite, PLAYERp player, vec3_t *pos, Voc3D_Flags flags, int channel, EChanFlags sndflags);
|
||||
void InitAmbient(int num, DSWActor* actor);
|
||||
|
||||
inline void PlaySound(int num, PLAYERp player, Voc3D_Flags flags, int channel = 8, EChanFlags sndflags = CHANF_NONE)
|
||||
|
@ -1832,7 +1832,7 @@ inline void PlaySound(int num, vec3_t *pos, Voc3D_Flags flags, int channel = 8,
|
|||
int _PlayerSound(int num, PLAYERp pp);
|
||||
inline int PlayerSound(int num, int flags, PLAYERp pp) { return _PlayerSound(num, pp); }
|
||||
void StopPlayerSound(PLAYERp pp, int which = -1);
|
||||
bool SoundValidAndActive(SPRITEp spr, int channel);
|
||||
bool SoundValidAndActive(DSWActor* spr, int channel);
|
||||
|
||||
|
||||
ANIMATOR DoActorBeginJump,DoActorJump,DoActorBeginFall,DoActorFall,DoActorDeathMove;
|
||||
|
@ -2224,7 +2224,7 @@ inline bool PLAYER_MOVING(PLAYERp pp)
|
|||
|
||||
inline void PlaySound(int num, DSWActor* actor, Voc3D_Flags flags, int channel = 8, EChanFlags sndflags = CHANF_NONE)
|
||||
{
|
||||
_PlaySound(num, &actor->s(), nullptr, nullptr, flags, channel, sndflags);
|
||||
_PlaySound(num, actor, nullptr, nullptr, flags, channel, sndflags);
|
||||
}
|
||||
|
||||
struct ANIMstruct
|
||||
|
|
|
@ -165,7 +165,7 @@ int DoToiletGirl(DSWActor* actor)
|
|||
|
||||
choose_snd = RANDOM_P2(1024<<4)>>4;
|
||||
|
||||
if (!SoundValidAndActive(sp, CHAN_ToiletFart))
|
||||
if (!SoundValidAndActive(actor, CHAN_ToiletFart))
|
||||
{
|
||||
if (choose_snd > 750)
|
||||
PlaySound(DIGI_TOILETGIRLFART1, actor, v3df_dontpan, CHAN_ToiletFart);
|
||||
|
@ -178,7 +178,7 @@ int DoToiletGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
if (RandomRange(1000<<8)>>8 > 500)
|
||||
PlaySound(DIGI_ANIMEMAD1, actor, v3df_dontpan, CHAN_AnimeMad);
|
||||
|
@ -220,7 +220,7 @@ int NullToiletGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
if (RandomRange(1000<<8)>>8 > 500)
|
||||
PlaySound(DIGI_ANIMEMAD1, actor, v3df_dontpan, CHAN_AnimeMad);
|
||||
|
@ -394,7 +394,7 @@ int DoWashGirl(DSWActor* actor)
|
|||
|
||||
if (RandomRange(1000) > 980 && u->ShellNum <= 0)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeSing))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeSing))
|
||||
{
|
||||
if (RANDOM_P2(1024<<4)>>4 > 500)
|
||||
PlaySound(DIGI_ANIMESING1, actor, v3df_dontpan, CHAN_AnimeSing);
|
||||
|
@ -422,7 +422,7 @@ int DoWashGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
if (RandomRange(1000<<8)>>8 > 500)
|
||||
PlaySound(DIGI_ANIMEMAD1, actor, v3df_dontpan, CHAN_AnimeMad);
|
||||
|
@ -464,7 +464,7 @@ int NullWashGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
if (RandomRange(1000<<8)>>8 > 500)
|
||||
PlaySound(DIGI_ANIMEMAD1, actor, v3df_dontpan, CHAN_AnimeMad);
|
||||
|
@ -1265,7 +1265,7 @@ int DoCarGirl(DSWActor* actor)
|
|||
{
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = RandomRange(1000);
|
||||
|
@ -1315,7 +1315,7 @@ int NullCarGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = RandomRange(1000);
|
||||
|
@ -1480,7 +1480,7 @@ int DoMechanicGirl(DSWActor* actor)
|
|||
{
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = RandomRange(1000);
|
||||
|
@ -1530,7 +1530,7 @@ int NullMechanicGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = RandomRange(1000);
|
||||
|
@ -1696,7 +1696,7 @@ int DoSailorGirl(DSWActor* actor)
|
|||
{
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = RandomRange(1000);
|
||||
|
@ -1751,7 +1751,7 @@ int NullSailorGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = RandomRange(1000);
|
||||
|
@ -1904,7 +1904,7 @@ int DoPruneGirl(DSWActor* actor)
|
|||
{
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = STD_RANDOM_RANGE(1000);
|
||||
|
@ -1924,7 +1924,7 @@ int DoPruneGirl(DSWActor* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_CoyHandle))
|
||||
if (!SoundValidAndActive(actor, CHAN_CoyHandle))
|
||||
{
|
||||
short choose;
|
||||
choose = STD_RANDOM_RANGE(1000);
|
||||
|
@ -1970,7 +1970,7 @@ int NullPruneGirl(DSWActor* actor)
|
|||
}
|
||||
else if ((u->WaitTics -= ACTORMOVETICS) <= 0 && ICanSee)
|
||||
{
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
short choose;
|
||||
choose = RandomRange(1000);
|
||||
|
|
|
@ -1211,7 +1211,7 @@ int DoRipper2StandHeart(DSWActor* actor)
|
|||
|
||||
NullRipper2(actor);
|
||||
|
||||
if (!SoundValidAndActive(sp, CHAN_RipHeart))
|
||||
if (!SoundValidAndActive(actor, CHAN_RipHeart))
|
||||
PlaySound(DIGI_RIPPER2HEARTOUT, actor, v3df_none, CHAN_RipHeart);
|
||||
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
|
||||
|
|
|
@ -323,7 +323,7 @@ static void RestartAmbient(AmbientSound* amb)
|
|||
static int RandomizeAmbientSpecials(int handle)
|
||||
{
|
||||
#define MAXRNDAMB 12
|
||||
static int ambrand[] =
|
||||
static const uint8_t ambrand[] =
|
||||
{
|
||||
56,57,58,59,60,61,62,63,64,65,66,67
|
||||
};
|
||||
|
@ -534,7 +534,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
|
|||
}
|
||||
else if (type == SOURCE_Actor || type == SOURCE_Player)
|
||||
{
|
||||
vpos = type == SOURCE_Actor ? &((SPRITEp)source)->pos : &((PLAYERp)source)->pos;
|
||||
vpos = type == SOURCE_Actor ? &((DSWActor*)source)->s().pos : &((PLAYERp)source)->pos;
|
||||
FVector3 npos = GetSoundPos(vpos);
|
||||
|
||||
*pos = npos;
|
||||
|
@ -629,12 +629,12 @@ void GameInterface::UpdateSounds(void)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags, int channel, EChanFlags cflags)
|
||||
int _PlaySound(int num, DSWActor* actor, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags, int channel, EChanFlags cflags)
|
||||
{
|
||||
if (Prediction || !SoundEnabled() || !soundEngine->isValidSoundId(num))
|
||||
return -1;
|
||||
|
||||
SPRITEp sps = sp;
|
||||
auto sps = actor;
|
||||
|
||||
auto vp = &voc[num];
|
||||
int sourcetype = SOURCE_None;
|
||||
|
@ -643,10 +643,10 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
|
|||
// If the sound is not supposd to be positioned, it may not be linked to the launching actor.
|
||||
if (!(flags & v3df_follow))
|
||||
{
|
||||
if (sp && !pos)
|
||||
if (actor && !pos)
|
||||
{
|
||||
pos = &sp->pos;
|
||||
sp = nullptr;
|
||||
pos = &actor->s().pos;
|
||||
actor = nullptr;
|
||||
}
|
||||
else if (pp && !pos)
|
||||
{
|
||||
|
@ -659,9 +659,9 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
|
|||
{
|
||||
sourcetype = SOURCE_Unattached;
|
||||
}
|
||||
else if (sp != nullptr)
|
||||
else if (actor != nullptr)
|
||||
{
|
||||
source = sp;
|
||||
source = actor;
|
||||
sourcetype = SOURCE_Actor;
|
||||
}
|
||||
else if (pp != nullptr)
|
||||
|
@ -836,7 +836,7 @@ void StopPlayerSound(PLAYERp pp, int which)
|
|||
soundEngine->StopSound(SOURCE_Player, pp, CHAN_VOICE, which);
|
||||
}
|
||||
|
||||
bool SoundValidAndActive(SPRITEp spr, int channel)
|
||||
bool SoundValidAndActive(DSWActor* spr, int channel)
|
||||
{
|
||||
return soundEngine->IsSourcePlayingSomething(SOURCE_Actor, spr, channel);
|
||||
}
|
||||
|
|
|
@ -707,7 +707,7 @@ int DoZillaMove(DSWActor* actor)
|
|||
short choose;
|
||||
|
||||
// Random Zilla taunts
|
||||
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
|
||||
if (!SoundValidAndActive(actor, CHAN_AnimeMad))
|
||||
{
|
||||
choose = STD_RANDOM_RANGE(1000);
|
||||
if (choose > 990)
|
||||
|
|
Loading…
Reference in a new issue