diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-06-20 16:30:28 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-06-20 16:30:28 +0200 |
commit | 2d2833f2e4f038f37cf75025e98476a4f1ad9a13 (patch) | |
tree | 7764969828ee3e9218912bf1e448493e62a4545f /src/weapons/Weapon.cpp | |
parent | Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami (diff) | |
download | re3-2d2833f2e4f038f37cf75025e98476a4f1ad9a13.tar re3-2d2833f2e4f038f37cf75025e98476a4f1ad9a13.tar.gz re3-2d2833f2e4f038f37cf75025e98476a4f1ad9a13.tar.bz2 re3-2d2833f2e4f038f37cf75025e98476a4f1ad9a13.tar.lz re3-2d2833f2e4f038f37cf75025e98476a4f1ad9a13.tar.xz re3-2d2833f2e4f038f37cf75025e98476a4f1ad9a13.tar.zst re3-2d2833f2e4f038f37cf75025e98476a4f1ad9a13.zip |
Diffstat (limited to '')
-rw-r--r-- | src/weapons/Weapon.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index d3b92b07..a895315e 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -194,8 +194,12 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) if ( GetInfo()->m_eWeaponFire != WEAPON_FIRE_MELEE ) { - if ( m_nAmmoInClip <= 0 ) - return false; + if (m_nAmmoInClip <= 0) { + if (m_nAmmoTotal <= 0 || m_eWeaponState == WEAPONSTATE_RELOADING) + return false; + + Reload(); + } switch ( m_eWeaponType ) { @@ -223,10 +227,10 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) { if ((TheCamera.PlayerWeaponMode.Mode == CCam::MODE_HELICANNON_1STPERSON || TheCamera.PlayerWeaponMode.Mode == CCam::MODE_M16_1STPERSON) && shooter == FindPlayerPed()) { - addFireRateAsDelay = false; + addFireRateAsDelay = true; fired = FireM16_1stPerson(shooter); } else { - addFireRateAsDelay = true; + addFireRateAsDelay = false; fired = FireInstantHit(shooter, source); } break; @@ -235,8 +239,11 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) case WEAPONTYPE_SNIPERRIFLE: case WEAPONTYPE_LASERSCOPE: { - fired = FireSniper(shooter); - + if (shooter == FindPlayerPed()) { + fired = FireSniper(shooter); + } else { + fired = FireInstantHit(shooter, source); + } break; } @@ -339,8 +346,12 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource) if (m_nAmmoInClip == 0) { - if (m_nAmmoTotal == 0) + if (m_nAmmoTotal == 0) { + if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_CAMERA) + CPad::GetPad(0)->Clear(false); + return true; + } m_eWeaponState = WEAPONSTATE_RELOADING; m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload; @@ -1026,7 +1037,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) { static uint8 counter = 0; - if ( info->m_nFiringRate >= 50 && !(++counter & 1) ) + if ( info->m_nFiringRate >= 50 || !(++counter & 1) ) { AddGunFlashBigGuns(*fireSource, *fireSource + target); @@ -2586,9 +2597,10 @@ CWeapon::Update(int32 audioEntity, CPed *pedToAdjustSound) if ( CTimer::GetTimeInMilliseconds() > m_nTimer ) { - if ( GetInfo()->m_eWeaponFire != WEAPON_FIRE_MELEE && m_nAmmoTotal == 0 ) + if ( GetInfo()->m_eWeaponFire != WEAPON_FIRE_MELEE && m_nAmmoTotal == 0 ) { m_eWeaponState = WEAPONSTATE_OUT_OF_AMMO; - else + // TODO(Miami): CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo + } else m_eWeaponState = WEAPONSTATE_READY; } |