From b45a089e15d79821b07be020db628e01a49b1fd2 Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:56:59 -0700 Subject: some J3D/misc cleanup (#2628) * some j3d cleanup * begin using uintptr_t * j3dgraphbase cleanup * j3dgraphanimator cleanup --- src/JSystem/J3DGraphAnimator/J3DModelData.cpp | 33 ++++++++++----------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'src/JSystem/J3DGraphAnimator/J3DModelData.cpp') diff --git a/src/JSystem/J3DGraphAnimator/J3DModelData.cpp b/src/JSystem/J3DGraphAnimator/J3DModelData.cpp index 5f3572ade2..bab3b416a7 100644 --- a/src/JSystem/J3DGraphAnimator/J3DModelData.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DModelData.cpp @@ -5,7 +5,7 @@ #include "JSystem/J3DGraphAnimator/J3DModelData.h" #include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" -#include "dolphin/os.h" +#include "JSystem/J3DGraphAnimator/J3DModel.h" /* 80325D88-80325DA0 3206C8 0018+00 1/1 2/2 0/0 .text clear__12J3DModelDataFv */ void J3DModelData::clear() { @@ -21,16 +21,17 @@ J3DModelData::J3DModelData() { } /* 80325E14-80325EC8 320754 00B4+00 0/0 2/2 0/0 .text newSharedDisplayList__12J3DModelDataFUl */ -s32 J3DModelData::newSharedDisplayList(u32 flag) { +s32 J3DModelData::newSharedDisplayList(u32 mdlFlags) { u16 matNum = getMaterialNum(); for (u16 i = 0; i < matNum; i++) { - if (!!(flag & 0x40000)) { - s32 ret = getMaterialNodePointer(i)->newSingleSharedDisplayList(getMaterialNodePointer(i)->countDLSize()); + s32 ret; + if (mdlFlags & J3DMdlFlag_UseSingleDL) { + ret = getMaterialNodePointer(i)->newSingleSharedDisplayList(getMaterialNodePointer(i)->countDLSize()); if (ret != kJ3DError_Success) return ret; } else { - s32 ret = getMaterialNodePointer(i)->newSharedDisplayList(getMaterialNodePointer(i)->countDLSize()); + ret = getMaterialNodePointer(i)->newSharedDisplayList(getMaterialNodePointer(i)->countDLSize()); if (ret != kJ3DError_Success) return ret; } @@ -39,22 +40,11 @@ s32 J3DModelData::newSharedDisplayList(u32 flag) { return kJ3DError_Success; } -/* ############################################################################################## */ -/* 804515E8-804515EC 000AE8 0004+00 1/1 0/0 0/0 .sbss sInterruptFlag$965 */ -static s32 sInterruptFlag; - -/* 804515EC-804515F0 000AEC 0004+00 1/1 0/0 0/0 .sbss None */ -static s8 sInitInterruptFlag; - /* 80325EC8-80325F94 320808 00CC+00 0/0 1/1 0/0 .text indexToPtr__12J3DModelDataFv */ void J3DModelData::indexToPtr() { - J3DTexture* tex = getTexture(); - j3dSys.setTexture(tex); + j3dSys.setTexture(getTexture()); - if (!sInitInterruptFlag) { - sInterruptFlag = OSDisableInterrupts(); - sInitInterruptFlag = true; - } + static BOOL sInterruptFlag = OSDisableInterrupts(); OSDisableScheduler(); GDLObj gdl_obj; @@ -67,6 +57,7 @@ void J3DModelData::indexToPtr() { GDSetCurrent(&gdl_obj); matNode->getTevBlock()->indexToPtr(); } + GDSetCurrent(NULL); OSEnableScheduler(); OSRestoreInterrupts(sInterruptFlag); @@ -74,8 +65,7 @@ void J3DModelData::indexToPtr() { /* 80325F94-8032600C 3208D4 0078+00 0/0 2/2 0/0 .text makeSharedDL__12J3DModelDataFv */ void J3DModelData::makeSharedDL() { - J3DTexture* tex = getTexture(); - j3dSys.setTexture(tex); + j3dSys.setTexture(getTexture()); u16 matNum = getMaterialNum(); for (u16 i = 0; i < matNum; i++) { @@ -88,8 +78,9 @@ void J3DModelData::makeSharedDL() { void J3DModelData::simpleCalcMaterial(u16 idx, Mtx param_1) { syncJ3DSysFlags(); + J3DMaterial* mat; J3DJoint* jointNode = getJointNodePointer(idx); - for (J3DMaterial* mat = jointNode->getMesh(); mat != NULL; mat = mat->getNext()) { + for (mat = jointNode->getMesh(); mat != NULL; mat = mat->getNext()) { if (mat->getMaterialAnm() != NULL) { mat->getMaterialAnm()->calc(mat); } -- cgit v1.2.3