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

148 lines
4.0 KiB
C++

#pragma once
#include "Game/LiveActor/LiveActor.hpp"
#include "Game/Screen/LayoutActor.hpp"
#include <JSystem/JGeometry/TMatrix.hpp>
class PlayerRacer;
class RaceManager;
enum RaceID {
/* 0x00 */ RaceID_Penguin,
/* 0x01 */ RaceID_TeresaPhantom,
/* 0x02 */ RaceID_TeresaDeathPromenade,
/* 0x03 */ RaceID_SurfingTrial,
/* 0x04 */ RaceID_SurfingChallenge,
};
class RaceManagerLayout : public LayoutActor {
public:
/// @brief Creates a new `RaceManagerLayout`.
/// @param pName A pointer to the null-terminated name of the object.
RaceManagerLayout(const char* pName);
/// @brief Intializes the `RaceManagerLayout` while being placed into a scene.
/// @param rIter The reference to an iterator over a `JMapInfo`.
virtual void init(const JMapInfoIter& rIter);
void playCountAndGo();
void playGo();
void playRecord(); // Note: this is very likely stripped
void playGoal();
void playLose();
void playTimeUp();
void playRank(u32);
bool isAllAnimStopped();
void hideRecordPane();
void hideBestRecordPane();
void hideAllPane();
bool isPlayCountAnim() const;
bool isPlayCountAndGoAnim() const;
void setTime(u32);
void setBestTime(u32);
};
class AbstractRacer {
public:
/// @brief Creates a new `AbstractRacer`.
AbstractRacer() {
initRacer();
}
virtual void initRacer() {
mRailCoord = 0.0f;
_8 = 0.0f;
mCurrPosition.zero();
mPrevPosition.zero();
}
virtual void prepRacer(const RaceManager* pRaceManager) = 0;
virtual void startRacer() = 0;
virtual bool updateRacer(const RaceManager* pRaceManager) = 0;
virtual bool goalRacer() = 0;
virtual void loseRacer() = 0;
virtual void resetRacer(const RaceManager* pRaceManager) = 0;
virtual void exitRacer() = 0;
static bool compRacer(const AbstractRacer* pRacerA, const AbstractRacer* pRacerB) {
return pRacerA->mRailCoord > pRacerB->mRailCoord;
}
/* 0x04 */ f32 mRailCoord;
/* 0x08 */ f32 _8;
/* 0x0C */ TVec3f mCurrPosition;
/* 0x18 */ TVec3f mPrevPosition;
};
class AbstractAudience {
public:
/// @brief Creates a new `AbstractAudience`.
AbstractAudience() {
}
virtual void prepAudience() = 0;
virtual void resetAudience() = 0;
};
class RaceManager : public LiveActor {
public:
/// @brief Creates a new `RaceManager`.
RaceManager();
/// @brief Intializes the `RaceManager` while being placed into a scene.
/// @param rIter The reference to an iterator over a `JMapInfo`.
virtual void init(const JMapInfoIter& rIter);
virtual void movement();
void exeWait();
void exePrep();
void exeWipeOut();
void exeWipeWait();
void exeWipeIn();
void exeIntro();
void exeCount();
void exeRace();
void exeDemo();
void exeGoal();
void exeRank();
bool startWithWipe();
bool startImmediately();
void prepRace();
void startRace();
void goalRace();
void resetRace();
void prepBind();
void entry(AbstractRacer*);
void entry(PlayerRacer*);
void entry(AbstractAudience*);
bool isGoal(const AbstractRacer*) const;
u32 getRank(const AbstractRacer*) const;
void renewTime();
/* 0x8C */ s32 mCurrentRace;
/* 0x90 */ RaceManagerLayout* mLayout;
/* 0x94 */ AbstractRacer* mRacer[10];
/* 0xBC */ AbstractAudience* mAudience[10];
/* 0xE4 */ u32 mRacerNum;
/* 0xE8 */ u32 mAudienceNum;
/* 0xEC */ u32 mRank;
/* 0xF0 */ u32 mBestTime;
/* 0xF4 */ u32 mTime;
/* 0xF8 */ PlayerRacer* mPlayerRacer;
/* 0xFC */ TPos3f _FC;
};
namespace RaceManagerFunction {
void entryRacerOthers(AbstractRacer*);
void entryAudience(AbstractAudience*);
void entryRacerPlayer(PlayerRacer*);
void startRaceWithWipe();
void startRaceImmediately();
u32 getRaceRank();
u32 getRaceTime();
const char* getRaceName(int);
const char* getRaceMessageId(int);
s32 getRaceId(const char*, s32);
bool hasPowerStarRaceScenario(int);
}; // namespace RaceManagerFunction