diff options
Diffstat (limited to '')
-rw-r--r-- | src/vehicles/Automobile.cpp | 34 | ||||
-rw-r--r-- | src/vehicles/Automobile.h | 6 | ||||
-rw-r--r-- | src/vehicles/Bike.cpp | 34 | ||||
-rw-r--r-- | src/vehicles/Bike.h | 5 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 39 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 11 |
6 files changed, 65 insertions, 64 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 61aa00b2..b0f21af7 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -206,7 +206,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) m_pBombRigger = nil; m_bombType = CARBOMB_NONE; - bUnknownFlag = false; + bDriverLastFrame = false; if(m_nDoorLock == CARLOCK_UNLOCKED && (id == MI_POLICE || id == MI_ENFORCER || id == MI_RHINO)) @@ -344,8 +344,19 @@ CAutomobile::ProcessControl(void) ScanForCrimes(); } - // TODO(LCS)? re-inline this and change where bDriverLastFrame is set - ActivateBombWhenEntered(); + if (pDriver) { + if (!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE) { + // If someone enters the car and there is a bomb, detonate + m_nBombTimer = 1000; + m_pBlowUpEntity = m_pBombRigger; + if (m_pBlowUpEntity) + m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f); + } + bDriverLastFrame = true; + } + else + bDriverLastFrame = false; // Process driver if(pDriver){ @@ -939,9 +950,20 @@ CAutomobile::ProcessControl(void) traction *= 4.0f; if(FindPlayerVehicle() && FindPlayerVehicle() == this) - if(CPad::GetPad(0)->CarGunJustDown()) - // TODO(LCS)? re-inline this from CVehicle - ActivateBomb(); + if (CPad::GetPad(0)->CarGunJustDown()) { + if (m_bombType == CARBOMB_TIMED) { + m_bombType = CARBOMB_TIMEDACTIVE; + m_nBombTimer = 7000; + m_pBlowUpEntity = FindPlayerPed(); + CGarages::TriggerMessage("GA_12", -1, 3000, -1); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f); + } + else if (m_bombType == CARBOMB_ONIGNITION) { + m_bombType = CARBOMB_ONIGNITIONACTIVE; + CGarages::TriggerMessage("GA_12", -1, 3000, -1); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f); + } + } if(FindPlayerVehicle() != this && (strongGrip1 || CVehicle::bCheat3)){ traction *= 1.2f; diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index de69d381..f3ee803b 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -35,11 +35,9 @@ public: float m_aWheelPosition[4]; float m_aWheelSpeed[4]; uint8 m_auto_unused2; -#if (defined GTA_PS2 && !defined FIX_BUGS) uint8 m_bombType : 3; -#endif uint8 bTaxiLight : 1; - uint8 bUnknownFlag : 1; // new in LCS + uint8 bDriverLastFrame : 1; uint8 bFixedColour : 1; uint8 bBigWheels : 1; uint8 bWaterTight : 1; // no damage for non-player peds @@ -48,9 +46,7 @@ public: uint8 bTankDetonateCars : 1; uint8 bStuckInSand : 1; uint8 bHeliDestroyed : 1; -#if (defined GTA_PS2 && !defined FIX_BUGS) CEntity* m_pBombRigger; -#endif int16 m_doingBurnout; uint16 m_hydraulicState; uint32 m_nBusDoorTimerEnd; diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index 60530fff..d8ad71ea 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -37,6 +37,7 @@ #include "Bike.h" #include "Debug.h" #include "SaveBuf.h" +#include "Garages.h" const uint32 CBike::nSaveStructSize = #ifdef COMPATIBLE_SAVES @@ -232,7 +233,19 @@ CBike::ProcessControl(void) ProcessCarAlarm(); - ActivateBombWhenEntered(); + if (pDriver) { + if (!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE) { + // If someone enters the car and there is a bomb, detonate + m_nBombTimer = 1000; + m_pBlowUpEntity = m_pBombRigger; + if (m_pBlowUpEntity) + m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f); + } + bDriverLastFrame = true; + } + else + bDriverLastFrame = false; CRubbish::StirUp(this); @@ -300,8 +313,23 @@ CBike::ProcessControl(void) ApplyMoveForce(parallelSpeed * -CTimer::GetTimeStep()*SAND_SLOWDOWN*m_fMass); } } - if(CPad::GetPad(0)->WeaponJustDown()) - ActivateBomb(); + +#ifdef BOMBS_ON_BIKES + if(CPad::GetPad(0)->WeaponJustDown()) { + if (m_bombType == CARBOMB_TIMED) { + m_bombType = CARBOMB_TIMEDACTIVE; + m_nBombTimer = 7000; + m_pBlowUpEntity = FindPlayerPed(); + CGarages::TriggerMessage("GA_12", -1, 3000, -1); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f); + } + else if (m_bombType == CARBOMB_ONIGNITION) { + m_bombType = CARBOMB_ONIGNITIONACTIVE; + CGarages::TriggerMessage("GA_12", -1, 3000, -1); + DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f); + } + } +#endif break; case STATUS_PLAYER_PLAYBACKFROMBUFFER: diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h index 611cd11d..ce89e8c7 100644 --- a/src/vehicles/Bike.h +++ b/src/vehicles/Bike.h @@ -67,15 +67,18 @@ public: float m_fPedLeanAmountUD; uint8 m_bike_unused2; uint8 unused[3]; // looks like padding..but for what? + uint8 m_bombType : 3; + uint8 bDriverLastFrame : 1; uint8 m_bike_flag01 : 1; uint8 m_bike_flag02 : 1; - uint8 bWaterTight : 1; + uint8 bWaterTight : 1; // 535_40 uint8 bIsBeingPickedUp : 1; uint8 bIsStanding : 1; uint8 bExtraSpeed : 1; // leaning forward uint8 bIsOnFire : 1; uint8 bWheelieCam : 1; uint8 bFixedColour : 1; // <- figure out its actual place (TODO) + CEntity* m_pBombRigger; int16 m_doingBurnout; float m_fTireTemperature; float m_fBrakeDestabilization; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index be4012eb..308a517e 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -159,10 +159,6 @@ CVehicle::CVehicle(uint8 CreatedBy) bIsBig = false; bLowVehicle = false; - m_bombType = CARBOMB_NONE; - m_pBombRigger = nil; - bDriverLastFrame = false; - m_nSetPieceExtendedRangeTime = 0; m_nAlarmState = 0; m_nDoorLock = CARLOCK_UNLOCKED; @@ -1465,41 +1461,6 @@ CVehicle::FireFixedMachineGuns(void) } } -//LCS: in CAutomobile -void -CVehicle::ActivateBomb(void) -{ - if(m_bombType == CARBOMB_TIMED){ - m_bombType = CARBOMB_TIMEDACTIVE; - m_nBombTimer = 7000; - m_pBlowUpEntity = FindPlayerPed(); - CGarages::TriggerMessage("GA_12", -1, 3000, -1); - DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f); - }else if(m_bombType == CARBOMB_ONIGNITION){ - m_bombType = CARBOMB_ONIGNITIONACTIVE; - CGarages::TriggerMessage("GA_12", -1, 3000, -1); - DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f); - } -} - -//LCS: in CAutomobile and CBike -void -CVehicle::ActivateBombWhenEntered(void) -{ - if(pDriver){ - if(!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE){ - // If someone enters the car and there is a bomb, detonate - m_nBombTimer = 1000; - m_pBlowUpEntity = m_pBombRigger; - if(m_pBlowUpEntity) - m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity); - DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f); - } - bDriverLastFrame = true; - }else - bDriverLastFrame = false; -} - void CVehicle::ExtinguishCarFire(void) { diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 940081b8..7be4e563 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -245,10 +245,6 @@ public: uint8 bRestingOnPhysical : 1; // Dont go static cause car is sitting on a physical object that might get removed uint8 bParking : 1; uint8 bCanPark : 1; -#if (!defined GTA_PS2 || defined FIX_BUGS) // <- I think this can be moved back to CAutomobile? - uint8 m_bombType : 3; -#endif - uint8 bDriverLastFrame : 1; // originally not in CVehicle (TODO - carbomb stuff) uint8 bRewardVehicle : 1; // 25B_40 int8 m_numPedsUseItAsCover; @@ -261,9 +257,6 @@ public: float m_fEngineEnergy; // TODO(LCS): better name. it adds up acceleration force, so possibly kinetic energy?? uint8 m_nCurrentGear; float m_fChangeGearTime; -#if (!defined GTA_PS2 || defined FIX_BUGS) - CEntity* m_pBombRigger; -#endif uint32 m_nSetPieceExtendedRangeTime; uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats) uint32 m_nTimeOfDeath; @@ -395,8 +388,6 @@ public: void InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage, CVector pos = CVector(0.0f, 0.0f, 0.0f)); void DoFixedMachineGuns(void); void FireFixedMachineGuns(void); - void ActivateBomb(void); - void ActivateBombWhenEntered(void); void KillPedsInVehicle(void); void SetComponentAtomicAlpha(RpAtomic *atomic, int32 alpha); @@ -407,7 +398,7 @@ public: bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } - bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } + bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE || GetModelIndex() == MI_KAUFMAN; } bool IsLimo(void) { return GetModelIndex() == MI_STRETCH; } bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); } bool IsRealPlane(void) { return !!(pHandling->Flags & HANDLING_IS_PLANE); } |