metaforce/Runtime/World/CPatterned.hpp

131 lines
3.2 KiB
C++
Raw Normal View History

2016-04-25 05:03:38 +00:00
#ifndef __URDE_CPATTERNED_HPP__
#define __URDE_CPATTERNED_HPP__
#include "CAi.hpp"
2016-08-15 20:43:04 +00:00
#include "Character/CBodyController.hpp"
2017-06-12 04:23:34 +00:00
#include "TCastTo.hpp"
2016-04-25 05:03:38 +00:00
namespace urde
{
class CPatternedInfo;
class CPatterned : public CAi
{
public:
2017-06-12 04:23:34 +00:00
enum class ECharacter
2016-04-25 05:03:38 +00:00
{
2017-06-12 04:23:34 +00:00
AtomicAlpha = 0,
AtomicBeta = 1,
Babygoth = 2,
Beetle = 3,
BloodFlower = 4,
Burrower = 5,
ChozoGhost = 6,
Drone = 7,
ElitePirate = 8,
EyeBall = 9,
FireFlea = 10,
Flaahgra = 11,
FlaahgraTentacle = 12,
FlickerBat = 13,
FlyingPirate = 14,
IceSheeegoth = 15,
JellyZap = 16,
Magdolite = 17,
Metaree = 18,
Metroid = 19,
MetroidBeta = 20,
MetroidPrimeExo = 21,
MetroidPrimeEssence = 22,
NewIntroBoss = 23,
Parasite = 24,
PuddleSpore = 27,
PuddleToad = 28,
Puffer = 29,
Ridley = 30,
Ripper = 31,
Seedling = 32,
SpacePirate = 34,
SpankWeed = 35,
PhazonHealingNodule = 35,
Thardus = 36,
ThardusRockProjectile = 37,
Tryclops = 38,
WarWasp = 39,
EnergyBall = 40
2016-04-25 05:03:38 +00:00
};
enum class EFlavorType
{
Zero = 0,
One = 1
2016-04-25 05:03:38 +00:00
};
enum class EMovementType
{
2016-04-25 05:46:28 +00:00
Ground = 0,
Flyer = 1
2016-04-25 05:03:38 +00:00
};
enum class EColliderType
{
2016-04-25 05:46:28 +00:00
One = 1
2016-04-25 05:03:38 +00:00
};
2016-04-25 05:03:38 +00:00
private:
2017-07-10 04:55:51 +00:00
union
{
struct
{
bool x328_24_ : 1;
bool x328_25_ : 1;
bool x328_26_ : 1;
bool x328_27_onGround : 1;
};
u32 _dummy = 0;
};
2017-06-12 04:23:34 +00:00
ECharacter x34c_character;
2017-07-14 05:14:19 +00:00
union
{
struct
{
bool x4e1_24_ : 1;
bool x4e1_25_ : 1;
bool x4e1_26_ : 1;
};
u32 _dummy2 = 0;
};
2016-04-25 05:03:38 +00:00
public:
2017-06-12 04:23:34 +00:00
CPatterned(ECharacter character, TUniqueId uid, const std::string& name, EFlavorType flavor, const CEntityInfo& info,
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pinfo,
CPatterned::EMovementType movement, EColliderType collider, EBodyType body,
const CActorParameters& params, int variant);
2016-04-25 05:03:38 +00:00
virtual void Death(CStateManager&, const zeus::CVector3f&, EStateMsg) {}
2017-03-29 02:51:12 +00:00
virtual void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType, bool, float) {}
2017-06-12 04:23:34 +00:00
template <class T>
static T* CastTo(CEntity* ent)
{
if (TCastToPtr<CPatterned> patterned = ent)
if (patterned->x34c_character == T::CharacterType)
return static_cast<T*>(patterned.GetPtr());
return nullptr;
}
template <class T>
static const T* CastTo(const CEntity* ent)
{
if (TCastToConstPtr<CPatterned> patterned = ent)
if (patterned->x34c_character == T::CharacterType)
return static_cast<const T*>(patterned.GetPtr());
return nullptr;
}
2017-07-10 04:55:51 +00:00
bool GetX328_26() const { return x328_26_; }
virtual bool IsOnGround() const { return x328_27_onGround; }
virtual float GetGravityConstant() const { return 24.525002f; }
2016-04-25 05:46:28 +00:00
};
2016-04-25 05:03:38 +00:00
}
2016-04-25 05:46:28 +00:00
#endif // CPATTERNED_HPP