Weapon flags changed from bit fields to bit mask (R* vision)

This commit is contained in:
Sergeanur
2020-12-26 14:21:45 +02:00
parent 612470cb3f
commit d459ef8820
7 changed files with 43 additions and 53 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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();