diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/audio/AudioManager.cpp | 8 | ||||
-rw-r--r-- | src/control/CarCtrl.cpp | 2 | ||||
-rw-r--r-- | src/control/PathFind.cpp | 2 | ||||
-rw-r--r-- | src/core/Collision.cpp | 8 | ||||
-rw-r--r-- | src/core/Collision.h | 39 | ||||
-rw-r--r-- | src/core/FileLoader.cpp | 2 | ||||
-rw-r--r-- | src/core/TempColModels.cpp | 52 | ||||
-rw-r--r-- | src/core/World.cpp | 8 | ||||
-rw-r--r-- | src/core/World.h | 4 | ||||
-rw-r--r-- | src/entities/Physical.cpp | 4 | ||||
-rw-r--r-- | src/modelinfo/PedModelInfo.cpp | 8 | ||||
-rw-r--r-- | src/objects/Object.cpp | 16 | ||||
-rw-r--r-- | src/objects/Object.h | 59 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 4 |
14 files changed, 121 insertions, 95 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 0f4281dc..ec520eaa 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -609,10 +609,9 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d float newSoundIntensity; if (soundIntensity <= 0.0f) return 0; - if ((soundIntensity * 0.2f) <= distance) { - newSoundIntensity = soundIntensity * 0.2f; + newSoundIntensity = soundIntensity / 5.0f; + if (newSoundIntensity <= distance) emittingVolume = sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume; - } return emittingVolume; } @@ -3611,11 +3610,10 @@ cAudioManager::ProcessActiveQueues() SampleManager.SetChannel3DDistances(j, sample.m_fSoundIntensity, 0.25f * sample.m_fSoundIntensity); } SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag); - continue; + break; } sample.m_bIsProcessed = false; m_asActiveSamples[j].m_bIsProcessed = false; - break; } } } diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 6eac44df..a4769d56 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -356,7 +356,7 @@ CCarCtrl::GenerateOneRandomCar() pCar->m_bSirenOrAlarm = true; pCar->AutoPilot.m_nNextPathNodeInfo = connectionId; pCar->AutoPilot.m_nNextLane = pCar->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad; - CColBox* boundingBox = &CModelInfo::GetModelInfo(pCar->GetModelIndex())->GetColModel()->boundingBox; + CBox* boundingBox = &CModelInfo::GetModelInfo(pCar->GetModelIndex())->GetColModel()->boundingBox; float carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2; float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D(); /* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */ diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index a5493a8f..22221e73 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -197,7 +197,7 @@ CPedPath::AddBlockadeSectorList(CPtrList& list, CPedPathNode(*pathNodes)[40], CV void CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition) { - const CColBox& boundingBox = pEntity->GetColModel()->boundingBox; + const CBox& boundingBox = pEntity->GetColModel()->boundingBox; const float fBoundMaxY = boundingBox.max.y + 0.3f; const float fBoundMinY = boundingBox.min.y - 0.3f; const float fBoundMaxX = boundingBox.max.x + 0.3f; diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index 61cb14db..48abbd9a 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -130,14 +130,14 @@ CCollision::LoadCollisionScreen(eLevelName level) bool -CCollision::TestSphereSphere(const CColSphere &s1, const CColSphere &s2) +CCollision::TestSphereSphere(const CSphere &s1, const CSphere &s2) { float d = s1.radius + s2.radius; return (s1.center - s2.center).MagnitudeSqr() < d*d; } bool -CCollision::TestSphereBox(const CColSphere &sph, const CColBox &box) +CCollision::TestSphereBox(const CSphere &sph, const CBox &box) { if(sph.center.x + sph.radius < box.min.x) return false; if(sph.center.x - sph.radius > box.max.x) return false; @@ -149,7 +149,7 @@ CCollision::TestSphereBox(const CColSphere &sph, const CColBox &box) } bool -CCollision::TestLineBox(const CColLine &line, const CColBox &box) +CCollision::TestLineBox(const CColLine &line, const CBox &box) { float t, x, y, z; // If either line point is in the box, we have a collision @@ -234,7 +234,7 @@ CCollision::TestLineBox(const CColLine &line, const CColBox &box) } bool -CCollision::TestVerticalLineBox(const CColLine &line, const CColBox &box) +CCollision::TestVerticalLineBox(const CColLine &line, const CBox &box) { if(line.p0.x <= box.min.x) return false; if(line.p0.y <= box.min.y) return false; diff --git a/src/core/Collision.h b/src/core/Collision.h index 18fad76b..4b0c2fb9 100644 --- a/src/core/Collision.h +++ b/src/core/Collision.h @@ -10,26 +10,37 @@ #define MAX_COLLISION_POINTS 32 #endif -struct CColSphere +struct CSphere { CVector center; float radius; + void Set(float radius, const CVector ¢er) { this->center = center; this->radius = radius; } +}; + +struct CBox +{ + CVector min; + CVector max; + CVector GetSize(void) { return max - min; } + void Set(const CVector &min, const CVector &max) { this->min = min; this->max = max; } +}; + +struct CColSphere : public CSphere +{ uint8 surface; uint8 piece; void Set(float radius, const CVector ¢er, uint8 surf, uint8 piece); - void Set(float radius, const CVector ¢er) { this->center = center; this->radius = radius; } + using CSphere::Set; }; -struct CColBox +struct CColBox : public CBox { - CVector min; - CVector max; uint8 surface; uint8 piece; void Set(const CVector &min, const CVector &max, uint8 surf, uint8 piece); - CVector GetSize(void) { return max - min; } + using CBox::Set; }; struct CColLine @@ -85,15 +96,15 @@ struct CStoredCollPoly bool valid; }; +//--MIAMI: done struct struct CColModel { - // TODO(MIAMI): CSphere and CBox - CColSphere boundingSphere; - CColBox boundingBox; + CSphere boundingSphere; + CBox boundingBox; int16 numSpheres; - int16 numLines; int16 numBoxes; int16 numTriangles; + int8 numLines; uint8 level; // colstore slot but probably still named level bool ownsCollisionVolumes; CColSphere *spheres; @@ -133,10 +144,10 @@ public: static void CalculateTrianglePlanes(CColModel *model); // all these return true if there's a collision - static bool TestSphereSphere(const CColSphere &s1, const CColSphere &s2); - static bool TestSphereBox(const CColSphere &sph, const CColBox &box); - static bool TestLineBox(const CColLine &line, const CColBox &box); - static bool TestVerticalLineBox(const CColLine &line, const CColBox &box); + static bool TestSphereSphere(const CSphere &s1, const CSphere &s2); + static bool TestSphereBox(const CSphere &sph, const CBox &box); + static bool TestLineBox(const CColLine &line, const CBox &box); + static bool TestVerticalLineBox(const CColLine &line, const CBox &box); static bool TestLineTriangle(const CColLine &line, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane); static bool TestLineSphere(const CColLine &line, const CColSphere &sph); static bool TestSphereTriangle(const CColSphere &sphere, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane); diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 9e7423f4..87cba5eb 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -193,6 +193,8 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot) CFileMgr::CloseFile(fd); } + +//--MIAMI: done bool CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlot) { diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp index 79d6252b..70ded11b 100644 --- a/src/core/TempColModels.cpp +++ b/src/core/TempColModels.cpp @@ -41,13 +41,13 @@ CTempColModels::Initialise(void) int i; - ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0); + ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); + ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f)); ms_colModelBBox.level = LEVEL_NONE; for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) { - ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0); + ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); + ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f)); ms_colModelCutObj[i].level = LEVEL_NONE; } @@ -69,8 +69,8 @@ CTempColModels::Initialise(void) s_aPedSpheres[i].piece = 0; } - ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f), SURFACE_DEFAULT, 0); + ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f)); + ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f)); SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres); // Ped 2 Spheres @@ -88,8 +88,8 @@ CTempColModels::Initialise(void) s_aPed2Spheres[i].piece = 0; } - ms_colModelPed2.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelPed2.boundingBox.Set(CVector(-0.7f, -0.7f, -1.2f), CVector(0.7f, 0.7f, 0.0f), SURFACE_DEFAULT, 0); + ms_colModelPed2.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); + ms_colModelPed2.boundingBox.Set(CVector(-0.7f, -0.7f, -1.2f), CVector(0.7f, 0.7f, 0.0f)); SET_COLMODEL_SPHERES(ms_colModelPed2, s_aPed2Spheres); @@ -114,8 +114,8 @@ CTempColModels::Initialise(void) s_aPedGSpheres[2].piece = 0; s_aPedGSpheres[3].piece = 6; - ms_colModelPedGroundHit.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelPedGroundHit.boundingBox.Set(CVector(-0.4f, -1.0f, -1.25f), CVector(0.4f, 1.2f, -0.5f), SURFACE_DEFAULT, 0); + ms_colModelPedGroundHit.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); + ms_colModelPedGroundHit.boundingBox.Set(CVector(-0.4f, -1.0f, -1.25f), CVector(0.4f, 1.2f, -0.5f)); SET_COLMODEL_SPHERES(ms_colModelPedGroundHit, s_aPedGSpheres); @@ -134,8 +134,8 @@ CTempColModels::Initialise(void) s_aDoorSpheres[i].piece = 0; } - ms_colModelDoor1.boundingSphere.Set(1.5f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelDoor1.boundingBox.Set(CVector(-0.3f, 0.0f, -0.6f), CVector(0.3f, -1.2f, 0.6f), SURFACE_DEFAULT, 0); + ms_colModelDoor1.boundingSphere.Set(1.5f, CVector(0.0f, -0.6f, 0.0f)); + ms_colModelDoor1.boundingBox.Set(CVector(-0.3f, 0.0f, -0.6f), CVector(0.3f, -1.2f, 0.6f)); SET_COLMODEL_SPHERES(ms_colModelDoor1, s_aDoorSpheres); @@ -154,8 +154,8 @@ CTempColModels::Initialise(void) s_aBumperSpheres[i].piece = 0; } - ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f), SURFACE_DEFAULT, 0); + ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f)); + ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f)); SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres); @@ -174,8 +174,8 @@ CTempColModels::Initialise(void) s_aPanelSpheres[i].piece = 0; } - ms_colModelPanel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelPanel1.boundingBox.Set(CVector(-0.3f, -0.6f, -0.15f), CVector(0.3f, 0.6f, 0.15f), SURFACE_DEFAULT, 0); + ms_colModelPanel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f)); + ms_colModelPanel1.boundingBox.Set(CVector(-0.3f, -0.6f, -0.15f), CVector(0.3f, 0.6f, 0.15f)); SET_COLMODEL_SPHERES(ms_colModelPanel1, s_aPanelSpheres); @@ -194,8 +194,8 @@ CTempColModels::Initialise(void) s_aBonnetSpheres[i].piece = 0; } - ms_colModelBonnet1.boundingSphere.Set(1.7f, CVector(0.0f, 0.5f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelBonnet1.boundingBox.Set(CVector(-0.7f, -0.2f, -0.3f), CVector(0.7f, 1.2f, 0.3f), SURFACE_DEFAULT, 0); + ms_colModelBonnet1.boundingSphere.Set(1.7f, CVector(0.0f, 0.5f, 0.0f)); + ms_colModelBonnet1.boundingBox.Set(CVector(-0.7f, -0.2f, -0.3f), CVector(0.7f, 1.2f, 0.3f)); SET_COLMODEL_SPHERES(ms_colModelBonnet1, s_aBonnetSpheres); @@ -214,8 +214,8 @@ CTempColModels::Initialise(void) s_aBootSpheres[i].piece = 0; } - ms_colModelBoot1.boundingSphere.Set(1.4f, CVector(0.0f, -0.4f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelBoot1.boundingBox.Set(CVector(-0.7f, -0.9f, -0.3f), CVector(0.7f, 0.2f, 0.3f), SURFACE_DEFAULT, 0); + ms_colModelBoot1.boundingSphere.Set(1.4f, CVector(0.0f, -0.4f, 0.0f)); + ms_colModelBoot1.boundingBox.Set(CVector(-0.7f, -0.9f, -0.3f), CVector(0.7f, 0.2f, 0.3f)); SET_COLMODEL_SPHERES(ms_colModelBoot1, s_aBootSpheres); @@ -236,8 +236,8 @@ CTempColModels::Initialise(void) s_aWheelSpheres[i].piece = 0; } - ms_colModelWheel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelWheel1.boundingBox.Set(CVector(-0.7f, -0.4f, -0.4f), CVector(0.7f, 0.4f, 0.4f), SURFACE_DEFAULT, 0); + ms_colModelWheel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f)); + ms_colModelWheel1.boundingBox.Set(CVector(-0.7f, -0.4f, -0.4f), CVector(0.7f, 0.4f, 0.4f)); SET_COLMODEL_SPHERES(ms_colModelWheel1, s_aWheelSpheres); @@ -258,8 +258,8 @@ CTempColModels::Initialise(void) s_aBodyPartSpheres1[i].piece = 0; } - ms_colModelBodyPart1.boundingSphere.Set(0.7f, CVector(0.4f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelBodyPart1.boundingBox.Set(CVector(-0.3f, -0.3f, -0.3f), CVector(1.1f, 0.3f, 0.3f), SURFACE_DEFAULT, 0); + ms_colModelBodyPart1.boundingSphere.Set(0.7f, CVector(0.4f, 0.0f, 0.0f)); + ms_colModelBodyPart1.boundingBox.Set(CVector(-0.3f, -0.3f, -0.3f), CVector(1.1f, 0.3f, 0.3f)); SET_COLMODEL_SPHERES(ms_colModelBodyPart1, s_aBodyPartSpheres1); @@ -280,8 +280,8 @@ CTempColModels::Initialise(void) s_aBodyPartSpheres2[i].piece = 0; } - ms_colModelBodyPart2.boundingSphere.Set(0.5f, CVector(0.25f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); - ms_colModelBodyPart2.boundingBox.Set(CVector(-0.2f, -0.2f, -0.2f), CVector(0.7f, 0.2f, 0.2f), SURFACE_DEFAULT, 0); + ms_colModelBodyPart2.boundingSphere.Set(0.5f, CVector(0.25f, 0.0f, 0.0f)); + ms_colModelBodyPart2.boundingBox.Set(CVector(-0.2f, -0.2f, -0.2f), CVector(0.7f, 0.2f, 0.2f)); SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2); diff --git a/src/core/World.cpp b/src/core/World.cpp index c884f1ed..29505481 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -920,6 +920,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad bool ignoreSomeObjects) { static CColModel sphereCol; + CColSphere sphere; sphereCol.boundingSphere.center.x = 0.0f; sphereCol.boundingSphere.center.y = 0.0f; @@ -932,7 +933,8 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad sphereCol.boundingBox.max.y = radius; sphereCol.boundingBox.max.z = radius; sphereCol.numSpheres = 1; - sphereCol.spheres = &sphereCol.boundingSphere; + sphere.Set(radius, CVector(0.0f, 0.0f, 0.0f)); + sphereCol.spheres = &sphere; sphereCol.numLines = 0; sphereCol.numBoxes = 0; sphereCol.numTriangles = 0; @@ -1201,7 +1203,7 @@ CWorld::FindObjectsIntersectingCubeSectorList(CPtrList &list, const CVector &vec } void -CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, const CMatrix &matrix, +CWorld::FindObjectsIntersectingAngledCollisionBox(const CBox &boundingBox, const CMatrix &matrix, const CVector &position, float fStartX, float fStartY, float fEndX, float fEndY, int16 *nEntitiesFound, int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles, bool bPeds, @@ -1261,7 +1263,7 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, co } void -CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList &list, const CColBox &boundingBox, +CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList &list, const CBox &boundingBox, const CMatrix &matrix, const CVector &position, int16 *nEntitiesFound, int16 maxEntitiesToFind, CEntity **aEntities) diff --git a/src/core/World.h b/src/core/World.h index 372cd8b5..19d480ff 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -113,8 +113,8 @@ public: static void FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities); static void FindObjectsIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies); static void FindObjectsIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities); - static void FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool); - static void FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); + static void FindObjectsIntersectingAngledCollisionBox(const CBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool); + static void FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); static void FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bVehicles, bool bPeds, bool bObjects); static void FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 17a39070..bbe69167 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -1837,7 +1837,7 @@ CPhysical::ProcessCollision(void) step = savedTimeStep / n; }else if(IsObject()){ int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases; - if(responsecase == COLLRESPONSE_CHANGE_MODEL){ + if(responsecase == COLLRESPONSE_LAMPOST){ CVector speedUp = { 0.0f, 0.0f, 0.0f }; CVector speedDown = { 0.0f, 0.0f, 0.0f }; speedUp.z = GetBoundRadius(); @@ -1856,7 +1856,7 @@ CPhysical::ProcessCollision(void) n = NUMSTEPS(0.09f); step = savedTimeStep / n; } - }else if(responsecase == COLLRESPONSE_SPLIT_MODEL || responsecase == COLLRESPONSE_CHANGE_THEN_SMASH){ + }else if(responsecase == COLLRESPONSE_SMALLBOX || responsecase == COLLRESPONSE_FENCEPART){ if(distSq >= sq(0.15f)){ n = NUMSTEPS(0.15f); step = savedTimeStep / n; diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 47080e23..7dfadf06 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -255,13 +255,13 @@ CPedModelInfo::CreateHitColModel(void) colmodel->spheres = spheres; colmodel->numSpheres = NUMPEDINFONODES; center.x = center.y = center.z = 0.0f; - colmodel->boundingSphere.Set(2.0f, center, 0, 0); + colmodel->boundingSphere.Set(2.0f, center); CVector min, max; min.x = min.y = -0.5f; min.z = -1.2f; max.x = max.y = 0.5f; max.z = 1.2f; - colmodel->boundingBox.Set(min, max, 0, 0); + colmodel->boundingBox.Set(min, max); colmodel->level = LEVEL_NONE; m_hitColModel = colmodel; } @@ -339,13 +339,13 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump) colmodel->spheres = spheres; colmodel->numSpheres = NUMPEDINFONODES; center.x = center.y = center.z = 0.0f; - colmodel->boundingSphere.Set(2.0f, center, 0, 0); + colmodel->boundingSphere.Set(2.0f, center); CVector min, max; min.x = min.y = -0.5f; min.z = -1.2f; max.x = max.y = 0.5f; max.z = 1.2f; - colmodel->boundingBox.Set(min, max, 0, 0); + colmodel->boundingBox.Set(min, max); colmodel->level = LEVEL_NONE; m_hitColModel = colmodel; } diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index fb1ab1a7..a5896975 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -174,12 +174,12 @@ CObject::ObjectDamage(float amount) const float fDirectionZ = 0.0002f * amount; switch (m_nCollisionDamageEffect) { - case COLDAMAGE_EFFECT_CHANGE_MODEL: + case DAMAGE_EFFECT_CHANGE_MODEL: bRenderDamaged = true; break; - case COLDAMAGE_EFFECT_SPLIT_MODEL: + case DAMAGE_EFFECT_SPLIT_MODEL: break; - case COLDAMAGE_EFFECT_SMASH_COMPLETELY: + case DAMAGE_EFFECT_SMASH_COMPLETELY: bIsVisible = false; bUsesCollision = false; bIsStatic = true; @@ -187,7 +187,7 @@ CObject::ObjectDamage(float amount) SetMoveSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f); break; - case COLDAMAGE_EFFECT_CHANGE_THEN_SMASH: + case DAMAGE_EFFECT_CHANGE_THEN_SMASH: if (!bRenderDamaged) { bRenderDamaged = true; } @@ -200,7 +200,7 @@ CObject::ObjectDamage(float amount) SetTurnSpeed(0.0f, 0.0f, 0.0f); } break; - case COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY: { + case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: { bIsVisible = false; bUsesCollision = false; bIsStatic = true; @@ -223,7 +223,7 @@ CObject::ObjectDamage(float amount) PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos); break; } - case COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: { + case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: { bIsVisible = false; bUsesCollision = false; bIsStatic = true; @@ -246,7 +246,7 @@ CObject::ObjectDamage(float amount) PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos); break; } - case COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: { + case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: { bIsVisible = false; bUsesCollision = false; bIsStatic = true; @@ -271,7 +271,7 @@ CObject::ObjectDamage(float amount) PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos); break; } - case COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: { + case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: { bIsVisible = false; bUsesCollision = false; bIsStatic = true; diff --git a/src/objects/Object.h b/src/objects/Object.h index 319ec4bc..2afb621c 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -10,31 +10,44 @@ enum { CUTSCENE_OBJECT = 4, }; -enum { - COLDAMAGE_EFFECT_NONE = 0, - COLDAMAGE_EFFECT_CHANGE_MODEL = 1, - COLDAMAGE_EFFECT_SPLIT_MODEL = 2, - COLDAMAGE_EFFECT_SMASH_COMPLETELY = 3, - COLDAMAGE_EFFECT_CHANGE_THEN_SMASH = 4, - COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY = 50, - COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY = 60, - COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY = 70, - COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY = 80, -}; - -enum { +enum CollisionSpecialResponseCase +{ COLLRESPONSE_NONE, - COLLRESPONSE_CHANGE_MODEL, - COLLRESPONSE_SPLIT_MODEL, - COLLRESPONSE_SMASH_COMPLETELY, - COLLRESPONSE_CHANGE_THEN_SMASH, - COLLRESPONSE_UNKNOWN5, - - COLLRESPONSE_SMASH_CARDBOARD_COMPLETELY = 50, - COLLRESPONSE_SMASH_WOODENBOX_COMPLETELY = 60, - COLLRESPONSE_SMASH_TRAFFICCONE_COMPLETELY = 70, - COLLRESPONSE_SMASH_BARPOST_COMPLETELY = 80, + COLLRESPONSE_LAMPOST, + COLLRESPONSE_SMALLBOX, + COLLRESPONSE_BIGBOX, + COLLRESPONSE_FENCEPART, + COLLRESPONSE_UNKNOWN5 +}; +enum CollisionDamageEffect +{ + DAMAGE_EFFECT_NONE, + DAMAGE_EFFECT_CHANGE_MODEL, + DAMAGE_EFFECT_SPLIT_MODEL, + 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_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; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index c8b0b922..7286e677 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -9548,7 +9548,7 @@ CPed::ProcessControl(void) { CBaseModelInfo *collidingModel = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex()); CColModel *collidingCol = collidingModel->GetColModel(); - if (collidingEnt->IsObject() && ((CObject*)collidingEnt)->m_nSpecialCollisionResponseCases != COLLRESPONSE_CHANGE_THEN_SMASH + if (collidingEnt->IsObject() && ((CObject*)collidingEnt)->m_nSpecialCollisionResponseCases != COLLRESPONSE_FENCEPART || collidingCol->boundingBox.max.x < 3.0f && collidingCol->boundingBox.max.y < 3.0f) { @@ -16931,7 +16931,7 @@ CPed::SpawnFlyingComponent(int pedNode, int8 direction) obj->ObjectCreatedBy = TEMP_OBJECT; obj->bIsStatic = false; obj->bIsPickup = false; - obj->m_nSpecialCollisionResponseCases = COLLRESPONSE_SPLIT_MODEL; + obj->m_nSpecialCollisionResponseCases = COLLRESPONSE_SMALLBOX; // life time - the more objects the are, the shorter this one will live CObject::nNoTempObjects++; |