Start mapping out PathFind related classes

This commit is contained in:
Phillip Stephens 2024-11-03 11:50:57 -08:00
parent 6a3e0c0728
commit 60189e1b02
8 changed files with 121 additions and 8 deletions

View File

@ -215,6 +215,7 @@ else:
cflags_dolphin = [
*cflags_base,
"-multibyte",
"-fp_contract off",
]
# Metrowerks library flags

View File

@ -0,0 +1,14 @@
#ifndef _TSEGIDMAPVARIABLESIZE
#define _TSEGIDMAPVARIABLESIZE
#include <rstl/reserved_vector.hpp>
#include <rstl/pair.hpp>
template < typename T >
struct TSegIdMapVariableSize {
private:
rstl::reserved_vector< rstl::pair< signed char, signed char >, 100 > x4_links;
};
#endif // _TSEGIDMAPVARIABLESIZE

View File

@ -0,0 +1,15 @@
#ifndef _CPFBITSET
#define _CPFBITSET
class CPFBitSet {
public:
void Clear();
void Add(int bit);
bool Test(int bit);
void Rmv(int bit);
private:
int mBits[16];
};
#endif // _CPFBITSET

View File

@ -0,0 +1,8 @@
#ifndef _CPATHFINDAREA
#define _CPATHFINDAREA
class CPFArea {
};
#endif // _CPATHFINDAREA

View File

@ -0,0 +1,64 @@
#ifndef _CPATHFINDREGION
#define _CPATHFINDREGION
#include <Kyoto/Math/CVector3f.hpp>
#include <Kyoto/Math/CAABox.hpp>
class CPFRegion;
class CPFRegionData {
CPFRegionData();
void SetOpenLess(CPFRegion* region);
CPFRegion* GetOpenLess();
void SetOpenMore(CPFRegion* region);
CPFRegion* GetOpenMore();
float GetCost();
void* GetParent();
void Setup(CPFRegion* region, float cost);
void Setup(CPFRegion* region, float, float);
void GetG();
void SetBestPoint(const CVector3f& point);
const CVector3f& GetBestPoint() const;
void SetCookie(int cookie);
int GetCookie() const;
private:
float x0_bestPointDistSq;
CVector3f x4_bestPoint;
int x10_cookie;
float x14_cost;
float x18_g;
float x1c_h;
CPFRegion* x20_parent;
CPFRegion* x24_openLess;
CPFRegion* x28_openMore;
int x2c_parentLink;
};
class CPFArea;
class CPFNode;
class CPFLink;
class CPFRegion {
CPFRegion();
void Fixup(CPFArea& area, int& numNodes);
private:
uint x0_numNodes;
CPFNode* x4_startNode;
uint x8_numLinks;
CPFLink* xc_startLink;
uint x10_flags;
float x14_height;
CVector3f x18_normal;
uint x24_regionIdx;
CVector3f x28_centroid;
CAABox x34_bounds;
CPFRegionData* x4c_data;
};
#endif // _CPATHFINDREGION

View File

@ -0,0 +1,11 @@
#ifndef _CPATHFINDSEARCH
#define _CPATHFINDSEARCH
class CPFOpenList {
};
class CPathFindSearch {
};
#endif // _CPATHFINDSEARCH

View File

@ -36,8 +36,8 @@ void CGuiObject::Draw(const CGuiWidgetDrawParms& parms) const {
void CGuiObject::MoveInWorld(const CVector3f& offset) {
CVector3f pos;
if (x64_parent != nullptr) {
pos = x64_parent->RotateW2O(offset);
if (GetParent() != nullptr) {
pos = GetParent()->RotateW2O(offset);
}
x4_localXF.AddTranslation(offset);
RecalculateTransforms();

View File

@ -1,5 +1,6 @@
#include "MetroidPrime/CPhysicsActor.hpp"
#include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CloseEnough.hpp"
#include "rstl/math.hpp"
@ -93,8 +94,8 @@ CPhysicsState CPhysicsActor::GetPhysicsState() const {
void CPhysicsActor::SetPhysicsState(const CPhysicsState& state) {
SetTranslation(state.GetTranslation());
const CQuaternion& quat = state.GetOrientationWR();
const CVector3f& translation = GetTranslation();
CQuaternion quat = state.GetOrientation();
CVector3f translation = GetTranslation();
SetTransform(quat.BuildTransform4f(translation));
SetConstantForceWR(state.GetConstantForceWR());
SetAngularMomentumWR(state.GetAngularMomentumWR());
@ -137,7 +138,7 @@ CMotionState CPhysicsActor::PredictAngularMotion(float dt) const {
CMotionState CPhysicsActor::PredictLinearMotion(float dt) const {
CVector3f velocity = CalculateNewVelocityWR_UsingImpulses();
CVector3f sum = x15c_force + x150_momentum;
CVector3f sum = GetConstantTotalForceWR();
return CMotionState(dt * velocity, CNUQuaternion(0.0f, CVector3f::Zero()),
dt * sum + x168_impulse, CAxisAngle::Identity());
@ -190,7 +191,6 @@ void CPhysicsActor::AddMotionState(const CMotionState& state) {
x108_angularMomentum += state.GetAngularMomentum();
ComputeDerivedQuantities();
}
bool CPhysicsActor::WillMove(const CStateManager& mgr) {