Fix some warnings. Hopefully fix bullet plugin.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5287 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
aede46c776
commit
98b71860ed
33 changed files with 439 additions and 264 deletions
|
@ -317,6 +317,17 @@ static cvar_t s_al_velocityscale = CVAR("s_al_velocityscale", "1");
|
|||
static cvar_t s_al_static_listener = CVAR("s_al_static_listener", "0"); //cheat
|
||||
extern cvar_t snd_doppler;
|
||||
|
||||
enum distancemodel_e
|
||||
{
|
||||
DM_INVERSE = 0,
|
||||
DM_INVERSE_CLAMPED = 1,
|
||||
DM_LINEAR = 2,
|
||||
DM_LINEAR_CLAMPED = 3,
|
||||
DM_EXPONENT = 4,
|
||||
DM_EXPONENT_CLAMPED = 5,
|
||||
DM_NONE = 6
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ALuint *source;
|
||||
|
@ -873,20 +884,20 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
|
|||
if (srcrel)
|
||||
{
|
||||
#ifdef FTE_TARGET_WEB
|
||||
switch(0) //emscripten omits it, and this is webaudio's default too.
|
||||
switch(DM_INVERSE) //emscripten omits it, and this is webaudio's default too.
|
||||
#else
|
||||
switch(s_al_distancemodel.ival)
|
||||
switch((enum distancemodel_e)s_al_distancemodel.ival)
|
||||
#endif
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
case 1:
|
||||
case DM_INVERSE:
|
||||
case DM_INVERSE_CLAMPED:
|
||||
palSourcef(src, AL_ROLLOFF_FACTOR, 0);
|
||||
palSourcef(src, AL_REFERENCE_DISTANCE, 1); //0 would be silent, or a division by 0
|
||||
palSourcef(src, AL_MAX_DISTANCE, 1); //only used for clamped mode
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case DM_LINEAR:
|
||||
case DM_LINEAR_CLAMPED:
|
||||
palSourcef(src, AL_ROLLOFF_FACTOR, 0);
|
||||
palSourcef(src, AL_REFERENCE_DISTANCE, 0); //doesn't matter when rolloff is 0
|
||||
palSourcef(src, AL_MAX_DISTANCE, 1); //doesn't matter, so long as its not a nan
|
||||
|
@ -896,20 +907,20 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
|
|||
else
|
||||
{
|
||||
#ifdef FTE_TARGET_WEB
|
||||
switch(2) //emscripten hardcodes it.
|
||||
switch(DM_LINEAR) //emscripten hardcodes it in a buggy kind of way.
|
||||
#else
|
||||
switch(s_al_distancemodel.ival)
|
||||
switch((enum distancemodel_e)s_al_distancemodel.ival)
|
||||
#endif
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
case 1:
|
||||
case DM_INVERSE:
|
||||
case DM_INVERSE_CLAMPED:
|
||||
palSourcef(src, AL_ROLLOFF_FACTOR, s_al_reference_distance.value);
|
||||
palSourcef(src, AL_REFERENCE_DISTANCE, 1);
|
||||
palSourcef(src, AL_MAX_DISTANCE, 1/chan->dist_mult); //clamp to the maximum distance you'd normally be allowed to hear... this is probably going to be annoying.
|
||||
break;
|
||||
case 2: //linear, mimic quake.
|
||||
case 3: //linear clamped to further than ref distance
|
||||
case DM_LINEAR: //linear, mimic quake.
|
||||
case DM_LINEAR_CLAMPED: //linear clamped to further than ref distance
|
||||
palSourcef(src, AL_ROLLOFF_FACTOR, 1);
|
||||
#ifdef FTE_TARGET_WEB
|
||||
//chrome complains about 0.
|
||||
|
@ -1093,45 +1104,45 @@ static void QDECL OnChangeALSettings (cvar_t *var, char *value)
|
|||
|
||||
if (palDistanceModel)
|
||||
{
|
||||
switch (s_al_distancemodel.ival)
|
||||
switch ((enum distancemodel_e)s_al_distancemodel.ival)
|
||||
{
|
||||
case 0:
|
||||
case DM_INVERSE:
|
||||
//gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE) )
|
||||
palDistanceModel(AL_INVERSE_DISTANCE);
|
||||
break;
|
||||
case 1: //openal's default mode
|
||||
case DM_INVERSE_CLAMPED: //openal's default mode
|
||||
//istance = max(distance,AL_REFERENCE_DISTANCE);
|
||||
//distance = min(distance,AL_MAX_DISTANCE);
|
||||
//gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE) )
|
||||
palDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
|
||||
break;
|
||||
case 2: //most quake-like
|
||||
case DM_LINEAR: //most quake-like. linear
|
||||
//distance = min(distance, AL_MAX_DISTANCE) // avoid negative gain
|
||||
//gain = ( 1 – AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE) / (AL_MAX_DISTANCE – AL_REFERENCE_DISTANCE) )
|
||||
palDistanceModel(AL_LINEAR_DISTANCE);
|
||||
break;
|
||||
case 3:
|
||||
case DM_LINEAR_CLAMPED: //linear, with near stuff clamped to further away
|
||||
//distance = max(distance, AL_REFERENCE_DISTANCE)
|
||||
//distance = min(distance, AL_MAX_DISTANCE)
|
||||
//gain = ( 1 – AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE) / (AL_MAX_DISTANCE – AL_REFERENCE_DISTANCE) )
|
||||
palDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);
|
||||
break;
|
||||
case 4:
|
||||
case DM_EXPONENT:
|
||||
//gain = (distance / AL_REFERENCE_DISTANCE) ^ (- AL_ROLLOFF_FACTOR)
|
||||
palDistanceModel(AL_EXPONENT_DISTANCE);
|
||||
break;
|
||||
case 5:
|
||||
case DM_EXPONENT_CLAMPED:
|
||||
//distance = max(distance, AL_REFERENCE_DISTANCE)
|
||||
//distance = min(distance, AL_MAX_DISTANCE)
|
||||
//gain = (distance / AL_REFERENCE_DISTANCE) ^ (- AL_ROLLOFF_FACTOR)
|
||||
palDistanceModel(AL_EXPONENT_DISTANCE_CLAMPED);
|
||||
break;
|
||||
case 6:
|
||||
case DM_NONE:
|
||||
//gain = 1
|
||||
palDistanceModel(AL_NONE);
|
||||
break;
|
||||
default:
|
||||
Cvar_ForceSet(&s_al_distancemodel, "0");
|
||||
Cvar_ForceSet(&s_al_distancemodel, "2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1258,7 +1269,6 @@ static ALuint OpenAL_LoadEffect(const struct reverbproperties_s *reverb)
|
|||
{
|
||||
/* EAX Reverb is available. Set the EAX effect type then load the
|
||||
* reverb properties. */
|
||||
|
||||
palEffectf(effect, AL_EAXREVERB_DENSITY, reverb->flDensity);
|
||||
palEffectf(effect, AL_EAXREVERB_DIFFUSION, reverb->flDiffusion);
|
||||
palEffectf(effect, AL_EAXREVERB_GAIN, reverb->flGain);
|
||||
|
@ -1284,7 +1294,9 @@ static ALuint OpenAL_LoadEffect(const struct reverbproperties_s *reverb)
|
|||
palEffecti(effect, AL_EAXREVERB_DECAY_HFLIMIT, reverb->iDecayHFLimit);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef AL_EFFECT_REVERB
|
||||
/* No EAX Reverb. Set the standard reverb effect type then load the
|
||||
* available reverb properties. */
|
||||
palEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
|
||||
|
@ -1302,8 +1314,8 @@ static ALuint OpenAL_LoadEffect(const struct reverbproperties_s *reverb)
|
|||
palEffectf(effect, AL_REVERB_AIR_ABSORPTION_GAINHF, reverb->flAirAbsorptionGainHF);
|
||||
palEffectf(effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, reverb->flRoomRolloffFactor);
|
||||
palEffecti(effect, AL_REVERB_DECAY_HFLIMIT, reverb->iDecayHFLimit);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue