diff options
author | withmorten <morten.with@gmail.com> | 2021-06-28 13:31:35 +0200 |
---|---|---|
committer | withmorten <morten.with@gmail.com> | 2021-06-28 13:31:35 +0200 |
commit | cb3b3855b844c14c0e943c1a7614fc29820cf666 (patch) | |
tree | 8e9a6ae74e9c98515b813f412476058274d3fde4 /src/core | |
parent | Less invasive red tint on Delete Game page (diff) | |
download | re3-cb3b3855b844c14c0e943c1a7614fc29820cf666.tar re3-cb3b3855b844c14c0e943c1a7614fc29820cf666.tar.gz re3-cb3b3855b844c14c0e943c1a7614fc29820cf666.tar.bz2 re3-cb3b3855b844c14c0e943c1a7614fc29820cf666.tar.lz re3-cb3b3855b844c14c0e943c1a7614fc29820cf666.tar.xz re3-cb3b3855b844c14c0e943c1a7614fc29820cf666.tar.zst re3-cb3b3855b844c14c0e943c1a7614fc29820cf666.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/Cam.cpp | 8 | ||||
-rw-r--r-- | src/core/Camera.cpp | 8 | ||||
-rw-r--r-- | src/core/FileLoader.cpp | 2 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 20 | ||||
-rw-r--r-- | src/core/Frontend_PS2.cpp | 4 | ||||
-rw-r--r-- | src/core/General.h | 2 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp | 2 | ||||
-rw-r--r-- | src/core/ZoneCull.cpp | 12 | ||||
-rw-r--r-- | src/core/common.h | 2 |
9 files changed, 30 insertions, 30 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index b6e4f967..ecfade74 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -3482,7 +3482,7 @@ FindSplinePathPositionFloat(float *out, float *spline, uint32 time, uint32 &mark } } float a = ((float)time - (float)MS(spline[marker-4])) / (float)MS(spline[marker] - spline[marker-4]); - a = clamp(a, 0.0f, 1.0f); + a = Clamp(a, 0.0f, 1.0f); float b = 1.0f - a; *out = b*b*b * spline[marker-3] + 3.0f*a*b*b * spline[marker-1] + @@ -3520,7 +3520,7 @@ FindSplinePathPositionVector(CVector *out, float *spline, uint32 time, uint32 &m } float a = ((float)time - (float)MS(spline[marker-10])) / (float)MS(spline[marker] - spline[marker-10]); - a = clamp(a, 0.0f, 1.0f); + a = Clamp(a, 0.0f, 1.0f); float b = 1.0f - a; out->x = b*b*b * spline[marker-9] + @@ -4899,7 +4899,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // 0.98f: CAR_FOV_FADE_MULT FOV = Pow(0.98f, CTimer::GetTimeStep()) * (FOV - DefaultFOV) + DefaultFOV; - FOV = clamp(FOV, DefaultFOV, DefaultFOV + 30.0f); + FOV = Clamp(FOV, DefaultFOV, DefaultFOV + 30.0f); } // WORKAROUND: I still don't know how looking behind works (m_bCamDirectlyInFront is unused in III, they seem to use m_bUseTransitionBeta) @@ -5021,7 +5021,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, } } - float targetAlpha = Asin(clamp(Front.z, -1.0f, 1.0f)) - zoomModeAlphaOffset; + float targetAlpha = Asin(Clamp(Front.z, -1.0f, 1.0f)) - zoomModeAlphaOffset; if (targetAlpha <= maxAlphaAllowed) { if (targetAlpha < -CARCAM_SET[camSetArrPos][14]) targetAlpha = -CARCAM_SET[camSetArrPos][14]; diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 5881dacd..f3b41655 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -661,7 +661,7 @@ CCamera::Process(void) // Process Shake float shakeStrength = m_fCamShakeForce - 0.28f*(CTimer::GetTimeInMilliseconds()-m_uiCamShakeStart)/1000.0f; - shakeStrength = clamp(shakeStrength, 0.0f, 2.0f); + shakeStrength = Clamp(shakeStrength, 0.0f, 2.0f); int shakeRand = CGeneral::GetRandomNumber(); float shakeOffset = shakeStrength*0.1f; GetMatrix().GetPosition().x += shakeOffset * ((shakeRand & 0xF) - 7); @@ -1877,7 +1877,7 @@ CCamera::CamShake(float strength, float x, float y, float z) float curForce = mult*(m_fCamShakeForce - (CTimer::GetTimeInMilliseconds() - m_uiCamShakeStart)/1000.0f); strength = mult*strength; - if(clamp(curForce, 0.0f, 2.0f) < strength){ + if(Clamp(curForce, 0.0f, 2.0f) < strength){ m_fCamShakeForce = strength; m_uiCamShakeStart = CTimer::GetTimeInMilliseconds(); } @@ -1888,7 +1888,7 @@ void CamShakeNoPos(CCamera *cam, float strength) { float curForce = cam->m_fCamShakeForce - (CTimer::GetTimeInMilliseconds() - cam->m_uiCamShakeStart)/1000.0f; - if(clamp(curForce, 0.0f, 2.0f) < strength){ + if(Clamp(curForce, 0.0f, 2.0f) < strength){ cam->m_fCamShakeForce = strength; cam->m_uiCamShakeStart = CTimer::GetTimeInMilliseconds(); } @@ -3572,7 +3572,7 @@ CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, float CCamera::Find3rdPersonQuickAimPitch(void) { - float clampedFrontZ = clamp(Cams[ActiveCam].Front.z, -1.0f, 1.0f); + float clampedFrontZ = Clamp(Cams[ActiveCam].Front.z, -1.0f, 1.0f); float rot = Asin(clampedFrontZ); diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 20e7bd8e..cc2b402b 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -1463,7 +1463,7 @@ CFileLoader::Load2dEffect(const char *line) &probability); effect->attractor.type = flags; #ifdef FIX_BUGS - effect->attractor.probability = clamp(probability, 0, 255); + effect->attractor.probability = Clamp(probability, 0, 255); #else effect->attractor.probability = probability; #endif diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index f7916f44..125360ff 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -899,29 +899,29 @@ CMenuManager::CheckSliderMovement(int value) switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_BRIGHTNESS: m_PrefsBrightness += value * (512/16); - m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 511); + m_PrefsBrightness = Clamp(m_PrefsBrightness, 0, 511); break; case MENUACTION_DRAWDIST: if(value > 0) m_PrefsLOD += ((1.8f - 0.8f) / 16.0f); else m_PrefsLOD -= ((1.8f - 0.8f) / 16.0f); - m_PrefsLOD = clamp(m_PrefsLOD, 0.8f, 1.8f); + m_PrefsLOD = Clamp(m_PrefsLOD, 0.8f, 1.8f); CRenderer::ms_lodDistScale = m_PrefsLOD; break; case MENUACTION_MUSICVOLUME: m_PrefsMusicVolume += value * (128/16); - m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127); + m_PrefsMusicVolume = Clamp(m_PrefsMusicVolume, 0, 127); DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume); break; case MENUACTION_SFXVOLUME: m_PrefsSfxVolume += value * (128/16); - m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 127); + m_PrefsSfxVolume = Clamp(m_PrefsSfxVolume, 0, 127); DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); break; case MENUACTION_MOUSESENS: TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ??? - TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f); + TheCamera.m_fMouseAccelHorzntl = Clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f); #ifdef FIX_BUGS TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; #else @@ -4523,7 +4523,7 @@ CMenuManager::ProcessButtonPresses(void) break; case HOVEROPTION_INCREASE_MUSICVOLUME: m_PrefsMusicVolume = m_PrefsMusicVolume + 8; - m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127); + m_PrefsMusicVolume = Clamp(m_PrefsMusicVolume, 0, 127); DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume); SaveSettings(); break; @@ -4562,7 +4562,7 @@ CMenuManager::ProcessButtonPresses(void) break; case HOVEROPTION_INCREASE_MOUSESENS: TheCamera.m_fMouseAccelHorzntl += (1.0f / 3000); - TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); + TheCamera.m_fMouseAccelHorzntl = Clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); #ifdef FIX_BUGS TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; #else @@ -4572,7 +4572,7 @@ CMenuManager::ProcessButtonPresses(void) break; case HOVEROPTION_DECREASE_MOUSESENS: TheCamera.m_fMouseAccelHorzntl -= (1.0f / 3000); - TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); + TheCamera.m_fMouseAccelHorzntl = Clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); #ifdef FIX_BUGS TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f; #else @@ -5388,14 +5388,14 @@ CMenuManager::ProcessButtonPresses(void) case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex != -1) { m_nPrefsAudio3DProviderIndex += changeValueBy; - m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1); + m_nPrefsAudio3DProviderIndex = Clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1); } DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NAVIGATION, 0); break; case MENUACTION_SPEAKERCONF: if (m_nPrefsAudio3DProviderIndex != -1) { m_PrefsSpeakers -= changeValueBy; - m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2); + m_PrefsSpeakers = Clamp(m_PrefsSpeakers, 0, 2); DMAudio.SetSpeakerConfig(m_PrefsSpeakers); SaveSettings(); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp index 457a5ff8..1da15fbb 100644 --- a/src/core/Frontend_PS2.cpp +++ b/src/core/Frontend_PS2.cpp @@ -1388,7 +1388,7 @@ CMenuManager::DrawFrontEndNormal(void) if ((m_nStartPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) <= 1600) alpha = float(m_nStartPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) / 400.0f; - m_someAlpha = 255 - clamp(alpha, 0.0f, 1.0f) * 255.0f; + m_someAlpha = 255 - Clamp(alpha, 0.0f, 1.0f) * 255.0f; switch ( m_nSlidingDir ) { @@ -1405,7 +1405,7 @@ CMenuManager::DrawFrontEndNormal(void) float slide = float(m_nEndPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) / 800.0f; float alpha = float((int32)(m_nEndPauseTimer - CTimer::GetTimeInMillisecondsPauseMode()) + -266) / 533.0f; - m_someAlpha = clamp(alpha, 0.0f, 1.0f) * 255.0f; + m_someAlpha = Clamp(alpha, 0.0f, 1.0f) * 255.0f; switch ( m_nSlidingDir ) { diff --git a/src/core/General.h b/src/core/General.h index 478ef027..d4b941dd 100644 --- a/src/core/General.h +++ b/src/core/General.h @@ -56,7 +56,7 @@ public: static float LimitRadianAngle(float angle) { - float result = clamp(angle, -25.0f, 25.0f); + float result = Clamp(angle, -25.0f, 25.0f); while (result >= PI) { result -= 2 * PI; diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index bd6feeed..91bd0691 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -121,7 +121,7 @@ CPlayerInfo::Process(void) m_fRoadDensity = ThePaths.CalcRoadDensity(playerPos.x, playerPos.y); } - m_fRoadDensity = clamp(m_fRoadDensity, 0.4f, 1.45f); + m_fRoadDensity = Clamp(m_fRoadDensity, 0.4f, 1.45f); // Because vehicle enter/exit use same key binding. bool enterOrExitVeh; diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp index 33586a4e..5a76e5ed 100644 --- a/src/core/ZoneCull.cpp +++ b/src/core/ZoneCull.cpp @@ -396,9 +396,9 @@ CCullZones::AddCullZone(CVector const &position, v = CVector(1061.7f, -613.0f, 19.0f); if((v-CVector(1029.48f, -495.757f, 21.98f)).Magnitude() < 1.0f) v = CVector(1061.4f, -506.0f, 18.5f); - cull->position.x = clamp(v.x, minx, maxx); - cull->position.y = clamp(v.y, miny, maxy); - cull->position.z = clamp(v.z, minz, maxz); + cull->position.x = Clamp(v.x, minx, maxx); + cull->position.y = Clamp(v.y, miny, maxy); + cull->position.z = Clamp(v.z, minz, maxz); cull->minx = minx; cull->maxx = maxx; cull->miny = miny; @@ -958,11 +958,11 @@ CCullZone::FindTestPoints() // indices of center int x = ElementsX * (position.x-minx)/(maxx-minx); - x = clamp(x, 0, ElementsX-1); + x = Clamp(x, 0, ElementsX-1); int y = ElementsY * (position.y-miny)/(maxy-miny); - y = clamp(y, 0, ElementsY-1); + y = Clamp(y, 0, ElementsY-1); int z = ElementsZ * (position.z-minz)/(maxz-minz); - z = clamp(z, 0, ElementsZ-1); + z = Clamp(z, 0, ElementsZ-1); // Mark which test points inside the zone are not occupied by buildings. // To do this, mark the start point as free and do a food fill. diff --git a/src/core/common.h b/src/core/common.h index 7207f08d..da162762 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -290,7 +290,7 @@ extern int strcasecmp(const char *str1, const char *str2); extern wchar *AllocUnicode(const char*src); -#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v)) +#define Clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v)) inline float sq(float x) { return x*x; } #define SQR(x) ((x) * (x)) |