summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Fluff.cpp5
-rw-r--r--src/render/Hud.cpp2
-rw-r--r--src/render/Hud.h3
-rw-r--r--src/render/MBlur.cpp3
-rw-r--r--src/render/Particle.cpp1015
-rw-r--r--src/render/Particle.h20
-rw-r--r--src/render/ParticleMgr.cpp32
-rw-r--r--src/render/ParticleMgr.h7
-rw-r--r--src/render/ParticleType.h9
-rw-r--r--src/render/Renderer.cpp187
-rw-r--r--src/render/Renderer.h2
-rw-r--r--src/render/Shadows.cpp18
-rw-r--r--src/render/Sprite.cpp13
-rw-r--r--src/render/Sprite.h2
-rw-r--r--src/render/Timecycle.cpp276
-rw-r--r--src/render/Timecycle.h1
-rw-r--r--src/render/WaterCreatures.cpp4
-rw-r--r--src/render/WaterCreatures.h3
-rw-r--r--src/render/WaterLevel.cpp13
-rw-r--r--src/render/WaterLevel.h2
-rw-r--r--src/render/Weather.cpp27
-rw-r--r--src/render/Weather.h7
22 files changed, 951 insertions, 700 deletions
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index 30e271fb..e28ebc8e 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -417,8 +417,9 @@ void CMovingThings::Init()
}
}
- CEscalators::Init();
- aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612f), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f);
+// LCS: removed
+// CEscalators::Init();
+// aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612f), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f);
}
void CMovingThings::Shutdown()
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 238dfbb5..f3181fa8 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -91,7 +91,7 @@ bool CHud::m_HideRadar;
int32 CHud::m_ClockState;
// These aren't really in CHud
-float CHud::BigMessageInUse[6];
+float BigMessageInUse[6];
float CHud::BigMessageAlpha[6];
float CHud::BigMessageX[6];
float CHud::OddJob2OffTimer;
diff --git a/src/render/Hud.h b/src/render/Hud.h
index a4b9609a..354f2438 100644
--- a/src/render/Hud.h
+++ b/src/render/Hud.h
@@ -47,6 +47,8 @@ enum eSprites
NUM_HUD_SPRITES = 69,
};
+extern float BigMessageInUse[6];
+
class CHud
{
public:
@@ -82,7 +84,6 @@ public:
static int32 m_ClockState;
// These aren't really in CHud
- static float BigMessageInUse[6];
static float BigMessageAlpha[6];
static float BigMessageX[6];
static float OddJob2OffTimer;
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index 205f9d92..5abc94b9 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -591,6 +591,8 @@ CMBlur::AddRenderFx(RwCamera *cam, RwRect *rect, float z, FxType type)
void
CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf)
{
+ //TODO(LCS)
+#if 0
bool drawWaterDrops = false;
RwIm2DVertex verts[4];
int red = (0.75f*CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed())*0.55f * 255;
@@ -796,4 +798,5 @@ CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf)
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
pBufVertCount = 0;
+#endif
}
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 51249844..d6ee36a1 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -12,6 +12,7 @@
#include "Replay.h"
#include "Stats.h"
#include "Weather.h"
+#include "WaterLevel.h"
#include "MBlur.h"
#include "main.h"
#include "AudioScriptObject.h"
@@ -212,7 +213,6 @@ RwRaster *gpLetterRaster;
RwTexture *gpSparkTex;
RwTexture *gpNewspaperTex;
RwTexture *gpGunSmokeTex;
-RwTexture *gpDotTex;
RwTexture *gpHeatHazeTex;
RwTexture *gpBeastieTex;
RwTexture *gpRainDripTex[MAX_RAINDRIP_FILES];
@@ -221,34 +221,30 @@ RwTexture *gpRainDripDarkTex[MAX_RAINDRIP_FILES];
RwRaster *gpSparkRaster;
RwRaster *gpNewspaperRaster;
RwRaster *gpGunSmokeRaster;
-RwRaster *gpDotRaster;
RwRaster *gpHeatHazeRaster;
RwRaster *gpBeastieRaster;
RwRaster *gpRainDripRaster[MAX_RAINDRIP_FILES];
RwRaster *gpRainDripDarkRaster[MAX_RAINDRIP_FILES];
+RwTexture *gpFireHoseTex;
+RwRaster *gpFireHoseRaster;
+
+RwTexture *gpMultiPlayerHitTex;
+RwRaster *gpMultiPlayerHitRaster;
+
float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE];
CParticle *CParticle::m_pUnusedListHead;
float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE];
float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE];
int32 Randomizer;
-int32 nParticleCreationInterval = 1;
float PARTICLE_WIND_TEST_SCALE = 0.002f;
-float fParticleScaleLimit = 0.5f;
-
-bool clearWaterDrop;
-int32 numWaterDropOnScreen;
#ifdef DEBUGMENU
SETTWEAKPATH("Particle");
-TWEAKINT32(nParticleCreationInterval, 0, 5, 1);
-TWEAKFLOAT(fParticleScaleLimit, 0.0f, 1.0f, 0.1f);
TWEAKFUNC(CParticle::ReloadConfig);
#endif
-
-
void CParticle::ReloadConfig()
{
debug("Initialising CParticleMgr...");
@@ -286,14 +282,6 @@ void CParticle::ReloadConfig()
gParticleArray[i].m_nFadeAlphaTimer = 0;
- gParticleArray[i].m_nCurrentZRotation = 0;
-
- gParticleArray[i].m_nZRotationTimer = 0;
-
- gParticleArray[i].m_fCurrentZRadius = 0.0f;
-
- gParticleArray[i].m_nZRadiusTimer = 0;
-
gParticleArray[i].m_nCurrentFrame = 0;
gParticleArray[i].m_nAnimationSpeedTimer = 0;
@@ -318,7 +306,7 @@ void CParticle::Initialise()
}
for ( int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ )
- {
+ {
float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
m_SinTable[i] = ::Sin(angle);
@@ -333,83 +321,98 @@ void CParticle::Initialise()
for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{
gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], nil);
+ ASSERT(gpSmokeTex[i] != nil);
gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]);
}
gpSmoke2Tex = RwTextureRead("smokeII_3", nil);
+ ASSERT(gpSmoke2Tex != nil);
gpSmoke2Raster = RwTextureGetRaster(gpSmoke2Tex);
for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{
gpRubberTex[i] = RwTextureRead(RubberFiles[i], nil);
+ ASSERT(gpRubberTex[i] != nil);
gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]);
}
for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{
gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], nil);
+ ASSERT(gpRainSplashTex[i] != nil);
gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]);
}
for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{
gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], nil);
+ ASSERT(gpWatersprayTex[i] != nil);
gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]);
}
for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{
gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], nil);
+ ASSERT(gpExplosionMediumTex[i] != nil);
gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]);
}
for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
{
gpGunFlashTex[i] = RwTextureRead(GunFlashFiles[i], nil);
+ ASSERT(gpGunFlashTex[i] != nil);
gpGunFlashRaster[i] = RwTextureGetRaster(gpGunFlashTex[i]);
}
gpRainDropTex = RwTextureRead("raindrop4", nil);
+ ASSERT(gpRainDropTex != nil);
gpRainDropRaster = RwTextureGetRaster(gpRainDropTex);
-
for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{
gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], nil);
+ ASSERT(gpRainSplashupTex[i] != nil);
gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]);
}
for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
{
gpBirdfrontTex[i] = RwTextureRead(BirdfrontFiles[i], nil);
+ ASSERT(gpBirdfrontTex[i] != nil);
gpBirdfrontRaster[i] = RwTextureGetRaster(gpBirdfrontTex[i]);
}
for ( int32 i = 0; i < MAX_BOAT_FILES; i++ )
{
gpBoatTex[i] = RwTextureRead(BoatFiles[i], nil);
+ ASSERT(gpBoatTex[i] != nil);
gpBoatRaster[i] = RwTextureGetRaster(gpBoatTex[i]);
}
for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{
gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], nil);
+ ASSERT(gpCarDebrisTex[i] != nil);
gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]);
}
for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{
gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], nil);
+ ASSERT(gpCarSplashTex[i] != nil);
gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]);
}
gpBoatWakeTex = RwTextureRead("boatwake2", nil);
+ ASSERT(gpBoatWakeTex != nil);
gpBoatWakeRaster = RwTextureGetRaster(gpBoatWakeTex);
gpFlame1Tex = RwTextureRead("flame1", nil);
+ ASSERT(gpFlame1Tex != nil);
gpFlame1Raster = RwTextureGetRaster(gpFlame1Tex);
gpFlame5Tex = RwTextureRead("flame5", nil);
+ ASSERT(gpFlame5Tex != nil);
//#ifdef FIX_BUGS
#if 0
@@ -420,70 +423,92 @@ void CParticle::Initialise()
#endif
gpRainDropSmallTex = RwTextureRead("rainsmall", nil);
+ ASSERT(gpRainDropSmallTex != nil);
gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex);
gpBloodTex = RwTextureRead("blood", nil);
+ ASSERT(gpBloodTex != nil);
gpBloodRaster = RwTextureGetRaster(gpBloodTex);
gpLeafTex = RwTextureRead("gameleaf01_64", nil);
+ ASSERT(gpLeafTex != nil);
gpLeafRaster = RwTextureGetRaster(gpLeafTex);
gpLetterTex = RwTextureRead("letter", nil);
+ ASSERT(gpLetterTex != nil);
gpLetterRaster = RwTextureGetRaster(gpLetterTex);
gpCloudTex1 = RwTextureRead("cloud3", nil);
+ ASSERT(gpCloudTex1 != nil);
gpCloudRaster1 = RwTextureGetRaster(gpCloudTex1);
gpCloudTex4 = RwTextureRead("cloudmasked", nil);
+ ASSERT(gpCloudTex4 != nil);
gpCloudRaster4 = RwTextureGetRaster(gpCloudTex4);
gpBloodSmallTex = RwTextureRead("bloodsplat2", nil);
+ ASSERT(gpBloodSmallTex != nil);
gpBloodSmallRaster = RwTextureGetRaster(gpBloodSmallTex);
gpGungeTex = RwTextureRead("gunge", nil);
+ ASSERT(gpGungeTex != nil);
gpGungeRaster = RwTextureGetRaster(gpGungeTex);
gpCollisionSmokeTex = RwTextureRead("collisionsmoke", nil);
+ ASSERT(gpCollisionSmokeTex != nil);
gpCollisionSmokeRaster = RwTextureGetRaster(gpCollisionSmokeTex);
gpBulletHitTex = RwTextureRead("bullethitsmoke", nil);
+ ASSERT(gpBulletHitTex != nil);
gpBulletHitRaster = RwTextureGetRaster(gpBulletHitTex);
gpGunShellTex = RwTextureRead("gunshell", nil);
+ ASSERT(gpGunShellTex != nil);
gpGunShellRaster = RwTextureGetRaster(gpGunShellTex);
- gpPointlightTex = RwTextureRead("pointlight", nil);
+ gpPointlightTex = RwTextureRead("smoke5", nil);
+ ASSERT(gpPointlightTex != nil);
gpPointlightRaster = RwTextureGetRaster(gpPointlightTex);
gpSparkTex = RwTextureRead("spark", nil);
+ ASSERT(gpSparkTex != nil);
gpSparkRaster = RwTextureGetRaster(gpSparkTex);
- gpNewspaperTex = RwTextureRead("newspaper02_64", nil);
+ gpNewspaperTex = RwTextureRead("ballot_paper", nil);
+ ASSERT(gpNewspaperTex != nil);
gpNewspaperRaster = RwTextureGetRaster(gpNewspaperTex);
gpGunSmokeTex = RwTextureRead("gunsmoke3", nil);
+ ASSERT(gpGunSmokeTex != nil);
gpGunSmokeRaster = RwTextureGetRaster(gpGunSmokeTex);
- gpDotTex = RwTextureRead("dot", nil);
- gpDotRaster = RwTextureGetRaster(gpDotTex);
-
gpHeatHazeTex = RwTextureRead("heathaze", nil);
+ ASSERT(gpHeatHazeTex != nil);
gpHeatHazeRaster = RwTextureGetRaster(gpHeatHazeTex);
gpBeastieTex = RwTextureRead("beastie", nil);
+ ASSERT(gpBeastieTex != nil);
gpBeastieRaster = RwTextureGetRaster(gpBeastieTex);
gpRainDripTex[0] = RwTextureRead("raindrip64", nil);
+ ASSERT(gpRainDripTex[0] != nil);
gpRainDripRaster[0] = RwTextureGetRaster(gpRainDripTex[0]);
gpRainDripTex[1] = RwTextureRead("raindripb64", nil);
+ ASSERT(gpRainDripTex[1] != nil);
gpRainDripRaster[1] = RwTextureGetRaster(gpRainDripTex[1]);
gpRainDripDarkTex[0] = RwTextureRead("raindrip64_d", nil);
+ ASSERT(gpRainDripDarkTex[0] != nil);
gpRainDripDarkRaster[0] = RwTextureGetRaster(gpRainDripDarkTex[0]);
- gpRainDripDarkTex[1] = RwTextureRead("raindripb64_d", nil);
- gpRainDripDarkRaster[1] = RwTextureGetRaster(gpRainDripDarkTex[1]);
+ gpMultiPlayerHitTex = RwTextureRead("mphit", nil);
+ ASSERT(gpMultiPlayerHitTex != nil);
+ gpMultiPlayerHitRaster = RwTextureGetRaster(gpMultiPlayerHitTex);
+
+ gpFireHoseTex = RwTextureRead("firehose", nil);
+ ASSERT(gpFireHoseTex != nil);
+ gpFireHoseRaster = RwTextureGetRaster(gpFireHoseTex);
CTxdStore::PopCurrentTxd();
@@ -491,98 +516,84 @@ void CParticle::Initialise()
{
tParticleSystemData *entry = &mod_ParticleSystemManager.m_aParticles[i];
- switch ( i )
+ switch( i )
{
case PARTICLE_SPARK:
+ entry->m_ppRaster = &gpRainDropSmallRaster;
+ break;
+
case PARTICLE_SPARK_SMALL:
- case PARTICLE_RAINDROP_SMALL:
- case PARTICLE_HELI_ATTACK:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
-
+
case PARTICLE_WATER_SPARK:
entry->m_ppRaster = &gpSparkRaster;
break;
-
+
case PARTICLE_WHEEL_DIRT:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
case PARTICLE_SAND:
- case PARTICLE_STEAM2:
- case PARTICLE_STEAM_NY:
- case PARTICLE_STEAM_NY_SLOWMOTION:
- case PARTICLE_GROUND_STEAM:
- case PARTICLE_ENGINE_STEAM:
- case PARTICLE_PEDFOOT_DUST:
- case PARTICLE_CAR_DUST:
- case PARTICLE_EXHAUST_FUMES:
entry->m_ppRaster = &gpSmoke2Raster;
break;
-
+
case PARTICLE_WHEEL_WATER:
- case PARTICLE_WATER:
- case PARTICLE_SMOKE:
- case PARTICLE_SMOKE_SLOWMOTION:
- case PARTICLE_DRY_ICE:
- case PARTICLE_GARAGEPAINT_SPRAY:
- case PARTICLE_STEAM:
- case PARTICLE_WATER_CANNON:
- case PARTICLE_EXTINGUISH_STEAM:
- case PARTICLE_HELI_DUST:
- case PARTICLE_PAINT_SMOKE:
- case PARTICLE_BULLETHIT_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
-
+
case PARTICLE_BLOOD:
entry->m_ppRaster = &gpBloodRaster;
break;
-
+
case PARTICLE_BLOOD_SMALL:
+ entry->m_ppRaster = &gpBloodSmallRaster;
+ break;
+
case PARTICLE_BLOOD_SPURT:
entry->m_ppRaster = &gpBloodSmallRaster;
break;
-
+
case PARTICLE_DEBRIS:
- case PARTICLE_TREE_LEAVES:
entry->m_ppRaster = &gpLeafRaster;
break;
-
+
case PARTICLE_DEBRIS2:
entry->m_ppRaster = &gpGungeRaster;
break;
-
+
case PARTICLE_FLYERS:
entry->m_ppRaster = &gpNewspaperRaster;
break;
-
+
+ case PARTICLE_WATER:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
case PARTICLE_FLAME:
- case PARTICLE_CARFLAME:
entry->m_ppRaster = &gpFlame1Raster;
break;
-
+
case PARTICLE_FIREBALL:
entry->m_ppRaster = &gpFlame5Raster;
break;
-
+
case PARTICLE_GUNFLASH:
+ entry->m_ppRaster = gpGunFlashRaster;
+ break;
+
case PARTICLE_GUNFLASH_NOANIM:
entry->m_ppRaster = gpGunFlashRaster;
break;
-
-
+
case PARTICLE_GUNSMOKE:
- case PARTICLE_WATERDROP:
- case PARTICLE_BLOODDROP:
- case PARTICLE_HEATHAZE:
- case PARTICLE_HEATHAZE_IN_DIST:
entry->m_ppRaster = nil;
break;
-
+
case PARTICLE_GUNSMOKE2:
- case PARTICLE_BOAT_THRUSTJET:
- case PARTICLE_RUBBER_SMOKE:
entry->m_ppRaster = gpRubberRaster;
break;
-
+
case PARTICLE_CIGARETTE_SMOKE:
entry->m_ppRaster = &gpGunSmokeRaster;
break;
@@ -590,20 +601,56 @@ void CParticle::Initialise()
case PARTICLE_TEARGAS:
entry->m_ppRaster = &gpHeatHazeRaster;
break;
+
+ case PARTICLE_SMOKE:
+ case PARTICLE_SMOKE_SLOWMOTION:
+ case PARTICLE_DRY_ICE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+ case PARTICLE_GARAGEPAINT_SPRAY:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
case PARTICLE_SHARD:
- case PARTICLE_RAINDROP:
- case PARTICLE_RAINDROP_2D:
entry->m_ppRaster = &gpRainDropRaster;
break;
-
+
case PARTICLE_SPLASH:
- case PARTICLE_PED_SPLASH:
- case PARTICLE_CAR_SPLASH:
- case PARTICLE_WATER_HYDRANT:
entry->m_ppRaster = gpCarSplashRaster;
break;
+
+ case PARTICLE_CARFLAME:
+ entry->m_ppRaster = &gpFlame1Raster;
+ break;
+
+ case PARTICLE_STEAM:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_STEAM2:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_STEAM_NY:
+ case PARTICLE_STEAM_NY_SLOWMOTION:
+ case PARTICLE_GROUND_STEAM:
+ case PARTICLE_HYDRANT_STEAM:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_ENGINE_STEAM:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_RAINDROP:
+ entry->m_ppRaster = &gpRainDropRaster;
+ break;
+ case PARTICLE_RAINDROP_SMALL:
+ entry->m_ppRaster = &gpRainDropSmallRaster;
+ break;
+
case PARTICLE_RAIN_SPLASH:
case PARTICLE_RAIN_SPLASH_BIGGROW:
entry->m_ppRaster = gpRainSplashRaster;
@@ -617,44 +664,140 @@ void CParticle::Initialise()
entry->m_ppRaster = gpWatersprayRaster;
break;
+ case PARTICLE_RAINDROP_2D:
+ entry->m_ppRaster = &gpRainDropRaster;
+ break;
+
case PARTICLE_EXPLOSION_MEDIUM:
+ entry->m_ppRaster = gpExplosionMediumRaster;
+ break;
+
case PARTICLE_EXPLOSION_LARGE:
+ entry->m_ppRaster = gpExplosionMediumRaster;
+ break;
+
case PARTICLE_EXPLOSION_MFAST:
+ entry->m_ppRaster = gpExplosionMediumRaster;
+ break;
+
case PARTICLE_EXPLOSION_LFAST:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
+ case PARTICLE_CAR_SPLASH:
+ entry->m_ppRaster = gpCarSplashRaster;
+ break;
+
case PARTICLE_BOAT_SPLASH:
entry->m_ppRaster = &gpBoatWakeRaster;
break;
+ case PARTICLE_BOAT_THRUSTJET:
+ entry->m_ppRaster = gpRubberRaster;
+ break;
+
+ case PARTICLE_WATER_HYDRANT:
+ entry->m_ppRaster = gpCarSplashRaster;
+ break;
+
+ case PARTICLE_WATER_CANNON:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_EXTINGUISH_STEAM:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_PED_SPLASH:
+ entry->m_ppRaster = gpCarSplashRaster;
+ break;
+
+ case PARTICLE_PEDFOOT_DUST:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_CAR_DUST:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_HELI_DUST:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_HELI_ATTACK:
+ entry->m_ppRaster = &gpRainDropSmallRaster;
+ break;
+
case PARTICLE_ENGINE_SMOKE:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
+
case PARTICLE_ENGINE_SMOKE2:
+ case PARTICLE_ROCKET_SMOKE:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
+
case PARTICLE_CARFLAME_SMOKE:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
+
case PARTICLE_FIREBALL_SMOKE:
- case PARTICLE_ROCKET_SMOKE:
- case PARTICLE_TEST:
entry->m_ppRaster = &gpCloudRaster4;
break;
+ case PARTICLE_PAINT_SMOKE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_TREE_LEAVES:
+ entry->m_ppRaster = &gpLeafRaster;
+ break;
+
case PARTICLE_CARCOLLISION_DUST:
- case PARTICLE_BURNINGRUBBER_SMOKE:
entry->m_ppRaster = &gpCollisionSmokeRaster;
break;
case PARTICLE_CAR_DEBRIS:
- case PARTICLE_HELI_DEBRIS:
case PARTICLE_BIRD_DEBRIS:
+ case PARTICLE_HELI_DEBRIS:
entry->m_ppRaster = gpCarDebrisRaster;
break;
+ case PARTICLE_EXHAUST_FUMES:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_RUBBER_SMOKE:
+ entry->m_ppRaster = gpRubberRaster;
+ break;
+
+ case PARTICLE_BURNINGRUBBER_SMOKE:
+ entry->m_ppRaster = &gpCollisionSmokeRaster;
+ break;
+
+ case PARTICLE_BULLETHIT_SMOKE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
case PARTICLE_GUNSHELL_FIRST:
+ entry->m_ppRaster = &gpGunShellRaster;
+ break;
+
case PARTICLE_GUNSHELL:
+ entry->m_ppRaster = &gpGunShellRaster;
+ break;
+
case PARTICLE_GUNSHELL_BUMP1:
+ entry->m_ppRaster = &gpGunShellRaster;
+ break;
+
case PARTICLE_GUNSHELL_BUMP2:
entry->m_ppRaster = &gpGunShellRaster;
break;
+ case PARTICLE_TEST:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
case PARTICLE_BIRD_FRONT:
entry->m_ppRaster = gpBirdfrontRaster;
@@ -667,6 +810,14 @@ void CParticle::Initialise()
case PARTICLE_BEASTIE:
entry->m_ppRaster = &gpBeastieRaster;
break;
+
+ case PARTICLE_FERRY_CHIM_SMOKE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_MULTIPLAYER_HIT:
+ entry->m_ppRaster = &gpMultiPlayerHitRaster;
+ break;
}
}
@@ -754,8 +905,13 @@ void CParticle::Shutdown()
RwTextureDestroy(gpRainDripTex[i]);
gpRainDripTex[i] = nil;
- RwTextureDestroy(gpRainDripDarkTex[i]);
- gpRainDripDarkTex[i] = nil;
+#ifdef FIX_BUGS
+ if (gpRainDripDarkTex[i])
+#endif
+ {
+ RwTextureDestroy(gpRainDripDarkTex[i]);
+ gpRainDripDarkTex[i] = nil;
+ }
}
RwTextureDestroy(gpBoatWakeTex);
@@ -811,14 +967,18 @@ void CParticle::Shutdown()
RwTextureDestroy(gpGunSmokeTex);
gpGunSmokeTex = nil;
-
- RwTextureDestroy(gpDotTex);
- gpDotTex = nil;
+
RwTextureDestroy(gpHeatHazeTex);
gpHeatHazeTex = nil;
RwTextureDestroy(gpBeastieTex);
gpBeastieTex = nil;
+
+ RwTextureDestroy(gpMultiPlayerHitTex);
+ gpBeastieTex = nil;
+
+ RwTextureDestroy(gpFireHoseTex);
+ gpFireHoseTex = nil;
int32 slot;
@@ -870,24 +1030,12 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan)
{
- if ( CTimer::GetIsPaused() )
+ if ( CTimer::GetIsPaused() /*TODO: || byte_355C47*/ )
return nil;
-
- if ( ( type == PARTICLE_ENGINE_SMOKE
- || type == PARTICLE_ENGINE_SMOKE2
- || type == PARTICLE_ENGINE_STEAM
- || type == PARTICLE_CARFLAME_SMOKE
- || type == PARTICLE_RUBBER_SMOKE
- || type == PARTICLE_BURNINGRUBBER_SMOKE
- || type == PARTICLE_EXHAUST_FUMES
- || type == PARTICLE_CARCOLLISION_DUST )
- && nParticleCreationInterval & CTimer::GetFrameCounter() )
- {
- return nil;
- }
-
+/*
if ( !CReplay::IsPlayingBack() )
CReplay::RecordParticle(type, vecPos, vecDir, fSize, color);
+*/
CParticle *pParticle = m_pUnusedListHead;
@@ -922,38 +1070,15 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->m_nFadeAlphaTime )
pParticle->m_nFadeAlphaTimer /= psystem->m_nFadeAlphaTime;
- pParticle->m_nCurrentZRotation = psystem->m_nZRotationInitialAngle;
- pParticle->m_fCurrentZRadius = psystem->m_fInitialZRadius;
-
if ( nCurFrame != 0 )
pParticle->m_nCurrentFrame = nCurFrame;
else
pParticle->m_nCurrentFrame = psystem->m_nStartAnimationFrame;
-
- pParticle->m_nZRotationTimer = 0;
- pParticle->m_nZRadiusTimer = 0;
pParticle->m_nAnimationSpeedTimer = 0;
pParticle->m_fZGround = 0.0f;
-
- if ( type != PARTICLE_HEATHAZE )
- pParticle->m_vecPosition = vecPos;
- else
- {
- CVector screen;
- float w, h;
-
- if ( !CSprite::CalcScreenCoors(vecPos, &screen, &w, &h, true) )
- return nil;
-
- pParticle->m_vecPosition = screen;
- psystem->m_vecTextureStretch.x = w;
- psystem->m_vecTextureStretch.y = h;
- }
-
+ pParticle->m_vecPosition = vecPos;
pParticle->m_vecVelocity = vecDir;
-
- pParticle->m_vecParticleMovementOffset = CVector(0.0f, 0.0f, 0.0f);
pParticle->m_nTimeWhenColorWillBeChanged = 0;
if ( color.alpha != 0 )
@@ -1090,14 +1215,14 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
break;
case PARTICLE_EXPLOSION_MEDIUM:
- pParticle->m_nColorIntensity -= 30 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
+ pParticle->m_nColorIntensity -= 2 * 15 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
pParticle->m_nAnimationSpeedTimer = CGeneral::GetRandomNumber() & 7;
pParticle->m_fSize = CGeneral::GetRandomNumberInRange(0.3f, 0.8f);
pParticle->m_vecPosition.z -= CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
break;
case PARTICLE_EXPLOSION_LARGE:
- pParticle->m_nColorIntensity -= 30 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
+ pParticle->m_nColorIntensity -= 2 * 15 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
pParticle->m_nAnimationSpeedTimer = CGeneral::GetRandomNumber() & 7;
pParticle->m_fSize = CGeneral::GetRandomNumberInRange(0.8f, 1.4f);
pParticle->m_vecPosition.z -= CGeneral::GetRandomNumberInRange(-0.3f, 0.3f);
@@ -1123,7 +1248,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
void CParticle::Update()
{
- if ( CTimer::GetIsPaused() )
+ if ( CTimer::GetIsPaused() /*TODO: || byte_355C47*/ )
return;
CRGBA color(0, 0, 0, 0);
@@ -1136,7 +1261,9 @@ void CParticle::Update()
float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep());
CParticleObject::UpdateAll();
-
+
+ // no more erectedcocks
+#ifndef FIX_BUGS
// ejaculation at 23:00, 23:15, 23:30, 23:45
if ( CClock::ms_nGameClockHours == 23 &&
( CClock::ms_nGameClockMinutes == 0
@@ -1155,6 +1282,7 @@ void CParticle::Update()
1,
1000);
}
+#endif
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
@@ -1174,68 +1302,7 @@ void CParticle::Update()
CVector vecMoveStep = particle->m_vecVelocity * CTimer::GetTimeStep();
CVector vecPos = particle->m_vecPosition;
-
- if ( numWaterDropOnScreen == 0 )
- clearWaterDrop = false;
-
- if ( psystem->m_Type == PARTICLE_WATERDROP )
- {
- if ( CGame::IsInInterior() || clearWaterDrop == true )
- {
- bRemoveParticle = true;
- continue;
- }
-
- static uint8 nWaterDropCount;
-
- if ( nWaterDropCount == 5 )
- {
- vecMoveStep = CVector(0.0f, 0.0f, 0.0f);
- particle->m_nTimeWhenWillBeDestroyed += 1250;
- nWaterDropCount = 0;
- }
- else
- {
- if ( TheCamera.m_CameraAverageSpeed > 0.35f )
- {
- if ( vecMoveStep.Magnitude() > 0.5f )
- {
- if ( vecMoveStep.Magnitude() > 0.4f && vecMoveStep.Magnitude() < 0.8f )
- {
- vecMoveStep.x += TheCamera.m_CameraAverageSpeed * 1.5f;
- vecMoveStep.y += TheCamera.m_CameraAverageSpeed * 1.5f;
- }
- else if ( vecMoveStep.Magnitude() != 0.0f )
- {
- vecMoveStep.x += CGeneral::GetRandomNumberInRange(0.01f, 0.05f);
- vecMoveStep.y += CGeneral::GetRandomNumberInRange(0.01f, 0.05f);
- }
- }
- }
-
- nWaterDropCount++;
- }
-
- if ( vecPos.z <= 1.5f )
- vecMoveStep.z = 0.0f;
- }
-
- if ( psystem->m_Type == PARTICLE_HEATHAZE || psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST )
- {
-#ifdef FIX_BUGS
- int32 nSinCosIndex = (int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) + SIN_COS_TABLE_SIZE) % SIN_COS_TABLE_SIZE;
-#else
- int32 nSinCosIndex = int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) % SIN_COS_TABLE_SIZE;
-#endif
- vecMoveStep.x = Sin(nSinCosIndex);
- vecMoveStep.y = Sin(nSinCosIndex);
-
- if ( psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST )
- particle->m_nRotation = int16((float)particle->m_nRotation + 0.75f);
- else
- particle->m_nRotation = int16((float)particle->m_nRotation + 1.0f);
- }
-
+
if ( psystem->m_Type == PARTICLE_BEASTIE )
{
#ifdef FIX_BUGS
@@ -1258,28 +1325,7 @@ void CParticle::Update()
}
vecPos += vecMoveStep;
-
- if ( psystem->m_Type == PARTICLE_FIREBALL )
- {
- AddParticle(PARTICLE_HEATHAZE, particle->m_vecPosition, CVector(0.0f, 0.0f, 0.0f),
- nil, particle->m_fSize * 5.0f);
- }
-
- if ( psystem->m_Type == PARTICLE_GUNSMOKE2 )
- {
- if ( CTimer::GetFrameCounter() & 10 )
- {
-#ifdef FIX_BUGS
- if ( FindPlayerPed() && FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN )
-#else
- if ( FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN )
-#endif
- {
- AddParticle(PARTICLE_HEATHAZE, particle->m_vecPosition, CVector(0.0f, 0.0f, 0.0f));
- }
- }
- }
-
+
if ( CWeather::Wind > 0.0f )
{
if ( vecMoveStep.Magnitude() != 0.0f )
@@ -1299,12 +1345,15 @@ void CParticle::Update()
|| psystem->m_Type == PARTICLE_BOAT_SPLASH
|| psystem->m_Type == PARTICLE_RAINDROP_2D )
{
- int32 nMaxDrops = int32(6.0f * TheCamera.m_CameraAverageSpeed + 1.0f);
+ //int32 nMaxDrops = int32(6.0f * TheCamera.m_CameraAverageSpeed + 1.0f);
float fDistToCam = 0.0f;
if ( psystem->m_Type == PARTICLE_BOAT_SPLASH || psystem->m_Type == PARTICLE_CAR_SPLASH )
{
- if ( vecPos.z + particle->m_fSize < 5.0f )
+ float fWaterLevel = 0.0f;
+ CWaterLevel::GetWaterLevelNoWaves(vecPos.x, vecPos.y, vecPos.z, &fWaterLevel);
+
+ if ( vecPos.z + particle->m_fSize < fWaterLevel )
{
bRemoveParticle = true;
continue;
@@ -1315,61 +1364,16 @@ void CParticle::Update()
case LOOKING_LEFT:
case LOOKING_RIGHT:
case LOOKING_FORWARD:
- nMaxDrops /= 2;
+ //nMaxDrops /= 2;
break;
default:
- nMaxDrops = 0;
+ //nMaxDrops = 0;
break;
}
fDistToCam = (TheCamera.GetPosition() - vecPos).Magnitude();
}
-
- if ( numWaterDropOnScreen < nMaxDrops && numWaterDropOnScreen < 63
- && fDistToCam < 10.0f
- && clearWaterDrop == false
- && !CGame::IsInInterior() )
- {
- CVector vecWaterdropTarget
- (
- CGeneral::GetRandomNumberInRange(-0.25f, 0.25f),
- CGeneral::GetRandomNumberInRange(0.1f, 0.75f),
- -0.01f
- );
-
- CVector vecWaterdropPos;
-
- if ( TheCamera.m_CameraAverageSpeed < 0.35f )
- vecWaterdropPos.x = (float)CGeneral::GetRandomNumberInRange(50, int32(SCREEN_WIDTH) - 50);
- else
- vecWaterdropPos.x = (float)CGeneral::GetRandomNumberInRange(200, int32(SCREEN_WIDTH) - 200);
-
- if ( psystem->m_Type == PARTICLE_BOAT_SPLASH || psystem->m_Type == PARTICLE_CAR_SPLASH )
- vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(SCREEN_HEIGHT / 2, SCREEN_HEIGHT);
- else
- {
- if ( TheCamera.m_CameraAverageSpeed < 0.35f )
- vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(0, int32(SCREEN_HEIGHT));
- else
- vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(150, int32(SCREEN_HEIGHT) - 200);
- }
-
- vecWaterdropPos.z = 2.0f;
-
- if ( AddParticle(PARTICLE_WATERDROP,
- vecWaterdropPos,
- vecWaterdropTarget,
- nil,
- CGeneral::GetRandomNumberInRange(0.1f, 0.15f),
- 0,
- 0,
- CGeneral::GetRandomNumber() & 1,
- 0) != nil )
- {
- numWaterDropOnScreen++;
- }
- }
}
if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed || particle->m_nAlpha == 0 )
@@ -1432,10 +1436,7 @@ void CParticle::Update()
}
else
size = particle->m_fSize + particle->m_fExpansionRate;
-
- if ( psystem->m_Type == PARTICLE_WATERDROP )
- size = (size - Abs(vecMoveStep.x) * 0.000150000007f) + (Abs(vecMoveStep.z) * 0.0500000007f); //TODO:
-
+
if ( size < 0.0f )
{
bRemoveParticle = true;
@@ -1716,28 +1717,6 @@ void CParticle::Update()
continue;
}
}
-
- if ( psystem->m_nZRotationAngleChangeAmount != 0 )
- {
- if ( particle->m_nZRotationTimer >= psystem->m_nZRotationChangeTime )
- {
- particle->m_nZRotationTimer = 0;
- particle->m_nCurrentZRotation += psystem->m_nZRotationAngleChangeAmount;
- }
- else
- ++particle->m_nZRotationTimer;
- }
-
- if ( psystem->m_fZRadiusChangeAmount != 0.0f )
- {
- if ( particle->m_nZRadiusTimer >= psystem->m_nZRadiusChangeTime )
- {
- particle->m_nZRadiusTimer = 0;
- particle->m_fCurrentZRadius += psystem->m_fZRadiusChangeAmount;
- }
- else
- ++particle->m_nZRadiusTimer;
- }
if ( psystem->m_nAnimationSpeed != 0 )
{
@@ -1764,21 +1743,6 @@ void CParticle::Update()
particle->m_nRotation += particle->m_nRotationStep;
#endif
- if ( particle->m_fCurrentZRadius != 0.0f )
- {
- int32 nSinCosIndex = particle->m_nCurrentZRotation % SIN_COS_TABLE_SIZE;
-
- float fX = (Cos(nSinCosIndex) - Sin(nSinCosIndex)) * particle->m_fCurrentZRadius;
-
- float fY = (Sin(nSinCosIndex) + Cos(nSinCosIndex)) * particle->m_fCurrentZRadius;
-
- vecPos -= particle->m_vecParticleMovementOffset;
-
- vecPos += CVector(fX, fY, 0.0f);
-
- particle->m_vecParticleMovementOffset = CVector(fX, fY, 0.0f);
- }
-
particle->m_vecPosition = vecPos;
}
}
@@ -1809,6 +1773,8 @@ void CParticle::Render()
RwRaster **frames = psystem->m_ppRaster;
tParticleType type = psystem->m_Type;
+ /*
+ something on ps2
if ( type == PARTICLE_ENGINE_SMOKE
|| type == PARTICLE_ENGINE_SMOKE2
|| type == PARTICLE_ENGINE_STEAM
@@ -1820,7 +1786,7 @@ void CParticle::Render()
{
particleBanned = true;
}
-
+ */
if ( particle )
{
if ( (flags & DRAW_OPAQUE) != (psystem->Flags & DRAW_OPAQUE)
@@ -1865,6 +1831,8 @@ void CParticle::Render()
if ( particle->m_nAlpha == 0 )
canDraw = false;
+ // TODO: psp vert buffer check
+
if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil )
{
RwRaster *curFrame = frames[particle->m_nCurrentFrame];
@@ -1878,11 +1846,7 @@ void CParticle::Render()
if ( canDraw && psystem->Flags & DRAWTOP2D )
{
- float screenZ = (particle->m_vecPosition.z - CDraw::GetNearClipZ())
- * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ())
- * CDraw::GetFarClipZ()
- / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * particle->m_vecPosition.z )
- + CSprite::GetNearScreenZ();
+ float screenZ = CalcScreenZ(particle->m_vecPosition.z);
float stretchTexW;
float stretchTexH;
@@ -1897,108 +1861,6 @@ void CParticle::Render()
stretchTexW = CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.x + 63.0f;
stretchTexH = CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.y + 63.0f;
}
-
-
- if ( i == PARTICLE_WATERDROP )
- {
- int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed;
-
- stretchTexH += (1.0f - (float)timeLeft ) * psystem->m_vecTextureStretch.y;
-
- RwRect rect;
-
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
-
- FxType fxtype;
-
- if ( particle->m_nCurrentFrame != 0 )
- fxtype = FXTYPE_WATER2;
- else
- fxtype = FXTYPE_WATER1;
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, fxtype);
-
- canDraw = false;
- }
-
- if ( i == PARTICLE_BLOODDROP )
- {
- int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed;
-
- stretchTexH += (1.0f + (float)timeLeft) * psystem->m_vecTextureStretch.y;
- stretchTexW += (1.0f - (float)timeLeft) * psystem->m_vecTextureStretch.x;
-
- RwRect rect;
-
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
-
- FxType fxtype;
-
- if ( particle->m_nCurrentFrame )
- fxtype = FXTYPE_BLOOD2;
- else
- fxtype = FXTYPE_BLOOD1;
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, fxtype);
-
- canDraw = false;
- }
-
- if ( i == PARTICLE_HEATHAZE_IN_DIST )
- {
- RwRect rect;
-
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH * 0.15f));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH * 0.15f));
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_HEATHAZE);
-
- canDraw = false;
- }
-
- if ( i == PARTICLE_HEATHAZE )
- {
- RwRect rect;
-
- switch ( TheCamera.GetLookDirection() )
- {
- case LOOKING_LEFT:
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x * 2.0f));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
- rect.w = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
-
- break;
-
- case LOOKING_RIGHT:
- rect.x = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x * 4.0f));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
-
- break;
-
- default:
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
-
- break;
- }
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_HEATHAZE);
-
- canDraw = false;
- }
if ( canDraw )
{
@@ -2064,6 +1926,8 @@ void CParticle::Render()
}
else if ( i == PARTICLE_WATER_HYDRANT )
{
+ float screenZ = CalcScreenZ(particle->m_vecPosition.z);
+
int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed;
w += (1.0f - (float)timeLeft) * psystem->m_vecTextureStretch.x;
@@ -2083,190 +1947,149 @@ void CParticle::Render()
h += CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.y;
}
- if ( i == PARTICLE_WATER_HYDRANT
- || (!particleBanned || SCREEN_WIDTH * fParticleScaleLimit >= w)
- && SCREEN_HEIGHT * fParticleScaleLimit >= h )
+ if ( particle->m_nRotation != 0 && i != PARTICLE_BEASTIE )
+ {
+ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
+ particle->m_fSize * w, particle->m_fSize * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ DEGTORAD((float)particle->m_nRotation),
+ particle->m_nAlpha);
+ }
+ else if ( psystem->Flags & SCREEN_TRAIL )
{
- if ( i == PARTICLE_WATER_HYDRANT )
+ float fRotation;
+ float fTrailLength;
+
+ if ( particle->m_fZGround == 0.0f )
{
- RwRect rect;
-
- if ( w > 0.0f )
- {
- rect.x = int32(coors.x - SCREEN_STRETCH_X(particle->m_fSize * w));
- rect.w = int32(coors.x + SCREEN_STRETCH_X(particle->m_fSize * w));
- }
- else
- {
- rect.w = int32(coors.x - SCREEN_STRETCH_X(particle->m_fSize * w));
- rect.x = int32(coors.x + SCREEN_STRETCH_X(particle->m_fSize * w));
- }
-
- if ( h > 0.0f )
- {
- rect.y = int32(coors.y - SCREEN_STRETCH_Y(particle->m_fSize * h));
- rect.h = int32(coors.y + SCREEN_STRETCH_Y(particle->m_fSize * h));
- }
- else
- {
- rect.h = int32(coors.y - SCREEN_STRETCH_Y(particle->m_fSize * h));
- rect.y = int32(coors.y + SCREEN_STRETCH_Y(particle->m_fSize * h));
- }
-
- float screenZ = (coors.z - CDraw::GetNearClipZ())
- * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ()) * CDraw::GetFarClipZ()
- / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * coors.z ) + CSprite::GetNearScreenZ();
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_SPLASH1);
+ fTrailLength = 0.0f;
+ fRotation = 0.0f;
}
else
{
- if ( particle->m_nRotation != 0 && i != PARTICLE_BEASTIE )
- {
- CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
- particle->m_fSize * w, particle->m_fSize * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- DEGTORAD((float)particle->m_nRotation),
- particle->m_nAlpha);
- }
- else if ( psystem->Flags & SCREEN_TRAIL )
- {
- float fRotation;
- float fTrailLength;
-
- if ( particle->m_fZGround == 0.0f )
- {
- fTrailLength = 0.0f;
- fRotation = 0.0f;
- }
- else
- {
- CVector2D vecDist
- (
- coors.x - particle->m_fZGround,
- coors.y - particle->m_fExpansionRate
- );
+ CVector2D vecDist
+ (
+ coors.x - particle->m_fZGround,
+ coors.y - particle->m_fExpansionRate
+ );
- float fDist = vecDist.Magnitude();
+ float fDist = vecDist.Magnitude();
- fTrailLength = fDist;
-
- float fRot = Asin(vecDist.x / fDist);
+ fTrailLength = fDist;
+
+ float fRot = Asin(vecDist.x / fDist);
- fRotation = fRot;
+ fRotation = fRot;
- if ( vecDist.y < 0.0f )
- fRotation = -1.0f * fRot + DEGTORAD(180.0f);
-
- float fSpeed = particle->m_vecVelocity.Magnitude();
-
- float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
-
- if ( fDist > fNewTrailLength )
- fTrailLength = fNewTrailLength;
- }
-
- CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- fRotation,
- particle->m_nAlpha);
+ if ( vecDist.y < 0.0f )
+ fRotation = -1.0f * fRot + DEGTORAD(180.0f);
+
+ float fSpeed = particle->m_vecVelocity.Magnitude();
+
+ float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
+
+ if ( fDist > fNewTrailLength )
+ fTrailLength = fNewTrailLength;
+ }
+
+ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ fRotation,
+ particle->m_nAlpha);
- particle->m_fZGround = coors.x; // WTF ?
- particle->m_fExpansionRate = coors.y; // WTF ?
- }
- else if ( psystem->Flags & SPEED_TRAIL )
- {
- CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity;
- float fRotation;
- float fTrailLength;
- CVector vecScreenPosition;
-
- if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) )
- {
- CVector2D vecDist
- (
- coors.x - vecScreenPosition.x,
- coors.y - vecScreenPosition.y
- );
-
- float fDist = vecDist.Magnitude();
-
- fTrailLength = fDist;
-
- float fRot = Asin(vecDist.x / fDist);
-
- fRotation = fRot;
-
- if ( vecDist.y < 0.0f )
- fRotation = -1.0f * fRot + DEGTORAD(180.0f);
- }
- else
- {
- fRotation = 0.0f;
- fTrailLength = 0.0f;
- }
-
- CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- fRotation,
- particle->m_nAlpha);
- }
- else if ( psystem->Flags & VERT_TRAIL )
- {
- float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f);
-
- CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- (particle->m_fSize + fTrailLength * psystem->m_fTrailLengthMultiplier) * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- particle->m_nAlpha);
- }
- else if ( i == PARTICLE_RAINDROP_SMALL )
- {
- CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
- particle->m_fSize * w * 0.05f,
- particle->m_fSize * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- particle->m_nAlpha);
- }
- /*else if ( i == PARTICLE_BOAT_WAKE )*/
- else
- {
- CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- particle->m_fSize * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- particle->m_nAlpha);
- }
+ particle->m_fZGround = coors.x; // WTF ?
+ particle->m_fExpansionRate = coors.y; // WTF ?
+ }
+ else if ( psystem->Flags & SPEED_TRAIL )
+ {
+ CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity;
+ float fRotation;
+ float fTrailLength;
+ CVector vecScreenPosition;
+
+ if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) )
+ {
+ CVector2D vecDist
+ (
+ coors.x - vecScreenPosition.x,
+ coors.y - vecScreenPosition.y
+ );
+
+ float fDist = vecDist.Magnitude();
+
+ fTrailLength = fDist;
+
+ float fRot = Asin(vecDist.x / fDist);
+
+ fRotation = fRot;
+
+ if ( vecDist.y < 0.0f )
+ fRotation = -1.0f * fRot + DEGTORAD(180.0f);
+ }
+ else
+ {
+ fRotation = 0.0f;
+ fTrailLength = 0.0f;
}
+
+ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ fRotation,
+ particle->m_nAlpha);
+ }
+ else if ( psystem->Flags & VERT_TRAIL )
+ {
+ float fTrailLength = Abs(particle->m_vecVelocity.z * 10.0f);
+
+ CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ (particle->m_fSize + fTrailLength * psystem->m_fTrailLengthMultiplier) * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ particle->m_nAlpha);
+ }
+ else if ( i == PARTICLE_RAINDROP_SMALL )
+ {
+ CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
+ particle->m_fSize * w * 0.05f,
+ particle->m_fSize * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ particle->m_nAlpha);
+ }
+ else
+ {
+ CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ particle->m_fSize * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ particle->m_nAlpha);
}
}
}
@@ -2295,9 +2118,6 @@ void CParticle::RemovePSystem(tParticleType type)
void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData)
{
- if ( pPSystemData->m_Type == PARTICLE_WATERDROP )
- --numWaterDropOnScreen;
-
if ( pPrevParticle )
pPrevParticle->m_pNext = pParticle->m_pNext;
else
@@ -2397,18 +2217,7 @@ void CParticle::CalWindDir(CVector *vecDirIn, CVector *vecDirOut)
void CParticle::HandleShipsAtHorizonStuff()
{
- tParticleSystemData *psystemdata = &mod_ParticleSystemManager.m_aParticles[PARTICLE_SHIP_SIDE];
-
- for ( CParticle *particle = psystemdata->m_pParticles; particle; particle = particle->m_pNext )
- {
- if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed - 32000
- && CTimer::GetTimeInMilliseconds() < particle->m_nTimeWhenWillBeDestroyed - 22000 )
- {
- particle->m_nAlpha = Min(particle->m_nAlpha + 1, 96);
- }
- if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed - 10000 )
- particle->m_nFadeAlphaTimer = 1;
- }
+ ;
}
void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
@@ -2448,7 +2257,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
bRemoveParticle = true;
for ( int32 i = 0; i < 8; i++ )
- {
+ {
CParticle *pBirdDerbis = AddParticle(PARTICLE_BIRD_DEBRIS,
particle->m_vecPosition,
CVector
@@ -2474,7 +2283,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
}
void
-CEntity::AddSteamsFromGround(CVector *unused)
+CEntity::AddSteamsFromGround(CVector *unused) //todo
{
int i, n;
C2dEffect *effect;
diff --git a/src/render/Particle.h b/src/render/Particle.h
index 5542dc02..edfd9b77 100644
--- a/src/render/Particle.h
+++ b/src/render/Particle.h
@@ -18,11 +18,6 @@ public:
uint32 m_nTimeWhenWillBeDestroyed;
uint32 m_nTimeWhenColorWillBeChanged;
float m_fZGround;
- CVector m_vecParticleMovementOffset;
- int16 m_nCurrentZRotation;
- uint16 m_nZRotationTimer;
- float m_fCurrentZRadius;
- uint16 m_nZRadiusTimer;
uint8 m_nColorIntensity;
uint8 m_nAlpha;
float m_fSize;
@@ -35,12 +30,20 @@ public:
uint8 m_nCurrentFrame;
RwRGBA m_Color;
CParticle *m_pNext;
+
+ //CVector m_vecParticleMovementOffset;
+ //int16 m_nCurrentZRotation;
+ //uint16 m_nZRotationTimer;
+ //float m_fCurrentZRadius;
+ //uint16 m_nZRadiusTimer;
+ int32 field_4C;
+
CParticle()
{
;
}
-
+
~CParticle()
{
;
@@ -97,12 +100,9 @@ public:
static void HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos);
};
-extern bool clearWaterDrop;
-extern int32 numWaterDropOnScreen;
extern RwRaster *gpCarSplashRaster[];
extern RwRaster *gpHeatHazeRaster;
-extern RwRaster *gpDotRaster;
extern RwRaster *gpRainDripRaster[];
extern RwRaster *gpRainDripDarkRaster[];
-VALIDATE_SIZE(CParticle, 0x58);
+VALIDATE_SIZE(CParticle, 0x50);
diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp
index f6919435..263c4ae1 100644
--- a/src/render/ParticleMgr.cpp
+++ b/src/render/ParticleMgr.cpp
@@ -4,18 +4,30 @@
#include "FileMgr.h"
#include "ParticleMgr.h"
+// --LCS: File done
+
cParticleSystemMgr mod_ParticleSystemManager;
const char *ParticleFilename = "PARTICLE.CFG";
cParticleSystemMgr::cParticleSystemMgr()
{
- memset(this, 0, sizeof(*this));
+#ifdef FIX_BUGS
+ m_aParticles = nil;
+#endif
+}
+
+cParticleSystemMgr::~cParticleSystemMgr()
+{
+#ifdef FIX_BUGS
+ delete [] m_aParticles;
+#endif
}
void cParticleSystemMgr::Initialise()
{
- LoadParticleData();
+ if ( gMakeResources )
+ LoadParticleData();
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
m_aParticles[i].m_pParticles = nil;
@@ -23,20 +35,30 @@ void cParticleSystemMgr::Initialise()
void cParticleSystemMgr::LoadParticleData()
{
- CFileMgr::SetDir("DATA");
- CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r");
+#ifdef FIX_BUGS
+ delete [] m_aParticles;
+#endif
+ m_aParticles = new tParticleSystemData[MAX_PARTICLES];
+
+ memset(m_aParticles, 0, sizeof(tParticleSystemData)*MAX_PARTICLES);
+
+ CFileMgr::SetDir("Data");
+ ssize_t len = CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r");
CFileMgr::SetDir("");
+ ASSERT(!(len <= 0));
+
tParticleSystemData *entry = nil;
int32 type = PARTICLE_FIRST;
+ char *buffEnd = (char *)&work_buff[len];
char *lineStart = (char *)work_buff;
char *lineEnd = lineStart + 1;
char line[500];
char delims[4];
- while ( true )
+ while ( lineStart < buffEnd )
{
ASSERT(lineStart != nil);
ASSERT(lineEnd != nil);
diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h
index f4afc018..16da2c5f 100644
--- a/src/render/ParticleMgr.h
+++ b/src/render/ParticleMgr.h
@@ -124,15 +124,18 @@ class cParticleSystemMgr
};
public:
- tParticleSystemData m_aParticles[MAX_PARTICLES];
+ tParticleSystemData *m_aParticles;//[MAX_PARTICLES];
cParticleSystemMgr();
+#ifdef FIX_BUGS
+ ~cParticleSystemMgr();
+#endif
void Initialise();
void LoadParticleData();
void RangeCheck(tParticleSystemData *pData) { }
};
-VALIDATE_SIZE(cParticleSystemMgr, 0x2FFC);
+VALIDATE_SIZE(cParticleSystemMgr, 0x4);
extern cParticleSystemMgr mod_ParticleSystemManager;
diff --git a/src/render/ParticleType.h b/src/render/ParticleType.h
index 9578083d..cb3d53f0 100644
--- a/src/render/ParticleType.h
+++ b/src/render/ParticleType.h
@@ -42,8 +42,6 @@ enum tParticleType
PARTICLE_RAIN_SPLASH_BIGGROW,
PARTICLE_RAIN_SPLASHUP,
PARTICLE_WATERSPRAY,
- PARTICLE_WATERDROP,
- PARTICLE_BLOODDROP,
PARTICLE_EXPLOSION_MEDIUM,
PARTICLE_EXPLOSION_LARGE,
PARTICLE_EXPLOSION_MFAST,
@@ -83,10 +81,11 @@ enum tParticleType
PARTICLE_SHIP_SIDE,
PARTICLE_BEASTIE,
PARTICLE_RAINDROP_2D,
- PARTICLE_HEATHAZE,
- PARTICLE_HEATHAZE_IN_DIST,
+ PARTICLE_FERRY_CHIM_SMOKE,
+ PARTICLE_MULTIPLAYER_HIT,
+ PARTICLE_HYDRANT_STEAM,
MAX_PARTICLES,
PARTICLE_FIRST = PARTICLE_SPARK,
- PARTICLE_LAST = PARTICLE_HEATHAZE_IN_DIST
+ PARTICLE_LAST = PARTICLE_HYDRANT_STEAM
}; \ No newline at end of file
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 91a34592..5c65eea5 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -2,6 +2,7 @@
#include "common.h"
#include "main.h"
+#include "General.h"
#include "Lights.h"
#include "ModelInfo.h"
#include "Treadable.h"
@@ -20,6 +21,7 @@
#include "ModelIndices.h"
#include "Streaming.h"
#include "Shadows.h"
+#include "Coronas.h"
#include "PointLights.h"
#include "Occlusion.h"
#include "Renderer.h"
@@ -40,6 +42,8 @@ bool gbDontRenderPeds;
bool gbDontRenderObjects;
bool gbDontRenderVehicles;
+bool gbRenderDebugEnvMap;
+
// unused
int16 TestCloseThings;
int16 TestBigThings;
@@ -1642,3 +1646,186 @@ CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset)
SetAmbientColours();
DeActivateDirectional();
}
+
+
+#include "postfx.h"
+
+static RwIm2DVertex Screen2EnvQuad[4];
+static RwImVertexIndex EnvQuadIndices[6] = { 0, 1, 2, 0, 2, 3 };
+
+static void
+SetQuadVertices(RwRaster *env, RwRaster *screen, float z)
+{
+ uint32 width = RwRasterGetWidth(env);
+ uint32 height = RwRasterGetHeight(env);
+
+ float zero, xmax, ymax;
+
+ zero = -HALFPX;
+ xmax = width - HALFPX;
+ ymax = height - HALFPX;
+
+ float recipz = 1.0f/z;
+ float umax = (float)SCREEN_WIDTH/RwRasterGetWidth(screen);
+ float vmax = (float)SCREEN_HEIGHT/RwRasterGetHeight(screen);
+
+ RwIm2DVertexSetScreenX(&Screen2EnvQuad[0], zero);
+ RwIm2DVertexSetScreenY(&Screen2EnvQuad[0], zero);
+ RwIm2DVertexSetScreenZ(&Screen2EnvQuad[0], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Screen2EnvQuad[0], z);
+ RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[0], recipz);
+ RwIm2DVertexSetU(&Screen2EnvQuad[0], 0.0f, recipz);
+ RwIm2DVertexSetV(&Screen2EnvQuad[0], 0.0f, recipz);
+ RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[0], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&Screen2EnvQuad[1], zero);
+ RwIm2DVertexSetScreenY(&Screen2EnvQuad[1], ymax);
+ RwIm2DVertexSetScreenZ(&Screen2EnvQuad[1], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Screen2EnvQuad[1], z);
+ RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[1], recipz);
+ RwIm2DVertexSetU(&Screen2EnvQuad[1], 0.0f, recipz);
+ RwIm2DVertexSetV(&Screen2EnvQuad[1], vmax, recipz);
+ RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[1], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&Screen2EnvQuad[2], xmax);
+ RwIm2DVertexSetScreenY(&Screen2EnvQuad[2], ymax);
+ RwIm2DVertexSetScreenZ(&Screen2EnvQuad[2], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Screen2EnvQuad[2], z);
+ RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[2], recipz);
+ RwIm2DVertexSetU(&Screen2EnvQuad[2], umax, recipz);
+ RwIm2DVertexSetV(&Screen2EnvQuad[2], vmax, recipz);
+ RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[2], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&Screen2EnvQuad[3], xmax);
+ RwIm2DVertexSetScreenY(&Screen2EnvQuad[3], zero);
+ RwIm2DVertexSetScreenZ(&Screen2EnvQuad[3], RwIm2DGetNearScreenZ());
+ RwIm2DVertexSetCameraZ(&Screen2EnvQuad[3], z);
+ RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[3], recipz);
+ RwIm2DVertexSetU(&Screen2EnvQuad[3], umax, recipz);
+ RwIm2DVertexSetV(&Screen2EnvQuad[3], 0.0f, recipz);
+ RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[3], 255, 255, 255, 255);
+}
+
+static RwIm2DVertex coronaVerts[4*4];
+static RwImVertexIndex coronaIndices[6*4];
+static int numCoronaVerts, numCoronaIndices;
+
+static void
+AddCorona(float x, float y, float sz)
+{
+ float nearz, recipz;
+ RwIm2DVertex *v;
+ nearz = RwIm2DGetNearScreenZ();
+ float z = RwCameraGetNearClipPlane(RwCameraGetCurrentCamera());
+ recipz = 1.0f/z;
+
+ v = &coronaVerts[numCoronaVerts];
+ RwIm2DVertexSetScreenX(&v[0], x);
+ RwIm2DVertexSetScreenY(&v[0], y);
+ RwIm2DVertexSetScreenZ(&v[0], z);
+ RwIm2DVertexSetScreenZ(&v[0], nearz);
+ RwIm2DVertexSetRecipCameraZ(&v[0], recipz);
+ RwIm2DVertexSetU(&v[0], 0.0f, recipz);
+ RwIm2DVertexSetV(&v[0], 0.0f, recipz);
+ RwIm2DVertexSetIntRGBA(&v[0], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&v[1], x);
+ RwIm2DVertexSetScreenY(&v[1], y + sz);
+ RwIm2DVertexSetScreenZ(&v[1], z);
+ RwIm2DVertexSetScreenZ(&v[1], nearz);
+ RwIm2DVertexSetRecipCameraZ(&v[1], recipz);
+ RwIm2DVertexSetU(&v[1], 0.0f, recipz);
+ RwIm2DVertexSetV(&v[1], 1.0f, recipz);
+ RwIm2DVertexSetIntRGBA(&v[1], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&v[2], x + sz);
+ RwIm2DVertexSetScreenY(&v[2], y + sz);
+ RwIm2DVertexSetScreenZ(&v[2], z);
+ RwIm2DVertexSetScreenZ(&v[2], nearz);
+ RwIm2DVertexSetRecipCameraZ(&v[2], recipz);
+ RwIm2DVertexSetU(&v[2], 1.0f, recipz);
+ RwIm2DVertexSetV(&v[2], 1.0f, recipz);
+ RwIm2DVertexSetIntRGBA(&v[2], 255, 255, 255, 255);
+
+ RwIm2DVertexSetScreenX(&v[3], x + sz);
+ RwIm2DVertexSetScreenY(&v[3], y);
+ RwIm2DVertexSetScreenZ(&v[3], z);
+ RwIm2DVertexSetScreenZ(&v[3], nearz);
+ RwIm2DVertexSetRecipCameraZ(&v[3], recipz);
+ RwIm2DVertexSetU(&v[3], 1.0f, recipz);
+ RwIm2DVertexSetV(&v[3], 0.0f, recipz);
+ RwIm2DVertexSetIntRGBA(&v[3], 255, 255, 255, 255);
+
+
+ coronaIndices[numCoronaIndices++] = numCoronaVerts;
+ coronaIndices[numCoronaIndices++] = numCoronaVerts + 1;
+ coronaIndices[numCoronaIndices++] = numCoronaVerts + 2;
+ coronaIndices[numCoronaIndices++] = numCoronaVerts;
+ coronaIndices[numCoronaIndices++] = numCoronaVerts + 2;
+ coronaIndices[numCoronaIndices++] = numCoronaVerts + 3;
+ numCoronaVerts += 4;
+}
+#include "Debug.h"
+
+static void
+DrawEnvMapCoronas(float heading)
+{
+ RwRaster *rt = RwTextureGetRaster(CustomPipes::EnvMapTex);
+ const float BIG = 89.0f * RwRasterGetWidth(rt)/128.0f;
+ const float SMALL = 38.0f * RwRasterGetHeight(rt)/128.0f;
+
+ float x;
+ numCoronaVerts = 0;
+ numCoronaIndices = 0;
+ x = (heading - PI)/TWOPI;// - 1.0f;
+ x *= BIG+SMALL;
+ AddCorona(x, 0.0f, BIG); x += BIG;
+ AddCorona(x, 12.0f, SMALL); x += SMALL;
+ AddCorona(x, 0.0f, BIG); x += BIG;
+ AddCorona(x, 12.0f, SMALL); x += SMALL;
+
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[CCoronas::TYPE_STAR]));
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, coronaVerts, numCoronaVerts, coronaIndices, numCoronaIndices);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
+}
+
+void
+CRenderer::GenerateEnvironmentMap(void)
+{
+ // We'll probably do this differently eventually
+ // re-using all sorts of stuff here...
+
+ CPostFX::GetBackBuffer(Scene.camera);
+
+ RwCameraBeginUpdate(CustomPipes::EnvMapCam);
+
+ // get current scene
+ SetQuadVertices(RwTextureGetRaster(CustomPipes::EnvMapTex), CPostFX::pBackBuffer, RwCameraGetNearClipPlane(RwCameraGetCurrentCamera()));
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, CPostFX::pBackBuffer);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Screen2EnvQuad, 4, EnvQuadIndices, 6);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+
+ // Draw coronas
+ if(CustomPipes::VehiclePipeSwitch != CustomPipes::VEHICLEPIPE_MOBILE)
+ DrawEnvMapCoronas(TheCamera.GetForward().Heading());
+
+ RwCameraEndUpdate(CustomPipes::EnvMapCam);
+
+
+ RwCameraBeginUpdate(Scene.camera);
+
+ if(gbRenderDebugEnvMap){
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(CustomPipes::EnvMapTex));
+ RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, CustomPipes::EnvScreenQuad, 4, (RwImVertexIndex*)CustomPipes::QuadIndices, 6);
+ }
+}
diff --git a/src/render/Renderer.h b/src/render/Renderer.h
index 9b202098..a4b6b0b8 100644
--- a/src/render/Renderer.h
+++ b/src/render/Renderer.h
@@ -102,4 +102,6 @@ public:
static void RenderTransparentWater(void); // keep-out polys and transparent water
#endif
static void InsertEntityIntoList(CEntity *ent);
+
+ static void GenerateEnvironmentMap(void);
};
diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp
index 2b1df555..ba902bae 100644
--- a/src/render/Shadows.cpp
+++ b/src/render/Shadows.cpp
@@ -76,14 +76,14 @@ CShadows::Init(void)
gpShadowBikeTex = RwTextureRead("shad_bike", nil);
gpShadowBaronTex = RwTextureRead("shad_rcbaron", nil);
gpShadowExplosionTex = RwTextureRead("shad_exp", nil);
- gpShadowHeadLightsTex = RwTextureRead("headlight", nil);
+ gpShadowHeadLightsTex = RwTextureRead("headlight_single", nil);
gpOutline1Tex = RwTextureRead("outline_64", nil);
gpOutline2Tex = RwTextureRead("outline2_64", nil);
gpOutline3Tex = RwTextureRead("outline3_64", nil);
gpBloodPoolTex = RwTextureRead("bloodpool_64", nil);
- gpReflectionTex = RwTextureRead("reflection01", nil);
+ //gpReflectionTex = RwTextureRead("reflection01", nil);
gpWalkDontTex = RwTextureRead("walk_dont", nil);
- gpCrackedGlassTex = RwTextureRead("wincrack_32", nil);
+ //gpCrackedGlassTex = RwTextureRead("wincrack_32", nil);
gpPostShadowTex = RwTextureRead("lamp_shad_64", nil);
CTxdStore::PopCurrentTxd();
@@ -99,9 +99,9 @@ CShadows::Init(void)
ASSERT(gpOutline2Tex != nil);
ASSERT(gpOutline3Tex != nil);
ASSERT(gpBloodPoolTex != nil);
- ASSERT(gpReflectionTex != nil);
+ //ASSERT(gpReflectionTex != nil);
ASSERT(gpWalkDontTex != nil);
- ASSERT(gpCrackedGlassTex != nil);
+ //ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpPostShadowTex != nil);
@@ -178,9 +178,9 @@ CShadows::Shutdown(void)
ASSERT(gpOutline2Tex != nil);
ASSERT(gpOutline3Tex != nil);
ASSERT(gpBloodPoolTex != nil);
- ASSERT(gpReflectionTex != nil);
+ //ASSERT(gpReflectionTex != nil);
ASSERT(gpWalkDontTex != nil);
- ASSERT(gpCrackedGlassTex != nil);
+ //ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpPostShadowTex != nil);
RwTextureDestroy(gpShadowCarTex);
@@ -194,9 +194,9 @@ CShadows::Shutdown(void)
RwTextureDestroy(gpOutline2Tex);
RwTextureDestroy(gpOutline3Tex);
RwTextureDestroy(gpBloodPoolTex);
- RwTextureDestroy(gpReflectionTex);
+ //RwTextureDestroy(gpReflectionTex);
RwTextureDestroy(gpWalkDontTex);
- RwTextureDestroy(gpCrackedGlassTex);
+ //RwTextureDestroy(gpCrackedGlassTex);
RwTextureDestroy(gpPostShadowTex);
}
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index ba6ab291..0e4d4fcd 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -10,6 +10,19 @@ float CSprite::m_f2DFarScreenZ;
float CSprite::m_fRecipNearClipPlane;
int32 CSprite::m_bFlushSpriteBufferSwitchZTest;
+float CalcScreenZ(float z)
+{
+ // LCS TODO: check
+
+ if ( z == 0.0f )
+ return CSprite::GetNearScreenZ();
+
+ return (z - CDraw::GetNearClipZ())
+ * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ()) * CDraw::GetFarClipZ()
+ / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * z )
+ + CSprite::GetNearScreenZ();
+}
+
float
CSprite::CalcHorizonCoors(void)
{
diff --git a/src/render/Sprite.h b/src/render/Sprite.h
index fae6684e..952837a0 100644
--- a/src/render/Sprite.h
+++ b/src/render/Sprite.h
@@ -29,3 +29,5 @@ public:
static void RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w, float h, const RwRGBA &colour, int16 intens, float rotation, uint8 alpha);
};
+
+extern float CalcScreenZ(float z); \ No newline at end of file
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index 70926c1a..3cb5a0b0 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -136,6 +136,61 @@ float CTimeCycle::m_fShadowSideY[16];
float CTimeCycle::m_fShadowDisplacementX[16];
float CTimeCycle::m_fShadowDisplacementY[16];
+
+
+static float tmp_nAmbientRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS];
+static float tmp_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS];
+static float tmp_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_fSunSize[NUMHOURS][NUMWEATHERS];
+static float tmp_fSpriteSize[NUMHOURS][NUMWEATHERS];
+static float tmp_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
+static float tmp_nShadowStrength[NUMHOURS][NUMWEATHERS];
+static float tmp_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+static float tmp_nPoleShadowStrength[NUMHOURS][NUMWEATHERS];
+static float tmp_fFogStart[NUMHOURS][NUMWEATHERS];
+static float tmp_fFarClip[NUMHOURS][NUMWEATHERS];
+static float tmp_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
+static float tmp_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+static float tmp_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_fBlurRed[NUMHOURS][NUMWEATHERS];
+static float tmp_fBlurGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_fBlurBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_fWaterRed[NUMHOURS][NUMWEATHERS];
+static float tmp_fWaterGreen[NUMHOURS][NUMWEATHERS];
+static float tmp_fWaterBlue[NUMHOURS][NUMWEATHERS];
+static float tmp_fWaterAlpha[NUMHOURS][NUMWEATHERS];
+
void
CTimeCycle::Initialise(void)
{
@@ -173,7 +228,7 @@ CTimeCycle::Initialise(void)
for(h = 0; h < NUMHOURS; h++){
li = 0;
while(work_buff[bi] == '/' || work_buff[bi] == '\n' ||
- work_buff[bi] == '\0' || work_buff[bi] == ' ' || work_buff[bi] == '\r'){
+ work_buff[bi] == '\0' || work_buff[bi] == '\r'){
while(work_buff[bi] != '\n' && work_buff[bi] != '\0' && work_buff[bi] != '\r')
bi++;
bi++;
@@ -209,65 +264,180 @@ CTimeCycle::Initialise(void)
&blurR, &blurG, &blurB,
&waterR, &waterG, &waterB, &waterA);
- m_nAmbientRed[h][w] = ambR;
- m_nAmbientGreen[h][w] = ambG;
- m_nAmbientBlue[h][w] = ambB;
- m_nAmbientRed_Obj[h][w] = ambobjR;
- m_nAmbientGreen_Obj[h][w] = ambobjG;
- m_nAmbientBlue_Obj[h][w] = ambobjB;
- m_nAmbientRed_Bl[h][w] = ambblR;
- m_nAmbientGreen_Bl[h][w] = ambblG;
- m_nAmbientBlue_Bl[h][w] = ambblB;
- m_nAmbientRed_Obj_Bl[h][w] = ambobjblR;
- m_nAmbientGreen_Obj_Bl[h][w] = ambobjblG;
- m_nAmbientBlue_Obj_Bl[h][w] = ambobjblB;
- m_nDirectionalRed[h][w] = dirR;
- m_nDirectionalGreen[h][w] = dirG;
- m_nDirectionalBlue[h][w] = dirB;
- m_nSkyTopRed[h][w] = skyTopR;
- m_nSkyTopGreen[h][w] = skyTopG;
- m_nSkyTopBlue[h][w] = skyTopB;
- m_nSkyBottomRed[h][w] = skyBotR;
- m_nSkyBottomGreen[h][w] = skyBotG;
- m_nSkyBottomBlue[h][w] = skyBotB;
- m_nSunCoreRed[h][w] = sunCoreR;
- m_nSunCoreGreen[h][w] = sunCoreG;
- m_nSunCoreBlue[h][w] = sunCoreB;
- m_nSunCoronaRed[h][w] = sunCoronaR;
- m_nSunCoronaGreen[h][w] = sunCoronaG;
- m_nSunCoronaBlue[h][w] = sunCoronaB;
- m_fSunSize[h][w] = sunSz * 10.0f;
- m_fSpriteSize[h][w] = sprSz * 10.0f;
- m_fSpriteBrightness[h][w] = sprBght * 10.0f;
- m_nShadowStrength[h][w] = shad;
- m_nLightShadowStrength[h][w] = lightShad;
- m_nPoleShadowStrength[h][w] = poleShad;
- m_fFarClip[h][w] = farClp;
- m_fFogStart[h][w] = fogSt;
- m_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f;
- m_nLowCloudsRed[h][w] = cloudR;
- m_nLowCloudsGreen[h][w] = cloudG;
- m_nLowCloudsBlue[h][w] = cloudB;
- m_nFluffyCloudsTopRed[h][w] = fluffyTopR;
- m_nFluffyCloudsTopGreen[h][w] = fluffyTopG;
- m_nFluffyCloudsTopBlue[h][w] = fluffyTopB;
- m_nFluffyCloudsBottomRed[h][w] = fluffyBotR;
- m_nFluffyCloudsBottomGreen[h][w] = fluffyBotG;
- m_nFluffyCloudsBottomBlue[h][w] = fluffyBotB;
- m_fBlurRed[h][w] = blurR;
- m_fBlurGreen[h][w] = blurG;
- m_fBlurBlue[h][w] = blurB;
- m_fWaterRed[h][w] = waterR;
- m_fWaterGreen[h][w] = waterG;
- m_fWaterBlue[h][w] = waterB;
- m_fWaterAlpha[h][w] = waterA;
+ tmp_nAmbientRed[h][w] = ambR;
+ tmp_nAmbientGreen[h][w] = ambG;
+ tmp_nAmbientBlue[h][w] = ambB;
+ tmp_nAmbientRed_Obj[h][w] = ambobjR;
+ tmp_nAmbientGreen_Obj[h][w] = ambobjG;
+ tmp_nAmbientBlue_Obj[h][w] = ambobjB;
+ tmp_nAmbientRed_Bl[h][w] = ambblR;
+ tmp_nAmbientGreen_Bl[h][w] = ambblG;
+ tmp_nAmbientBlue_Bl[h][w] = ambblB;
+ tmp_nAmbientRed_Obj_Bl[h][w] = ambobjblR;
+ tmp_nAmbientGreen_Obj_Bl[h][w] = ambobjblG;
+ tmp_nAmbientBlue_Obj_Bl[h][w] = ambobjblB;
+ tmp_nDirectionalRed[h][w] = dirR;
+ tmp_nDirectionalGreen[h][w] = dirG;
+ tmp_nDirectionalBlue[h][w] = dirB;
+ tmp_nSkyTopRed[h][w] = skyTopR;
+ tmp_nSkyTopGreen[h][w] = skyTopG;
+ tmp_nSkyTopBlue[h][w] = skyTopB;
+ tmp_nSkyBottomRed[h][w] = skyBotR;
+ tmp_nSkyBottomGreen[h][w] = skyBotG;
+ tmp_nSkyBottomBlue[h][w] = skyBotB;
+ tmp_nSunCoreRed[h][w] = sunCoreR;
+ tmp_nSunCoreGreen[h][w] = sunCoreG;
+ tmp_nSunCoreBlue[h][w] = sunCoreB;
+ tmp_nSunCoronaRed[h][w] = sunCoronaR;
+ tmp_nSunCoronaGreen[h][w] = sunCoronaG;
+ tmp_nSunCoronaBlue[h][w] = sunCoronaB;
+ if(sunSz == -1)
+ tmp_fSunSize[h][w] = -1;
+ else
+ tmp_fSunSize[h][w] = sunSz * 10.0f;
+ if(sprSz == -1)
+ tmp_fSpriteSize[h][w] = -1;
+ else
+ tmp_fSpriteSize[h][w] = sprSz * 10.0f;
+ if(sprBght == -1)
+ tmp_fSpriteBrightness[h][w] = -1;
+ else
+ tmp_fSpriteBrightness[h][w] = sprBght * 10.0f;
+ tmp_nShadowStrength[h][w] = shad;
+ tmp_nLightShadowStrength[h][w] = lightShad;
+ tmp_nPoleShadowStrength[h][w] = poleShad;
+ tmp_fFarClip[h][w] = farClp;
+ tmp_fFogStart[h][w] = fogSt;
+ if(lightGnd == -1)
+ tmp_fLightsOnGroundBrightness[h][w] = -1;
+ else
+ tmp_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f;
+ tmp_nLowCloudsRed[h][w] = cloudR;
+ tmp_nLowCloudsGreen[h][w] = cloudG;
+ tmp_nLowCloudsBlue[h][w] = cloudB;
+ tmp_nFluffyCloudsTopRed[h][w] = fluffyTopR;
+ tmp_nFluffyCloudsTopGreen[h][w] = fluffyTopG;
+ tmp_nFluffyCloudsTopBlue[h][w] = fluffyTopB;
+ tmp_nFluffyCloudsBottomRed[h][w] = fluffyBotR;
+ tmp_nFluffyCloudsBottomGreen[h][w] = fluffyBotG;
+ tmp_nFluffyCloudsBottomBlue[h][w] = fluffyBotB;
+ tmp_fBlurRed[h][w] = blurR;
+ tmp_fBlurGreen[h][w] = blurG;
+ tmp_fBlurBlue[h][w] = blurB;
+ tmp_fWaterRed[h][w] = waterR;
+ tmp_fWaterGreen[h][w] = waterG;
+ tmp_fWaterBlue[h][w] = waterB;
+ tmp_fWaterAlpha[h][w] = waterA;
}
+ UpdateArrays();
+
m_FogReduction = 0;
debug("CTimeCycle ready\n");
}
+template<typename T> void
+FillGaps(T (*out)[NUMWEATHERS], float (*in)[NUMWEATHERS])
+{
+ int w;
+ for(w = 0; w < NUMWEATHERS; w++){
+ for(int h = 0; h < NUMHOURS; h++)
+ out[h][w] = in[h][w];
+
+#define NEXT(h) (((h)+1)%NUMHOURS)
+#define PREV(h) (((h)+NUMHOURS-1)%NUMHOURS)
+ int hend, h1, h2;
+ for(hend = 0; hend < NUMHOURS; hend++)
+ if(in[hend][w] != -1.0f)
+ goto foundstart;
+ return; // this should never happen
+foundstart:
+ // Found the start of a block of filled in entries
+ for(h1 = NEXT(hend); h1 != hend; h1 = h2){
+ // Skip filled in entries
+ for(; h1 != hend; h1 = NEXT(h1))
+ if(in[h1][w] == -1.0f)
+ goto foundfirst;
+ break; // all filled in already
+foundfirst:
+ // h1 is now the first -1 after n filled in values
+ for(h2 = NEXT(h1); ; h2 = NEXT(h2))
+ if(in[h2][w] != -1.0f)
+ goto foundlast;
+ break;
+foundlast:
+ // h2 is now the first entry after a row of -1s
+ h1 = PREV(h1); // make h1 the first before a row of -1s
+ int n = (h2-h1 + NUMHOURS) % NUMHOURS;
+ if(n == 0) n = NUMHOURS; // can't happen
+ float step = (in[h2][w] - in[h1][w])/n;
+
+ for(int i = 1; i < n; i++){
+ float f = (float)i/n;
+ out[(h1+i)%NUMHOURS][w] = in[h2][w]*f + in[h1][w]*(1.0f-f);
+ }
+ }
+ }
+}
+
+void
+CTimeCycle::UpdateArrays(void)
+{
+ FillGaps(m_nAmbientRed, tmp_nAmbientRed);
+ FillGaps(m_nAmbientGreen, tmp_nAmbientGreen);
+ FillGaps(m_nAmbientBlue, tmp_nAmbientBlue);
+ FillGaps(m_nAmbientRed_Obj, tmp_nAmbientRed_Obj);
+ FillGaps(m_nAmbientGreen_Obj, tmp_nAmbientGreen_Obj);
+ FillGaps(m_nAmbientBlue_Obj, tmp_nAmbientBlue_Obj);
+ FillGaps(m_nAmbientRed_Bl, tmp_nAmbientRed_Bl);
+ FillGaps(m_nAmbientGreen_Bl, tmp_nAmbientGreen_Bl);
+ FillGaps(m_nAmbientBlue_Bl, tmp_nAmbientBlue_Bl);
+ FillGaps(m_nAmbientRed_Obj_Bl, tmp_nAmbientRed_Obj_Bl);
+ FillGaps(m_nAmbientGreen_Obj_Bl, tmp_nAmbientGreen_Obj_Bl);
+ FillGaps(m_nAmbientBlue_Obj_Bl, tmp_nAmbientBlue_Obj_Bl);
+ FillGaps(m_nDirectionalRed, tmp_nDirectionalRed);
+ FillGaps(m_nDirectionalGreen, tmp_nDirectionalGreen);
+ FillGaps(m_nDirectionalBlue, tmp_nDirectionalBlue);
+ FillGaps(m_nSkyTopRed, tmp_nSkyTopRed);
+ FillGaps(m_nSkyTopGreen, tmp_nSkyTopGreen);
+ FillGaps(m_nSkyTopBlue, tmp_nSkyTopBlue);
+ FillGaps(m_nSkyBottomRed, tmp_nSkyBottomRed);
+ FillGaps(m_nSkyBottomGreen, tmp_nSkyBottomGreen);
+ FillGaps(m_nSkyBottomBlue, tmp_nSkyBottomBlue);
+ FillGaps(m_nSunCoreRed, tmp_nSunCoreRed);
+ FillGaps(m_nSunCoreGreen, tmp_nSunCoreGreen);
+ FillGaps(m_nSunCoreBlue, tmp_nSunCoreBlue);
+ FillGaps(m_nSunCoronaRed, tmp_nSunCoronaRed);
+ FillGaps(m_nSunCoronaGreen, tmp_nSunCoronaGreen);
+ FillGaps(m_nSunCoronaBlue, tmp_nSunCoronaBlue);
+ FillGaps(m_fSunSize, tmp_fSunSize);
+ FillGaps(m_fSpriteSize, tmp_fSpriteSize);
+ FillGaps(m_fSpriteBrightness, tmp_fSpriteBrightness);
+ FillGaps(m_nShadowStrength, tmp_nShadowStrength);
+ FillGaps(m_nLightShadowStrength, tmp_nLightShadowStrength);
+ FillGaps(m_nPoleShadowStrength, tmp_nPoleShadowStrength);
+ FillGaps(m_fFogStart, tmp_fFogStart);
+ FillGaps(m_fFarClip, tmp_fFarClip);
+ FillGaps(m_fLightsOnGroundBrightness, tmp_fLightsOnGroundBrightness);
+ FillGaps(m_nLowCloudsRed, tmp_nLowCloudsRed);
+ FillGaps(m_nLowCloudsGreen, tmp_nLowCloudsGreen);
+ FillGaps(m_nLowCloudsBlue, tmp_nLowCloudsBlue);
+ FillGaps(m_nFluffyCloudsTopRed, tmp_nFluffyCloudsTopRed);
+ FillGaps(m_nFluffyCloudsTopGreen, tmp_nFluffyCloudsTopGreen);
+ FillGaps(m_nFluffyCloudsTopBlue, tmp_nFluffyCloudsTopBlue);
+ FillGaps(m_nFluffyCloudsBottomRed, tmp_nFluffyCloudsBottomRed);
+ FillGaps(m_nFluffyCloudsBottomGreen, tmp_nFluffyCloudsBottomGreen);
+ FillGaps(m_nFluffyCloudsBottomBlue, tmp_nFluffyCloudsBottomBlue);
+ FillGaps(m_fBlurRed, tmp_fBlurRed);
+ FillGaps(m_fBlurGreen, tmp_fBlurGreen);
+ FillGaps(m_fBlurBlue, tmp_fBlurBlue);
+ FillGaps(m_fWaterRed, tmp_fWaterRed);
+ FillGaps(m_fWaterGreen, tmp_fWaterGreen);
+ FillGaps(m_fWaterBlue, tmp_fWaterBlue);
+ FillGaps(m_fWaterAlpha, tmp_fWaterAlpha);
+}
+
static float interp_c0, interp_c1, interp_c2, interp_c3;
float CTimeCycle::Interpolate(int8 *a, int8 *b)
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index da911b75..d8c333f6 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -185,6 +185,7 @@ public:
static int32 GetWaterAlpha(void) { return m_fCurrentWaterAlpha; }
static void Initialise(void);
+ static void UpdateArrays(void);
static void Update(void);
static float Interpolate(int8 *a, int8 *b);
static float Interpolate(uint8 *a, uint8 *b);
diff --git a/src/render/WaterCreatures.cpp b/src/render/WaterCreatures.cpp
index d3bd2701..b44f987c 100644
--- a/src/render/WaterCreatures.cpp
+++ b/src/render/WaterCreatures.cpp
@@ -7,6 +7,7 @@
#include "config.h"
#include "General.h"
+/*
int CWaterCreatures::nNumActiveSeaLifeForms;
CWaterCreature CWaterCreatures::aWaterCreatures[NUM_WATER_CREATURES];
@@ -271,4 +272,5 @@ void CWaterCreatures::RemoveAll() {
nNumActiveSeaLifeForms--;
}
}
-} \ No newline at end of file
+}
+*/ \ No newline at end of file
diff --git a/src/render/WaterCreatures.h b/src/render/WaterCreatures.h
index 9ef8198c..0b8d2376 100644
--- a/src/render/WaterCreatures.h
+++ b/src/render/WaterCreatures.h
@@ -1,6 +1,7 @@
#pragma once
#include "Object.h"
+/*
enum eFishSlotState {
WATER_CREATURE_INIT = 0,
WATER_CREATURE_ACTIVE,
@@ -45,4 +46,4 @@ struct WaterCreatureProperties {
float fLevel;
float fUnknown; //unused
float fWaterDepth;
-}; \ No newline at end of file
+};*/ \ No newline at end of file
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index 08fd5e6e..6247c611 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -1175,13 +1175,13 @@ CWaterLevel::RenderWater()
if ( WavesCalculatedThisFrame )
{
RenderSeaBirds();
- RenderShipsOnHorizon();
- CParticle::HandleShipsAtHorizonStuff();
- HandleBeachToysStuff();
+ //RenderShipsOnHorizon();
+ //CParticle::HandleShipsAtHorizonStuff();
+ //HandleBeachToysStuff();
}
- if ( _bSeaLife )
- HandleSeaLifeForms();
+ //if ( _bSeaLife )
+ // HandleSeaLifeForms();
DefinedState();
}
@@ -3105,6 +3105,7 @@ CWaterLevel::RenderShipsOnHorizon()
}
}
+/*
void
CWaterLevel::HandleSeaLifeForms()
{
@@ -3145,7 +3146,7 @@ CWaterLevel::HandleSeaLifeForms()
}
CWaterCreatures::UpdateAll();
-}
+}*/
void
CWaterLevel::HandleBeachToysStuff(void)
diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h
index 6d6614d8..d12fb9f6 100644
--- a/src/render/WaterLevel.h
+++ b/src/render/WaterLevel.h
@@ -1,6 +1,6 @@
#pragma once
-#define WATER_X_OFFSET (400.0f)
+#define WATER_X_OFFSET (0.0f)
#define WATER_Z_OFFSET (0.5f)
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index f5d7402a..ca4ef349 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -51,6 +51,11 @@ float CWeather::WindClipped;
float CWeather::TrafficLightBrightness;
bool CWeather::bScriptsForceRain;
+bool CWeather::Stored_StateStored;
+float CWeather::Stored_InterpolationValue;
+int16 CWeather::Stored_OldWeatherType;
+int16 CWeather::Stored_NewWeatherType;
+float CWeather::Stored_Rain;
tRainStreak Streaks[NUM_RAIN_STREAKS];
@@ -325,6 +330,7 @@ void CWeather::Update(void)
void CWeather::AddHeatHaze()
{
+ /*
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED)
return;
@@ -336,6 +342,7 @@ void CWeather::AddHeatHaze()
pos.y = CGeneral::GetRandomNumberInRange(SCREEN_HEIGHT*0.4f, SCREEN_HEIGHT*0.9f);
pos.z = 100.0f;
CParticle::AddParticle(PARTICLE_HEATHAZE_IN_DIST, pos, CVector(0.0f, 0.0f, 0.0f));
+ */
}
void CWeather::AddBeastie()
@@ -648,6 +655,26 @@ void CWeather::RenderRainStreaks(void)
TempBufferIndicesStored = 0;
}
+void CWeather::StoreWeatherState()
+{
+ Stored_StateStored = true;
+ Stored_InterpolationValue = InterpolationValue;
+ Stored_Rain = Rain;
+ Stored_NewWeatherType = NewWeatherType;
+ Stored_OldWeatherType = OldWeatherType;
+}
+
+void CWeather::RestoreWeatherState()
+{
+#ifdef FIX_BUGS // it's not used anyway though
+ Stored_StateStored = false;
+#endif
+ InterpolationValue = Stored_InterpolationValue;
+ Rain = Stored_Rain;
+ NewWeatherType = Stored_NewWeatherType;
+ OldWeatherType = Stored_OldWeatherType;
+}
+
#ifdef SECUROM
void CWeather::ForceHurricaneWeather()
{
diff --git a/src/render/Weather.h b/src/render/Weather.h
index bda57d55..0e7cf9bd 100644
--- a/src/render/Weather.h
+++ b/src/render/Weather.h
@@ -42,6 +42,11 @@ public:
static float TrafficLightBrightness;
static bool bScriptsForceRain;
+ static bool Stored_StateStored;
+ static float Stored_InterpolationValue;
+ static int16 Stored_OldWeatherType;
+ static int16 Stored_NewWeatherType;
+ static float Stored_Rain;
static void RenderRainStreaks(void);
static void Update(void);
@@ -57,6 +62,8 @@ public:
static void AddBeastie();
static void ForceHurricaneWeather();
+ static void StoreWeatherState();
+ static void RestoreWeatherState();
};
enum {