diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-12-26 13:22:02 +0100 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-12-26 13:22:02 +0100 |
commit | c9c447e7a9f9616b111b9d6211ac072e7739ba4c (patch) | |
tree | 15b4054d867ea8f60b90550033ccf85cbfc86102 /src/peds | |
parent | fix mblur stencil (diff) | |
download | re3-c9c447e7a9f9616b111b9d6211ac072e7739ba4c.tar re3-c9c447e7a9f9616b111b9d6211ac072e7739ba4c.tar.gz re3-c9c447e7a9f9616b111b9d6211ac072e7739ba4c.tar.bz2 re3-c9c447e7a9f9616b111b9d6211ac072e7739ba4c.tar.lz re3-c9c447e7a9f9616b111b9d6211ac072e7739ba4c.tar.xz re3-c9c447e7a9f9616b111b9d6211ac072e7739ba4c.tar.zst re3-c9c447e7a9f9616b111b9d6211ac072e7739ba4c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/peds/Ped.cpp | 6 | ||||
-rw-r--r-- | src/peds/Ped.h | 32 | ||||
-rw-r--r-- | src/peds/PedFight.cpp | 83 | ||||
-rw-r--r-- | src/peds/PlayerPed.cpp | 32 |
4 files changed, 81 insertions, 72 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 020b2eac..312be34b 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -1183,7 +1183,7 @@ CPed::SetAimFlag(float angle) if (bIsDucking) m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; - if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm) + if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; @@ -1273,7 +1273,7 @@ CPed::RestoreGunPosition(void) bool CPed::CanWeRunAndFireWithWeapon(void) { - return CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm; + return CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM); } // --MIAMI: Done @@ -5597,7 +5597,7 @@ CPed::SetSeek(CVector pos, float distanceToCountDone) || (m_nPedState == PED_SEEK_POS && m_vecSeekPos.x == pos.x && m_vecSeekPos.y == pos.y) || m_nPedState == PED_FOLLOW_PATH) return; - if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm) { + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) { ClearPointGunAt(); } diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 5683c7c9..88a16a95 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -1002,23 +1002,23 @@ public: // My names. Inlined in VC AnimationId GetFireAnimNotDucking(CWeaponInfo* weapon) { - if (m_nPedType == PEDTYPE_COP && !!weapon->m_bCop3rd) + if (m_nPedType == PEDTYPE_COP && weapon->IsFlagSet(WEAPONFLAG_COP3_RD)) return ANIM_WEAPON_FIRE_3RD; else return GetPrimaryFireAnim(weapon); } static AnimationId Get3rdFireAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bCop3rd) + if (weapon->IsFlagSet(WEAPONFLAG_COP3_RD)) return ANIM_WEAPON_FIRE_3RD; else return (AnimationId)0; } static AnimationId GetFireAnimGround(CWeaponInfo* weapon, bool kickFloorIfNone = true) { - if (!!weapon->m_bGround2nd) + if (weapon->IsFlagSet(WEAPONFLAG_GROUND_2ND)) return ANIM_WEAPON_CROUCHFIRE; - else if (!!weapon->m_bGround3rd) + else if (weapon->IsFlagSet(WEAPONFLAG_GROUND_3RD)) return ANIM_WEAPON_FIRE_3RD; else if (kickFloorIfNone) return ANIM_KICK_FLOOR; @@ -1027,60 +1027,68 @@ public: } static AnimationId GetPrimaryFireAnim(CWeaponInfo* weapon) { - if (weapon->m_bAnimDetonate) + if (weapon->IsFlagSet(WEAPONFLAG_ANIMDETONATE)) return ANIM_BOMBER; else return ANIM_WEAPON_FIRE; } static AnimationId GetCrouchReloadAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bReload) + if (weapon->IsFlagSet(WEAPONFLAG_RELOAD)) return ANIM_WEAPON_CROUCHRELOAD; else return (AnimationId)0; } static AnimationId GetCrouchFireAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bCrouchFire) + if (weapon->IsFlagSet(WEAPONFLAG_CROUCHFIRE)) return ANIM_WEAPON_CROUCHFIRE; else return (AnimationId)0; } static AnimationId GetReloadAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bReload) + if (weapon->IsFlagSet(WEAPONFLAG_RELOAD)) return ANIM_WEAPON_RELOAD; else return (AnimationId)0; } static AnimationId GetFightIdleWithMeleeAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bFightMode) + if (weapon->IsFlagSet(WEAPONFLAG_FIGHTMODE)) return ANIM_MELEE_IDLE_FIGHTMODE; else return (AnimationId)0; } static AnimationId GetFinishingAttackAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bFinish3rd) + if (weapon->IsFlagSet(WEAPONFLAG_FINISH_3RD)) return ANIM_MELEE_ATTACK_FINISH; else return (AnimationId)0; } static AnimationId GetSecondFireAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bUse2nd) + if (weapon->IsFlagSet(WEAPONFLAG_USE_2ND)) return ANIM_WEAPON_FIRE_2ND; // or ANIM_MELEE_ATTACK_2ND else return (AnimationId)0; } static AnimationId GetMeleeStartAnim(CWeaponInfo* weapon) { - if (!!weapon->m_bPartialAttack) + if (weapon->IsFlagSet(WEAPONFLAG_PARTIALATTACK)) return ANIM_MELEE_ATTACK_START; else return (AnimationId)0; } + + static AnimationId GetThrowAnim(CWeaponInfo *weapon) + { + if (weapon->IsFlagSet(WEAPONFLAG_THROW)) + return ANIM_THROWABLE_START_THROW; + else + return (AnimationId)0; + } // -- // My additions, because there were many, many instances of that. diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp index 25ca2210..8208163b 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -210,7 +210,7 @@ CPed::PointGunAt(void) float animLoopStart = weaponInfo->m_fAnimLoopStart; CAnimBlendAssociation *weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_FIRE); if (!weaponAssoc || weaponAssoc->blendDelta < 0.0f) { - if (!!weaponInfo->m_bCrouchFire) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CROUCHFIRE)) { weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(weaponInfo)); animLoopStart = weaponInfo->m_fAnim2LoopStart; } @@ -223,7 +223,7 @@ CPed::PointGunAt(void) if (bIsDucking) m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; - if (weaponInfo->m_bCanAimWithArm) + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; @@ -247,7 +247,7 @@ CPed::ClearPointGunAt(void) weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_FIRE); if (!animAssoc || animAssoc->blendDelta < 0.0f) { - if (!!weaponInfo->m_bCrouchFire) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CROUCHFIRE)) { animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(weaponInfo)); } } @@ -271,7 +271,7 @@ CPed::SetAttack(CEntity *victim) if (m_attackTimer > CTimer::GetTimeInMilliseconds() || m_nWaitState == WAITSTATE_SURPRISE || (bIsDucking && !bCrouchWhenShooting)) return; - if (curWeapon->m_bReload && + if (curWeapon->IsFlagSet(WEAPONFLAG_RELOAD) && (RpAnimBlendClumpGetAssociation(GetClump(), GetReloadAnim(curWeapon)) || RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchReloadAnim(curWeapon)))) { if (!IsPlayer() || m_nPedState != PED_ATTACK || ((CPlayerPed*)this)->m_bHaveTargetSelected) bIsAttacking = false; @@ -281,10 +281,10 @@ CPed::SetAttack(CEntity *victim) return; } - if (GetWeapon()->m_eWeaponType == WEAPONTYPE_UNARMED || curWeapon->m_bFightMode || GetWeapon()->m_eWeaponType == WEAPONTYPE_BRASSKNUCKLE) { + if (GetWeapon()->m_eWeaponType == WEAPONTYPE_UNARMED || curWeapon->IsFlagSet(WEAPONFLAG_FIGHTMODE) || GetWeapon()->m_eWeaponType == WEAPONTYPE_BRASSKNUCKLE) { if (IsPlayer() || (m_nPedState != PED_FIGHT && m_nMoveState != PEDMOVE_NONE && m_nMoveState != PEDMOVE_STILL - && !(m_pedStats->m_flags & STAT_SHOPPING_BAGS) && curWeapon->m_bPartialAttack)) { + && !(m_pedStats->m_flags & STAT_SHOPPING_BAGS) && curWeapon->IsFlagSet(WEAPONFLAG_PARTIALATTACK))) { if (m_nPedState != PED_ATTACK) { SetPedState(PED_ATTACK); @@ -303,7 +303,7 @@ CPed::SetAttack(CEntity *victim) return; } - if (curWeapon->m_bPartialAttack && + if (curWeapon->IsFlagSet(WEAPONFLAG_PARTIALATTACK) && (IsPlayer() && ((CPlayerPed*)this)->m_fMoveSpeed >= 1.0f || m_nMoveState == PEDMOVE_WALK || m_nMoveState == PEDMOVE_RUN)) { @@ -326,7 +326,7 @@ CPed::SetAttack(CEntity *victim) if (m_pSeekTarget) m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); - if (curWeapon->m_bCanAim) { + if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM)) { CVector aimPos = GetRight() * 0.1f + GetForward() * 0.2f + GetPosition(); aimPos += GetUp() * 0.35f; CEntity *obstacle = CWorld::TestSphereAgainstWorld(aimPos, 0.2f, nil, true, false, false, true, false, false); @@ -354,7 +354,7 @@ CPed::SetAttack(CEntity *victim) } else if (this == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam()) { SetAimFlag(m_fRotationCur); ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch(); - } else if (curWeapon->m_bCanAimWithArm) { + } else if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) { SetAimFlag(m_fRotationCur); } } @@ -380,7 +380,7 @@ CPed::SetAttack(CEntity *victim) if (pointBlankStatus == POINT_BLANK_FOR_WANTED_PED || !victimPed && (IsPlayer() || !m_carInObjective)) StartFightAttack(200); } else { - if (!curWeapon->m_bCanAim) + if (!curWeapon->IsFlagSet(WEAPONFLAG_CANAIM)) m_pSeekTarget = nil; if (m_nPedState != PED_AIM_GUN) @@ -388,7 +388,7 @@ CPed::SetAttack(CEntity *victim) SetPedState(PED_ATTACK); SetMoveState(PEDMOVE_NONE); - if (bCrouchWhenShooting && bIsDucking && !!curWeapon->m_bCrouchFire) { + if (bCrouchWhenShooting && bIsDucking && curWeapon->IsFlagSet(WEAPONFLAG_CROUCHFIRE)) { CAnimBlendAssociation* curMoveAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(curWeapon)); if (curMoveAssoc) { if (strcmp(CAnimManager::GetAnimAssociation(curWeapon->m_AnimToPlay, GetCrouchFireAnim(curWeapon))->hierarchy->name, curMoveAssoc->hierarchy->name) != 0) { @@ -402,9 +402,9 @@ CPed::SetAttack(CEntity *victim) animDelta = 1000.0f; AnimationId fireAnim; - if (curWeapon->m_bThrow) + if (curWeapon->IsFlagSet(WEAPONFLAG_THROW)) fireAnim = ANIM_THROWABLE_START_THROW; - else if (CGame::nastyGame && (curWeapon->m_bGround2nd || curWeapon->m_bGround3rd)) { + else if (CGame::nastyGame && (curWeapon->IsFlagSet(WEAPONFLAG_GROUND_2ND) || curWeapon->IsFlagSet(WEAPONFLAG_GROUND_3RD))) { PedOnGroundState pedOnGround = CheckForPedsOnGroundToAttack(this, nil); if (pedOnGround > PED_IN_FRONT_OF_ATTACKER || pedOnGround == NO_PED && bIsStanding && m_pCurSurface && m_pCurSurface->IsVehicle()) { fireAnim = GetFireAnimGround(curWeapon, false); @@ -589,17 +589,17 @@ CPed::FinishedReloadCB(CAnimBlendAssociation *reloadAssoc, void *arg) if (ped->bIsDucking && ped->bCrouchWhenShooting) { CAnimBlendAssociation *crouchFireAssoc = nil; - if (!!weapon->m_bCrouchFire) { + if (weapon->IsFlagSet(WEAPONFLAG_CROUCHFIRE)) { crouchFireAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), GetCrouchFireAnim(weapon)); } - if (!!weapon->m_bReload && reloadAssoc) { + if (weapon->IsFlagSet(WEAPONFLAG_RELOAD) && reloadAssoc) { if (reloadAssoc->animId == GetCrouchReloadAnim(weapon) && !crouchFireAssoc) { CAnimBlendAssociation *crouchAssoc = CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_WEAPON_CROUCH, 8.0f); crouchAssoc->SetCurrentTime(crouchAssoc->hierarchy->totalLength); crouchAssoc->flags &= ~ASSOC_RUNNING; } } - } else if (weapon->m_bReloadLoop2Start && ped->bIsAttacking) { + } else if (weapon->IsFlagSet(WEAPONFLAG_RELOAD_LOOP2START) && ped->bIsAttacking) { CAnimBlendAssociation *fireAssoc = CAnimManager::BlendAnimation(ped->GetClump(), weapon->m_AnimToPlay, GetPrimaryFireAnim(weapon), 8.0f); fireAssoc->SetFinishCallback(FinishedAttackCB, ped); @@ -677,7 +677,7 @@ CPed::Attack(void) ourWeapon = CWeaponInfo::GetWeaponInfo(ourWeaponType); ourWeaponFire = ourWeapon->m_eWeaponFire; weaponAnimAssoc = nil; - attackShouldContinue = bIsAttacking; + attackShouldContinue = !!bIsAttacking; reloadAnimAssoc = nil; throwAssoc = nil; animLoopStart = ourWeapon->m_fAnimLoopStart; @@ -686,7 +686,7 @@ CPed::Attack(void) weaponAnim = ourWeapon->m_AnimToPlay; if (bIsDucking) { - if (!!ourWeapon->m_bCrouchFire && bCrouchWhenShooting) { + if(GetCrouchFireAnim(ourWeapon) && bCrouchWhenShooting) { weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchFireAnim(ourWeapon)); if (weaponAnimAssoc) { animLoopStart = ourWeapon->m_fAnim2LoopStart; @@ -704,11 +704,11 @@ CPed::Attack(void) } } - if (ourWeapon->m_bReload) { + if (GetReloadAnim(ourWeapon)) { reloadAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetReloadAnim(ourWeapon)); } - if (!!ourWeapon->m_bReload && !reloadAnimAssoc) { + if (GetCrouchReloadAnim(ourWeapon) && !reloadAnimAssoc) { reloadAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetCrouchReloadAnim(ourWeapon)); } @@ -724,8 +724,8 @@ CPed::Attack(void) reloadAnimAssoc->blendDelta = -8.0f; } - if (!!ourWeapon->m_bThrow) { - throwAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_THROWABLE_START_THROW); + if (GetThrowAnim(ourWeapon)) { + throwAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetThrowAnim(ourWeapon)); } if ( CTimer::GetTimeInMilliseconds() < m_shootTimer ) @@ -733,8 +733,8 @@ CPed::Attack(void) bool meleeAttackStarted = false; if ( !weaponAnimAssoc ) { - if (!!ourWeapon->m_bPartialAttack) { - weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_MELEE_ATTACK_START); + if (GetMeleeStartAnim(ourWeapon)) { + weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetMeleeStartAnim(ourWeapon)); if ( weaponAnimAssoc ) { if ( IsPlayer() ) meleeAttackStarted = true; @@ -757,7 +757,7 @@ CPed::Attack(void) } } if (!weaponAnimAssoc) { - if (!!ourWeapon->m_bUse2nd) { + if (GetSecondFireAnim(ourWeapon)) { weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetSecondFireAnim(ourWeapon)); if (weaponAnimAssoc) { animLoopStart = ourWeapon->m_fAnim2LoopStart; @@ -779,14 +779,15 @@ CPed::Attack(void) if (!throwAssoc) { if (attackShouldContinue) { if (ourWeaponFire != WEAPON_FIRE_PROJECTILE || !IsPlayer() || ((CPlayerPed*)this)->m_bHaveTargetSelected) { - if (bCrouchWhenShooting && bIsDucking && !!ourWeapon->m_bCrouchFire) { + if (bCrouchWhenShooting && bIsDucking && GetCrouchFireAnim(ourWeapon)) { weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, GetCrouchFireAnim(ourWeapon), 8.0f); } else if(GetSecondFireAnim(ourWeapon) && CGeneral::GetRandomNumber() & 1){ weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, GetSecondFireAnim(ourWeapon), 8.0f); - } else if (!CGame::nastyGame || (!ourWeapon->m_bGround2nd && !ourWeapon->m_bGround3rd) || - ourWeaponFire != WEAPON_FIRE_MELEE || CheckForPedsOnGroundToAttack(this, nil) < PED_ON_THE_FLOOR) { + } else if(!CGame::nastyGame || ourWeaponFire != WEAPON_FIRE_MELEE || + GetFireAnimGround(ourWeapon) || + CheckForPedsOnGroundToAttack(this, nil) < PED_ON_THE_FLOOR) { weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, GetFireAnimNotDucking(ourWeapon), 8.0f); @@ -824,7 +825,7 @@ CPed::Attack(void) float animStart = animLoopStart * 0.4f; weaponAnimTime = weaponAnimAssoc->currentTime; if (weaponAnimTime > animStart && weaponAnimTime - weaponAnimAssoc->timeStep <= animStart) { - if (!bIsDucking && !(m_nPedType == PEDTYPE_COP && ourWeapon->m_bCop3rd && weaponAnimAssoc->animId == ANIM_WEAPON_FIRE_3RD) && ourWeapon->m_bCanAimWithArm) + if (!bIsDucking && !GetFireAnimNotDucking(ourWeapon) && ourWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; @@ -860,7 +861,7 @@ CPed::Attack(void) if (ourWeaponType == WEAPONTYPE_MOLOTOV || ourWeaponType == WEAPONTYPE_GRENADE || ourWeaponType == WEAPONTYPE_DETONATOR_GRENADE || ourWeaponType == WEAPONTYPE_TEARGAS) { - RemoveWeaponModel(ourWeapon->m_nModelId); + RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nModelId); } if (!GetWeapon()->m_nAmmoTotal && ourWeaponFire != WEAPON_FIRE_MELEE && FindPlayerPed() != this) { SelectGunIfArmed(); @@ -921,9 +922,9 @@ CPed::Attack(void) if (ourWeapon->m_eWeaponFire == WEAPON_FIRE_INSTANT_HIT && ourWeapon->m_AnimToPlay == ASSOCGRP_SHOTGUN) { weaponAnimTime = weaponAnimAssoc->currentTime; - firePos = ourWeapon->m_vecFireOffset; if (weaponAnimTime > 1.0f && weaponAnimTime - weaponAnimAssoc->timeStep <= 1.0f && weaponAnimAssoc->IsRunning()) { + firePos = ourWeapon->m_vecFireOffset; TransformToNode(firePos, PED_HANDR); CVector gunshellPos( @@ -971,7 +972,7 @@ 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->m_bReload && !reloadAnimAssoc) { + if (ourWeapon->IsFlagSet(WEAPONFLAG_RELOAD) && !reloadAnimAssoc) { if (!CWorld::Players[CWorld::PlayerInFocus].m_bFastReload) { CAnimBlendAssociation *newReloadAssoc; if (bIsDucking) { @@ -1010,14 +1011,14 @@ CPed::Attack(void) if (weaponAnimAssoc->animId == fireAnim) weaponAnimAssoc->SetCurrentTime(0.1f); else { - if (fireAnim) { + if (GetFireAnimGround(ourWeapon, false)) { weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, fireAnim, 8.0f); } else { weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_KICK_FLOOR, 8.0f); } } weaponAnimAssoc->SetFinishCallback(FinishedAttackCB, this); - } else if (!!ourWeapon->m_bUse2nd) { + } else if (GetSecondFireAnim(ourWeapon)) { if (weaponAnimAssoc->animId == GetSecondFireAnim(ourWeapon)) { weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, ANIM_WEAPON_FIRE, 8.0f); } else { @@ -1333,7 +1334,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) m_fightButtonPressure = 0; } else if (IsPlayer() && GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE && - !CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bFightMode) { + !CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_FIGHTMODE)) { CAnimBlendAssociation *moveAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_curFightMove].animId, 4.0f); moveAssoc->SetCurrentTime(0.0f); moveAssoc->speed = 1.2f; @@ -1401,7 +1402,7 @@ CPed::Fight(void) eWeaponType weapon = GetWeapon()->m_eWeaponType; CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(weapon); - if (weaponInfo->m_bFightMode && weapon != WEAPONTYPE_UNARMED) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_FIGHTMODE) && weapon != WEAPONTYPE_UNARMED) { fightWithWeapon = true; tFightMoves[FIGHTMOVE_MELEE1].startFireTime = weaponInfo->m_fAnimFrameFire; tFightMoves[FIGHTMOVE_MELEE1].endFireTime = weaponInfo->m_fAnimLoopEnd; @@ -1650,9 +1651,9 @@ CPed::ChooseAttackAI(uint8 buttonPressure, bool fightWithWeapon) if (m_pedInObjective->OnGroundOrGettingUp()) { if (CGame::nastyGame && dist < 1.2f && !m_pedInObjective->IsPlayer() && (m_pedInObjective->m_nPedState == PED_DEAD || !m_pedInObjective->IsPedHeadAbovePos(-0.3f))) { - if (weaponInfo->m_bGround2nd) + if (weaponInfo->IsFlagSet(WEAPONFLAG_GROUND_2ND)) return FIGHTMOVE_MELEE2; - if (weaponInfo->m_bGround3rd) + if (weaponInfo->IsFlagSet(WEAPONFLAG_GROUND_3RD)) return FIGHTMOVE_MELEE3; return FIGHTMOVE_GROUNDKICK; @@ -1880,9 +1881,9 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon) Say(SOUND_PED_ATTACK); } else if (groundAttackAlivePed || groundAttackDeadPed) { - if (fightWithWeapon && weaponInfo->m_bGround2nd) { + if (fightWithWeapon && weaponInfo->IsFlagSet(WEAPONFLAG_GROUND_2ND)) { choosenMove = FIGHTMOVE_MELEE2; - } else if (fightWithWeapon && weaponInfo->m_bGround3rd) { + } else if (fightWithWeapon && weaponInfo->IsFlagSet(WEAPONFLAG_GROUND_3RD)) { choosenMove = FIGHTMOVE_MELEE3; } else { choosenMove = FIGHTMOVE_GROUNDKICK; @@ -2166,7 +2167,7 @@ CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dir, int16 piece) bool fightingWithWeapon = false; int damageMult = tFightMoves[m_curFightMove].damage * ((CGeneral::GetRandomNumber() & 1) + 2) + 1; - if (weaponInfo->m_bFightMode) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_FIGHTMODE)) { fightingWithWeapon = true; if (m_curFightMove >= FIGHTMOVE_MELEE1) { damageMult = weaponInfo->m_nDamage; diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index c84ed4b4..2dbdb59c 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -228,7 +228,7 @@ CPlayerPed::MakeChangesForNewWeapon(eWeaponType weapon) GetWeapon()->m_nAmmoInClip = Min(GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition); - if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAim)) + if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM)) ClearWeaponTarget(); // WEAPONTYPE_SNIPERRIFLE? Wut? @@ -855,7 +855,7 @@ CPlayerPed::PlayerControlFighter(CPad *padUsed) bIsAttacking = false; } - if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy && padUsed->JumpJustDown()) { + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY) && padUsed->JumpJustDown()) { if (m_nEvadeAmount != 0 && m_pEvadingFrom) { SetEvasiveDive((CPhysical*)m_pEvadingFrom, 1); m_nEvadeAmount = 0; @@ -900,13 +900,13 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed) return; } - if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) && padUsed->GetSprint()) { + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY) && padUsed->GetSprint()) { m_nMoveState = PEDMOVE_SPRINT; } if (m_nPedState != PED_FIGHT) SetRealMoveAnim(); - if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) && + if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY)) && padUsed->JumpJustDown() && m_nPedState != PED_JUMP) { ClearAttack(); @@ -1034,14 +1034,14 @@ CPlayerPed::CanIKReachThisTarget(CVector target, CWeapon* weapon, bool zRotImpor float angleToFace = CGeneral::GetRadianAngleBetweenPoints(target.x, target.y, GetPosition().x, GetPosition().y); float angleDiff = CGeneral::LimitRadianAngle(angleToFace - m_fRotationCur); - return (!zRotImportant || CWeaponInfo::GetWeaponInfo(weapon->m_eWeaponType)->m_bCanAimWithArm || Abs(angleDiff) <= HALFPI) && - (CWeaponInfo::GetWeaponInfo(weapon->m_eWeaponType)->m_bCanAimWithArm || Abs(target.z - GetPosition().z) <= (target - GetPosition()).Magnitude2D()); + return (!zRotImportant || CWeaponInfo::GetWeaponInfo(weapon->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM) || Abs(angleDiff) <= HALFPI) && + (CWeaponInfo::GetWeaponInfo(weapon->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM) || Abs(target.z - GetPosition().z) <= (target - GetPosition()).Magnitude2D()); } void CPlayerPed::RotatePlayerToTrackTarget(void) { - if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm) + if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) return; float angleToFace = CGeneral::GetRadianAngleBetweenPoints( @@ -1250,7 +1250,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) bCrouchWhenShooting = false; } - if(weaponInfo->m_bCanAim) + if(weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM)) m_wepAccuracy = 95; else m_wepAccuracy = 100; @@ -1310,7 +1310,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_bHaveTargetSelected = false; } if (GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE && - !weaponInfo->m_bFightMode) { + !weaponInfo->IsFlagSet(WEAPONFLAG_FIGHTMODE)) { if (GetWeapon()->m_eWeaponType != WEAPONTYPE_DETONATOR && GetWeapon()->m_eWeaponType != WEAPONTYPE_DETONATOR_GRENADE || padUsed->WeaponJustDown()) @@ -1342,7 +1342,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) { -#define CAN_AIM_WITH_ARM (weaponInfo->m_bCanAimWithArm && !bIsDucking && !bCrouchWhenShooting) +#define CAN_AIM_WITH_ARM (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM) && !bIsDucking && !bCrouchWhenShooting) // Weapons except throwable and melee ones if (weaponInfo->m_nWeaponSlot > 2) { if ((padUsed->GetTarget() && CAN_AIM_WITH_ARM) || padUsed->GetWeapon()) { @@ -1365,7 +1365,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_headingRate = 12.5f; // Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly) - if (weaponInfo->m_bCanAim && padUsed->WeaponJustDown()) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) && padUsed->WeaponJustDown()) { m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur); float limitedRotDest = m_fRotationDest; @@ -1392,7 +1392,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) } #endif - if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT && !TheCamera.Using1stPersonWeaponMode() && weaponInfo->m_bCanAim) { + if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT && !TheCamera.Using1stPersonWeaponMode() && weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM)) { if (m_pPointGunAt) { // what?? if (!m_pPointGunAt @@ -1415,7 +1415,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) return; } if (CPlayerPed::DoesTargetHaveToBeBroken(m_pPointGunAt->GetPosition(), GetWeapon()) || - (!bCanPointGunAtTarget && !weaponInfo->m_bCanAimWithArm)) { // this line isn't on Mobile, idk why + (!bCanPointGunAtTarget && !weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM))) { // this line isn't on Mobile, idk why ClearWeaponTarget(); return; } @@ -1460,7 +1460,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) bool CPlayerPed::MovementDisabledBecauseOfTargeting(void) { - return m_pPointGunAt && !CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm; + return m_pPointGunAt && !CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM); } // --MIAMI: Done @@ -1521,7 +1521,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed) return; } - if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) && padUsed->GetSprint()) { + if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY) && padUsed->GetSprint()) { if (!m_pCurrentPhysSurface || (!m_pCurrentPhysSurface->bInfiniteMass || m_pCurrentPhysSurface->m_phy_flagA08)) m_nMoveState = PEDMOVE_SPRINT; } @@ -1529,7 +1529,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed) if (m_nPedState != PED_FIGHT) SetRealMoveAnim(); - if (!bIsInTheAir && !(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bHeavy) + if (!bIsInTheAir && !CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_HEAVY) && padUsed->JumpJustDown() && m_nPedState != PED_JUMP) { ClearAttack(); ClearWeaponTarget(); |