mirror of
https://github.com/zeldaret/tp
synced 2026-06-10 04:54:14 -04:00
d_jnt_col debug (#3088)
This commit is contained in:
@@ -5,17 +5,286 @@
|
||||
#include "d/dolzel.h" // IWYU pragma: keep
|
||||
|
||||
#include "d/d_jnt_col.h"
|
||||
#include "JSystem/JHostIO/JORFile.h"
|
||||
#include "JSystem/JHostIO/JORServer.h"
|
||||
#include "SSystem/SComponent/c_math.h"
|
||||
#include "SSystem/SComponent/c_m3d_g_sph.h"
|
||||
#include "SSystem/SComponent/c_m3d_g_cyl.h"
|
||||
#include "d/d_debug_viewer.h"
|
||||
#include "f_op/f_op_actor_mng.h"
|
||||
|
||||
#if DEBUG
|
||||
dJntCol_HIO_c l_HIO;
|
||||
|
||||
Vec l_debugTmpPos[] = {
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 50.0f, 0.0f},
|
||||
};
|
||||
|
||||
dJntColData_c l_debugColData[32] = {
|
||||
{1, 0, 0, 50.0f, &l_debugTmpPos[0]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[2]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[4]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[6]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[8]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[10]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[12]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[14]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[16]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[18]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[20]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[22]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[24]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[26]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[28]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[30]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[32]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[34]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[36]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[38]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[40]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[42]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[44]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[46]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[48]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[50]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[52]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[54]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[56]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[58]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[60]},
|
||||
{1, 0, -1, 50.0f, &l_debugTmpPos[62]},
|
||||
};
|
||||
|
||||
void dJntCol_HIO_c::genMessage(JORMContext* mctx) {
|
||||
mctx->genButton("ファイルに保存", 0x4000001);
|
||||
mctx->genCheckBox("デバッグ表示", &field_0x5, 1);
|
||||
mctx->genSliderID("テーブル番号", 0x4000002, 0, 0, 0x1f);
|
||||
mctx->startComboBoxID("形", 0x4000003, field_0xc->field_0x0, 0, NULL, 0xffff, 0xffff, 0x100, 0x1a);
|
||||
mctx->genComboBoxItem("球", 0);
|
||||
mctx->genComboBoxItem("円柱", 1);
|
||||
mctx->genComboBoxItem("円盤", 2);
|
||||
mctx->endComboBox();
|
||||
mctx->startComboBoxID("矢属性", 0x4000004, field_0xc->mType, 0, NULL, 0xffff, 0xffff, 0x100, 0x1a);
|
||||
mctx->genComboBoxItem("消える", 0);
|
||||
mctx->genComboBoxItem("刺さる", 1);
|
||||
mctx->genComboBoxItem("貫通", 2);
|
||||
mctx->genComboBoxItem("跳ね返し", 3);
|
||||
mctx->endComboBox();
|
||||
mctx->genSliderID("ジョイント番号", 0x4000005, field_0xc->mJntNum, -1, 200);
|
||||
mctx->genSliderID("中心X", 0x4000006, field_0xc->field_0x8->x, -10000.0f, 10000.0f);
|
||||
mctx->genSliderID("中心Y", 0x4000007, field_0xc->field_0x8->y, -10000.0f, 10000.0f);
|
||||
mctx->genSliderID("中心Z", 0x4000008, field_0xc->field_0x8->z, -10000.0f, 10000.0f);
|
||||
mctx->genSliderID("次点X", 0x4000009, field_0xc->field_0x8[1].x, -10000.0f, 10000.0f);
|
||||
mctx->genSliderID("次点Y", 0x400000a, field_0xc->field_0x8[1].y, -10000.0f, 10000.0f);
|
||||
mctx->genSliderID("次点Z", 0x400000b, field_0xc->field_0x8[1].z, -10000.0f, 10000.0f);
|
||||
mctx->genSliderID("半径", 0x400000c, field_0xc->field_0x4, 0.009999999776482582f, 1000.0f);
|
||||
}
|
||||
|
||||
void dJntCol_HIO_c::listenPropertyEvent(const JORPropertyEvent* property) {
|
||||
JORReflexible::listenPropertyEvent(property);
|
||||
const JORPropertyEvent* r29 = property;
|
||||
const f32* r30 = (f32*)&property->field_0x18;
|
||||
switch (u32(r29->id)) {
|
||||
case 0x4000003:
|
||||
field_0xc->field_0x0 = property->field_0x18.U32;
|
||||
break;
|
||||
case 0x4000004:
|
||||
field_0xc->mType = property->field_0x18.U32;
|
||||
break;
|
||||
case 0x4000005:
|
||||
field_0xc->mJntNum = property->field_0x18.U32;
|
||||
break;
|
||||
case 0x4000006:
|
||||
field_0xc->field_0x8[0].x = *r30;
|
||||
break;
|
||||
case 0x4000007:
|
||||
field_0xc->field_0x8[0].y = *r30;
|
||||
break;
|
||||
case 0x4000008:
|
||||
field_0xc->field_0x8[0].z = *r30;
|
||||
break;
|
||||
case 0x4000009:
|
||||
field_0xc->field_0x8[1].x = *r30;
|
||||
break;
|
||||
case 0x400000A:
|
||||
field_0xc->field_0x8[1].y = *r30;
|
||||
break;
|
||||
case 0x400000B:
|
||||
field_0xc->field_0x8[1].z = *r30;
|
||||
break;
|
||||
case 0x400000C:
|
||||
field_0xc->field_0x4 = *r30;
|
||||
break;
|
||||
case 0x4000002:
|
||||
field_0xc = &l_debugColData[property->field_0x18.U32];
|
||||
update();
|
||||
break;
|
||||
case 0x4000001:
|
||||
fileOut();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dJntCol_HIO_c::update() {
|
||||
JORMContext* mctx = attachJORMContext(8);
|
||||
mctx->startUpdateNode(this);
|
||||
mctx->updateComboBoxID(2, 0x4000003, field_0xc->field_0x0, 0);
|
||||
mctx->updateComboBoxID(2, 0x4000004, field_0xc->mType, 0);
|
||||
mctx->updateSliderID(2, 0x4000005, field_0xc->mJntNum, 0, 0, 0);
|
||||
mctx->updateSliderID(2, 0x4000006, field_0xc->field_0x8[0].x, 0.0, 0.0, 0);
|
||||
mctx->updateSliderID(2, 0x4000007, field_0xc->field_0x8[0].y, 0.0, 0.0, 0);
|
||||
mctx->updateSliderID(2, 0x4000008, field_0xc->field_0x8[0].z, 0.0, 0.0, 0);
|
||||
mctx->updateSliderID(2, 0x4000009, field_0xc->field_0x8[1].x, 0.0, 0.0, 0);
|
||||
mctx->updateSliderID(2, 0x400000a, field_0xc->field_0x8[1].y, 0.0, 0.0, 0);
|
||||
mctx->updateSliderID(2, 0x400000b, field_0xc->field_0x8[1].z, 0.0, 0.0, 0);
|
||||
mctx->updateSliderID(2, 0x400000c, field_0xc->field_0x4, 0.0, 0.0, 0);
|
||||
mctx->endUpdateNode();
|
||||
releaseJORMContext(mctx);
|
||||
}
|
||||
|
||||
void dJntCol_HIO_c::fileOut() {
|
||||
char* buffer = new(0x20) char[0x10000];
|
||||
if (!buffer) {
|
||||
OSReport("書き込み用領域確保できませんでした\n");
|
||||
return;
|
||||
}
|
||||
buffer[0] = 0;
|
||||
JORFile file;
|
||||
int i;
|
||||
if (file.open(JORFile::EFlags_WRITE | JORFile::EFlags_UNK_0x4, "すべてのファイル(*.*)\0*.*\0", NULL, NULL, NULL)) {
|
||||
for (i = 0; i < ARRAY_SIZE(l_debugColData); i++) {
|
||||
if (l_debugColData[i].mJntNum >= 0) {
|
||||
if (l_debugColData[i].field_0x0 == 0) {
|
||||
sprintf(buffer + strlen(buffer), "static Vec l_jntColPos%d = {\n", i);
|
||||
sprintf(buffer + strlen(buffer), "\t%ff, %ff, %ff,\n};\n", l_debugColData[i].field_0x8->x, l_debugColData[i].field_0x8->y, l_debugColData[i].field_0x8->z);
|
||||
} else {
|
||||
sprintf(buffer + strlen(buffer), "static Vec l_jntColPos%d[2] = {\n", i);
|
||||
sprintf(buffer + strlen(buffer), "\t{%ff, %ff, %ff},\n", l_debugColData[i].field_0x8[0].x, l_debugColData[i].field_0x8[0].y, l_debugColData[i].field_0x8[0].z);
|
||||
sprintf(buffer + strlen(buffer), "\t{%ff, %ff, %ff},\n};\n", l_debugColData[i].field_0x8[1].x, l_debugColData[i].field_0x8[1].y, l_debugColData[i].field_0x8[1].z);
|
||||
}
|
||||
}
|
||||
}
|
||||
sprintf(buffer + strlen(buffer), "static dJntColData_c l_jntColData[] = {\n");
|
||||
for (i = 0; i < ARRAY_SIZE(l_debugColData); i++) {
|
||||
if (l_debugColData[i].mJntNum >= 0) {
|
||||
sprintf(buffer + strlen(buffer), "\t{\n\t\t");
|
||||
if (l_debugColData[i].field_0x0 == 0) {
|
||||
sprintf(buffer + strlen(buffer), "dJntCol_c::SHAPE_SPH_e, ");
|
||||
} else if (l_debugColData[i].field_0x0 == 1) {
|
||||
sprintf(buffer + strlen(buffer), "dJntCol_c::SHAPE_CYL_e, ");
|
||||
} else {
|
||||
sprintf(buffer + strlen(buffer), "dJntCol_c::SHAPE_CIRCLE_e, ");
|
||||
}
|
||||
if (l_debugColData[i].mType == 0) {
|
||||
sprintf(buffer + strlen(buffer), "dJntCol_c::TYPE_NORMAL_e,\n");
|
||||
} else if (l_debugColData[i].mType == 1) {
|
||||
sprintf(buffer + strlen(buffer), "dJntCol_c::TYPE_STOP_e,\n");
|
||||
} else if (l_debugColData[i].mType == 2) {
|
||||
sprintf(buffer + strlen(buffer), "dJntCol_c::TYPE_THROUGH_e,\n");
|
||||
} else {
|
||||
sprintf(buffer + strlen(buffer), "dJntCol_c::TYPE_SHIELD_e,\n");
|
||||
}
|
||||
sprintf(buffer + strlen(buffer), "\t\t%d, %ff, ", l_debugColData[i].mJntNum, l_debugColData[i].field_0x4);
|
||||
if (l_debugColData[i].field_0x0 == 0) {
|
||||
sprintf(buffer + strlen(buffer), "&l_jntColPos%d\n", i);
|
||||
} else {
|
||||
sprintf(buffer + strlen(buffer), "l_jntColPos%d\n", i);
|
||||
}
|
||||
sprintf(buffer + strlen(buffer), "\t},\n");
|
||||
}
|
||||
}
|
||||
sprintf(buffer + strlen(buffer), "};\n");
|
||||
file.writeData(buffer, strlen(buffer));
|
||||
if (strlen(buffer) > 0x10000) {
|
||||
OSReport("メモリ破壊が起こりました!!!!!\n");
|
||||
}
|
||||
file.close();
|
||||
} else {
|
||||
OSReport("書き込みファイルが開けません\n");
|
||||
}
|
||||
delete[] buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
dJntCol_c::dJntCol_c() {
|
||||
mModel = 0;
|
||||
mData = 0;
|
||||
field_0x8 = 0;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
void dJntCol_setDebugHIO() {
|
||||
l_HIO.field_0x4 = mDoHIO_createChild("ジョイントコリジョン", &l_HIO);
|
||||
}
|
||||
|
||||
void dJntCol_deleteDebugHIO() {
|
||||
mDoHIO_deleteChild(l_HIO.field_0x4);
|
||||
}
|
||||
#endif
|
||||
|
||||
int dJntCol_c::init(fopAc_ac_c* i_actorP, dJntColData_c const* i_jntColP, J3DModel* i_modelP,
|
||||
int param_3) {
|
||||
mData = i_jntColP;
|
||||
@@ -283,3 +552,52 @@ void dJntCol_c::setArrowPosAndAngle(cXyz const* param_0, cXyz const* i_srcPos, i
|
||||
i_arrowPosP->y = dst_pos.atan2sX_Z();
|
||||
mDoMtx_multVec(mModel->getAnmMtx(i_anmMtxIdx), param_0, param_3);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
void dJntCol_c::debugDraw() {
|
||||
static const GXColor color = {255, 0, 0, 128};
|
||||
|
||||
if (!l_HIO.field_0x5) {
|
||||
return;
|
||||
}
|
||||
|
||||
const dJntColData_c* r30 = mData;
|
||||
cXyz local_b4;
|
||||
cXyz local_c0;
|
||||
cXyz local_cc;
|
||||
for (int i = 0; i < field_0x8; i++, r30++) {
|
||||
if (field_0xc & 1 << i) {
|
||||
continue;
|
||||
}
|
||||
if (r30->mJntNum < 0) {
|
||||
continue;
|
||||
}
|
||||
mDoMtx_stack_c::copy(mModel->getAnmMtx(r30->mJntNum));
|
||||
mDoMtx_stack_c::multVec(r30->field_0x8, &local_b4);
|
||||
if (r30->field_0x0 == 0) {
|
||||
dDbVw_drawSphereXlu(local_b4, r30->field_0x4, color, 1);
|
||||
continue;
|
||||
} else if (r30->field_0x0 == 1) {
|
||||
mDoMtx_stack_c::multVec(&r30->field_0x8[1], &local_c0);
|
||||
} else {
|
||||
mDoMtx_stack_c::multVecSR(&r30->field_0x8[1], &local_c0);
|
||||
local_c0.normalizeZP();
|
||||
local_c0 += local_b4;
|
||||
}
|
||||
local_cc = local_c0 - local_b4;
|
||||
Mtx local_48;
|
||||
Mtx local_78;
|
||||
Mtx local_a8;
|
||||
cMtx_trans(local_78, local_b4.x, local_b4.y, local_b4.z);
|
||||
cM3d_UpMtx(local_cc, local_a8);
|
||||
cMtx_concat(local_78, local_a8, local_48);
|
||||
cMtx_scale(local_78, r30->field_0x4, local_cc.abs() * 0.5f, r30->field_0x4);
|
||||
cMtx_concat(local_48, local_78, local_48);
|
||||
cMtx_trans(local_78, 0.0f, 1.0f, 0.0f);
|
||||
cMtx_concat(local_48, local_78, local_48);
|
||||
cMtx_XrotS(local_78, 0x4000);
|
||||
cMtx_concat(local_48, local_78, local_48);
|
||||
dDbVw_drawCylinderMXlu(local_48, color, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user