From ec1b91e5270b1c91885a5e8000a5ff8286aee140 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 May 2020 05:06:51 +0300 Subject: Remove unused audio enum --- src/objects/Object.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/objects') diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index cd2cd688..c5f73987 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -11,6 +11,7 @@ #include "ObjectData.h" #include "World.h" #include "Floater.h" +#include "soundlist.h" int16 CObject::nNoTempObjects; int16 CObject::nBodyCastHealth = 1000; @@ -219,7 +220,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos); break; } case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: { @@ -242,7 +243,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_1, vecPos); break; } case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: { @@ -267,7 +268,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_TIRE_COLLISION, vecPos); break; } case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: { @@ -292,7 +293,7 @@ CObject::ObjectDamage(float amount) int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0); } - PlayOneShotScriptObject(_SCRSOUND_COL_CAR, vecPos); + PlayOneShotScriptObject(SCRIPT_SOUND_METAL_COLLISION, vecPos); break; } } -- cgit v1.2.3 From 6510b15704998b14b89fa453ba9d142f85c30dd5 Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Tue, 19 May 2020 01:49:09 +0300 Subject: script revision --- src/objects/Object.cpp | 15 +++++++++++++++ src/objects/Object.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'src/objects') diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 0107c75c..4a45050c 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -396,3 +396,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 20c99b1b..73f710f0 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -113,3 +113,5 @@ public: static void DeleteAllTempObjects(); static void DeleteAllTempObjectsInArea(CVector point, float fRadius); }; + +bool IsObjectPointerValid(CObject* pObject); -- cgit v1.2.3 From bdbe5d1080066073f063d653e80df6dbf4b326a2 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 19 May 2020 20:56:42 +0200 Subject: CEntity and friends --- src/objects/Object.cpp | 10 ++++++++-- src/objects/Object.h | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/objects') diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 4a45050c..e6bb7aee 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);}; @@ -161,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); @@ -170,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; @@ -335,9 +338,12 @@ CObject::Init(void) m_pCurSurface = outEntity; else m_pCurSurface = nil; +#if 0 if (GetModelIndex() == MI_BODYCAST) nBodyCastHealth = 1000; - else if (GetModelIndex() == MI_BUOY) + else +#endif + if (GetModelIndex() == MI_BUOY) bTouchingWater = true; } diff --git a/src/objects/Object.h b/src/objects/Object.h index 73f710f0..9ceffb2f 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -86,7 +86,9 @@ public: int8 m_colour1, m_colour2; static int16 nNoTempObjects; - static int16 nBodyCastHealth; +// static int16 nBodyCastHealth; + + static float fDistToNearestTree; static void *operator new(size_t); static void *operator new(size_t, int); -- cgit v1.2.3 From 2ab3fb5dd02aad980718f1ac176f06f7b7e25f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 20 May 2020 20:10:05 +0300 Subject: Fixes for melees and various things --- src/objects/Object.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/objects') diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index e6bb7aee..fd5a2aa3 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -338,13 +338,13 @@ CObject::Init(void) m_pCurSurface = outEntity; else m_pCurSurface = nil; -#if 0 - if (GetModelIndex() == MI_BODYCAST) - nBodyCastHealth = 1000; - else -#endif + if (GetModelIndex() == MI_BUOY) bTouchingWater = true; + + // TODO(Miami): Second flag set initialization + + m_area = AREA_EVERYWHERE; } bool -- cgit v1.2.3 From a53ca58e566ffceb058451bc49bcc5810c26cb37 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 22 May 2020 14:27:16 +0200 Subject: CPhysical --- src/objects/Object.cpp | 6 +++++- src/objects/Object.h | 29 ++++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'src/objects') diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index fd5a2aa3..daa48d98 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -330,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; @@ -342,7 +344,9 @@ CObject::Init(void) if (GetModelIndex() == MI_BUOY) bTouchingWater = true; - // TODO(Miami): Second flag set initialization + if(CModelInfo::GetModelInfo(GetModelIndex())->GetModelType() == MITYPE_WEAPON) + bIsWeapon = true; + bIsStreetLight = IsLightObject(GetModelIndex()); m_area = AREA_EVERYWHERE; } diff --git a/src/objects/Object.h b/src/objects/Object.h index 9ceffb2f..5a9c0195 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -59,26 +59,23 @@ 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; - - // this batch is unused - int8 field_17B; - int8 field_17C; - int8 field_17D; - int8 field_17E; - int8 field_17F; - + int8 m_nBeachballBounces; + uint32 m_obj_unused1; uint32 m_nEndOfLifeTime; int16 m_nRefModelIndex; CEntity *m_pCurSurface; @@ -86,8 +83,6 @@ public: int8 m_colour1, m_colour2; static int16 nNoTempObjects; -// static int16 nBodyCastHealth; - static float fDistToNearestTree; static void *operator new(size_t); -- cgit v1.2.3