mirror of https://github.com/AxioDL/metaforce.git
Re-organize MP1 specific world objects
This commit is contained in:
parent
6968d9f0d3
commit
d9f5805356
|
@ -148,6 +148,8 @@ public:
|
||||||
|
|
||||||
const zeus::CVector3f& GetScale() const { return x0_scale; }
|
const zeus::CVector3f& GetScale() const { return x0_scale; }
|
||||||
void SetScale(const zeus::CVector3f& scale) { x0_scale = scale; }
|
void SetScale(const zeus::CVector3f& scale) { x0_scale = scale; }
|
||||||
|
bool HasAnimData() const { return x10_animData != nullptr; }
|
||||||
|
bool HasNormalModel() const { return x1c_normalModel; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,12 +99,12 @@ public:
|
||||||
|
|
||||||
void Add(EMaterialTypes type)
|
void Add(EMaterialTypes type)
|
||||||
{
|
{
|
||||||
x0_list |= (1ull << u64(type));
|
x0_list |= (1ull << u32(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Remove(EMaterialTypes type)
|
void Remove(EMaterialTypes type)
|
||||||
{
|
{
|
||||||
x0_list &= ~(1ull << u64(type));
|
x0_list &= ~(1ull << u32(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Remove(const CMaterialList& other)
|
void Remove(const CMaterialList& other)
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
|
|
||||||
bool HasMaterial(EMaterialTypes type) const
|
bool HasMaterial(EMaterialTypes type) const
|
||||||
{
|
{
|
||||||
return (x0_list & (1ull << u64(type))) != 0;
|
return (x0_list & (1ull << u32(type))) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharesMaterials(const CMaterialList& other)
|
bool SharesMaterials(const CMaterialList& other)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
include_directories(. ..)
|
include_directories(. ..)
|
||||||
|
add_subdirectory(World)
|
||||||
|
|
||||||
set(MP1_SOURCES
|
set(MP1_SOURCES
|
||||||
CTweaks.hpp CTweaks.cpp
|
CTweaks.hpp CTweaks.cpp
|
||||||
CInGameTweakManager.hpp CInGameTweakManager.cpp
|
CInGameTweakManager.hpp CInGameTweakManager.cpp
|
||||||
|
@ -10,18 +12,13 @@ set(MP1_SOURCES
|
||||||
CFrontEndUI.hpp CFrontEndUI.cpp
|
CFrontEndUI.hpp CFrontEndUI.cpp
|
||||||
CPreFrontEnd.hpp CPreFrontEnd.cpp
|
CPreFrontEnd.hpp CPreFrontEnd.cpp
|
||||||
CSlideShow.hpp CSlideShow.cpp
|
CSlideShow.hpp CSlideShow.cpp
|
||||||
CNewIntroBoss.hpp CNewIntroBoss.cpp
|
|
||||||
CBeetle.hpp CBeetle.cpp
|
|
||||||
CWarWasp.hpp CWarWasp.cpp
|
|
||||||
CSpacePirate.hpp CSpacePirate.cpp
|
|
||||||
CBabygoth.hpp CBabygoth.cpp
|
|
||||||
CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp
|
|
||||||
CSaveUI.hpp CSaveUI.cpp
|
CSaveUI.hpp CSaveUI.cpp
|
||||||
CMemoryCardDriver.hpp CMemoryCardDriver.cpp
|
CMemoryCardDriver.hpp CMemoryCardDriver.cpp
|
||||||
CQuitScreen.hpp CQuitScreen.cpp
|
CQuitScreen.hpp CQuitScreen.cpp
|
||||||
CCredits.hpp CCredits.cpp
|
CCredits.hpp CCredits.cpp
|
||||||
CStateSetterFlow.hpp CStateSetterFlow.cpp
|
CStateSetterFlow.hpp CStateSetterFlow.cpp
|
||||||
CAudioStateWin.hpp CAudioStateWin.cpp
|
CAudioStateWin.hpp CAudioStateWin.cpp
|
||||||
MP1.hpp MP1.cpp)
|
MP1.hpp MP1.cpp
|
||||||
|
${MP1_WORLD_SOURCES})
|
||||||
|
|
||||||
runtime_add_list(MP1 MP1_SOURCES)
|
runtime_add_list(MP1 MP1_SOURCES)
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include "MP1/World/CActorContraption.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
MP1::CActorContraption::CActorContraption(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||||
|
const zeus::CTransform& xf, CModelData&& mData, const zeus::CAABox& aabox,
|
||||||
|
const CMaterialList& matList, float f1, float f2, const CHealthInfo& hInfo,
|
||||||
|
const CDamageVulnerability& dVuln, const CActorParameters& aParams,
|
||||||
|
ResId part, const CDamageInfo& dInfo, bool active)
|
||||||
|
: CScriptActor(uid, name, info, xf, std::move(mData), aabox, f1, f2, matList, hInfo, dVuln, aParams, false, active, 0,
|
||||||
|
0.f, false, false, false, false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef __URDE_MP1_CACTORCONTRAPTION_HPP__
|
||||||
|
#define __URDE_MP1_CACTORCONTRAPTION_HPP__
|
||||||
|
|
||||||
|
#include "World/CScriptActor.hpp"
|
||||||
|
#include "World/CDamageInfo.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace MP1
|
||||||
|
{
|
||||||
|
class CActorContraption : public CScriptActor
|
||||||
|
{
|
||||||
|
/* AKA Why Zoid?!?!?!? */
|
||||||
|
|
||||||
|
TToken<CGenDescription> x300_;
|
||||||
|
CDamageInfo x30c_;
|
||||||
|
public:
|
||||||
|
CActorContraption(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||||
|
const zeus::CAABox&, const CMaterialList&, float, float, const CHealthInfo&,
|
||||||
|
const CDamageVulnerability&, const CActorParameters&, ResId, const CDamageInfo&, bool);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_MP1_CACTORCONTRAPTION_HPP__
|
|
@ -0,0 +1,10 @@
|
||||||
|
set(MP1_WORLD_SOURCES
|
||||||
|
CNewIntroBoss.hpp CNewIntroBoss.cpp
|
||||||
|
CBeetle.hpp CBeetle.cpp
|
||||||
|
CWarWasp.hpp CWarWasp.cpp
|
||||||
|
CSpacePirate.hpp CSpacePirate.cpp
|
||||||
|
CBabygoth.hpp CBabygoth.cpp
|
||||||
|
CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp
|
||||||
|
CActorContraption.hpp CActorContraption.cpp)
|
||||||
|
|
||||||
|
runtime_add_list(World MP1_WORLD_SOURCES)
|
|
@ -25,7 +25,7 @@ CENTITY_TYPES = (
|
||||||
('CGameProjectile', 'Weapon/CGameProjectile.hpp'),
|
('CGameProjectile', 'Weapon/CGameProjectile.hpp'),
|
||||||
('CHUDBillboardEffect', 'World/CHUDBillboardEffect.hpp'),
|
('CHUDBillboardEffect', 'World/CHUDBillboardEffect.hpp'),
|
||||||
Namespace('MP1'),
|
Namespace('MP1'),
|
||||||
('CMetroidPrimeRelay', 'MP1/CMetroidPrimeRelay.hpp', 'MP1'),
|
('CMetroidPrimeRelay', 'MP1/World/CMetroidPrimeRelay.hpp', 'MP1'),
|
||||||
EndNamespace(),
|
EndNamespace(),
|
||||||
('CPathCamera', 'Camera/CPathCamera.hpp'),
|
('CPathCamera', 'Camera/CPathCamera.hpp'),
|
||||||
('CAi', 'World/CAi.hpp'),
|
('CAi', 'World/CAi.hpp'),
|
||||||
|
|
|
@ -140,7 +140,7 @@ const zeus::CTransform CActor::GetLocatorTransform(const std::string& segName) c
|
||||||
}
|
}
|
||||||
|
|
||||||
EWeaponCollisionResponseTypes CActor::GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
|
EWeaponCollisionResponseTypes CActor::GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
|
||||||
CWeaponMode&, int)
|
CWeaponMode&, s32)
|
||||||
{
|
{
|
||||||
return EWeaponCollisionResponseTypes::Unknown13;
|
return EWeaponCollisionResponseTypes::Unknown13;
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,23 @@ void CActor::AddMaterial(EMaterialTypes type, CStateManager& mgr)
|
||||||
mgr.UpdateObjectInLists(*this);
|
mgr.UpdateObjectInLists(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CActor::CreateShadow(bool b)
|
||||||
|
{
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
_CreateShadow();
|
||||||
|
if (!xe5_24_ && x94_simpleShadow)
|
||||||
|
xe5_25_ = true;
|
||||||
|
}
|
||||||
|
xe5_24_ = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CActor::_CreateShadow()
|
||||||
|
{
|
||||||
|
if (!x94_simpleShadow && x64_modelData && (x64_modelData->HasAnimData() || x64_modelData->HasNormalModel()))
|
||||||
|
x94_simpleShadow.reset(new CSimpleShadow(1.f, 1.f, 20.f, 0.05f));
|
||||||
|
}
|
||||||
|
|
||||||
void CActor::SetCallTouch(bool callTouch) { xe5_28_callTouch = callTouch; }
|
void CActor::SetCallTouch(bool callTouch) { xe5_28_callTouch = callTouch; }
|
||||||
|
|
||||||
bool CActor::GetCallTouch() const { return xe5_28_callTouch; }
|
bool CActor::GetCallTouch() const { return xe5_28_callTouch; }
|
||||||
|
|
|
@ -58,6 +58,8 @@ protected:
|
||||||
bool xe4_28_ : 1;
|
bool xe4_28_ : 1;
|
||||||
bool xe4_29_ : 1;
|
bool xe4_29_ : 1;
|
||||||
bool xe4_30_ : 1;
|
bool xe4_30_ : 1;
|
||||||
|
bool xe5_24_ : 1;
|
||||||
|
bool xe5_25_ : 1;
|
||||||
bool xe5_26_muted : 1;
|
bool xe5_26_muted : 1;
|
||||||
bool xe5_27_useInSortedLists : 1;
|
bool xe5_27_useInSortedLists : 1;
|
||||||
bool xe5_28_callTouch : 1;
|
bool xe5_28_callTouch : 1;
|
||||||
|
@ -69,6 +71,7 @@ protected:
|
||||||
};
|
};
|
||||||
u32 dummy = 0;
|
u32 dummy = 0;
|
||||||
};
|
};
|
||||||
|
void _CreateShadow();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class EFluidState
|
enum class EFluidState
|
||||||
|
@ -131,6 +134,7 @@ public:
|
||||||
void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||||
void AddMaterial(EMaterialTypes, CStateManager&);
|
void AddMaterial(EMaterialTypes, CStateManager&);
|
||||||
|
|
||||||
|
void CreateShadow(bool);
|
||||||
void SetCallTouch(bool callTouch);
|
void SetCallTouch(bool callTouch);
|
||||||
bool GetCallTouch() const;
|
bool GetCallTouch() const;
|
||||||
void SetUseInSortedList(bool use);
|
void SetUseInSortedList(bool use);
|
||||||
|
|
|
@ -109,6 +109,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WeaponHurts(const CWeaponMode&, u32) const { return false; }
|
bool WeaponHurts(const CWeaponMode&, u32) const { return false; }
|
||||||
|
|
||||||
|
EVulnerability GetVulnerability(const CWeaponMode& mode, u32 w) const
|
||||||
|
{
|
||||||
|
if (int(mode.GetType()) < int(EWeaponType::None) || int(mode.GetType()) > int(EWeaponType::Unused2))
|
||||||
|
return EVulnerability::Reflect;
|
||||||
|
|
||||||
|
if (!mode.IsInstantKill())
|
||||||
|
return EVulnerability::Normal;
|
||||||
|
// TODO: Finish
|
||||||
|
return EVulnerability::Normal;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,77 @@
|
||||||
#include "CScriptActor.hpp"
|
#include "CScriptActor.hpp"
|
||||||
|
#include "CStateManager.hpp"
|
||||||
|
#include "CScriptTrigger.hpp"
|
||||||
|
#include "CDamageVulnerability.hpp"
|
||||||
#include "TCastTo.hpp"
|
#include "TCastTo.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CScriptActor::CScriptActor(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CScriptActor::CScriptActor(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const zeus::CAABox& aabb, float a, float, const CMaterialList& matList,
|
CModelData&& mData, const zeus::CAABox& aabb, float f1, float zMomentum,
|
||||||
const CHealthInfo&, const CDamageVulnerability&, const CActorParameters& actParms, bool,
|
const CMaterialList& matList, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||||
bool active, u32, float, bool, bool, bool, bool)
|
const CActorParameters& actParms, bool looping, bool active, u32 w1, float f3, bool b2,
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), matList, aabb, SMoverData(a), actParms, 0.3f, 0.1f)
|
bool castsShadow, bool b4, bool b5)
|
||||||
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), matList, aabb, SMoverData(f1), actParms, 0.3f, 0.1f)
|
||||||
|
, x258_initialHealth(hInfo)
|
||||||
|
, x260_currentHealth(hInfo)
|
||||||
|
, x268_damageVulnerability(dVuln)
|
||||||
|
, x2d8_(w1)
|
||||||
|
, x2dc_(f3)
|
||||||
|
, x2e2_24_(b2)
|
||||||
|
, x2e2_25_(false)
|
||||||
|
, x2e2_26_(true)
|
||||||
|
, x2e2_27_(std::fabs(f3 - 1.f) > 0.00001)
|
||||||
|
, x2e2_28_(false)
|
||||||
|
, x2e2_29_((x2e2_24_ && x2e2_25_ && x2d8_ != 0))
|
||||||
|
, x2e2_30_(b4)
|
||||||
|
, x2e2_31_(b5)
|
||||||
{
|
{
|
||||||
|
if (x64_modelData && (x64_modelData->HasAnimData() || x64_modelData->HasNormalModel()) && castsShadow)
|
||||||
|
CreateShadow(true);
|
||||||
|
|
||||||
|
if (x64_modelData && x64_modelData->HasAnimData())
|
||||||
|
x64_modelData->EnableLooping(looping);
|
||||||
|
|
||||||
|
x150_momentum = zeus::CVector3f(0.f, 0.f, zMomentum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptActor::Accept(IVisitor& visitor)
|
void CScriptActor::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||||
|
|
||||||
|
void CScriptActor::AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
||||||
|
|
||||||
|
void CScriptActor::Think(float, CStateManager&) {}
|
||||||
|
|
||||||
|
void CScriptActor::PreRender(const zeus::CFrustum&, const CStateManager&) {}
|
||||||
|
|
||||||
|
zeus::CAABox CScriptActor::GetSortingBounds(const CStateManager& mgr) const
|
||||||
{
|
{
|
||||||
visitor.Visit(this);
|
if (x2e0_ != kInvalidUniqueId)
|
||||||
|
{
|
||||||
|
TCastToConstPtr<CScriptTrigger> trigger(mgr.GetObjectById(x2e0_));
|
||||||
|
if (trigger)
|
||||||
|
return trigger->GetTriggerBoundsWR();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CActor::GetSortingBounds(mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EWeaponCollisionResponseTypes
|
||||||
|
CScriptActor::GetCollisionResponseType(const zeus::CVector3f& v1, const zeus::CVector3f& v2, CWeaponMode& wMode, s32 w)
|
||||||
|
{
|
||||||
|
const CDamageVulnerability* dVuln = GetDamageVulnerability();
|
||||||
|
EVulnerability vuln = dVuln->GetVulnerability(wMode, 0);
|
||||||
|
return CActor::GetCollisionResponseType(v1, v2, wMode, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
rstl::optional_object<zeus::CAABox> CScriptActor::GetTouchBounds() const
|
||||||
|
{
|
||||||
|
if (GetActive() && x68_material.HasMaterial(EMaterialTypes::Solid))
|
||||||
|
return {CPhysicsActor::GetBoundingBox()};
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptActor::Touch(CActor&, CStateManager&)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,48 @@
|
||||||
#define __URDE_CSCRIPTACTOR_HPP__
|
#define __URDE_CSCRIPTACTOR_HPP__
|
||||||
|
|
||||||
#include "CPhysicsActor.hpp"
|
#include "CPhysicsActor.hpp"
|
||||||
|
#include "CHealthInfo.hpp"
|
||||||
|
#include "CDamageVulnerability.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
class CScriptActor : public CPhysicsActor
|
class CScriptActor : public CPhysicsActor
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
CHealthInfo x258_initialHealth;
|
||||||
|
CHealthInfo x260_currentHealth;
|
||||||
|
CDamageVulnerability x268_damageVulnerability;
|
||||||
|
float x2d0_;
|
||||||
|
float x2d4_;
|
||||||
|
s32 x2d8_;
|
||||||
|
float x2dc_;
|
||||||
|
TUniqueId x2e0_ = kInvalidUniqueId;
|
||||||
|
bool x2e2_24_ : 1;
|
||||||
|
bool x2e2_25_ : 1;
|
||||||
|
bool x2e2_26_ : 1;
|
||||||
|
bool x2e2_27_ : 1;
|
||||||
|
bool x2e2_28_ : 1;
|
||||||
|
bool x2e2_29_ : 1;
|
||||||
|
bool x2e2_30_ : 1;
|
||||||
|
bool x2e2_31_ : 1;
|
||||||
|
bool x2e3_24_ : 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CScriptActor(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
CScriptActor(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||||
const zeus::CAABox& aabb, float, float, const CMaterialList& matList, const CHealthInfo&,
|
const zeus::CAABox& aabb, float, float, const CMaterialList& matList, const CHealthInfo&,
|
||||||
const CDamageVulnerability&, const CActorParameters&, bool, bool, u32, float, bool, bool, bool, bool);
|
const CDamageVulnerability&, const CActorParameters&, bool, bool, u32, float, bool, bool, bool, bool);
|
||||||
void Accept(IVisitor& visitor);
|
void Accept(IVisitor& visitor);
|
||||||
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||||
|
void Think(float, CStateManager&);
|
||||||
|
void PreRender(const zeus::CFrustum&, const CStateManager&);
|
||||||
|
zeus::CAABox GetSortingBounds(const CStateManager&) const;
|
||||||
|
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
|
||||||
|
CWeaponMode&, int);
|
||||||
|
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||||
|
void Touch(CActor&, CStateManager&);
|
||||||
|
const CDamageVulnerability* GetDamageVulnerability() { return &x268_damageVulnerability; }
|
||||||
|
CHealthInfo* HealthInfo() { return &x260_currentHealth; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,10 +56,11 @@
|
||||||
#include "CScriptCameraHintTrigger.hpp"
|
#include "CScriptCameraHintTrigger.hpp"
|
||||||
#include "CScriptBeam.hpp"
|
#include "CScriptBeam.hpp"
|
||||||
#include "Camera/CCinematicCamera.hpp"
|
#include "Camera/CCinematicCamera.hpp"
|
||||||
#include "MP1/CNewIntroBoss.hpp"
|
#include "MP1/World/CNewIntroBoss.hpp"
|
||||||
#include "MP1/CBeetle.hpp"
|
#include "MP1/World/CBeetle.hpp"
|
||||||
#include "MP1/CWarWasp.hpp"
|
#include "MP1/World/CWarWasp.hpp"
|
||||||
#include "MP1/CSpacePirate.hpp"
|
#include "MP1/World/CSpacePirate.hpp"
|
||||||
|
#include "MP1/World/CActorContraption.hpp"
|
||||||
#include "CScriptShadowProjector.hpp"
|
#include "CScriptShadowProjector.hpp"
|
||||||
#include "CScriptStreamedMusic.hpp"
|
#include "CScriptStreamedMusic.hpp"
|
||||||
#include "CScriptRoomAcoustics.hpp"
|
#include "CScriptRoomAcoustics.hpp"
|
||||||
|
@ -1996,6 +1997,7 @@ CEntity* ScriptLoader::Load(CStateManager& mgr, CInputStream& in, int propCount,
|
||||||
CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount,
|
CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount,
|
||||||
const CEntityInfo& info)
|
const CEntityInfo& info)
|
||||||
{
|
{
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue