2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-05-13 17:51:21 +00:00
metaforce/Runtime/Weapon/CWeaponMode.hpp
Lioncash 3d5ed90d1a CWeaponMode: Make constexpr capable
Given this is such a simple type, this can be made usable with
constexpr. This allows the type to be usable at file-scope without
potentially incurring a runtime constructor.
2020-01-23 23:12:18 -05:00

33 lines
1.6 KiB
C++

#pragma once
#include "Runtime/Weapon/WeaponCommon.hpp"
namespace urde {
class CWeaponMode {
EWeaponType x0_weaponType = EWeaponType::None;
bool x4_24_charged : 1;
bool x4_25_comboed : 1;
bool x4_26_instantKill : 1;
public:
constexpr CWeaponMode() : x4_24_charged{false}, x4_25_comboed{false}, x4_26_instantKill{false} {}
constexpr explicit 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) {}
constexpr EWeaponType GetType() const { return x0_weaponType; }
constexpr bool IsCharged() const { return x4_24_charged; }
constexpr bool IsComboed() const { return x4_25_comboed; }
constexpr bool IsInstantKill() const { return x4_26_instantKill; }
static constexpr CWeaponMode Invalid() { return CWeaponMode(EWeaponType::None); }
static constexpr CWeaponMode Phazon() { return CWeaponMode(EWeaponType::Phazon); }
static constexpr CWeaponMode Plasma() { return CWeaponMode(EWeaponType::Plasma); }
static constexpr CWeaponMode Wave() { return CWeaponMode(EWeaponType::Wave); }
static constexpr CWeaponMode BoostBall() { return CWeaponMode(EWeaponType::BoostBall); }
static constexpr CWeaponMode Ice() { return CWeaponMode(EWeaponType::Ice); }
static constexpr CWeaponMode Power() { return CWeaponMode(EWeaponType::Power); }
static constexpr CWeaponMode Bomb() { return CWeaponMode(EWeaponType::Bomb); }
static constexpr CWeaponMode PowerBomb() { return CWeaponMode(EWeaponType::PowerBomb); }
};
} // namespace urde