summaryrefslogtreecommitdiffstats
path: root/src/entities/Physical.cpp
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2020-04-19 18:34:08 +0200
committerFilip Gawin <filip.gawin@zoho.com>2020-04-20 18:18:46 +0200
commit370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96 (patch)
tree5f5c66a542d7a121a7db88fed66e31f2a263b206 /src/entities/Physical.cpp
parentMerge pull request #474 from Nick007J/master (diff)
downloadre3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar
re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.gz
re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.bz2
re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.lz
re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.xz
re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.zst
re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.zip
Diffstat (limited to '')
-rw-r--r--src/entities/Physical.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index ec4543f6..a27e4d7b 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -457,7 +457,7 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &
{
float compression = 1.0f - springRatio;
if(compression > 0.0f){
- float step = min(CTimer::GetTimeStep(), 3.0f);
+ float step = Min(CTimer::GetTimeStep(), 3.0f);
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
ApplyMoveForce(springDir*impulse);
ApplyTurnForce(springDir*impulse, point);
@@ -471,12 +471,12 @@ CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &poin
{
float speedA = DotProduct(speed, springDir);
float speedB = DotProduct(GetSpeed(point), springDir);
- float step = min(CTimer::GetTimeStep(), 3.0f);
+ float step = Min(CTimer::GetTimeStep(), 3.0f);
float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f;
// what is this?
float a = m_fTurnMass / ((point.MagnitudeSqr() + 1.0f) * 2.0f * m_fMass);
- a = min(a, 1.0f);
+ a = Min(a, 1.0f);
float b = Abs(impulse / (speedB * m_fMass));
if(a < b)
impulse *= a/b;
@@ -646,7 +646,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
// positive if B is moving towards A
// not interested in how much B moves into A apparently?
// only interested in cases where A collided into B
- speedB = max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
+ speedB = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
// A has moved into B
if(speedA < speedB){
if(!A->bHasHitWall)
@@ -1147,18 +1147,18 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
CVector dir = A->GetPosition() - B->GetPosition();
dir.Normalise();
if(dir.z < 0.0f && dir.z < A->GetForward().z && dir.z < A->GetRight().z)
- dir.z = min(0.0f, min(A->GetForward().z, A->GetRight().z));
+ dir.z = Min(0.0f, Min(A->GetForward().z, A->GetRight().z));
shift += dir * colpoints[mostColliding].depth * 0.5f;
}else if(A->IsPed() && B->IsVehicle() && ((CVehicle*)B)->IsBoat()){
CVector dir = colpoints[mostColliding].normal;
- float f = min(Abs(dir.z), 0.9f);
+ float f = Min(Abs(dir.z), 0.9f);
dir.z = 0.0f;
dir.Normalise();
shift += dir * colpoints[mostColliding].depth / (1.0f - f);
boat = B;
}else if(B->IsPed() && A->IsVehicle() && ((CVehicle*)A)->IsBoat()){
CVector dir = colpoints[mostColliding].normal * -1.0f;
- float f = min(Abs(dir.z), 0.9f);
+ float f = Min(Abs(dir.z), 0.9f);
dir.z = 0.0f;
dir.Normalise();
B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f);
@@ -1246,7 +1246,7 @@ collision:
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
}
}else if(A->bHasContacted){
CVector savedMoveFriction = A->m_vecMoveFriction;
@@ -1268,7 +1268,7 @@ collision:
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
A->bHasContacted = true;
@@ -1301,7 +1301,7 @@ collision:
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
A->bHasContacted = true;
@@ -1328,7 +1328,7 @@ collision:
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
A->bHasContacted = true;
@@ -1506,7 +1506,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, Max(turnSpeedDiff, moveSpeedDiff));
}
}else{
for(i = 0; i < numCollisions; i++){
@@ -1527,7 +1527,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, Max(turnSpeedDiff, moveSpeedDiff));
float adhesion = CSurfaceTable::GetAdhesiveLimit(aColPoints[i]) / numCollisions;
@@ -1545,7 +1545,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
else if(A->GetUp().z > 0.3f)
adhesion = 0.0f;
else
- adhesion *= min(5.0f, 0.03f*impulseA + 1.0f);
+ adhesion *= Min(5.0f, 0.03f*impulseA + 1.0f);
}
if(A->ApplyFriction(adhesion, aColPoints[i]))
@@ -1594,7 +1594,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
}
}else if(A->bHasContacted){
CVector savedMoveFriction = A->m_vecMoveFriction;
@@ -1619,7 +1619,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
A->bHasContacted = true;
@@ -1655,7 +1655,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
A->bHasContacted = true;
@@ -1685,7 +1685,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
- DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
+ DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
A->bHasContacted = true;
@@ -1831,7 +1831,7 @@ CPhysical::ProcessCollision(void)
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
if(ped->IsPlayer())
- n = max(NUMSTEPS(0.2f), 2.0f);
+ n = Max(NUMSTEPS(0.2f), 2.0f);
else
n = NUMSTEPS(0.3f);
step = savedTimeStep / n;
@@ -1852,7 +1852,7 @@ CPhysical::ProcessCollision(void)
speedDown = Multiply3x3(GetMatrix(), speedDown);
speedUp = GetSpeed(speedUp);
speedDown = GetSpeed(speedDown);
- distSq = max(speedUp.MagnitudeSqr(), speedDown.MagnitudeSqr()) * sq(CTimer::GetTimeStep());
+ distSq = Max(speedUp.MagnitudeSqr(), speedDown.MagnitudeSqr()) * sq(CTimer::GetTimeStep());
if(distSq >= sq(0.3f)){
n = NUMSTEPS(0.3f);
step = savedTimeStep / n;