summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/vehicles/Automobile.cpp71
-rw-r--r--src/vehicles/CarGen.cpp4
-rw-r--r--src/vehicles/Vehicle.cpp16
-rw-r--r--src/vehicles/Vehicle.h3
4 files changed, 48 insertions, 46 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 7d942dcd..417dd140 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -995,19 +995,19 @@ CAutomobile::ProcessControl(void)
}else{
if(GetModelIndex() == MI_MRWHOOP){
if(Pads[0].bHornHistory[Pads[0].iCurrHornHistory] &&
- !Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+4) % 5]){
+ !Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+CPad::HORNHISTORY_SIZE-1) % CPad::HORNHISTORY_SIZE]){
m_bSirenOrAlarm = !m_bSirenOrAlarm;
printf("m_bSirenOrAlarm toggled to %d\n", m_bSirenOrAlarm);
}
}else if(UsesSiren(GetModelIndex())){
if(Pads[0].bHornHistory[Pads[0].iCurrHornHistory]){
- if(Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+4) % 5] &&
- Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+3) % 5])
+ if(Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+CPad::HORNHISTORY_SIZE-1) % CPad::HORNHISTORY_SIZE] &&
+ Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+CPad::HORNHISTORY_SIZE-2) % CPad::HORNHISTORY_SIZE])
m_nCarHornTimer = 1;
else
m_nCarHornTimer = 0;
- }else if(Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+4) % 5] &&
- !Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+1) % 5]){
+ }else if(Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+CPad::HORNHISTORY_SIZE-1) % CPad::HORNHISTORY_SIZE] &&
+ !Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+1) % CPad::HORNHISTORY_SIZE]){
m_nCarHornTimer = 0;
m_bSirenOrAlarm = !m_bSirenOrAlarm;
}else
@@ -1363,7 +1363,7 @@ CAutomobile::PreRender(void)
break;
default:
- if(Abs(fwdSpeed) > 0.5f)
+ if(Abs(fwdSpeed) > 5.0f)
AddWheelDirtAndWater(&m_aWheelColPoints[i], drawParticles);
if(m_aWheelSkidmarkBloody[i] && m_aWheelTimer[i] > 0.0f)
CSkidmarks::RegisterOne((uintptr)this + i, m_aWheelColPoints[i].point,
@@ -1388,7 +1388,7 @@ CAutomobile::PreRender(void)
CVector(0.0f, 0.0f, 0.0f));
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f)
- CSkidmarks::RegisterOne((uintptr)this + CARWHEEL_REAR_LEFT,
+ CSkidmarks::RegisterOne((uintptr)this + 5,
m_aWheelColPoints[CARWHEEL_REAR_LEFT].point + offset,
GetForward().x, GetForward().y,
&m_aWheelSkidmarkMuddy[CARWHEEL_REAR_LEFT], &m_aWheelSkidmarkBloody[CARWHEEL_REAR_LEFT]);
@@ -1406,12 +1406,12 @@ CAutomobile::PreRender(void)
CVector(0.0f, 0.0f, 0.0f));
if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f)
- CSkidmarks::RegisterOne((uintptr)this + CARWHEEL_REAR_RIGHT,
+ CSkidmarks::RegisterOne((uintptr)this + 6,
m_aWheelColPoints[CARWHEEL_REAR_RIGHT].point + offset,
GetForward().x, GetForward().y,
&m_aWheelSkidmarkMuddy[CARWHEEL_REAR_RIGHT], &m_aWheelSkidmarkBloody[CARWHEEL_REAR_RIGHT]);
break;
- default: break;
+ default: break;
}
}
@@ -1539,7 +1539,7 @@ CAutomobile::PreRender(void)
r *= f;
g *= f;
b *= f;
- }else if(t > 412){
+ }else if(t > (512-100)){
float f = (512-t)/100.0f;
r *= f;
g *= f;
@@ -1770,20 +1770,20 @@ CAutomobile::PreRender(void)
// Taillight coronas
if(behindness > 0.0f){
// Behind car
- float intensity = 0.4f*behindness + 0.4f;
- float size = (behindness + 1.0f)/2.0f;
+ float intensity = (behindness + 1.0f)*0.4f;
+ float size = (behindness + 1.0f)*0.5f;
if(m_fGasPedal < 0.0f){
// reversing
intensity += 0.4f;
size += 0.3f;
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 2, 128*intensity, 128*intensity, 128*intensity, 255,
+ CCoronas::RegisterCorona((uintptr)this + 14, 128*intensity, 128*intensity, 128*intensity, 255,
lightL, size, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STREAK, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, angle);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 3, 128*intensity, 128*intensity, 128*intensity, 255,
+ CCoronas::RegisterCorona((uintptr)this + 15, 128*intensity, 128*intensity, 128*intensity, 255,
lightR, size, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STREAK, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, angle);
@@ -1795,23 +1795,23 @@ CAutomobile::PreRender(void)
if(alarmOff){
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 2, 0, 0, 0, 0,
+ CCoronas::RegisterCorona((uintptr)this + 14, 0, 0, 0, 0,
lightL, size, 0.0f,
CCoronas::TYPE_STREAK, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, angle);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 3, 0, 0, 0, 0,
+ CCoronas::RegisterCorona((uintptr)this + 15, 0, 0, 0, 0,
lightR, size, 0.0f,
CCoronas::TYPE_STREAK, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, angle);
}else{
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 2, 128*intensity, 0, 0, 255,
+ CCoronas::RegisterCorona((uintptr)this + 14, 128*intensity, 0, 0, 255,
lightL, size, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STREAK, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, angle);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 3, 128*intensity, 0, 0, 255,
+ CCoronas::RegisterCorona((uintptr)this + 15, 128*intensity, 0, 0, 255,
lightR, size, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STREAK, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, angle);
@@ -1819,10 +1819,11 @@ CAutomobile::PreRender(void)
}
}else{
// In front of car
+ // missing LODDistMultiplier probably a BUG
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::UpdateCoronaCoors((uintptr)this + 2, lightL, 50.0f*TheCamera.LODDistMultiplier, angle);
+ CCoronas::UpdateCoronaCoors((uintptr)this + 14, lightL, 50.0f, angle);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::UpdateCoronaCoors((uintptr)this + 3, lightR, 50.0f*TheCamera.LODDistMultiplier, angle);
+ CCoronas::UpdateCoronaCoors((uintptr)this + 15, lightR, 50.0f, angle);
}
// bright lights
@@ -1888,12 +1889,12 @@ CAutomobile::PreRender(void)
if(m_fGasPedal < 0.0f){
// reversing
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 2, 120, 120, 120, 255,
+ CCoronas::RegisterCorona((uintptr)this + 14, 120, 120, 120, 255,
lightL, 1.2f, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 3, 120, 120, 120, 255,
+ CCoronas::RegisterCorona((uintptr)this + 15, 120, 120, 120, 255,
lightR, 1.2f, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
@@ -1904,12 +1905,12 @@ CAutomobile::PreRender(void)
}else{
// braking
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 2, 120, 0, 0, 255,
+ CCoronas::RegisterCorona((uintptr)this + 14, 120, 0, 0, 255,
lightL, 1.2f, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::RegisterCorona((uintptr)this + 3, 120, 0, 0, 255,
+ CCoronas::RegisterCorona((uintptr)this + 15, 120, 0, 0, 255,
lightR, 1.2f, 50.0f*TheCamera.LODDistMultiplier,
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
@@ -1920,15 +1921,15 @@ CAutomobile::PreRender(void)
}
}else{
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::UpdateCoronaCoors((uintptr)this + 2, lightL, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
+ CCoronas::UpdateCoronaCoors((uintptr)this + 14, lightL, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::UpdateCoronaCoors((uintptr)this + 3, lightR, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
+ CCoronas::UpdateCoronaCoors((uintptr)this + 15, lightR, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
}
}else{
if(Damage.GetLightStatus(VEHLIGHT_REAR_LEFT) == LIGHT_STATUS_OK)
- CCoronas::UpdateCoronaCoors((uintptr)this + 2, lightL, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
+ CCoronas::UpdateCoronaCoors((uintptr)this + 14, lightL, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
if(Damage.GetLightStatus(VEHLIGHT_REAR_RIGHT) == LIGHT_STATUS_OK)
- CCoronas::UpdateCoronaCoors((uintptr)this + 3, lightR, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
+ CCoronas::UpdateCoronaCoors((uintptr)this + 15, lightR, 50.0f*TheCamera.LODDistMultiplier, 0.0f);
}
}
// end of lights
@@ -3063,7 +3064,7 @@ CAutomobile::DoDriveByShootings(void)
lookingLeft = true;
if(TheCamera.Cams[TheCamera.ActiveCam].LookingRight)
lookingRight = true;
- }
+ }
if(lookingLeft || lookingRight){
if(lookingLeft){
@@ -3496,9 +3497,9 @@ CAutomobile::dmgDrawCarCollidingParticles(const CVector &pos, float amount)
nil,
CGeneral::GetRandomNumberInRange(0.02f, 0.08f),
CVehicleModelInfo::ms_vehicleColourTable[m_currentColour1],
- CGeneral::GetRandomNumberInRange(-40.0f, 40.0f),
+ CGeneral::GetRandomNumberInRange(-40, 40),
0,
- CGeneral::GetRandomNumberInRange(0.0f, 4.0f));
+ CGeneral::GetRandomNumberInRange(0, 4));
}
void
@@ -3955,7 +3956,9 @@ CAutomobile::SetUpWheelColModel(CColModel *colModel)
return true;
}
-// this probably isn't used in III yet
+float fBurstForceMult = 0.03f;
+
+// this isn't used in III yet
void
CAutomobile::BurstTyre(uint8 wheel)
{
@@ -3975,8 +3978,8 @@ CAutomobile::BurstTyre(uint8 wheel)
CCarCtrl::SwitchVehicleToRealPhysics(this);
}
- ApplyMoveForce(GetRight() * m_fMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f));
- ApplyTurnForce(GetRight() * m_fTurnMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f), GetForward());
+ ApplyMoveForce(GetRight() * m_fMass * CGeneral::GetRandomNumberInRange(-fBurstForceMult, fBurstForceMult));
+ ApplyTurnForce(GetRight() * m_fTurnMass * CGeneral::GetRandomNumberInRange(-fBurstForceMult, fBurstForceMult), GetForward());
}
}
diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp
index 22b2fc60..ebb767dd 100644
--- a/src/vehicles/CarGen.cpp
+++ b/src/vehicles/CarGen.cpp
@@ -172,8 +172,8 @@ void CCarGenerator::Setup(float x, float y, float z, float angle, int32 mi, int1
m_nTimer = CTimer::GetTimeInMilliseconds() + 1;
m_nUsesRemaining = 0;
m_bIsBlocking = false;
- m_vecInf = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.min;
- m_vecSup = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.max;
+ m_vecInf = CModelInfo::GetColModel(m_nModelIndex)->boundingBox.min;
+ m_vecSup = CModelInfo::GetColModel(m_nModelIndex)->boundingBox.max;
m_fSize = Max(m_vecInf.Magnitude(), m_vecSup.Magnitude());
}
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 4259f9d8..451f3a39 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -527,7 +527,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
#ifdef FIX_BUGS
// contactSpeedFwd is independent of framerate but fwd has timestep as a factor
// so we probably have to fix this
- fwd *= CTimer::GetTimeStepFix();
+ // better get rid of it here too
+ //fwd *= CTimer::GetTimeStepFix();
#endif
if(!bBraking){
@@ -860,12 +861,11 @@ CVehicle::ProcessDelayedExplosion(void)
if(IsCar() && ((CAutomobile*)this)->m_bombType == CARBOMB_TIMEDACTIVE && (m_nBombTimer & 0xFE00) != (prev & 0xFE00))
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f);
- if (m_nBombTimer != 0)
- return;
-
- if(FindPlayerVehicle() != this && m_pBlowUpEntity == FindPlayerPed())
- CWorld::Players[CWorld::PlayerInFocus].AwardMoneyForExplosion(this);
- BlowUpCar(m_pBlowUpEntity);
+ if (m_nBombTimer == 0){
+ if(FindPlayerVehicle() != this && m_pBlowUpEntity == FindPlayerPed())
+ CWorld::Players[CWorld::PlayerInFocus].AwardMoneyForExplosion(this);
+ BlowUpCar(m_pBlowUpEntity);
+ }
}
bool
@@ -1207,7 +1207,7 @@ CVehicle::ProcessCarAlarm(void)
{
uint32 step;
- if(!IsAlarmOn())
+ if(m_nAlarmState == 0 || m_nAlarmState == -1)
return;
step = CTimer::GetTimeStepInMilliseconds();
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index e7ad5c13..ab60ee2f 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -25,8 +25,7 @@ enum eCarLock {
CARLOCK_LOCKOUT_PLAYER_ONLY,
CARLOCK_LOCKED_PLAYER_INSIDE,
CARLOCK_LOCKED_INITIALLY,
- CARLOCK_FORCE_SHUT_DOORS,
- CARLOCK_SKIP_SHUT_DOORS
+ CARLOCK_FORCE_SHUT_DOORS
};
enum eDoors