mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-24 18:30:00 +00:00
another clamp
This commit is contained in:
parent
f67275be13
commit
b956be0f44
|
@ -3210,7 +3210,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams* params)
|
||||||
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
|
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
|
||||||
if (propellerSpeed < 1.0f)
|
if (propellerSpeed < 1.0f)
|
||||||
m_sQueueSample.m_nFrequency = (propellerSpeed + 1.0f) * (m_sQueueSample.m_nFrequency / 2.0f);
|
m_sQueueSample.m_nFrequency = (propellerSpeed + 1.0f) * (m_sQueueSample.m_nFrequency / 2.0f);
|
||||||
m_sQueueSample.m_nFrequency = clamp(m_sQueueSample.m_nFrequency, freqFrontPrev - 197, freqFrontPrev + 197);
|
m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqFrontPrev, 197);
|
||||||
freqFrontPrev = m_sQueueSample.m_nFrequency;
|
freqFrontPrev = m_sQueueSample.m_nFrequency;
|
||||||
|
|
||||||
m_sQueueSample.m_bIs2D = false;
|
m_sQueueSample.m_bIs2D = false;
|
||||||
|
@ -3268,7 +3268,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams* params)
|
||||||
if (propellerSpeed < 1.0f)
|
if (propellerSpeed < 1.0f)
|
||||||
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2);
|
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2);
|
||||||
|
|
||||||
m_sQueueSample.m_nFrequency = clamp(m_sQueueSample.m_nFrequency, freqPropellerPrev - 98, freqPropellerPrev + 98);
|
m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqPropellerPrev, 98);
|
||||||
freqPropellerPrev = m_sQueueSample.m_nFrequency;
|
freqPropellerPrev = m_sQueueSample.m_nFrequency;
|
||||||
} else {
|
} else {
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI2;
|
m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI2;
|
||||||
|
@ -3339,7 +3339,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams* params)
|
||||||
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
|
m_sQueueSample.m_nFrequency = 14287 + Min(1.0f, freqModifier) * 3713;
|
||||||
if (propellerSpeed < 1.0)
|
if (propellerSpeed < 1.0)
|
||||||
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2.0f);
|
m_sQueueSample.m_nFrequency = (propellerSpeed + 1) * (m_sQueueSample.m_nFrequency / 2.0f);
|
||||||
m_sQueueSample.m_nFrequency = clamp(m_sQueueSample.m_nFrequency, freqSkimmerPrev - 197, freqSkimmerPrev + 197);
|
m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqSkimmerPrev, 197);
|
||||||
freqSkimmerPrev = m_sQueueSample.m_nFrequency;
|
freqSkimmerPrev = m_sQueueSample.m_nFrequency;
|
||||||
|
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO4;
|
m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO4;
|
||||||
|
@ -3441,8 +3441,8 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams* params)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modifier = Min(1.0f, Abs(params->m_fVelocityChange) / (0.3f * params->m_pTransmission->fMaxVelocity));
|
modifier = Min(1.0f, Abs(params->m_fVelocityChange) / (0.3f * params->m_pTransmission->fMaxVelocity));
|
||||||
if (modifier > 0.01) { //mb can be replaced by (emittingVol > 1)
|
if (modifier > 0.01f) { //mb can be replaced by (emittingVol > 1)
|
||||||
emittingVol = (100.0 * modifier);
|
emittingVol = (100.0f * modifier);
|
||||||
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
|
||||||
if (m_sQueueSample.m_nVolume) {
|
if (m_sQueueSample.m_nVolume) {
|
||||||
|
@ -4968,7 +4968,7 @@ cAudioManager::ProcessExtraSounds()
|
||||||
m_sQueueSample.m_vecPos = aVecExtraSoundPosition[i];
|
m_sQueueSample.m_vecPos = aVecExtraSoundPosition[i];
|
||||||
distance = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
distance = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
||||||
if (distance < SQR(SOUND_INTENSITY)) {
|
if (distance < SQR(SOUND_INTENSITY)) {
|
||||||
if (distance > 0.0)
|
if (distance > 0.0f)
|
||||||
m_sQueueSample.m_fDistance = Sqrt(distance);
|
m_sQueueSample.m_fDistance = Sqrt(distance);
|
||||||
else
|
else
|
||||||
m_sQueueSample.m_fDistance = 0.0f;
|
m_sQueueSample.m_fDistance = 0.0f;
|
||||||
|
|
|
@ -219,6 +219,8 @@ extern int strncasecmp(const char *str1, const char *str2, size_t len);
|
||||||
|
|
||||||
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
|
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
|
||||||
|
|
||||||
|
#define clamp2(v, center, radius) ((v) < (center) ? Max(v, center - radius) : Min(v, center + radius))
|
||||||
|
|
||||||
inline float sq(float x) { return x*x; }
|
inline float sq(float x) { return x*x; }
|
||||||
#define SQR(x) ((x) * (x))
|
#define SQR(x) ((x) * (x))
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
void Update(void);
|
void Update(void);
|
||||||
void SwitchOff(void);
|
void SwitchOff(void);
|
||||||
void AddThisOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, bool b_isMovingDown);
|
void AddThisOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, bool b_isMovingDown);
|
||||||
bool IsActive() { return m_bIsActive; };
|
bool IsActive() const { return m_bIsActive; };
|
||||||
const CVector& GetPosition() const { return m_midPoint; };
|
const CVector& GetPosition() const { return m_midPoint; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public:
|
||||||
static void Update(void);
|
static void Update(void);
|
||||||
static void AddOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, bool b_isMovingDown);
|
static void AddOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, bool b_isMovingDown);
|
||||||
static void Shutdown(void);
|
static void Shutdown(void);
|
||||||
static CEscalator& GetEscalator(int ind) { return aEscalators[ind]; };
|
static const CEscalator& GetEscalator(int ind) { return aEscalators[ind]; };
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMovingThing
|
class CMovingThing
|
||||||
|
|
Loading…
Reference in a new issue