diff --git a/configure.py b/configure.py index 5e83a610c..41d85837a 100755 --- a/configure.py +++ b/configure.py @@ -1429,7 +1429,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bflower"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bita"), ActorRel(Matching, "d_a_branch"), - ActorRel(NonMatching, "d_a_bridge"), + ActorRel(Matching, "d_a_bridge"), ActorRel(Matching, "d_a_coming2"), ActorRel(Matching, "d_a_coming3"), ActorRel(Matching, "d_a_demo_dk"), diff --git a/include/JSystem/J3DGraphBase/J3DStruct.h b/include/JSystem/J3DGraphBase/J3DStruct.h index cfbda1b45..46fc620c6 100644 --- a/include/JSystem/J3DGraphBase/J3DStruct.h +++ b/include/JSystem/J3DGraphBase/J3DStruct.h @@ -10,11 +10,22 @@ class J3DLightInfo { public: void operator=(J3DLightInfo const& other) { - mLightPosition = other.mLightPosition; - mLightDirection = other.mLightDirection; - mColor = other.mColor; - mCosAtten = other.mCosAtten; - mDistAtten = other.mDistAtten; + mLightPosition.x = other.mLightPosition.x; + mLightPosition.y = other.mLightPosition.y; + mLightPosition.z = other.mLightPosition.z; + mLightDirection.x = other.mLightDirection.x; + mLightDirection.y = other.mLightDirection.y; + mLightDirection.z = other.mLightDirection.z; + mColor.r = other.mColor.r; + mColor.g = other.mColor.g; + mColor.b = other.mColor.b; + mColor.a = other.mColor.a; + mCosAtten.x = other.mCosAtten.x; + mCosAtten.y = other.mCosAtten.y; + mCosAtten.z = other.mCosAtten.z; + mDistAtten.x = other.mDistAtten.x; + mDistAtten.y = other.mDistAtten.y; + mDistAtten.z = other.mDistAtten.z; } /* 0x00 */ Vec mLightPosition; diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h index 62f141a57..6760dfb4e 100644 --- a/include/JSystem/J3DGraphBase/J3DSys.h +++ b/include/JSystem/J3DGraphBase/J3DSys.h @@ -99,7 +99,6 @@ public: // Type 1: Xlu Buffer void setDrawBuffer(J3DDrawBuffer* buffer, int type) { J3D_ASSERT(114, type >= 0 && type < 2, "Error : range over."); - J3D_ASSERT(115, buffer, "Error : null pointer."); mDrawBuffer[type] = buffer; } diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index 7f26e814d..ee80cc088 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -46,33 +46,37 @@ struct cXyz : Vec { y = vec.y; z = vec.z; } + // void operator=(const cXyz&); cXyz operator+(const Vec&) const; cXyz operator-(const Vec&) const; cXyz operator*(f32) const; cXyz operator*(const Vec&) const; cXyz operator/(f32) const; - // void operator=(const cXyz&); - void operator+=(f32 f) { - x += f; - y += f; - z += f; - } - void operator-=(f32 f) { - x -= f; - y -= f; - z -= f; - } - void operator-=(const Vec& other) { VECSubtract(this, &other, this); } - cXyz* operator+=(const Vec& other) { - VECAdd(this, &other, this); + cXyz* operator*=(f32 scale) { + VECScale(this, this, scale); return this; } - void operator*=(f32 scale) { VECScale(this, this, scale); } cXyz* operator/=(f32 scale) { VECScale(this, this, 1.0f / std::sqrtf(scale)); return this; } + + cXyz* operator+=(const Vec& other) { + VECAdd(this, &other, this); + return this; + } + cXyz* operator-=(const Vec& other) { + VECSubtract(this, &other, this); + return this; + } + cXyz* operator*=(const Vec& other) { + x *= other.x; + y *= other.y; + z *= other.z; + return this; + } + cXyz getCrossProduct(const Vec&) const; cXyz outprod(const Vec&) const; cXyz norm() const; @@ -126,10 +130,7 @@ struct cXyz : Vec { f32 inprod(const Vec& other) const { return getDotProduct(other); } f32 inprodXZ(const Vec& other) const { return x * other.x + z * other.z; } - // TODO - // void operator*=(const Vec&) {} - // void operator/=(f32) {} - // void operator=(const cXyz&) {} + // debug-only inline? // void print(const char*) {} }; diff --git a/include/d/actor/d_a_bridge.h b/include/d/actor/d_a_bridge.h index ff563d530..af9f703ae 100644 --- a/include/d/actor/d_a_bridge.h +++ b/include/d/actor/d_a_bridge.h @@ -11,8 +11,7 @@ class JPABaseEmitter; struct br_s { /* 0x000 */ J3DModel* mpModel; - /* 0x004 */ J3DLightObj mLight; - /* 0x078 */ u8 m078[0xB4 - 0x78]; + /* 0x004 */ dKy_tevstr_c mTevStr; /* 0x0B4 */ J3DModel* mpModelRope1; /* 0x0B8 */ J3DModel* mpModelRope0; /* 0x0BC */ mDoExt_3DlineMat1_c mLineMat1; @@ -75,9 +74,9 @@ struct bridge_class { /* 0x02FC */ f32 m02FC; /* 0x0300 */ s16 m0300; /* 0x0302 */ s16 m0302; - /* 0x0304 */ s32 m0304; - /* 0x0308 */ s32 m0308; - /* 0x030C */ s32 m030C; + /* 0x0304 */ int m0304; + /* 0x0308 */ int m0308; + /* 0x030C */ int m030C; /* 0x0310 */ u8 m0310[0x0312 - 0x0310]; /* 0x0312 */ s16 m0312; /* 0x0314 */ cXyz mEndPos; diff --git a/include/d/actor/d_a_npc_os.h b/include/d/actor/d_a_npc_os.h index 1f2a4d860..10f0505e4 100644 --- a/include/d/actor/d_a_npc_os.h +++ b/include/d/actor/d_a_npc_os.h @@ -45,18 +45,19 @@ public: s16 getBackbone_x() { return mJntCtrl.getBackbone_x(); } s16 getBackbone_y() { return mJntCtrl.getBackbone_y(); } cXyz& getEyePos() { return field_0x748; } - f32 getGroundY() { return mAcch.GetGroundH(); } + virtual f32 getGroundY() { return mAcch.GetGroundH(); } s16 getHead_x() { return mJntCtrl.getHead_x(); } s16 getHead_y() { return mJntCtrl.getHead_y(); } - MtxP getLeftHandMatrix() { return cullMtx; } - MtxP getRightHandMatrix() { return cullMtx; } - f32 getBaseAnimeFrameRate() { return 1.0f; } - f32 getBaseAnimeFrame() { return 0.0f; } + virtual MtxP getLeftHandMatrix() { return cullMtx; } + virtual MtxP getRightHandMatrix() { return cullMtx; } + virtual f32 getBaseAnimeFrameRate() { return 1.0f; } + virtual f32 getBaseAnimeFrame() { return 0.0f; } void incAttnSetCount() { if(field_0x7A3 != 0xFF) { field_0x7A3 += 1; } } + BOOL isFinish() { return cLib_checkBit(field_0x784, 0x1UL); } void onFinish() { cLib_onBit(field_0x784, 0x1UL); } BOOL isSetHomePos() { return cLib_checkBit(field_0x784, 0x2UL); } @@ -67,6 +68,7 @@ public: void onGravity() { cLib_onBit(field_0x784, 0x8UL); } void offGravity() { cLib_offBit(field_0x784, 0x8UL); } // Note: The 0x10 bit is used in the final release, but not in the demo debug maps, so its official name is unknown. + void offPlayerRoom(int idx) { m_playerRoom[idx] = false; } void onPlayerRoom(int idx) { m_playerRoom[idx] = true; } diff --git a/src/d/actor/d_a_bridge.cpp b/src/d/actor/d_a_bridge.cpp index 4b14551d3..785026ce1 100644 --- a/src/d/actor/d_a_bridge.cpp +++ b/src/d/actor/d_a_bridge.cpp @@ -30,7 +30,7 @@ static void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { bridge_class* i_this = (bridge_class*)i_ac; cXyz pos = i_this->mBr[0].mPosition - i_pt->current.pos; - s32 brIdx = std::sqrtf(pos.x * pos.x + pos.z * pos.z) / 76.5f - -0.5f; + int brIdx = std::sqrtf(pos.x * pos.x + pos.z * pos.z) / 76.5f - -0.5f; if (brIdx > i_this->mBrCount - 1) { brIdx = i_this->mBrCount - 1; } else if (brIdx < 0) { @@ -52,20 +52,20 @@ static void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { i_pt->speed.y = -5.0f; f32 fVar7; - if (fpcM_GetName(i_pt) == fpcNm_PLAYER_e) { + if (fopAcM_GetName(i_pt) == fpcNm_PLAYER_e) { fVar7 = 100.0f; pBr->m3F4 = -31.0f; i_this->m033C = 5; - } else if (fpcM_GetName(i_pt) == fpcNm_MO2_e) { + } else if (fopAcM_GetName(i_pt) == fpcNm_MO2_e) { fVar7 = 150.0f; pBr->m3F4 = -40.0f; i_pt->speed.y = -20.0f; - } else if (fpcM_GetName(i_pt) == fpcNm_BK_e) { + } else if (fopAcM_GetName(i_pt) == fpcNm_BK_e) { bk_class* bk = (bk_class*)i_pt; bk->speed.y = -20.0f; fVar7 = 100.0f; pBr->m3F4 = -25.0f; - bk->dr.m7B8 = fpcM_GetID(i_ac); + bk->dr.m7B8 = fopAcM_GetID(i_ac); bk->dr.m7B2 = 8; bk->dr.m7AC = pBr->mRotation; @@ -82,7 +82,7 @@ static void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { } else { fVar7 = 50.0f; pBr->m3F4 = -10.0f; - if (fpcM_GetName(i_pt) == fpcNm_BOMB_e) { + if (fopAcM_GetName(i_pt) == fpcNm_BOMB_e) { daBomb_c* bomb = (daBomb_c*)i_pt; if (bomb->getBombRestTime() <= 1) { @@ -124,7 +124,7 @@ static void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { } /* 00000540-00000614 .text kikuzu_set__FP12bridge_classP4cXyz */ -void kikuzu_set(bridge_class* i_this, cXyz* pPos) { +static void kikuzu_set(bridge_class* i_this, cXyz* pPos) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); csXyz shapeAngle = player->shape_angle; shapeAngle.y -= -0x8000; @@ -135,7 +135,10 @@ void kikuzu_set(bridge_class* i_this, cXyz* pPos) { emitter->setMaxFrame(1); emitter->setSpread(0.2f); emitter->setVolumeSweep(0.15f); - JGeometry::TVec3 scale(0.7f, 0.7f, 0.7f); + JGeometry::TVec3 scale; + scale.x = 0.7f; + scale.y = 0.7f; + scale.z = 0.7f; emitter->setGlobalParticleScale(scale); } } @@ -143,7 +146,7 @@ void kikuzu_set(bridge_class* i_this, cXyz* pPos) { /* 00000614-000011EC .text daBridge_Draw__FP12bridge_class */ static BOOL daBridge_Draw(bridge_class* i_this) { s16 atan; - s32 atan2; + int atan2; s16 sVar7; s16 sVar8; @@ -152,7 +155,7 @@ static BOOL daBridge_Draw(bridge_class* i_this) { } br_s* pBr = &i_this->mBr[0]; - for (s32 i = 0; i < i_this->mBrCount; i++, pBr++) { + for (int i = 0; i < i_this->mBrCount; i++, pBr++) { g_env_light.setLightTevColorType(pBr->mpModel, &i_this->actor.tevStr); dComIfGd_setListBG(); @@ -171,14 +174,14 @@ static BOOL daBridge_Draw(bridge_class* i_this) { cXyz sp60 = pBr->m0F8[0] - pBr->m0F8[1]; if ((i_this->mTypeBits & 1) == 0) { - s32 uVar16 = (i_this->mTypeBits & 8) ? 5 : 3; + int uVar16 = (i_this->mTypeBits & 8) ? 5 : 3; cXyz* segment0; cXyz* segment1; u8* size0 = pBr->mLineMat1.getSize(0); u8* size1 = pBr->mLineMat1.getSize(2); if ((pBr->m408 & 1) == 0) { - for (s32 j = 0; j < 5; j++) { + for (int j = 0; j < 5; j++) { *size0++ = *size1++ = uVar16; } } else { @@ -191,7 +194,7 @@ static BOOL daBridge_Draw(bridge_class* i_this) { f32 fVar3 = pBr->m3A0[0] * cM_ssin(i_this->m0300 * 5); - for (s32 j = 0; j < 5; j++, segment0++, segment1++, size0++, size1++) { + for (int j = 0; j < 5; j++, segment0++, segment1++, size0++, size1++) { *size0 = uVar16; f32 fVar2; @@ -222,7 +225,7 @@ static BOOL daBridge_Draw(bridge_class* i_this) { size0 = pBr->mLineMat1.getSize(1); size1 = pBr->mLineMat1.getSize(3); if ((pBr->m408 & 2) == 0) { - for (s32 j = 0; j < 5; j++) { + for (int j = 0; j < 5; j++) { *size0++ = *size1++ = uVar16; } } else { @@ -235,7 +238,7 @@ static BOOL daBridge_Draw(bridge_class* i_this) { f32 fVar3 = pBr->m3A0[1] * cM_ssin(i_this->m0300 * 5); - for (s32 j = 0; j < 5; j++, segment0++, segment1++, size0++, size1++) { + for (int j = 0; j < 5; j++, segment0++, segment1++, size0++, size1++) { *size0 = uVar16; f32 fVar2; @@ -376,7 +379,7 @@ static BOOL daBridge_Draw(bridge_class* i_this) { } /* 000011EC-00001580 .text control1__FP12bridge_classP4br_s */ -void control1(bridge_class* i_this, br_s* pBr) { +static void control1(bridge_class* i_this, br_s* pBr) { cXyz sp3C; cXyz sp30; cXyz sp24; @@ -409,7 +412,7 @@ void control1(bridge_class* i_this, br_s* pBr) { sp3C.x = 0.0f; sp3C.z = 75.0f; - for (s32 i = 1; i < i_this->mBrCount; i++, pBr++) { + for (int i = 1; i < i_this->mBrCount; i++, pBr++) { f32 x; f32 y; f32 z; @@ -437,7 +440,7 @@ void control1(bridge_class* i_this, br_s* pBr) { } /* 00001580-0000178C .text control2__FP12bridge_classP4br_s */ -void control2(bridge_class* i_this, br_s* pBr) { +static void control2(bridge_class* i_this, br_s* pBr) { cXyz sp18; cXyz sp0C; @@ -446,7 +449,7 @@ void control2(bridge_class* i_this, br_s* pBr) { sp18.y = 0.0f; sp18.z = 75.0f; - for (s32 i = 0; i < i_this->mBrCount - 1; i++, pBr--) { + for (int i = 0; i < i_this->mBrCount - 1; i++, pBr--) { f32 tmp = pBr->m3F8 * 0.5f + (pBr->m3FC * pBr->m3F0 * 0.5f + pBr->m3CC.y); f32 y = tmp - pBr[1].m3CC.y; @@ -472,7 +475,7 @@ void control2(bridge_class* i_this, br_s* pBr) { } /* 0000178C-000018A8 .text control3__FP12bridge_classP4br_s */ -void control3(bridge_class* i_this, br_s* pBr) { +static void control3(bridge_class* i_this, br_s* pBr) { f32 x = pBr->m3CC.x - pBr[1].m3CC.x; f32 y = pBr->m3CC.y - pBr[1].m3CC.y; f32 z = pBr->m3CC.z - pBr[1].m3CC.z; @@ -482,7 +485,7 @@ void control3(bridge_class* i_this, br_s* pBr) { } /* 000018A8-00001B08 .text cut_control1__FP12bridge_classP4br_s */ -void cut_control1(bridge_class* i_this, br_s* pBr) { +static void cut_control1(bridge_class* i_this, br_s* pBr) { cXyz sp24; cXyz sp18; cXyz spC; @@ -495,7 +498,7 @@ void cut_control1(bridge_class* i_this, br_s* pBr) { MtxPosition(&sp24, &spC); sp24.z = 75.0f; - for (s32 i = 1; i < i_this->m0304; i++, pBr++) { + for (int i = 1; i < i_this->m0304; i++, pBr++) { f32 fVar2 = pBr->m3CC.y + pBr->m3FC; f32 fVar1 = pBr->m3EC + 30.0f; if (fVar2 < fVar1) { @@ -531,7 +534,7 @@ void cut_control1(bridge_class* i_this, br_s* pBr) { } /* 00001B08-00001D84 .text cut_control2__FP12bridge_classP4br_s */ -void cut_control2(bridge_class* i_this, br_s* pBr) { +static void cut_control2(bridge_class* i_this, br_s* pBr) { cXyz sp24; cXyz sp18; cXyz spC; @@ -544,7 +547,7 @@ void cut_control2(bridge_class* i_this, br_s* pBr) { MtxPosition(&sp24, &spC); sp24.z = 75.0f; - for (s32 i = 0; i < (i_this->mBrCount - 1) - i_this->m0304; i++, pBr--) { + for (int i = 0; i < (i_this->mBrCount - 1) - i_this->m0304; i++, pBr--) { f32 fVar2 = pBr->m3CC.y + pBr->m3FC; f32 fVar1 = pBr->m3EC + 30.0f; if (fVar2 < fVar1) { @@ -555,7 +558,7 @@ void cut_control2(bridge_class* i_this, br_s* pBr) { f32 x = spC.x + (pBr->m3CC.x - pBr[1].m3CC.x); f32 z = spC.z + (pBr->m3CC.z - pBr[1].m3CC.z); s16 atan2; - s32 atan; + int atan; atan = cM_atan2s(x, z); atan2 = -cM_atan2s(y, std::sqrtf(x * x + z * z)); pBr[1].mRotation.y = atan; @@ -574,7 +577,7 @@ void cut_control2(bridge_class* i_this, br_s* pBr) { } /* 00001D84-00001FAC .text himo_cut_control1__FP4cXyz */ -void himo_cut_control1(cXyz* pPos) { +static void himo_cut_control1(cXyz* pPos) { cXyz pos; cXyz sp18; cXyz transformedPos; @@ -589,12 +592,12 @@ void himo_cut_control1(cXyz* pPos) { pos.z = 23.0f; pPos++; - for (s32 i = 1; i < 5; i++, pPos++) { + for (int i = 1; i < 5; i++, pPos++) { f32 x = transformedPos.x + (pPos[0].x - pPos[-1].x); f32 y = (pPos[0].y - pPos[-1].y) - 10.0f; f32 z = transformedPos.z + (pPos[0].z - pPos[-1].z); s16 atan2; - s32 atan; + int atan; atan = cM_atan2s(x, z); atan2 = -cM_atan2s(y, std::sqrtf(x * x + z * z)); @@ -608,11 +611,10 @@ void himo_cut_control1(cXyz* pPos) { } /* 00001FAC-00002A1C .text bridge_move__FP12bridge_class */ -void bridge_move(bridge_class* i_this) { - /* Nonmatching */ - daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); - s32 i; - s32 j; +static void bridge_move(bridge_class* i_this) { + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + int i; + int j; br_s* pBr = &i_this->mBr[0]; cXyz sp38; cXyz sp2C; @@ -621,7 +623,6 @@ void bridge_move(bridge_class* i_this) { f32 fVar14; f32 fVar2; f32 tmpf; - s32 iVar11; switch (i_this->mMoveProcMode) { case 1: @@ -681,8 +682,7 @@ void bridge_move(bridge_class* i_this) { if (pBr->m406 != 0) { for (j = -5; j <= 5; j++) { - iVar11 = i + j; - if ((iVar11 < 0) || (iVar11 >= i_this->mBrCount)) { + if (((i + j) < 0) || ((i + j) >= i_this->mBrCount)) { continue; } @@ -704,8 +704,7 @@ void bridge_move(bridge_class* i_this) { } for (j = -5; j <= 5; j++) { - iVar11 = i + j; - if ((iVar11 < 0) || (iVar11 >= i_this->mBrCount)) { + if (((i + j) < 0) || ((i + j) >= i_this->mBrCount)) { continue; } @@ -722,7 +721,7 @@ void bridge_move(bridge_class* i_this) { if (i_this->m0308 > 100) { i_this->mMoveProcMode = 4; - i_this->m0304 = iVar11; + i_this->m0304 = (i + j); if (i_this->m033C != 0) { dComIfGp_getVibration().StartShock(REG0_S(2) + 5, -0x21, cXyz(0.0f, 1.0f, 0.0f)); } @@ -732,7 +731,7 @@ void bridge_move(bridge_class* i_this) { if (pBr[j].m3F4 < -200.0f) { i_this->mMoveProcMode = 4; - i_this->m0304 = iVar11; + i_this->m0304 = (i + j); break; } } @@ -742,8 +741,7 @@ void bridge_move(bridge_class* i_this) { f32 fVar141 = (pBr->m3A0[0] | pBr->m3A0[1]) * 150.0f; fVar14 = fVar141 * cM_ssin(i_this->m0300 * 4); for (j = -5; j <= 5; j++) { - iVar11 = i + j; - if (iVar11 < 0 || iVar11 >= i_this->mBrCount) { + if ((i + j) < 0 || (i + j) >= i_this->mBrCount) { continue; } @@ -827,8 +825,8 @@ void bridge_move(bridge_class* i_this) { } /* 00002A1C-00002A8C .text s_a_b_sub__FPvPv */ -void* s_a_b_sub(void* ac1, void* ac2) { - if (fopAc_IsActor(ac1) && fpcM_GetName(ac1) == fpcNm_BRIDGE_e && ac1 != ac2) { +static void* s_a_b_sub(void* ac1, void* ac2) { + if (fopAcM_IsActor(ac1) && fopAcM_GetName(ac1) == fpcNm_BRIDGE_e && ac1 != ac2) { bridge_class* bridge = (bridge_class*)ac1; if ((bridge->mTypeBits & 0x82) == 2) { return ac1; @@ -838,17 +836,15 @@ void* s_a_b_sub(void* ac1, void* ac2) { } /* 00002A8C-00002AB8 .text search_aite__FP12bridge_class */ -bridge_class* search_aite(bridge_class* i_this) { +static bridge_class* search_aite(bridge_class* i_this) { return (bridge_class*)fpcM_Search(s_a_b_sub, &i_this->actor); } /* 00002AB8-00003C68 .text daBridge_Execute__FP12bridge_class */ static BOOL daBridge_Execute(bridge_class* i_this) { - /* Nonmatching - regswap */ - fopAc_ac_c* a_player = static_cast(dComIfGp_getPlayer(0)); - daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); - camera_process_class* pCam = dComIfGp_getCamera(0); - s32 i; + fopAc_ac_c* a_player = dComIfGp_getPlayer(0); + daPy_py_c* player = (daPy_py_c*)a_player; + camera_process_class* pCam = (camera_process_class*)dComIfGp_getCamera(0); cXyz eyeDir = i_this->actor.current.pos - pCam->view.mLookat.mEye; cXyz spCC; @@ -889,7 +885,7 @@ static BOOL daBridge_Execute(bridge_class* i_this) { bGotFlamePos = true; } - for (i = 0; i < i_this->mBrCount; i++, pBr++) { + for (int i = 0; i < i_this->mBrCount; i++, pBr++) { MtxTrans(pBr->mPosition.x, pBr->mPosition.y, pBr->mPosition.z, false); cMtx_YrotM(*calc_mtx, pBr->mRotation.y); cMtx_XrotM(*calc_mtx, pBr->mRotation.x); @@ -1082,7 +1078,7 @@ static BOOL daBridge_Execute(bridge_class* i_this) { dComIfG_Ccsp()->Set(&pBr->mCyl[1]); } - for (s32 i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { if (pBr->m3A0[i] != 0) { pBr->m3A0[i]--; } @@ -1161,16 +1157,15 @@ static BOOL daBridge_Execute(bridge_class* i_this) { cBgD_Vtx_t* vtxTbl = i_this->mpBgW->GetVtxTbl(); - int idx; int sw; + int idx; int other_i = 0; - for (i = 0; i < i_this->mpBgW->GetVtxNum(); i++, pBr++) { + for (int i = 0; i < i_this->mpBgW->GetVtxNum(); i++) { sw = i & 3; - idx = i; - idx >>= 2; + idx = i >> 2; if (idx < i_this->m02DD) { - br_s* pBr = &i_this->mBr[idx]; + pBr = &i_this->mBr[idx]; switch (sw) { case 0: @@ -1238,7 +1233,7 @@ static BOOL daBridge_Execute(bridge_class* i_this) { /* 00003C68-00003CD4 .text daBridge_IsDelete__FP12bridge_class */ static BOOL daBridge_IsDelete(bridge_class* i_this) { br_s* pBr = &i_this->mBr[0]; - for (s32 i = 0; i < i_this->mBrCount; i++, pBr++) { + for (int i = 0; i < i_this->mBrCount; i++, pBr++) { mDoAud_seDeleteObject(&pBr->m3CC); } return TRUE; @@ -1254,7 +1249,7 @@ static BOOL daBridge_Delete(bridge_class* i_this) { } /* 00003D2C-00003E00 .text CreateInit__FP10fopAc_ac_c */ -void CreateInit(fopAc_ac_c* a_this) { +static void CreateInit(fopAc_ac_c* a_this) { static dCcD_SrcCyl himo_cyl_src = { // dCcD_SrcGObjInf { @@ -1290,8 +1285,8 @@ void CreateInit(fopAc_ac_c* a_this) { i_this->mStts.Init(0xFF, 0xFF, a_this); br_s* pBr = i_this->mBr; - for (s32 i = 0; i < i_this->mBrCount; i++, pBr++) { - for (s32 j = 0; j < 2; j++) { + for (int i = 0; i < i_this->mBrCount; i++, pBr++) { + for (int j = 0; j < 2; j++) { pBr->mCyl[j].Set(himo_cyl_src); pBr->mCyl[j].SetStts(&i_this->mStts); if ((i_this->mTypeBits & 1) == 0) { @@ -1304,11 +1299,11 @@ void CreateInit(fopAc_ac_c* a_this) { /* 00003E00-00004310 .text CallbackCreateHeap__FP10fopAc_ac_c */ static BOOL CallbackCreateHeap(fopAc_ac_c* a_this) { - static const s32 bridge_bmd[] = { dRes_INDEX_BRIDGE_BDL_OBM_BRIDGE_e, dRes_INDEX_BRIDGE_BDL_OBM_BRIDGE2_e }; + static const int bridge_bmd[] = { dRes_INDEX_BRIDGE_BDL_OBM_BRIDGE_e, dRes_INDEX_BRIDGE_BDL_OBM_BRIDGE2_e }; bridge_class* i_this = (bridge_class*)a_this; - s32 modelNum = i_this->mTypeBits & 1; + int modelNum = i_this->mTypeBits & 1; if (i_this->mTypeBits & 4) { modelNum = 1; } @@ -1324,12 +1319,12 @@ static BOOL CallbackCreateHeap(fopAc_ac_c* a_this) { br_s* pBr = i_this->mBr; - s32 iVar8 = 2; + int iVar8 = 2; if (i_this->mTypeBits & 1) { iVar8 = 0; } - for (s32 i = 0; i < i_this->mBrCount; i++, pBr++) { + for (int i = 0; i < i_this->mBrCount; i++, pBr++) { pBr->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11020002); if (pBr->mpModel == NULL) { return FALSE; @@ -1423,7 +1418,7 @@ static BOOL CallbackCreateHeap(fopAc_ac_c* a_this) { i_this->mpBgW->SetRideCallback(ride_call_back); i_this->mpBgW->CopyBackVtx(); cBgD_Vtx_t* vtxTbl = i_this->mpBgW->GetVtxTbl(); - for (s32 i = 0; i < i_this->mpBgW->GetVtxNum(); i++) { + for (int i = 0; i < i_this->mpBgW->GetVtxNum(); i++) { vtxTbl[i].x = i_this->actor.current.pos.x; vtxTbl[i].y = i_this->actor.current.pos.y; vtxTbl[i].z = i_this->actor.current.pos.z; diff --git a/src/d/actor/d_a_npc_hi1.cpp b/src/d/actor/d_a_npc_hi1.cpp index 50ca82850..c36849c51 100644 --- a/src/d/actor/d_a_npc_hi1.cpp +++ b/src/d/actor/d_a_npc_hi1.cpp @@ -840,7 +840,6 @@ BOOL daNpc_Hi1_c::_draw() { mBtpAnm.remove(modelData); shadowDraw(); return TRUE; - /* Nonmatching */ } /* 00001CB4-00001EDC .text _execute__11daNpc_Hi1_cFv */ diff --git a/src/d/actor/d_a_npc_os.cpp b/src/d/actor/d_a_npc_os.cpp index 271198e42..a0b8899da 100644 --- a/src/d/actor/d_a_npc_os.cpp +++ b/src/d/actor/d_a_npc_os.cpp @@ -755,7 +755,7 @@ BOOL daNpc_Os_c::waitNpcAction(void*) { } else { cLib_onBit(attention_info.flags, fopAc_Attn_ACTION_CARRY_e); - s16 angle = shape_angle.y + mJntCtrl.getHead_y() + mJntCtrl.getBackbone_y(); + s16 angle = shape_angle.y + getHead_y() + getBackbone_y(); field_0x7A4 = chkAttention(current.pos, angle); if(chkArea(¤t.pos)) { @@ -774,7 +774,7 @@ BOOL daNpc_Os_c::waitNpcAction(void*) { f32 dist_sq = fopAcM_searchPlayerDistance2(this); if(!checkNpcCallCommand()) { if(dist_sq < SQUARE(l_HIO.field_0x64)) { - daPy_getPlayerLinkActorClass()->onNpcCallCommand(); + daPy_getPlayerLinkActorClass()->onNpcCall(); } } else { @@ -865,7 +865,7 @@ BOOL daNpc_Os_c::talkNpcAction(void*) { field_0x7A9 += 1; } else if(field_0x7A9 != -1) { - s16 angle = shape_angle.y + mJntCtrl.getHead_y() + mJntCtrl.getBackbone_y(); + s16 angle = shape_angle.y + getHead_y() + getBackbone_y(); field_0x7A4 = chkAttention(current.pos, angle); if(field_0x7A9 == 1) { @@ -899,7 +899,7 @@ BOOL daNpc_Os_c::carryNpcAction(void* param_1) { cLib_offBit(attention_info.flags, fopAc_Attn_ACTION_CARRY_e); offNpcCallCommand(); - field_0x7AC = shape_angle.y - dComIfGp_getPlayer(0)->shape_angle.y; + field_0x7AC = fopAcM_toPlayerShapeAngleY(this); field_0x788 = 120.0f; field_0x7A9 += 1; } @@ -925,7 +925,7 @@ BOOL daNpc_Os_c::carryNpcAction(void* param_1) { } if(!fopAcM_checkCarryNow(this)) { - if(speedF > 0.0f) { + if(fopAcM_GetSpeedF(this) > 0.0f) { setNpcAction(&daNpc_Os_c::throwNpcAction, 0); return true; @@ -1019,7 +1019,7 @@ void daNpc_Os_c::routeWallCheck(cXyz& param_1, cXyz& param_2, s16* param_3) { dBgS_LinChk linChk; linChk.Set(¶m_1, ¶m_2, 0); if(dComIfG_Bgsp()->LineCross(&linChk)) { - cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(linChk.GetBgIndex(), linChk.GetPolyIndex()); + cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(linChk); if(plane) { routeAngCheck(*plane->GetNP(), param_3); } @@ -1030,7 +1030,7 @@ void daNpc_Os_c::routeWallCheck(cXyz& param_1, cXyz& param_2, s16* param_3) { f32 daNpc_Os_c::checkForwardGroundY(s16 param_1) { s32 wallHit = wallHitCheck(); if(wallHit >= 0) { - cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(mAcchCir[wallHit].GetBgIndex(), mAcchCir[wallHit].GetPolyIndex()); + cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(mAcchCir[wallHit]); if(plane) { if(cLib_distanceAngleS(param_1, cM_atan2s(plane->GetNP()->x, plane->GetNP()->z)) > 0x4000) { dBgS_GndChk gndChk; @@ -2017,9 +2017,6 @@ BOOL daNpc_Os_c::init() { field_0x794 = fopAcM_GetParam(this) >> 0x10 & 0xFF; attention_info.distances[fopAc_Attn_TYPE_CARRY_e] = 0x27; - // Fakematch, the next two lines get optimized out, but they affect the regalloc when copying the tevstr. - speedF = speedF; - speedF = speedF; m_smoke_tevstr = tevStr; m_smoke.setTevStr(&m_smoke_tevstr); m_playerRoom[argument] = false; @@ -2090,6 +2087,9 @@ BOOL daNpc_Os_c::draw() { ); } + // dDbVw_drawCylinderXlu + // dDbVw_drawSphereXlu + return true; } @@ -2255,8 +2255,8 @@ BOOL daNpc_Os_c::execute() { } } - speed.x = speedF * cM_ssin(current.angle.y); - speed.z = speedF * cM_scos(current.angle.y); + speed.x = fopAcM_GetSpeedF(this) * cM_ssin(current.angle.y); + speed.z = fopAcM_GetSpeedF(this) * cM_scos(current.angle.y); fopAcM_posMove(this, mStts.GetCCMoveP()); } @@ -2280,7 +2280,7 @@ BOOL daNpc_Os_c::execute() { } if(mAcch.GetGroundH() != -G_CM3D_F_INF) { - cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd.GetBgIndex(), mAcch.m_gnd.GetPolyIndex()); + cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); if(plane) { field_0x7F0 = *plane->GetNP(); } diff --git a/src/d/actor/d_a_obj_gtaki.cpp b/src/d/actor/d_a_obj_gtaki.cpp index 725fb720a..569825711 100644 --- a/src/d/actor/d_a_obj_gtaki.cpp +++ b/src/d/actor/d_a_obj_gtaki.cpp @@ -104,7 +104,6 @@ void daObjGtaki_c::set_effect() { /* 00000484-00000604 .text CreateInit__12daObjGtaki_cFv */ bool daObjGtaki_c::CreateInit() { - /* Nonmatching */ fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); fopAcM_setCullSizeBox(this, -600.0f, -0.0f, -600.0f,600.0f,10000.0f,600.0f); fopAcM_setCullSizeFar(this, 1.0f); diff --git a/src/d/actor/d_a_obj_ikada.cpp b/src/d/actor/d_a_obj_ikada.cpp index 65791ef1e..a6612b84f 100644 --- a/src/d/actor/d_a_obj_ikada.cpp +++ b/src/d/actor/d_a_obj_ikada.cpp @@ -405,7 +405,6 @@ void daObj_Ikada_c::createWave() { /* 000012EC-00001528 .text setWave__13daObj_Ikada_cFv */ void daObj_Ikada_c::setWave() { - /* Nonmatching */ f32 fVar2 = l_HIO.mTrackVel; f32 fVar1 = l_HIO.mWaveVelFade; f32 target = l_HIO.mSplashScaleMax; diff --git a/src/d/actor/d_a_obj_lpalm.cpp b/src/d/actor/d_a_obj_lpalm.cpp index 4b11b6fe0..dd1a089c5 100644 --- a/src/d/actor/d_a_obj_lpalm.cpp +++ b/src/d/actor/d_a_obj_lpalm.cpp @@ -122,7 +122,6 @@ static BOOL daObjLpalmExecute(void* i_this) { /* 0000054C-000008C4 .text _execute__12daObjLpalm_cFv */ bool daObjLpalm_c::_execute() { - /* Nonmatching */ if (attr().flag0) return true; diff --git a/src/d/actor/d_a_obj_mtest.cpp b/src/d/actor/d_a_obj_mtest.cpp index 0e2d507cf..8921aafea 100644 --- a/src/d/actor/d_a_obj_mtest.cpp +++ b/src/d/actor/d_a_obj_mtest.cpp @@ -260,9 +260,7 @@ cPhs_State daObjMtest::Act_c::Mthd_Create() { mbAppear = chk_appear(); cXyz& scl_mult = M_scl_mult[M_type]; - scale.x *= scl_mult.x; - scale.y *= scl_mult.y; - scale.z *= scl_mult.z; + scale *= scl_mult; phase_state = MoveBGCreate(M_arcname[M_type], dzb_data[dzb_idx][M_type], NULL, heap_size[dzb_idx][M_type]); diff --git a/src/d/actor/d_a_obj_vmc.cpp b/src/d/actor/d_a_obj_vmc.cpp index c4d5a9cae..6146c3dbb 100644 --- a/src/d/actor/d_a_obj_vmc.cpp +++ b/src/d/actor/d_a_obj_vmc.cpp @@ -86,7 +86,6 @@ BOOL daObjVmc::Act_c::solidHeapCB(fopAc_ac_c* i_this) { /* 0000009C-00000400 .text create_heap__Q28daObjVmc5Act_cFv */ bool daObjVmc::Act_c::create_heap() { - /* Nonmatching */ J3DModelData* mdl_bs_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, dRes_INDEX_VMC_BDL_VMCBS_e); JUT_ASSERT(200, mdl_bs_data != NULL); mModelBase = mDoExt_J3DModel__create(mdl_bs_data, 0, 0x11020203); @@ -137,7 +136,6 @@ bool daObjVmc::Act_c::create_heap() { /* 00000400-000005BC .text CreateInit__Q28daObjVmc5Act_cFv */ void daObjVmc::Act_c::CreateInit() { - /* Nonmatching */ fopAcM_SetMtx(this, mModelBase->getBaseTRMtx()); fopAcM_setCullSizeBox(this, -300.0f, -0.0f, -300.0, 300.0f, 500.0f, 300.0f); mStts.Init(255, 255, this); @@ -292,7 +290,6 @@ void daObjVmc::Act_c::daObjVmc_tree_main() { /* 00000EDC-000011D0 .text _execute__Q28daObjVmc5Act_cFv */ bool daObjVmc::Act_c::_execute() { - /* Nonmatching */ mCyl.SetC(current.pos); #if VERSION > VERSION_DEMO if (mState == STATE_BASE_MAIN) diff --git a/src/d/actor/d_a_salvage.cpp b/src/d/actor/d_a_salvage.cpp index 7c69d8ea1..50455ce3d 100644 --- a/src/d/actor/d_a_salvage.cpp +++ b/src/d/actor/d_a_salvage.cpp @@ -717,7 +717,7 @@ BOOL daSalvage_c::isEffectKind(int salvageId) { /* 0000240C-00002410 .text debugDraw__11daSalvage_cFv */ void daSalvage_c::debugDraw() { - /* Nonmatching */ + /* Debug Nonmatching */ } /* 00002410-00002430 .text daSalvageCreate__FPv */ diff --git a/src/d/actor/d_a_sk.cpp b/src/d/actor/d_a_sk.cpp index 713fc9454..68bc09bbb 100644 --- a/src/d/actor/d_a_sk.cpp +++ b/src/d/actor/d_a_sk.cpp @@ -254,7 +254,6 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { /* 00000A6C-00000E30 .text daSk_Create__FP10fopAc_ac_c */ static cPhs_State daSk_Create(fopAc_ac_c* a_this) { - /* Nonmatching */ static dCcD_SrcSph body_co_sph_src = { // dCcD_SrcGObjInf { diff --git a/src/d/actor/d_a_ssk.cpp b/src/d/actor/d_a_ssk.cpp index cea0077fa..b7c2032ee 100644 --- a/src/d/actor/d_a_ssk.cpp +++ b/src/d/actor/d_a_ssk.cpp @@ -330,7 +330,6 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) { /* 00000EB8-00001244 .text daSsk_Create__FP10fopAc_ac_c */ static cPhs_State daSsk_Create(fopAc_ac_c* a_this) { - /* Nonmatching */ static dCcD_SrcCyl body_co_cyl = { // dCcD_SrcGObjInf { diff --git a/src/d/actor/d_a_tsubo.cpp b/src/d/actor/d_a_tsubo.cpp index 35a862b67..57b638788 100644 --- a/src/d/actor/d_a_tsubo.cpp +++ b/src/d/actor/d_a_tsubo.cpp @@ -2829,7 +2829,7 @@ void Act_c::moment_proc_call() { if (m678 == 3) { cM3dGPla* pcVar1 = NULL; if (mAcch.ChkGroundHit()) { - pcVar1 = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd.GetBgIndex(), mAcch.m_gnd.GetPolyIndex()); + pcVar1 = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); } if (pcVar1 != NULL) { diff --git a/src/d/d_water_mark.cpp b/src/d/d_water_mark.cpp index c155e4e85..ab26954a7 100644 --- a/src/d/d_water_mark.cpp +++ b/src/d/d_water_mark.cpp @@ -32,7 +32,7 @@ BOOL dWaterMark_c::setMatrix() { mPos.y = dComIfG_Bgsp()->GroundCross(&m_ground_check); if (mPos.y != -G_CM3D_F_INF) { - cM3dGPla* tri = dComIfG_Bgsp()->GetTriPla(m_ground_check.GetBgIndex(), m_ground_check.GetPolyIndex()); + cM3dGPla* tri = dComIfG_Bgsp()->GetTriPla(m_ground_check); s16 tri_angle = cM_atan2s(tri->mNormal.x, tri->mNormal.z) - field_0x12e; f32 norm_xz_mag = tri->mNormal.absXZ();