mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-22 12:11:17 +00:00
cleanup of Blood sound playing interface
This commit is contained in:
parent
7b3203c607
commit
401c260f9c
5 changed files with 48 additions and 25 deletions
|
@ -1947,18 +1947,6 @@ static int checkDamageType(DBloodActor* actor, DAMAGE_TYPE damageType)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case kDamageFall:
|
||||
switch (actor->GetType())
|
||||
{
|
||||
case kDudeCultistTommy:
|
||||
case kDudeCultistShotgun:
|
||||
nSeq = 1;
|
||||
break;
|
||||
default:
|
||||
nSeq = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
nSeq = 1;
|
||||
break;
|
||||
|
|
|
@ -181,11 +181,9 @@ void sfxPlay3DSectorSound(const DVector3& pos, int soundId, sectortype* pSector)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sfxPlay3DSoundVolume(DBloodActor* pActor, int soundId, int playchannel, int playflags, int pitch, int volume)
|
||||
void sfxPlay3DSoundVolume(DBloodActor* pActor, FSoundID sid, int playchannel, int playflags, int pitch, int volume)
|
||||
{
|
||||
if (!SoundEnabled() || soundId <= 0 || !pActor) return;
|
||||
auto sid = soundEngine->FindSoundByResID(soundId);
|
||||
if (!sid.isvalid()) return;
|
||||
if (!SoundEnabled() || !sid.isvalid() || !pActor) return;
|
||||
|
||||
auto svec = GetSoundPos(pActor->spr.pos);
|
||||
|
||||
|
@ -224,11 +222,18 @@ void sfxPlay3DSoundVolume(DBloodActor* pActor, int soundId, int playchannel, int
|
|||
soundEngine->StartSound(SOURCE_Actor, pActor, &svec, playchannel, flags, sid, volume * (0.8f / 80.f), attenuation, nullptr, pitch / 65536.f);
|
||||
}
|
||||
|
||||
void sfxPlay3DSound(DBloodActor* pActor, int soundId, int a3, int a4)
|
||||
{
|
||||
sfxPlay3DSoundVolume(pActor, soundId, a3, a4, -1);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sfxPlay3DSoundVolume(DBloodActor* pActor, int soundId, int playchannel, int playflags, int pitch, int volume)
|
||||
{
|
||||
if (soundId <= 0) return;
|
||||
auto sid = soundEngine->FindSoundByResID(soundId);
|
||||
if (sid.isvalid()) sfxPlay3DSoundVolume(pActor, sid, playchannel, playflags, pitch, volume);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -29,9 +29,18 @@ void sndTerm(void);
|
|||
void sndInit(void);
|
||||
|
||||
void sfxPlay3DSectorSound(const DVector3& pos, int soundId, sectortype* pSector);
|
||||
void sfxPlay3DSound(DBloodActor* pSprite, int soundId, int a3 = -1, int a4 = 0);
|
||||
void sfxPlay3DSoundVolume(DBloodActor* pSprite, int soundId, int a3 = -1, int a4 = 0, int pitch = 0, int volume = 0);
|
||||
void sfxKill3DSound(DBloodActor* pSprite, int a2 = -1, int a3 = -1);
|
||||
void sfxPlay3DSoundVolume(DBloodActor* pActor, FSoundID sid, int playchannel = -1, int playflags = 0, int pitch = 0, int volume = 0);
|
||||
void sfxPlay3DSoundVolume(DBloodActor* pActor, int soundId, int playchannel = -1, int playflags = 0, int pitch = 0, int volume = 0);
|
||||
|
||||
inline void sfxPlay3DSound(DBloodActor* pActor, FSoundID soundId, int a3 = -1, int a4 = 0)
|
||||
{
|
||||
sfxPlay3DSoundVolume(pActor, soundId, a3, a4, 0, -1);
|
||||
}
|
||||
inline void sfxPlay3DSound(DBloodActor* pActor, int soundId, int a3 = -1, int a4 = 0)
|
||||
{
|
||||
sfxPlay3DSoundVolume(pActor, soundId, a3, a4, 0, -1);
|
||||
}
|
||||
void sfxKill3DSound(DBloodActor* pActor, int a2 = -1, int a3 = -1);
|
||||
void sfxKillAllSounds(void);
|
||||
void sfxSetReverb(bool toggle);
|
||||
void sfxSetReverb2(bool toggle);
|
||||
|
|
|
@ -327,13 +327,33 @@ DEFINE_ACTION_FUNCTION_NATIVE(DBloodActor, HitScan, bloodactor_HitScan)
|
|||
ACTION_RETURN_INT(bloodactor_HitScan(self, z, x, y, zz, clipmask, clipdist));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBloodActor, play3DSoundID, sfxPlay3DSound)
|
||||
void blood_play3DSoundID(DBloodActor* actor, int snd, int chn, int flags)
|
||||
{
|
||||
sfxPlay3DSoundVolume(actor, snd, chn, flags, 0, -1);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBloodActor, play3DSoundID, blood_play3DSoundID)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBloodActor);
|
||||
PARAM_INT(sound);
|
||||
PARAM_INT(chan);
|
||||
PARAM_INT(flags);
|
||||
sfxPlay3DSound(self, sound, chan, flags);
|
||||
blood_play3DSoundID(self, sound, chan, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void blood_play3DSound(DBloodActor* actor, int snd, int chn, int flags)
|
||||
{
|
||||
sfxPlay3DSoundVolume(actor, FSoundID::fromInt(snd), chn, flags, 0, -1);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBloodActor, play3DSound, blood_play3DSound)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBloodActor);
|
||||
PARAM_INT(sound);
|
||||
PARAM_INT(chan);
|
||||
PARAM_INT(flags);
|
||||
blood_play3DSound(self, sound, chan, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -361,6 +361,7 @@ native void callbackMissileBurst();
|
|||
native int HitScan(double z, vector3 xyz, int clipmask, double clipdist);
|
||||
native void impactMissile(int hitcode);
|
||||
|
||||
native void play3DSound(Sound soundId, int a3 = -1, int a4 = 0);
|
||||
native void play3DSoundID(int soundId, int a3 = -1, int a4 = 0);
|
||||
native void seqSpawnID(int seqID, VMFunction seqCallbackID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue