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

39 lines
1.4 KiB
C++

#pragma once
#include "Game/Gravity/PlanetGravity.hpp"
class CubeGravity : public PlanetGravity {
public:
CubeGravity();
virtual void updateMtx(const TPos3f& rMtx);
virtual bool calcOwnGravityVector(TVec3f* pDest, f32* pScalar, const TVec3f& rPosition) const;
void setCube(const TPos3f&);
/*
* Area as in region, not area as in Area = Base * h
*
* The region is made up of 3 components: x, y, z. For each component, a value of 0 indicates
* that the position is beyond the negative face of that component, a value of 1 indicates that
* the position is between the two faces for that component, and a value of 2 indicates that
* the position is beyond the positive face of that component.
*
* The region is encoded as follows (in pseudocode):
* `area = area_x * 3^0 + area_y * 3^1 + area_z * 3^2`
*
* `calcGravityArea` returns the encoded region
*/
int calcGravityArea(const TVec3f& rPosition) const;
bool calcFaceGravity(const TVec3f& rPosition, s32, TVec3f* pDest, f32* pScalar) const;
bool calcEdgeGravity(const TVec3f& rPosition, s32, TVec3f* pDest, f32* pScalar) const;
bool calcCornerGravity(const TVec3f& rPosition, s32, TVec3f* pDest, f32* pScalar) const;
TPos3f mCube; // 0x28
TPos3f mPosition; // 0x58
f32 lenX; // 0x88
f32 lenY; // 0x8C
f32 lenZ; // 0x90
u8 mActiveFaces; // 0x94
};