summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorwithmorten <morten.with@gmail.com>2021-06-28 13:31:35 +0200
committerwithmorten <morten.with@gmail.com>2021-06-28 13:31:35 +0200
commitcb3b3855b844c14c0e943c1a7614fc29820cf666 (patch)
tree8e9a6ae74e9c98515b813f412476058274d3fde4 /src/render
parentLess invasive red tint on Delete Game page (diff)
downloadre3-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/render/Coronas.cpp2
-rw-r--r--src/render/Glass.cpp4
-rw-r--r--src/render/Particle.cpp16
-rw-r--r--src/render/Sprite.cpp8
-rw-r--r--src/render/WaterLevel.cpp26
5 files changed, 28 insertions, 28 deletions
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index 68e57b16..e9f9e662 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -481,7 +481,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/Glass.cpp b/src/render/Glass.cpp
index ede06ba1..cc45648c 100644
--- a/src/render/Glass.cpp
+++ b/src/render/Glass.cpp
@@ -139,9 +139,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/Particle.cpp b/src/render/Particle.cpp
index c971955f..76ddde50 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -880,15 +880,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);
}
@@ -1083,15 +1083,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);
}
@@ -1380,7 +1380,7 @@ void CParticle::Update()
{
particle->m_nFadeToBlackTimer = 0;
- particle->m_nColorIntensity = clamp(particle->m_nColorIntensity - psystem->m_nFadeToBlackAmount,
+ particle->m_nColorIntensity = Clamp(particle->m_nColorIntensity - psystem->m_nFadeToBlackAmount,
0, 255);
}
else
@@ -1393,7 +1393,7 @@ void CParticle::Update()
{
particle->m_nFadeAlphaTimer = 0;
- particle->m_nAlpha = clamp(particle->m_nAlpha - psystem->m_nFadeAlphaAmount,
+ particle->m_nAlpha = Clamp(particle->m_nAlpha - psystem->m_nFadeAlphaAmount,
0, 255);
#ifdef PC_PARTICLE
if ( particle->m_nAlpha == 0 )
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index a441e08b..3fef0733 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -405,13 +405,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 e41af17a..7001c0cf 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -126,10 +126,10 @@ CWaterLevel::Initialise(Const char *pWaterDat)
#ifdef FIX_BUGS
// water.dat has rects that go out of bounds
// which causes memory corruption
- 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);
#endif
for (int32 x = l; x <= r; x++)
@@ -713,10 +713,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++ )
{
@@ -1406,10 +1406,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;
@@ -1433,7 +1433,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