[iortcw] 15/497: All: Make the AL version of AddLoopingSound closer to Base version
Simon McVittie
smcv at debian.org
Fri Sep 8 10:36:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 1147f7a4978e616061ac148a6f2784439a7f4b27
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Mon Jan 20 22:06:24 2014 +0000
All: Make the AL version of AddLoopingSound closer to Base version
---
MP/code/client/snd_openal.c | 20 +++++++++++++++++---
SP/code/client/snd_openal.c | 20 +++++++++++++++++---
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/MP/code/client/snd_openal.c b/MP/code/client/snd_openal.c
index 0657066..68ba042 100644
--- a/MP/code/client/snd_openal.c
+++ b/MP/code/client/snd_openal.c
@@ -1388,7 +1388,7 @@ S_AL_SrcLoop
=================
*/
static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
- const vec3_t origin, const vec3_t velocity, int entityNum )
+ const vec3_t origin, const vec3_t velocity, int entityNum, int volume )
{
int src;
sentity_t *sent = &entityList[ entityNum ];
@@ -1448,8 +1448,15 @@ static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
VectorClear(sorigin);
+ if ( volume > 255 ) {
+ volume = 255;
+ } else if ( volume < 0 ) {
+ volume = 0;
+ }
+
qalSourcefv(curSource->alSource, AL_POSITION, sorigin);
qalSourcefv(curSource->alSource, AL_VELOCITY, vec3_origin);
+ S_AL_Gain(curSource->alSource, volume / 255.0f);
}
else
{
@@ -1472,8 +1479,15 @@ static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
else
VectorClear(svelocity);
+ if ( volume > 255 ) {
+ volume = 255;
+ } else if ( volume < 0 ) {
+ volume = 0;
+ }
+
qalSourcefv(curSource->alSource, AL_POSITION, (ALfloat *) sorigin);
qalSourcefv(curSource->alSource, AL_VELOCITY, (ALfloat *) svelocity);
+ S_AL_Gain(curSource->alSource, volume / 255.0f);
}
}
@@ -1484,7 +1498,7 @@ S_AL_AddLoopingSound
*/
static void S_AL_AddLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, const int range, sfxHandle_t sfx, int volume)
{
- S_AL_SrcLoop(SRCPRI_ENTITY, sfx, origin, velocity, entityNum);
+ S_AL_SrcLoop(SRCPRI_ENTITY, sfx, origin, velocity, entityNum, volume);
}
/*
@@ -1494,7 +1508,7 @@ S_AL_AddRealLoopingSound
*/
static void S_AL_AddRealLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, const int range, sfxHandle_t sfx)
{
- S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum);
+ S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum, 0);
}
/*
diff --git a/SP/code/client/snd_openal.c b/SP/code/client/snd_openal.c
index f9dc9bd..52ea8f1 100644
--- a/SP/code/client/snd_openal.c
+++ b/SP/code/client/snd_openal.c
@@ -1388,7 +1388,7 @@ S_AL_SrcLoop
=================
*/
static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
- const vec3_t origin, const vec3_t velocity, int entityNum )
+ const vec3_t origin, const vec3_t velocity, int entityNum, int volume )
{
int src;
sentity_t *sent = &entityList[ entityNum ];
@@ -1448,8 +1448,15 @@ static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
VectorClear(sorigin);
+ if ( volume > 255 ) {
+ volume = 255;
+ } else if ( volume < 0 ) {
+ volume = 0;
+ }
+
qalSourcefv(curSource->alSource, AL_POSITION, sorigin);
qalSourcefv(curSource->alSource, AL_VELOCITY, vec3_origin);
+ S_AL_Gain(curSource->alSource, volume / 255.0f);
}
else
{
@@ -1472,8 +1479,15 @@ static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
else
VectorClear(svelocity);
+ if ( volume > 255 ) {
+ volume = 255;
+ } else if ( volume < 0 ) {
+ volume = 0;
+ }
+
qalSourcefv(curSource->alSource, AL_POSITION, (ALfloat *) sorigin);
qalSourcefv(curSource->alSource, AL_VELOCITY, (ALfloat *) svelocity);
+ S_AL_Gain(curSource->alSource, volume / 255.0f);
}
}
@@ -1484,7 +1498,7 @@ S_AL_AddLoopingSound
*/
static void S_AL_AddLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, const int range, sfxHandle_t sfx, int volume)
{
- S_AL_SrcLoop(SRCPRI_ENTITY, sfx, origin, velocity, entityNum);
+ S_AL_SrcLoop(SRCPRI_ENTITY, sfx, origin, velocity, entityNum, volume);
}
/*
@@ -1494,7 +1508,7 @@ S_AL_AddRealLoopingSound
*/
static void S_AL_AddRealLoopingSound(int entityNum, const vec3_t origin, const vec3_t velocity, const int range, sfxHandle_t sfx)
{
- S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum);
+ S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum, 0);
}
/*
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list