diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp index 05945529..1396d001 100644 --- a/src/graphics/engine/camera.cpp +++ b/src/graphics/engine/camera.cpp @@ -934,9 +934,9 @@ bool CCamera::IsCollisionBack(Math::Vector &eye, Math::Vector lookat) oType == OBJECT_BEE || oType == OBJECT_WORM ) continue; - Math::Vector oPos; - float oRadius = 0.0f; - obj->GetGlobalSphere(oPos, oRadius); + Math::Sphere objSphere = obj->GetCameraCollisionSphere(); + Math::Vector oPos = objSphere.pos; + float oRadius = objSphere.radius; if ( oRadius <= 2.0f ) continue; // ignores small objects if ( oPos.x+oRadius < min.x || @@ -995,9 +995,9 @@ bool CCamera::IsCollisionFix(Math::Vector &eye, Math::Vector lookat) type == OBJECT_BEE || type == OBJECT_WORM ) continue; - Math::Vector objPos; - float objRadius = 0.0f; - obj->GetGlobalSphere(objPos, objRadius); + Math::Sphere objSphere = obj->GetCameraCollisionSphere(); + Math::Vector objPos = objSphere.pos; + float objRadius = objSphere.radius; if (objRadius == 0.0f) continue; float dist = Math::Distance(eye, objPos); diff --git a/src/object/auto/autovault.cpp b/src/object/auto/autovault.cpp index 50b35cd6..5cf9c4a0 100644 --- a/src/object/auto/autovault.cpp +++ b/src/object/auto/autovault.cpp @@ -240,7 +240,7 @@ bool CAutoVault::EventProcess(const Event &event) } m_object->DeleteAllCrashSpheres(); - m_object->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f)); m_sound->Play(SOUND_FINDING, m_object->GetPosition(0)); diff --git a/src/object/interface/powered_object.h b/src/object/interface/powered_object.h index 23baf6b2..254a26c4 100644 --- a/src/object/interface/powered_object.h +++ b/src/object/interface/powered_object.h @@ -27,6 +27,10 @@ class CObject; /** * \class CPoweredObject * \brief Interface for objects powered using power cells + * + * TODO: It currently includes objects that take other objects as input + * and convert them, for example PowerPlant. + * We should create a dedicated interface for such uses. */ class CPoweredObject { diff --git a/src/object/motion/motionant.cpp b/src/object/motion/motionant.cpp index 74d3842e..00001975 100644 --- a/src/object/motion/motionant.cpp +++ b/src/object/motion/motionant.cpp @@ -86,7 +86,7 @@ void CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type, // A vehicle must have necessarily a collision //with a sphere of center (0, y, 0) (see GetCrashSphere). m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, -2.0f, 0.0f), 4.0f, SOUND_BOUM, 0.20f)); - m_object->SetGlobalSphere(Math::Vector(-0.5f, 1.0f, 0.0f), 4.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-0.5f, 1.0f, 0.0f), 4.0f)); // Creates the head. rank = m_engine->CreateObject(); diff --git a/src/object/motion/motionbee.cpp b/src/object/motion/motionbee.cpp index 9d4c5daa..aa2cd903 100644 --- a/src/object/motion/motionbee.cpp +++ b/src/object/motion/motionbee.cpp @@ -86,7 +86,7 @@ void CMotionBee::Create(Math::Vector pos, float angle, ObjectType type, // A vehicle must have an obligatory collision // with a sphere of center (0, y, 0) (see GetCrashSphere). m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f, SOUND_BOUM, 0.20f)); - m_object->SetGlobalSphere(Math::Vector(-1.0f, 1.0f, 0.0f), 5.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-1.0f, 1.0f, 0.0f), 5.0f)); // Creates the head. rank = m_engine->CreateObject(); diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp index f2cc2255..ec07a2a3 100644 --- a/src/object/motion/motionhuman.cpp +++ b/src/object/motion/motionhuman.cpp @@ -151,7 +151,7 @@ void CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type, // A vehicle must have an obligatory collision with a sphere of center (0, y, 0) (see GetCrashSphere). m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 2.0f, SOUND_AIE, 0.20f)); - m_object->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 4.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 1.0f, 0.0f), 4.0f)); // Creates the head. rank = m_engine->CreateObject(); diff --git a/src/object/motion/motionqueen.cpp b/src/object/motion/motionqueen.cpp index 1aa90832..e45e2564 100644 --- a/src/object/motion/motionqueen.cpp +++ b/src/object/motion/motionqueen.cpp @@ -85,7 +85,7 @@ void CMotionQueen::Create(Math::Vector pos, float angle, ObjectType type, // A vehicle must have a obligatory collision //with a sphere of center (0, y, 0) (see GetCrashSphere). m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 20.0f, SOUND_BOUM, 0.20f)); - m_object->SetGlobalSphere(Math::Vector(-2.0f, 10.0f, 0.0f), 25.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-2.0f, 10.0f, 0.0f), 25.0f)); // Creates the head. rank = m_engine->CreateObject(); diff --git a/src/object/motion/motionspider.cpp b/src/object/motion/motionspider.cpp index dcb1f715..72ceaa6b 100644 --- a/src/object/motion/motionspider.cpp +++ b/src/object/motion/motionspider.cpp @@ -111,7 +111,7 @@ void CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type, // A vehicle must have a obligatory collision // with a sphere of center (0, y, 0) (see GetCrashSphere). m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, -2.0f, 0.0f), 4.0f, SOUND_BOUM, 0.20f)); - m_object->SetGlobalSphere(Math::Vector(-0.5f, 1.0f, 0.0f), 4.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-0.5f, 1.0f, 0.0f), 4.0f)); // Creates the abdomen. rank = m_engine->CreateObject(); diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp index 8b377383..2dded3ff 100644 --- a/src/object/motion/motionvehicle.cpp +++ b/src/object/motion/motionvehicle.cpp @@ -194,17 +194,17 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type, type == OBJECT_MOBILErs) { m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 4.0f, 0.0f), 6.5f, SOUND_BOUMm, 0.45f)); - m_object->SetGlobalSphere(Math::Vector(0.0f, 3.0f, 0.0f), 7.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 3.0f, 0.0f), 7.0f)); } else if (type == OBJECT_MOBILEsa) { m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 3.0f, 0.0f), 4.5f, SOUND_BOUMm, 0.45f)); - m_object->SetGlobalSphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f)); } else if (type == OBJECT_MOBILEdr) { m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 3.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); - m_object->SetGlobalSphere(Math::Vector(0.0f, 3.0f, 0.0f), 7.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 3.0f, 0.0f), 7.0f)); } else if (type == OBJECT_APOLLO2) { @@ -213,7 +213,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type, else { m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 3.0f, 0.0f), 4.5f, SOUND_BOUMm, 0.45f)); - m_object->SetGlobalSphere(Math::Vector(0.0f, 4.0f, 0.0f), 6.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 4.0f, 0.0f), 6.0f)); } if (type == OBJECT_MOBILEfa || diff --git a/src/object/motion/motionworm.cpp b/src/object/motion/motionworm.cpp index ed271545..062dfd42 100644 --- a/src/object/motion/motionworm.cpp +++ b/src/object/motion/motionworm.cpp @@ -98,7 +98,7 @@ void CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type, // A vehicle must have a obligatory collision with a sphere of center (0, y, 0) (see GetCrashSphere). m_object->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f, SOUND_BOUM, 0.20f)); - m_object->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 5.0f); + m_object->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 5.0f)); px = 1.0f+WORM_PART/2; diff --git a/src/object/object.cpp b/src/object/object.cpp index 998bcca9..faf6954b 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -48,3 +48,16 @@ void CObject::DeleteAllCrashSpheres() { m_crashSpheres.clear(); } + +void CObject::SetCameraCollisionSphere(const Math::Sphere& sphere) +{ + m_cameraCollisionSphere = sphere; +} + +Math::Sphere CObject::GetCameraCollisionSphere() +{ + Math::Sphere transformedSphere = m_cameraCollisionSphere; + TransformCrashSphere(transformedSphere); + return transformedSphere; +} + diff --git a/src/object/object.h b/src/object/object.h index 2465c475..f31d92b3 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -95,13 +95,22 @@ public: //! Removes all crash spheres void DeleteAllCrashSpheres(); + //! Returns sphere used to test for camera collisions + Math::Sphere GetCameraCollisionSphere(); + //! Sets sphere used to test for camera collisions + // TODO: remove from here once no longer necessary + void SetCameraCollisionSphere(const Math::Sphere& sphere); + protected: //! Transform crash sphere by object's world matrix virtual void TransformCrashSphere(Math::Sphere& crashSphere) = 0; + //! Transform crash sphere by object's world matrix + virtual void TransformCameraCollisionSphere(Math::Sphere& collisionSphere) = 0; protected: const int m_id; //!< unique identifier ObjectType m_type; //!< object type ObjectInterfaceTypes m_implementedInterfaces; //!< interfaces that the object implements std::vector m_crashSpheres; //!< crash spheres + Math::Sphere m_cameraCollisionSphere; }; diff --git a/src/object/object_factory.cpp b/src/object/object_factory.cpp index 53a6336d..94578c47 100644 --- a/src/object/object_factory.cpp +++ b/src/object/object_factory.cpp @@ -398,7 +398,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-32.0f, 45.0f, 32.0f), 10.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 32.0f, 45.0f, -32.0f), 10.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 32.0f, 45.0f, 32.0f), 10.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 35.0f, 0.0f), 50.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 35.0f, 0.0f), 50.0f)); obj->CreateShadowCircle(50.0f, 1.0f); } @@ -461,7 +461,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-13.0f, 94.0f, -13.0f), 10.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f,104.0f, 0.0f), 14.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 45.0f, 0.0f), 10.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 45.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(60.0f, 1.0f); obj->SetShowLimitRadius(200.0f); @@ -487,7 +487,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 17.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 26.0f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(7.0f, 17.0f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 10.0f, 0.0f), 10.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 10.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(10.0f, 0.4f); } @@ -517,7 +517,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 9.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 6.0f, 0.0f), 9.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 14.0f, 0.0f), 7.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 8.0f, 0.0f), 12.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 8.0f, 0.0f), 12.0f)); obj->GetCharacter()->posPower = Math::Vector(7.5f, 3.0f, 0.0f); @@ -555,7 +555,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 11.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 7.0f, 0.0f), 7.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 7.0f, 0.0f), 7.0f)); obj->CreateShadowCircle(8.0f, 1.0f); } @@ -570,7 +570,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-2.0f, 13.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-7.0f, 3.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 1.0f, 0.0f), 1.5f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(-7.0f, 5.0f, 0.0f), 5.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-7.0f, 5.0f, 0.0f), 5.0f)); obj->GetCharacter()->posPower = Math::Vector(0.0f, 3.0f, 0.0f); obj->SetEnergy(power); // initializes the energy level @@ -631,7 +631,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-10.0f, 10.0f, 0.0f), 4.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-12.0f, 3.0f, 3.0f), 4.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-12.0f, 3.0f, -3.0f), 4.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(-10.0f, 5.0f, 0.0f), 7.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-10.0f, 5.0f, 0.0f), 7.0f)); obj->GetCharacter()->posPower = Math::Vector(0.0f, 3.0f, 0.0f); @@ -690,7 +690,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-10.0f, 9.0f, 4.0f*s), 4.0f, SOUND_BOUMm, 0.45f)); } obj->AddCrashSphere(CrashSphere(Math::Vector(-10.0f, 21.0f, -4.0f), 3.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 10.0f, 0.0f), 18.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 10.0f, 0.0f), 18.0f)); obj->CreateShadowCircle(24.0f, 0.3f); } @@ -716,7 +716,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-11.0f, 0.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-11.0f, 0.0f, -4.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-11.0f, 10.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(-11.0f, 13.0f, 0.0f), 15.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-11.0f, 13.0f, 0.0f), 15.0f)); } if ( type == OBJECT_DESTROYER ) @@ -754,7 +754,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-15.0f, 2.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-15.0f, 6.0f, 0.0f), 4.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(-15.0f, 5.0f, 0.0f), 6.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-15.0f, 5.0f, 0.0f), 6.0f)); obj->SetEnergy(power); } @@ -796,7 +796,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-10.0f, 2.0f, -4.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-10.0f, 9.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 14.0f, 0.0f), 1.5f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(-3.0f, 8.0f, 0.0f), 14.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-3.0f, 8.0f, 0.0f), 14.0f)); } if ( type == OBJECT_TOWER ) @@ -826,7 +826,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 8.0f, 0.0f), 4.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 15.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 24.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 5.0f, 0.0f), 7.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 7.0f)); obj->GetCharacter()->posPower = Math::Vector(5.0f, 3.0f, 0.0f); @@ -852,7 +852,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 0.0f, 0.0f), 19.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 24.0f, 0.0f), 15.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(22.0f, 1.0f, 0.0f), 1.5f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 17.0f, 0.0f), 26.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 17.0f, 0.0f), 26.0f)); obj->GetCharacter()->posPower = Math::Vector(22.0f, 3.0f, 0.0f); @@ -878,7 +878,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-11.0f, 15.0f, -11.0f), 2.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 26.0f, 0.0f), 9.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 54.0f, 0.0f), 14.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 10.0f, 0.0f), 20.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 10.0f, 0.0f), 20.0f)); obj->CreateShadowCircle(21.0f, 1.0f); obj->SetShowLimitRadius(Gfx::LTNG_PROTECTION_RADIUS); @@ -908,7 +908,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) m_terrain->AddBuildingLevel(pos, 18.0f, 20.0f, 1.0f, 0.5f); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 13.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 13.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 1.0f, 0.0f), 13.0f)); obj->CreateShadowCircle(23.0f, 1.0f); } @@ -1042,7 +1042,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params) pPower->obj->SetPosition(0, GetCharacter()->posPower); pPower->obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f)); - pPower->obj->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f); + pPower->obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f)); pPower->SetTransporter(obj.get()); SetPower(pPower); @@ -1145,19 +1145,19 @@ CObjectUPtr CObjectFactory::CreateResource(const ObjectCreateParams& params) else if ( type == OBJECT_EGG ) { obj->AddCrashSphere(CrashSphere(Math::Vector(-1.0f, 2.8f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f)); radius = 3.0f; } else if ( type == OBJECT_BOMB ) { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 3.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 3.0f)); radius = 3.0f; } else if ( type == OBJECT_BAG ) { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f)); obj->SetZoom(0, 1.5f); radius = 5.0f; height = -1.4f; @@ -1165,7 +1165,7 @@ CObjectUPtr CObjectFactory::CreateResource(const ObjectCreateParams& params) else { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f)); } obj->CreateShadowCircle(radius, 1.0f); @@ -1372,7 +1372,7 @@ CObjectUPtr CObjectFactory::CreatePlant(const ObjectCreateParams& params) height -= 2.0f; obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f, SOUND_BOUM, 0.10f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f)); obj->SetJostlingSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 8.0f)); obj->CreateShadowCircle(8.0f, 0.5f); @@ -1432,7 +1432,7 @@ CObjectUPtr CObjectFactory::CreatePlant(const ObjectCreateParams& params) obj->SetAngleY(0, angle); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 12.0f, 0.0f), 5.0f, SOUND_BOUM, 0.10f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 6.0f, 0.0f), 6.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 6.0f, 0.0f), 6.0f)); obj->SetJostlingSphere(Math::Sphere(Math::Vector(0.0f, 4.0f, 0.0f), 8.0f)); obj->CreateShadowCircle(8.0f, 0.3f); @@ -1458,7 +1458,7 @@ CObjectUPtr CObjectFactory::CreatePlant(const ObjectCreateParams& params) if ( type != OBJECT_PLANT19 ) { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f, SOUND_BOUM, 0.10f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f)); } obj->SetJostlingSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 8.0f)); @@ -1603,7 +1603,7 @@ CObjectUPtr CObjectFactory::CreateMushroom(const ObjectCreateParams& params) obj->SetAngleY(0, angle); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 4.0f, 0.0f), 3.0f, SOUND_BOUM, 0.10f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 3.0f, 0.0f), 5.5f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 3.0f, 0.0f), 5.5f)); obj->SetJostlingSphere(Math::Sphere(Math::Vector(0.0f, 3.0f, 0.0f), 5.5f)); obj->CreateShadowCircle(6.0f, 0.5f); @@ -1619,7 +1619,7 @@ CObjectUPtr CObjectFactory::CreateMushroom(const ObjectCreateParams& params) obj->SetAngleY(0, angle); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 5.0f, 0.0f), 3.0f, SOUND_BOUM, 0.10f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 4.0f, 0.0f), 5.5f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 4.0f, 0.0f), 5.5f)); obj->SetJostlingSphere(Math::Sphere(Math::Vector(0.0f, 4.0f, 0.0f), 5.5f)); obj->CreateShadowCircle(5.0f, 0.5f); @@ -1661,7 +1661,7 @@ CObjectUPtr CObjectFactory::CreateQuartz(const ObjectCreateParams& params) obj->SetAngleY(0, angle); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 2.0f, 0.0f), 3.5f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 2.0f, 0.0f), 3.5f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 2.0f, 0.0f), 3.5f)); obj->CreateShadowCircle(4.0f, 0.5f); } @@ -1675,7 +1675,7 @@ CObjectUPtr CObjectFactory::CreateQuartz(const ObjectCreateParams& params) obj->SetAngleY(0, angle); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 4.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 4.0f, 0.0f), 5.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 4.0f, 0.0f), 5.0f)); obj->CreateShadowCircle(5.0f, 0.5f); } @@ -1689,7 +1689,7 @@ CObjectUPtr CObjectFactory::CreateQuartz(const ObjectCreateParams& params) obj->SetAngleY(0, angle); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 6.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 6.0f, 0.0f), 6.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 6.0f, 0.0f), 6.0f)); obj->CreateShadowCircle(6.0f, 0.5f); } @@ -1703,7 +1703,7 @@ CObjectUPtr CObjectFactory::CreateQuartz(const ObjectCreateParams& params) obj->SetAngleY(0, angle); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 10.0f, 0.0f), 10.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 10.0f, 0.0f), 10.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 10.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(10.0f, 0.5f); } @@ -1774,7 +1774,7 @@ CObjectUPtr CObjectFactory::CreateRoot(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-4.0f, 5.0f, -1.0f), 1.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-2.0f, 8.0f, -0.5f), 1.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 10.0f, -0.5f), 1.0f, SOUND_BOUMv, 0.15f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 6.0f, 0.0f), 11.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 6.0f, 0.0f), 11.0f)); obj->CreateShadowCircle(16.0f, 0.5f); } @@ -1795,7 +1795,7 @@ CObjectUPtr CObjectFactory::CreateRoot(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 2.0f, 5.0f, 0.0f), 1.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 8.0f, 1.0f), 1.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 12.0f, 1.0f), 1.0f, SOUND_BOUMv, 0.15f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 6.0f, 0.0f), 12.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 6.0f, 0.0f), 12.0f)); obj->CreateShadowCircle(16.0f, 0.5f); } @@ -1815,7 +1815,7 @@ CObjectUPtr CObjectFactory::CreateRoot(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 3.0f, 7.0f, 1.0f), 1.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 7.0f, -1.0f), 1.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 4.0f, 11.0f, 1.0f), 1.0f, SOUND_BOUMv, 0.15f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 6.0f, 0.0f), 10.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 6.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(16.0f, 0.5f); } @@ -1837,7 +1837,7 @@ CObjectUPtr CObjectFactory::CreateRoot(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 3.0f, 6.0f, -1.0f), 1.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 12.0f, 0.0f), 2.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 1.0f, 16.0f, 0.0f), 1.0f, SOUND_BOUMv, 0.15f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 10.0f, 0.0f), 14.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 10.0f, 0.0f), 14.0f)); obj->CreateShadowCircle(22.0f, 0.5f); } @@ -1861,7 +1861,7 @@ CObjectUPtr CObjectFactory::CreateRoot(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 3.0f, 11.0f, -3.0f), 2.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( -3.0f, 17.0f, 1.0f), 2.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( -3.0f, 23.0f, -1.0f), 2.0f, SOUND_BOUMv, 0.15f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 12.0f, 0.0f), 20.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 12.0f, 0.0f), 20.0f)); obj->CreateShadowCircle(30.0f, 0.5f); } @@ -1894,7 +1894,7 @@ CObjectUPtr CObjectFactory::CreateRoot(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 3.0f, 11.0f, -3.0f), 2.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( -3.0f, 17.0f, 1.0f), 2.0f, SOUND_BOUMv, 0.15f)); obj->AddCrashSphere(CrashSphere(Math::Vector( -3.0f, 23.0f, -1.0f), 2.0f, SOUND_BOUMv, 0.15f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 12.0f, 0.0f), 20.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 12.0f, 0.0f), 20.0f)); obj->CreateShadowCircle(30.0f, 0.5f); } @@ -1935,7 +1935,7 @@ CObjectUPtr CObjectFactory::CreateHome(const ObjectCreateParams& params) obj->SetZoom(0, 1.3f); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f, SOUND_BOUMs, 0.25f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 6.0f, 0.0f), 11.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 6.0f, 0.0f), 11.0f)); obj->CreateShadowCircle(16.0f, 0.5f); } @@ -2037,7 +2037,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) obj->SetAngleX(9, 0.2f); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 2.8f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(4.0f, 1.0f); } @@ -2069,7 +2069,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) obj->SetAngleX(9, -0.3f); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 2.8f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(4.0f, 1.0f); } @@ -2090,7 +2090,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) obj->SetAngleZ(1, -0.1f); obj->AddCrashSphere(CrashSphere(Math::Vector(1.0f, 2.8f, -1.0f), 5.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(1.0f, 5.0f, -1.0f), 10.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(1.0f, 5.0f, -1.0f), 10.0f)); obj->CreateShadowCircle(5.0f, 1.0f); } @@ -2098,7 +2098,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) if ( type == OBJECT_RUINmobilet2 ) // vehicle have caterpillars? { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 2.8f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(5.0f, 1.0f); } @@ -2106,7 +2106,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) if ( type == OBJECT_RUINmobiler1 ) // vehicle skating? { obj->AddCrashSphere(CrashSphere(Math::Vector(1.0f, 2.8f, -1.0f), 5.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(1.0f, 5.0f, -1.0f), 10.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(1.0f, 5.0f, -1.0f), 10.0f)); obj->CreateShadowCircle(5.0f, 1.0f); } @@ -2114,7 +2114,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) if ( type == OBJECT_RUINmobiler2 ) // vehicle skating? { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 10.0f)); obj->CreateShadowCircle(6.0f, 1.0f); } @@ -2130,7 +2130,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-11.0f, 2.0f, 4.0f), 3.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-11.0f, 2.0f, 10.0f), 3.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( -4.0f, 0.0f, 10.0f), 3.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 18.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 18.0f)); obj->CreateShadowCircle(20.0f, 0.7f); } @@ -2138,7 +2138,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) if ( type == OBJECT_RUINdoor ) // converter holder? { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 6.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 6.0f)); obj->CreateShadowCircle(6.0f, 1.0f); } @@ -2146,7 +2146,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) if ( type == OBJECT_RUINsupport ) // radar holder? { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f)); obj->CreateShadowCircle(3.0f, 1.0f); } @@ -2154,7 +2154,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) if ( type == OBJECT_RUINradar ) // radar base? { obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 5.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 6.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 6.0f)); obj->CreateShadowCircle(6.0f, 1.0f); } @@ -2165,7 +2165,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector(-10.0f, 0.0f, 4.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(-10.0f, 0.0f, -4.0f), 5.0f, SOUND_BOUMm, 0.45f)); -//? obj->SetGlobalSphere(Math::Vector(-3.0f, 0.0f, 0.0f), 14.0f); +//? obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(-3.0f, 0.0f, 0.0f), 14.0f)); } if ( type == OBJECT_RUINbase ) // base? @@ -2185,7 +2185,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 31.0f, 15.0f, -13.0f), 3.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 21.0f, 8.0f, -39.0f), 5.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 26.0f, 8.0f, -33.0f), 5.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 48.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 48.0f)); obj->CreateShadowCircle(40.0f, 1.0f); } @@ -2204,7 +2204,7 @@ CObjectUPtr CObjectFactory::CreateRuin(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( -9.0f, 7.0f, -21.0f), 8.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 21.0f, 7.0f, -9.0f), 8.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 9.0f, 7.0f, -21.0f), 8.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 35.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 0.0f, 0.0f), 35.0f)); obj->CreateShadowCircle(30.0f, 1.0f); } @@ -2414,7 +2414,7 @@ CObjectUPtr CObjectFactory::CreateApollo(const ObjectCreateParams& params) obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 5.0f, -11.0f), 3.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector( 0.0f, 5.0f, 11.0f), 3.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 4.0f, 0.0f), 9.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 4.0f, 0.0f), 9.0f)); obj->CreateShadowCircle(16.0f, 0.5f); } diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp index 37d7bd7e..a8adbab8 100644 --- a/src/object/old_object.cpp +++ b/src/object/old_object.cpp @@ -297,8 +297,6 @@ COldObject::COldObject(int id) m_cmdLine.clear(); DeleteAllCrashSpheres(); - m_globalSpherePos = Math::Vector(0.0f, 0.0f, 0.0f); - m_globalSphereRadius = 0.0f; CBotClass* bc = CBotClass::Find("object"); if ( bc != 0 ) @@ -1088,23 +1086,10 @@ void COldObject::TransformCrashSphere(Math::Sphere& crashSphere) crashSphere.pos = Math::Transform(m_objectPart[0].matWorld, crashSphere.pos); } -// Specifies the global sphere, relative to the object. - -void COldObject::SetGlobalSphere(Math::Vector pos, float radius) +void COldObject::TransformCameraCollisionSphere(Math::Sphere& collisionSphere) { - float zoom; - - zoom = GetZoomX(0); - m_globalSpherePos = pos; - m_globalSphereRadius = radius*zoom; -} - -// Returns the global sphere, in the world. - -void COldObject::GetGlobalSphere(Math::Vector &pos, float &radius) -{ - pos = Math::Transform(m_objectPart[0].matWorld, m_globalSpherePos); - radius = m_globalSphereRadius; + collisionSphere.pos = Math::Transform(m_objectPart[0].matWorld, collisionSphere.pos); + collisionSphere.radius *= GetZoomX(0); } diff --git a/src/object/old_object.h b/src/object/old_object.h index eb545c25..be7b4aef 100644 --- a/src/object/old_object.h +++ b/src/object/old_object.h @@ -112,8 +112,6 @@ public: int GetShadowLight() override; int GetEffectLight() override; - void SetGlobalSphere(Math::Vector pos, float radius) override; - void GetGlobalSphere(Math::Vector &pos, float &radius) override; void SetShieldRadius(float radius) override; float GetShieldRadius() override; @@ -324,6 +322,7 @@ protected: bool UpdateTransformObject(); void UpdateSelectParticle(); void TransformCrashSphere(Math::Sphere &crashSphere) override; + void TransformCameraCollisionSphere(Math::Sphere& collisionSphere) override; protected: Gfx::CEngine* m_engine; @@ -396,8 +395,6 @@ protected: float m_param; int m_team; - Math::Vector m_globalSpherePos; - float m_globalSphereRadius; Math::Sphere m_jostlingSphere; float m_shieldRadius; diff --git a/src/object/old_object_interface.h b/src/object/old_object_interface.h index 72796431..7eab6069 100644 --- a/src/object/old_object_interface.h +++ b/src/object/old_object_interface.h @@ -98,8 +98,6 @@ public: virtual int GetShadowLight() = 0; virtual int GetEffectLight() = 0; - virtual void SetGlobalSphere(Math::Vector pos, float radius) = 0; - virtual void GetGlobalSphere(Math::Vector &pos, float &radius) = 0; virtual void SetShieldRadius(float radius) = 0; virtual float GetShieldRadius() = 0; diff --git a/src/object/subclass/exchange_post.cpp b/src/object/subclass/exchange_post.cpp index 1837d250..a623d326 100644 --- a/src/object/subclass/exchange_post.cpp +++ b/src/object/subclass/exchange_post.cpp @@ -87,7 +87,7 @@ std::unique_ptr CExchangePost::Create( obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 3.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); obj->AddCrashSphere(CrashSphere(Math::Vector(0.0f, 11.0f, 0.0f), 6.0f, SOUND_BOUMm, 0.45f)); - obj->SetGlobalSphere(Math::Vector(0.0f, 5.0f, 0.0f), 6.0f); + obj->SetCameraCollisionSphere(Math::Sphere(Math::Vector(0.0f, 5.0f, 0.0f), 6.0f)); obj->CreateShadowCircle(8.0f, 1.0f);