Files
bigmak94andClaude Opus 5.5 4b395efe5c Add the Petari decompilation (SMGCommunity/Petari@0a5c660)
The sources of Petari (https://github.com/SMGCommunity/Petari), the
Super Mario Galaxy decompilation by the SMGCommunity, at commit
0a5c6608dc3b4c44a9aa68c2535d1793dc565f02, unchanged but for LF line
endings: LICENSE (as LICENSE-Petari.txt; CC0 1.0), include/, libs/ and
src/.  Left out: the game data Petari keeps from the original
executable, the error message archive (include/Game/System/
ErrorArchive.hpp) and two tables (src/Game/System/GalaxyID.bcsv and
StoryEvent.bcsv); GalaxyQuest's converter takes them from the player's
own disc.  The port's changes follow in the next commit, so
`git diff petari-base -- decomp` shows them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 01:59:38 +02:00

68 lines
1.9 KiB
C++

#pragma once
#include "Game/Map/RailPart.hpp"
#include <JSystem/JGeometry/TVec.hpp>
#include <revolution/types.h>
class JMapInfo;
class JMapInfoIter;
class BezierRailPart {
public:
BezierRailPart() {
}
void set(const TVec3f&, const TVec3f&, const TVec3f&, const TVec3f&);
void calcPos(TVec3f*, f32) const;
void calcVelocity(TVec3f*, f32) const;
f32 getLength(f32, f32, int) const;
f32 getParam(f32) const;
f32 getNearestParam(const TVec3f&, f32) const;
inline f32 getVelocityLength(f32 t) const {
TVec3f v;
calcVelocity(&v, t);
return v.length();
}
// 0th to 3rd degree control vectors for bezier control
/* 0x00 */ TVec3f mStart;
/* 0x0C */ TVec3f mCtrlDegree1; // "velocity"
/* 0x18 */ TVec3f mCtrlDegree2; // "acceleration"
/* 0x24 */ TVec3f mCtrlDegree3; // "jerk"
/* 0x30 */ f32 mLength;
};
class BezierRail {
public:
BezierRail(const JMapInfoIter&, const JMapInfo*);
f32 normalizePos(f32, int) const;
f32 getPartLength(int) const;
void calcPos(TVec3f*, f32) const;
void calcDirection(TVec3f*, f32) const;
void calcPosDir(TVec3f*, TVec3f*, f32) const;
f32 getNearestRailPosCoord(const TVec3f&) const;
f32 getRailPosCoord(int) const;
void calcCurrentRailCtrlPointIter(JMapInfoIter*, f32, bool) const;
void calcRailCtrlPointIter(JMapInfoIter*, int) const NO_INLINE;
void getIncludedSection(const RailPart**, f32*, f32, int) const;
int getCurrentCtrlPointIndex(f32, bool) const;
f32 getTotalLength() const;
inline RailPart* getRailPart(s32 idx) const {
return &mRailParts[idx];
}
/* 0x00 */ bool mIsClosed;
/* 0x04 */ s32 mPointNum;
/* 0x08 */ s32 mNumRailParts;
/* 0x0C */ RailPart* mRailParts; // this is a direct array of RailParts, not a single RailPart
/* 0x10 */ f32* mPointCoords;
/* 0x14 */ JMapInfoIter* mIter;
/* 0x18 */ const JMapInfo* mInfo;
};