Merge pull request #128 from lioncash/weap-mode

CWeaponMode: Make constexpr capable
This commit is contained in:
Phillip Stephens 2020-01-30 20:10:21 -08:00 committed by GitHub
commit 234fbb2de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 20 deletions

View File

@ -10,27 +10,23 @@ class CWeaponMode {
bool x4_26_instantKill : 1; bool x4_26_instantKill : 1;
public: public:
CWeaponMode() { constexpr CWeaponMode() : x4_24_charged{false}, x4_25_comboed{false}, x4_26_instantKill{false} {}
x4_24_charged = false; constexpr explicit CWeaponMode(EWeaponType type, bool charged = false, bool comboed = false, bool instaKill = false)
x4_25_comboed = false;
x4_26_instantKill = false;
}
CWeaponMode(EWeaponType type, bool charged = false, bool comboed = false, bool instaKill = false)
: x0_weaponType(type), x4_24_charged(charged), x4_25_comboed(comboed), x4_26_instantKill(instaKill) {} : x0_weaponType(type), x4_24_charged(charged), x4_25_comboed(comboed), x4_26_instantKill(instaKill) {}
EWeaponType GetType() const { return x0_weaponType; } constexpr EWeaponType GetType() const { return x0_weaponType; }
bool IsCharged() const { return x4_24_charged; } constexpr bool IsCharged() const { return x4_24_charged; }
bool IsComboed() const { return x4_25_comboed; } constexpr bool IsComboed() const { return x4_25_comboed; }
bool IsInstantKill() const { return x4_26_instantKill; } constexpr bool IsInstantKill() const { return x4_26_instantKill; }
static CWeaponMode Invalid() { return CWeaponMode(EWeaponType::None); } static constexpr CWeaponMode Invalid() { return CWeaponMode(EWeaponType::None); }
static CWeaponMode Phazon() { return CWeaponMode(EWeaponType::Phazon); } static constexpr CWeaponMode Phazon() { return CWeaponMode(EWeaponType::Phazon); }
static CWeaponMode Plasma() { return CWeaponMode(EWeaponType::Plasma); } static constexpr CWeaponMode Plasma() { return CWeaponMode(EWeaponType::Plasma); }
static CWeaponMode Wave() { return CWeaponMode(EWeaponType::Wave); } static constexpr CWeaponMode Wave() { return CWeaponMode(EWeaponType::Wave); }
static CWeaponMode BoostBall() { return CWeaponMode(EWeaponType::BoostBall); } static constexpr CWeaponMode BoostBall() { return CWeaponMode(EWeaponType::BoostBall); }
static CWeaponMode Ice() { return CWeaponMode(EWeaponType::Ice); } static constexpr CWeaponMode Ice() { return CWeaponMode(EWeaponType::Ice); }
static CWeaponMode Power() { return CWeaponMode(EWeaponType::Power); } static constexpr CWeaponMode Power() { return CWeaponMode(EWeaponType::Power); }
static CWeaponMode Bomb() { return CWeaponMode(EWeaponType::Bomb); } static constexpr CWeaponMode Bomb() { return CWeaponMode(EWeaponType::Bomb); }
static CWeaponMode PowerBomb() { return CWeaponMode(EWeaponType::PowerBomb); } static constexpr CWeaponMode PowerBomb() { return CWeaponMode(EWeaponType::PowerBomb); }
}; };
} // namespace urde } // namespace urde

View File

@ -207,7 +207,7 @@ std::optional<zeus::CAABox> CScriptTrigger::GetTouchBounds() const {
return {GetTriggerBoundsWR()}; return {GetTriggerBoundsWR()};
return {}; return {};
} }
static const CWeaponMode sktonOHurtWeaponMode = CWeaponMode(EWeaponType::Power, false, false, true); constexpr auto sktonOHurtWeaponMode = CWeaponMode(EWeaponType::Power, false, false, true);
void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) { void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) {
if (!act.GetActive() || act.GetMaterialList().HasMaterial(EMaterialTypes::Trigger)) if (!act.GetActive() || act.GetMaterialList().HasMaterial(EMaterialTypes::Trigger))