summaryrefslogtreecommitdiffstats
path: root/src/peds/PedFight.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2020-12-28 01:52:23 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2020-12-28 01:52:23 +0100
commit7b2f17826a5db72d264a5c4c2556cd914f272041 (patch)
tree895a6ea57af3b523503aaa7100a883b4f1e5bc39 /src/peds/PedFight.cpp
parentPed: WeaponInfo: little fixes and renamings (diff)
downloadre3-7b2f17826a5db72d264a5c4c2556cd914f272041.tar
re3-7b2f17826a5db72d264a5c4c2556cd914f272041.tar.gz
re3-7b2f17826a5db72d264a5c4c2556cd914f272041.tar.bz2
re3-7b2f17826a5db72d264a5c4c2556cd914f272041.tar.lz
re3-7b2f17826a5db72d264a5c4c2556cd914f272041.tar.xz
re3-7b2f17826a5db72d264a5c4c2556cd914f272041.tar.zst
re3-7b2f17826a5db72d264a5c4c2556cd914f272041.zip
Diffstat (limited to '')
-rw-r--r--src/peds/PedFight.cpp48
1 files changed, 20 insertions, 28 deletions
diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp
index 8208163b..79c6f367 100644
--- a/src/peds/PedFight.cpp
+++ b/src/peds/PedFight.cpp
@@ -972,20 +972,12 @@ CPed::Attack(void)
// Anim loop end, either start the loop again or finish the attack
if (weaponAnimTime > animLoopEnd || !weaponAnimAssoc->IsRunning() && ourWeaponFire != WEAPON_FIRE_PROJECTILE) {
if (GetWeapon()->m_eWeaponState == WEAPONSTATE_RELOADING) {
- if (ourWeapon->IsFlagSet(WEAPONFLAG_RELOAD) && !reloadAnimAssoc) {
+ if (GetReloadAnim(ourWeapon) && !reloadAnimAssoc) {
if (!CWorld::Players[CWorld::PlayerInFocus].m_bFastReload) {
- CAnimBlendAssociation *newReloadAssoc;
- if (bIsDucking) {
- newReloadAssoc = CAnimManager::BlendAnimation(
- GetClump(), ourWeapon->m_AnimToPlay,
- GetCrouchReloadAnim(ourWeapon),
- 8.0f);
- } else {
- newReloadAssoc = CAnimManager::BlendAnimation(
- GetClump(), ourWeapon->m_AnimToPlay,
- GetReloadAnim(ourWeapon),
- 8.0f);
- }
+ CAnimBlendAssociation *newReloadAssoc = CAnimManager::BlendAnimation(
+ GetClump(), ourWeapon->m_AnimToPlay,
+ bIsDucking && GetCrouchReloadAnim(ourWeapon) ? GetCrouchReloadAnim(ourWeapon) : GetReloadAnim(ourWeapon),
+ 8.0f);
newReloadAssoc->SetFinishCallback(FinishedReloadCB, this);
}
ClearLookFlag();
@@ -1029,23 +1021,23 @@ CPed::Attack(void)
weaponAnimAssoc->SetCurrentTime(animLoopStart);
weaponAnimAssoc->SetRun();
}
- }
- } else if (IsPlayer() && m_pPointGunAt && bIsAimingGun && GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING) {
- weaponAnimAssoc->SetCurrentTime(animLoopEnd);
- weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
- SetPointGunAt(m_pPointGunAt);
- } else {
- ClearAimFlag();
+ } else if (IsPlayer() && m_pPointGunAt && bIsAimingGun && GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING) {
+ weaponAnimAssoc->SetCurrentTime(animLoopEnd);
+ weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
+ SetPointGunAt(m_pPointGunAt);
+ } else {
+ ClearAimFlag();
- // Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading)
- if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < animLoopEnd)
- DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, ourWeaponType);
+ // Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading)
+ if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < animLoopEnd)
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, ourWeaponType);
- // Fun fact: removing this part leds to reloading flamethrower
- if (ourWeaponType == WEAPONTYPE_FLAMETHROWER && weaponAnimAssoc->IsRunning()) {
- weaponAnimAssoc->flags |= ASSOC_DELETEFADEDOUT;
- weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
- weaponAnimAssoc->blendDelta = -4.0f;
+ // Fun fact: removing this part leds to reloading flamethrower
+ if (ourWeaponType == WEAPONTYPE_FLAMETHROWER && weaponAnimAssoc->IsRunning()) {
+ weaponAnimAssoc->flags |= ASSOC_DELETEFADEDOUT;
+ weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
+ weaponAnimAssoc->blendDelta = -4.0f;
+ }
}
}