diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Coronas.cpp | 2 | ||||
-rw-r--r-- | src/render/Fluff.cpp | 2 | ||||
-rw-r--r-- | src/render/Glass.cpp | 4 | ||||
-rw-r--r-- | src/render/Hud.cpp | 6 | ||||
-rw-r--r-- | src/render/MBlur.cpp | 18 | ||||
-rw-r--r-- | src/render/Particle.cpp | 16 | ||||
-rw-r--r-- | src/render/SpecialFX.cpp | 1 | ||||
-rw-r--r-- | src/render/Sprite.cpp | 8 | ||||
-rw-r--r-- | src/render/WaterLevel.cpp | 40 | ||||
-rw-r--r-- | src/render/Weather.cpp | 2 |
10 files changed, 49 insertions, 50 deletions
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index 1ac3263c..a00dc165 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -493,7 +493,7 @@ CCoronas::RenderReflections(void) if(spriteCoors.z < drawDist){ float fadeDistance = drawDist / 2.0f; float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance; - distanceFade = clamp(distanceFade, 0.0f, 1.0f); + distanceFade = Clamp(distanceFade, 0.0f, 1.0f); float recipz = 1.0f/RwCameraGetNearClipPlane(Scene.camera); float heightFade = (20.0f - aCoronas[i].heightAboveRoad)/20.0f; int intensity = distanceFade*heightFade * 230.0 * CWeather::WetRoads; diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 2d4fd185..b6a7e766 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -1156,7 +1156,7 @@ void CScriptPath::Update(void) { return; m_fPosition += m_fSpeed * CTimer::GetTimeStepInSeconds(); - m_fPosition = clamp(m_fPosition, 0.0f, m_fTotalLength); + m_fPosition = Clamp(m_fPosition, 0.0f, m_fTotalLength); if (m_pObjects[0] || m_pObjects[1] || m_pObjects[2] || m_pObjects[3] || m_pObjects[4] || m_pObjects[5]) { diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp index 3409a058..b4ec8c7e 100644 --- a/src/render/Glass.cpp +++ b/src/render/Glass.cpp @@ -151,9 +151,9 @@ CFallingGlassPane::Render(void) uint8 alpha = CGlass::CalcAlphaWithNormal(&fwdNorm); #ifdef FIX_BUGS - uint16 time = clamp(CTimer::GetTimeInMilliseconds() > m_nTimer ? CTimer::GetTimeInMilliseconds() - m_nTimer : 0u, 0u, 500u); + uint16 time = Clamp(CTimer::GetTimeInMilliseconds() > m_nTimer ? CTimer::GetTimeInMilliseconds() - m_nTimer : 0u, 0u, 500u); #else - uint16 time = clamp(CTimer::GetTimeInMilliseconds() - m_nTimer, 0, 500); + uint16 time = Clamp(CTimer::GetTimeInMilliseconds() - m_nTimer, 0, 500); #endif uint8 color = int32( float(alpha) * (float(time) / 500) ); diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 2efa7b64..f6374cf5 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -1407,7 +1407,7 @@ CHud::DrawHealthBar(int16 value) } float fHealth = value; float fMaxHealth = CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth; - fHealth = clamp(fHealth, 0.0f, fMaxHealth); + fHealth = Clamp(fHealth, 0.0f, fMaxHealth); float fWidth = (fHealth / fMaxHealth) * 40.0f + 16.0f + 4.0f; float u = fWidth / 64.0f; if (value == 0) { @@ -1477,7 +1477,7 @@ CHud::DrawArmourBar(int16 value) } float fArmour = value; float fMaxArmour = CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour; - fArmour = clamp(fArmour, 0.0f, fMaxArmour); + fArmour = Clamp(fArmour, 0.0f, fMaxArmour); float fWidth = (fArmour / fMaxArmour) * 40.0f + 16.0f + 4.0f; float u = fWidth / 64.0f; if (value == 0) { @@ -2252,7 +2252,7 @@ float CHud::DrawFadeState(DRAW_FADE_STATE fadingElement, int forceFadingIn) break; } - return clamp(alpha, 0.0f, 255.0f); + return Clamp(alpha, 0.0f, 255.0f); } void diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index dc88164b..f2c85719 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -283,10 +283,10 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect, RwIm2DVertex *verts v1 = y1/height + v1Off; u2 = x2/width + u2Off; v2 = y2/height + v2Off; - u1 = clamp(u1, 0.0f, 1.0f); - v1 = clamp(v1, 0.0f, 1.0f); - u2 = clamp(u2, 0.0f, 1.0f); - v2 = clamp(v2, 0.0f, 1.0f); + u1 = Clamp(u1, 0.0f, 1.0f); + v1 = Clamp(v1, 0.0f, 1.0f); + u2 = Clamp(u2, 0.0f, 1.0f); + v2 = Clamp(v2, 0.0f, 1.0f); } float recipz = 1.0f/z; @@ -517,7 +517,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, void CMBlur::SetDrunkBlur(float drunkness) { - Drunkness = clamp(drunkness, 0.0f, 1.0f); + Drunkness = Clamp(drunkness, 0.0f, 1.0f); } void @@ -600,9 +600,9 @@ CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf) int red = (0.75f*CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed())*0.55f * 255; int green = (0.75f*CTimeCycle::GetDirectionalGreen() + CTimeCycle::GetAmbientGreen())*0.55f * 255; int blue = (0.75f*CTimeCycle::GetDirectionalBlue() + CTimeCycle::GetAmbientBlue())*0.55f * 255; - red = clamp(red, 0, 255); - green = clamp(green, 0, 255); - blue = clamp(blue, 0, 255); + red = Clamp(red, 0, 255); + green = Clamp(green, 0, 255); + blue = Clamp(blue, 0, 255); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); @@ -697,7 +697,7 @@ CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf) int alpha = FrontEndMenuManager.m_PrefsBrightness > 255 ? FrontEndMenuManager.m_PrefsBrightness - 90 : FrontEndMenuManager.m_PrefsBrightness - 130; - alpha = clamp(alpha, 16, 200)/2; + alpha = Clamp(alpha, 16, 200)/2; CreateImmediateModeData(cam, &fxRect[i], verts, CRGBA(0, 0, 0, alpha), 0.0f, 0.0f, 0.0f, 0.0f, fxZ[i], true); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpHeatHazeRaster); diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 3c8172b4..54b6ca92 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -1096,15 +1096,15 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe int32 ColorVariation = CGeneral::GetRandomNumberInRange(-psystem->m_InitialColorVariation, psystem->m_InitialColorVariation); //float ColorVariation = CGeneral::GetRandomNumberInRange((float)-psystem->m_InitialColorVariation, (float)psystem->m_InitialColorVariation); - pParticle->m_Color.red = clamp(pParticle->m_Color.red + + pParticle->m_Color.red = Clamp(pParticle->m_Color.red + PERCENT(pParticle->m_Color.red, ColorVariation), 0, 255); - pParticle->m_Color.green = clamp(pParticle->m_Color.green + + pParticle->m_Color.green = Clamp(pParticle->m_Color.green + PERCENT(pParticle->m_Color.green, ColorVariation), 0, 255); - pParticle->m_Color.blue = clamp(pParticle->m_Color.blue + + pParticle->m_Color.blue = Clamp(pParticle->m_Color.blue + PERCENT(pParticle->m_Color.blue, ColorVariation), 0, 255); } @@ -1389,15 +1389,15 @@ void CParticle::Update() { float colorMul = 1.0f - float(particle->m_nTimeWhenColorWillBeChanged - CTimer::GetTimeInMilliseconds()) / float(psystem->m_ColorFadeTime); - particle->m_Color.red = clamp( + particle->m_Color.red = Clamp( psystem->m_RenderColouring.red + int32(float(psystem->m_FadeDestinationColor.red - psystem->m_RenderColouring.red) * colorMul), 0, 255); - particle->m_Color.green = clamp( + particle->m_Color.green = Clamp( psystem->m_RenderColouring.green + int32(float(psystem->m_FadeDestinationColor.green - psystem->m_RenderColouring.green) * colorMul), 0, 255); - particle->m_Color.blue = clamp( + particle->m_Color.blue = Clamp( psystem->m_RenderColouring.blue + int32(float(psystem->m_FadeDestinationColor.blue - psystem->m_RenderColouring.blue) * colorMul), 0, 255); } @@ -1704,13 +1704,13 @@ void CParticle::Update() if ( particle->m_nFadeToBlackTimer != 0 ) { - particle->m_nColorIntensity = clamp(particle->m_nColorIntensity - particle->m_nFadeToBlackTimer, + particle->m_nColorIntensity = Clamp(particle->m_nColorIntensity - particle->m_nFadeToBlackTimer, 0, 255); } if ( particle->m_nFadeAlphaTimer != 0 ) { - particle->m_nAlpha = clamp(particle->m_nAlpha - particle->m_nFadeAlphaTimer, + particle->m_nAlpha = Clamp(particle->m_nAlpha - particle->m_nFadeAlphaTimer, 0, 255); if ( particle->m_nAlpha == 0 ) { diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index e27a783e..4bf94f2b 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -214,7 +214,6 @@ CSpecialFX::Render2DFXs(void) CFont::SetPropOn(); CFont::SetColor(CRGBA(100, 100, 100, 200)); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); - CFont::PrintString(SCREEN_WIDTH * 8 / 10, SCREEN_HEIGHT * 8 / 10, gUString); for (int32 i = 0; i < SCREEN_HEIGHT; i += 4) { RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 0e4d4fcd..f19ad55e 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -414,13 +414,13 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, f // Colour factors, cx/y is the direction in which colours change from rgb1 to rgb2 cf[0] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f; - cf[0] = clamp(cf[0], 0.0f, 1.0f); + cf[0] = Clamp(cf[0], 0.0f, 1.0f); cf[1] = (cx*(-c+s) + cy*( c+s))*0.5f + 0.5f; - cf[1] = clamp(cf[1], 0.0f, 1.0f); + cf[1] = Clamp(cf[1], 0.0f, 1.0f); cf[2] = (cx*( c+s) + cy*( c-s))*0.5f + 0.5f; - cf[2] = clamp(cf[2], 0.0f, 1.0f); + cf[2] = Clamp(cf[2], 0.0f, 1.0f); cf[3] = (cx*( c-s) + cy*(-c-s))*0.5f + 0.5f; - cf[3] = clamp(cf[3], 0.0f, 1.0f); + cf[3] = Clamp(cf[3], 0.0f, 1.0f); float screenz = m_f2DNearScreenZ + (z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() / diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 759a3595..a241ac9f 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -179,10 +179,10 @@ CWaterLevel::Initialise(Const char *pWaterDat) int32 t = WATER_HUGE_Y(ms_aWaterRects[i].top); int32 b = WATER_HUGE_Y(ms_aWaterRects[i].bottom) + 1.0f; - l = clamp(l, 0, MAX_SMALL_SECTORS - 1); - r = clamp(r, 0, MAX_SMALL_SECTORS - 1); - t = clamp(t, 0, MAX_SMALL_SECTORS - 1); - b = clamp(b, 0, MAX_SMALL_SECTORS - 1); + l = Clamp(l, 0, MAX_SMALL_SECTORS - 1); + r = Clamp(r, 0, MAX_SMALL_SECTORS - 1); + t = Clamp(t, 0, MAX_SMALL_SECTORS - 1); + b = Clamp(b, 0, MAX_SMALL_SECTORS - 1); for (int32 x = l; x <= r; x++) { @@ -991,10 +991,10 @@ CWaterLevel::RenderWater() if ( bUseCamEndY ) nEndY = WATER_TO_HUGE_SECTOR_Y(camPos.y); - nStartX = clamp(nStartX, 0, MAX_HUGE_SECTORS - 1); - nEndX = clamp(nEndX, 0, MAX_HUGE_SECTORS - 1); - nStartY = clamp(nStartY, 0, MAX_HUGE_SECTORS - 1); - nEndY = clamp(nEndY, 0, MAX_HUGE_SECTORS - 1); + nStartX = Clamp(nStartX, 0, MAX_HUGE_SECTORS - 1); + nEndX = Clamp(nEndX, 0, MAX_HUGE_SECTORS - 1); + nStartY = Clamp(nStartY, 0, MAX_HUGE_SECTORS - 1); + nEndY = Clamp(nEndY, 0, MAX_HUGE_SECTORS - 1); for ( int32 x = nStartX; x <= nEndX; x++ ) { @@ -1259,10 +1259,10 @@ CWaterLevel::RenderTransparentWater(void) if ( bUseCamEndY ) nEndY = WATER_TO_HUGE_SECTOR_Y(camPos.y ); - nStartX = clamp(nStartX, 0, MAX_HUGE_SECTORS - 1); - nEndX = clamp(nEndX, 0, MAX_HUGE_SECTORS - 1); - nStartY = clamp(nStartY, 0, MAX_HUGE_SECTORS - 1); - nEndY = clamp(nEndY, 0, MAX_HUGE_SECTORS - 1); + nStartX = Clamp(nStartX, 0, MAX_HUGE_SECTORS - 1); + nEndX = Clamp(nEndX, 0, MAX_HUGE_SECTORS - 1); + nStartY = Clamp(nStartY, 0, MAX_HUGE_SECTORS - 1); + nEndY = Clamp(nEndY, 0, MAX_HUGE_SECTORS - 1); for ( int32 x = nStartX; x <= nEndX; x++ ) @@ -2161,10 +2161,10 @@ CWaterLevel::PreCalcWaterGeometry(void) float signX = CamFwdDir.x * 1.4144272f; float signY = CamFwdDir.y * 1.4144272f; - signX = clamp(signX, -1.0f, 1.0f); + signX = Clamp(signX, -1.0f, 1.0f); fCamX += 0.4f * signX * float(SMALL_SECTOR_SIZE * 2.0f); - signY = clamp(signY, -1.0f, 1.0f); + signY = Clamp(signY, -1.0f, 1.0f); fCamY += 0.4f * signY * float(SMALL_SECTOR_SIZE * 2.0f); int32 nBlock; @@ -2578,7 +2578,7 @@ CWaterLevel::RenderBoatWakes(void) float val = 500.0f - (CBoat::WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[wake]) * 600.0f / CBoat::WAKE_LIFETIME; - fAplhaB = clamp(val, 0.0f, 255.0f); + fAplhaB = Clamp(val, 0.0f, 255.0f); } CVector2D vecDistB = pBoat->m_avec2dWakePoints[wake - 1] - pBoat->m_avec2dWakePoints[wake]; @@ -2888,10 +2888,10 @@ CWaterLevel::CalcDistanceToWater(float fX, float fY) int32 nStartY = WATER_TO_SMALL_SECTOR_Y(fY - fSectorMaxRenderDist) - 1; int32 nEndY = WATER_TO_SMALL_SECTOR_Y(fY + fSectorMaxRenderDist) + 1; - nStartX = clamp(nStartX, 0, MAX_SMALL_SECTORS - 1); - nEndX = clamp(nEndX, 0, MAX_SMALL_SECTORS - 1); - nStartY = clamp(nStartY, 0, MAX_SMALL_SECTORS - 1); - nEndY = clamp(nEndY, 0, MAX_SMALL_SECTORS - 1); + nStartX = Clamp(nStartX, 0, MAX_SMALL_SECTORS - 1); + nEndX = Clamp(nEndX, 0, MAX_SMALL_SECTORS - 1); + nStartY = Clamp(nStartY, 0, MAX_SMALL_SECTORS - 1); + nEndY = Clamp(nEndY, 0, MAX_SMALL_SECTORS - 1); float fDistSqr = 1.0e10f; @@ -2915,7 +2915,7 @@ CWaterLevel::CalcDistanceToWater(float fX, float fY) } } - return clamp(Sqrt(fDistSqr) - 23.0f, 0.0f, fSectorMaxRenderDist); + return Clamp(Sqrt(fDistSqr) - 23.0f, 0.0f, fSectorMaxRenderDist); } void diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 8718e1c6..7358654c 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -286,7 +286,7 @@ void CWeather::Update(void) if (SunGlare > 0.0f) { SunGlare *= Min(1.0f, 7.0 * CTimeCycle::GetSunDirection().z); - SunGlare = clamp(SunGlare, 0.0f, 1.0f); + SunGlare = Clamp(SunGlare, 0.0f, 1.0f); if (!CSpecialFX::bSnapShotActive) SunGlare *= (1.0f - (CGeneral::GetRandomNumber()&0x1F)*0.007f); } |