mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-21 11:21:52 +00:00
Hide OpenALs doppler effect behind s_doppler.
This allows it to disable the doppler effect by setting s_doppler to 0. The default value 1 == enabled.
This commit is contained in:
parent
2e4a48798d
commit
f6e3f1f4bc
3 changed files with 17 additions and 7 deletions
|
@ -166,6 +166,7 @@ extern cvar_t *s_testsound;
|
|||
extern cvar_t *s_ambient;
|
||||
extern cvar_t* s_underwater;
|
||||
extern cvar_t* s_underwater_gain_hf;
|
||||
extern cvar_t* s_doppler;
|
||||
|
||||
/*
|
||||
* Globals
|
||||
|
|
|
@ -225,9 +225,12 @@ AL_Spatialize(channel_t *ch)
|
|||
CL_GetEntitySoundOrigin(ch->entnum, origin);
|
||||
qalSource3f(ch->srcnum, AL_POSITION, AL_UnpackVector(origin));
|
||||
|
||||
CL_GetEntitySoundVelocity(ch->entnum, velocity);
|
||||
VectorScale(velocity, AL_METER_OF_Q2_UNIT, velocity);
|
||||
qalSource3f(ch->srcnum, AL_VELOCITY, AL_UnpackVector(velocity));
|
||||
if (s_doppler->value) {
|
||||
CL_GetEntitySoundVelocity(ch->entnum, velocity);
|
||||
VectorScale(velocity, AL_METER_OF_Q2_UNIT, velocity);
|
||||
qalSource3f(ch->srcnum, AL_VELOCITY, AL_UnpackVector(velocity));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -624,9 +627,11 @@ AL_Update(void)
|
|||
qalListener3f(AL_POSITION, AL_UnpackVector(listener_origin));
|
||||
qalListenerfv(AL_ORIENTATION, orientation);
|
||||
|
||||
CL_GetViewVelocity(listener_velocity);
|
||||
VectorScale(listener_velocity, AL_METER_OF_Q2_UNIT, listener_velocity);
|
||||
qalListener3f(AL_VELOCITY, AL_UnpackVector(listener_velocity));
|
||||
if (s_doppler->value) {
|
||||
CL_GetViewVelocity(listener_velocity);
|
||||
VectorScale(listener_velocity, AL_METER_OF_Q2_UNIT, listener_velocity);
|
||||
qalListener3f(AL_VELOCITY, AL_UnpackVector(listener_velocity));
|
||||
}
|
||||
|
||||
/* update spatialization for dynamic sounds */
|
||||
ch = channels;
|
||||
|
@ -847,7 +852,9 @@ AL_Init(void)
|
|||
Com_Printf("Number of OpenAL sources: %d\n\n", s_numchannels);
|
||||
|
||||
// exaggerate 2x because realistic is barely noticeable
|
||||
qalDopplerFactor(2.0f);
|
||||
if (s_doppler->value) {
|
||||
qalDopplerFactor(2.0f);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ cvar_t *s_show;
|
|||
cvar_t *s_ambient;
|
||||
cvar_t* s_underwater;
|
||||
cvar_t* s_underwater_gain_hf;
|
||||
cvar_t* s_doppler;
|
||||
|
||||
channel_t channels[MAX_CHANNELS];
|
||||
int num_sfx;
|
||||
|
@ -1020,6 +1021,7 @@ S_Init(void)
|
|||
s_ambient = Cvar_Get("s_ambient", "1", 0);
|
||||
s_underwater = Cvar_Get("s_underwater", "1", CVAR_ARCHIVE);
|
||||
s_underwater_gain_hf = Cvar_Get("s_underwater_gain_hf", "0.25", CVAR_ARCHIVE);
|
||||
s_doppler = Cvar_Get("s_doppler", "1", CVAR_ARCHIVE);
|
||||
|
||||
Cmd_AddCommand("play", S_Play);
|
||||
Cmd_AddCommand("stopsound", S_StopAllSounds);
|
||||
|
|
Loading…
Reference in a new issue