2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 04:27:42 +00:00

Add trigger visualization to inspecter

This commit is contained in:
2021-05-27 01:30:40 -07:00
parent 57cf88559f
commit 31e7721fbf
5 changed files with 39 additions and 4 deletions

View File

@@ -30,7 +30,8 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti
// FIXME: HACK This fixes the HotE softlock, definitely need to look into the morphball's collision codepath and
// FIXME: determine the proper fix
if (GetEditorId() == 0x0034004B) {
Log.report(logvisor::Warning, FMT_STRING("BUG THIS!: Overriding forceField.x() for trigger {} in area {}"), GetEditorId(), GetAreaIdAlways());
Log.report(logvisor::Warning, FMT_STRING("BUG THIS!: Overriding forceField.x() for trigger {} in area {}"),
GetEditorId(), GetAreaIdAlways());
x11c_forceField.x() = 0.f;
}
#endif
@@ -307,4 +308,11 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) {
zeus::CAABox CScriptTrigger::GetTriggerBoundsWR() const {
return {x130_bounds.min + x34_transform.origin, x130_bounds.max + x34_transform.origin};
}
void CScriptTrigger::DebugDraw() {
if (m_debugSelected || m_debugHovered) {
m_debugBox.setAABB(GetTriggerBoundsWR());
m_debugBox.draw(m_debugAddColor);
}
}
} // namespace metaforce

View File

@@ -5,12 +5,12 @@
#include "Runtime/World/CActor.hpp"
#include "Runtime/World/CDamageInfo.hpp"
#include "Runtime/Graphics/Shaders/CAABoxShader.hpp"
#include <zeus/CAABox.hpp>
#include <zeus/CVector3f.hpp>
namespace metaforce {
// TODO - Phil: Figure out what each of the DetectProjectiles actually mean
enum class ETriggerFlags : u32 {
None = 0,
@@ -61,6 +61,7 @@ protected:
bool x148_28_playerTriggerProc : 1 = false;
bool x148_29_didPhazonDamage : 1 = false;
CAABoxShader m_debugBox;
public:
DEFINE_ENTITY
CScriptTrigger(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos,
@@ -90,5 +91,6 @@ public:
x128_forceMagnitude = x11c_forceField.magnitude();
}
bool IsPlayerTriggerProc() const { return x148_28_playerTriggerProc; }
void DebugDraw();
};
} // namespace metaforce