mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:44:56 +00:00
Complete C*Projectile construction chain, add CScriptBeam
This commit is contained in:
0
Runtime/Weapon/CBeamInfo.cpp
Normal file
0
Runtime/Weapon/CBeamInfo.cpp
Normal file
53
Runtime/Weapon/CBeamInfo.hpp
Normal file
53
Runtime/Weapon/CBeamInfo.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef __URDE_CBEAMINFO_HPP__
|
||||
#define __URDE_CBEAMINFO_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "IOStreams.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
struct CBeamInfo
|
||||
{
|
||||
u32 x0_;
|
||||
u32 x4_;
|
||||
ResId x8_;
|
||||
ResId xc_;
|
||||
ResId x10_;
|
||||
ResId x14_;
|
||||
u32 x18_;
|
||||
float x1c_;
|
||||
float x20_;
|
||||
float x24_;
|
||||
float x28_;
|
||||
float x2c_;
|
||||
float x30_;
|
||||
float x34_;
|
||||
float x38_;
|
||||
zeus::CColor x3c_;
|
||||
zeus::CColor x40_;
|
||||
|
||||
CBeamInfo(CInputStream& in)
|
||||
: x0_(in.readUint32Big())
|
||||
, x4_(in.readUint32Big())
|
||||
, x8_(in.readUint32Big())
|
||||
, xc_(in.readUint32Big())
|
||||
, x10_(in.readUint32Big())
|
||||
, x14_(in.readUint32Big())
|
||||
, x18_(in.readFloatBig())
|
||||
, x1c_(in.readFloatBig())
|
||||
, x20_(in.readFloatBig())
|
||||
, x24_(in.readFloatBig())
|
||||
, x28_(in.readFloatBig())
|
||||
, x2c_(in.readFloatBig())
|
||||
, x30_(in.readFloatBig())
|
||||
, x34_(in.readFloatBig())
|
||||
, x38_(in.readFloatBig())
|
||||
, x3c_(zeus::CColor::ReadRGBABig(in))
|
||||
, x40_(zeus::CColor::ReadRGBABig(in))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
#endif // __URDE_CBEAMINFO_HPP__
|
||||
38
Runtime/Weapon/CBeamProjectile.cpp
Normal file
38
Runtime/Weapon/CBeamProjectile.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "Weapon/CBeamProjectile.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CBeamProjectile::CBeamProjectile(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
|
||||
const zeus::CTransform& xf, int attribs, float f1, float f2, EMaterialTypes matType,
|
||||
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aid, TUniqueId uid, u32 w1, bool b1)
|
||||
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, owner, aid, uid, kInvalidUniqueId, w1, false,
|
||||
zeus::CVector3f::skOne, {}, -1, false)
|
||||
{
|
||||
}
|
||||
|
||||
void CBeamProjectile::Think(float, CStateManager &)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CBeamProjectile::GetTouchBounds() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void CBeamProjectile::Touch(CActor &, CStateManager &)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CBeamProjectile::ResetBeam(CStateManager &, bool)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CBeamProjectile::UpdateFX(const zeus::CTransform &, float, CStateManager &)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
33
Runtime/Weapon/CBeamProjectile.hpp
Normal file
33
Runtime/Weapon/CBeamProjectile.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef __URDE_CBEAMPROJECTILE_HPP__
|
||||
#define __URDE_CBEAMPROJECTILE_HPP__
|
||||
|
||||
#include "Weapon/CGameProjectile.hpp"
|
||||
namespace urde
|
||||
{
|
||||
class CBeamProjectile : public CGameProjectile
|
||||
{
|
||||
public:
|
||||
CBeamProjectile(const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const zeus::CTransform&, int,
|
||||
float, float, EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, u32, bool);
|
||||
|
||||
float GetMaxRadius() const;
|
||||
zeus::CVector3f GetSurfaceNormal() const;
|
||||
void GetDamageType() const;
|
||||
void GetCurrentPos() const;
|
||||
void PointCache();
|
||||
void GetPointCache() const;
|
||||
void CauseDamage(bool);
|
||||
zeus::CVector3f GetBeamOrigin() const;
|
||||
void GetInvMaxLength() const;
|
||||
void GetCurrentLength();
|
||||
void GetMaxLength();
|
||||
s32 GetIntMaxLength();
|
||||
|
||||
void Think(float, CStateManager&);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor&, CStateManager&);
|
||||
virtual void ResetBeam(CStateManager&, bool);
|
||||
virtual void UpdateFX(const zeus::CTransform&, float, CStateManager&);
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CBEAMPROJECTILE_HPP__
|
||||
32
Runtime/Weapon/CGameProjectile.cpp
Normal file
32
Runtime/Weapon/CGameProjectile.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "Weapon/CGameProjectile.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&, const std::string& name,
|
||||
EWeaponType wType, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aid, TUniqueId uid, TUniqueId,
|
||||
u32 w1, bool b2, const zeus::CVector3f&,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool b3)
|
||||
: CWeapon(owner, aid, uid, active, wType, name, xf,
|
||||
CMaterialFilter(
|
||||
CMaterialList(EMaterialTypes::Fifty, matType),
|
||||
CMaterialList(EMaterialTypes::ThirtyFive, EMaterialTypes::Eighteen, matType, EMaterialTypes::Nineteen),
|
||||
CMaterialFilter::EFilterType::Three),
|
||||
CMaterialList(), dInfo, EProjectileAttrib(w1) | GetBeamAttribType(wType), CModelData::CModelDataNull())
|
||||
{
|
||||
}
|
||||
|
||||
CWeapon::EProjectileAttrib CGameProjectile::GetBeamAttribType(EWeaponType wType)
|
||||
{
|
||||
if (wType == EWeaponType::Ice)
|
||||
return EProjectileAttrib::Ice;
|
||||
else if (wType == EWeaponType::Wave)
|
||||
return EProjectileAttrib::Wave;
|
||||
else if (wType == EWeaponType::Plasma)
|
||||
return EProjectileAttrib::Plasma;
|
||||
else if (wType == EWeaponType::Phazon)
|
||||
return EProjectileAttrib::Phazon;
|
||||
|
||||
return EProjectileAttrib::None;
|
||||
}
|
||||
}
|
||||
26
Runtime/Weapon/CGameProjectile.hpp
Normal file
26
Runtime/Weapon/CGameProjectile.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef __URDE_CGAMEPROJECTILE_HPP__
|
||||
#define __URDE_CGAMEPROJECTILE_HPP__
|
||||
|
||||
#include "Collision/CMaterialList.hpp"
|
||||
#include "Weapon/CWeaponMode.hpp"
|
||||
#include "Weapon/CWeapon.hpp"
|
||||
#include "World/CDamageInfo.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CGenDescription;
|
||||
class CWeaponDescription;
|
||||
class CGameProjectile : public CWeapon
|
||||
{
|
||||
public:
|
||||
CGameProjectile(bool, const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const zeus::CTransform&,
|
||||
EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, TUniqueId, u32, bool,
|
||||
const zeus::CVector3f&, const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool);
|
||||
|
||||
static EProjectileAttrib GetBeamAttribType(EWeaponType wType);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CGAMEPROJECTILE_HPP__
|
||||
@@ -1,4 +1,5 @@
|
||||
set(WEAPON_SOURCES
|
||||
WeaponCommon.hpp
|
||||
CWeaponMgr.hpp CWeaponMgr.cpp
|
||||
CGunController.hpp CGunController.cpp
|
||||
CGunMotion.hpp CGunMotion.cpp
|
||||
@@ -15,6 +16,11 @@ set(WEAPON_SOURCES
|
||||
CGSFreeLook.hpp CGSFreeLook.cpp
|
||||
CGSComboFire.hpp CGSComboFire.cpp
|
||||
CGSFidget.hpp CGSFidget.cpp
|
||||
CFidget.hpp CFidget.cpp)
|
||||
CFidget.hpp CFidget.cpp
|
||||
CWeapon.hpp CWeapon.cpp
|
||||
CGameProjectile.hpp CGameProjectile.cpp
|
||||
CBeamProjectile.hpp CBeamProjectile.cpp
|
||||
CBeamInfo.hpp CBeamInfo.cpp
|
||||
CPlasmaProjectile.hpp CPlasmaProjectile.cpp)
|
||||
|
||||
runtime_add_list(Weapon WEAPON_SOURCES)
|
||||
|
||||
13
Runtime/Weapon/CPlasmaProjectile.cpp
Normal file
13
Runtime/Weapon/CPlasmaProjectile.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "CPlasmaProjectile.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CPlasmaProjectile::CPlasmaProjectile(const TToken<CWeaponDescription>& wDesc, const std::string& name,
|
||||
EWeaponType wType, const CBeamInfo& bInfo, const zeus::CTransform& xf,
|
||||
EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId owner, TAreaId aid,
|
||||
TUniqueId uid, u32 w1, bool b1, u32 w2)
|
||||
: CBeamProjectile(wDesc, name, wType, xf, bInfo.x18_, bInfo.x1c_, bInfo.x38_, matType, dInfo, owner, aid, uid, w2, b1)
|
||||
{
|
||||
}
|
||||
}
|
||||
19
Runtime/Weapon/CPlasmaProjectile.hpp
Normal file
19
Runtime/Weapon/CPlasmaProjectile.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef __URDE_CPLASMAPROJECTILE_HPP__
|
||||
#define __URDE_CPLASMAPROJECTILE_HPP__
|
||||
|
||||
#include "Weapon/CBeamProjectile.hpp"
|
||||
#include "Weapon/CBeamInfo.hpp"
|
||||
#include "World/CDamageInfo.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CPlasmaProjectile : public CBeamProjectile
|
||||
{
|
||||
public:
|
||||
CPlasmaProjectile(const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const CBeamInfo&,
|
||||
const zeus::CTransform&, EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, u32,
|
||||
bool, u32);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CPLASMAPROJECTILE_HPP__
|
||||
14
Runtime/Weapon/CWeapon.cpp
Normal file
14
Runtime/Weapon/CWeapon.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "CWeapon.hpp"
|
||||
#include "World/CActorParameters.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CWeapon::CWeapon(TUniqueId uid, TAreaId aid, bool active, TUniqueId, EWeaponType, const std::string& name,
|
||||
const zeus::CTransform& xf, const CMaterialFilter&, const CMaterialList& mList, const CDamageInfo&,
|
||||
EProjectileAttrib, CModelData&& mData)
|
||||
: CActor(uid, active, name, CEntityInfo(aid, CEntity::NullConnectionList), xf, std::move(mData), mList,
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
{
|
||||
}
|
||||
}
|
||||
49
Runtime/Weapon/CWeapon.hpp
Normal file
49
Runtime/Weapon/CWeapon.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef __URDE_CWEAPON_HPP__
|
||||
#define __URDE_CWEAPON_HPP__
|
||||
|
||||
#include "World/CActor.hpp"
|
||||
#include "Weapon/WeaponCommon.hpp"
|
||||
#include "Collision/CMaterialFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CWeapon : public CActor
|
||||
{
|
||||
public:
|
||||
enum class EProjectileAttrib
|
||||
{
|
||||
None = 0,
|
||||
Ice = (1 << 3),
|
||||
Wave = (1 << 4),
|
||||
Plasma = (1 << 5),
|
||||
Phazon = (1 << 6)
|
||||
};
|
||||
|
||||
private:
|
||||
public:
|
||||
CWeapon(TUniqueId, TAreaId, bool, TUniqueId, EWeaponType, const std::string&, const zeus::CTransform&,
|
||||
const CMaterialFilter&, const CMaterialList&, const CDamageInfo&, EProjectileAttrib, CModelData&&);
|
||||
|
||||
bool HasAttrib(EProjectileAttrib) const;
|
||||
EProjectileAttrib GetAttribField() const;
|
||||
const CMaterialFilter& GetFilter() const;
|
||||
void SetFilter(const CMaterialFilter&);
|
||||
TUniqueId GetOwnerId() const;
|
||||
void SetOwnerId(TUniqueId);
|
||||
EWeaponType GetType() const;
|
||||
const CDamageInfo& GetDamageInfo() const;
|
||||
CDamageInfo& DamageInfo();
|
||||
void SetDamageInfo(const CDamageInfo&);
|
||||
|
||||
void Think(float, CStateManager &) {}
|
||||
void Render(const CStateManager&) const {}
|
||||
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&,
|
||||
int)
|
||||
{
|
||||
return EWeaponCollisionResponseTypes::Default;
|
||||
}
|
||||
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&) {}
|
||||
};
|
||||
ENABLE_BITWISE_ENUM(CWeapon::EProjectileAttrib)
|
||||
}
|
||||
#endif // __URDE_CWEAPON_HPP__
|
||||
@@ -2,30 +2,11 @@
|
||||
#define __URDE_CWEAPONMGR_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "WeaponCommon.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
enum class EWeaponType
|
||||
{
|
||||
None = -1,
|
||||
Power = 0,
|
||||
Ice,
|
||||
Wave,
|
||||
Plasma,
|
||||
Bomb,
|
||||
PowerBomb,
|
||||
Missile,
|
||||
BoostBall,
|
||||
Phazon,
|
||||
AI,
|
||||
PoisonWater,
|
||||
Lava,
|
||||
Hot,
|
||||
Unused1,
|
||||
Unused2
|
||||
};
|
||||
|
||||
class CWeaponMgr
|
||||
{
|
||||
std::map<TUniqueId, rstl::reserved_vector<s32, 10>> x0_weapons;
|
||||
|
||||
@@ -7,6 +7,11 @@ CWeaponMode::CWeaponMode(EWeaponType type, bool, bool)
|
||||
{
|
||||
}
|
||||
|
||||
EWeaponType CWeaponMode::GetType() const
|
||||
{
|
||||
return x0_weaponType;
|
||||
}
|
||||
|
||||
CWeaponMode CWeaponMode::Invalid()
|
||||
{
|
||||
return CWeaponMode(EWeaponType::None, false, false);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef __URDE_CWEAPONMODE_HPP__
|
||||
#define __URDE_CWEAPONMODE_HPP__
|
||||
|
||||
#include "CWeaponMgr.hpp"
|
||||
#include "WeaponCommon.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CWeaponMode
|
||||
{
|
||||
EWeaponType x0_weaponType;
|
||||
EWeaponType x0_weaponType = EWeaponType::None;
|
||||
union
|
||||
{
|
||||
struct
|
||||
@@ -19,7 +19,8 @@ class CWeaponMode
|
||||
u8 dummy = 0;
|
||||
};
|
||||
public:
|
||||
CWeaponMode(EWeaponType, bool, bool);
|
||||
CWeaponMode() = default;
|
||||
CWeaponMode(EWeaponType, bool = false, bool = false);
|
||||
EWeaponType GetType() const;
|
||||
|
||||
|
||||
|
||||
29
Runtime/Weapon/WeaponCommon.hpp
Normal file
29
Runtime/Weapon/WeaponCommon.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef __URDE_WEAPONCOMMON_HPP__
|
||||
#define __URDE_WEAPONCOMMON_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
enum class EWeaponType
|
||||
{
|
||||
None = -1,
|
||||
Power = 0,
|
||||
Ice,
|
||||
Wave,
|
||||
Plasma,
|
||||
Bomb,
|
||||
PowerBomb,
|
||||
Missile,
|
||||
BoostBall,
|
||||
Phazon,
|
||||
AI,
|
||||
PoisonWater,
|
||||
Lava,
|
||||
Hot,
|
||||
Unused1,
|
||||
Unused2
|
||||
};
|
||||
}
|
||||
#endif // __URDE_WEAPONCOMMON_HPP__
|
||||
Reference in New Issue
Block a user