aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-12 10:43:37 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-02-12 10:43:37 +0000
commitfc78095f330982bbf5dd265c8afc37e031a90913 (patch)
treed6ad3b454e535ebfb4ce4c673cca6a6cc0bb0d56
parent2940e0d323d94dd53d244b408d93dec33b05b563 (diff)
downloadioquake3-aero-fc78095f330982bbf5dd265c8afc37e031a90913.tar.gz
ioquake3-aero-fc78095f330982bbf5dd265c8afc37e031a90913.zip
* OpenAL now respatializes using the player entity origin instead of the view
origin by default. The old behaviour is available by setting s_alSpatEntOrigin to 0. git-svn-id: svn://svn.icculus.org/quake3/trunk@539 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--README1
-rw-r--r--code/client/snd_openal.c20
2 files changed, 16 insertions, 5 deletions
diff --git a/README b/README
index 8a2d6b1..cd470ca 100644
--- a/README
+++ b/README
@@ -105,6 +105,7 @@ New cvars
s_alMinDistance - the value of AL_REFERENCE_DISTANCE for each source
s_alRolloff - the value of AL_ROLLOFF_FACTOR for each source
s_alMaxSpeakerDistance - ET_SPEAKERS beyond this distance are culled
+ s_alSpatEntOrigin - spatialize entity origin instead of view origin
s_alDriver - which OpenAL library to use
s_sdlBits - SDL bit resolution
diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c
index 0bbf07b..7514f8b 100644
--- a/code/client/snd_openal.c
+++ b/code/client/snd_openal.c
@@ -39,6 +39,7 @@ cvar_t *s_alMinDistance;
cvar_t *s_alRolloff;
cvar_t *s_alDriver;
cvar_t *s_alMaxSpeakerDistance;
+cvar_t *s_alSpatEntOrigin;
/*
=================
@@ -1460,10 +1461,18 @@ S_AL_Respatialize
static
void S_AL_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater )
{
- float velocity[3] = {0.0f, 0.0f, 0.0f};
- float orientation[6];
+ float velocity[3] = {0.0f, 0.0f, 0.0f};
+ float orientation[6];
+ vec3_t sorigin;
+
+ if( s_alSpatEntOrigin->integer && entityNum )
+ VectorCopy( entityList[ entityNum ].origin, sorigin );
+ else
+ {
+ VectorCopy( origin, sorigin );
+ S_AL_SanitiseVector( sorigin );
+ }
- S_AL_SanitiseVector( (vec_t *)origin );
S_AL_SanitiseVector( axis[ 0 ] );
S_AL_SanitiseVector( axis[ 1 ] );
S_AL_SanitiseVector( axis[ 2 ] );
@@ -1471,10 +1480,10 @@ void S_AL_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int
orientation[0] = axis[0][0]; orientation[1] = axis[0][1]; orientation[2] = axis[0][2];
orientation[3] = axis[2][0]; orientation[4] = axis[2][1]; orientation[5] = axis[2][2];
- VectorCopy( origin, lastListenerOrigin );
+ VectorCopy( sorigin, lastListenerOrigin );
// Set OpenAL listener paramaters
- qalListenerfv(AL_POSITION, (ALfloat *)origin);
+ qalListenerfv(AL_POSITION, (ALfloat *)sorigin);
qalListenerfv(AL_VELOCITY, velocity);
qalListenerfv(AL_ORIENTATION, orientation);
}
@@ -1631,6 +1640,7 @@ qboolean S_AL_Init( soundInterface_t *si )
s_alMinDistance = Cvar_Get( "s_alMinDistance", "120", CVAR_CHEAT );
s_alRolloff = Cvar_Get( "s_alRolloff", "0.8", CVAR_CHEAT );
s_alMaxSpeakerDistance = Cvar_Get( "s_alMaxSpeakerDistance", "1024", CVAR_ARCHIVE );
+ s_alSpatEntOrigin = Cvar_Get( "s_alSpatEntOrigin", "1", CVAR_ARCHIVE );
s_alDriver = Cvar_Get( "s_alDriver", ALDRIVER_DEFAULT, CVAR_ARCHIVE );