summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2019-07-24 19:30:09 +0200
committerFire-Head <Fire-Head@users.noreply.github.com>2019-07-24 19:30:09 +0200
commit0c0e564019af4dac66150b1bfa5c13219b9eb752 (patch)
tree6cb58eae0085a0a5a4abf5535e1d452ed497dd21
parentshadows done (diff)
downloadre3-0c0e564019af4dac66150b1bfa5c13219b9eb752.tar
re3-0c0e564019af4dac66150b1bfa5c13219b9eb752.tar.gz
re3-0c0e564019af4dac66150b1bfa5c13219b9eb752.tar.bz2
re3-0c0e564019af4dac66150b1bfa5c13219b9eb752.tar.lz
re3-0c0e564019af4dac66150b1bfa5c13219b9eb752.tar.xz
re3-0c0e564019af4dac66150b1bfa5c13219b9eb752.tar.zst
re3-0c0e564019af4dac66150b1bfa5c13219b9eb752.zip
Diffstat (limited to '')
-rw-r--r--src/core/Camera.h2
-rw-r--r--src/core/main.cpp2
-rw-r--r--src/core/re3.cpp17
-rw-r--r--src/entities/Entity.cpp6
-rw-r--r--src/render/Shadows.h11
-rw-r--r--src/render/WaterLevel.cpp12
-rw-r--r--src/vehicles/Boat.cpp11
7 files changed, 20 insertions, 41 deletions
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 10554601..84af9d55 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -441,7 +441,7 @@ int m_iModeObbeCamIsInForCar;
static bool &m_bUseMouse3rdPerson;
- CMatrix &GetCameraMatrix(void) { return m_cameraMatrix; }
+ inline const CMatrix GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 7fcc7ec9..e301b470 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -501,7 +501,7 @@ void
DisplayGameDebugText()
{
static bool bDisplayPosn = false;
- static bool bDisplayRate = false;
+ static bool bDisplayRate = false;
{
SETTWEAKPATH("GameDebugText");
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index bea5763c..e3aece97 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -190,21 +190,6 @@ void CTweakVars::AddDBG(const char *path)
bAddTweakVarsNow = true;
}
-//inline DebugMenuEntry * DebugMenuAddVar (const char *path , name, ptr, trig, step, lowerBound, upperBound, const char **strings)
-/*
-inline DebugMenuEntry *
-DebugMenuAddVar
-
-(const char *path,
-const char *name,
-int8_t *ptr,
-TriggerFunc triggerFunc,
-int8_t step,
-int8_t lowerBound,
-int8_t upperBound,
-const char **strings)
-*/
-
void CTweakSwitch::AddDBG(const char *path)
{
DebugMenuEntry *e = DebugMenuAddVar(m_pPath == NULL ? path : m_pPath, m_pVarName, (int32_t *)m_pIntVar, m_pFunc, 1, m_nMin, m_nMax, m_aStr);
@@ -232,7 +217,7 @@ TWEAKSWITCH(CWeather::NewWeatherType, 0, 3, wt, NULL);
void
DebugMenuPopulate(void)
-{
+{
if(DebugMenuLoad()){
static const char *weathers[] = {
"Sunny", "Cloudy", "Rainy", "Foggy"
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 10677bdf..0749e8e7 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -405,7 +405,7 @@ CEntity::PreRender(void)
}else if(GetModelIndex() == MI_MISSILE){
CVector pos = GetPosition();
float flicker = (CGeneral::GetRandomNumber() & 0xF)/(float)0x10;
- CShadows::StoreShadowToBeRendered(SHADOWTYPE_2,
+ CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE,
gpShadowExplosionTex, &pos,
8.0f, 0.0f, 0.0f, -8.0f,
255, 200.0f*flicker, 160.0f*flicker, 120.0f*flicker,
@@ -758,7 +758,7 @@ CEntity::ProcessLightsForEntity(void)
// Light shadow
if(effect->light.shadowRange != 0.0f){
if(lightOn){
- CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_2,
+ CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange,
@@ -768,7 +768,7 @@ CEntity::ProcessLightsForEntity(void)
effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
15.0f, 1.0f, 40.0f, false, 0.0f);
}else if(lightFlickering){
- CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_2,
+ CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange,
diff --git a/src/render/Shadows.h b/src/render/Shadows.h
index ca6718b0..585518ee 100644
--- a/src/render/Shadows.h
+++ b/src/render/Shadows.h
@@ -9,17 +9,12 @@
struct RwTexture;
class CEntity;
-enum
-{
- SHADOWTYPE_2 = 2
-};
-
enum eShadowType
{
SHADOWTYPE_NONE = 0,
- SHADOWTYPE_DARK,
- SHADOWTYPE_ADDITIVE,
- SHADOWTYPE_INVCOLOR
+ SHADOWTYPE_DARK,
+ SHADOWTYPE_ADDITIVE,
+ SHADOWTYPE_INVCOLOR
};
enum eShadowTextureType
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index f77680b6..07c88d3e 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -323,7 +323,7 @@ _GetCamBounds(bool *bUseCamStartY, bool *bUseCamEndY, bool *bUseCamStartX, bool
}
}
-float
+inline float
SectorRadius(float fSize)
{
return Sqrt(Pow(fSize, 2) + Pow(fSize, 2));
@@ -424,7 +424,7 @@ CWaterLevel::RenderWater()
if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr )
{
if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE),
- &CMatrix(TheCamera.GetCameraMatrix())) )
+ &TheCamera.GetCameraMatrix()) )
{
if ( fHugeSectorDistToCamSqr >= SQR(500.0f) /*fHugeSectorNearDist*/ )
{
@@ -466,7 +466,7 @@ CWaterLevel::RenderWater()
if ( fLargeSectorDistToCamSqr < fHugeSectorMaxRenderDistSqr )
{
if ( TheCamera.IsSphereVisible(CVector(vecLargeSectorCentre.x, vecLargeSectorCentre.y, 0.0f), SectorRadius(LARGE_SECTOR_SIZE), //90.879997f,
- &CMatrix(TheCamera.GetCameraMatrix())) )
+ &TheCamera.GetCameraMatrix()) )
{
// Render four small(32x32) sectors, or one large(64x64).
@@ -629,7 +629,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{
if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE),
- &CMatrix(TheCamera.GetCameraMatrix())) )
+ &TheCamera.GetCameraMatrix()) )
{
RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@@ -663,7 +663,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{
if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE),
- &CMatrix(TheCamera.GetCameraMatrix())) )
+ &TheCamera.GetCameraMatrix()) )
{
RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@@ -687,7 +687,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{
if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE),
- &CMatrix(TheCamera.GetCameraMatrix())) )
+ &TheCamera.GetCameraMatrix()) )
{
RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 53a912b3..c18bad25 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -37,8 +37,8 @@ bool CBoat::IsSectorAffectedByWake(CVector2D sector, float fSize, CBoat **apBoat
{
float fDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[j]) * fShapeTime + float(j) * fShapeLength + fSize;
- if ( fabs(pBoat->m_avec2dWakePoints[j].x - sector.x) < fDist
- && fabs(pBoat->m_avec2dWakePoints[i].y - sector.y) < fDist )
+ if ( Abs(pBoat->m_avec2dWakePoints[j].x - sector.x) < fDist
+ && Abs(pBoat->m_avec2dWakePoints[i].y - sector.y) < fDist )
{
apBoats[numVerts] = pBoat;
numVerts = 1; // += ?
@@ -56,13 +56,12 @@ float CBoat::IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat)
{
float fMaxDist = (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fShapeTime + float(i) * fShapeLength;
- float fX = pBoat->m_avec2dWakePoints[i].x - vecVertex.x;
- float fY = pBoat->m_avec2dWakePoints[i].y - vecVertex.y;
+ CVector2D vecDist = pBoat->m_avec2dWakePoints[i] - CVector2D(vecVertex);
- float fDist = fY * fY + fX * fX;
+ float fDist = vecDist.MagnitudeSqr();
if ( fDist < SQR(fMaxDist) )
- return 1.0f - min(fRangeMult * sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
+ return 1.0f - min(fRangeMult * Sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
}
return 0.0f;