rename clamp macro to Clamp to fix compilation with g++11

This commit is contained in:
withmorten
2021-06-28 13:31:35 +02:00
parent cc235be3aa
commit cb3b3855b8
31 changed files with 116 additions and 116 deletions

View File

@ -1220,7 +1220,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
CurrentPretendGear = 1;
}
if (CReplay::IsPlayingBack())
accelerateState = 255.f * clamp(automobile->m_fGasPedal, 0.0f, 1.0f);
accelerateState = 255.f * Clamp(automobile->m_fGasPedal, 0.0f, 1.0f);
else
accelerateState = Pads[0].GetAccelerate();
@ -1229,7 +1229,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
velocityChange = params.m_fVelocityChange;
relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f);
accelerationMultipler = Clamp(relativeVelocityChange, 0.0f, 1.0f);
gasPedalAudio = accelerationMultipler;
currentGear = params.m_pVehicle->m_nCurrentGear;

View File

@ -321,7 +321,7 @@ cAudioManager::Get3DProviderName(uint8 id) const
if (!m_bIsInitialised)
return nil;
#ifdef AUDIO_OAL
id = clamp(id, 0, SampleManager.GetNum3DProvidersAvailable() - 1);
id = Clamp(id, 0, SampleManager.GetNum3DProvidersAvailable() - 1);
#else
// We don't want that either since it will crash the game, but skipping for now
if (id >= SampleManager.GetNum3DProvidersAvailable())

View File

@ -134,7 +134,7 @@ public:
else
StepIndex--;
StepIndex = clamp(StepIndex, 0, 88);
StepIndex = Clamp(StepIndex, 0, 88);
int delta = step >> 3;
if (adpcm & 1) delta += step >> 2;
@ -143,7 +143,7 @@ public:
if (adpcm & 8) delta = -delta;
int newSample = Sample + delta;
Sample = clamp(newSample, -32768, 32767);
Sample = Clamp(newSample, -32768, 32767);
return Sample;
}
};
@ -596,7 +596,7 @@ public:
static short quantize(double sample)
{
int a = int(sample + 0.5);
return short(clamp(a, -32768, 32767));
return short(Clamp(a, -32768, 32767));
}
void Decode(void* _inbuf, int16* _outbuf, size_t size)
@ -1086,10 +1086,10 @@ void CStream::SetVolume(uint32 nVol)
void CStream::SetPan(uint8 nPan)
{
m_nPan = clamp((int8)nPan - 63, 0, 63);
m_nPan = Clamp((int8)nPan - 63, 0, 63);
SetPosition(0, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
m_nPan = clamp((int8)nPan + 64, 64, 127);
m_nPan = Clamp((int8)nPan + 64, 64, 127);
SetPosition(1, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
m_nPan = nPan;

View File

@ -1624,7 +1624,7 @@ cSampleManager::UpdateReverb(void)
}
}
fRatio = clamp(fRatio, usingEAX3==1 ? 0.0f : 0.30f, 1.0f);
fRatio = Clamp(fRatio, usingEAX3==1 ? 0.0f : 0.30f, 1.0f);
if ( fRatio == _fPrevEaxRatioDestination )
return FALSE;

View File

@ -348,7 +348,7 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
{
int savedprovider = curprovider;
nProvider = clamp(nProvider, 0, m_nNumberOfProviders - 1);
nProvider = Clamp(nProvider, 0, m_nNumberOfProviders - 1);
if ( set_new_provider(nProvider) )
return curprovider;
@ -1424,7 +1424,7 @@ bool8 cSampleManager::UpdateReverb(void)
#undef CALCRATIO
#undef ZR
fRatio = clamp(fRatio, usingEAX3==1 ? 0.0f : 0.30f, 1.0f);
fRatio = Clamp(fRatio, usingEAX3==1 ? 0.0f : 0.30f, 1.0f);
if ( fRatio == _fPrevEaxRatioDestination )
return FALSE;