diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-12-26 14:21:45 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-12-26 14:21:45 +0200 |
commit | d459ef882082f41a94b9ae9c298d361b15374cfd (patch) | |
tree | 1fd023b4e241800eb9f60b9b9c38e1c0933a5b69 /src/peds | |
parent | 612470cb3f88c0bf59be8684f9c251e7c93497ef (diff) |
Weapon flags changed from bit fields to bit mask (R* vision)
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/Ped.cpp | 2 | ||||
-rw-r--r-- | src/peds/PedFight.cpp | 12 | ||||
-rw-r--r-- | src/peds/PlayerPed.cpp | 24 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index b8b3e92c..3d2278bd 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -1046,7 +1046,7 @@ CPed::SetAimFlag(float angle) m_lookTimer = 0; m_pLookTarget = nil; m_pSeekTarget = nil; - 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; diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp index 6188f019..ca720479 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -201,7 +201,7 @@ CPed::PointGunAt(void) weaponAssoc->SetCurrentTime(weaponInfo->m_fAnimLoopStart); weaponAssoc->flags &= ~ASSOC_RUNNING; - 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; @@ -300,7 +300,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(); CEntity *obstacle = CWorld::TestSphereAgainstWorld(aimPos, 0.2f, nil, true, false, false, true, false, false); if (obstacle) @@ -342,7 +342,7 @@ CPed::SetAttack(CEntity *victim) if (pointBlankStatus == POINT_BLANK_FOR_WANTED_PED || !victimPed) StartFightAttack(200); } else { - if (!curWeapon->m_bCanAim) + if (!curWeapon->IsFlagSet(WEAPONFLAG_CANAIM)) m_pSeekTarget = nil; if (m_nPedState != PED_AIM_GUN) @@ -417,7 +417,7 @@ CPed::ClearAttackByRemovingAnim(void) if (!weaponAssoc) { weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), weapon->m_Anim2ToPlay); - if (!weaponAssoc && weapon->m_bThrow) + if (!weaponAssoc && weapon->IsFlagSet(WEAPONFLAG_THROW)) weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_THROWU); if (!weaponAssoc) { @@ -569,7 +569,7 @@ CPed::Attack(void) delayBetweenAnimAndFire = ourWeapon->m_fAnim2FrameFire; // Long throw granade, molotov - if (!weaponAnimAssoc && ourWeapon->m_bThrow) { + if (!weaponAnimAssoc && ourWeapon->IsFlagSet(WEAPONFLAG_THROW)) { weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_THROWU); delayBetweenAnimAndFire = 0.2f; } @@ -605,7 +605,7 @@ CPed::Attack(void) animStart = ourWeapon->m_fAnimLoopStart; weaponAnimTime = weaponAnimAssoc->currentTime; if (weaponAnimTime > animStart && weaponAnimTime - weaponAnimAssoc->timeStep <= animStart) { - if (ourWeapon->m_bCanAimWithArm) + if (ourWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 330d209b..ef5815ed 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -192,7 +192,7 @@ CPlayerPed::MakeChangesForNewWeapon(int8 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(); CAnimBlendAssociation *weaponAnim = RpAnimBlendClumpGetAssociation(GetClump(), CWeaponInfo::GetWeaponInfo(WEAPONTYPE_SNIPERRIFLE)->m_AnimToPlay); @@ -685,7 +685,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; @@ -723,13 +723,13 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed) m_fMoveSpeed = 0.0f; } } - 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(); ClearWeaponTarget(); @@ -1061,12 +1061,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) { // Weapons except throwable and melee ones - if (weaponInfo->m_bCanAim || weaponInfo->m_b1stPerson || weaponInfo->m_bExpands) { - if ((padUsed->GetTarget() && weaponInfo->m_bCanAimWithArm) || padUsed->GetWeapon()) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) || weaponInfo->IsFlagSet(WEAPONFLAG_1ST_PERSON) || weaponInfo->IsFlagSet(WEAPONFLAG_EXPANDS)) { + if ((padUsed->GetTarget() && weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) || padUsed->GetWeapon()) { float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation); // On this one we can rotate arm. - if (weaponInfo->m_bCanAimWithArm) { + if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) { if (!padUsed->GetWeapon()) { // making this State != ATTACK still stops it after attack. Re-start it immediately! SetPointGunAt(nil); bIsPointingGunAt = false; // to not stop after attack @@ -1083,7 +1083,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_headingRate = 50.0f; // 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; @@ -1096,7 +1096,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2; } } - } else if (weaponInfo->m_bCanAimWithArm && m_nPedState != PED_ATTACK) + } else if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM) && m_nPedState != PED_ATTACK) ClearPointGunAt(); } } @@ -1133,7 +1133,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) TheCamera.UpdateAimingCoors(m_pPointGunAt->GetPosition()); } #ifdef FREE_CAM - else if ((CCamera::bFreeCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE) || (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson)) { + else if ((CCamera::bFreeCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE) || (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) && !CCamera::m_bUseMouse3rdPerson)) { #else else if (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson) { #endif @@ -1215,13 +1215,13 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed) } } - 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(); ClearWeaponTarget(); |