add cc collider view (broken color)

This commit is contained in:
TakaRikka
2026-03-18 01:25:42 -07:00
parent 5cb3a39f43
commit cefd7e59a1
11 changed files with 87 additions and 46 deletions
+1 -1
-2
View File
@@ -22,12 +22,10 @@ public:
/* 0x2802 */ u16 mObjTgCount;
/* 0x2804 */ u16 mObjCoCount;
/* 0x2806 */ u16 mObjCount;
#if DEBUG
/* 0x280C */ u16 field_0x280c;
/* 0x280E */ u16 field_0x280e;
/* 0x2810 */ u16 field_0x2810;
/* 0x2812 */ u16 field_0x2812;
#endif
/* 0x2808 */ cCcD_DivideArea mDivideArea;
/* 0x2848 vtable */
-8
View File
@@ -451,9 +451,7 @@ public:
void CalcTgVec();
virtual ~dCcD_Cps() {}
dCcD_Cps() {}
#if DEBUG
virtual void Draw(const GXColor& color);
#endif
}; // Size = 0x144
// Triangle
@@ -463,9 +461,7 @@ public:
cCcD_ShapeAttr* GetShapeAttr();
virtual ~dCcD_Tri() {}
dCcD_Tri() {}
#if DEBUG
virtual void Draw(const GXColor& color);
#endif
};
// Cylinder
@@ -478,9 +474,7 @@ public:
void MoveCTg(cXyz&);
virtual ~dCcD_Cyl() {}
dCcD_Cyl() {}
#if DEBUG
virtual void Draw(const GXColor& color);
#endif
}; // Size = 0x13C
// Sphere
@@ -492,9 +486,7 @@ public:
void MoveCAt(cXyz&);
virtual cCcD_ShapeAttr* GetShapeAttr();
virtual ~dCcD_Sph() {}
#if DEBUG
virtual void Draw(const GXColor& color);
#endif
}; // Size = 0x138
dCcD_GObjInf* dCcD_GetGObjInf(cCcD_Obj* param_0);
-2
View File
@@ -472,12 +472,10 @@ void cCcS::Move() {
ChkCo();
MoveAfterCheck();
#if DEBUG
field_0x280c = mObjAtCount;
field_0x280e = mObjTgCount;
field_0x2810 = mObjCoCount;
field_0x2812 = mObjCount;
#endif
mObjAtCount = 0;
mObjTgCount = 0;
+25 -5
View File
@@ -618,6 +618,14 @@ static int poly_draw(dBgS_CaptPoly* capt, cBgD_Vtx_t* vtxList, int v0, int v1, i
GXColor roof_color = {0, 0, 0xFF, 0xFF};
GXColor wall_color = {0, 0xFF, 0, 0xFF};
#if TARGET_PC
dusk::ImGuiMenuTools::CollisionViewSettings collisionViewSettings = dusk::g_imguiConsole.getCollisionViewSettings();
f32 view_opacity = 255 * (collisionViewSettings.m_terrainViewOpacity / 100.0f);
ground_color.a = view_opacity;
roof_color.a = view_opacity;
wall_color.a = view_opacity;
#endif
cXyz raise;
PSVECScale(&plane->mNormal, &raise, s_InsideHio.m_raise_amount);
@@ -649,11 +657,18 @@ static int poly_draw(dBgS_CaptPoly* capt, cBgD_Vtx_t* vtxList, int v0, int v1, i
void dBgS::Draw() {
cBgS::Draw();
if (dusk::g_imguiConsole.isCollisionView()) {
s_InsideHio.m_flags |= dBgS_InsideHIO::FLAG_DISP_POLY_e;
} else {
s_InsideHio.m_flags &= ~dBgS_InsideHIO::FLAG_DISP_POLY_e;
}
#if TARGET_PC
#define IMGUI_TOGGLE_HIO_FLAG(status, flag) \
if (status) { \
s_InsideHio.m_flags |= flag; \
} else { \
s_InsideHio.m_flags &= ~flag; \
}
dusk::ImGuiMenuTools::CollisionViewSettings collisionViewSettings = dusk::g_imguiConsole.getCollisionViewSettings();
IMGUI_TOGGLE_HIO_FLAG(collisionViewSettings.m_enableTerrainView, dBgS_InsideHIO::FLAG_DISP_POLY_e);
IMGUI_TOGGLE_HIO_FLAG(collisionViewSettings.m_enableWireframe, dBgS_InsideHIO::FLAG_WHITE_WIRE_e);
#endif
if (s_InsideHio.ChkDispPoly()) {
cM3dGAab aab;
@@ -664,6 +679,11 @@ void dBgS::Draw() {
f32 var_f31 = fabsf(s_InsideHio.m_p0.x);
#if TARGET_PC
dusk::ImGuiMenuTools::CollisionViewSettings collisionViewSettings = dusk::g_imguiConsole.getCollisionViewSettings();
var_f31 = collisionViewSettings.m_drawRange;
#endif
min.x = player->current.pos.x - var_f31;
min.y = player->current.pos.y - var_f31;
min.z = player->current.pos.z - var_f31;
-18
View File
@@ -4,9 +4,7 @@
#include "f_op/f_op_actor_mng.h"
#include "f_pc/f_pc_searcher.h"
#if DEBUG
#include "d/d_debug_viewer.h"
#endif
void dCcD_GAtTgCoCommonBase::ClrActorInfo() {
mApid = -1;
@@ -354,8 +352,6 @@ void dCcD_Cps::CalcTgVec() {
CalcVec(dest);
}
#if DEBUG
void dCcD_Cps::Draw(const GXColor& color) {
Mtx auStack_68;
Mtx auStack_98;
@@ -379,8 +375,6 @@ void dCcD_Cps::Draw(const GXColor& color) {
dDbVw_drawSphereXlu(*GetEndP(), GetR(), color, 1);
}
#endif
void dCcD_Tri::Set(dCcD_SrcTri const& src) {
dCcD_GObjInf::Set(src.mObjInf);
cCcD_TriAttr* attr = this;
@@ -390,8 +384,6 @@ cCcD_ShapeAttr* dCcD_Tri::GetShapeAttr() {
return this;
}
#if DEBUG
void dCcD_Tri::Draw(const GXColor& color) {
cXyz cStack_34[3];
cStack_34[0] = mA;
@@ -400,8 +392,6 @@ void dCcD_Tri::Draw(const GXColor& color) {
dDbVw_drawTriangleXlu(cStack_34, color, 1);
}
#endif
void dCcD_Cyl::Set(dCcD_SrcCyl const& src) {
dCcD_GObjInf::Set(src.mObjInf);
cCcD_CylAttr::Set(src.mCylAttr);
@@ -433,14 +423,10 @@ void dCcD_Cyl::MoveCTg(cXyz& pos) {
SetC(pos);
}
#if DEBUG
void dCcD_Cyl::Draw(const GXColor& color) {
dDbVw_drawCylinderXlu(*GetCP(), GetR(), GetH(), color, 1);
}
#endif
void dCcD_Sph::Set(dCcD_SrcSph const& src) {
dCcD_GObjInf::Set(src.mObjInf);
cCcD_SphAttr::Set(src.mSphAttr);
@@ -464,10 +450,6 @@ cCcD_ShapeAttr* dCcD_Sph::GetShapeAttr() {
return this;
}
#if DEBUG
void dCcD_Sph::Draw(const GXColor& color) {
dDbVw_drawSphereXlu(*GetCP(), GetR(), color, 1);
}
#endif
+32 -3
View File
@@ -10,6 +10,8 @@
#include "d/d_jnt_col.h"
#include "f_op/f_op_actor_mng.h"
#include "dusk/imgui/ImGuiConsole.hpp"
class dCcS_HIO : public JORReflexible {
public:
enum flags_e {
@@ -55,10 +57,11 @@ public:
/* 0x8 */ s16 m_shield_range;
};
#if DEBUG
dCcS_HIO::~dCcS_HIO() {}
void dCcS_HIO::genMessage(JORMContext* mctx) {
#if DEBUG
mctx->genLabel("処理関係 -----", 0);
mctx->genCheckBox("処理Off", &m_flags, 0x40);
mctx->genCheckBox("多数ヒットチェック(草木花)Off", &m_flags, 0x80);
@@ -79,16 +82,18 @@ void dCcS_HIO::genMessage(JORMContext* mctx) {
mctx->genLabel("特殊-----", 0);
mctx->genSlider("盾範囲(max=360度)", &m_shield_range, 0, 0x7FFF);
#endif
}
#if DEBUG
static OSStopwatch s_move_timer;
static OSStopwatch s_mass_timer;
static dCcS_HIO s_Hio;
int g_mass_counter;
#endif
static dCcS_HIO s_Hio;
void dCcS::Ct() {
cCcS::Ct();
@@ -762,6 +767,23 @@ void dCcS::Draw() {
OS_REPORT("Mass Counter %d\n", g_mass_counter);
g_mass_counter = 0;
}
#endif
#if TARGET_PC
#define IMGUI_TOGGLE_HIO_FLAG(status, flag) \
if (status) { \
s_Hio.m_flags |= flag; \
} else { \
s_Hio.m_flags &= ~flag; \
}
dusk::ImGuiMenuTools::CollisionViewSettings collisionViewSettings = dusk::g_imguiConsole.getCollisionViewSettings();
IMGUI_TOGGLE_HIO_FLAG(collisionViewSettings.m_enableAtView, dCcS_HIO::FLAG_AT_ON_e);
IMGUI_TOGGLE_HIO_FLAG(collisionViewSettings.m_enableTgView, dCcS_HIO::FLAG_TG_ON_e);
IMGUI_TOGGLE_HIO_FLAG(collisionViewSettings.m_enableCoView, dCcS_HIO::FLAG_CO_ON_e);
f32 view_opacity = 255 * (collisionViewSettings.m_colliderViewOpacity / 100.0f);
#endif
if (s_Hio.CheckAtOn()) {
for (int i = 0; i < field_0x280c; i++) {
@@ -769,9 +791,11 @@ void dCcS::Draw() {
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjAt[i]->GetGObjInf();
if (gobj->ChkAtHit()) {
GXColor color = {0xFF, 0, 0, 0xB4};
color.a = view_opacity;
mpObjAt[i]->Draw(color);
} else {
GXColor color = {0xFF, 0, 0, 0x50};
color.a = view_opacity;
mpObjAt[i]->Draw(color);
}
}
@@ -784,9 +808,11 @@ void dCcS::Draw() {
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjTg[i]->GetGObjInf();
if (gobj->ChkTgHit()) {
GXColor color = {0, 0xFF, 0, 0xB4};
color.a = view_opacity;
mpObjTg[i]->Draw(color);
} else {
GXColor color = {0, 0xFF, 0, 0x50};
color.a = view_opacity;
mpObjTg[i]->Draw(color);
}
}
@@ -799,9 +825,11 @@ void dCcS::Draw() {
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjCo[i]->GetGObjInf();
if (gobj->ChkCoHit()) {
GXColor color = {0xFF, 0xFF, 0xFF, 0xB4};
color.a = view_opacity;
mpObjCo[i]->Draw(color);
} else {
GXColor color = {0xFF, 0xFF, 0xFF, 0x50};
color.a = view_opacity;
mpObjCo[i]->Draw(color);
}
}
@@ -820,6 +848,7 @@ void dCcS::Draw() {
}
}
#if DEBUG
if (s_Hio.ChkCounter()) {
OS_REPORT("At:%d,Tg:%d,Co:%d\n", field_0x280c, field_0x280e, field_0x2810);
}
+1 -1
View File
@@ -15,7 +15,7 @@ namespace dusk {
void draw();
bool isBloomEnabled() { return m_menuGame.isBloomEnabled(); }
bool isCollisionView() { return m_menuTools.isCollisionView(); }
ImGuiMenuTools::CollisionViewSettings& getCollisionViewSettings() { return m_menuTools.getCollisionViewSettings(); }
static bool CheckMenuViewToggle(ImGuiKey key, bool& active);
+15 -1
View File
@@ -18,9 +18,23 @@ namespace dusk {
if (ImGui::Checkbox("Development Mode", &m_isDevelopmentMode)) {
isToggleDevelopmentMode = true;
}
ImGui::Checkbox("Enable Collision View", &m_enableCollisionView);
ImGui::Separator();
if (ImGui::BeginMenu("Collision View")) {
ImGui::Checkbox("Enable Terrain view", &m_collisionViewSettings.m_enableTerrainView);
// can't use wireframe atm because aurora doesn't support GX_LINES
//ImGui::Checkbox("Enable wireframe view", &m_collisionViewSettings.m_enableWireframe);
ImGui::SliderFloat("Opacity##terrain", &m_collisionViewSettings.m_terrainViewOpacity, 0.0f, 100.0f);
ImGui::SliderFloat("Draw Range", &m_collisionViewSettings.m_drawRange, 0.0f, 1000.0f);
ImGui::Separator();
ImGui::Checkbox("Enable Attack Collider view", &m_collisionViewSettings.m_enableAtView);
ImGui::Checkbox("Enable Target Collider view", &m_collisionViewSettings.m_enableTgView);
ImGui::Checkbox("Enable Push Collider view", &m_collisionViewSettings.m_enableCoView);
ImGui::SliderFloat("Opacity##colliders", &m_collisionViewSettings.m_colliderViewOpacity, 0.0f, 100.0f);
ImGui::EndMenu();
}
ImGui::MenuItem("Process Management", "F2", &m_showProcessManagement);
ImGui::MenuItem("Debug Overlay", "F3", &m_showDebugOverlay);
ImGui::MenuItem("Heap Viewer", "F4", &m_showHeapOverlay);
+13 -2
View File
@@ -9,6 +9,17 @@
namespace dusk {
class ImGuiMenuTools {
public:
struct CollisionViewSettings {
bool m_enableTerrainView = false;
bool m_enableWireframe = false;
bool m_enableAtView = false;
bool m_enableTgView = false;
bool m_enableCoView = false;
float m_terrainViewOpacity = 50.0f;
float m_colliderViewOpacity = 50.0f;
float m_drawRange = 100.0f;
};
ImGuiMenuTools();
void draw();
@@ -19,7 +30,7 @@ namespace dusk {
void ShowStubLog();
void ShowMapLoader();
bool isCollisionView() { return m_enableCollisionView; }
CollisionViewSettings& getCollisionViewSettings() { return m_collisionViewSettings; }
private:
bool m_showDebugOverlay = false;
@@ -49,7 +60,7 @@ namespace dusk {
bool m_isDevelopmentMode = false;
bool m_enableCollisionView = false;
CollisionViewSettings m_collisionViewSettings;
};
}
-3
View File
@@ -1041,9 +1041,6 @@ GXDrawSyncCallback GXSetDrawSyncCallback(GXDrawSyncCallback cb) {
STUB_LOG();
return cb;
}
void GXDrawCylinder(u8 numEdges) {
STUB_LOG();
}
void GXWaitDrawDone(void) {
STUB_LOG();
}