diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-06-07 03:16:10 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-06-07 03:16:10 +0200 |
commit | 24bf4c2cbae67be4a0ac5f674f3fb5645e92516b (patch) | |
tree | 392d6754b618a6be48c391d86601da905299be89 /src/weapons/Weapon.cpp | |
parent | a bit of fonts (diff) | |
parent | Merge branch 'master' into miami (diff) | |
download | re3-24bf4c2cbae67be4a0ac5f674f3fb5645e92516b.tar re3-24bf4c2cbae67be4a0ac5f674f3fb5645e92516b.tar.gz re3-24bf4c2cbae67be4a0ac5f674f3fb5645e92516b.tar.bz2 re3-24bf4c2cbae67be4a0ac5f674f3fb5645e92516b.tar.lz re3-24bf4c2cbae67be4a0ac5f674f3fb5645e92516b.tar.xz re3-24bf4c2cbae67be4a0ac5f674f3fb5645e92516b.tar.zst re3-24bf4c2cbae67be4a0ac5f674f3fb5645e92516b.zip |
Diffstat (limited to 'src/weapons/Weapon.cpp')
-rw-r--r-- | src/weapons/Weapon.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 114a2240..8aa3db39 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -31,6 +31,7 @@ #include "WeaponInfo.h" #include "World.h" #include "SurfaceTable.h" +#include "Bike.h" // TODO(Miami) #define AUDIO_NOT_READY @@ -386,7 +387,7 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) } bool -CWeapon::FireFromCar(CVehicle *shooter, bool left) +CWeapon::FireFromCar(CVehicle *shooter, bool left, bool right) { ASSERT(shooter!=nil); @@ -396,7 +397,7 @@ CWeapon::FireFromCar(CVehicle *shooter, bool left) if ( m_nAmmoInClip <= 0 ) return false; - if ( FireInstantHitFromCar(shooter, left) ) + if ( FireInstantHitFromCar(shooter, left, right) ) { DMAudio.PlayOneShot(shooter->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f); @@ -524,7 +525,22 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource) } damageEntityRegistered = 3; - // TODO(Miami): Bike + if (victimPed->bInVehicle) { + CVehicle *victimVeh = victimPed->m_pMyVehicle; + if (victimVeh) { + if (victimVeh->IsBike()) { + CBike *victimBike = (CBike*)victimVeh; + victimBike->KnockOffRider(m_eWeaponType, localDir, victimPed, false); + if (victimBike->pDriver) { + victimBike->pDriver->ReactToAttack(shooterPed); + } else { + if (victimVeh->pPassengers[0]) + victimVeh->pPassengers[0]->ReactToAttack(shooterPed); + } + continue; + } + } + } if ( !victimPed->DyingOrDead() ) victimPed->ReactToAttack(shooterPed); @@ -2005,8 +2021,9 @@ CWeapon::FireM16_1stPerson(CEntity *shooter) } bool -CWeapon::FireInstantHitFromCar(CVehicle *shooter, bool left) +CWeapon::FireInstantHitFromCar(CVehicle *shooter, bool left, bool right) { +// TODO(MIAMI): bikes CWeaponInfo *info = GetInfo(); CVehicleModelInfo *modelInfo = shooter->GetModelInfo(); |