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

96 lines
2.8 KiB
C++

#pragma once
#include "Game/NameObj/NameObj.hpp"
#include "Game/Util/Array.hpp"
#include <JSystem/JGeometry/TMatrix.hpp>
class JMapLinkInfo;
class LiveActor;
class BaseMatrixFollowValidater {
public:
virtual bool isValid(s32) const = 0;
};
template < typename T >
class BaseMatrixFollowValidateDelegator : public BaseMatrixFollowValidater {
public:
typedef bool (T::*Func)(s32) const;
BaseMatrixFollowValidateDelegator(T* pHost, Func func) : mHost(pHost), mFunc(func) {
}
virtual bool isValid(s32 id) const {
return (mHost->*mFunc)(id);
}
/* 0x4 */ T* mHost;
/* 0x8 */ Func mFunc;
};
class BaseMatrixFollowTarget {
public:
BaseMatrixFollowTarget(const JMapLinkInfo*);
void set(LiveActor*, const TPos3f&, const TPos3f*, BaseMatrixFollowValidater*);
const MtxPtr getHostBaseMtx() const;
bool isValid(s32) const;
/* 0x00 */ TMtx34f _0;
/* 0x30 */ const TPos3f* _30;
/* 0x34 */ LiveActor* mActor;
/* 0x38 */ const JMapLinkInfo* mLinkInfo;
/* 0x3C */ BaseMatrixFollowValidater* mValidater;
};
class BaseMatrixFollower;
class BaseMatrixFollowTargetHolder : public NameObj {
public:
BaseMatrixFollowTargetHolder(const char*, s32, s32);
virtual ~BaseMatrixFollowTargetHolder();
virtual void initAfterPlacement();
virtual void movement();
void addFollower(BaseMatrixFollower* pFollower);
void setFollowTargetInfo(LiveActor* pActor, const JMapInfoIter& rIter, const TPos3f* pBaseMtx, BaseMatrixFollowValidater* pValidater) NO_INLINE;
BaseMatrixFollowTarget* findFollowTarget(const JMapLinkInfo* pLinkInfo);
BaseMatrixFollowTarget* findFollowTarget(const BaseMatrixFollower* pFollower);
/* 0x0C */ MR::Vector< MR::AssignableArray< BaseMatrixFollowTarget* > > mTargets;
/* 0x18 */ MR::Vector< MR::AssignableArray< BaseMatrixFollower* > > mFollowers;
};
class BaseMatrixFollower {
public:
BaseMatrixFollower(NameObj*, const JMapInfoIter&);
virtual void setGravityFollowHost(const NameObj*) {
}
virtual void update();
NameObj* getFollowTargetActor() const;
void calcFollowMatrix(TPos3f*) const;
bool isEnableFollow() const;
bool isValid() const;
/* 0x04 */ JMapLinkInfo* mLinkInfo;
/* 0x08 */ NameObj* mFollowerObj;
/* 0x0C */ BaseMatrixFollowTarget* mFollowTarget;
/* 0x10 */ s32 mFollowID;
};
namespace MR {
template < typename T >
BaseMatrixFollowValidater* createBaseMatrixFollowValidateDelegator(T* pHost, bool (T::*func)(s32) const) {
return new BaseMatrixFollowValidateDelegator< T >(pHost, func);
}
bool isValidFollowID(const JMapInfoIter&);
void addBaseMatrixFollower(BaseMatrixFollower*);
void addBaseMatrixFollowTarget(LiveActor*, const JMapInfoIter&, const TPos3f*, BaseMatrixFollowValidater*);
}; // namespace MR