2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 16:24:55 +00:00

Add debugging tool CVars

This commit is contained in:
2021-01-10 18:44:42 -08:00
parent 386d6ef527
commit cede47be4d
6 changed files with 49 additions and 44 deletions

View File

@@ -1956,7 +1956,7 @@ void CMorphBall::CollidedWith(TUniqueId id, const CCollisionInfoList& list, CSta
if (wakeMaterial == EMaterialTypes::NoStepLogic) {
if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Floor)) {
EMaterialTypes tmpMaterial;
EMaterialTypes tmpMaterial = EMaterialTypes::NoStepLogic;
if (info.GetMaterialLeft().HasMaterial(EMaterialTypes::Dirt)) {
tmpMaterial = EMaterialTypes::Dirt;
} else {
@@ -2169,12 +2169,11 @@ float CMorphBall::CalculateSurfaceFriction() const {
}
void CMorphBall::ApplyGravity(const CStateManager& mgr) {
const float mass = x0_player.GetMass();
const bool hasGravitySuit = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit);
const bool useWaterGravity = x0_player.CheckSubmerged() && !hasGravitySuit;
const float gravity = useWaterGravity ? g_tweakBall->GetBallWaterGravity() : g_tweakBall->GetBallGravity();
x0_player.SetMomentumWR(zeus::CVector3f(0.f, 0.f, gravity * mass));
if (!x0_player.CheckSubmerged() || mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit)) {
x0_player.SetMomentumWR({0.f, 0.f, x0_player.GetMass() * g_tweakBall->GetBallGravity()});
} else {
x0_player.SetMomentumWR({0.f, 0.f, x0_player.GetMass() * g_tweakBall->GetBallWaterGravity()});
}
}
void CMorphBall::SpinToSpeed(float holdMag, const zeus::CVector3f& torque, float mag) {

View File

@@ -11,9 +11,7 @@ namespace urde {
std::array<s32, 300> sMazeSeeds;
#ifndef NDEBUG
std::array<zeus::CVector3f, skMazeRows * skMazeCols> sDebugCellPos;
#endif
CScriptMazeNode::CScriptMazeNode(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, s32 col, s32 row, s32 side,
@@ -163,14 +161,12 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
maze->GenerateObstacles();
mgr.SetCurrentMaze(std::move(maze));
}
#ifndef NDEBUG
if (xf0_side == ESide::Right) {
sDebugCellPos[xe8_col + xec_row * skMazeCols] = GetTranslation();
} else if (xe8_col == skMazeCols - 1) {
// Last column does not have right nodes, but we can infer the position
sDebugCellPos[xe8_col + xec_row * skMazeCols] = GetTranslation() - zeus::CVector3f{1.1875f, -0.1215f, 1.2187f};
}
#endif
}
}
// URDE change: used to be in the above if branch
@@ -356,11 +352,9 @@ void CMazeState::Initialize() {
auto& cell = GetCell(*idx);
if (cell.x1_26_checked) {
cell.x1_25_onPath = true;
#ifndef NDEBUG
if (pathLength > 0) {
m_path.push_back(*idx);
}
#endif
}
}
x94_24_initialized = true;
@@ -467,7 +461,6 @@ void CMazeState::GenerateObstacles() {
};
}
#ifndef NDEBUG
void CMazeState::DebugRender() {
m_renderer.Reset();
m_renderer.AddVertex(sDebugCellPos[skEnterCol + skEnterRow * skMazeCols], zeus::skBlue, 2.f);
@@ -484,5 +477,4 @@ void CMazeState::DebugRender() {
}
m_renderer.Render();
}
#endif
} // namespace urde

View File

@@ -54,10 +54,8 @@ class CMazeState {
s32 x90_targetRow;
bool x94_24_initialized : 1 = false;
#ifndef NDEBUG
std::vector<s32> m_path;
CLineRenderer m_renderer = {CLineRenderer::EPrimitiveMode::LineStrip, skMazeRows * skMazeCols, {}, true};
#endif
public:
CMazeState(s32 enterCol, s32 enterRow, s32 targetCol, s32 targetRow)
@@ -66,9 +64,7 @@ public:
void Initialize();
void GenerateObstacles();
#ifndef NDEBUG
void DebugRender();
#endif
[[nodiscard]] SMazeCell& GetCell(u32 col, u32 row) {
#ifndef NDEBUG

View File

@@ -54,7 +54,7 @@ void CScriptTrigger::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CS
}
}
CEntity::AcceptScriptMsg(msg, uid, mgr);
CActor::AcceptScriptMsg(msg, uid, mgr);
}
CScriptTrigger::CObjectTracker* CScriptTrigger::FindObject(TUniqueId id) {