mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-30 08:51:47 -04:00
Debug build improvements (#1170)
This commit is contained in:
@@ -2284,6 +2284,14 @@ int cM3d_UpMtx_Base(const Vec& param_0, const Vec& param_1, Mtx m) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static Vec base_y = {0.0f, 1.0f, 0.0f};
|
||||
|
||||
bool cM3d_UpMtx(const Vec& param_1, Mtx param_2) {
|
||||
return cM3d_UpMtx_Base(base_y, param_1, param_2);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 8025172C-80251758 .text cM3d_PlaneCrossLineProcWork__FfffffffPfPf */
|
||||
void cM3d_PlaneCrossLineProcWork(f32 v0, f32 v1, f32 v2, f32 v3, f32 v4, f32 v5, f32 v6, f32* p0, f32* p1) {
|
||||
*p0 = (v1 * v6 - v3 * v5) / v4;
|
||||
|
||||
@@ -189,10 +189,11 @@ bool daObj_Canon_c::checkTgHit() {
|
||||
}
|
||||
|
||||
if(cLib_calcTimer(&field_0x440) == 0) {
|
||||
cXyz hitPos;
|
||||
CcAtInfo atInfo;
|
||||
atInfo.pParticlePos = NULL;
|
||||
cCcD_Obj* tg = mSph.GetTgHitObj();
|
||||
cXyz hitPos = *mSph.GetTgHitPosP();
|
||||
hitPos = *mSph.GetTgHitPosP();
|
||||
atInfo.mpObj = mSph.GetTgHitObj();
|
||||
if (tg == NULL) {
|
||||
return false;
|
||||
@@ -335,7 +336,7 @@ void daObj_Canon_c::modeWait() {
|
||||
temp += tmp;
|
||||
}
|
||||
|
||||
s16 temp2 = fopAcM_searchActorAngleY(this, daPy_getPlayerActorClass());
|
||||
s16 temp2 = fopAcM_searchPlayerAngleY(this);
|
||||
|
||||
field_0x2CC.x -= temp * cM_ssin(temp2);
|
||||
field_0x2CC.z -= temp * cM_scos(temp2);
|
||||
@@ -384,7 +385,7 @@ void daObj_Canon_c::modeDeleteInit() {
|
||||
setEffect(dPa_name::ID_IT_SN_MJTAIHOU_SENKO00);
|
||||
setEffect(dPa_name::ID_IT_JN_MJTAIHOU_SMOKE01);
|
||||
|
||||
fopAcM_OffStatus(this, fopAcStts_SHOWMAP_e | 0x1F);
|
||||
fopAcM_ClearStatusMap(this);
|
||||
}
|
||||
|
||||
/* 00001174-00001178 .text modeDelete__13daObj_Canon_cFv */
|
||||
@@ -395,7 +396,7 @@ void daObj_Canon_c::modeDelete() {
|
||||
/* 00001178-00001194 .text modeSwWaitInit__13daObj_Canon_cFv */
|
||||
void daObj_Canon_c::modeSwWaitInit() {
|
||||
field_0x46C = 120.0f;
|
||||
fopAcM_OffStatus(this, fopAcStts_SHOWMAP_e | 0x1F);
|
||||
fopAcM_ClearStatusMap(this);
|
||||
}
|
||||
|
||||
/* 00001194-000011F4 .text modeSwWait__13daObj_Canon_cFv */
|
||||
@@ -485,12 +486,12 @@ bool daObj_Canon_c::_execute() {
|
||||
temp.x = l_HIO.field_0x14;
|
||||
temp.y = l_HIO.field_0x18 * scale.x;
|
||||
temp.z = l_HIO.field_0x1C;
|
||||
mDoMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp, &field_0x450);
|
||||
cMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp, &field_0x450);
|
||||
Vec temp2 = {0.0f, 0.0f, 0.0f};
|
||||
temp2.x = REG12_F(0);
|
||||
temp2.y = (REG12_F(1) + 60.0f) * scale.x;
|
||||
temp2.z = REG12_F(2);
|
||||
mDoMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp2, &field_0x45C);
|
||||
cMtx_multVec(mpModel->getAnmMtx(WALLBOM_JNT_SHOT_e), &temp2, &field_0x45C);
|
||||
|
||||
if(field_0x470.getEmitter()) {
|
||||
if(cLib_calcTimer(&field_0x484) == 0) {
|
||||
|
||||
@@ -110,7 +110,7 @@ BOOL daObjJump::Act_c::Create() {
|
||||
}
|
||||
#if VERSION > VERSION_DEMO
|
||||
if (mType == Type_SPRING_ON_BOX_e) {
|
||||
actor_status &= ~0x3F;
|
||||
fopAcM_ClearStatusMap(this);
|
||||
gbaName = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+55
-6
@@ -4,9 +4,11 @@
|
||||
//
|
||||
|
||||
#include "d/d_cc_d.h"
|
||||
#include "d/d_debug_viewer.h"
|
||||
#include "f_op/f_op_actor_mng.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
|
||||
/* 800AB2AC-800AB328 .text GetAc__22dCcD_GAtTgCoCommonBaseFv */
|
||||
fopAc_ac_c* dCcD_GAtTgCoCommonBase::GetAc() {
|
||||
@@ -273,17 +275,58 @@ void dCcD_Cps::Set(const dCcD_SrcCps& src) {
|
||||
cCcD_CpsAttr::Set(src.mCpsAttr);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void dCcD_Cps::Draw(const GXColor& color) {
|
||||
Mtx auStack_68;
|
||||
Mtx auStack_98;
|
||||
Mtx auStack_c8;
|
||||
|
||||
MTXIdentity(auStack_68);
|
||||
|
||||
cXyz cStack_d8;
|
||||
CalcVec(&cStack_d8);
|
||||
cMtx_trans(auStack_98, GetStartP()->x, GetStartP()->y, GetStartP()->z);
|
||||
cM3d_UpMtx(cStack_d8, auStack_c8);
|
||||
cMtx_concat(auStack_98, auStack_c8, auStack_68);
|
||||
cMtx_scale(auStack_98, GetR(), 0.5f * GetLen(), GetR());
|
||||
cMtx_concat(auStack_68, auStack_98, auStack_68);
|
||||
cMtx_trans(auStack_98, 0.0f, 1.0f, 0.0f);
|
||||
cMtx_concat(auStack_68, auStack_98, auStack_68);
|
||||
cMtx_XrotS(auStack_98, 0x4000);
|
||||
cMtx_concat(auStack_68, auStack_98, auStack_68);
|
||||
dDbVw_drawCylinderMXlu(auStack_68, color, 1);
|
||||
dDbVw_drawSphereXlu(*GetStartP(), GetR(), color, 1);
|
||||
dDbVw_drawSphereXlu(*GetEndP(), GetR(), color, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 800ABD34-800ABD54 .text Set__8dCcD_TriFRC11dCcD_SrcTri */
|
||||
void dCcD_Tri::Set(const dCcD_SrcTri& src) {
|
||||
dCcD_GObjInf::Set(src.mObjInf);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
void dCcD_Tri::Draw(const GXColor& color) {
|
||||
cXyz cStack_34[3];
|
||||
cStack_34[0] = mA;
|
||||
cStack_34[1] = mB;
|
||||
cStack_34[2] = mC;
|
||||
dDbVw_drawTriangleXlu(cStack_34, color, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 800ABD54-800ABDCC .text Set__8dCcD_CylFRC11dCcD_SrcCyl */
|
||||
void dCcD_Cyl::Set(const dCcD_SrcCyl& src) {
|
||||
dCcD_GObjInf::Set(src.mObjInf);
|
||||
cCcD_CylAttr::Set(src.mCylAttr);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
void dCcD_Cyl::Draw(const GXColor& color) {
|
||||
dDbVw_drawCylinderXlu(*GetCP(), GetR(), GetH(), color, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 800ABDCC-800ABE18 .text StartCAt__8dCcD_CylFR4cXyz */
|
||||
void dCcD_Cyl::StartCAt(cXyz& pos) {
|
||||
cXyz vel = cXyz::Zero;
|
||||
@@ -300,8 +343,8 @@ void dCcD_Cyl::StartCTg(cXyz& pos) {
|
||||
|
||||
/* 800ABE64-800ABEE0 .text MoveCAtTg__8dCcD_CylFR4cXyz */
|
||||
void dCcD_Cyl::MoveCAtTg(cXyz& pos) {
|
||||
cXyz& center = GetC();
|
||||
cXyz vel = pos - center;
|
||||
const cXyz* center = GetCP();
|
||||
cXyz vel = pos - *center;
|
||||
SetAtVec(vel);
|
||||
SetTgVec(vel);
|
||||
SetC(pos);
|
||||
@@ -309,16 +352,16 @@ void dCcD_Cyl::MoveCAtTg(cXyz& pos) {
|
||||
|
||||
/* 800ABEE0-800ABF50 .text MoveCAt__8dCcD_CylFR4cXyz */
|
||||
void dCcD_Cyl::MoveCAt(cXyz& pos) {
|
||||
cXyz& center = GetC();
|
||||
cXyz vel = pos - center;
|
||||
const cXyz* center = GetCP();
|
||||
cXyz vel = pos - *center;
|
||||
SetAtVec(vel);
|
||||
SetC(pos);
|
||||
}
|
||||
|
||||
/* 800ABF50-800ABFC0 .text MoveCTg__8dCcD_CylFR4cXyz */
|
||||
void dCcD_Cyl::MoveCTg(cXyz& pos) {
|
||||
cXyz& center = GetC();
|
||||
cXyz vel = pos - center;
|
||||
const cXyz* center = GetCP();
|
||||
cXyz vel = pos - *center;
|
||||
SetTgVec(vel);
|
||||
SetC(pos);
|
||||
}
|
||||
@@ -329,6 +372,12 @@ void dCcD_Sph::Set(const dCcD_SrcSph& src) {
|
||||
cCcD_SphAttr::Set(src.mSphAttr);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void dCcD_Sph::Draw(const GXColor& color) {
|
||||
dDbVw_drawSphereXlu(*GetCP(), GetR(), color, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 800AC02C-800AC078 .text StartCAt__8dCcD_SphFR4cXyz */
|
||||
void dCcD_Sph::StartCAt(cXyz& pos) {
|
||||
cXyz atVec = cXyz::Zero;
|
||||
|
||||
+125
-1
@@ -6,6 +6,67 @@
|
||||
#include "d/d_cc_s.h"
|
||||
#include "d/d_cc_d.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "m_Do/m_Do_hostIO.h"
|
||||
|
||||
#if DEBUG
|
||||
class dCcS_HIO : public JORReflexible {
|
||||
public:
|
||||
enum flags_e {
|
||||
FLAG_CAM_COL_DISP_e = 0x1, // TP only?
|
||||
FLAG_AT_ON_e = 0x2,
|
||||
FLAG_TG_ON_e = 0x4,
|
||||
FLAG_CO_ON_e = 0x8,
|
||||
FLAG_DRAW_CLEAR_OFF_e = 0x10,
|
||||
FLAG_COUNTER_e = 0x20,
|
||||
FLAG_MOVE_OFF_e = 0x40,
|
||||
FLAG_MASS_OFF_e = 0x80,
|
||||
FLAG_MOVE_TIMER_e = 0x100,
|
||||
FLAG_MASS_TIMER_e = 0x200,
|
||||
FLAG_MASS_COUNTER_e = 0x400,
|
||||
FLAG_ALL_MASS_TIMER_e = 0x800,
|
||||
};
|
||||
|
||||
dCcS_HIO() {
|
||||
m_flags = 0;
|
||||
m_shield_range = 0x4000;
|
||||
}
|
||||
|
||||
virtual ~dCcS_HIO();
|
||||
|
||||
void genMessage(JORMContext*);
|
||||
|
||||
BOOL ChkMoveTimer() { return m_flags & FLAG_MOVE_TIMER_e; }
|
||||
BOOL ChkMoveOff() { return m_flags & FLAG_MOVE_OFF_e; }
|
||||
BOOL ChkAllMassTimer() { return m_flags & FLAG_ALL_MASS_TIMER_e; }
|
||||
BOOL ChkDrawClearOff() { return m_flags & FLAG_DRAW_CLEAR_OFF_e; }
|
||||
BOOL ChkCounter() { return m_flags & FLAG_COUNTER_e; }
|
||||
BOOL CheckCoOn() { return m_flags & FLAG_CO_ON_e; }
|
||||
BOOL CheckTgOn() { return m_flags & FLAG_TG_ON_e; }
|
||||
BOOL CheckAtOn() { return m_flags & FLAG_AT_ON_e; }
|
||||
BOOL ChkMassCounter() { return m_flags & FLAG_MASS_COUNTER_e; }
|
||||
BOOL ChkMassOff() { return m_flags & FLAG_MASS_OFF_e; }
|
||||
BOOL ChkMassTimer() { return m_flags & FLAG_MASS_TIMER_e; }
|
||||
|
||||
s16 GetShFrontRange() { return m_shield_range; }
|
||||
|
||||
/* 0x4 */ s8 id;
|
||||
/* 0x6 */ u16 m_flags;
|
||||
/* 0x8 */ s16 m_shield_range;
|
||||
};
|
||||
|
||||
dCcS_HIO::~dCcS_HIO() {}
|
||||
|
||||
void dCcS_HIO::genMessage(JORMContext* mctx) {
|
||||
UNUSED(mctx);
|
||||
}
|
||||
|
||||
static OSStopwatch s_move_timer;
|
||||
static OSStopwatch s_mass_timer;
|
||||
|
||||
static dCcS_HIO s_Hio;
|
||||
|
||||
int g_mass_counter;
|
||||
#endif
|
||||
|
||||
/* 800AD5B0-800AD5E4 .text Ct__4dCcSFv */
|
||||
void dCcS::Ct() {
|
||||
@@ -460,8 +521,71 @@ void dCcS::Move() {
|
||||
|
||||
/* 800AE83C-800AE878 .text Draw__4dCcSFv */
|
||||
void dCcS::Draw() {
|
||||
#if DEBUG
|
||||
if (s_Hio.ChkMassCounter()) {
|
||||
OSReport("Mass Counter %d\n", g_mass_counter);
|
||||
g_mass_counter = 0;
|
||||
}
|
||||
|
||||
if (s_Hio.CheckAtOn()) {
|
||||
for (int i = 0; i < mObjAtDrawCount; i++) {
|
||||
if (mpObjAt[i] != NULL && mpObjAt[i]->ChkAtSet()) {
|
||||
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjAt[i]->GetGObjInf();
|
||||
if (gobj->ChkAtHit()) {
|
||||
GXColor color = {0xFF, 0, 0, 0xB4};
|
||||
mpObjAt[i]->Draw(color);
|
||||
} else {
|
||||
GXColor color = {0xFF, 0, 0, 0x50};
|
||||
mpObjAt[i]->Draw(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s_Hio.CheckTgOn()) {
|
||||
for (int i = 0; i < mObjTgDrawCount; i++) {
|
||||
if (mpObjTg[i] != NULL && mpObjTg[i]->ChkTgSet()) {
|
||||
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjTg[i]->GetGObjInf();
|
||||
if (gobj->ChkTgHit()) {
|
||||
GXColor color = {0, 0xFF, 0, 0xB4};
|
||||
mpObjTg[i]->Draw(color);
|
||||
} else {
|
||||
GXColor color = {0, 0xFF, 0, 0x50};
|
||||
mpObjTg[i]->Draw(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s_Hio.CheckCoOn()) {
|
||||
for (int i = 0; i < mObjCoDrawCount; i++) {
|
||||
if (mpObjCo[i] != NULL && mpObjCo[i]->ChkCoSet()) {
|
||||
dCcD_GObjInf* gobj = (dCcD_GObjInf*)mpObjCo[i]->GetGObjInf();
|
||||
if (gobj->ChkCoHit()) {
|
||||
GXColor color = {0xFF, 0xFF, 0xFF, 0xB4};
|
||||
mpObjCo[i]->Draw(color);
|
||||
} else {
|
||||
GXColor color = {0xFF, 0xFF, 0xFF, 0x50};
|
||||
mpObjCo[i]->Draw(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s_Hio.ChkCounter()) {
|
||||
OSReport("At:%d,Tg:%d,Co:%d\n", mObjAtDrawCount, mObjTgDrawCount, mObjCoDrawCount);
|
||||
}
|
||||
#endif
|
||||
|
||||
DrawAfter();
|
||||
DrawClear();
|
||||
|
||||
#if DEBUG
|
||||
if (!s_Hio.ChkDrawClearOff())
|
||||
#endif
|
||||
{
|
||||
DrawClear();
|
||||
}
|
||||
|
||||
mMass_Mng.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
// Debug-only file. This file is known to have existed for TWW based on the debug maps.
|
||||
// The contents of this are copied from the TP debug build decomp and may or may not match the actual TWW debug build.
|
||||
|
||||
#include "d/d_debug_pad.h"
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
#include "JSystem/JUtility/JUTDbPrint.h"
|
||||
#include "JSystem/JUtility/JUTReport.h"
|
||||
#include "f_ap/f_ap_game.h"
|
||||
#include "stdio.h"
|
||||
#include "stdarg.h"
|
||||
|
||||
dDebugPad_c::dDebugPad_c() {
|
||||
mIsActive = false;
|
||||
mMode = MODE_CAMERA_e;
|
||||
mTrigger = false;
|
||||
}
|
||||
|
||||
const char dDebugPad_c::mode_name[MODE_MAX_e][9] = {
|
||||
"CAMERA",
|
||||
"BsLight",
|
||||
"WindTest",
|
||||
"SDCARD",
|
||||
};
|
||||
|
||||
bool dDebugPad_c::Update() {
|
||||
mTrigger = false;
|
||||
|
||||
if (CPad_CHECK_TRIG_START(PAD_3)) {
|
||||
mIsActive = mIsActive ? false : true;
|
||||
mTrigger = true;
|
||||
}
|
||||
|
||||
if (mIsActive) {
|
||||
if (CPad_CHECK_TRIG_Z(PAD_3)) {
|
||||
mMode = (mMode + 1) % MODE_MAX_e;
|
||||
}
|
||||
|
||||
int x = 10;
|
||||
int y = 40;
|
||||
int line_height = 15;
|
||||
JUtility::TColor sp40(0xC8, 0x80, 0xFF, 0xC0);
|
||||
JUtility::TColor sp3C(0xFF, 0xC0, 0xC0, 0xFF);
|
||||
|
||||
Report(x, y, sp40, "+-DEBUG-PAD-+");
|
||||
|
||||
int i;
|
||||
for (i = 0; i < MODE_MAX_e; i++) {
|
||||
y += line_height;
|
||||
|
||||
if (i == mMode) {
|
||||
Report(x, y, sp40, "| |");
|
||||
Report(x, y, sp3C, " @%-8s ", mode_name[i]);
|
||||
} else {
|
||||
Report(x, y, sp40, "| %-8s |", mode_name[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 1; i++) {
|
||||
y += line_height;
|
||||
Report(x, y, sp40, "| |");
|
||||
}
|
||||
|
||||
y += line_height;
|
||||
Report(x, y, sp40, "+-----------+");
|
||||
}
|
||||
|
||||
return mIsActive;
|
||||
}
|
||||
|
||||
bool dDebugPad_c::Report(int x, int y, JUtility::TColor color, const char* message, ...) {
|
||||
char buffer[256];
|
||||
|
||||
static JUtility::TColor ShadowDarkColor(0, 0, 0, 0x80);
|
||||
|
||||
if (mIsActive) {
|
||||
va_list list;
|
||||
va_start(list, message);
|
||||
vsnprintf(buffer, sizeof(buffer), message, list);
|
||||
va_end(list);
|
||||
|
||||
JUTDbPrint::getManager()->flush();
|
||||
JUTDbPrint::getManager()->setCharColor(ShadowDarkColor);
|
||||
JUTReport(x + 2, y + 2, buffer);
|
||||
JUTDbPrint::getManager()->flush();
|
||||
JUTDbPrint::getManager()->setCharColor(color);
|
||||
JUTReport(x, y, buffer);
|
||||
JUTDbPrint::getManager()->flush();
|
||||
JUTDbPrint::getManager()->setCharColor(g_HIO.mColor);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
dDebugPad_c dDebugPad;
|
||||
@@ -0,0 +1,156 @@
|
||||
// Debug-only file. This file is known to have existed for TWW based on the debug maps.
|
||||
// The contents of this are copied from the TP debug build decomp and may or may not match the actual TWW debug build.
|
||||
|
||||
#include "d/dolzel.h" // IWYU pragma: keep
|
||||
|
||||
#include "d/d_debug_viewer.h"
|
||||
#include "d/d_debug_pad.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "f_ap/f_ap_game.h"
|
||||
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
|
||||
#include "JSystem/JUtility/JUTDbPrint.h"
|
||||
#include "JSystem/JUtility/JUTReport.h"
|
||||
#include "stdio.h"
|
||||
|
||||
J3DPacket* l_drawPacketList[1000];
|
||||
int l_drawPacketListNum;
|
||||
|
||||
J3DPacket* dDbVw_setDrawPacketList(J3DPacket* i_packet, int i_bufferType) {
|
||||
if (i_packet == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (l_drawPacketListNum >= 1000) {
|
||||
delete (void*)i_packet;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
l_drawPacketList[l_drawPacketListNum++] = i_packet;
|
||||
j3dSys.getDrawBuffer(i_bufferType)->entryImm(i_packet, 0);
|
||||
return i_packet;
|
||||
}
|
||||
|
||||
void dDbVw_deleteDrawPacketList() {
|
||||
for (int i = 0; i < l_drawPacketListNum; i++) {
|
||||
delete (void*)l_drawPacketList[i];
|
||||
}
|
||||
|
||||
l_drawPacketListNum = 0;
|
||||
}
|
||||
|
||||
void dDbVw_drawCube8p(int i_bufferType, cXyz* i_points, const GXColor& i_color) {
|
||||
mDoExt_cube8pPacket* packet = new mDoExt_cube8pPacket(i_points, i_color);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawCube(int i_bufferType, cXyz& i_pos, cXyz& i_size, csXyz& i_angle, const GXColor& i_color) {
|
||||
mDoExt_cubePacket* packet = new mDoExt_cubePacket(i_pos, i_size, i_angle, i_color);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawTriangle(int i_bufferType, cXyz* i_points, const GXColor& i_color, u8 i_clipZ) {
|
||||
mDoExt_trianglePacket* packet = new mDoExt_trianglePacket(i_points, i_color, i_clipZ);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawQuad(int i_bufferType, cXyz* i_points, const GXColor& i_color, u8 i_clipZ) {
|
||||
mDoExt_quadPacket* packet = new mDoExt_quadPacket(i_points, i_color, i_clipZ);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawQuad(int i_bufferType, cXyz* param_1, cXyz* param_2, cXyz* i_pos, s16 i_rotY, const GXColor& i_color, u8 i_clipZ) {
|
||||
cXyz points[4];
|
||||
|
||||
points[0] = *param_1;
|
||||
points[2] = *param_2;
|
||||
|
||||
points[1].x = param_2->x;
|
||||
points[1].y = param_1->y;
|
||||
points[1].z = param_1->z;
|
||||
|
||||
points[3].x = param_1->x;
|
||||
points[3].y = param_1->y;
|
||||
points[3].z = param_2->z;
|
||||
|
||||
mDoMtx_stack_c::transS(*i_pos);
|
||||
mDoMtx_stack_c::YrotM(i_rotY);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mDoMtx_stack_c::multVec(&points[i], &points[i]);
|
||||
}
|
||||
|
||||
mDoExt_quadPacket* packet = new mDoExt_quadPacket(points, i_color, i_clipZ);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawLine(int i_bufferType, cXyz& i_start, cXyz& i_end, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
|
||||
mDoExt_linePacket* packet = new mDoExt_linePacket(i_start, i_end, i_color, i_clipZ, i_width);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawArrow(int i_bufferType, cXyz& i_pos, cXyz& param_2, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
|
||||
mDoExt_ArrowPacket* packet = new mDoExt_ArrowPacket(i_pos, param_2, i_color, i_clipZ, i_width);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawPoint(int i_bufferType, cXyz& i_pos, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
|
||||
mDoExt_pointPacket* packet = new mDoExt_pointPacket(i_pos, i_color, i_clipZ, i_width);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawCircle(int i_bufferType, cXyz& i_pos, f32 i_radius, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
|
||||
mDoExt_circlePacket* packet = new mDoExt_circlePacket(i_pos, i_radius, i_color, i_clipZ, i_width);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawSphere(int i_bufferType, cXyz& i_pos, f32 i_size, const GXColor& i_color, u8 i_clipZ) {
|
||||
mDoExt_spherePacket* packet = new mDoExt_spherePacket(i_pos, i_size, i_color, i_clipZ);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawCylinder(int i_bufferType, cXyz& i_pos, f32 i_radius, f32 i_height, const GXColor& i_color, u8 i_clipZ) {
|
||||
mDoExt_cylinderPacket* packet = new mDoExt_cylinderPacket(i_pos, i_radius, i_height, i_color, i_clipZ);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
void dDbVw_drawCylinderM(int i_bufferType, Mtx i_mtx, const GXColor& i_color, u8 i_clipZ) {
|
||||
mDoExt_cylinderMPacket* packet = new mDoExt_cylinderMPacket(i_mtx, i_color, i_clipZ);
|
||||
dDbVw_setDrawPacketList(packet, i_bufferType);
|
||||
}
|
||||
|
||||
static bool reportOK() {
|
||||
return !dComIfG_isDebugMode() && !dDebugPad.Active();
|
||||
}
|
||||
|
||||
static JUtility::TColor ShadowDarkColor(0, 0, 0, 0x80);
|
||||
static JUtility::TColor ShadowLightColor(0xFF, 0xFF, 0xFF, 0x80);
|
||||
|
||||
int dDbVw_Report(int x, int y, char const* string, ...) {
|
||||
UNUSED(string);
|
||||
char buffer[256];
|
||||
|
||||
if (reportOK()) {
|
||||
va_list list;
|
||||
va_start(list, string);
|
||||
vsnprintf(buffer, sizeof(buffer), string, list);
|
||||
va_end(list);
|
||||
|
||||
JUTDbPrint::getManager()->flush();
|
||||
|
||||
if (g_HIO.mColor & 0xF0F0F000) {
|
||||
JUTDbPrint::getManager()->setCharColor(ShadowDarkColor);
|
||||
} else {
|
||||
JUTDbPrint::getManager()->setCharColor(ShadowLightColor);
|
||||
}
|
||||
|
||||
JUTReport(x + 2, y + 2, buffer);
|
||||
JUTDbPrint::getManager()->flush();
|
||||
|
||||
JUTDbPrint::getManager()->setCharColor(g_HIO.mColor);
|
||||
JUTReport(x, y, buffer);
|
||||
JUTDbPrint::getManager()->flush();
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -70,3 +70,51 @@ void GXDrawCylinder(u8 numEdges) {
|
||||
|
||||
RestoreVertState();
|
||||
}
|
||||
|
||||
void GXDrawSphere(u8 numMajor, u8 numMinor) {
|
||||
GXAttrType ttype;
|
||||
f32 radius = 1.0f;
|
||||
f32 majorStep = 3.1415927f / numMajor;
|
||||
f32 minorStep = 6.2831855f / numMinor;
|
||||
s32 i, j;
|
||||
f32 a, b;
|
||||
f32 r0, r1;
|
||||
f32 z0, z1;
|
||||
f32 c;
|
||||
|
||||
GXGetVtxDesc(GX_VA_TEX0, &ttype);
|
||||
GetVertState();
|
||||
|
||||
if (ttype != GX_NONE) {
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT3, GX_VA_TEX0, GX_TEX_ST, GX_RGBA6, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < numMajor; i++) {
|
||||
a = i * majorStep;
|
||||
b = a + majorStep;
|
||||
r0 = radius * sinf(a);
|
||||
r1 = radius * sinf(b);
|
||||
z0 = radius * cosf(a);
|
||||
z1 = radius * cosf(b);
|
||||
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT3, (numMinor + 1) * 2);
|
||||
for (j = 0; j <= numMinor; j++) {
|
||||
f32 x, y;
|
||||
c = j * minorStep;
|
||||
x = cosf(c);
|
||||
y = sinf(c);
|
||||
GXPosition3f32(x * r1, y * r1, z1);
|
||||
GXNormal3f32((x * r1) / radius, (y * r1) / radius, z1 / radius);
|
||||
if (ttype != GX_NONE) {
|
||||
GXTexCoord2f32((f32)j / (f32)numMinor, (f32)(i + 1) / (f32)numMajor);
|
||||
}
|
||||
GXPosition3f32(x * r0, y * r0, z0);
|
||||
GXNormal3f32((x * r0) / radius, (y * r0) / radius, z0 / radius);
|
||||
if (ttype != GX_NONE) {
|
||||
GXTexCoord2f32((f32)j / (f32)numMinor, (f32)i / (f32)numMajor);
|
||||
}
|
||||
}
|
||||
GXEnd();
|
||||
}
|
||||
RestoreVertState();
|
||||
}
|
||||
|
||||
@@ -2540,6 +2540,547 @@ void mDoExt_3DlineMatSortPacket::draw() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
mDoExt_cube8pPacket::mDoExt_cube8pPacket(cXyz* i_points, const GXColor& i_color) {
|
||||
cXyz* pnt_array = mPoints;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
*(pnt_array)++ = *(i_points)++;
|
||||
}
|
||||
|
||||
DCStoreRangeNoSync(mPoints, sizeof(cXyz) * 8);
|
||||
mColor = i_color;
|
||||
}
|
||||
|
||||
void drawCube(MtxP mtx, cXyz* pos, const GXColor& color) {
|
||||
GXSetArray(GX_VA_POS, pos, sizeof(cXyz));
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP,
|
||||
GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, color);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_BACK);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXLoadPosMtxImm(mtx, 0);
|
||||
GXSetCurrentMtx(0);
|
||||
|
||||
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, 14);
|
||||
GXPosition1x8(4);
|
||||
GXPosition1x8(6);
|
||||
GXPosition1x8(5);
|
||||
GXPosition1x8(7);
|
||||
GXPosition1x8(3);
|
||||
GXPosition1x8(6);
|
||||
GXPosition1x8(2);
|
||||
GXPosition1x8(4);
|
||||
GXPosition1x8(0);
|
||||
GXPosition1x8(5);
|
||||
GXPosition1x8(1);
|
||||
GXPosition1x8(3);
|
||||
GXPosition1x8(0);
|
||||
GXPosition1x8(2);
|
||||
GXEnd();
|
||||
}
|
||||
|
||||
void mDoExt_cube8pPacket::draw() {
|
||||
drawCube(j3dSys.getViewMtx(), mPoints, mColor);
|
||||
}
|
||||
|
||||
mDoExt_cubePacket::mDoExt_cubePacket(cXyz& i_position, cXyz& i_size, csXyz& i_angle, const GXColor& i_color) {
|
||||
mPosition = i_position;
|
||||
mSize = i_size;
|
||||
mAngle = i_angle;
|
||||
mColor = i_color;
|
||||
}
|
||||
|
||||
void mDoExt_cubePacket::draw() {
|
||||
static cXyz l_pos[8] = {
|
||||
cXyz(-1.0f, 1.0f, -1.0f), cXyz(1.0f, 1.0f, -1.0f), cXyz(-1.0f, 1.0f, 1.0f),
|
||||
cXyz(1.0f, 1.0f, 1.0f), cXyz(-1.0f, -1.0f, -1.0f), cXyz(1.0f, -1.0f, -1.0f),
|
||||
cXyz(-1.0f, -1.0f, 1.0f), cXyz(1.0f, -1.0f, 1.0f),
|
||||
};
|
||||
|
||||
mDoMtx_stack_c::transS(mPosition.x, mPosition.y, mPosition.z);
|
||||
mDoMtx_stack_c::XYZrotM(mAngle.x, mAngle.y, mAngle.z);
|
||||
mDoMtx_stack_c::scaleM(mSize.x, mSize.y, mSize.z);
|
||||
mDoMtx_stack_c::revConcat(j3dSys.getViewMtx());
|
||||
drawCube(mDoMtx_stack_c::get(), l_pos, mColor);
|
||||
}
|
||||
|
||||
mDoExt_quadPacket::mDoExt_quadPacket(cXyz* i_points, const GXColor& i_color, u8 i_clipZ) {
|
||||
cXyz* pnt_array = mPoints;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
*(pnt_array)++ = *(i_points)++;
|
||||
}
|
||||
|
||||
DCStoreRangeNoSync(mPoints, sizeof(cXyz) * 4);
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
}
|
||||
|
||||
void mDoExt_quadPacket::draw() {
|
||||
GXSetArray(GX_VA_POS, mPoints, sizeof(cXyz));
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP,
|
||||
GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_BACK);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), 0);
|
||||
GXSetCurrentMtx(0);
|
||||
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition1x8(0);
|
||||
GXPosition1x8(1);
|
||||
GXPosition1x8(2);
|
||||
GXPosition1x8(3);
|
||||
GXEnd();
|
||||
}
|
||||
|
||||
mDoExt_trianglePacket::mDoExt_trianglePacket(cXyz* i_points, const GXColor& i_color, u8 i_clipZ) {
|
||||
cXyz* pnt_array = mPoints;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
*(pnt_array)++ = *(i_points)++;
|
||||
}
|
||||
|
||||
DCStoreRangeNoSync(mPoints, sizeof(cXyz) * 3);
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
}
|
||||
|
||||
void mDoExt_trianglePacket::draw() {
|
||||
j3dSys.reinitGX();
|
||||
|
||||
GXSetArray(GX_VA_POS, mPoints, sizeof(cXyz));
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), 0);
|
||||
GXSetCurrentMtx(0);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetZCompLoc(GX_ENABLE);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetFog(GX_FOG_NONE, 0.0f, 0.0f, 0.0f, 0.0f, g_clearColor);
|
||||
GXSetFogRangeAdj(GX_DISABLE, 0, NULL);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXSetDither(GX_ENABLE);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXSetNumIndStages(0);
|
||||
|
||||
GXBegin(GX_TRIANGLES, GX_VTXFMT0, 3);
|
||||
GXPosition1x8(0);
|
||||
GXPosition1x8(1);
|
||||
GXPosition1x8(2);
|
||||
GXEnd();
|
||||
|
||||
J3DShape::resetVcdVatCache();
|
||||
}
|
||||
|
||||
mDoExt_linePacket::mDoExt_linePacket(cXyz& i_start, cXyz& i_end, const GXColor& i_color, u8 i_clipZ, u8 i_width) {
|
||||
mStart = i_start;
|
||||
mEnd = i_end;
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
mWidth = i_width;
|
||||
}
|
||||
|
||||
void mDoExt_linePacket::draw() {
|
||||
j3dSys.reinitGX();
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), 0);
|
||||
GXSetCurrentMtx(0);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetZCompLoc(GX_ENABLE);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetFog(GX_FOG_NONE, 0.0f, 0.0f, 0.0f, 0.0f, g_clearColor);
|
||||
GXSetFogRangeAdj(GX_DISABLE, 0, NULL);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXSetDither(GX_ENABLE);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXSetNumIndStages(0);
|
||||
GXSetLineWidth(mWidth, GX_TO_ZERO);
|
||||
|
||||
GXBegin(GX_LINES, GX_VTXFMT0, 2);
|
||||
GXPosition3f32(mStart.x, mStart.y, mStart.z);
|
||||
GXPosition3f32(mEnd.x, mEnd.y, mEnd.z);
|
||||
GXEnd();
|
||||
|
||||
J3DShape::resetVcdVatCache();
|
||||
}
|
||||
|
||||
mDoExt_ArrowPacket::mDoExt_ArrowPacket(cXyz& i_position, cXyz& param_1, const GXColor& i_color, u8 i_clipZ, u8 i_lineWidth) {
|
||||
mStart = i_position;
|
||||
mEnd = param_1;
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
mLineWidth = i_lineWidth;
|
||||
}
|
||||
|
||||
void mDoExt_ArrowPacket::draw() {
|
||||
Mtx sp28;
|
||||
cXyz sp18;
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXSetLineWidth(mLineWidth, GX_TO_ZERO);
|
||||
|
||||
sp18 = mEnd - mStart;
|
||||
MtxTrans(mStart.x, mStart.y, mStart.z, 0);
|
||||
cMtx_YrotM(*calc_mtx, sp18.atan2sX_Z());
|
||||
cMtx_XrotM(*calc_mtx, cM_atan2s(JMAFastSqrt(SQUARE(sp18.x) + SQUARE(sp18.z)), sp18.y));
|
||||
cMtx_concat(j3dSys.getViewMtx(), *calc_mtx, sp28);
|
||||
|
||||
GXLoadPosMtxImm(sp28, 0);
|
||||
GXSetCurrentMtx(0);
|
||||
|
||||
GXBegin(GX_LINES, GX_VTXFMT0, 2);
|
||||
GXPosition3f32(0.0f, 0.0f, 0.0f);
|
||||
GXPosition3f32(0.0f, sp18.abs(), 0.0f);
|
||||
GXEnd();
|
||||
|
||||
f32 var_f29 = sp18.abs();
|
||||
f32 var_f31 = var_f29 * 0.1f;
|
||||
f32 var_f30 = var_f29 * 0.8f;
|
||||
|
||||
GXBegin(GX_TRIANGLEFAN, GX_VTXFMT0, 6);
|
||||
GXPosition3f32(0.0f, var_f29, 0.0f);
|
||||
GXPosition3f32(0.0f, var_f30, var_f31);
|
||||
GXPosition3f32(var_f31, var_f30, 0.0f);
|
||||
GXPosition3f32(0.0f, var_f30, -var_f31);
|
||||
GXPosition3f32(-var_f31, var_f30, 0.0f);
|
||||
GXPosition3f32(0.0f, var_f30, var_f31);
|
||||
GXEnd();
|
||||
}
|
||||
|
||||
mDoExt_pointPacket::mDoExt_pointPacket(cXyz& i_position, const GXColor& i_color, u8 i_clipZ, u8 i_lineWidth) {
|
||||
mPosition = i_position;
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
mLineWidth = i_lineWidth;
|
||||
}
|
||||
|
||||
void mDoExt_pointPacket::draw() {
|
||||
j3dSys.reinitGX();
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXSetPointSize(mLineWidth, GX_TO_ZERO);
|
||||
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), 0);
|
||||
GXSetCurrentMtx(0);
|
||||
|
||||
GXBegin(GX_POINTS, GX_VTXFMT0, 1);
|
||||
GXPosition3f32(mPosition.x, mPosition.y, mPosition.z);
|
||||
GXEnd();
|
||||
|
||||
j3dSys.reinitGX();
|
||||
J3DShape::resetVcdVatCache();
|
||||
}
|
||||
|
||||
mDoExt_circlePacket::mDoExt_circlePacket(cXyz& i_position, f32 i_radius, const GXColor& i_color, u8 i_clipZ, u8 i_lineWidth) {
|
||||
mPosition = i_position;
|
||||
mRadius = i_radius;
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
mLineWidth = i_lineWidth;
|
||||
}
|
||||
|
||||
void mDoExt_circlePacket::draw() {
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXSetLineWidth(mLineWidth, GX_TO_ZERO);
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), 0);
|
||||
GXSetCurrentMtx(0);
|
||||
|
||||
cXyz sp38;
|
||||
cXyz sp44;
|
||||
int numEdges = 36;
|
||||
sp38.y = sp44.y = mPosition.y;
|
||||
|
||||
GXBegin(GX_LINES, GX_VTXFMT0, numEdges * 2);
|
||||
for (int i = 0; i < numEdges; i++) {
|
||||
sp38.x = cM_fcos((i * 6.2831855f) / numEdges) * mRadius;
|
||||
sp38.z = cM_fsin((i * 6.2831855f) / numEdges) * mRadius;
|
||||
|
||||
sp44.x = cM_fcos(((i + 1) * 6.2831855f) / numEdges) * mRadius;
|
||||
sp44.z = cM_fsin(((i + 1) * 6.2831855f) / numEdges) * mRadius;
|
||||
|
||||
sp38.x += mPosition.x;
|
||||
sp38.z += mPosition.z;
|
||||
sp44.x += mPosition.x;
|
||||
sp44.z += mPosition.z;
|
||||
GXPosition3f32(sp38.x, sp38.y, sp38.z);
|
||||
GXPosition3f32(sp44.x, sp44.y, sp44.z);
|
||||
}
|
||||
GXEnd();
|
||||
}
|
||||
|
||||
mDoExt_spherePacket::mDoExt_spherePacket(cXyz& i_position, f32 i_size, const GXColor& i_color, u8 i_clipZ) {
|
||||
mPosition = i_position;
|
||||
mSize = i_size;
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
}
|
||||
|
||||
void mDoExt_spherePacket::draw() {
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_RASC, GX_CC_C0, GX_CC_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_BACK);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
|
||||
mDoMtx_stack_c::copy(j3dSys.getViewMtx());
|
||||
mDoMtx_stack_c::transM(mPosition.x, mPosition.y, mPosition.z);
|
||||
mDoMtx_stack_c::scaleM(mSize, mSize, mSize);
|
||||
|
||||
GXLoadPosMtxImm(mDoMtx_stack_c::get(), 0);
|
||||
mDoMtx_stack_c::inverseTranspose();
|
||||
|
||||
GXLoadNrmMtxImm(mDoMtx_stack_c::get(), 0);
|
||||
GXSetCurrentMtx(0);
|
||||
|
||||
GXDrawSphere(8, 8);
|
||||
}
|
||||
|
||||
mDoExt_cylinderPacket::mDoExt_cylinderPacket(cXyz& i_position, f32 i_radius, f32 i_height, const GXColor& i_color, u8 i_clipZ) {
|
||||
mPosition = i_position;
|
||||
mRadius = i_radius;
|
||||
mHeight = i_height;
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
}
|
||||
|
||||
void mDoExt_cylinderPacket::draw() {
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, 1, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_RASC, GX_CC_C0, GX_CC_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_BACK);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
|
||||
f32 var_f31 = mHeight * 0.5f;
|
||||
|
||||
mDoMtx_stack_c::copy(j3dSys.getViewMtx());
|
||||
mDoMtx_stack_c::transM(mPosition.x, mPosition.y + var_f31, mPosition.z);
|
||||
mDoMtx_stack_c::scaleM(mRadius, var_f31, mRadius);
|
||||
mDoMtx_stack_c::XrotM(0x4000);
|
||||
|
||||
GXLoadPosMtxImm(mDoMtx_stack_c::get(), 0);
|
||||
mDoMtx_stack_c::inverseTranspose();
|
||||
|
||||
GXLoadNrmMtxImm(mDoMtx_stack_c::get(), 0);
|
||||
GXSetCurrentMtx(0);
|
||||
GXDrawCylinder(8);
|
||||
}
|
||||
|
||||
mDoExt_cylinderMPacket::mDoExt_cylinderMPacket(Mtx i_mtx, const GXColor& i_color, u8 i_clipZ) {
|
||||
cMtx_copy(i_mtx, mMatrix);
|
||||
mColor = i_color;
|
||||
mClipZ = i_clipZ;
|
||||
}
|
||||
|
||||
void mDoExt_cylinderMPacket::draw() {
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, mColor);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_RASC, GX_CC_C0, GX_CC_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV);
|
||||
|
||||
if (mClipZ) {
|
||||
GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_ENABLE);
|
||||
} else {
|
||||
GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE);
|
||||
}
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_CLEAR);
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
GXSetCullMode(GX_CULL_BACK);
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
|
||||
cMtx_concat(j3dSys.getViewMtx(), mMatrix, mMatrix);
|
||||
|
||||
GXLoadPosMtxImm(mMatrix, 0);
|
||||
cMtx_inverseTranspose(mMatrix, mMatrix);
|
||||
|
||||
GXLoadNrmMtxImm(mMatrix, 0);
|
||||
GXSetCurrentMtx(0);
|
||||
|
||||
GXDrawCylinder(8);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 800165E4-8001683C .text mDoExt_initFontCommon__FPP7JUTFontPP7ResFONTP7JKRHeapPCcP10JKRArchiveUcUlUl */
|
||||
void mDoExt_initFontCommon(JUTFont** p_font, ResFONT** p_resfont, JKRHeap* p_heap, const char* param_4,
|
||||
JKRArchive* p_archive, u8 param_6, u32 param_7, u32 param_8) {
|
||||
|
||||
Reference in New Issue
Block a user