From a2b9822e5cfbf23ec166cf5989694d360560a7a4 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 23 Jan 2024 01:04:32 -0800 Subject: [PATCH] minor matches --- configure.py | 2 +- include/JSystem/J2DGraph/J2DPicture.h | 4 +-- include/d/actor/d_a_mozo.h | 10 +++++--- include/d/actor/d_a_sea.h | 27 ++++++++++++++++--- src/d/actor/d_a_mozo.cpp | 37 +++++++++++++++++---------- src/d/actor/d_a_sea.cpp | 8 +++--- src/d/d_cc_mass_s.cpp | 27 ++++++++++--------- src/d/d_drawlist.cpp | 37 ++++++++++++++------------- 8 files changed, 93 insertions(+), 59 deletions(-) diff --git a/configure.py b/configure.py index 810432def..12ce79005 100644 --- a/configure.py +++ b/configure.py @@ -1563,7 +1563,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_msdan_sub2"), ActorRel(NonMatching, "d_a_obj_mtest", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_nest"), - ActorRel(Matching, "d_a_obj_ojtree"), + ActorRel(Matching, "d_a_obj_ojtree"), ActorRel(NonMatching, "d_a_obj_ospbox"), ActorRel(Matching, "d_a_obj_paper", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_obj_pbka"), diff --git a/include/JSystem/J2DGraph/J2DPicture.h b/include/JSystem/J2DGraph/J2DPicture.h index ffa9bd5fa..8b9974d9e 100644 --- a/include/JSystem/J2DGraph/J2DPicture.h +++ b/include/JSystem/J2DGraph/J2DPicture.h @@ -56,9 +56,9 @@ public: const ResTIMG * changeTexture(const char*, u8); void drawFullSet(f32, f32, f32, f32, J2DBinding, J2DMirror, bool, Mtx*); void draw(f32, f32, f32, f32, bool, bool, bool); - void draw(f32 x, f32 y, bool, bool, bool) { + void draw(f32 x, f32 y, bool mirrorX, bool mirrorY, bool tumble) { if (mNumTexture > 0) - draw(x, y, mpTexture[0]->getWidth(), mpTexture[0]->getHeight(), false, false, false); + draw(x, y, mpTexture[0]->getWidth(), mpTexture[0]->getHeight(), mirrorX, mirrorY, tumble); } void drawOut(const JGeometry::TBox2&, const JGeometry::TBox2&); void drawTexCoord(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, Mtx*); diff --git a/include/d/actor/d_a_mozo.h b/include/d/actor/d_a_mozo.h index 85dffc895..1600b5673 100644 --- a/include/d/actor/d_a_mozo.h +++ b/include/d/actor/d_a_mozo.h @@ -21,7 +21,7 @@ public: BOOL CreateHeap(); s32 CreateInit(); void event_move(); - void getBeamActor(u32); + fopAc_ac_c* getBeamActor(unsigned int); void search_beam_proc_init(); void search_beam_proc(); void search_fire_proc_init(); @@ -43,9 +43,11 @@ public: /* 0x2D8 */ J3DAnmTextureSRTKey* m_btk; /* 0x2DC */ u8 m2DC[0x35C - 0x2DC]; /* 0x35C */ Quaternion mQuatRotation; - /* 0x36C */ u8 m36C[0x380 - 0x36C]; - /* 0x380 */ dCcD_Stts mColStatus; - /* 0x3BC */ dCcD_Cps mCapsuleCol; + /* 0x36C */ u8 m36C[0x376 - 0x36C]; + /* 0x376 */ u8 field_0x376; + /* 0x377 */ u8 field_0x377[7]; + /* 0x380 */ dCcD_Stts mStts; + /* 0x3BC */ dCcD_Cps mCps; }; class daMozo_HIO_c { diff --git a/include/d/actor/d_a_sea.h b/include/d/actor/d_a_sea.h index 512716e58..9e9f82585 100644 --- a/include/d/actor/d_a_sea.h +++ b/include/d/actor/d_a_sea.h @@ -21,7 +21,7 @@ public: }; STATIC_ASSERT(sizeof(daSea_WaterHeightInfo_Mng) == 0x58); -struct daSea_WaveInfo__Table { +struct daSea_WaveInfoDat { /* 0x00 */ f32 mHeight; /* 0x04 */ f32 mKm; /* 0x08 */ s16 mPhase; @@ -32,7 +32,7 @@ struct daSea_WaveInfo__Table { class daSea_WaveInfo { public: - /* 0x00 */ daSea_WaveInfo__Table* mWaveInfoTable; + /* 0x00 */ daSea_WaveInfoDat* mWaveInfoTable; /* 0x04 */ f32 m04[4]; /* 0x14 */ int mCounters[4]; /* 0x24 */ f32 mCurScale; @@ -45,6 +45,13 @@ public: f32 GetRatio(int); f32 GetKm(int); f32 GetScale(f32); + + void SetDat(daSea_WaveInfoDat* dat) { mWaveInfoTable = dat; } + f32 GetBaseHeight(int no) { return mWaveInfoTable[no].mHeight; } + s16 GetPhai(int no) { return mWaveInfoTable[no].mPhase; } + f32 GetVx(int no) { return mWaveInfoTable[no].mScaleX; } + f32 GetVz(int no) { return mWaveInfoTable[no].mScaleZ; } + void GetRamdaRecp(int no) {} }; class daSea_packet_c : public J3DPacket { @@ -62,6 +69,20 @@ public: void draw(); ~daSea_packet_c() {} + f32 getMinX() {} + f32 getMinZ() {} + f32 getMaxX() {} + f32 getMaxZ() {} + GXTexObj* getSea0TexObj() { return &mTexSea0; } + GXTexObj* getSea1TexObj() { return &mTexSea1; } + GXTexObj* getYuraTexObj() { return &mTexYura; } + void ChkNowUse() {} + void GetSrcDataHeight(f32, f32) {} + void ChkCullStop() {} + void end() {} + void getPos() {} + void GetCenterP() {} + public: /* 0x010 */ daSea_WaterHeightInfo_Mng mWaterHeightMgr; /* 0x068 */ daSea_WaveInfo mWaveInfo; @@ -73,7 +94,7 @@ public: /* 0x0B0 */ f32 mFlatInterCounter; /* 0x0B4 */ GXTexObj mTexSea0; /* 0x0D4 */ GXTexObj mTexSea1; - /* 0x0F4 */ GXTexObj mpTexWyurayura; + /* 0x0F4 */ GXTexObj mTexYura; /* 0x114 */ f32 mDrawMinX; /* 0x118 */ f32 mDrawMinZ; /* 0x11C */ f32 mDrawMaxX; diff --git a/src/d/actor/d_a_mozo.cpp b/src/d/actor/d_a_mozo.cpp index 4fe9ce6c7..b3183550c 100644 --- a/src/d/actor/d_a_mozo.cpp +++ b/src/d/actor/d_a_mozo.cpp @@ -22,18 +22,29 @@ daMozo_HIO_c::daMozo_HIO_c() { } /* 000002D0-00000568 .text daMozo_nodeCallBackBeam__FP8daMozo_cP8J3DModelP7J3DNodei */ -void daMozo_nodeCallBackBeam(daMozo_c*, J3DModel*, J3DNode*, int) { +static BOOL daMozo_nodeCallBackBeam(daMozo_c*, J3DModel*, J3DNode*, int) { /* Nonmatching */ } /* 00000568-00000728 .text daMozo_nodeCallBackFire__FP8daMozo_cP8J3DModelP7J3DNodei */ -void daMozo_nodeCallBackFire(daMozo_c*, J3DModel*, J3DNode*, int) { +static BOOL daMozo_nodeCallBackFire(daMozo_c*, J3DModel*, J3DNode*, int) { /* Nonmatching */ } /* 00000728-0000078C .text daMozo_nodeCallBack__FP7J3DNodei */ -static BOOL daMozo_nodeCallBack(J3DNode*, int) { +static BOOL daMozo_nodeCallBack(J3DNode* node, int idx) { /* Nonmatching */ + J3DJoint* joint = (J3DJoint*)node; + s32 jntNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + daMozo_c* i_this = (daMozo_c*)model->getUserArea(); + + switch (i_this->field_0x376) { + case 0: return daMozo_nodeCallBackBeam(i_this, model, node, idx); + case 1: return daMozo_nodeCallBackFire(i_this, model, node, idx); + } + + return TRUE; } /* 0000078C-000007AC .text CheckCreateHeap__FP10fopAc_ac_c */ @@ -43,7 +54,6 @@ static BOOL CheckCreateHeap(fopAc_ac_c* i_this) { /* 000007AC-00000A24 .text CreateHeap__8daMozo_cFv */ BOOL daMozo_c::CreateHeap() { - /* Nonmatching */ J3DModelData* mdlData = (J3DModelData*)dComIfG_getObjectRes("Mozo", 9); mDoExt_McaMorf* newMorf = new mDoExt_McaMorf( @@ -181,20 +191,16 @@ s32 daMozo_c::CreateInit() { /* 00002228-000023B0 .text _create__8daMozo_cFv */ s32 daMozo_c::_create() { - /* Nonmatching */ fopAcM_SetupActor(this, daMozo_c); s32 result = dComIfG_resLoad(&mPhs, "Mozo"); if (result == cPhs_COMPLEATE_e) { - s32 solidHeapResult = fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x1AA0); - - if (solidHeapResult & 0xFF == 0) { - result = cPhs_ERROR_e; - } - else { + if (fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x1AA0)) { result = CreateInit(); _execute(); + } else { + return cPhs_ERROR_e; } } @@ -207,8 +213,13 @@ bool daMozo_c::_delete() { } /* 0000242C-00002498 .text getBeamActor__8daMozo_cFUi */ -void daMozo_c::getBeamActor(u32) { - /* Nonmatching */ +fopAc_ac_c* daMozo_c::getBeamActor(unsigned int apid) { + fopAc_ac_c* ac = fopAcM_SearchByID(apid); + if (ac == NULL) + return NULL; + if (fopAc_IsActor(ac) && fopAcM_GetProfName(ac) == PROC_Beam) + return ac; + return NULL; } /* 00002498-00002588 .text event_move__8daMozo_cFv */ diff --git a/src/d/actor/d_a_sea.cpp b/src/d/actor/d_a_sea.cpp index 211fb6efb..a355580c7 100644 --- a/src/d/actor/d_a_sea.cpp +++ b/src/d/actor/d_a_sea.cpp @@ -14,7 +14,7 @@ daSea_packet_c l_cloth; f32 daSea_packet_c::BASE_HEIGHT = 1.0f; -daSea_WaveInfo__Table wi_prm_ocean[4] = { +daSea_WaveInfoDat wi_prm_ocean[4] = { { 2.5f, // mHeight 7.352941E-5f, // mKm @@ -176,10 +176,10 @@ bool daSea_packet_c::create(cXyz& pos) { mFlatInter = 0.0f; mpHeightTable = new f32[65 * 65]; if (mpHeightTable == NULL) - return true; + return false; mWaterHeightMgr.SetInf(); - mWaveInfo.mWaveInfoTable = wi_prm_ocean; + mWaveInfo.SetDat(wi_prm_ocean); CleanUp(); mInitFlag = true; mRoomNo = -1; @@ -203,7 +203,7 @@ bool daSea_packet_c::create(cXyz& pos) { (GXAnisotropy)timg->maxAnisotropy); timg = (ResTIMG*)dComIfG_getObjectRes("Always", ALWAYS_BTI_B_WYURAYURA_TEX1); - mDoLib_setResTimgObj(timg, &mpTexWyurayura, 0, NULL); + mDoLib_setResTimgObj(timg, &mTexYura, 0, NULL); return true; } diff --git a/src/d/d_cc_mass_s.cpp b/src/d/d_cc_mass_s.cpp index a716fd6d9..55e9be7fe 100644 --- a/src/d/d_cc_mass_s.cpp +++ b/src/d/d_cc_mass_s.cpp @@ -27,44 +27,43 @@ void dCcMassS_Mng::Ct() { /* 800AC96C-800ACCB8 .text Prepare__12dCcMassS_MngFv */ void dCcMassS_Mng::Prepare() { /* Nonmatching */ - cM3dGAab local_38; - local_38.ClearForMinMax(); + cM3dGAab area; + area.ClearForMinMax(); for (dCcMassS_Obj* mass = mMassObjs; mass < mMassObjs + mMassObjCount; mass++) { cCcD_Obj* pobj = mass->mpObj; JUT_ASSERT(61, pobj != 0); cCcD_ShapeAttr* attr = pobj->GetShapeAttr(); attr->CalcAabBox(); - local_38.SetMinMax(attr->mAab.mMin); - local_38.SetMinMax(attr->mAab.mMax); + area.SetMinMax(attr->GetWorkAab().mMin); + area.SetMinMax(attr->GetWorkAab().mMax); } for (dCcMassS_Obj* mass = mMassAreas; mass < mMassAreas + mMassAreaCount; mass++) { cCcD_Obj* parea = mass->mpObj; JUT_ASSERT(73, parea != 0); cCcD_ShapeAttr* attr = parea->GetShapeAttr(); attr->CalcAabBox(); - local_38.SetMinMax(attr->mAab.mMin); - local_38.SetMinMax(attr->mAab.mMax); + area.SetMinMax(attr->GetWorkAab().mMin); + area.SetMinMax(attr->GetWorkAab().mMax); } if (mFlag & 1) { mCpsAttr.CalcAabBox(); - local_38.SetMinMax(mCpsAttr.mAab.mMin); - local_38.SetMinMax(mCpsAttr.mAab.mMax); + cCcD_ShapeAttr* attr = &mCpsAttr; + area.SetMinMax(attr->GetWorkAab().mMin); + area.SetMinMax(attr->GetWorkAab().mMax); } - mDivideArea.SetArea(local_38); + mDivideArea.SetArea(area); for (dCcMassS_Obj* mass = mMassObjs; mass < mMassObjs + mMassObjCount; mass++) { cCcD_Obj* pobj = mass->mpObj; JUT_ASSERT(93, pobj != 0); - cCcD_ShapeAttr* attr = pobj->GetShapeAttr(); - mDivideArea.CalcDivideInfo(&mass->mDivideInfo, attr->mAab, 0); + mDivideArea.CalcDivideInfo(&mass->mDivideInfo, pobj->GetShapeAttr()->GetWorkAab(), 0); } for (dCcMassS_Obj* mass = mMassAreas; mass < mMassAreas + mMassAreaCount; mass++) { cCcD_Obj* parea = mass->mpObj; JUT_ASSERT(104, parea != 0); - cCcD_ShapeAttr* attr = parea->GetShapeAttr(); - mDivideArea.CalcDivideInfo(&mass->mDivideInfo, attr->mAab, 0); + mDivideArea.CalcDivideInfo(&mass->mDivideInfo, parea->GetShapeAttr()->GetWorkAab(), 0); } if (mFlag & 1) { - mDivideArea.CalcDivideInfo(&mDivideInfo, mCpsAttr.mAab, 0); + mDivideArea.CalcDivideInfo(&mDivideInfo, mCpsAttr.GetWorkAab(), 0); } mCamTopPos.x = 0.0f; mCamTopPos.y = -1e+9f; diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 22a8858a1..33b4ea571 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -1523,18 +1523,17 @@ void dDlst_shadowReal_c::draw() { } /* 80083B8C-80083DA0 .text psdRealCallBack__FP13cBgS_ShdwDrawP10cBgD_Vtx_tiiiP8cM3dGPla */ -int psdRealCallBack(cBgS_ShdwDraw* param_0, cBgD_Vtx_t* param_1, int param_2, - int param_3, int param_4, cM3dGPla* param_5) { - ShdwDrawPoly_c* shdwDrawPoly = (ShdwDrawPoly_c*)param_0; - const cXyz* normal = param_5->GetNP(); +int psdRealCallBack(cBgS_ShdwDraw* shdw, cBgD_Vtx_t* pVtx, int v0, int v1, int v2, cM3dGPla* tri) { + ShdwDrawPoly_c* shdwDrawPoly = (ShdwDrawPoly_c*)shdw; + const cXyz* normal = tri->GetNP(); if (shdwDrawPoly->getLightVec()->inprod(*normal) < -0.2f) { cXyz* center = shdwDrawPoly->getCenter(); - if (normal->x * center->x + normal->y * center->y + normal->z * center->z + param_5->GetD() > -90.f) { + if (normal->x * center->x + normal->y * center->y + normal->z * center->z + tri->GetD() > -90.f) { const cXyz* min = shdwDrawPoly->GetBndP()->GetMinP(); const cXyz* max = shdwDrawPoly->GetBndP()->GetMaxP(); - cBgD_Vtx_t* vert1 = param_1 + param_2; - cBgD_Vtx_t* vert2 = param_1 + param_3; - cBgD_Vtx_t* vert3 = param_1 + param_4; + cBgD_Vtx_t* vert1 = pVtx + v0; + cBgD_Vtx_t* vert2 = pVtx + v1; + cBgD_Vtx_t* vert3 = pVtx + v2; if ((normal->y <= 0.0f && (vert1->y < min->y || vert2->y < min->y || vert3->y < min->y)) || (normal->y > 0.0f && (vert1->y < min->y && vert2->y < min->y && vert3->y < min->y)) || (vert1->y > max->y && vert2->y > max->y && vert3->y > max->y) || @@ -1545,7 +1544,7 @@ int psdRealCallBack(cBgS_ShdwDraw* param_0, cBgD_Vtx_t* param_1, int param_2, ) { return 1; } else { - return shdwDrawPoly->getPoly()->set(param_1, param_2, param_3, param_4, param_5); + return shdwDrawPoly->getPoly()->set(pVtx, v0, v1, v2, tri); } } } @@ -1558,8 +1557,7 @@ void seaRealCallBack(void*, cXyz&, cXyz&, cXyz&) { } /* 80083E18-800840B0 .text realPolygonCheck__FP4cXyzffP4cXyzP18dDlst_shadowPoly_c */ -BOOL realPolygonCheck(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3, - dDlst_shadowPoly_c* param_4) { +BOOL realPolygonCheck(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3, dDlst_shadowPoly_c* param_4) { ShdwDrawPoly_c shdwDrawPoly; cXyz local_8c; cXyz local_98; @@ -2243,17 +2241,20 @@ void dDlst_list_c::reset() { /* 80086490-80086540 .text entryZSortXluDrawList__12dDlst_list_cFP13J3DDrawBufferP9J3DPacketR4cXyz */ void dDlst_list_c::entryZSortXluDrawList(J3DDrawBuffer* pBuffer, J3DPacket* pPacket, cXyz& pos) { - /* Nonmatching */ f32 z = -J3DCalcZValue(j3dSys.getViewMtx(), pos); u16 idx; - if (40.05859f > z) { - idx = 0; - } else if (z > 9960.941f) { - idx = 0xFF; + if (40.05859f < z) { + if (9960.941f > z) { + idx = z / 39.05859f; + } else { + idx = 0xFF; + } } else { - idx = z / 39.05859f; + idx = 0; } - pBuffer->entryImm(pPacket, 0xFF - idx); + + idx = 0xFF - idx; + pBuffer->entryImm(pPacket, idx); } /* 80086540-80086570 .text set__12dDlst_list_cFRPP12dDlst_base_cRPP12dDlst_base_cP12dDlst_base_c */