mirror of
https://github.com/PodeCaradox/GalaxyQuest-SteamFrame.git
synced 2026-10-18 21:01:23 +02:00
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>
179 lines
10 KiB
C++
179 lines
10 KiB
C++
#pragma once
|
|
|
|
#include "Game/LiveActor/LiveActor.hpp"
|
|
#include <JSystem/JGeometry/TMatrix.hpp>
|
|
#include <JSystem/JGeometry/TVec.hpp>
|
|
#include <revolution/types.h>
|
|
|
|
class HitSensor;
|
|
class LiveActor;
|
|
|
|
namespace MR {
|
|
|
|
struct ActorMoveParam {
|
|
f32 _0;
|
|
f32 _4;
|
|
f32 _8;
|
|
f32 _C;
|
|
};
|
|
|
|
f32 calcDistance(const HitSensor*, const HitSensor*, TVec3f*);
|
|
f32 calcDistance(const LiveActor*, const TVec3f&);
|
|
f32 calcDistanceHorizontal(const LiveActor*, const TVec3f&, const TVec3f&);
|
|
f32 calcDistanceVertical(const LiveActor*, const TVec3f&, const TVec3f&);
|
|
f32 calcDistanceVertical(const LiveActor*, const TVec3f&);
|
|
f32 calcDistanceToPlayer(const LiveActor*);
|
|
f32 calcDistanceToPlayerH(const LiveActor*);
|
|
bool isNear(const HitSensor*, const HitSensor*, f32);
|
|
bool isNear(const LiveActor*, const LiveActor*, f32);
|
|
bool isNear(const LiveActor*, const TVec3f&, f32);
|
|
bool isNearPlayer(const LiveActor*, f32);
|
|
bool isNearPlayerAnyTime(const LiveActor*, f32) NO_INLINE;
|
|
bool isNearPlayer(const TVec3f&, f32);
|
|
bool isNearPlayerPose(const LiveActor*, f32, f32);
|
|
bool isNearPlayerHorizontal(const LiveActor*, f32);
|
|
void calcFrontVec(TVec3f*, const LiveActor*);
|
|
void calcUpVec(TVec3f*, const LiveActor*);
|
|
void calcSideVec(TVec3f*, const LiveActor*);
|
|
void calcPositionUpOffset(TVec3f*, const LiveActor*, f32);
|
|
void calcVecToPlayerH(TVec3f*, const LiveActor*, const TVec3f*);
|
|
void calcVecFromPlayerH(TVec3f*, const LiveActor*);
|
|
void calcVecToTargetPosH(TVec3f*, const LiveActor*, const TVec3f&, const TVec3f*);
|
|
void calcVecFromTargetPosH(TVec3f*, const LiveActor*, const TVec3f&, const TVec3f*);
|
|
bool isFaceToTargetDegree(const LiveActor*, const TVec3f&, const TVec3f&, f32);
|
|
bool isFaceToPlayerDegree(const LiveActor*, const TVec3f&, f32) NO_INLINE;
|
|
bool isFaceToTargetDegree(const LiveActor*, const TVec3f&, f32);
|
|
bool isFaceToPlayerDegree(const LiveActor*, f32);
|
|
bool isFaceToPlayerDegreeHV(const LiveActor*, const TVec3f&, f32, f32) NO_INLINE;
|
|
bool isFaceToTargetHorizontalDegree(const LiveActor*, const TVec3f&, const TVec3f&, f32);
|
|
bool isFaceToPlayerHorizontalDegree(const LiveActor*, const TVec3f&, f32);
|
|
bool isClockwiseToDir(const LiveActor*, const TVec3f&, const TVec3f&);
|
|
bool isClockwiseToPlayer(const LiveActor*, const TVec3f&);
|
|
bool isPlayerLeftSide(const LiveActor*);
|
|
bool isLeftSideFromPlayer(const LiveActor*);
|
|
bool isInSightConePlayer(const LiveActor*, const TVec3f&, f32, f32);
|
|
bool isInSightFanPlayer(const LiveActor*, const TVec3f&, f32, f32, f32);
|
|
bool isBindedWallFront(const LiveActor*, const TVec3f&, f32);
|
|
bool isOnPlayer(const LiveActor*);
|
|
bool isPlayerExistSide(const LiveActor*, f32, f32);
|
|
bool isPlayerExistUp(const LiveActor*, f32, f32);
|
|
bool isPlayerExistDown(const LiveActor*, f32, f32);
|
|
bool isInWater(const LiveActor*, const TVec3f&);
|
|
bool isInDeath(const LiveActor*, const TVec3f&);
|
|
void makeMtxTR(MtxPtr, const LiveActor*);
|
|
void makeMtxTRS(MtxPtr, const LiveActor*);
|
|
void makeMtxTransRotateY(MtxPtr, const LiveActor*);
|
|
void calcMtxFromGravityAndZAxis(TPos3f*, const LiveActor*, const TVec3f&, const TVec3f&);
|
|
void calcAndSetBaseMtxFromGravityAndZAxis(LiveActor*, const TVec3f&);
|
|
void calcActorAxis(TVec3f*, TVec3f*, TVec3f*, const LiveActor*);
|
|
void calcActorAxisX(TVec3f*, const LiveActor*);
|
|
void calcActorAxisY(TVec3f*, const LiveActor*);
|
|
void calcActorAxisZ(TVec3f*, const LiveActor*);
|
|
bool faceToVector(TQuat4f*, TVec3f, f32);
|
|
bool faceToVector(MtxPtr, TVec3f, f32);
|
|
bool faceToPoint(MtxPtr, TVec3f, f32);
|
|
void makeQuatFromRotate(TQuat4f*, const LiveActor*);
|
|
void makeQuatAndFrontFromRotate(TQuat4f*, TVec3f*, const LiveActor*);
|
|
void turnQuatUpToGravity(TQuat4f*, const TQuat4f&, const LiveActor*);
|
|
void blendQuatFromGroundAndFront(TQuat4f*, const LiveActor*, const TVec3f&, f32, f32);
|
|
void resetPosition(LiveActor*);
|
|
void resetPosition(LiveActor*, const TVec3f&);
|
|
void resetPosition(LiveActor*, const char*);
|
|
bool makeMtxOnMapCollision(TPos3f*, LiveActor*, f32);
|
|
void calcVelocityMoveToDirectionHorizon(TVec3f*, const LiveActor*, const TVec3f&, f32) NO_INLINE;
|
|
void calcVelocityMoveToDirectionHorizon(TVec3f*, const LiveActor*, const TVec3f&, f32, f32, f32, f32) NO_INLINE;
|
|
void calcVelocityMoveToDirection(TVec3f*, const LiveActor*, const TVec3f&, f32);
|
|
void calcVelocityMoveToDirection(TVec3f*, const LiveActor*, const TVec3f&, f32, f32, f32, f32) NO_INLINE;
|
|
void calcVelocityMoveToTarget(TVec3f*, const LiveActor*, const TVec3f&, f32);
|
|
void addVelocityMoveToDirection(LiveActor*, const TVec3f&, f32);
|
|
void addVelocityMoveToTarget(LiveActor*, const TVec3f&, f32);
|
|
void addVelocityMoveToTarget(LiveActor*, const TVec3f&, f32, f32, f32, f32);
|
|
void addVelocityAwayFromTarget(LiveActor*, const TVec3f&, f32);
|
|
void addVelocityAwayFromTarget(LiveActor*, const TVec3f&, f32, f32, f32, f32);
|
|
void addVelocityClockwiseToDirection(LiveActor*, const TVec3f&, f32);
|
|
void addVelocityClockwiseToTarget(LiveActor*, const TVec3f&, f32);
|
|
void addVelocityClockwiseToPlayer(LiveActor*, f32);
|
|
void addVelocityJump(LiveActor*, f32) NO_INLINE;
|
|
bool addVelocityLimit(LiveActor*, const TVec3f&);
|
|
void setVelocityJump(LiveActor*, f32);
|
|
void addVelocityToGravity(LiveActor*, f32) NO_INLINE;
|
|
void addVelocityToGravityOrGround(LiveActor*, f32);
|
|
bool addVelocityToCollisionNormal(LiveActor*, f32);
|
|
void addVelocityKeepHeight(LiveActor*, const TVec3f&, f32, f32);
|
|
void addVelocityKeepHeight(LiveActor*, const TVec3f&, f32, f32, f32);
|
|
bool addVelocityKeepHeightUseShadow(LiveActor*, f32, f32, f32, const char*);
|
|
bool addVelocityKeepHeightUseShadow(LiveActor*, f32, f32, f32, f32, const char*);
|
|
void addVelocitySeparateHV(LiveActor*, const TVec3f&, f32, f32);
|
|
void setVelocitySeparateHV(LiveActor*, const TVec3f&, f32, f32);
|
|
void attenuateVelocity(LiveActor*, f32);
|
|
void attenuateVelocityExceptDirection(LiveActor*, const TVec3f&, f32);
|
|
void restrictVelocity(LiveActor*, f32);
|
|
void killVelocityOnGroundH(LiveActor*);
|
|
void killVelocityOnGroundCosH(LiveActor*, f32);
|
|
void killVelocityToTarget(LiveActor*, const TVec3f&);
|
|
void forceBindOnGround(LiveActor*, f32, f32);
|
|
bool reboundVelocityFromEachCollision(LiveActor*, f32, f32, f32, f32);
|
|
bool reboundVelocityFromCollision(LiveActor*, f32 = 0.0f, f32 = 0.0f, f32 = 1.0f);
|
|
void zeroVelocity(LiveActor*);
|
|
void setVelocity(LiveActor*, const TVec3f&);
|
|
void addVelocity(LiveActor*, const TVec3f&);
|
|
void scaleVelocity(LiveActor*, f32);
|
|
f32 calcVelocityLength(const LiveActor*);
|
|
f32 calcGravitySpeed(const LiveActor*);
|
|
void applyVelocityDampAndGravity(LiveActor*, f32 gravity, f32 groundDampH, f32 airDampH, f32 dampVUp, f32 velHMin);
|
|
void setVelocityJumpAwayFromPlayer(LiveActor*, f32, f32);
|
|
bool sendMsgPushAndKillVelocityToTarget(LiveActor*, HitSensor*, HitSensor*);
|
|
void addVelocityFromPush(LiveActor*, f32, HitSensor*, HitSensor*);
|
|
void addVelocityFromPushHorizon(LiveActor*, f32, HitSensor*, HitSensor*);
|
|
void addVelocitySeparateHV(LiveActor*, HitSensor*, HitSensor*, f32, f32);
|
|
void setVelocitySeparateHV(LiveActor*, HitSensor*, HitSensor*, f32, f32) NO_INLINE;
|
|
void setVelocityBlowAttack(LiveActor*, HitSensor*, HitSensor*, f32, f32, s32);
|
|
bool reflectVelocityH(LiveActor*, HitSensor*, HitSensor*, f32);
|
|
bool calcVelocityAreaMoveOnGround(TVec3f*, const LiveActor*);
|
|
bool calcVelocityRailMoveOnGround(TVec3f*, const LiveActor*);
|
|
bool calcVelocityAreaOrRailMoveOnGround(TVec3f*, const LiveActor*);
|
|
void rotateDirectionGravityDegree(const LiveActor*, TVec3f*, f32);
|
|
void turnDirection(const LiveActor*, TVec3f*, const TVec3f&, f32);
|
|
void turnDirectionDegree(const LiveActor*, TVec3f*, const TVec3f&, f32);
|
|
void turnDirectionToTarget(const LiveActor*, TVec3f*, const TVec3f&, f32);
|
|
void turnDirectionToTargetDegree(const LiveActor*, TVec3f*, const TVec3f&, f32) NO_INLINE;
|
|
void turnDirectionToTargetDegreeHorizon(const LiveActor*, TVec3f*, const TVec3f&, f32) NO_INLINE;
|
|
bool turnDirectionToTargetUseGroundNormalDegree(const LiveActor*, TVec3f*, const TVec3f&, f32);
|
|
void turnDirectionToPlayerDegree(const LiveActor*, TVec3f*, f32);
|
|
void turnDirectionToPlayerDegreeHorizon(const LiveActor*, TVec3f*, f32);
|
|
void turnDirectionFromTargetDegree(const LiveActor*, TVec3f*, const TVec3f&, f32) NO_INLINE;
|
|
void turnDirectionFromTargetDegreeHorizon(const LiveActor*, TVec3f*, const TVec3f&, f32) NO_INLINE;
|
|
void turnDirectionFromPlayerDegree(const LiveActor*, TVec3f*, f32);
|
|
void turnDirectionFromPlayerDegreeHorizon(const LiveActor*, TVec3f*, f32);
|
|
f32 turnDirectionAndGravityH(TQuat4f*, const LiveActor*, const TVec3f&, f32, f32);
|
|
f32 turnDirectionAndGravityH(LiveActor*, const TVec3f&, f32, f32);
|
|
void turnDirectionToGround(const LiveActor*, TVec3f*);
|
|
void moveAndTurnToDirection(LiveActor*, TVec3f*, const TVec3f&, f32, f32, f32, f32);
|
|
void moveAndTurnToTarget(LiveActor*, TVec3f*, const TVec3f&, f32, f32, f32, f32);
|
|
void moveAndTurnToPlayer(LiveActor*, TVec3f*, f32, f32, f32, f32);
|
|
void flyAndTurnAlongRailSearchingPlayer(LiveActor*, TVec3f*, f32, f32, f32, f32, f32, bool);
|
|
void escapeFromPlayer(LiveActor*, TVec3f*, f32, f32, f32, f32);
|
|
void moveAndTurnToDirection(LiveActor*, const TVec3f&, f32, f32, f32, f32) NO_INLINE;
|
|
void moveAndTurnToTarget(LiveActor*, const TVec3f&, f32, f32, f32, f32) NO_INLINE;
|
|
void moveAndTurnToPlayer(LiveActor*, f32, f32, f32, f32);
|
|
void moveAndTurnAlongRail(LiveActor*, f32, f32, f32, f32, f32, bool*);
|
|
|
|
// NOTE: symbols dont exist for these, however the exact logic is used various places
|
|
// If a suitable symbol is found, these can be replaced.
|
|
inline TVec3f getVelocityHorizon(LiveActor* pActor) {
|
|
TVec3f velH;
|
|
velH.scaleAdd(-pActor->mGravity.dot(pActor->mVelocity), pActor->mGravity, pActor->mVelocity);
|
|
return velH;
|
|
}
|
|
|
|
inline void killVelocityVertical(LiveActor* pActor) {
|
|
pActor->mVelocity.scaleAdd(-pActor->mGravity.dot(pActor->mVelocity), pActor->mGravity, pActor->mVelocity);
|
|
}
|
|
|
|
inline TVec3f killGravity(LiveActor* pActor, const TVec3f& rVec) {
|
|
TVec3f velH;
|
|
velH.scaleAdd(-pActor->mGravity.dot(rVec), pActor->mGravity, rVec);
|
|
return velH;
|
|
}
|
|
}; // namespace MR
|