summaryrefslogtreecommitdiff
path: root/src/d/d_path.cpp
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2026-03-29 16:43:00 -0700
committerGitHub <noreply@github.com>2026-03-29 16:43:00 -0700
commitcb6ee4b21e25cb40a08c0f1effeebda79896a7e5 (patch)
treef894ebc412808129583aaac83a8e1ff8580e0ea9 /src/d/d_path.cpp
parentc98b96f94eff76d380c62f3935fefe56057dc99e (diff)
d_path / d_vibration debug work (#3138)
* dpath debug * dvibration debug * d_meter2_info debug * gcyl/gpsh debug
Diffstat (limited to 'src/d/d_path.cpp')
-rw-r--r--src/d/d_path.cpp195
1 files changed, 161 insertions, 34 deletions
diff --git a/src/d/d_path.cpp b/src/d/d_path.cpp
index a01cfdc8a6..b1fa3b7891 100644
--- a/src/d/d_path.cpp
+++ b/src/d/d_path.cpp
@@ -8,7 +8,38 @@
#include "d/d_path.h"
#include "d/d_com_inf_game.h"
-dPnt* dPath_GetPnt(dPath const* path, int pnt_index) {
+#if DEBUG
+#include "d/d_debug_viewer.h"
+#endif
+
+class dPath_HIO : public JORReflexible {
+public:
+ dPath_HIO() {}
+ ~dPath_HIO();
+
+ void genMessage(JORMContext* mctx) {
+ mctx->genCheckBox("デバッグ表示", &flags, 2);
+ mctx->genSlider("部屋番号", &roomNo, -2, 64);
+ mctx->genLabel("-3=現在プレイヤーのいる部屋, -2=旧常駐、-1=常駐", 0);
+ }
+
+ void Ct() {
+ flags = 0;
+ roomNo = -3;
+ }
+
+ int GetRoomNo() { return roomNo; }
+ bool ChkDispLine() { return flags & 2; }
+
+ /* 0x4 */ s8 id;
+ /* 0x6 */ u16 flags;
+ /* 0x8 */ s16 roomNo;
+};
+
+dPnt* dPath_GetPnt(const dPath* path, int pnt_index) {
+ JUT_ASSERT(27, path != NULL);
+ JUT_ASSERT(28, 0 <= pnt_index && pnt_index < path->m_num);
+
if (path == NULL || path->m_points == NULL || pnt_index < 0 || pnt_index >= path->m_num) {
return NULL;
}
@@ -17,116 +48,212 @@ dPnt* dPath_GetPnt(dPath const* path, int pnt_index) {
}
dPath* dPath_GetRoomPath(int path_index, int room_no) {
- dStage_dPath_c* path;
+ dStage_dPath_c* pd;
if (room_no == -1) {
- path = dComIfGp_getStage()->getPath2Inf();
+ dStage_dt_c* stage = dComIfGp_getStage();
+ pd = stage->getPath2Inf();
} else {
+ JUT_ASSERT(58, 0 <= room_no && room_no < 64);
dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(room_no);
if (roomDt == NULL) {
return NULL;
}
- path = roomDt->getPath2Inf();
+ pd = roomDt->getPath2Inf();
}
- if (path == NULL || path_index < 0 || path_index >= path->m_num) {
+ if (pd == NULL || path_index < 0 || path_index >= pd->num) {
return NULL;
}
- return &path->m_path[path_index];
+ return &pd->m_path[path_index];
}
-dPath* dPath_GetNextRoomPath(dPath const* p_path, int room_no) {
- dStage_dPath_c* path;
+dPath* dPath_GetNextRoomPath(const dPath* path, int room_no) {
+ dStage_dPath_c* pd;
if (room_no == -1) {
- path = dComIfGp_getStage()->getPath2Inf();
+ dStage_dt_c* stage = dComIfGp_getStage();
+ pd = stage->getPath2Inf();
} else {
dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(room_no);
if (roomDt == NULL) {
return NULL;
}
- path = roomDt->getPath2Inf();
+ pd = roomDt->getPath2Inf();
}
- int next_id = p_path->m_nextID;
- if (path == NULL || next_id == 0xFFFF) {
+ int next_id = path->m_nextID;
+ if (pd == NULL || next_id == 0xFFFF) {
return NULL;
}
- if (next_id < 0 || next_id >= path->m_num) {
+ JUT_ASSERT(111, 0 <= next_id && next_id < pd->num);
+ if (next_id < 0 || next_id >= pd->num) {
return NULL;
}
- return &path->m_path[next_id];
+ return &pd->m_path[next_id];
}
#if !PLATFORM_GCN // Fakematch due to differing return type on non-GCN platforms
-int dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2) {
+int dPath_GetPolyRoomPathVec(const cBgS_PolyInfo& polyinfo, cXyz* vec, int* param_2)
#else
-u8 dPath_GetPolyRoomPathVec(cBgS_PolyInfo const& poly, cXyz* p_pathVec, int* param_2) {
+u8 dPath_GetPolyRoomPathVec(const cBgS_PolyInfo& polyinfo, cXyz* vec, int* param_2)
#endif
- int roomId = dComIfG_Bgsp().GetRoomId(poly);
- int roomPathId = dComIfG_Bgsp().GetRoomPathId(poly);
+{
+ int room_no = dComIfG_Bgsp().GetRoomId(polyinfo);
+ int path_idx = dComIfG_Bgsp().GetRoomPathId(polyinfo);
- p_pathVec->x = 0.0f;
- p_pathVec->y = 0.0f;
- p_pathVec->z = 0.0f;
+ vec->x = 0.0f;
+ vec->y = 0.0f;
+ vec->z = 0.0f;
*param_2 = 0;
- if (roomId == -1) {
+ if (room_no == -1) {
return 0;
}
- dPath* path = dPath_GetRoomPath(roomPathId, roomId);
+ dPath* path = dPath_GetRoomPath(path_idx, room_no);
if (path == NULL) {
return 0;
}
- if (path->field_0x6 != 0xFF && dComIfGs_isSwitch(path->field_0x6, roomId)) {
+ if (path->swbit != 0xFF && dComIfGs_isSwitch(path->swbit, room_no)) {
return 0;
}
- int pnt_no = dComIfG_Bgsp().GetRoomPathPntNo(poly);
+ int pnt_no = dComIfG_Bgsp().GetRoomPathPntNo(polyinfo);
if (pnt_no == 0xFF || pnt_no < 0 || pnt_no >= path->m_num) {
return 0;
}
- dPnt* pnt_start = path->m_points;
- dPnt* pnt_end = &pnt_start[pnt_no];
+ dPnt* pnt_end = &path->m_points[pnt_no];
dPnt* pnt_begin;
if (pnt_no == path->m_num - 1) {
- pnt_begin = pnt_start;
+ pnt_begin = path->m_points;
} else {
- pnt_begin = &pnt_start[pnt_no + 1];
+ pnt_begin = &path->m_points[pnt_no + 1];
}
- p_pathVec->x = pnt_begin->m_position.x - pnt_end->m_position.x;
- p_pathVec->y = pnt_begin->m_position.y - pnt_end->m_position.y;
- p_pathVec->z = pnt_begin->m_position.z - pnt_end->m_position.z;
+ vec->x = pnt_begin->m_position.x - pnt_end->m_position.x;
+ vec->y = pnt_begin->m_position.y - pnt_end->m_position.y;
+ vec->z = pnt_begin->m_position.z - pnt_end->m_position.z;
*param_2 = path->field_0x4;
return 1;
}
+#if DEBUG
+dPath_HIO::~dPath_HIO() {}
+
+static dPath_HIO s_hio;
+#endif
+
#if VERSION == VERSION_SHIELD_DEBUG
void dPath_Ct() {
#if DEBUG
+ s_hio.Ct();
+ s_hio.id = mDoHIO_CREATE_CHILD("レール", &s_hio);
#endif
}
void dPath_Dt() {
- #if DEBUG
- #endif
+ mDoHIO_DELETE_CHILD(s_hio.id);
}
void dPath_Move() {}
void dPath_Draw() {
#if DEBUG
+ if (s_hio.ChkDispLine()) {
+ static int start_counter;
+ int counter = start_counter / 20;
+ dStage_dPath_c* pd;
+
+ int hio_roomNo = s_hio.GetRoomNo();
+ if (hio_roomNo == -3) {
+ int roomNo = dComIfGp_roomControl_getStayNo();
+ dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(roomNo);
+ if (roomDt == NULL) {
+ return;
+ }
+
+ pd = roomDt->getPath2Inf();
+ } else if (hio_roomNo == -2) {
+ pd = dComIfGp_getStage()->getPathInf();
+ } else if (hio_roomNo == -1) {
+ pd = dComIfGp_getStage()->getPath2Inf();
+ } else {
+ dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(hio_roomNo);
+ if (roomDt == NULL) {
+ return;
+ }
+
+ pd = roomDt->getPath2Inf();
+ }
+
+ if (pd != NULL) {
+ dPath* path = pd->m_path;
+ for (int i = 0; i < pd->num; i++) {
+ if (path->m_num >= 1) {
+ dPnt* pnt = path->m_points;
+ cXyz start_pos;
+ cXyz end_pos;
+
+ for (int j = 0; j < path->m_num - 1; j++) {
+ start_pos.set(pnt[0].m_position);
+ end_pos.set(pnt[1].m_position);
+
+ if (counter == 0) {
+ dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0xFF, 0xFF, 0xFF}, TRUE, 12);
+ } else {
+ dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0, 0, 0xFF}, TRUE, 12);
+ }
+
+ counter++;
+ if (counter >= 8) {
+ counter = 0;
+ }
+
+ pnt++;
+ }
+
+ if (dPath_ChkClose(path)) {
+ start_pos.set(pnt[0].m_position);
+ end_pos.set(path[1].m_points->m_position);
+
+ if (counter == 0) {
+ dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0xFF, 0xFF, 0xFF}, TRUE, 12);
+ } else {
+ dDbVw_drawLineOpa(start_pos, end_pos, (GXColor){0xFF, 0, 0, 0xFF}, TRUE, 12);
+ }
+
+ counter++;
+ if (counter >= 8) {
+ counter = 0;
+ }
+ }
+ }
+
+ path++;
+ }
+ }
+
+ start_counter--;
+ if (start_counter < 0) {
+ start_counter = 160;
+ }
+ }
#endif
}
+
+static void dummy() {
+ cXyz pos;
+ GXColor color;
+ dDbVw_drawSphereOpa(pos, 0.0f, color, 0);
+}
#endif