summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vehicles/Automobile.cpp32
-rw-r--r--src/vehicles/DamageManager.cpp10
-rw-r--r--src/vehicles/DamageManager.h2
-rw-r--r--src/vehicles/Vehicle.cpp8
4 files changed, 28 insertions, 24 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index e572c123..5d39b525 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -3232,7 +3232,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
if(impulse > 25.0f && GetStatus() != STATUS_WRECKED){
if(bIsLawEnforcer &&
FindPlayerVehicle() && FindPlayerVehicle() == m_pDamageEntity &&
- GetStatus() != STATUS_ABANDONED &&
+ GetStatus() != STATUS_ABANDONED &&
FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() >= m_vecMoveSpeed.Magnitude() &&
FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.1f)
FindPlayerPed()->SetWantedLevelNoDrop(1);
@@ -3276,6 +3276,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
case CAR_PIECE_BONNET:
GetComponentWorldPosition(CAR_BONNET, pos);
dmgDrawCarCollidingParticles(pos, impulse);
+ if(GetModelIndex() != MI_DODO)
if(Damage.ApplyDamage(COMPONENT_DOOR_BONNET, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){
SetDoorDamage(CAR_BONNET, DOOR_BONNET);
doubleMoney = true;
@@ -3286,7 +3287,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
case CAR_PIECE_BUMP_REAR:
GetComponentWorldPosition(CAR_BUMP_REAR, pos);
dmgDrawCarCollidingParticles(pos, impulse);
- if(Damage.ApplyDamage(COMPONENT_BUMPER_FRONT, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){
+ if(Damage.ApplyDamage(COMPONENT_BUMPER_REAR, impulse*impulseMult, pHandling->fCollisionDamageMultiplier)){
SetBumperDamage(CAR_BUMP_REAR, VEHBUMPER_REAR);
doubleMoney = true;
}
@@ -3542,8 +3543,8 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
int i;
CVector dir;
static RwRGBA grassCol = { 8, 24, 8, 255 };
- static RwRGBA dirtCol = { 64, 64, 64, 255 };
- static RwRGBA dirttrackCol = { 64, 32, 16, 255 };
+ static RwRGBA gravelCol = { 64, 64, 64, 255 };
+ static RwRGBA mudCol = { 64, 32, 16, 255 };
static RwRGBA waterCol = { 48, 48, 64, 0 };
if(!belowEffectSpeed)
@@ -3565,7 +3566,7 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
for(i = 0; i < 4; i++){
dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil,
- CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirtCol);
+ CGeneral::GetRandomNumberInRange(0.02f, 0.06f), gravelCol);
}
return 1;
case SURFACE_MUD_DRY:
@@ -3574,7 +3575,7 @@ CAutomobile::AddWheelDirtAndWater(CColPoint *colpoint, uint32 belowEffectSpeed)
for(i = 0; i < 4; i++){
dir.z = CGeneral::GetRandomNumberInRange(0.03f, 0.06f);
CParticle::AddParticle(PARTICLE_WHEEL_DIRT, colpoint->point, dir, nil,
- CGeneral::GetRandomNumberInRange(0.02f, 0.06f), dirttrackCol);
+ CGeneral::GetRandomNumberInRange(0.02f, 0.06f), mudCol);
}
return 0;
default:
@@ -4404,7 +4405,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
(component == COMPGROUP_BONNET || component == COMPGROUP_BOOT || component == CAR_WINDSCREEN)){
obj->m_vecMoveSpeed.z *= -1.5f;
obj->m_vecMoveSpeed.z += 0.04f;
- }else{
+ }else{p
obj->m_vecMoveSpeed.z *= 0.25f;
}
obj->m_vecMoveSpeed.x *= 0.75f;
@@ -4420,7 +4421,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
dist += GetUp();
if(GetUp().z > 0.0f){
// simulate fast upward movement if going fast
- float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr();
+ float speed = CVector2D(m_vecMoveSpeed).Magnitude();
obj->GetMatrix().Translate(GetUp()*speed);
}
}
@@ -4452,8 +4453,11 @@ CAutomobile::RemoveBonnetInPedCollision(void)
if(Damage.GetDoorStatus(DOOR_BONNET) == DOOR_STATUS_SWINGING &&
Doors[DOOR_BONNET].RetAngleWhenOpen()*0.4f < Doors[DOOR_BONNET].m_fAngle){
- // BUG? why not COMPGROUP_BONNET?
+#ifdef FIX_BUGS
+ obj = SpawnFlyingComponent(CAR_BONNET, COMPGROUP_BONNET);
+#else
obj = SpawnFlyingComponent(CAR_BONNET, COMPGROUP_DOOR);
+#endif
// make both doors invisible on car
SetComponentVisibility(m_aCarNodes[CAR_BONNET], ATOMIC_FLAG_NONE);
Damage.SetDoorStatus(DOOR_BONNET, DOOR_STATUS_MISSING);
@@ -4514,13 +4518,16 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents
status = DOOR_STATUS_MISSING;
}
- if(status == DOOR_STATUS_SMASHED){
+ switch(status){
+ case DOOR_STATUS_SMASHED:
// show damaged part
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_DAM);
- }else if(status == DOOR_STATUS_SWINGING){
+ break;
+ case DOOR_STATUS_SWINGING:
// turn off angle cull for swinging doors
RwFrameForAllObjects(m_aCarNodes[component], CVehicleModelInfo::SetAtomicFlagCB, (void*)ATOMIC_FLAG_NOCULL);
- }else if(status == DOOR_STATUS_MISSING){
+ break;
+ case DOOR_STATUS_MISSING:
if(!noFlyingComponents){
if(door == DOOR_BONNET)
SpawnFlyingComponent(component, COMPGROUP_BONNET);
@@ -4531,6 +4538,7 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents
}
// hide both
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_NONE);
+ break;
}
}
diff --git a/src/vehicles/DamageManager.cpp b/src/vehicles/DamageManager.cpp
index 6b59ccda..c625a4e7 100644
--- a/src/vehicles/DamageManager.cpp
+++ b/src/vehicles/DamageManager.cpp
@@ -11,7 +11,7 @@ CDamageManager::CDamageManager(void)
{
ResetDamageStatus();
m_fWheelDamageEffect = 0.75f;
- field_24 = 1;
+ field_18 = 1;
}
void
@@ -28,12 +28,8 @@ CDamageManager::FuckCarCompletely(void)
m_wheelStatus[0] = WHEEL_STATUS_MISSING;
// wheels 1-3 not reset?
- m_doorStatus[0] = DOOR_STATUS_MISSING;
- m_doorStatus[1] = DOOR_STATUS_MISSING;
- m_doorStatus[2] = DOOR_STATUS_MISSING;
- m_doorStatus[3] = DOOR_STATUS_MISSING;
- m_doorStatus[4] = DOOR_STATUS_MISSING;
- m_doorStatus[5] = DOOR_STATUS_MISSING;
+ for(i = 0; i < ARRAY_SIZE(m_doorStatus); i++)
+ m_doorStatus[i] = DOOR_STATUS_MISSING;
for(i = 0; i < 3; i++){
#ifdef FIX_BUGS
diff --git a/src/vehicles/DamageManager.h b/src/vehicles/DamageManager.h
index bf0c59a1..312006e3 100644
--- a/src/vehicles/DamageManager.h
+++ b/src/vehicles/DamageManager.h
@@ -86,7 +86,7 @@ public:
uint8 m_doorStatus[6];
uint32 m_lightStatus;
uint32 m_panelStatus;
- uint32 field_24;
+ uint8 field_18;
CDamageManager(void);
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index e264d7ed..77c549f9 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -780,7 +780,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
return false;
if (pPassengers[1] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_LR) &&
- IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_LEFT, nil)) {
+ IsRoomForPedToLeaveCar(CAR_DOOR_LR, nil)) {
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[1];
pPassengers[1] = nil;
@@ -797,7 +797,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
}
if (pPassengers[2] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RR) &&
- IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_RIGHT, nil)) {
+ IsRoomForPedToLeaveCar(CAR_DOOR_RR, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[2];
pPassengers[2] = nil;
@@ -814,7 +814,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
}
if (pPassengers[0] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RF) &&
- IsRoomForPedToLeaveCar(COMPONENT_DOOR_FRONT_RIGHT, nil)) {
+ IsRoomForPedToLeaveCar(CAR_DOOR_RF, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[0];
pPassengers[0] = nil;
@@ -1192,7 +1192,7 @@ CVehicle::ProcessCarAlarm(void)
{
uint32 step;
- if(m_nAlarmState == 0 || m_nAlarmState == -1)
+ if(!IsAlarmOn())
return;
step = CTimer::GetTimeStepInMilliseconds();