mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-22 15:51:50 +01:00
fixes for CPhysical and friends
This commit is contained in:
parent
73ff01e35b
commit
21071edbfe
@ -56,39 +56,39 @@ int
|
||||
CSurfaceTable::GetAdhesionGroup(uint8 surfaceType)
|
||||
{
|
||||
switch(surfaceType){
|
||||
case SURFACE_0: return ADHESIVE_ROAD;
|
||||
case SURFACE_1: return ADHESIVE_ROAD;
|
||||
case SURFACE_2: return ADHESIVE_LOOSE;
|
||||
case SURFACE_3: return ADHESIVE_LOOSE;
|
||||
case SURFACE_4: return ADHESIVE_HARD;
|
||||
case SURFACE_5: return ADHESIVE_ROAD;
|
||||
case SURFACE_6: return ADHESIVE_HARD;
|
||||
case SURFACE_7: return ADHESIVE_HARD;
|
||||
case SURFACE_8: return ADHESIVE_HARD;
|
||||
case SURFACE_9: return ADHESIVE_HARD;
|
||||
case SURFACE_10: return ADHESIVE_HARD;
|
||||
case SURFACE_11: return ADHESIVE_HARD;
|
||||
case SURFACE_12: return ADHESIVE_HARD;
|
||||
case SURFACE_13: return ADHESIVE_HARD;
|
||||
case SURFACE_14: return ADHESIVE_HARD;
|
||||
case SURFACE_15: return ADHESIVE_HARD;
|
||||
case SURFACE_16: return ADHESIVE_HARD;
|
||||
case SURFACE_17: return ADHESIVE_RUBBER;
|
||||
case SURFACE_18: return ADHESIVE_LOOSE;
|
||||
case SURFACE_19: return ADHESIVE_WET;
|
||||
case SURFACE_20: return ADHESIVE_ROAD;
|
||||
case SURFACE_21: return ADHESIVE_ROAD;
|
||||
case SURFACE_22: return ADHESIVE_ROAD;
|
||||
case SURFACE_23: return ADHESIVE_RUBBER;
|
||||
case SURFACE_24: return ADHESIVE_HARD;
|
||||
case SURFACE_25: return ADHESIVE_LOOSE;
|
||||
case SURFACE_26: return ADHESIVE_LOOSE;
|
||||
case SURFACE_27: return ADHESIVE_HARD;
|
||||
case SURFACE_28: return ADHESIVE_HARD;
|
||||
case SURFACE_29: return ADHESIVE_RUBBER;
|
||||
case SURFACE_30: return ADHESIVE_LOOSE;
|
||||
case SURFACE_31: return ADHESIVE_HARD;
|
||||
case SURFACE_32: return ADHESIVE_HARD;
|
||||
case SURFACE_DEFAULT: return ADHESIVE_ROAD;
|
||||
case SURFACE_TARMAC: return ADHESIVE_ROAD;
|
||||
case SURFACE_GRASS: return ADHESIVE_LOOSE;
|
||||
case SURFACE_DIRT: return ADHESIVE_LOOSE;
|
||||
case SURFACE_DIRTTRACK: return ADHESIVE_HARD;
|
||||
case SURFACE_PAVEMENT: return ADHESIVE_ROAD;
|
||||
case SURFACE_METAL6: return ADHESIVE_HARD;
|
||||
case SURFACE_GLASS: return ADHESIVE_HARD;
|
||||
case SURFACE_SCAFFOLD: return ADHESIVE_HARD;
|
||||
case SURFACE_METAL_DOOR: return ADHESIVE_HARD;
|
||||
case SURFACE_BILLBOARD: return ADHESIVE_HARD;
|
||||
case SURFACE_STEEL: return ADHESIVE_HARD;
|
||||
case SURFACE_METAL_POLE: return ADHESIVE_HARD;
|
||||
case SURFACE_STREET_LIGHT: return ADHESIVE_HARD;
|
||||
case SURFACE_METAL14: return ADHESIVE_HARD;
|
||||
case SURFACE_METAL15: return ADHESIVE_HARD;
|
||||
case SURFACE_METAL_FENCE: return ADHESIVE_HARD;
|
||||
case SURFACE_FLESH: return ADHESIVE_RUBBER;
|
||||
case SURFACE_SAND: return ADHESIVE_LOOSE;
|
||||
case SURFACE_PUDDLE: return ADHESIVE_WET;
|
||||
case SURFACE_WOOD: return ADHESIVE_ROAD;
|
||||
case SURFACE_WOOD_BOX: return ADHESIVE_ROAD;
|
||||
case SURFACE_WOOD_PLANK: return ADHESIVE_ROAD;
|
||||
case SURFACE_TIRE: return ADHESIVE_RUBBER;
|
||||
case SURFACE_HARD24: return ADHESIVE_HARD;
|
||||
case SURFACE_HEDGE: return ADHESIVE_LOOSE;
|
||||
case SURFACE_STONE: return ADHESIVE_LOOSE;
|
||||
case SURFACE_METAL27: return ADHESIVE_HARD;
|
||||
case SURFACE_METAL28: return ADHESIVE_HARD;
|
||||
case SURFACE_RUBBER29: return ADHESIVE_RUBBER;
|
||||
case SURFACE_LOOSE30: return ADHESIVE_LOOSE;
|
||||
case SURFACE_BOLLARD: return ADHESIVE_HARD;
|
||||
case SURFACE_GATE: return ADHESIVE_HARD;
|
||||
default: return ADHESIVE_ROAD;
|
||||
}
|
||||
}
|
||||
@ -97,38 +97,38 @@ float
|
||||
CSurfaceTable::GetWetMultiplier(uint8 surfaceType)
|
||||
{
|
||||
switch(surfaceType){
|
||||
case SURFACE_0:
|
||||
case SURFACE_1:
|
||||
case SURFACE_4:
|
||||
case SURFACE_5:
|
||||
case SURFACE_8:
|
||||
case SURFACE_20:
|
||||
case SURFACE_21:
|
||||
case SURFACE_22:
|
||||
case SURFACE_25:
|
||||
case SURFACE_30:
|
||||
case SURFACE_31:
|
||||
case SURFACE_DEFAULT:
|
||||
case SURFACE_TARMAC:
|
||||
case SURFACE_DIRTTRACK:
|
||||
case SURFACE_PAVEMENT:
|
||||
case SURFACE_SCAFFOLD:
|
||||
case SURFACE_WOOD:
|
||||
case SURFACE_WOOD_BOX:
|
||||
case SURFACE_WOOD_PLANK:
|
||||
case SURFACE_HEDGE:
|
||||
case SURFACE_LOOSE30:
|
||||
case SURFACE_BOLLARD:
|
||||
return 1.0f - CWeather::WetRoads*0.25f;
|
||||
|
||||
case SURFACE_2:
|
||||
case SURFACE_6:
|
||||
case SURFACE_7:
|
||||
case SURFACE_9:
|
||||
case SURFACE_10:
|
||||
case SURFACE_11:
|
||||
case SURFACE_12:
|
||||
case SURFACE_13:
|
||||
case SURFACE_14:
|
||||
case SURFACE_15:
|
||||
case SURFACE_16:
|
||||
case SURFACE_17:
|
||||
case SURFACE_23:
|
||||
case SURFACE_24:
|
||||
case SURFACE_26:
|
||||
case SURFACE_27:
|
||||
case SURFACE_28:
|
||||
case SURFACE_29:
|
||||
case SURFACE_32:
|
||||
case SURFACE_GRASS:
|
||||
case SURFACE_METAL6:
|
||||
case SURFACE_GLASS:
|
||||
case SURFACE_METAL_DOOR:
|
||||
case SURFACE_BILLBOARD:
|
||||
case SURFACE_STEEL:
|
||||
case SURFACE_METAL_POLE:
|
||||
case SURFACE_STREET_LIGHT:
|
||||
case SURFACE_METAL14:
|
||||
case SURFACE_METAL15:
|
||||
case SURFACE_METAL_FENCE:
|
||||
case SURFACE_FLESH:
|
||||
case SURFACE_TIRE:
|
||||
case SURFACE_HARD24:
|
||||
case SURFACE_STONE:
|
||||
case SURFACE_METAL27:
|
||||
case SURFACE_METAL28:
|
||||
case SURFACE_RUBBER29:
|
||||
case SURFACE_GATE:
|
||||
return 1.0f - CWeather::WetRoads*0.4f;
|
||||
|
||||
default:
|
||||
|
@ -1,47 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
SURFACE_0,
|
||||
SURFACE_1,
|
||||
SURFACE_2,
|
||||
SURFACE_3,
|
||||
SURFACE_4,
|
||||
SURFACE_5,
|
||||
SURFACE_6,
|
||||
SURFACE_7,
|
||||
SURFACE_8,
|
||||
SURFACE_9,
|
||||
SURFACE_10,
|
||||
SURFACE_11,
|
||||
SURFACE_12,
|
||||
SURFACE_13,
|
||||
SURFACE_14,
|
||||
SURFACE_15,
|
||||
SURFACE_16,
|
||||
SURFACE_17,
|
||||
SURFACE_18,
|
||||
SURFACE_19,
|
||||
SURFACE_20,
|
||||
SURFACE_21,
|
||||
SURFACE_22,
|
||||
SURFACE_23,
|
||||
SURFACE_24,
|
||||
SURFACE_25,
|
||||
SURFACE_26,
|
||||
SURFACE_27,
|
||||
SURFACE_28,
|
||||
SURFACE_29,
|
||||
SURFACE_30,
|
||||
SURFACE_31,
|
||||
SURFACE_32,
|
||||
|
||||
NUMSURFACETYPES
|
||||
};
|
||||
|
||||
// From nick
|
||||
// TODO: check and use this
|
||||
// TODO: check this
|
||||
enum eSurfaceType
|
||||
{
|
||||
SURFACE_DEFAULT,
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
friend bool GenericSave(int file);
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
static float GetDefaultTimeStep(void) { return 5.0f / 3.0f; }
|
||||
static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
|
||||
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
|
||||
#endif
|
||||
};
|
||||
|
@ -45,9 +45,9 @@ CPhysical::CPhysical(void)
|
||||
|
||||
bUsesCollision = true;
|
||||
m_audioEntityId = -5;
|
||||
unk1 = 100.0f;
|
||||
m_phys_unused1 = 100.0f;
|
||||
m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f);
|
||||
field_EC = 0;
|
||||
m_phys_unused2 = 0;
|
||||
|
||||
bIsHeavy = false;
|
||||
bAffectedByGravity = true;
|
||||
@ -527,26 +527,26 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
bool ispedcontactA = false;
|
||||
bool ispedcontactB = false;
|
||||
|
||||
float timestepA;
|
||||
float massFactorA;
|
||||
if(B->bPedPhysics){
|
||||
timestepA = 10.0f;
|
||||
massFactorA = 10.0f;
|
||||
if(B->IsPed() && ((CPed*)B)->m_pCurrentPhysSurface == A)
|
||||
ispedcontactA = true;
|
||||
}else
|
||||
timestepA = A->bIsHeavy ? 2.0f : 1.0f;
|
||||
massFactorA = A->bIsHeavy ? 2.0f : 1.0f;
|
||||
|
||||
float timestepB;
|
||||
float massFactorB;
|
||||
if(A->bPedPhysics){
|
||||
if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() &&
|
||||
(B->GetStatus() == STATUS_ABANDONED || B->GetStatus() == STATUS_WRECKED || A->bHasHitWall))
|
||||
timestepB = 2200.0f / B->m_fMass;
|
||||
massFactorB = 2200.0f / B->m_fMass;
|
||||
else
|
||||
timestepB = 10.0f;
|
||||
massFactorB = 10.0f;
|
||||
|
||||
if(A->IsPed() && ((CPed*)A)->m_pCurrentPhysSurface == B)
|
||||
ispedcontactB = true;
|
||||
}else
|
||||
timestepB = B->bIsHeavy ? 2.0f : 1.0f;
|
||||
massFactorB = B->bIsHeavy ? 2.0f : 1.0f;
|
||||
|
||||
float speedA, speedB;
|
||||
if(B->IsStatic()){
|
||||
@ -646,14 +646,17 @@ 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 = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
|
||||
float speedSum = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
|
||||
// A has moved into B
|
||||
if(speedA < speedB){
|
||||
if(!A->bHasHitWall)
|
||||
speedB -= (speedA - speedB) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
|
||||
impulseA = (speedB-speedA) * A->m_fMass * timestepA;
|
||||
if(speedA < speedSum){
|
||||
if(A->bHasHitWall)
|
||||
eA = speedSum;
|
||||
else
|
||||
eA = speedSum - (speedA - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
|
||||
impulseA = (eA-speedA) * A->m_fMass * massFactorA;
|
||||
if(!A->bInfiniteMass)
|
||||
A->ApplyMoveForce(colpoint.normal*(impulseA/timestepA));
|
||||
A->ApplyMoveForce(colpoint.normal*(impulseA/massFactorA));
|
||||
return true;
|
||||
}
|
||||
}else if(A->bPedPhysics){
|
||||
@ -661,9 +664,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
|
||||
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
|
||||
|
||||
float a = A->m_fMass*timestepA;
|
||||
float b = B->GetMassTime(pointposB, colpoint.normal, timestepB);
|
||||
float speedSum = (b*speedB + a*speedA)/(a + b);
|
||||
float mA = A->m_fMass*massFactorA;
|
||||
float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
|
||||
float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
|
||||
if(speedA < speedSum){
|
||||
if(A->bHasHitWall)
|
||||
eA = speedSum;
|
||||
@ -673,10 +676,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
eB = speedSum;
|
||||
else
|
||||
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
|
||||
impulseA = (eA - speedA) * a;
|
||||
impulseB = -(eB - speedB) * b;
|
||||
CVector fA = colpoint.normal*(impulseA/timestepA);
|
||||
CVector fB = colpoint.normal*(-impulseB/timestepB);
|
||||
impulseA = (eA - speedA) * mA;
|
||||
impulseB = -(eB - speedB) * mB;
|
||||
CVector fA = colpoint.normal*(impulseA/massFactorA);
|
||||
CVector fB = colpoint.normal*(-impulseB/massFactorB);
|
||||
if(!A->bInfiniteMass){
|
||||
if(fA.z < 0.0f) fA.z = 0.0f;
|
||||
if(ispedcontactB){
|
||||
@ -696,9 +699,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
|
||||
speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
|
||||
|
||||
float a = A->GetMassTime(pointposA, colpoint.normal, timestepA);
|
||||
float b = B->m_fMass*timestepB;
|
||||
float speedSum = (b*speedB + a*speedA)/(a + b);
|
||||
float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
|
||||
float mB = B->m_fMass*massFactorB;
|
||||
float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
|
||||
if(speedA < speedSum){
|
||||
if(A->bHasHitWall)
|
||||
eA = speedSum;
|
||||
@ -708,10 +711,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
eB = speedSum;
|
||||
else
|
||||
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
|
||||
impulseA = (eA - speedA) * a;
|
||||
impulseB = -(eB - speedB) * b;
|
||||
CVector fA = colpoint.normal*(impulseA/timestepA);
|
||||
CVector fB = colpoint.normal*(-impulseB/timestepB);
|
||||
impulseA = (eA - speedA) * mA;
|
||||
impulseB = -(eB - speedB) * mB;
|
||||
CVector fA = colpoint.normal*(impulseA/massFactorA);
|
||||
CVector fB = colpoint.normal*(-impulseB/massFactorB);
|
||||
if(!A->bInfiniteMass && !ispedcontactA){
|
||||
if(fA.z < 0.0f) fA.z = 0.0f;
|
||||
A->ApplyMoveForce(fA);
|
||||
@ -736,9 +739,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
CVector pointposB = colpoint.point - B->GetPosition();
|
||||
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
|
||||
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
|
||||
float a = A->GetMassTime(pointposA, colpoint.normal, timestepA);
|
||||
float b = B->GetMassTime(pointposB, colpoint.normal, timestepB);
|
||||
float speedSum = (b*speedB + a*speedA)/(a + b);
|
||||
float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
|
||||
float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
|
||||
float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
|
||||
if(speedA < speedSum){
|
||||
if(A->bHasHitWall)
|
||||
eA = speedSum;
|
||||
@ -748,10 +751,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
eB = speedSum;
|
||||
else
|
||||
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
|
||||
impulseA = (eA - speedA) * a;
|
||||
impulseB = -(eB - speedB) * b;
|
||||
CVector fA = colpoint.normal*(impulseA/timestepA);
|
||||
CVector fB = colpoint.normal*(-impulseB/timestepB);
|
||||
impulseA = (eA - speedA) * mA;
|
||||
impulseB = -(eB - speedB) * mB;
|
||||
CVector fA = colpoint.normal*(impulseA/massFactorA);
|
||||
CVector fB = colpoint.normal*(-impulseB/massFactorB);
|
||||
if(A->IsVehicle() && !A->bHasHitWall){
|
||||
fA.x *= 1.4f;
|
||||
fA.y *= 1.4f;
|
||||
@ -767,7 +770,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
||||
if(B->IsVehicle() && !B->bHasHitWall){
|
||||
fB.x *= 1.4f;
|
||||
fB.y *= 1.4f;
|
||||
if(colpoint.normal.z < 0.7f)
|
||||
if(-colpoint.normal.z < 0.7f)
|
||||
fB.z *= 0.3f;
|
||||
if(B->GetStatus() == STATUS_PLAYER)
|
||||
pointposB *= 0.8f;
|
||||
@ -813,7 +816,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
|
||||
speed = GetSpeed(pointpos);
|
||||
normalSpeed = DotProduct(speed, colpoint.normal);
|
||||
if(normalSpeed < 0.0f){
|
||||
float minspeed = 0.0104f * CTimer::GetTimeStep();
|
||||
float minspeed = 1.3f*GRAVITY * CTimer::GetTimeStep();
|
||||
#ifdef GTA3_1_1_PATCH
|
||||
if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED))) &&
|
||||
#else
|
||||
@ -1015,7 +1018,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
|
||||
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
|
||||
|
||||
if(fOtherSpeed > 0.1f &&
|
||||
colpoint.surfaceB != SURFACE_2 && colpoint.surfaceB != SURFACE_4 &&
|
||||
colpoint.surfaceB != SURFACE_GRASS && colpoint.surfaceB != SURFACE_DIRTTRACK &&
|
||||
CSurfaceTable::GetAdhesionGroup(colpoint.surfaceA) == ADHESIVE_HARD){
|
||||
CVector v = frictionDir * fOtherSpeed * 0.25f;
|
||||
for(int i = 0; i < 4; i++)
|
||||
@ -1064,7 +1067,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||
canshift = true;
|
||||
else
|
||||
canshift = A->IsPed() &&
|
||||
B->IsObject() && B->bInfiniteMass && !Bobj->bHasBeenDamaged;
|
||||
B->IsObject() && B->bIsStatic && !Bobj->bHasBeenDamaged;
|
||||
if(B == A ||
|
||||
B->m_scanCode == CWorld::GetCurrentScanCode() ||
|
||||
!B->bUsesCollision ||
|
||||
@ -1084,7 +1087,6 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||
B->GetUp().z < 0.66f &&
|
||||
IsStreetLight(B->GetModelIndex()))
|
||||
skipShift = true;
|
||||
// TODO: maybe flip some ifs here
|
||||
else if(A->IsObject() && B->IsVehicle()){
|
||||
CObject *Aobj = (CObject*)A;
|
||||
if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
|
||||
@ -1699,16 +1701,16 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
||||
}
|
||||
|
||||
if(B->IsPed() && A->IsVehicle() &&
|
||||
(!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > 0.0025f))
|
||||
(!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > SQR(0.05f)))
|
||||
Bped->KillPedWithCar((CVehicle*)A, maxImpulseB);
|
||||
else if(B->GetModelIndex() == MI_TRAIN && A->IsPed() &&
|
||||
(!Aped->IsPlayer() || A->bHasHitWall))
|
||||
Aped->KillPedWithCar((CVehicle*)B, maxImpulseA*2.0f);
|
||||
else if(B->IsObject() && B->bUsesCollision && A->IsVehicle()){
|
||||
// BUG? not impulseA?
|
||||
if(Bobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
|
||||
Bobj->ObjectDamage(maxImpulseB);
|
||||
}else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){
|
||||
// BUG? not impulseA?
|
||||
if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
|
||||
Aobj->ObjectDamage(maxImpulseB);
|
||||
}
|
||||
@ -1774,7 +1776,7 @@ CPhysical::ProcessShift(void)
|
||||
m_bIsVehicleBeingShifted = true;
|
||||
|
||||
CEntryInfoNode *node;
|
||||
bool hasshifted = false; // whatever that means...
|
||||
bool hasshifted = false;
|
||||
for(node = m_entryInfoList.first; node; node = node->next)
|
||||
hasshifted |= ProcessShiftSectorList(node->sector->m_lists);
|
||||
m_bIsVehicleBeingShifted = false;
|
||||
@ -1831,7 +1833,7 @@ CPhysical::ProcessCollision(void)
|
||||
|
||||
int8 n = 1; // The number of steps we divide the time step into
|
||||
float step = 0.0f; // divided time step
|
||||
float distSq = GetDistanceSq();
|
||||
float distSq = m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep());
|
||||
|
||||
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
|
||||
if(ped->IsPlayer())
|
||||
@ -1920,8 +1922,11 @@ CPhysical::ProcessCollision(void)
|
||||
bSkipLineCol = false;
|
||||
if(!m_vecMoveSpeed.IsZero() ||
|
||||
!m_vecTurnSpeed.IsZero() ||
|
||||
#ifdef GTA_TRAIN
|
||||
bHitByTrain ||
|
||||
GetStatus() == STATUS_PLAYER || IsPed() && ped->IsPlayer()){
|
||||
#endif
|
||||
GetStatus() == STATUS_PLAYER ||
|
||||
IsPed() && ped->IsPlayer()){
|
||||
if(IsVehicle())
|
||||
((CVehicle*)this)->bVehicleColProcessed = true;
|
||||
if(CheckCollision()){
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
// The not properly indented fields haven't been checked properly yet
|
||||
|
||||
int32 m_audioEntityId;
|
||||
float unk1;
|
||||
float m_phys_unused1;
|
||||
CTreadable *m_treadable[2]; // car and ped
|
||||
uint32 m_nLastTimeCollided;
|
||||
CVector m_vecMoveSpeed; // velocity
|
||||
@ -37,7 +37,7 @@ public:
|
||||
CEntryInfoList m_entryInfoList;
|
||||
CPtrNode *m_movingListNode;
|
||||
|
||||
char field_EC;
|
||||
int8 m_phys_unused2;
|
||||
uint8 m_nStaticFrames;
|
||||
uint8 m_nCollisionRecords;
|
||||
bool m_bIsVehicleBeingShifted;
|
||||
@ -86,7 +86,6 @@ public:
|
||||
void RemoveRefsToEntity(CEntity *ent);
|
||||
static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos);
|
||||
|
||||
float GetDistanceSq(void) { return m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); }
|
||||
// get speed of point p relative to entity center
|
||||
CVector GetSpeed(const CVector &r);
|
||||
CVector GetSpeed(void) { return GetSpeed(CVector(0.0f, 0.0f, 0.0f)); }
|
||||
@ -94,7 +93,7 @@ public:
|
||||
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/m_fTurnMass +
|
||||
1.0f/m_fMass);
|
||||
}
|
||||
float GetMassTime(const CVector &pos, const CVector &dir, float t) {
|
||||
float GetMassTweak(const CVector &pos, const CVector &dir, float t) {
|
||||
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/(m_fTurnMass*t) +
|
||||
1.0f/(m_fMass*t));
|
||||
}
|
||||
|
@ -55,14 +55,7 @@ public:
|
||||
uint8 m_nCollisionDamageEffect;
|
||||
uint8 m_nSpecialCollisionResponseCases;
|
||||
bool m_bCameraToAvoidThisObject;
|
||||
|
||||
// this batch is unused
|
||||
int8 field_17B;
|
||||
int8 field_17C;
|
||||
int8 field_17D;
|
||||
int8 field_17E;
|
||||
int8 field_17F;
|
||||
|
||||
uint32 m_obj_unused1;
|
||||
uint32 m_nEndOfLifeTime;
|
||||
int16 m_nRefModelIndex;
|
||||
CEntity *m_pCurSurface;
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
static float GetSpriteSize(void) { return m_fCurrentSpriteSize; }
|
||||
static int GetShadowStrength(void) { return m_nCurrentShadowStrength; }
|
||||
static int GetLightShadowStrength(void) { return m_nCurrentLightShadowStrength; }
|
||||
static int GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
|
||||
static float GetLightOnGroundBrightness(void) { return m_fCurrentLightsOnGroundBrightness; }
|
||||
static float GetFarClip(void) { return m_fCurrentFarClip; }
|
||||
static float GetFogStart(void) { return m_fCurrentFogStart; }
|
||||
|
||||
|
@ -79,7 +79,7 @@ CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner)
|
||||
|
||||
bIsInWater = true;
|
||||
|
||||
unk1 = 0.0f;
|
||||
m_phys_unused1 = 0.0f;
|
||||
m_bIsAnchored = true;
|
||||
m_fOrientation = INVALID_ORIENTATION;
|
||||
bTouchingWater = true;
|
||||
|
Loading…
Reference in New Issue
Block a user