1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-24 17:50:00 +00:00

Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-05-06 19:04:52 +03:00
commit d5e76471ae
14 changed files with 119 additions and 93 deletions

View file

@ -609,10 +609,9 @@ cAudioManager::ComputeVolume(uint8 emittingVolume, float soundIntensity, float d
float newSoundIntensity; float newSoundIntensity;
if (soundIntensity <= 0.0f) if (soundIntensity <= 0.0f)
return 0; return 0;
if ((soundIntensity * 0.2f) <= distance) { newSoundIntensity = soundIntensity / 5.0f;
newSoundIntensity = soundIntensity * 0.2f; if (newSoundIntensity <= distance)
emittingVolume = sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume; emittingVolume = sq((soundIntensity - newSoundIntensity - (distance - newSoundIntensity)) / (soundIntensity - newSoundIntensity)) * emittingVolume;
}
return emittingVolume; return emittingVolume;
} }
@ -3611,11 +3610,10 @@ cAudioManager::ProcessActiveQueues()
SampleManager.SetChannel3DDistances(j, sample.m_fSoundIntensity, 0.25f * sample.m_fSoundIntensity); SampleManager.SetChannel3DDistances(j, sample.m_fSoundIntensity, 0.25f * sample.m_fSoundIntensity);
} }
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag); SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
continue; break;
} }
sample.m_bIsProcessed = false; sample.m_bIsProcessed = false;
m_asActiveSamples[j].m_bIsProcessed = false; m_asActiveSamples[j].m_bIsProcessed = false;
break;
} }
} }
} }

View file

@ -356,7 +356,7 @@ CCarCtrl::GenerateOneRandomCar()
pCar->m_bSirenOrAlarm = true; pCar->m_bSirenOrAlarm = true;
pCar->AutoPilot.m_nNextPathNodeInfo = connectionId; pCar->AutoPilot.m_nNextPathNodeInfo = connectionId;
pCar->AutoPilot.m_nNextLane = pCar->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad; 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 carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2;
float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D(); 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. */ /* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */

View file

@ -197,7 +197,7 @@ CPedPath::AddBlockadeSectorList(CPtrList& list, CPedPathNode(*pathNodes)[40], CV
void void
CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *pPosition) 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 fBoundMaxY = boundingBox.max.y + 0.3f;
const float fBoundMinY = boundingBox.min.y - 0.3f; const float fBoundMinY = boundingBox.min.y - 0.3f;
const float fBoundMaxX = boundingBox.max.x + 0.3f; const float fBoundMaxX = boundingBox.max.x + 0.3f;

View file

@ -130,14 +130,14 @@ CCollision::LoadCollisionScreen(eLevelName level)
bool bool
CCollision::TestSphereSphere(const CColSphere &s1, const CColSphere &s2) CCollision::TestSphereSphere(const CSphere &s1, const CSphere &s2)
{ {
float d = s1.radius + s2.radius; float d = s1.radius + s2.radius;
return (s1.center - s2.center).MagnitudeSqr() < d*d; return (s1.center - s2.center).MagnitudeSqr() < d*d;
} }
bool 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.min.x) return false;
if(sph.center.x - sph.radius > box.max.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 bool
CCollision::TestLineBox(const CColLine &line, const CColBox &box) CCollision::TestLineBox(const CColLine &line, const CBox &box)
{ {
float t, x, y, z; float t, x, y, z;
// If either line point is in the box, we have a collision // 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 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.x <= box.min.x) return false;
if(line.p0.y <= box.min.y) return false; if(line.p0.y <= box.min.y) return false;

View file

@ -10,26 +10,37 @@
#define MAX_COLLISION_POINTS 32 #define MAX_COLLISION_POINTS 32
#endif #endif
struct CColSphere struct CSphere
{ {
CVector center; CVector center;
float radius; float radius;
void Set(float radius, const CVector &center) { 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 surface;
uint8 piece; uint8 piece;
void Set(float radius, const CVector &center, uint8 surf, uint8 piece); void Set(float radius, const CVector &center, uint8 surf, uint8 piece);
void Set(float radius, const CVector &center) { this->center = center; this->radius = radius; } using CSphere::Set;
}; };
struct CColBox struct CColBox : public CBox
{ {
CVector min;
CVector max;
uint8 surface; uint8 surface;
uint8 piece; uint8 piece;
void Set(const CVector &min, const CVector &max, uint8 surf, 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 struct CColLine
@ -85,15 +96,15 @@ struct CStoredCollPoly
bool valid; bool valid;
}; };
//--MIAMI: done struct
struct CColModel struct CColModel
{ {
// TODO(MIAMI): CSphere and CBox CSphere boundingSphere;
CColSphere boundingSphere; CBox boundingBox;
CColBox boundingBox;
int16 numSpheres; int16 numSpheres;
int16 numLines;
int16 numBoxes; int16 numBoxes;
int16 numTriangles; int16 numTriangles;
int8 numLines;
uint8 level; // colstore slot but probably still named level uint8 level; // colstore slot but probably still named level
bool ownsCollisionVolumes; bool ownsCollisionVolumes;
CColSphere *spheres; CColSphere *spheres;
@ -133,10 +144,10 @@ public:
static void CalculateTrianglePlanes(CColModel *model); static void CalculateTrianglePlanes(CColModel *model);
// all these return true if there's a collision // all these return true if there's a collision
static bool TestSphereSphere(const CColSphere &s1, const CColSphere &s2); static bool TestSphereSphere(const CSphere &s1, const CSphere &s2);
static bool TestSphereBox(const CColSphere &sph, const CColBox &box); static bool TestSphereBox(const CSphere &sph, const CBox &box);
static bool TestLineBox(const CColLine &line, const CColBox &box); static bool TestLineBox(const CColLine &line, const CBox &box);
static bool TestVerticalLineBox(const CColLine &line, const CColBox &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 TestLineTriangle(const CColLine &line, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);
static bool TestLineSphere(const CColLine &line, const CColSphere &sph); static bool TestLineSphere(const CColLine &line, const CColSphere &sph);
static bool TestSphereTriangle(const CColSphere &sphere, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane); static bool TestSphereTriangle(const CColSphere &sphere, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);

View file

@ -193,6 +193,8 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
CFileMgr::CloseFile(fd); CFileMgr::CloseFile(fd);
} }
//--MIAMI: done
bool bool
CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlot) CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlot)
{ {

View file

@ -41,13 +41,13 @@ CTempColModels::Initialise(void)
int i; int i;
ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.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), SURFACE_DEFAULT, 0); ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f));
ms_colModelBBox.level = LEVEL_NONE; ms_colModelBBox.level = LEVEL_NONE;
for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) { 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].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), SURFACE_DEFAULT, 0); 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; ms_colModelCutObj[i].level = LEVEL_NONE;
} }
@ -69,8 +69,8 @@ CTempColModels::Initialise(void)
s_aPedSpheres[i].piece = 0; s_aPedSpheres[i].piece = 0;
} }
ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
// Ped 2 Spheres // Ped 2 Spheres
@ -88,8 +88,8 @@ CTempColModels::Initialise(void)
s_aPed2Spheres[i].piece = 0; s_aPed2Spheres[i].piece = 0;
} }
ms_colModelPed2.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelPed2, s_aPed2Spheres);
@ -114,8 +114,8 @@ CTempColModels::Initialise(void)
s_aPedGSpheres[2].piece = 0; s_aPedGSpheres[2].piece = 0;
s_aPedGSpheres[3].piece = 6; s_aPedGSpheres[3].piece = 6;
ms_colModelPedGroundHit.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelPedGroundHit, s_aPedGSpheres);
@ -134,8 +134,8 @@ CTempColModels::Initialise(void)
s_aDoorSpheres[i].piece = 0; s_aDoorSpheres[i].piece = 0;
} }
ms_colModelDoor1.boundingSphere.Set(1.5f, CVector(0.0f, -0.6f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelDoor1, s_aDoorSpheres);
@ -154,8 +154,8 @@ CTempColModels::Initialise(void)
s_aBumperSpheres[i].piece = 0; s_aBumperSpheres[i].piece = 0;
} }
ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres);
@ -174,8 +174,8 @@ CTempColModels::Initialise(void)
s_aPanelSpheres[i].piece = 0; s_aPanelSpheres[i].piece = 0;
} }
ms_colModelPanel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelPanel1, s_aPanelSpheres);
@ -194,8 +194,8 @@ CTempColModels::Initialise(void)
s_aBonnetSpheres[i].piece = 0; s_aBonnetSpheres[i].piece = 0;
} }
ms_colModelBonnet1.boundingSphere.Set(1.7f, CVector(0.0f, 0.5f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelBonnet1, s_aBonnetSpheres);
@ -214,8 +214,8 @@ CTempColModels::Initialise(void)
s_aBootSpheres[i].piece = 0; s_aBootSpheres[i].piece = 0;
} }
ms_colModelBoot1.boundingSphere.Set(1.4f, CVector(0.0f, -0.4f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelBoot1, s_aBootSpheres);
@ -236,8 +236,8 @@ CTempColModels::Initialise(void)
s_aWheelSpheres[i].piece = 0; s_aWheelSpheres[i].piece = 0;
} }
ms_colModelWheel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelWheel1, s_aWheelSpheres);
@ -258,8 +258,8 @@ CTempColModels::Initialise(void)
s_aBodyPartSpheres1[i].piece = 0; s_aBodyPartSpheres1[i].piece = 0;
} }
ms_colModelBodyPart1.boundingSphere.Set(0.7f, CVector(0.4f, 0.0f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelBodyPart1, s_aBodyPartSpheres1);
@ -280,8 +280,8 @@ CTempColModels::Initialise(void)
s_aBodyPartSpheres2[i].piece = 0; s_aBodyPartSpheres2[i].piece = 0;
} }
ms_colModelBodyPart2.boundingSphere.Set(0.5f, CVector(0.25f, 0.0f, 0.0f), 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), SURFACE_DEFAULT, 0); 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); SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);

View file

@ -920,6 +920,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
bool ignoreSomeObjects) bool ignoreSomeObjects)
{ {
static CColModel sphereCol; static CColModel sphereCol;
CColSphere sphere;
sphereCol.boundingSphere.center.x = 0.0f; sphereCol.boundingSphere.center.x = 0.0f;
sphereCol.boundingSphere.center.y = 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.y = radius;
sphereCol.boundingBox.max.z = radius; sphereCol.boundingBox.max.z = radius;
sphereCol.numSpheres = 1; sphereCol.numSpheres = 1;
sphereCol.spheres = &sphereCol.boundingSphere; sphere.Set(radius, CVector(0.0f, 0.0f, 0.0f));
sphereCol.spheres = &sphere;
sphereCol.numLines = 0; sphereCol.numLines = 0;
sphereCol.numBoxes = 0; sphereCol.numBoxes = 0;
sphereCol.numTriangles = 0; sphereCol.numTriangles = 0;
@ -1201,7 +1203,7 @@ CWorld::FindObjectsIntersectingCubeSectorList(CPtrList &list, const CVector &vec
} }
void 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, const CVector &position, float fStartX, float fStartY, float fEndX,
float fEndY, int16 *nEntitiesFound, int16 maxEntitiesToFind, float fEndY, int16 *nEntitiesFound, int16 maxEntitiesToFind,
CEntity **aEntities, bool bBuildings, bool bVehicles, bool bPeds, CEntity **aEntities, bool bBuildings, bool bVehicles, bool bPeds,
@ -1261,7 +1263,7 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, co
} }
void void
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList &list, const CColBox &boundingBox, CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList &list, const CBox &boundingBox,
const CMatrix &matrix, const CVector &position, const CMatrix &matrix, const CVector &position,
int16 *nEntitiesFound, int16 maxEntitiesToFind, int16 *nEntitiesFound, int16 maxEntitiesToFind,
CEntity **aEntities) CEntity **aEntities)

View file

@ -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 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 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 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 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 CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); 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 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); static void FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList);

View file

@ -1837,7 +1837,7 @@ CPhysical::ProcessCollision(void)
step = savedTimeStep / n; step = savedTimeStep / n;
}else if(IsObject()){ }else if(IsObject()){
int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases; int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases;
if(responsecase == COLLRESPONSE_CHANGE_MODEL){ if(responsecase == COLLRESPONSE_LAMPOST){
CVector speedUp = { 0.0f, 0.0f, 0.0f }; CVector speedUp = { 0.0f, 0.0f, 0.0f };
CVector speedDown = { 0.0f, 0.0f, 0.0f }; CVector speedDown = { 0.0f, 0.0f, 0.0f };
speedUp.z = GetBoundRadius(); speedUp.z = GetBoundRadius();
@ -1856,7 +1856,7 @@ CPhysical::ProcessCollision(void)
n = NUMSTEPS(0.09f); n = NUMSTEPS(0.09f);
step = savedTimeStep / n; 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)){ if(distSq >= sq(0.15f)){
n = NUMSTEPS(0.15f); n = NUMSTEPS(0.15f);
step = savedTimeStep / n; step = savedTimeStep / n;

View file

@ -255,13 +255,13 @@ CPedModelInfo::CreateHitColModel(void)
colmodel->spheres = spheres; colmodel->spheres = spheres;
colmodel->numSpheres = NUMPEDINFONODES; colmodel->numSpheres = NUMPEDINFONODES;
center.x = center.y = center.z = 0.0f; 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; CVector min, max;
min.x = min.y = -0.5f; min.x = min.y = -0.5f;
min.z = -1.2f; min.z = -1.2f;
max.x = max.y = 0.5f; max.x = max.y = 0.5f;
max.z = 1.2f; max.z = 1.2f;
colmodel->boundingBox.Set(min, max, 0, 0); colmodel->boundingBox.Set(min, max);
colmodel->level = LEVEL_NONE; colmodel->level = LEVEL_NONE;
m_hitColModel = colmodel; m_hitColModel = colmodel;
} }
@ -339,13 +339,13 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
colmodel->spheres = spheres; colmodel->spheres = spheres;
colmodel->numSpheres = NUMPEDINFONODES; colmodel->numSpheres = NUMPEDINFONODES;
center.x = center.y = center.z = 0.0f; 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; CVector min, max;
min.x = min.y = -0.5f; min.x = min.y = -0.5f;
min.z = -1.2f; min.z = -1.2f;
max.x = max.y = 0.5f; max.x = max.y = 0.5f;
max.z = 1.2f; max.z = 1.2f;
colmodel->boundingBox.Set(min, max, 0, 0); colmodel->boundingBox.Set(min, max);
colmodel->level = LEVEL_NONE; colmodel->level = LEVEL_NONE;
m_hitColModel = colmodel; m_hitColModel = colmodel;
} }

View file

@ -174,12 +174,12 @@ CObject::ObjectDamage(float amount)
const float fDirectionZ = 0.0002f * amount; const float fDirectionZ = 0.0002f * amount;
switch (m_nCollisionDamageEffect) switch (m_nCollisionDamageEffect)
{ {
case COLDAMAGE_EFFECT_CHANGE_MODEL: case DAMAGE_EFFECT_CHANGE_MODEL:
bRenderDamaged = true; bRenderDamaged = true;
break; break;
case COLDAMAGE_EFFECT_SPLIT_MODEL: case DAMAGE_EFFECT_SPLIT_MODEL:
break; break;
case COLDAMAGE_EFFECT_SMASH_COMPLETELY: case DAMAGE_EFFECT_SMASH_COMPLETELY:
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; bIsStatic = true;
@ -187,7 +187,7 @@ CObject::ObjectDamage(float amount)
SetMoveSpeed(0.0f, 0.0f, 0.0f); SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
break; break;
case COLDAMAGE_EFFECT_CHANGE_THEN_SMASH: case DAMAGE_EFFECT_CHANGE_THEN_SMASH:
if (!bRenderDamaged) { if (!bRenderDamaged) {
bRenderDamaged = true; bRenderDamaged = true;
} }
@ -200,7 +200,7 @@ CObject::ObjectDamage(float amount)
SetTurnSpeed(0.0f, 0.0f, 0.0f); SetTurnSpeed(0.0f, 0.0f, 0.0f);
} }
break; break;
case COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY: { case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; bIsStatic = true;
@ -223,7 +223,7 @@ CObject::ObjectDamage(float amount)
PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos); PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos);
break; break;
} }
case COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: { case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; bIsStatic = true;
@ -246,7 +246,7 @@ CObject::ObjectDamage(float amount)
PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos); PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos);
break; break;
} }
case COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: { case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; bIsStatic = true;
@ -271,7 +271,7 @@ CObject::ObjectDamage(float amount)
PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos); PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos);
break; break;
} }
case COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: { case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
bIsVisible = false; bIsVisible = false;
bUsesCollision = false; bUsesCollision = false;
bIsStatic = true; bIsStatic = true;

View file

@ -10,31 +10,44 @@ enum {
CUTSCENE_OBJECT = 4, CUTSCENE_OBJECT = 4,
}; };
enum { enum CollisionSpecialResponseCase
COLDAMAGE_EFFECT_NONE = 0, {
COLDAMAGE_EFFECT_CHANGE_MODEL = 1, COLLRESPONSE_NONE,
COLDAMAGE_EFFECT_SPLIT_MODEL = 2, COLLRESPONSE_LAMPOST,
COLDAMAGE_EFFECT_SMASH_COMPLETELY = 3, COLLRESPONSE_SMALLBOX,
COLDAMAGE_EFFECT_CHANGE_THEN_SMASH = 4, COLLRESPONSE_BIGBOX,
COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY = 50, COLLRESPONSE_FENCEPART,
COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY = 60, COLLRESPONSE_UNKNOWN5
COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY = 70,
COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY = 80,
}; };
enum { enum CollisionDamageEffect
COLLRESPONSE_NONE, {
COLLRESPONSE_CHANGE_MODEL, DAMAGE_EFFECT_NONE,
COLLRESPONSE_SPLIT_MODEL, DAMAGE_EFFECT_CHANGE_MODEL,
COLLRESPONSE_SMASH_COMPLETELY, DAMAGE_EFFECT_SPLIT_MODEL,
COLLRESPONSE_CHANGE_THEN_SMASH, DAMAGE_EFFECT_SMASH_AND_DAMAGE_TRAFFICLIGHTS,
COLLRESPONSE_UNKNOWN5,
COLLRESPONSE_SMASH_CARDBOARD_COMPLETELY = 50, DAMAGE_EFFECT_SMASH_COMPLETELY = 20,
COLLRESPONSE_SMASH_WOODENBOX_COMPLETELY = 60, DAMAGE_EFFECT_CHANGE_THEN_SMASH,
COLLRESPONSE_SMASH_TRAFFICCONE_COMPLETELY = 70,
COLLRESPONSE_SMASH_BARPOST_COMPLETELY = 80,
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; class CVehicle;

View file

@ -9548,7 +9548,7 @@ CPed::ProcessControl(void)
{ {
CBaseModelInfo *collidingModel = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex()); CBaseModelInfo *collidingModel = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex());
CColModel *collidingCol = collidingModel->GetColModel(); 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.x < 3.0f
&& collidingCol->boundingBox.max.y < 3.0f) { && collidingCol->boundingBox.max.y < 3.0f) {
@ -16931,7 +16931,7 @@ CPed::SpawnFlyingComponent(int pedNode, int8 direction)
obj->ObjectCreatedBy = TEMP_OBJECT; obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false; obj->bIsStatic = false;
obj->bIsPickup = 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 // life time - the more objects the are, the shorter this one will live
CObject::nNoTempObjects++; CObject::nNoTempObjects++;