diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-12-26 13:21:45 +0100 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-12-26 13:21:45 +0100 |
commit | d459ef882082f41a94b9ae9c298d361b15374cfd (patch) | |
tree | 1fd023b4e241800eb9f60b9b9c38e1c0933a5b69 /src/weapons | |
parent | unfix particle bug (diff) | |
download | re3-d459ef882082f41a94b9ae9c298d361b15374cfd.tar re3-d459ef882082f41a94b9ae9c298d361b15374cfd.tar.gz re3-d459ef882082f41a94b9ae9c298d361b15374cfd.tar.bz2 re3-d459ef882082f41a94b9ae9c298d361b15374cfd.tar.lz re3-d459ef882082f41a94b9ae9c298d361b15374cfd.tar.xz re3-d459ef882082f41a94b9ae9c298d361b15374cfd.tar.zst re3-d459ef882082f41a94b9ae9c298d361b15374cfd.zip |
Diffstat (limited to '')
-rw-r--r-- | src/weapons/ShotInfo.cpp | 6 | ||||
-rw-r--r-- | src/weapons/WeaponInfo.cpp | 18 | ||||
-rw-r--r-- | src/weapons/WeaponInfo.h | 30 |
3 files changed, 22 insertions, 32 deletions
diff --git a/src/weapons/ShotInfo.cpp b/src/weapons/ShotInfo.cpp index c0ab9ac1..e604093c 100644 --- a/src/weapons/ShotInfo.cpp +++ b/src/weapons/ShotInfo.cpp @@ -76,7 +76,7 @@ CShotInfo::AddShot(CEntity *sourceEntity, eWeaponType weapon, CVector startPos, gaShotInfo[slot].m_areaAffected.z += CShotInfo::ms_afRandTable[CGeneral::GetRandomNumber() % ARRAY_SIZE(ms_afRandTable)]; } gaShotInfo[slot].m_areaAffected.Normalise(); - if (weaponInfo->m_bRandSpeed) + if (weaponInfo->IsFlagSet(WEAPONFLAG_RAND_SPEED)) gaShotInfo[slot].m_areaAffected *= CShotInfo::ms_afRandTable[CGeneral::GetRandomNumber() % ARRAY_SIZE(ms_afRandTable)] + weaponInfo->m_fSpeed; else gaShotInfo[slot].m_areaAffected *= weaponInfo->m_fSpeed; @@ -117,10 +117,10 @@ CShotInfo::Update() shot.m_inUse = false; } - if (weaponInfo->m_bSlowsDown) + if (weaponInfo->IsFlagSet(WEAPONFLAG_SLOWS_DOWN)) shot.m_areaAffected *= pow(0.96, CTimer::GetTimeStep()); // FRAMERATE - if (weaponInfo->m_bExpands) + if (weaponInfo->IsFlagSet(WEAPONFLAG_EXPANDS)) shot.m_radius += 0.075f * CTimer::GetTimeStep(); shot.m_startPos += CTimer::GetTimeStep() * shot.m_areaAffected; diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp index 69d2faed..546aa6ba 100644 --- a/src/weapons/WeaponInfo.cpp +++ b/src/weapons/WeaponInfo.cpp @@ -39,11 +39,7 @@ CWeaponInfo::Initialise(void) ms_apWeaponInfos[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT; ms_apWeaponInfos[i].m_AnimToPlay = ANIM_PUNCH_R; ms_apWeaponInfos[i].m_Anim2ToPlay = NUM_ANIMS; - ms_apWeaponInfos[i].m_bUseGravity = 1; - ms_apWeaponInfos[i].m_bSlowsDown = 1; - ms_apWeaponInfos[i].m_bRandSpeed = 1; - ms_apWeaponInfos[i].m_bExpands = 1; - ms_apWeaponInfos[i].m_bExplodes = 1; + ms_apWeaponInfos[i].m_Flags = WEAPONFLAG_USE_GRAVITY | WEAPONFLAG_SLOWS_DOWN | WEAPONFLAG_RAND_SPEED | WEAPONFLAG_EXPANDS | WEAPONFLAG_EXPLODES; } debug("Loading weapon data...\n"); LoadWeaponData(); @@ -160,17 +156,7 @@ CWeaponInfo::LoadWeaponData(void) ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire / 30.0f; ms_apWeaponInfos[weaponType].m_fAnim2FrameFire = delayBetweenAnim2AndFire / 30.0f; ms_apWeaponInfos[weaponType].m_nModelId = modelId; - ms_apWeaponInfos[weaponType].m_bUseGravity = flags & 1; - ms_apWeaponInfos[weaponType].m_bSlowsDown = (flags >> 1) & 1; - ms_apWeaponInfos[weaponType].m_bDissipates = (flags >> 2) & 1; - ms_apWeaponInfos[weaponType].m_bRandSpeed = (flags >> 3) & 1; - ms_apWeaponInfos[weaponType].m_bExpands = (flags >> 4) & 1; - ms_apWeaponInfos[weaponType].m_bExplodes = (flags >> 5) & 1; - ms_apWeaponInfos[weaponType].m_bCanAim = (flags >> 6) & 1; - ms_apWeaponInfos[weaponType].m_bCanAimWithArm = (flags >> 7) & 1; - ms_apWeaponInfos[weaponType].m_b1stPerson = (flags >> 8) & 1; - ms_apWeaponInfos[weaponType].m_bHeavy = (flags >> 9) & 1; - ms_apWeaponInfos[weaponType].m_bThrow = (flags >> 10) & 1; + ms_apWeaponInfos[weaponType].m_Flags = flags; } } diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h index c89dd482..69ad1f39 100644 --- a/src/weapons/WeaponInfo.h +++ b/src/weapons/WeaponInfo.h @@ -3,8 +3,22 @@ #include "AnimationId.h" #include "WeaponType.h" +enum +{ + WEAPONFLAG_USE_GRAVITY = 1, + WEAPONFLAG_SLOWS_DOWN = 1 << 1, + WEAPONFLAG_DISSIPATES = 1 << 2, + WEAPONFLAG_RAND_SPEED = 1 << 3, + WEAPONFLAG_EXPANDS = 1 << 4, + WEAPONFLAG_EXPLODES = 1 << 5, + WEAPONFLAG_CANAIM = 1 << 6, + WEAPONFLAG_CANAIM_WITHARM = 1 << 7, + WEAPONFLAG_1ST_PERSON = 1 << 8, + WEAPONFLAG_HEAVY = 1 << 9, + WEAPONFLAG_THROW = 1 << 10, +}; + class CWeaponInfo { -// static CWeaponInfo(&ms_apWeaponInfos)[14]; static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE]; public: eWeaponFire m_eWeaponFire; @@ -25,18 +39,7 @@ public: float m_fAnimFrameFire; float m_fAnim2FrameFire; int32 m_nModelId; - // flags - uint8 m_bUseGravity : 1; - uint8 m_bSlowsDown : 1; - uint8 m_bDissipates : 1; - uint8 m_bRandSpeed : 1; - uint8 m_bExpands : 1; - uint8 m_bExplodes : 1; - uint8 m_bCanAim : 1; - uint8 m_bCanAimWithArm : 1; - uint8 m_b1stPerson : 1; - uint8 m_bHeavy : 1; - uint8 m_bThrow : 1; + uint32 m_Flags; static void Initialise(void); static void LoadWeaponData(void); @@ -44,6 +47,7 @@ public: static eWeaponFire FindWeaponFireType(char *name); static eWeaponType FindWeaponType(char *name); static void Shutdown(void); + bool IsFlagSet(uint32 flag) const { return (m_Flags & flag) != 0; } }; VALIDATE_SIZE(CWeaponInfo, 0x54);
\ No newline at end of file |