VC CParticle done

This commit is contained in:
Fire-Head 2020-05-27 02:16:31 +03:00
parent ae8a377f26
commit 6a32981ba5
15 changed files with 1147 additions and 500 deletions

View File

@ -11,6 +11,7 @@
class CVehicle; class CVehicle;
struct CReference; struct CReference;
enum tParticleType;
struct CAddressInReplayBuffer struct CAddressInReplayBuffer
{ {
@ -287,6 +288,8 @@ public:
static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; } static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; }
static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; } static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; }
static void RecordParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, float fSize, RwRGBA const&color)
{ } //TODO
private: private:
static void RecordThisFrame(void); static void RecordThisFrame(void);
static void StorePedUpdate(CPed *ped, int id); static void StorePedUpdate(CPed *ped, int id);

View File

@ -4,6 +4,9 @@
#include "Text.h" #include "Text.h"
#include "World.h" #include "World.h"
//TODO
int32 CStats::SeagullsKilled;
int32 CStats::DaysPassed; int32 CStats::DaysPassed;
int32 CStats::HeadsPopped; int32 CStats::HeadsPopped;
int32 CStats::CommercialPassed; int32 CStats::CommercialPassed;

View File

@ -9,6 +9,9 @@ public:
TOTAL_FASTEST_TIMES = 16, TOTAL_FASTEST_TIMES = 16,
TOTAL_HIGHEST_SCORES = 16 TOTAL_HIGHEST_SCORES = 16
}; };
//TODO
static int32 SeagullsKilled;
static int32 DaysPassed; static int32 DaysPassed;
static int32 HeadsPopped; static int32 HeadsPopped;
static int32 CommercialPassed; static int32 CommercialPassed;

View File

@ -206,7 +206,7 @@ enum Config {
#endif #endif
// Particle // Particle
//#define PC_PARTICLE #define PC_PARTICLE
//#define PS2_ALTERNATIVE_CARSPLASH // unused on PS2 //#define PS2_ALTERNATIVE_CARSPLASH // unused on PS2
// Pad // Pad

View File

@ -1,5 +1,15 @@
#pragma once #pragma once
enum FxType
{
FXTYPE_0 = 0,
FXTYPE_1,
FXTYPE_2,
FXTYPE_3,
FXTYPE_4,
FXTYPE_5,
};
class CMBlur class CMBlur
{ {
public: public:
@ -15,4 +25,8 @@ public:
static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type); static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type);
static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type); static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type);
static void ClearDrunkBlur(); static void ClearDrunkBlur();
//TODO
static void AddRenderFx(RwCamera *,RwRect *,float,FxType)
{}
}; };

File diff suppressed because it is too large Load Diff

View File

@ -15,25 +15,24 @@ public:
CVector m_vecPosition; CVector m_vecPosition;
CVector m_vecVelocity; CVector m_vecVelocity;
CVector m_vecScreenPosition; uint32 m_nTimeWhenWillBeDestroyed;
uint32 m_nTimeWhenWillBeDestroyed; uint32 m_nTimeWhenColorWillBeChanged;
uint32 m_nTimeWhenColorWillBeChanged;
float m_fZGround; float m_fZGround;
CVector m_vecParticleMovementOffset; CVector m_vecParticleMovementOffset;
int16 m_nCurrentZRotation; int16 m_nCurrentZRotation;
uint16 m_nZRotationTimer; uint16 m_nZRotationTimer;
float m_fCurrentZRadius; float m_fCurrentZRadius;
uint16 m_nZRadiusTimer; uint16 m_nZRadiusTimer;
float m_fSize;
float m_fExpansionRate;
uint16 m_nFadeToBlackTimer;
uint16 m_nFadeAlphaTimer;
uint8 m_nColorIntensity; uint8 m_nColorIntensity;
uint8 m_nAlpha; uint8 m_nAlpha;
uint16 m_nCurrentFrame; float m_fSize;
float m_fExpansionRate;
int16 m_nFadeToBlackTimer;
int16 m_nFadeAlphaTimer;
int16 m_nAnimationSpeedTimer; int16 m_nAnimationSpeedTimer;
int16 m_nRotationStep; int16 m_nRotationStep;
int16 m_nRotation; int16 m_nRotation;
uint8 m_nCurrentFrame;
RwRGBA m_Color; RwRGBA m_Color;
CParticle *m_pNext; CParticle *m_pNext;
@ -60,8 +59,11 @@ public:
static void Initialise(); static void Initialise();
static void Shutdown(); static void Shutdown();
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = nil, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0); static void AddParticlesAlongLine(tParticleType type, CVector const &vecStart, CVector const &vecEnd, CVector const &vecDir, float fPower, CEntity *pEntity = nil, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0); static void AddParticlesAlongLine(tParticleType type, CVector const &vecStart, CVector const &vecEnd, CVector const &vecDir, float fPower, CEntity *pEntity, float fSize, RwRGBA const&color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = nil, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static void Update(); static void Update();
static void Render(); static void Render();
@ -89,6 +91,10 @@ public:
static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize); static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize);
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
static void CalWindDir(CVector *vecDirIn, CVector *vecDirOut);
static void HandleShipsAtHorizonStuff();
static void HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos);
}; };
VALIDATE_SIZE(CParticle, 0x68); VALIDATE_SIZE(CParticle, 0x58);

View File

@ -216,6 +216,18 @@ void cParticleSystemMgr::LoadParticleData()
case CFG_PARAM_TRAIL_LENGTH_MULTIPLIER: case CFG_PARAM_TRAIL_LENGTH_MULTIPLIER:
entry->m_fTrailLengthMultiplier = atof(value); entry->m_fTrailLengthMultiplier = atof(value);
break; break;
case CFG_PARAM_STRETCH_VALUE_X:
entry->m_vecTextureStretch.x = atof(value);
break;
case CFG_PARAM_STRETCH_VALUE_Y:
entry->m_vecTextureStretch.y = atof(value);
break;
case CFG_PARAM_WIND_FACTOR:
entry->m_fWindFactor = atof(value);
break;
case CFG_PARAM_PARTICLE_CREATE_RANGE: case CFG_PARAM_PARTICLE_CREATE_RANGE:
entry->m_fCreateRange = SQR(atof(value)); entry->m_fCreateRange = SQR(atof(value));

View File

@ -36,14 +36,14 @@ struct tParticleSystemData
uint16 m_nZRadiusChangeTime; uint16 m_nZRadiusChangeTime;
float m_fInitialZRadius; float m_fInitialZRadius;
float m_fZRadiusChangeAmount; float m_fZRadiusChangeAmount;
uint16 m_nFadeToBlackTime; int16 m_nFadeToBlackTime;
int16 m_nFadeToBlackAmount;
uint8 m_nFadeToBlackInitialIntensity; uint8 m_nFadeToBlackInitialIntensity;
int16 m_nFadeToBlackAmount;
uint8 m_nFadeAlphaInitialIntensity; uint8 m_nFadeAlphaInitialIntensity;
uint16 m_nFadeAlphaTime; int16 m_nFadeAlphaTime;
int16 m_nFadeAlphaAmount; int16 m_nFadeAlphaAmount;
uint16 m_nStartAnimationFrame; uint8 m_nStartAnimationFrame;
uint16 m_nFinalAnimationFrame; uint8 m_nFinalAnimationFrame;
uint16 m_nAnimationSpeed; uint16 m_nAnimationSpeed;
uint16 m_nRotationSpeed; uint16 m_nRotationSpeed;
float m_fGravitationalAcceleration; float m_fGravitationalAcceleration;
@ -56,16 +56,19 @@ struct tParticleSystemData
uint32 m_nLifeSpanErrorShape; uint32 m_nLifeSpanErrorShape;
float m_fTrailLengthMultiplier; float m_fTrailLengthMultiplier;
uint32 Flags; uint32 Flags;
RwRGBA m_RenderColouring; CRGBA m_RenderColouring;
uint8 m_InitialColorVariation; uint8 m_InitialColorVariation;
RwRGBA m_FadeDestinationColor; CRGBA m_FadeDestinationColor;
uint32 m_ColorFadeTime; uint32 m_ColorFadeTime;
CVector2D m_vecTextureStretch;
float m_fWindFactor;
RwRaster **m_ppRaster; RwRaster **m_ppRaster;
CParticle *m_pParticles; CParticle *m_pParticles;
}; };
VALIDATE_SIZE(tParticleSystemData, 0x88); VALIDATE_SIZE(tParticleSystemData, 0x94);
class cParticleSystemMgr class cParticleSystemMgr
{ {
@ -107,6 +110,11 @@ class cParticleSystemMgr
CFG_PARAM_ROTATION_RATE_ERROR, CFG_PARAM_ROTATION_RATE_ERROR,
CFG_PARAM_LIFE_SPAN_ERROR_SHAPE, CFG_PARAM_LIFE_SPAN_ERROR_SHAPE,
CFG_PARAM_TRAIL_LENGTH_MULTIPLIER, CFG_PARAM_TRAIL_LENGTH_MULTIPLIER,
CFG_PARAM_STRETCH_VALUE_X,
CFG_PARAM_STRETCH_VALUE_Y,
CFG_PARAM_WIND_FACTOR,
CFG_PARAM_PARTICLE_CREATE_RANGE, CFG_PARAM_PARTICLE_CREATE_RANGE,
CFG_PARAM_FLAGS, CFG_PARAM_FLAGS,
@ -125,6 +133,6 @@ public:
void RangeCheck(tParticleSystemData *pData) { } void RangeCheck(tParticleSystemData *pData) { }
}; };
VALIDATE_SIZE(cParticleSystemMgr, 0x2420); VALIDATE_SIZE(cParticleSystemMgr, 0x2FFC);
extern cParticleSystemMgr mod_ParticleSystemManager; extern cParticleSystemMgr mod_ParticleSystemManager;

View File

@ -4,13 +4,16 @@ enum tParticleType
{ {
PARTICLE_SPARK = 0, PARTICLE_SPARK = 0,
PARTICLE_SPARK_SMALL, PARTICLE_SPARK_SMALL,
PARTICLE_WATER_SPARK,
PARTICLE_WHEEL_DIRT, PARTICLE_WHEEL_DIRT,
PARTICLE_SAND,
PARTICLE_WHEEL_WATER, PARTICLE_WHEEL_WATER,
PARTICLE_BLOOD, PARTICLE_BLOOD,
PARTICLE_BLOOD_SMALL, PARTICLE_BLOOD_SMALL,
PARTICLE_BLOOD_SPURT, PARTICLE_BLOOD_SPURT,
PARTICLE_DEBRIS, PARTICLE_DEBRIS,
PARTICLE_DEBRIS2, PARTICLE_DEBRIS2,
PARTICLE_FLYERS,
PARTICLE_WATER, PARTICLE_WATER,
PARTICLE_FLAME, PARTICLE_FLAME,
PARTICLE_FIREBALL, PARTICLE_FIREBALL,
@ -18,8 +21,11 @@ enum tParticleType
PARTICLE_GUNFLASH_NOANIM, PARTICLE_GUNFLASH_NOANIM,
PARTICLE_GUNSMOKE, PARTICLE_GUNSMOKE,
PARTICLE_GUNSMOKE2, PARTICLE_GUNSMOKE2,
PARTICLE_CIGARETTE_SMOKE,
PARTICLE_SMOKE, PARTICLE_SMOKE,
PARTICLE_SMOKE_SLOWMOTION, PARTICLE_SMOKE_SLOWMOTION,
PARTICLE_DRY_ICE,
PARTICLE_TEARGAS,
PARTICLE_GARAGEPAINT_SPRAY, PARTICLE_GARAGEPAINT_SPRAY,
PARTICLE_SHARD, PARTICLE_SHARD,
PARTICLE_SPLASH, PARTICLE_SPLASH,
@ -28,6 +34,7 @@ enum tParticleType
PARTICLE_STEAM2, PARTICLE_STEAM2,
PARTICLE_STEAM_NY, PARTICLE_STEAM_NY,
PARTICLE_STEAM_NY_SLOWMOTION, PARTICLE_STEAM_NY_SLOWMOTION,
PARTICLE_GROUND_STEAM,
PARTICLE_ENGINE_STEAM, PARTICLE_ENGINE_STEAM,
PARTICLE_RAINDROP, PARTICLE_RAINDROP,
PARTICLE_RAINDROP_SMALL, PARTICLE_RAINDROP_SMALL,
@ -35,6 +42,8 @@ enum tParticleType
PARTICLE_RAIN_SPLASH_BIGGROW, PARTICLE_RAIN_SPLASH_BIGGROW,
PARTICLE_RAIN_SPLASHUP, PARTICLE_RAIN_SPLASHUP,
PARTICLE_WATERSPRAY, PARTICLE_WATERSPRAY,
PARTICLE_WATERDROP,
PARTICLE_BLOODDROP,
PARTICLE_EXPLOSION_MEDIUM, PARTICLE_EXPLOSION_MEDIUM,
PARTICLE_EXPLOSION_LARGE, PARTICLE_EXPLOSION_LARGE,
PARTICLE_EXPLOSION_MFAST, PARTICLE_EXPLOSION_MFAST,
@ -42,12 +51,12 @@ enum tParticleType
PARTICLE_CAR_SPLASH, PARTICLE_CAR_SPLASH,
PARTICLE_BOAT_SPLASH, PARTICLE_BOAT_SPLASH,
PARTICLE_BOAT_THRUSTJET, PARTICLE_BOAT_THRUSTJET,
PARTICLE_BOAT_WAKE,
PARTICLE_WATER_HYDRANT, PARTICLE_WATER_HYDRANT,
PARTICLE_WATER_CANNON, PARTICLE_WATER_CANNON,
PARTICLE_EXTINGUISH_STEAM, PARTICLE_EXTINGUISH_STEAM,
PARTICLE_PED_SPLASH, PARTICLE_PED_SPLASH,
PARTICLE_PEDFOOT_DUST, PARTICLE_PEDFOOT_DUST,
PARTICLE_CAR_DUST,
PARTICLE_HELI_DUST, PARTICLE_HELI_DUST,
PARTICLE_HELI_ATTACK, PARTICLE_HELI_ATTACK,
PARTICLE_ENGINE_SMOKE, PARTICLE_ENGINE_SMOKE,
@ -58,6 +67,7 @@ enum tParticleType
PARTICLE_TREE_LEAVES, PARTICLE_TREE_LEAVES,
PARTICLE_CARCOLLISION_DUST, PARTICLE_CARCOLLISION_DUST,
PARTICLE_CAR_DEBRIS, PARTICLE_CAR_DEBRIS,
PARTICLE_BIRD_DEBRIS,
PARTICLE_HELI_DEBRIS, PARTICLE_HELI_DEBRIS,
PARTICLE_EXHAUST_FUMES, PARTICLE_EXHAUST_FUMES,
PARTICLE_RUBBER_SMOKE, PARTICLE_RUBBER_SMOKE,
@ -67,9 +77,14 @@ enum tParticleType
PARTICLE_GUNSHELL, PARTICLE_GUNSHELL,
PARTICLE_GUNSHELL_BUMP1, PARTICLE_GUNSHELL_BUMP1,
PARTICLE_GUNSHELL_BUMP2, PARTICLE_GUNSHELL_BUMP2,
PARTICLE_ROCKET_SMOKE,
PARTICLE_TEST, PARTICLE_TEST,
PARTICLE_BIRD_FRONT, PARTICLE_BIRD_FRONT,
PARTICLE_SHIP_SIDE,
PARTICLE_BEASTIE,
PARTICLE_RAINDROP_2D, PARTICLE_RAINDROP_2D,
PARTICLE_HEATHAZE,
PARTICLE_HEATHAZE_IN_DIST,
MAX_PARTICLES, MAX_PARTICLES,
PARTICLE_FIRST = PARTICLE_SPARK, PARTICLE_FIRST = PARTICLE_SPARK,

View File

@ -7,6 +7,9 @@ class CSprite
static float m_fRecipNearClipPlane; static float m_fRecipNearClipPlane;
static int32 m_bFlushSpriteBufferSwitchZTest; static int32 m_bFlushSpriteBufferSwitchZTest;
public: public:
static float GetNearScreenZ(void) { return m_f2DNearScreenZ; }
static float GetFarScreenZ(void) { return m_f2DFarScreenZ; }
static float CalcHorizonCoors(void); static float CalcHorizonCoors(void);
static bool CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, bool farclip); static bool CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, bool farclip);
static void InitSpriteBuffer(void); static void InitSpriteBuffer(void);

View File

@ -567,7 +567,7 @@ void CWeather::RenderRainStreaks(void)
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRainDropTex[3])); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRainDropTex));
if (RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, 1)) if (RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, 1))
{ {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored); RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored);

View File

@ -63,4 +63,4 @@ struct tRainStreak
uint32 timer; uint32 timer;
}; };
extern RwTexture* gpRainDropTex[4]; extern RwTexture* gpRainDropTex;

View File

@ -382,8 +382,9 @@ CBoat::ProcessControl(void)
CGeneral::GetRandomNumberInRange(0, 30), CGeneral::GetRandomNumberInRange(0, 30),
CGeneral::GetRandomNumberInRange(0, 90), 3); CGeneral::GetRandomNumberInRange(0, 90), 3);
#endif #endif
if(!cameraHack) //TODO: MIAMI:
CParticle::AddParticle(PARTICLE_BOAT_WAKE, wakePos, wakeDir, nil, 0.0f, jetColor); //if(!cameraHack)
// CParticle::AddParticle(PARTICLE_BOAT_WAKE, wakePos, wakeDir, nil, 0.0f, jetColor);
}else if((CTimer::GetFrameCounter() + m_randomSeed) & 1){ }else if((CTimer::GetFrameCounter() + m_randomSeed) & 1){
#ifdef PC_PARTICLE #ifdef PC_PARTICLE
jetDir.z = 0.018f; jetDir.z = 0.018f;

View File

@ -36,7 +36,7 @@ CWeaponEffects::Init(void)
int32 slot = CTxdStore::FindTxdSlot("particle"); int32 slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::SetCurrentTxd(slot); CTxdStore::SetCurrentTxd(slot);
gpCrossHairTex = RwTextureRead("crosshair", nil); gpCrossHairTex = RwTextureRead("target256", "target256m");
gpCrossHairRaster = RwTextureGetRaster(gpCrossHairTex); gpCrossHairRaster = RwTextureGetRaster(gpCrossHairTex);
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();