diff options
Diffstat (limited to 'src/objects')
-rw-r--r-- | src/objects/CutsceneHead.cpp | 194 | ||||
-rw-r--r-- | src/objects/CutsceneHead.h | 28 | ||||
-rw-r--r-- | src/objects/CutsceneObject.cpp | 46 | ||||
-rw-r--r-- | src/objects/CutsceneObject.h | 17 | ||||
-rw-r--r-- | src/objects/DummyObject.cpp | 1 | ||||
-rw-r--r-- | src/objects/DummyObject.h | 2 | ||||
-rw-r--r-- | src/objects/Object.cpp | 34 | ||||
-rw-r--r-- | src/objects/Object.h | 42 | ||||
-rw-r--r-- | src/objects/ParticleObject.cpp | 874 | ||||
-rw-r--r-- | src/objects/ParticleObject.h | 22 |
10 files changed, 505 insertions, 755 deletions
diff --git a/src/objects/CutsceneHead.cpp b/src/objects/CutsceneHead.cpp deleted file mode 100644 index 55e75807..00000000 --- a/src/objects/CutsceneHead.cpp +++ /dev/null @@ -1,194 +0,0 @@ -#include "common.h" -#include <rpskin.h> - -#include "main.h" -#include "RwHelper.h" -#include "RpAnimBlend.h" -#include "AnimBlendClumpData.h" -#include "Bones.h" -#include "Directory.h" -#include "CutsceneMgr.h" -#include "Streaming.h" -#include "CutsceneHead.h" -#include "CdStream.h" - - -CCutsceneHead::CCutsceneHead(CObject *obj) -{ - RpAtomic *atm; - - assert(RwObjectGetType(obj->m_rwObject) == rpCLUMP); -#ifdef PED_SKIN - unk1 = 0; - bIsSkinned = false; - m_parentObject = (CCutsceneObject*)obj; - // Hide original head - if(IsClumpSkinned(obj->GetClump())){ - m_parentObject->SetRenderHead(false); - bIsSkinned = true; - }else -#endif - { - m_pHeadNode = RpAnimBlendClumpFindFrame((RpClump*)obj->m_rwObject, "Shead")->frame; - atm = (RpAtomic*)GetFirstObject(m_pHeadNode); - if(atm){ - assert(RwObjectGetType((RwObject*)atm) == rpATOMIC); - RpAtomicSetFlags(atm, RpAtomicGetFlags(atm) & ~rpATOMICRENDER); - } - } -} - -void -CCutsceneHead::CreateRwObject(void) -{ - RpAtomic *atm; - - CEntity::CreateRwObject(); - assert(RwObjectGetType(m_rwObject) == rpCLUMP); - atm = GetFirstAtomic((RpClump*)m_rwObject); - RpSkinAtomicSetHAnimHierarchy(atm, RpHAnimFrameGetHierarchy(GetFirstChild(RpClumpGetFrame((RpClump*)m_rwObject)))); -} - -void -CCutsceneHead::DeleteRwObject(void) -{ - CEntity::DeleteRwObject(); -} - -void -CCutsceneHead::ProcessControl(void) -{ - RpAtomic *atm; - RpHAnimHierarchy *hier; - - // android/xbox calls is at the end - CPhysical::ProcessControl(); - -#ifdef PED_SKIN - if(bIsSkinned){ - UpdateRpHAnim(); - UpdateRwFrame(); - - RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(m_parentObject->GetClump()); - int idx = RpHAnimIDGetIndex(hier, BONE_head); - RwMatrix *mat = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; - if(RwV3dLength(&mat->pos) > 100.0f){ - m_matrix.SetRotateY(PI/2); - m_matrix = CMatrix(mat) * m_matrix; - } - }else -#endif - { - m_matrix.SetRotateY(PI/2); - m_matrix = CMatrix(RwFrameGetLTM(m_pHeadNode)) * m_matrix; - UpdateRwFrame(); // android/xbox don't call this - } - - assert(RwObjectGetType(m_rwObject) == rpCLUMP); - atm = GetFirstAtomic((RpClump*)m_rwObject); - hier = RpSkinAtomicGetHAnimHierarchy(atm); - RpHAnimHierarchyAddAnimTime(hier, CTimer::GetTimeStepNonClipped()/50.0f); -} - -void -CCutsceneHead::Render(void) -{ - RpAtomic *atm; - -#ifdef PED_SKIN - if(bIsSkinned){ - RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(m_parentObject->GetClump()); - RpHAnimHierarchyUpdateMatrices(hier); - int idx = RpHAnimIDGetIndex(hier, BONE_head); - RwMatrix *mat = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; - if(RwV3dLength(&mat->pos) > 100.0f){ - m_matrix.SetRotateY(PI/2); - m_matrix = CMatrix(mat) * m_matrix; - } - // This is head...it has no limbs -#ifndef FIX_BUGS - RenderLimb(BONE_Lhand); - RenderLimb(BONE_Rhand); -#endif - }else -#endif - { - m_matrix.SetRotateY(PI/2); - m_matrix = CMatrix(RwFrameGetLTM(m_pHeadNode)) * m_matrix; - } - - UpdateRwFrame(); - - assert(RwObjectGetType(m_rwObject) == rpCLUMP); - atm = GetFirstAtomic((RpClump*)m_rwObject); - RpHAnimHierarchyUpdateMatrices(RpSkinAtomicGetHAnimHierarchy(atm)); - - CObject::Render(); -} - -#ifdef PED_SKIN -void -CCutsceneHead::RenderLimb(int32 bone) -{ - // It's not clear what this is... - // modelinfo for this object is not a ped so it also doesn't have any limbs -#ifndef FIX_BUGS - RpAtomic *atomic; - RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(m_parentObject->GetClump()); - int idx = RpHAnimIDGetIndex(hier, bone); - RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier); - CPedModelInfo *mi = (CPedModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); - assert(mi->GetModelType() == MITYPE_PED); - switch(bone){ - case BONE_Lhand: - atomic = mi->getLeftHand(); - break; - case BONE_Rhand: - atomic = mi->getRightHand(); - break; - default: - return; - } - if(atomic){ - RwFrame *frame = RpAtomicGetFrame(atomic); - RwMatrixTransform(RwFrameGetMatrix(frame), &mats[idx], rwCOMBINEREPLACE); - RwFrameUpdateObjects(frame); - RpAtomicRender(atomic); - } -#endif -} -#endif - -void -CCutsceneHead::PlayAnimation(const char *animName) -{ - RpAtomic *atm; - RpHAnimHierarchy *hier; - RpHAnimAnimation *anim; - uint32 offset, size; - RwStream *stream; - - assert(RwObjectGetType(m_rwObject) == rpCLUMP); - atm = GetFirstAtomic((RpClump*)m_rwObject); - hier = RpSkinAtomicGetHAnimHierarchy(atm); - - sprintf(gString, "%s.anm", animName); - - if(CCutsceneMgr::ms_pCutsceneDir->FindItem(gString, offset, size)){ - stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "ANIM\\CUTS.IMG"); - assert(stream); - - CStreaming::MakeSpaceFor(size * CDSTREAM_SECTOR_SIZE); - CStreaming::ImGonnaUseStreamingMemory(); - - RwStreamSkip(stream, offset*2048); - if(RwStreamFindChunk(stream, rwID_HANIMANIMATION, nil, nil)){ - anim = RpHAnimAnimationStreamRead(stream); - RpHAnimHierarchySetCurrentAnim(hier, anim); - } - - CStreaming::IHaveUsedStreamingMemory(); - - RwStreamClose(stream, nil); - } -} diff --git a/src/objects/CutsceneHead.h b/src/objects/CutsceneHead.h deleted file mode 100644 index c931eb01..00000000 --- a/src/objects/CutsceneHead.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include "CutsceneObject.h" - -class CCutsceneHead : public CCutsceneObject -{ -public: - RwFrame *m_pHeadNode; -#ifdef PED_SKIN - int32 unk1; - CCutsceneObject *m_parentObject; - int32 unk2; - int32 bIsSkinned; -#endif - - CCutsceneHead(CObject *obj); - - void CreateRwObject(void); - void DeleteRwObject(void); - void ProcessControl(void); - void Render(void); - void RenderLimb(int32 bone); - - void PlayAnimation(const char *animName); -}; -#ifndef PED_SKIN -VALIDATE_SIZE(CCutsceneHead, 0x19C); -#endif diff --git a/src/objects/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp index 5c10d37d..adfec37c 100644 --- a/src/objects/CutsceneObject.cpp +++ b/src/objects/CutsceneObject.cpp @@ -21,12 +21,6 @@ CCutsceneObject::CCutsceneObject(void) ObjectCreatedBy = CUTSCENE_OBJECT; m_fMass = 1.0f; m_fTurnMass = 1.0f; - -#ifdef PED_SKIN - bRenderHead = true; - bRenderRightHand = true; - bRenderLeftHand = true; -#endif } void @@ -85,47 +79,9 @@ CCutsceneObject::PreRender(void) void CCutsceneObject::Render(void) { -#ifdef PED_SKIN - if(IsClumpSkinned(GetClump())){ - if(bRenderLeftHand) RenderLimb(BONE_Lhand); - if(bRenderRightHand) RenderLimb(BONE_Rhand); - if(bRenderHead) RenderLimb(BONE_head); - } -#endif CObject::Render(); } -#ifdef PED_SKIN -void -CCutsceneObject::RenderLimb(int32 bone) -{ - RpAtomic *atomic; - CPedModelInfo *mi = (CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex()); - switch(bone){ - case BONE_head: - atomic = mi->getHead(); - break; - case BONE_Lhand: - atomic = mi->getLeftHand(); - break; - case BONE_Rhand: - atomic = mi->getRightHand(); - break; - default: - return; - } - if(atomic){ - RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump()); - int idx = RpHAnimIDGetIndex(hier, bone); - RwMatrix *mat = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; - RwFrame *frame = RpAtomicGetFrame(atomic); - *RwFrameGetMatrix(frame) = *mat; - RwFrameUpdateObjects(frame); - RpAtomicRender(atomic); - } -} -#endif - bool CCutsceneObject::SetupLighting(void) { @@ -137,7 +93,7 @@ CCutsceneObject::SetupLighting(void) }else{ CVector coors = GetPosition(); float lighting = CPointLights::GenerateLightsAffectingObject(&coors); - if(!bHasBlip && lighting != 1.0f){ + if(lighting != 1.0f){ SetAmbientAndDirectionalColours(lighting); return true; } diff --git a/src/objects/CutsceneObject.h b/src/objects/CutsceneObject.h index 407adcc7..bb642f3e 100644 --- a/src/objects/CutsceneObject.h +++ b/src/objects/CutsceneObject.h @@ -5,29 +5,12 @@ class CCutsceneObject : public CObject { public: -#ifdef PED_SKIN - bool bRenderHead; - bool bRenderRightHand; - bool bRenderLeftHand; - - bool GetRenderHead(void) { return bRenderHead; } - bool GetRenderRightHand(void) { return bRenderRightHand; } - bool GetRenderLeftHand(void) { return bRenderLeftHand; } - void SetRenderHead(bool render) { bRenderHead = render; } - void SetRenderRightHand(bool render) { bRenderRightHand = render; } - void SetRenderLeftHand(bool render) { bRenderLeftHand = render; } -#endif - CCutsceneObject(void); void SetModelIndex(uint32 id); void ProcessControl(void); void PreRender(void); void Render(void); - void RenderLimb(int32 bone); bool SetupLighting(void); void RemoveLighting(bool reset); }; -#ifndef PED_SKIN -VALIDATE_SIZE(CCutsceneObject, 0x198); -#endif diff --git a/src/objects/DummyObject.cpp b/src/objects/DummyObject.cpp index d5805073..8dd1643d 100644 --- a/src/objects/DummyObject.cpp +++ b/src/objects/DummyObject.cpp @@ -10,4 +10,5 @@ CDummyObject::CDummyObject(CObject *obj) AttachToRwObject(obj->m_rwObject); obj->DetachFromRwObject(); m_level = obj->m_level; + m_area = obj->m_area; } diff --git a/src/objects/DummyObject.h b/src/objects/DummyObject.h index d6f88335..680df685 100644 --- a/src/objects/DummyObject.h +++ b/src/objects/DummyObject.h @@ -10,5 +10,3 @@ public: CDummyObject(void) {} CDummyObject(CObject *obj); }; - -VALIDATE_SIZE(CDummyObject, 0x68); diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index c5f73987..daa48d98 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -14,7 +14,8 @@ #include "soundlist.h" int16 CObject::nNoTempObjects; -int16 CObject::nBodyCastHealth = 1000; +//int16 CObject::nBodyCastHealth = 1000; +float CObject::fDistToNearestTree; void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); } void *CObject::operator new(size_t sz, int handle) { return CPools::GetObjectPool()->New(handle);}; @@ -69,6 +70,7 @@ CObject::CObject(CDummyObject *dummy) dummy->DetachFromRwObject(); Init(); m_level = dummy->m_level; + m_area = dummy->m_area; } CObject::~CObject(void) @@ -160,6 +162,7 @@ CObject::ObjectDamage(float amount) return; static int8 nFrameGen = 0; bool bBodyCastDamageEffect = false; +#if 0 if (GetModelIndex() == MI_BODYCAST) { if (amount > 50.0f) nBodyCastHealth = (int16)(nBodyCastHealth - 0.5f * amount); @@ -169,6 +172,7 @@ CObject::ObjectDamage(float amount) bBodyCastDamageEffect = true; amount = 0.0f; } +#endif if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) { const CVector& vecPos = m_matrix.GetPosition(); const float fDirectionZ = 0.0002f * amount; @@ -326,6 +330,8 @@ CObject::Init(void) m_colour1 = 0; m_colour2 = 0; m_nBonusValue = 0; + bIsWeapon = false; +// TODO(MIAMI): some new field here m_pCollidingEntity = nil; CColPoint point; CEntity* outEntity = nil; @@ -334,10 +340,15 @@ CObject::Init(void) m_pCurSurface = outEntity; else m_pCurSurface = nil; - if (GetModelIndex() == MI_BODYCAST) - nBodyCastHealth = 1000; - else if (GetModelIndex() == MI_BUOY) + + if (GetModelIndex() == MI_BUOY) bTouchingWater = true; + + if(CModelInfo::GetModelInfo(GetModelIndex())->GetModelType() == MITYPE_WEAPON) + bIsWeapon = true; + bIsStreetLight = IsLightObject(GetModelIndex()); + + m_area = AREA_EVERYWHERE; } bool @@ -395,3 +406,18 @@ CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius) } } } + +bool +IsObjectPointerValid(CObject* pObject) +{ + if (!pObject) + return false; + int index = CPools::GetObjectPool()->GetJustIndex(pObject); +#ifdef FIX_BUGS + if (index < 0 || index >= CPools::GetObjectPool()->GetSize()) +#else + if (index < 0 || index > CPools::GetObjectPool()->GetSize()) +#endif + return false; + return pObject->bIsBIGBuilding || pObject->m_entryInfoList.first; +} diff --git a/src/objects/Object.h b/src/objects/Object.h index c9a1bba8..5a9c0195 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -25,13 +25,29 @@ enum CollisionDamageEffect DAMAGE_EFFECT_NONE, DAMAGE_EFFECT_CHANGE_MODEL, DAMAGE_EFFECT_SPLIT_MODEL, - DAMAGE_EFFECT_SMASH_COMPLETELY, + DAMAGE_EFFECT_SMASH_AND_DAMAGE_TRAFFICLIGHTS, + + DAMAGE_EFFECT_SMASH_COMPLETELY = 20, DAMAGE_EFFECT_CHANGE_THEN_SMASH, DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY = 50, + DAMAGE_EFFECT_SMASH_YELLOW_TARGET_COMPLETELY, + DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY = 60, DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY = 70, - DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY = 80 + DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY = 80, + + DAMAGE_EFFECT_SMASH_NEWSTANDNEW1 = 91, + DAMAGE_EFFECT_SMASH_NEWSTANDNEW21, + DAMAGE_EFFECT_SMASH_NEWSTANDNEW31, + DAMAGE_EFFECT_SMASH_NEWSTANDNEW41, + DAMAGE_EFFECT_SMASH_NEWSTANDNEW51, + + DAMAGE_EFFECT_SMASH_BLACKBAG = 100, + DAMAGE_EFFECT_SMASH_VEGPALM = 110, + DAMAGE_EFFECT_BURST_BEACHBALL = 120, + DAMAGE_EFFECT_SMASH_BEACHLOUNGE_WOOD = 131, + DAMAGE_EFFECT_SMASH_BEACHLOUNGE_TOWEL, }; class CVehicle; @@ -43,18 +59,22 @@ public: CMatrix m_objectMatrix; float m_fUprootLimit; int8 ObjectCreatedBy; - int8 bIsPickup : 1; - int8 bPickupObjWithMessage : 1; - int8 bOutOfStock : 1; - int8 bGlassCracked : 1; - int8 bGlassBroken : 1; - int8 bHasBeenDamaged : 1; - int8 bUseVehicleColours : 1; + uint8 bIsPickup : 1; + uint8 obj_flag_02 : 1; + uint8 bPickupObjWithMessage : 1; + uint8 bOutOfStock : 1; + uint8 bGlassCracked : 1; + uint8 bGlassBroken : 1; + uint8 bHasBeenDamaged : 1; + uint8 bUseVehicleColours : 1; + uint8 bIsWeapon : 1; + uint8 bIsStreetLight : 1; int8 m_nBonusValue; float m_fCollisionDamageMultiplier; uint8 m_nCollisionDamageEffect; uint8 m_nSpecialCollisionResponseCases; bool m_bCameraToAvoidThisObject; + int8 m_nBeachballBounces; uint32 m_obj_unused1; uint32 m_nEndOfLifeTime; int16 m_nRefModelIndex; @@ -63,7 +83,7 @@ public: int8 m_colour1, m_colour2; static int16 nNoTempObjects; - static int16 nBodyCastHealth; + static float fDistToNearestTree; static void *operator new(size_t); static void *operator new(size_t, int); @@ -91,4 +111,4 @@ public: static void DeleteAllTempObjectsInArea(CVector point, float fRadius); }; -VALIDATE_SIZE(CObject, 0x198); +bool IsObjectPointerValid(CObject* pObject); diff --git a/src/objects/ParticleObject.cpp b/src/objects/ParticleObject.cpp index a8afaf6c..b2a77bc5 100644 --- a/src/objects/ParticleObject.cpp +++ b/src/objects/ParticleObject.cpp @@ -50,7 +50,7 @@ CAudioHydrant::Remove(CParticleObject *particleobject) { DMAudio.DestroyEntity(List[i].AudioEntity); List[i].AudioEntity = AEHANDLE_NONE; - List[i].pParticleObject = NULL; + List[i].pParticleObject = nil; } } } @@ -59,8 +59,8 @@ CParticleObject::CParticleObject() : CPlaceable(), m_nFrameCounter(0), m_nState(POBJECTSTATE_INITIALISED), - m_pNext(NULL), - m_pPrev(NULL), + m_pNext(nil), + m_pPrev(nil), m_nRemoveTimer(0) { @@ -75,20 +75,20 @@ CParticleObject::~CParticleObject() void CParticleObject::Initialise() { - pCloseListHead = NULL; - pFarListHead = NULL; + pCloseListHead = nil; + pFarListHead = nil; pUnusedListHead = &gPObjectArray[0]; for ( int32 i = 0; i < MAX_PARTICLEOBJECTS; i++ ) { if ( i == 0 ) - gPObjectArray[i].m_pPrev = NULL; + gPObjectArray[i].m_pPrev = nil; else gPObjectArray[i].m_pPrev = &gPObjectArray[i - 1]; if ( i == MAX_PARTICLEOBJECTS-1 ) - gPObjectArray[i].m_pNext = NULL; + gPObjectArray[i].m_pNext = nil; else gPObjectArray[i].m_pNext = &gPObjectArray[i + 1]; @@ -124,12 +124,12 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe { CParticleObject *pobj = pUnusedListHead; - ASSERT(pobj != NULL); + ASSERT(pobj != nil); - if ( pobj == NULL ) + if ( pobj == nil ) { printf("Error: No particle objects available!\n"); - return NULL; + return nil; } MoveToList(&pUnusedListHead, &pCloseListHead, pobj); @@ -147,7 +147,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe pobj->m_bRemove = remove; - pobj->m_pParticle = NULL; + pobj->m_pParticle = nil; if ( lifeTime != 0 ) pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds() + lifeTime; @@ -162,223 +162,237 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe pobj->m_fSize = size; pobj->m_fRandVal = 0.0f; - if ( type <= POBJECT_CATALINAS_SHOTGUNFLASH ) + switch ( type ) { - switch ( type ) + case POBJECT_PAVEMENT_STEAM: { - case POBJECT_PAVEMENT_STEAM: - { - pobj->m_ParticleType = PARTICLE_STEAM_NY; - pobj->m_nNumEffectCycles = 1; -#ifdef PC_PARTICLE - pobj->m_nSkipFrames = 3; -#else - pobj->m_nSkipFrames = 1; -#endif - pobj->m_nCreationChance = 8; - break; - } - - case POBJECT_PAVEMENT_STEAM_SLOWMOTION: - { - pobj->m_ParticleType = PARTICLE_STEAM_NY_SLOWMOTION; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 8; - break; - } - - case POBJECT_WALL_STEAM: - { - pobj->m_ParticleType = PARTICLE_STEAM_NY; - pobj->m_nNumEffectCycles = 1; -#ifdef PC_PARTICLE - pobj->m_nSkipFrames = 3; -#else - pobj->m_nSkipFrames = 1; -#endif - pobj->m_nCreationChance = 8; - break; - } - - case POBJECT_WALL_STEAM_SLOWMOTION: - { - pobj->m_ParticleType = PARTICLE_STEAM_NY_SLOWMOTION; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 8; - break; - } - - case POBJECT_DARK_SMOKE: - { - pobj->m_ParticleType = PARTICLE_STEAM_NY; - pobj->m_nNumEffectCycles = 1; -#ifdef PC_PARTICLE - pobj->m_nSkipFrames = 3; -#else - pobj->m_nSkipFrames = 1; -#endif - pobj->m_nCreationChance = 8; - pobj->m_Color = CRGBA(16, 16, 16, 255); - break; - } - - case POBJECT_FIRE_HYDRANT: - { - pobj->m_ParticleType = PARTICLE_WATER_HYDRANT; - pobj->m_nNumEffectCycles = 4; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 0; - pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.3f); - pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds() + 5000; - CAudioHydrant::Add(pobj); - break; - } - - case POBJECT_CAR_WATER_SPLASH: - case POBJECT_PED_WATER_SPLASH: - { - pobj->m_ParticleType = PARTICLE_CAR_SPLASH; - pobj->m_nNumEffectCycles = 0; -#ifdef PC_PARTICLE - pobj->m_nSkipFrames = 1; -#else - pobj->m_nSkipFrames = 3; -#endif - pobj->m_nCreationChance = 0; - break; - } - - case POBJECT_SPLASHES_AROUND: - { - pobj->m_ParticleType = PARTICLE_SPLASH; -#ifdef PC_PARTICLE - pobj->m_nNumEffectCycles = 15; -#else - pobj->m_nNumEffectCycles = 30; -#endif - pobj->m_nSkipFrames = 2; - pobj->m_nCreationChance = 0; - break; - } - - case POBJECT_SMALL_FIRE: - { - pobj->m_ParticleType = PARTICLE_FLAME; - pobj->m_nNumEffectCycles = 1; -#ifdef PC_PARTICLE - pobj->m_nSkipFrames = 2; -#else - pobj->m_nSkipFrames = 1; -#endif - pobj->m_nCreationChance = 2; - pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); - break; - } - - case POBJECT_BIG_FIRE: - { - pobj->m_ParticleType = PARTICLE_FLAME; - pobj->m_nNumEffectCycles = 1; -#ifdef PC_PARTICLE - pobj->m_nSkipFrames = 2; -#else - pobj->m_nSkipFrames = 1; -#endif - pobj->m_nCreationChance = 4; - pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); - break; - } - - case POBJECT_DRY_ICE: - { - pobj->m_ParticleType = PARTICLE_SMOKE; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 0; - pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); - break; - } - - case POBJECT_DRY_ICE_SLOWMOTION: - { - pobj->m_ParticleType = PARTICLE_SMOKE_SLOWMOTION; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 0; - pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); - break; - } - - case POBJECT_FIRE_TRAIL: - { - pobj->m_ParticleType = PARTICLE_EXPLOSION_MEDIUM; - pobj->m_nNumEffectCycles = 1; -#ifdef PC_PARTICLE - pobj->m_nSkipFrames = 3; -#else - pobj->m_nSkipFrames = 1; -#endif - pobj->m_nCreationChance = 2; - pobj->m_fRandVal = 0.01f; - break; - } - - case POBJECT_SMOKE_TRAIL: - { - pobj->m_ParticleType = PARTICLE_FIREBALL_SMOKE; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 2; - pobj->m_fRandVal = 0.02f; - break; - } - - case POBJECT_FIREBALL_AND_SMOKE: - { - pobj->m_ParticleType = PARTICLE_FLAME; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 2; - pobj->m_fRandVal = 0.1f; - break; - } - - case POBJECT_ROCKET_TRAIL: - { - pobj->m_ParticleType = PARTICLE_FLAME; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 2; - pobj->m_nCreationChance = 8; - pobj->m_fRandVal = 0.1f; - break; - } - - case POBJECT_EXPLOSION_ONCE: - { - pobj->m_ParticleType = PARTICLE_EXPLOSION_LARGE; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 0; - pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds(); - break; - } - - case POBJECT_CATALINAS_GUNFLASH: - case POBJECT_CATALINAS_SHOTGUNFLASH: - { - pobj->m_ParticleType = PARTICLE_GUNFLASH_NOANIM; - pobj->m_nNumEffectCycles = 1; - pobj->m_nSkipFrames = 1; - pobj->m_nCreationChance = 0; - pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds(); - pobj->m_vecTarget.Normalise(); - break; - } + pobj->m_ParticleType = PARTICLE_STEAM_NY; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 3; + pobj->m_nCreationChance = 8; + break; + } + + case POBJECT_PAVEMENT_STEAM_SLOWMOTION: + { + pobj->m_ParticleType = PARTICLE_STEAM_NY_SLOWMOTION; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 8; + break; + } + + case POBJECT_WALL_STEAM: + { + pobj->m_ParticleType = PARTICLE_STEAM_NY; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 3; + pobj->m_nCreationChance = 8; + break; + } + + case POBJECT_WALL_STEAM_SLOWMOTION: + { + pobj->m_ParticleType = PARTICLE_STEAM_NY_SLOWMOTION; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 8; + break; + } + + case POBJECT_DARK_SMOKE: + { + pobj->m_ParticleType = PARTICLE_STEAM_NY; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 3; + pobj->m_nCreationChance = 8; + pobj->m_Color = CRGBA(16, 16, 16, 255); + break; + } + + case POBJECT_WATER_FOUNTAIN_VERT: + { + pobj->m_ParticleType = PARTICLE_WATER_HYDRANT; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.1f); + break; + } + + case POBJECT_WATER_FOUNTAIN_HORIZ: + { + pobj->m_ParticleType = PARTICLE_WATER_HYDRANT; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + break; + } + + case POBJECT_FIRE_HYDRANT: + { + pobj->m_ParticleType = PARTICLE_WATER_HYDRANT; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.3f); + pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds() + 5000; + CAudioHydrant::Add(pobj); + break; + } + + case POBJECT_CAR_WATER_SPLASH: + case POBJECT_PED_WATER_SPLASH: + { + pobj->m_ParticleType = PARTICLE_CAR_SPLASH; + pobj->m_nNumEffectCycles = 0; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + break; + } + + case POBJECT_SPLASHES_AROUND: + { + pobj->m_ParticleType = PARTICLE_SPLASH; + pobj->m_nNumEffectCycles = 15; + pobj->m_nSkipFrames = 2; + pobj->m_nCreationChance = 0; + break; + } + + case POBJECT_SMALL_FIRE: + { + pobj->m_ParticleType = PARTICLE_FLAME; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 2; + pobj->m_nCreationChance = 2; + pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); + break; } + + case POBJECT_BIG_FIRE: + { + pobj->m_ParticleType = PARTICLE_FLAME; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 2; + pobj->m_nCreationChance = 4; + pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); + break; + } + + case POBJECT_DRY_ICE: + { + pobj->m_ParticleType = PARTICLE_SMOKE; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); + break; + } + + case POBJECT_DRY_ICE_SLOWMOTION: + { + pobj->m_ParticleType = PARTICLE_SMOKE_SLOWMOTION; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + pobj->m_vecTarget = CVector(0.0f, 0.0f, 0.0f); + break; + } + + case POBJECT_FIRE_TRAIL: + { + pobj->m_ParticleType = PARTICLE_EXPLOSION_MEDIUM; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 3; + pobj->m_nCreationChance = 2; + pobj->m_fRandVal = 0.01f; + break; + } + + case POBJECT_SMOKE_TRAIL: + { + pobj->m_ParticleType = PARTICLE_FIREBALL_SMOKE; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 2; + pobj->m_fRandVal = 0.02f; + break; + } + + case POBJECT_FIREBALL_AND_SMOKE: + { + pobj->m_ParticleType = PARTICLE_FLAME; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + pobj->m_fRandVal = 0.1f; + break; + } + + case POBJECT_ROCKET_TRAIL: + { + pobj->m_ParticleType = PARTICLE_FLAME; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 2; + pobj->m_nCreationChance = 8; + pobj->m_fRandVal = 0.1f; + break; + } + + case POBJECT_EXPLOSION_ONCE: + { + pobj->m_ParticleType = PARTICLE_EXPLOSION_LARGE; + pobj->m_nNumEffectCycles = 1; + pobj->m_nSkipFrames = 1; + pobj->m_nCreationChance = 0; + pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds(); + break; + } + } + + return pobj; +} + +CParticleObject * +CParticleObject::AddObject(tParticleType type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, uint8 numEffectCycles, uint8 skipFrames, uint16 creationChance, uint8 remove) +{ + CParticleObject *pobj = pUnusedListHead; + + ASSERT(pobj != nil); + + if ( pobj == nil ) + { + printf("Error: No particle objects available!\n"); + return nil; } + MoveToList(&pUnusedListHead, &pCloseListHead, pobj); + + pobj->m_nState = POBJECTSTATE_UPDATE_CLOSE; + pobj->m_Type = (eParticleObjectType)-1; + pobj->m_ParticleType = type; + + pobj->SetPosition(pos); + pobj->m_vecTarget = target; + + pobj->m_nNumEffectCycles = numEffectCycles; + pobj->m_nSkipFrames = skipFrames; + pobj->m_nCreationChance = creationChance; + pobj->m_nFrameCounter = 0; + + pobj->m_bRemove = remove; + + if ( lifeTime != 0 ) + pobj->m_nRemoveTimer = CTimer::GetTimeInMilliseconds() + lifeTime; + else + pobj->m_nRemoveTimer = 0; + + pobj->m_Color.alpha = 0; + + pobj->m_fSize = size; + pobj->m_fRandVal = 0.0f; + return pobj; } @@ -408,7 +422,7 @@ CParticleObject::UpdateAll(void) { CParticleObject *pobj = pCloseListHead; CParticleObject *nextpobj; - if ( pobj != NULL ) + if ( pobj != nil ) { do { @@ -416,7 +430,7 @@ CParticleObject::UpdateAll(void) pobj->UpdateClose(); pobj = nextpobj; } - while ( nextpobj != NULL ); + while ( nextpobj != nil ); } } @@ -426,7 +440,7 @@ CParticleObject::UpdateAll(void) CParticleObject *pobj = pFarListHead; CParticleObject *nextpobj; - if ( pobj != NULL ) + if ( pobj != nil ) { do { @@ -442,7 +456,7 @@ CParticleObject::UpdateAll(void) pobj = nextpobj; } - while ( nextpobj != NULL ); + while ( nextpobj != nil ); } } } @@ -497,7 +511,7 @@ void CParticleObject::UpdateClose(void) flamevel.y = vel.y; flamevel.z = CGeneral::GetRandomNumberInRange(0.0125f*size, 0.1f*size); - CParticle::AddParticle(PARTICLE_FLAME, pos, flamevel, NULL, size); + CParticle::AddParticle(PARTICLE_FLAME, pos, flamevel, nil, size); CVector possmoke = pos; @@ -528,7 +542,7 @@ void CParticleObject::UpdateClose(void) float flamesize = 0.8f*size; - CParticle::AddParticle(PARTICLE_FLAME, pos, flamevel, NULL, flamesize); + CParticle::AddParticle(PARTICLE_FLAME, pos, flamevel, nil, flamesize); for ( int32 i = 0; i < 4; i++ ) @@ -547,7 +561,7 @@ void CParticleObject::UpdateClose(void) case POBJECT_FIREBALL_AND_SMOKE: { - if ( this->m_pParticle == NULL ) + if ( this->m_pParticle == nil ) { CVector pos = this->GetPosition(); CVector vel = this->m_vecTarget; @@ -555,7 +569,7 @@ void CParticleObject::UpdateClose(void) CVector expvel = 1.2f*vel; float expsize = 1.2f*size; - this->m_pParticle = CParticle::AddParticle(PARTICLE_EXPLOSION_MEDIUM, pos, expvel, NULL, expsize); + this->m_pParticle = CParticle::AddParticle(PARTICLE_EXPLOSION_MEDIUM, pos, expvel, nil, expsize); } else { @@ -572,7 +586,7 @@ void CParticleObject::UpdateClose(void) fireballvel.y += CGeneral::GetRandomNumberInRange(-veloffset.y, veloffset.y); fireballvel.z += CGeneral::GetRandomNumberInRange(-veloffset.z, veloffset.z); - CParticle::AddParticle(PARTICLE_FIREBALL_SMOKE, pos, fireballvel, NULL, size); + CParticle::AddParticle(PARTICLE_FIREBALL_SMOKE, pos, fireballvel, nil, size); } } @@ -581,13 +595,13 @@ void CParticleObject::UpdateClose(void) case POBJECT_ROCKET_TRAIL: { - if ( this->m_pParticle == NULL ) + if ( this->m_pParticle == nil ) { CVector pos = this->GetPosition(); CVector vel = this->m_vecTarget; float size = this->m_fSize; - this->m_pParticle = CParticle::AddParticle(PARTICLE_EXPLOSION_MEDIUM, pos, vel, NULL, size); + this->m_pParticle = CParticle::AddParticle(PARTICLE_EXPLOSION_MEDIUM, pos, vel, nil, size); } else { @@ -600,7 +614,7 @@ void CParticleObject::UpdateClose(void) for ( int32 i = 0; i < this->m_nNumEffectCycles; i++ ) { - CParticle::AddParticle(PARTICLE_FIREBALL_SMOKE, pos, fireballvel, NULL, fireballsize); + CParticle::AddParticle(PARTICLE_FIREBALL_SMOKE, pos, fireballvel, nil, fireballsize); } } @@ -622,7 +636,7 @@ void CParticleObject::UpdateClose(void) if ( vel.z != 0.0f ) vel.z += CGeneral::GetRandomNumberInRange(-this->m_fRandVal, this->m_fRandVal); - CParticle::AddParticle(this->m_ParticleType, this->GetPosition(), vel, NULL, this->m_fSize, + CParticle::AddParticle(this->m_ParticleType, this->GetPosition(), vel, nil, this->m_fSize, CGeneral::GetRandomNumberInRange(-6.0f, 6.0f)); } @@ -631,7 +645,6 @@ void CParticleObject::UpdateClose(void) case POBJECT_PED_WATER_SPLASH: { -#ifdef PC_PARTICLE CRGBA colorsmoke(255, 255, 255, 196); CVector pos = this->GetPosition(); @@ -649,9 +662,9 @@ void CParticleObject::UpdateClose(void) splashpos = pos + CVector(0.75f*fCos, 0.75f*fSin, 0.0f); splashvel = vel + CVector(0.05f*fCos, 0.05f*fSin, CGeneral::GetRandomNumberInRange(0.04f, 0.08f)); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.8f), colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.5f), this->m_Color); @@ -659,9 +672,9 @@ void CParticleObject::UpdateClose(void) splashvel = vel + CVector(0.05f*fCos, 0.05f*-fSin, CGeneral::GetRandomNumberInRange(0.04f, 0.08f)); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.8f), colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.5f), this->m_Color); @@ -669,18 +682,18 @@ void CParticleObject::UpdateClose(void) splashvel = vel + CVector(0.05f*-fCos, 0.05f*fSin, CGeneral::GetRandomNumberInRange(0.04f, 0.08f)); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.8f), colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.5f), this->m_Color); splashpos = pos + CVector(0.75f*-fCos, 0.75f*-fSin, 0.0f); splashvel = vel + CVector(0.05f*-fCos, 0.05f*-fSin, CGeneral::GetRandomNumberInRange(0.04f, 0.08f)); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.8f), colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.5f), this->m_Color); } @@ -700,7 +713,7 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.25f, 0.25f) * fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.05f, 0.25f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.4f, 1.0f), this->m_Color); @@ -710,7 +723,7 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.25f, 0.25f) * -fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.05f, 0.25f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.4f, 1.0f), this->m_Color); @@ -720,7 +733,7 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.25f, 0.25f) * fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.05f, 0.25f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.4f, 1.0f), this->m_Color); @@ -730,72 +743,15 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.25f, 0.25f) * -fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.05f, 0.25f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, CGeneral::GetRandomNumberInRange(0.4f, 1.0f), this->m_Color); } -#else - CVector pos; - CVector vel; - - for ( int32 i = -2; i < 2; i++ ) - { - pos = this->GetPosition(); - pos += CVector(-0.75f, 0.5f * float(i), 0.0f); - - vel = this->m_vecTarget; - vel.x += -1.5 * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color); - - pos = this->GetPosition(); - pos += CVector(0.75f, 0.5f * float(i), 0.0f); - - vel = this->m_vecTarget; - vel.x += 1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color); - - pos = this->GetPosition(); - pos += CVector(0.5f * float(i), -0.75, 0.0f); - - vel = this->m_vecTarget; - vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += -1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color); - - - pos = this->GetPosition(); - pos += CVector(0.5f * float(i), 0.75, 0.0f); - - vel = this->m_vecTarget; - vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += 1.5f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color); - } - - - for ( int32 i = 0; i < 4; i++ ) - { - pos = this->GetPosition(); - - pos.x += CGeneral::GetRandomNumberInRange(-1.5f, 1.5f); - pos.y += CGeneral::GetRandomNumberInRange(-1.5f, 1.5f); - pos.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - vel = this->m_vecTarget; - CParticle::AddParticle(PARTICLE_PED_SPLASH, pos, vel, NULL, 0.8f, this->m_Color); - } -#endif break; } case POBJECT_CAR_WATER_SPLASH: { -#ifdef PC_PARTICLE CRGBA colorsmoke(255, 255, 255, 196); CVector pos = this->GetPosition(); @@ -819,8 +775,8 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.5f, 0.5f) * fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.01f, 0.03f); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, size, colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, size, colorsmoke); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); splashpos = pos + CVector(2.0f*fCos, 2.0f*-fSin, 0.0f); @@ -829,8 +785,8 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.5f, 0.5f) * -fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.01f, 0.03f); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, size, colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, size, colorsmoke); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); splashpos = pos + CVector(2.0f*-fCos, 2.0f*fSin, 0.0f); splashvel = vel; @@ -838,8 +794,8 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.5f, 0.5f) * fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.01f, 0.03f); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, size, colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, size, colorsmoke); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); splashpos = pos + CVector(2.0f*-fCos, 2.0f*-fSin, 0.0f); splashvel = vel; @@ -847,8 +803,8 @@ void CParticleObject::UpdateClose(void) splashvel.y += CGeneral::GetRandomNumberInRange(-0.5f, 0.5f) * -fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.01f, 0.03f); - CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, NULL, size, colorsmoke); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_RUBBER_SMOKE, splashpos, splashvel, nil, size, colorsmoke); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); } for ( int32 i = 0; i < 1; i++ ) @@ -867,88 +823,30 @@ void CParticleObject::UpdateClose(void) splashvel.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * fCos; splashvel.y += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.26f, 0.53f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); splashpos = pos + CVector(1.25f*fCos, 1.25f*-fSin, 0.0f); splashvel = vel; splashvel.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * fCos; splashvel.y += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * -fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.26f, 0.53f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); splashpos = pos + CVector(1.25f*-fCos, 1.25f*fSin, 0.0f); splashvel = vel; splashvel.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * -fCos; splashvel.y += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.26f, 0.53f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); splashpos = pos + CVector(1.25f*-fCos, 1.25f*-fSin, 0.0f); splashvel = vel; splashvel.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * -fCos; splashvel.y += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f) * -fSin; splashvel.z += CGeneral::GetRandomNumberInRange(0.26f, 0.53f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, NULL, 0.0f, this->m_Color); - } -#else - CVector pos; - CVector vel; - - for ( int32 i = -3; i < 4; i++ ) - { - pos = this->GetPosition(); - pos += CVector(-1.5f, 0.5f * float(i), 0.0f); - - - vel = this->m_vecTarget; - vel.x += -3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color); - - - pos = this->GetPosition(); - pos += CVector(1.5f, 0.5f * float(i), 0.0f); - - vel = this->m_vecTarget; - vel.x += 3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color); - - - pos = this->GetPosition(); - pos += CVector(0.5f * float(i), -1.5f, 0.0f); - - vel = this->m_vecTarget; - vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += -3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color); - - - pos = this->GetPosition(); - pos += CVector(0.5f * float(i), 1.5f, 0.0f); - - - vel = this->m_vecTarget; - vel.x += float(i) * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.y += 3.0f * CGeneral::GetRandomNumberInRange(0.001f, 0.006f); - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color); - } - - for ( int32 i = 0; i < 8; i++ ) - { - pos = this->GetPosition(); - pos.x += CGeneral::GetRandomNumberInRange(-3.0f, 3.0f); - pos.y += CGeneral::GetRandomNumberInRange(-3.0f, 3.0f); - - vel = this->m_vecTarget; - vel.z += CGeneral::GetRandomNumberInRange(0.03f, 0.06f); - CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, NULL, 0.0f, this->m_Color); + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, 0.0f, this->m_Color); } -#endif + break; } @@ -967,75 +865,119 @@ void CParticleObject::UpdateClose(void) if ( CGeneral::GetRandomNumber() & 1 ) { CParticle::AddParticle(PARTICLE_RAIN_SPLASH, splashpos, CVector(0.0f, 0.0f, 0.0f), - NULL, 0.1f, this->m_Color); + nil, 0.1f, this->m_Color); } else { CParticle::AddParticle(PARTICLE_RAIN_SPLASHUP, splashpos, CVector(0.0f, 0.0f, 0.0f), - NULL, 0.12f, this->m_Color); + nil, 0.12f, this->m_Color); } } break; } - case POBJECT_CATALINAS_GUNFLASH: + case POBJECT_FIRE_HYDRANT: { - CRGBA flashcolor(120, 120, 120, 255); - - CVector vel = this->m_vecTarget; CVector pos = this->GetPosition(); - - float size = 1.0f; - if ( this->m_fSize != 0.0f ) - size = this->m_fSize; - - CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.12f*size, flashcolor); - - pos += size * (0.06f * vel); - CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.08f*size, flashcolor); - - pos += size * (0.04f * vel); - CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.04f*size, flashcolor); + CVector vel = this->m_vecTarget; - CVector smokepos = this->GetPosition(); - CVector smokevel = 0.1f * vel; - CParticle::AddParticle(PARTICLE_GUNSMOKE2, smokepos, smokevel, NULL, 0.005f*size); + if ( (TheCamera.GetPosition() - pos).Magnitude() > 5.0f ) + { + for ( int32 i = 0; i < 1; i++ ) + { + int32 angle = 180 * i; + + float fCos = CParticle::Cos(angle); + float fSin = CParticle::Sin(angle); + + CVector splashpos, splashvel; + + splashpos = pos + CVector(0.01f*fCos, 0.01f*fSin, 0.0f); + splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300); + + splashpos = pos + CVector(0.01f*fCos, 0.01f*-fSin, 0.0f); + splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300); + + splashpos = pos + CVector(0.01f*-fCos, 0.01f*fSin, 0.0f); + splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300); + + splashpos = pos + CVector(0.01f*-fCos, 0.01f*-fSin, 0.0f); + splashvel = vel + CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_CAR_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.005f, 0.0075f), this->m_Color, 0, 0, 1, 300); + } + for ( int32 i = 0; i < this->m_nNumEffectCycles; i++ ) + { + CParticle::AddParticle(this->m_ParticleType, pos, vel, nil, 0.0f, this->m_Color); + } + } break; } - case POBJECT_CATALINAS_SHOTGUNFLASH: + case POBJECT_WATER_FOUNTAIN_VERT: { - CRGBA flashcolor(120, 120, 120, 255); - + CVector pos = this->GetPosition(); CVector vel = this->m_vecTarget; - float size = 1.0f; - if ( this->m_fSize != 0.0f ) - size = this->m_fSize; + for ( int32 i = 0; i < 2; i++ ) + { + int32 angle = 180 * i; + + float fCos = CParticle::Cos(angle); + float fSin = CParticle::Sin(angle); + + CVector splashpos, splashvel; + + splashpos = pos + CVector(0.015f*fCos, 0.015f*fSin, 0.0f); + splashvel = vel + CVector(0.015f*fCos, 0.015f*fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000); + + splashpos = pos + CVector(0.015f*fCos, 0.015f*-fSin, 0.0f); + splashvel = vel + CVector(0.015f*fCos, 0.015f*-fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000); + + splashpos = pos + CVector(0.015f*-fCos, 0.015f*fSin, 0.0f); + splashvel = vel + CVector(0.015f*-fCos, 0.015f*fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000); + + splashpos = pos + CVector(0.015f*-fCos, 0.015f*-fSin, 0.0f); + splashvel = vel + CVector(0.015f*-fCos, 0.015f*-fSin, CGeneral::GetRandomNumberInRange(0.004f, 0.008f)); + + CParticle::AddParticle(PARTICLE_SPLASH, splashpos, splashvel, nil, + CGeneral::GetRandomNumberInRange(0.001f, 0.005f), this->m_Color, 0, 0, 1, 1000); + } + break; + } + + case POBJECT_WATER_FOUNTAIN_HORIZ: + { CVector pos = this->GetPosition(); - - CVector velstep = size * (0.1f * vel); - CVector flashpos = pos; - - flashpos += velstep; - CParticle::AddParticle(PARTICLE_GUNFLASH, flashpos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, flashcolor); - - flashpos += velstep; - CParticle::AddParticle(PARTICLE_GUNFLASH, flashpos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.15f*size, flashcolor); - - flashpos += velstep; - CParticle::AddParticle(PARTICLE_GUNFLASH, flashpos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.2f*size, flashcolor); - + CVector vel = this->m_vecTarget; - CParticle::AddParticle(PARTICLE_GUNFLASH, pos, CVector(0.0f, 0.0f, 0.0f), NULL, 0.0f, flashcolor); + for ( int32 i = 0; i < 3; i++ ) + { + CParticle::AddParticle(PARTICLE_CAR_SPLASH, pos, vel, nil, 0.001f, this->m_Color, 0, 0, 1, 1000); + } - CVector smokepos = this->GetPosition(); - CVector smokevel = 0.1f*vel; - CParticle::AddParticle(PARTICLE_GUNSMOKE2, smokepos, smokevel, NULL, 0.1f*size); - break; } @@ -1056,7 +998,7 @@ void CParticleObject::UpdateClose(void) if ( vel.z != 0.0f ) vel.z += CGeneral::GetRandomNumberInRange(-this->m_fRandVal, this->m_fRandVal); - CParticle::AddParticle(this->m_ParticleType, this->GetPosition(), vel, NULL, + CParticle::AddParticle(this->m_ParticleType, this->GetPosition(), vel, nil, this->m_fSize, this->m_Color); } } @@ -1064,7 +1006,7 @@ void CParticleObject::UpdateClose(void) { for ( int32 i = 0; i < this->m_nNumEffectCycles; i++ ) { - CParticle::AddParticle(this->m_ParticleType, this->GetPosition(), this->m_vecTarget, NULL, + CParticle::AddParticle(this->m_ParticleType, this->GetPosition(), this->m_vecTarget, nil, this->m_fSize, this->m_Color); } } @@ -1108,15 +1050,15 @@ CParticleObject::UpdateFar(void) bool CParticleObject::SaveParticle(uint8 *buffer, uint32 *length) { - ASSERT( buffer != NULL ); - ASSERT( length != NULL ); + ASSERT( buffer != nil ); + ASSERT( length != nil ); int32 numObjects = 0; - for ( CParticleObject *p = pCloseListHead; p != NULL; p = p->m_pNext ) + for ( CParticleObject *p = pCloseListHead; p != nil; p = p->m_pNext ) ++numObjects; - for ( CParticleObject *p = pFarListHead; p != NULL; p = p->m_pNext ) + for ( CParticleObject *p = pFarListHead; p != nil; p = p->m_pNext ) ++numObjects; *(int32 *)buffer = numObjects; @@ -1125,7 +1067,7 @@ CParticleObject::SaveParticle(uint8 *buffer, uint32 *length) int32 objectsLength = sizeof(CParticleObject) * (numObjects + 1); int32 dataLength = objectsLength + sizeof(int32); - for ( CParticleObject *p = pCloseListHead; p != NULL; p = p->m_pNext ) + for ( CParticleObject *p = pCloseListHead; p != nil; p = p->m_pNext ) { #if 0 // todo better *(CParticleObject*)buffer = *p; @@ -1135,7 +1077,7 @@ CParticleObject::SaveParticle(uint8 *buffer, uint32 *length) buffer += sizeof(CParticleObject); } - for ( CParticleObject *p = pFarListHead; p != NULL; p = p->m_pNext ) + for ( CParticleObject *p = pFarListHead; p != nil; p = p->m_pNext ) { #if 0 // todo better *(CParticleObject*)buffer = *p; @@ -1153,7 +1095,7 @@ CParticleObject::SaveParticle(uint8 *buffer, uint32 *length) bool CParticleObject::LoadParticle(uint8 *buffer, uint32 length) { - ASSERT( buffer != NULL ); + ASSERT( buffer != nil ); RemoveAllParticleObjects(); @@ -1174,7 +1116,7 @@ CParticleObject::LoadParticle(uint8 *buffer, uint32 length) CParticleObject *src = (CParticleObject *)buffer; buffer += sizeof(CParticleObject); - if ( dst == NULL ) + if ( dst == nil ) return false; MoveToList(&pUnusedListHead, &pCloseListHead, dst); @@ -1186,7 +1128,7 @@ CParticleObject::LoadParticle(uint8 *buffer, uint32 length) dst->m_vecTarget = src->m_vecTarget; dst->m_nFrameCounter = src->m_nFrameCounter; dst->m_bRemove = src->m_bRemove; - dst->m_pParticle = NULL; + dst->m_pParticle = nil; dst->m_nRemoveTimer = src->m_nRemoveTimer; dst->m_Color = src->m_Color; dst->m_fSize = src->m_fSize; @@ -1202,22 +1144,64 @@ CParticleObject::LoadParticle(uint8 *buffer, uint32 length) } void +CParticleObject::RemoveAllExpireableParticleObjects(void) +{ + { + CParticleObject *pobj = pCloseListHead; + CParticleObject *nextpobj; + if ( pobj != nil ) + { + do + { + nextpobj = pobj->m_pNext; + if ( pobj->m_nRemoveTimer != 0 ) + { + MoveToList(&pCloseListHead, &pUnusedListHead, pobj); + pobj->m_nState = POBJECTSTATE_FREE; + } + pobj = nextpobj; + } + while ( nextpobj != nil ); + } + } + + { + CParticleObject *pobj = pFarListHead; + CParticleObject *nextpobj; + if ( pobj != nil ) + { + do + { + nextpobj = pobj->m_pNext; + if ( pobj->m_nRemoveTimer != 0 ) + { + MoveToList(&pFarListHead, &pUnusedListHead, pobj); + pobj->m_nState = POBJECTSTATE_FREE; + } + pobj = nextpobj; + } + while ( nextpobj != nil ); + } + } +} + +void CParticleObject::RemoveAllParticleObjects(void) { pUnusedListHead = &gPObjectArray[0]; - pCloseListHead = NULL; - pFarListHead = NULL; + pCloseListHead = nil; + pFarListHead = nil; for ( int32 i = 0; i < MAX_PARTICLEOBJECTS; i++ ) { if ( i == 0 ) - gPObjectArray[i].m_pPrev = NULL; + gPObjectArray[i].m_pPrev = nil; else gPObjectArray[i].m_pPrev = &gPObjectArray[i - 1]; if ( i == MAX_PARTICLEOBJECTS-1 ) - gPObjectArray[i].m_pNext = NULL; + gPObjectArray[i].m_pNext = nil; else gPObjectArray[i].m_pNext = &gPObjectArray[i + 1]; @@ -1228,20 +1212,20 @@ CParticleObject::RemoveAllParticleObjects(void) void CParticleObject::MoveToList(CParticleObject **from, CParticleObject **to, CParticleObject *obj) { - ASSERT( from != NULL ); - ASSERT( to != NULL ); - ASSERT( obj != NULL ); + ASSERT( from != nil ); + ASSERT( to != nil ); + ASSERT( obj != nil ); - if ( obj->m_pPrev == NULL ) + if ( obj->m_pPrev == nil ) { *from = obj->m_pNext; if ( *from ) - (*from)->m_pPrev = NULL; + (*from)->m_pPrev = nil; } else { - if ( obj->m_pNext == NULL ) - obj->m_pPrev->m_pNext = NULL; + if ( obj->m_pNext == nil ) + obj->m_pPrev->m_pNext = nil; else { obj->m_pNext->m_pPrev = obj->m_pPrev; @@ -1250,7 +1234,7 @@ CParticleObject::MoveToList(CParticleObject **from, CParticleObject **to, CParti } obj->m_pNext = *to; - obj->m_pPrev = NULL; + obj->m_pPrev = nil; *to = obj; if ( obj->m_pNext ) diff --git a/src/objects/ParticleObject.h b/src/objects/ParticleObject.h index 34a672bb..a29d7bd4 100644 --- a/src/objects/ParticleObject.h +++ b/src/objects/ParticleObject.h @@ -4,12 +4,12 @@ #include "ParticleType.h" #include "Placeable.h" -#define MAX_PARTICLEOBJECTS 100 +#define MAX_PARTICLEOBJECTS 70 #define MAX_AUDIOHYDRANTS 8 enum eParticleObjectType { - POBJECT_PAVEMENT_STEAM, + POBJECT_PAVEMENT_STEAM = 0, POBJECT_PAVEMENT_STEAM_SLOWMOTION, POBJECT_WALL_STEAM, POBJECT_WALL_STEAM_SLOWMOTION, @@ -22,6 +22,8 @@ enum eParticleObjectType POBJECT_BIG_FIRE, POBJECT_DRY_ICE, POBJECT_DRY_ICE_SLOWMOTION, + POBJECT_WATER_FOUNTAIN_VERT, + POBJECT_WATER_FOUNTAIN_HORIZ, POBJECT_FIRE_TRAIL, POBJECT_SMOKE_TRAIL, POBJECT_FIREBALL_AND_SMOKE, @@ -69,12 +71,13 @@ public: ~CParticleObject(); static void Initialise(void); - - static CParticleObject *AddObject(uint16 type, CVector const &pos, uint8 remove); - static CParticleObject *AddObject(uint16 type, CVector const &pos, float size, uint8 remove); - static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint8 remove); - static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, RwRGBA const &color, uint8 remove); - + + static CParticleObject *AddObject(uint16 type, CVector const &pos, uint8 remove); + static CParticleObject *AddObject(uint16 type, CVector const &pos, float size, uint8 remove); + static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint8 remove); + static CParticleObject *AddObject(uint16 type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, RwRGBA const &color, uint8 remove); + static CParticleObject *AddObject(tParticleType type, CVector const &pos, CVector const &target, float size, uint32 lifeTime, uint8 numEffectCycles, uint8 skipFrames, uint16 creationChance, uint8 remove); + void RemoveObject(void); static void UpdateAll(void); @@ -84,6 +87,7 @@ public: static bool SaveParticle(uint8 *buffer, uint32 *length); static bool LoadParticle(uint8 *buffer, uint32 length); + static void RemoveAllExpireableParticleObjects(void); static void RemoveAllParticleObjects(void); static void MoveToList(CParticleObject **from, CParticleObject **to, CParticleObject *obj); }; @@ -98,7 +102,7 @@ public: CAudioHydrant() : AudioEntity(AEHANDLE_NONE), - pParticleObject(NULL) + pParticleObject(nil) { } static bool Add (CParticleObject *particleobject); |