summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Clouds.cpp16
-rw-r--r--src/render/Coronas.cpp4
-rw-r--r--src/render/Draw.cpp5
-rw-r--r--src/render/Hud.cpp14
-rw-r--r--src/render/Particle.cpp8
-rw-r--r--src/render/PointLights.cpp16
-rw-r--r--src/render/Renderer.cpp2
-rw-r--r--src/render/Sprite.cpp20
-rw-r--r--src/render/Timecycle.cpp4
-rw-r--r--src/render/WeaponEffects.cpp7
-rw-r--r--src/render/WeaponEffects.h14
11 files changed, 66 insertions, 44 deletions
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index d582bff8..2884894c 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -53,7 +53,7 @@ CClouds::Shutdown(void)
void
CClouds::Update(void)
{
- float s = sin(TheCamera.Orientation - 0.85f);
+ float s = Sin(TheCamera.Orientation - 0.85f);
CloudRotation += CWeather::Wind*s*0.0025f;
IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f;
}
@@ -81,7 +81,7 @@ CClouds::Render(void)
float coverage = CWeather::CloudCoverage <= CWeather::Foggyness ? CWeather::Foggyness : CWeather::CloudCoverage;
// Moon
- int moonfadeout = abs(minute - 180); // fully visible at 3AM
+ int moonfadeout = Abs(minute - 180); // fully visible at 3AM
if(moonfadeout < 180){ // fade in/out 3 hours
int brightness = (1.0f - coverage) * (180 - moonfadeout);
RwV3d pos = { 0.0f, -100.0f, 15.0f };
@@ -169,8 +169,8 @@ CClouds::Render(void)
}
// Fluffy clouds
- float rot_sin = sin(CloudRotation);
- float rot_cos = cos(CloudRotation);
+ float rot_sin = Sin(CloudRotation);
+ float rot_cos = Cos(CloudRotation);
int fluffyalpha = 160 * (1.0f - CWeather::Foggyness);
if(fluffyalpha != 0){
static float CoorsOffsetX[37] = {
@@ -210,7 +210,7 @@ CClouds::Render(void)
worldpos.z = pos.z;
if(CSprite::CalcScreenCoors(worldpos, &screenpos, &szx, &szy, false)){
- float sundist = sqrt(sq(screenpos.x-CCoronas::SunScreenX) + sq(screenpos.y-CCoronas::SunScreenY));
+ float sundist = Sqrt(sq(screenpos.x-CCoronas::SunScreenX) + sq(screenpos.y-CCoronas::SunScreenY));
int tr = CTimeCycle::GetFluffyCloudsTopRed();
int tg = CTimeCycle::GetFluffyCloudsTopGreen();
int tb = CTimeCycle::GetFluffyCloudsTopBlue();
@@ -302,10 +302,10 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
int16 botred, int16 botgreen, int16 botblue, int16 alpha)
{
RwMatrix *mat = RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera));
- float c = sqrt(mat->right.x * mat->right.x + mat->right.y * mat->right.y);
+ float c = Sqrt(mat->right.x * mat->right.x + mat->right.y * mat->right.y);
if(c > 1.0f)
c = 1.0f;
- ms_cameraRoll = acos(c);
+ ms_cameraRoll = Acos(c);
if(mat->right.z < 0.0f)
ms_cameraRoll = -ms_cameraRoll;
@@ -424,7 +424,7 @@ CClouds::RenderHorizon(void)
SCREEN_HEIGHT/300.0f * max(TheCamera.GetPosition().z, 0.0f);
float b = TheCamera.GetUp().z < 0.0f ?
SCREEN_HEIGHT :
- SCREEN_HEIGHT * fabs(TheCamera.GetRight().z);
+ SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
z2 = min(z2, SCREEN_HEIGHT);
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index 61fa1a5a..5ac9b149 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -286,8 +286,8 @@ CCoronas::Render(void)
// if distance too big, break streak
if(aCoronas[i].hasValue[1]){
- if(fabs(aCoronas[i].prevX[0] - aCoronas[i].prevX[1]) > 50.0f ||
- fabs(aCoronas[i].prevY[0] - aCoronas[i].prevY[1]) > 50.0f)
+ if(Abs(aCoronas[i].prevX[0] - aCoronas[i].prevX[1]) > 50.0f ||
+ Abs(aCoronas[i].prevY[0] - aCoronas[i].prevY[1]) > 50.0f)
aCoronas[i].hasValue[0] = false;
}
}
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index f825ba42..beb3443d 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -29,6 +29,7 @@ CDraw::FindAspectRatio(void)
switch (FrontEndMenuManager.m_PrefsUseWideScreen) {
case AR_AUTO:
return SCREEN_WIDTH / SCREEN_HEIGHT;
+ default:
case AR_4_3:
return 4.0f / 3.0f;
case AR_16_9:
@@ -49,8 +50,8 @@ CDraw::ConvertFOV(float hfov)
float ar1 = DEFAULT_ASPECT_RATIO;
float ar2 = GetAspectRatio();
hfov = DEGTORAD(hfov);
- float vfov = atan(tan(hfov/2) / ar1) *2;
- hfov = atan(tan(vfov/2) * ar2) *2;
+ float vfov = Atan(tan(hfov/2) / ar1) *2;
+ hfov = Atan(tan(vfov/2) * ar2) *2;
return RADTODEG(hfov);
}
#endif
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 680720e0..81f27153 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -173,7 +173,7 @@ void CHud::Draw()
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
- float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127);
+ float fStep = Sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127);
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect;
#ifndef ASPECT_RATIO_SCALE
@@ -814,8 +814,8 @@ void CHud::Draw()
if (!CTimer::GetIsUserPaused()) {
CTextLine* IntroText = CTheScripts::IntroTextLines;
- for (int i = 0; i < 2; i++) {
- if (CTheScripts::IntroTextLines[i].m_awText[0] && CTheScripts::IntroTextLines[i].field_29) {
+ for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++) {
+ if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) {
CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f));
CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor);
@@ -855,22 +855,22 @@ void CHud::Draw()
CFont::SetPropOff();
CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont);
- CFont::PrintString(SCREEN_SCALE_X(640.0f - CTheScripts::IntroTextLines[i].field_36), SCREEN_SCALE_Y(448.0f - CTheScripts::IntroTextLines[i].field_40), IntroText->m_awText);
+ CFont::PrintString(SCREEN_SCALE_X(640.0f - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(448.0f - CTheScripts::IntroTextLines[i].m_fAtY), IntroText->m_Text);
}
}
CScriptRectangle* IntroRect = CTheScripts::IntroRectangles;
for (int i = 0; i < 16; i++) {
- if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bIsAntialiased) {
- if (CTheScripts::IntroRectangles[i].m_wTextureId >= 0) {
+ if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bBeforeFade) {
+ if (CTheScripts::IntroRectangles[i].m_nTextureId >= 0) {
CRect rect = {
CTheScripts::IntroRectangles[i].m_sRect.left,
CTheScripts::IntroRectangles[i].m_sRect.bottom,
CTheScripts::IntroRectangles[i].m_sRect.right,
CTheScripts::IntroRectangles[i].m_sRect.bottom };
- CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_wTextureId].Draw(rect, IntroRect->m_sColor);
+ CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_nTextureId].Draw(rect, IntroRect->m_sColor);
}
else {
CRect rect = {
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 416e5af0..63545dff 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -299,8 +299,8 @@ void CParticle::Initialise()
{
float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
- m_SinTable[i] = sin(angle);
- m_CosTable[i] = cos(angle);
+ m_SinTable[i] = Sin(angle);
+ m_CosTable[i] = Cos(angle);
}
int32 slot = CTxdStore::FindTxdSlot("particle");
@@ -1599,7 +1599,7 @@ void CParticle::Render()
fTrailLength = fDist;
- //Float fRot = atan2( vecDist.x / fDist, sqrtf(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
+ //Float fRot = Atan2( vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
@@ -1651,7 +1651,7 @@ void CParticle::Render()
fTrailLength = fDist;
- //Float fRot = atan2(vecDist.x / fDist, sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
+ //Float fRot = Atan2(vecDist.x / fDist, Sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp
index 9e98a327..a015ec54 100644
--- a/src/render/PointLights.cpp
+++ b/src/render/PointLights.cpp
@@ -33,7 +33,7 @@ CPointLights::AddLight(uint8 type, CVector coors, CVector dir, float radius, flo
return;
dist = coors - TheCamera.GetPosition();
- if(fabs(dist.x) < MAX_DIST && fabs(dist.y) < MAX_DIST){
+ if(Abs(dist.x) < MAX_DIST && Abs(dist.y) < MAX_DIST){
distance = dist.Magnitude();
if(distance < MAX_DIST){
aLights[NumLights].type = type;
@@ -73,9 +73,9 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors)
// same weird distance calculation. simplified here
dist = aLights[i].coors - *objCoors;
radius = aLights[i].radius;
- if(fabs(dist.x) < radius &&
- fabs(dist.y) < radius &&
- fabs(dist.z) < radius){
+ if(Abs(dist.x) < radius &&
+ Abs(dist.y) < radius &&
+ Abs(dist.z) < radius){
distance = dist.Magnitude();
if(distance < radius){
@@ -213,11 +213,11 @@ CPointLights::RenderFogEffect(void)
if(dot > 0.0f && dot < FOG_AREA_LENGTH && linedistsq < sq(FOG_AREA_WIDTH)){
float intensity = 158.0f * fogginess;
// more intensity the smaller the angle
- intensity *= dot/sqrt(distsq);
+ intensity *= dot/Sqrt(distsq);
// more intensity the closer to light source
intensity *= 1.0f - sq(dot/FOG_AREA_LENGTH);
// more intensity the closer to line
- intensity *= 1.0f - sq(sqrt(linedistsq) / FOG_AREA_WIDTH);
+ intensity *= 1.0f - sq(Sqrt(linedistsq) / FOG_AREA_WIDTH);
if(CSprite::CalcScreenCoors(fogcoors, spriteCoors, &spritew, &spriteh, true)){
float rotation = (CTimer::GetTimeInMilliseconds()&0x1FFF) * 2*3.14f / 0x1FFF;
@@ -251,11 +251,11 @@ CPointLights::RenderFogEffect(void)
float dx = xi - aLights[i].coors.x;
float dy = yi - aLights[i].coors.y;
- float lightdist = sqrt(sq(dx) + sq(dy));
+ float lightdist = Sqrt(sq(dx) + sq(dy));
if(lightdist < FOG_AREA_RADIUS){
dx = xi - TheCamera.GetPosition().x;
dy = yi - TheCamera.GetPosition().y;
- float camdist = sqrt(sq(dx) + sq(dy));
+ float camdist = Sqrt(sq(dx) + sq(dy));
if(camdist < MAX_DIST){
float intensity;
// distance fade
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index a6f28443..69df63ba 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1160,7 +1160,7 @@ CRenderer::IsVehicleCullZoneVisible(CEntity *ent)
case STATUS_PHYSICS:
case STATUS_ABANDONED:
case STATUS_WRECKED:
- return !(v->m_pCurSurface && v->m_pCurSurface->bZoneCulled2);
+ return !(v->m_pCurGroundEntity && v->m_pCurGroundEntity->bZoneCulled2);
return true;
}
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index d917117a..24577f41 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -135,8 +135,8 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r
void
CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -261,8 +261,8 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(float x, float y, float z,
{
m_bFlushSpriteBufferSwitchZTest = 0;
// TODO: replace with lookup
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -313,8 +313,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -365,8 +365,8 @@ void
CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, float w, float h, uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2, float cx, float cy, float recipz, float rotation, uint8 a)
{
m_bFlushSpriteBufferSwitchZTest = 0;
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
float xs[4];
float ys[4];
@@ -572,8 +572,8 @@ CSprite::RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w
{
m_bFlushSpriteBufferSwitchZTest = 1;
CRGBA col(intens * colour.red >> 8, intens * colour.green >> 8, intens * colour.blue >> 8, alpha);
- float c = cos(DEGTORAD(rotation));
- float s = sin(DEGTORAD(rotation));
+ float c = Cos(DEGTORAD(rotation));
+ float s = Sin(DEGTORAD(rotation));
Set6Vertices2D(&SpriteBufferVerts[6 * nSpriteBufferIndex],
x + c*w - s*h,
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index af154716..7ab3e91e 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -299,9 +299,9 @@ CTimeCycle::Update(void)
float sunAngle = 2*PI*(CClock::GetMinutes() + CClock::GetHours()*60)/(24*60);
CVector &sunPos = GetSunPosition();
- sunPos.x = sinf(sunAngle);
+ sunPos.x = Sin(sunAngle);
sunPos.y = 1.0f;
- sunPos.z = 0.2f - cosf(sunAngle);
+ sunPos.z = 0.2f - Cos(sunAngle);
sunPos.Normalise();
CShadows::CalcPedShadowValues(sunPos,
diff --git a/src/render/WeaponEffects.cpp b/src/render/WeaponEffects.cpp
index a1a6d25a..e062da07 100644
--- a/src/render/WeaponEffects.cpp
+++ b/src/render/WeaponEffects.cpp
@@ -3,3 +3,10 @@
#include "WeaponEffects.h"
WRAPPER void CWeaponEffects::Render(void) { EAXJMP(0x564D70); }
+
+CWeaponEffects &gCrossHair = *(CWeaponEffects*)0x6503BC;
+
+void CWeaponEffects::ClearCrosshair()
+{
+ gCrossHair.m_bCrosshair = false;
+}
diff --git a/src/render/WeaponEffects.h b/src/render/WeaponEffects.h
index 63c8fd7d..7176c26d 100644
--- a/src/render/WeaponEffects.h
+++ b/src/render/WeaponEffects.h
@@ -3,5 +3,19 @@
class CWeaponEffects
{
public:
+ bool m_bCrosshair;
+ int8 gap_1[3];
+ CVector m_vecPos;
+ int8 field_16;
+ int8 field_17;
+ int8 field_18;
+ int8 field_19;
+ float field_20;
+ int32 field_24;
+ RwTexture *m_pTexture;
+ RwRaster *m_pRaster;
+
+public:
static void Render(void);
+ static void ClearCrosshair();
};