diff --git a/configure.py b/configure.py index 6b351ecf8..1dd025db0 100755 --- a/configure.py +++ b/configure.py @@ -1425,9 +1425,9 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_agbsw0"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_andsw0"), ActorRel(Matching, "d_a_andsw2"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_att"), + ActorRel(Matching, "d_a_att"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bflower"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bita"), + ActorRel(Matching, "d_a_bita"), ActorRel(Matching, "d_a_branch"), ActorRel(Matching, "d_a_bridge"), ActorRel(Matching, "d_a_coming2"), @@ -1440,11 +1440,11 @@ config.libs = [ ActorRel(Matching, "d_a_ep"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_floor"), ActorRel(Matching, "d_a_grass"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_hitobj"), + ActorRel(Matching, "d_a_hitobj"), ActorRel(Matching, "d_a_hot_floor"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_ikari"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_jbo"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kaji"), + ActorRel(Matching, "d_a_kaji"), ActorRel(Matching, "d_a_kanban"), ActorRel(Matching, "d_a_ki"), ActorRel(Matching, "d_a_knob00"), @@ -1641,7 +1641,7 @@ config.libs = [ ActorRel(Matching, "d_a_goal_flag"), ActorRel(NonMatching, "d_a_gy"), ActorRel(NonMatching, "d_a_icelift"), - ActorRel(NonMatching, "d_a_kb"), + ActorRel(Matching, "d_a_kb"), ActorRel(NonMatching, "d_a_kddoor"), ActorRel(Matching, "d_a_kita"), ActorRel(NonMatching, "d_a_klft"), diff --git a/include/d/actor/d_a_andsw0.h b/include/d/actor/d_a_andsw0.h index cded73097..e1710ea07 100644 --- a/include/d/actor/d_a_andsw0.h +++ b/include/d/actor/d_a_andsw0.h @@ -3,8 +3,8 @@ #include "f_op/f_op_actor.h" -class andsw0_class : public fopAc_ac_c { -public: +struct andsw0_class { + /* 0x000 */ fopAc_ac_c actor; /* 0x290 */ u32 _pad[2]; /* 0x298 */ s8 mAction; /* 0x299 */ u8 mNumSwitchesToCheck; diff --git a/include/d/actor/d_a_att.h b/include/d/actor/d_a_att.h index 05a168b8d..81b7a7e51 100644 --- a/include/d/actor/d_a_att.h +++ b/include/d/actor/d_a_att.h @@ -7,13 +7,20 @@ class att_class : public fopAc_ac_c { public: /* 0x290 */ request_of_phase_process_class mPhase; - /* 0x298 */ u8 m298[0x02B5 - 0x0298]; +#if VERSION == VERSION_DEMO + /* 0x298 */ u8 m298[0x299 - 0x298]; +#else + /* 0x298 */ u8 m298[0x2B5 - 0x298]; +#endif /* 0x2B5 */ u8 m2B5; - /* 0x2B6 */ u8 m2B6[0x02B8 - 0x02B6]; + /* 0x2B6 */ u8 m2B6[0x2B8 - 0x2B6]; /* 0x2B8 */ dCcD_Stts mStts; /* 0x2F4 */ dCcD_Cyl mCyl; /* 0x424 */ dCcD_Sph mSph; /* 0x550 */ s8 m550; +#if VERSION == VERSION_DEMO + /* 0x535 */ s8 m535; +#endif }; #endif /* D_A_ATT_H */ diff --git a/include/d/actor/d_a_bomb2.h b/include/d/actor/d_a_bomb2.h index cec0e8aaf..f391eb4b2 100644 --- a/include/d/actor/d_a_bomb2.h +++ b/include/d/actor/d_a_bomb2.h @@ -72,8 +72,10 @@ namespace daBomb2 { public: void prm_get_start() const {} void prm_get_stick() const {} - static u32 prm_make(Start_e start, bool param) { // Might be wrong - return start | ((param ? 1 : 0) << 8); + static u32 prm_make(Start_e p0, bool p1) { // Might be wrong + u32 prm = 0; + prm |= (p1 ? 1 : 0) << 8; + return prm | p0; } Act_c(); diff --git a/include/d/actor/d_a_kaji.h b/include/d/actor/d_a_kaji.h index 6fe8850f2..98eb7fd47 100644 --- a/include/d/actor/d_a_kaji.h +++ b/include/d/actor/d_a_kaji.h @@ -16,8 +16,8 @@ public: void set_mtx() { mpMorf->getModel()->setBaseScale(scale); - mDoMtx_stack_c::transS(current.pos); - mDoMtx_stack_c::ZXYrotM(shape_angle); + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); MTXCopy(mDoMtx_stack_c::get(), mMtx); } diff --git a/include/d/actor/d_a_obj_ferris.h b/include/d/actor/d_a_obj_ferris.h index ff8b793bc..85160f8db 100644 --- a/include/d/actor/d_a_obj_ferris.h +++ b/include/d/actor/d_a_obj_ferris.h @@ -36,7 +36,7 @@ namespace daObjFerris { bool is_switch() const { return fopAcM_isSwitch(const_cast(this), param_get_swSave()); } void off_switch() const { return fopAcM_offSwitch(const_cast(this), param_get_swSave()); } - s32 param_get_swSave() const { return daObj::PrmAbstract(this, PRM_SWSAVE_W, PRM_SWSAVE_S); } + int param_get_swSave() const { return daObj::PrmAbstract(this, PRM_SWSAVE_W, PRM_SWSAVE_S); } bool create_heap(); cPhs_State _create(); @@ -59,7 +59,7 @@ namespace daObjFerris { public: /* 0x0290 */ dBgW* mpBgW[6]; - /* 0x02A8 */ s32 mRideState[6]; + /* 0x02A8 */ int mRideState[6]; /* 0x02C0 */ cXyz mRidePos; /* 0x02CC */ request_of_phase_process_class mPhs; /* 0x02D4 */ dCcD_Stts field_0x02d4[5]; diff --git a/src/d/actor/d_a_andsw0.cpp b/src/d/actor/d_a_andsw0.cpp index 8adada0ef..42a626c7b 100644 --- a/src/d/actor/d_a_andsw0.cpp +++ b/src/d/actor/d_a_andsw0.cpp @@ -26,6 +26,8 @@ static BOOL daAndsw0_Draw(andsw0_class*) { /* 00000080-000003C4 .text daAndsw0_check__FP12andsw0_class */ static void daAndsw0_check(andsw0_class* i_this) { + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; + s32 numToCheck = i_this->mNumSwitchesToCheck; u32 switchToCheck; if (i_this->mFirstSwitchToCheck) { @@ -37,13 +39,13 @@ static void daAndsw0_check(andsw0_class* i_this) { switch(i_this->mAction) { case ACT_ON_ALL: for(int i = 0; i < numToCheck; i++) { - if(dComIfGs_isSwitch(switchToCheck, fopAcM_GetRoomNo(i_this)) == false) { + if(dComIfGs_isSwitch(switchToCheck, fopAcM_GetRoomNo(actor)) == false) { break; } if(i == numToCheck - 1) { if(i_this->mBehaviorType != 3) { - dComIfGs_onSwitch(i_this->mSwitchToSet, fopAcM_GetRoomNo(i_this)); + dComIfGs_onSwitch(i_this->mSwitchToSet, fopAcM_GetRoomNo(actor)); } switch(i_this->mBehaviorType) { @@ -68,8 +70,8 @@ static void daAndsw0_check(andsw0_class* i_this) { u32 switchToCheck2 = i_this->mFirstSwitchToCheck ? i_this->mFirstSwitchToCheck : i_this->mSwitchToSet + 1; for(int i = 0; i < numToCheck; i++) { - if(dComIfGs_isSwitch(switchToCheck2, fopAcM_GetRoomNo(i_this)) == false) { - dComIfGs_offSwitch(i_this->mSwitchToSet, fopAcM_GetRoomNo(i_this)); + if(dComIfGs_isSwitch(switchToCheck2, fopAcM_GetRoomNo(actor)) == false) { + dComIfGs_offSwitch(i_this->mSwitchToSet, fopAcM_GetRoomNo(actor)); i_this->mAction = ACT_ON_ALL; break; } @@ -80,13 +82,13 @@ static void daAndsw0_check(andsw0_class* i_this) { break; } case ACT_TIMER: - i_this->mTimer = (i_this->home.angle.z & 0xFF) * 15; - if(fopAcM_isSwitch(i_this, i_this->mSwitchToSet)) { + i_this->mTimer = (actor->home.angle.z & 0xFF) * 15; + if(fopAcM_isSwitch(actor, i_this->mSwitchToSet)) { i_this->mAction = ACT_WAIT; } else { for(int i = 0; i < numToCheck; i++) { - if(fopAcM_isSwitch(i_this, switchToCheck)) { + if(fopAcM_isSwitch(actor, switchToCheck)) { i_this->mAction += 1; break; } @@ -100,7 +102,7 @@ static void daAndsw0_check(andsw0_class* i_this) { i_this->mTimer -= 1; if(i_this->mTimer == 0) { for(int i = 0; i < numToCheck; i++) { - fopAcM_offSwitch(i_this, switchToCheck); + fopAcM_offSwitch(actor, switchToCheck); switchToCheck += 1; } @@ -110,12 +112,12 @@ static void daAndsw0_check(andsw0_class* i_this) { switchToCheck = i_this->mFirstSwitchToCheck ? i_this->mFirstSwitchToCheck : i_this->mSwitchToSet + 1; for(int i = 0; i < numToCheck; i++) { - if(fopAcM_isSwitch(i_this, switchToCheck) == false) { + if(fopAcM_isSwitch(actor, switchToCheck) == false) { break; } if(i == numToCheck - 1) { - fopAcM_onSwitch(i_this, i_this->mSwitchToSet); + fopAcM_onSwitch(actor, i_this->mSwitchToSet); i_this->mAction = ACT_WAIT; } @@ -127,7 +129,7 @@ static void daAndsw0_check(andsw0_class* i_this) { case ACT_TIMER_SET: i_this->mTimer -= 1; if(i_this->mTimer == 0) { - fopAcM_onSwitch(i_this, i_this->mSwitchToSet); + fopAcM_onSwitch(actor, i_this->mSwitchToSet); i_this->mAction = ACT_WAIT; } @@ -225,7 +227,7 @@ static s32 hajimari_actor_entry(andsw0_class* i_this) { /* 000006AC-0000081C .text hajimarinomori_check__FP12andsw0_class */ static void hajimarinomori_check(andsw0_class* i_this) { - fopAc_ac_c* actor = i_this; + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; if (i_this->mBehaviorType == 0) { if (hajimari_actor_entry(i_this)) { i_this->mBehaviorType = 1; @@ -271,7 +273,7 @@ static void hajimarinomori_check(andsw0_class* i_this) { /* 0000081C-00000914 .text event_start_check__FP12andsw0_class */ static void event_start_check(andsw0_class* i_this) { - fopAc_ac_c* actor = i_this; + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; switch (i_this->mEventState) { case 0: if (i_this->mEventIdx != -1 && fopAcM_isSwitch(actor, i_this->mSwitchToSet)) { @@ -316,6 +318,8 @@ static BOOL daAndsw0_Delete(andsw0_class*) { /* 00000974-00000A64 .text daAndsw0_Create__FP10fopAc_ac_c */ static cPhs_State daAndsw0_Create(fopAc_ac_c* ac) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + fopAcM_ct(ac, andsw0_class); andsw0_class * i_this = (andsw0_class *)ac; diff --git a/src/d/actor/d_a_att.cpp b/src/d/actor/d_a_att.cpp index f3974facd..36cbe0c20 100644 --- a/src/d/actor/d_a_att.cpp +++ b/src/d/actor/d_a_att.cpp @@ -6,6 +6,7 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_att.h" #include "d/d_com_inf_game.h" +#include "d/d_s_play.h" #include "f_op/f_op_actor_mng.h" #include "d/actor/d_a_bgn.h" @@ -36,6 +37,7 @@ static BOOL daAtt_Execute(att_class* i_this) { dComIfG_Ccsp()->Set(&i_this->mSph); } #endif + if (i_this->m2B5 == 100) { i_this->attention_info.position = i_this->eyePos = i_this->current.pos; } else { @@ -49,12 +51,21 @@ static BOOL daAtt_Execute(att_class* i_this) { i_this->m550--; } +#if VERSION == VERSION_DEMO + if (i_this->m535 != 0) { + i_this->m535--; + } +#endif + if (i_this->m550 == 0 && (i_this->mCyl.ChkTgHit() || i_this->mSph.ChkTgHit())) { i_this->m550 = 10; boss->mAAA8[r30].m308--; if (boss->mAAA8[r30].m308 <= 0) { +#if VERSION == VERSION_DEMO + i_this->m535 = 30; +#endif boss->mAAA8[r30].m2D0 = 1; - boss->mAAA8[r30].m304 = 6000.0f; + boss->mAAA8[r30].m304 = 6000.0f + DEMO_SELECT(REG6_F(3), 0.0f); mDoAud_seStart(JA_SE_LK_W_WEP_HIT, NULL, 0x21, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); if (r30 <= 1) { if (boss->mAAA8[1-r30].m2D0 != 0) { @@ -62,31 +73,51 @@ static BOOL daAtt_Execute(att_class* i_this) { } } } else { - boss->mAAA8[r30].m300 = 15; + boss->mAAA8[r30].m300 = 15 + DEMO_SELECT(REG6_S(7), 0); mDoAud_seStart(JA_SE_CM_BGN_D_STRING_PLINK, NULL, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); } } i_this->current.pos = boss->mC33C[r30]; +#if VERSION == VERSION_DEMO + cXyz sp24 = i_this->current.pos - i_this->old.pos; +#endif cXyz sp08 = i_this->current.pos; if ( - boss->m02B5 == 0 - && - (boss->mC748 != 0 || boss->mC74C != 0 || r30 != 7) - && - (boss->mAAA8[r30].m2D0 == 0 && boss->mAAA8[r30].m2EC < 1.0f) + ( + boss->m02B5 == 0 && +#if VERSION == VERSION_DEMO + sp24.abs() < 100.0f + REG17_F(16) && +#else + (boss->mC748 != 0 || boss->mC74C != 0 || r30 != 7) && +#endif + boss->mAAA8[r30].m2D0 == 0 && + boss->mAAA8[r30].m2EC < 1.0f + ) +#if VERSION == VERSION_DEMO + || i_this->m535 != 0 +#endif ) { +#if VERSION > VERSION_DEMO i_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e; - i_this->mCyl.SetR(200.0f); +#endif + i_this->mCyl.SetR(200.0f + DEMO_SELECT(REG0_F(16), 0.0f)); i_this->mCyl.SetC(sp08); - sp08.y += 1000.0f; + sp08.y += 1000.0f + DEMO_SELECT(REG13_F(3), 0.0f); i_this->mSph.SetC(sp08); - i_this->eyePos = sp08; - i_this->attention_info.position = sp08; +#if VERSION == VERSION_DEMO + if (i_this->m535 == 0) +#endif + { + i_this->eyePos = sp08; + i_this->attention_info.position = sp08; + } } else { +#if VERSION > VERSION_DEMO fopAcM_OffStatus(i_this, 0); i_this->attention_info.flags = 0; +#endif i_this->mCyl.SetC(non_pos); i_this->mSph.SetC(non_pos); } diff --git a/src/d/actor/d_a_bflower.cpp b/src/d/actor/d_a_bflower.cpp index b8f401f56..bf86ca736 100644 --- a/src/d/actor/d_a_bflower.cpp +++ b/src/d/actor/d_a_bflower.cpp @@ -117,7 +117,7 @@ BOOL daBFlower_c::CreateHeap() { } J3DModelData* modelData = static_cast(dComIfG_getObjectRes(m_arcname, dRes_INDEX_VBAKH_BDL_VBAKH_e)); - JUT_ASSERT(0x1B2, modelData != NULL); + JUT_ASSERT(DEMO_SELECT(429, 434), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022); if (mpModel == NULL) { @@ -125,7 +125,7 @@ BOOL daBFlower_c::CreateHeap() { } J3DAnmTransform* pbck = static_cast(dComIfG_getObjectRes(m_arcname, dRes_INDEX_VBAKH_BCK_VBAHX_e)); - JUT_ASSERT(0x1C3, pbck != NULL); + JUT_ASSERT(DEMO_SELECT(446, 451), pbck != NULL); if (!mBck1.init(modelData, pbck, TRUE, J3DFrameCtrl::EMode_RESET)) { return FALSE; @@ -133,7 +133,7 @@ BOOL daBFlower_c::CreateHeap() { mBck1.setFrame(mBck1.getEndFrame()); J3DAnmTevRegKey* pbrk = static_cast(dComIfG_getObjectRes(m_arcname, dRes_INDEX_VBAKH_BRK_VBAHX_e)); - JUT_ASSERT(0x1D9, pbrk != NULL); + JUT_ASSERT(DEMO_SELECT(468, 473), pbrk != NULL); if (!mBrk1.init(modelData, pbrk, TRUE, J3DFrameCtrl::EMode_NONE)) { return FALSE; @@ -141,7 +141,7 @@ BOOL daBFlower_c::CreateHeap() { mBrk1.setPlaySpeed(0.0f); modelData = static_cast(dComIfG_getObjectRes(m_arcname, dRes_INDEX_VBAKH_BDL_VBAKM_e)); - JUT_ASSERT(0x1E7, modelData != NULL); + JUT_ASSERT(DEMO_SELECT(482, 487), modelData != NULL); mpModel2 = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022); if (mpModel2 == NULL) { @@ -149,7 +149,7 @@ BOOL daBFlower_c::CreateHeap() { } pbck = static_cast(dComIfG_getObjectRes(m_arcname, dRes_INDEX_VBAKH_BCK_VBAMX_e)); - JUT_ASSERT(0x1F7, pbck != NULL); + JUT_ASSERT(DEMO_SELECT(498, 503), pbck != NULL); if (!mBck2.init(modelData, pbck, TRUE, J3DFrameCtrl::EMode_NONE)) { return FALSE; @@ -157,7 +157,7 @@ BOOL daBFlower_c::CreateHeap() { mBck2.setPlaySpeed(0.0f); pbrk = static_cast(dComIfG_getObjectRes(m_arcname, dRes_INDEX_VBAKH_BRK_VBAMX_e)); - JUT_ASSERT(0x208, pbrk != NULL); + JUT_ASSERT(DEMO_SELECT(515, 520), pbrk != NULL); if (!mBrk2.init(modelData, pbrk, TRUE, J3DFrameCtrl::EMode_NONE)) { return FALSE; @@ -306,7 +306,8 @@ BOOL daBFlower_c::actLive() { fopAc_ac_c* pActor = fopAcM_SearchByID(mPrevGrabActorID); if (pActor != NULL) { - if ((pActor->current.pos - current.pos).absXZ() < 70.0f) { + f32 temp = (pActor->current.pos - current.pos).absXZ(); + if (temp < 70.0f) { init_bck_anm(dRes_INDEX_VBAKH_BCK_VBAKH_e); } } @@ -343,7 +344,11 @@ BOOL daBFlower_c::actLive() { cCcD_Obj* tg = mSph.GetTgHitObj(); if (tg != NULL) { if (tg->ChkAtType(AT_TYPE_BOMB)) { - mpBombActor = static_cast(fopAcM_fastCreate(fpcNm_Bomb2_e, daBomb2::Act_c::prm_make(daBomb2::Start_UNK0_e, true), ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle)); + bool b = true; + u32 prm = daBomb2::Act_c::prm_make(daBomb2::Start_UNK0_e, b); + mpBombActor = static_cast(fopAcM_fastCreate( + fpcNm_Bomb2_e, prm, ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle) + ); m58C = 0; } else if (tg->ChkAtType(~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT))) { // TODO: simplify @@ -352,8 +357,9 @@ BOOL daBFlower_c::actLive() { b = true; } u32 prm = daBomb2::Act_c::prm_make(daBomb2::Start_UNK1_e, b); - - mpBombActor = static_cast(fopAcM_fastCreate(fpcNm_Bomb2_e, prm, ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle)); + mpBombActor = static_cast(fopAcM_fastCreate( + fpcNm_Bomb2_e, prm, ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle) + ); m58C = 0; } } @@ -364,7 +370,11 @@ BOOL daBFlower_c::actLive() { if (fopAcM_checkCarryNow(this) && m58D != 0) { m58C = 0; - mpBombActor = static_cast(fopAcM_fastCreate(fpcNm_Bomb2_e, daBomb2::Act_c::prm_make(daBomb2::Start_UNK2_e, false), ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle)); + bool b = false; + u32 prm = daBomb2::Act_c::prm_make(daBomb2::Start_UNK2_e, b); + mpBombActor = static_cast(fopAcM_fastCreate( + fpcNm_Bomb2_e, prm, ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle) + ); fopAcM_cancelCarryNow(this); if (mpBombActor != NULL) { @@ -482,7 +492,7 @@ bool daBFlower_c::_draw() { } bool daBFlower_c::_delete() { - dComIfG_resDelete(&mPhs, m_arcname); + dComIfG_resDeleteDemo(&mPhs, m_arcname); return TRUE; } diff --git a/src/d/actor/d_a_bita.cpp b/src/d/actor/d_a_bita.cpp index 723e95c70..45ac46493 100644 --- a/src/d/actor/d_a_bita.cpp +++ b/src/d/actor/d_a_bita.cpp @@ -155,9 +155,13 @@ static BOOL daBita_IsDelete(bita_class* i_this) { /* 0000071C-00000778 .text daBita_Delete__FP10bita_class */ static BOOL daBita_Delete(bita_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "Bita"); + dComIfG_resDeleteDemo(&i_this->mPhs, "Bita"); +#if VERSION > VERSION_DEMO if (i_this->heap != NULL) +#endif + { dComIfG_Bgsp()->Release(i_this->mpBgW); + } return TRUE; } @@ -170,14 +174,14 @@ static BOOL useHeapInit(fopAc_ac_c* i_ac) { type = 1; J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Bita", ita_bmd[type]); - JUT_ASSERT(0x23b, modelData != NULL); + JUT_ASSERT(DEMO_SELECT(562, 571), modelData != NULL); J3DModel* model = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (model == NULL) return FALSE; i_this->mpModel = model; modelData = (J3DModelData*)dComIfG_getObjectRes("Bita", ita_Ef_bmd[type]); - JUT_ASSERT(0x247, modelData != NULL); + JUT_ASSERT(DEMO_SELECT(574, 583), modelData != NULL); model = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (model == NULL) return FALSE; @@ -233,11 +237,12 @@ static cPhs_State daBita_Create(fopAc_ac_c* i_ac) { }}, }; - fopAcM_ct(i_ac, bita_class); + fopAcM_ct_Retail(i_ac, bita_class); bita_class* i_this = (bita_class*)i_ac; cPhs_State rt = dComIfG_resLoad(&i_this->mPhs, "Bita"); if (rt == cPhs_COMPLEATE_e) { + fopAcM_ct_Demo(i_ac, bita_class); btd = NULL; i_this->mType = (fopAcM_GetParam(i_this) >> 0) & 0xFF; i_this->mPrmScale = (fopAcM_GetParam(i_this) >> 8) & 0xFF; diff --git a/src/d/actor/d_a_bmdfoot.cpp b/src/d/actor/d_a_bmdfoot.cpp index cfc8830f8..e33bb312a 100644 --- a/src/d/actor/d_a_bmdfoot.cpp +++ b/src/d/actor/d_a_bmdfoot.cpp @@ -75,7 +75,7 @@ static BOOL daBmdfoot_Draw(bmdfoot_class* i_this) { } /* 000002B0-000003D8 .text anm_init__FP13bmdfoot_classifUcfi */ -void anm_init(bmdfoot_class* i_this, int bckFileIdx, f32 morf, unsigned char loopMode, f32 speed, int soundFileIdx) { +static void anm_init(bmdfoot_class* i_this, int bckFileIdx, f32 morf, unsigned char loopMode, f32 speed, int soundFileIdx) { if (soundFileIdx >= 0) { i_this->mpBodyVineMorf->setAnm( (J3DAnmTransform*)dComIfG_getObjectRes("Bmdfoot", bckFileIdx), loopMode, morf, speed, 0.0f, -1.0f, dComIfG_getObjectRes("Bmdfoot", soundFileIdx) @@ -86,7 +86,7 @@ void anm_init(bmdfoot_class* i_this, int bckFileIdx, f32 morf, unsigned char loo } /* 000003D8-00000440 .text housi_off__FP13bmdfoot_class */ -void housi_off(bmdfoot_class* i_this) { +static void housi_off(bmdfoot_class* i_this) { for (int i = 0; i < ARRAY_SSIZE(i_this->mAsiWaitFollowCB); i++) { if (i_this->mAsiWaitFollowCB[i].getEmitter() != NULL) { i_this->mAsiWaitFollowCB[i].getEmitter()->stopCreateParticle(); @@ -98,13 +98,13 @@ void housi_off(bmdfoot_class* i_this) { } /* 00000440-00000840 .text wait__FP13bmdfoot_class */ -void wait(bmdfoot_class* i_this) { +static void wait(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; cXyz local_98; static int eff_id[] = {ASI_JNT_ASI11_e, ASI_JNT_ASI13_e, ASI_JNT_ASI18_e}; int frame = i_this->mpBodyVineMorf->getFrame(); - local_98.setall(0.0f); + local_98.set(0.0f, 0.0f, 0.0f); for (int i = 0; i < ARRAY_SSIZE(i_this->m3F8); i++) { MTXCopy(i_this->mpBodyVineMorf->getModel()->getAnmMtx(eff_id[i]), *calc_mtx); @@ -170,7 +170,7 @@ void wait(bmdfoot_class* i_this) { } /* 0000087C-00000D8C .text attack_1__FP13bmdfoot_class */ -void attack_1(bmdfoot_class* i_this) { +static void attack_1(bmdfoot_class* i_this) { /* Nonmatching - retail-only regalloc */ fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; cXyz local_5c; @@ -179,7 +179,7 @@ void attack_1(bmdfoot_class* i_this) { static int col_joint[] = {ASI_JNT_ASI2_e, ASI_JNT_ASI4_e, ASI_JNT_ASI6_e, ASI_JNT_ASI8_e, ASI_JNT_ASI10_e}; bool bVar2 = false; - local_5c.setall(0.0f); + local_5c.set(0.0f, 0.0f, 0.0f); switch (i_this->m2BC) { case 0: @@ -264,13 +264,13 @@ void attack_1(bmdfoot_class* i_this) { } /* 00000D8C-00001180 .text ug_move__FP13bmdfoot_class */ -int ug_move(bmdfoot_class* i_this) { +static int ug_move(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; cXyz local_4c; cXyz cStack_58; cXyz local_64; - daPy_py_c* player = daPy_getPlayerActorClass(); + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); u32 uVar4 = 0; switch (i_this->mBA8) { case 0: @@ -286,9 +286,7 @@ int ug_move(bmdfoot_class* i_this) { dPa_name::ID_AK_ST_BKMLATTACKSMOKE01, &i_this->mBAC, &i_this->mBB8, NULL, 0xB9, &i_this->mLAttackSmoke01CB, (u8)actor->current.roomNo ); break; - case 0xa: - break; - case 2: + case 2: { local_64 = player->current.pos - i_this->mBAC; f32 dVar5 = (local_64.abs() * 10.0f); if (dVar5 > (REG14_F(14) + 10000.0f)) { @@ -314,6 +312,9 @@ int ug_move(bmdfoot_class* i_this) { } break; } + case 10: + break; + } MtxTrans(i_this->mBAC.x, i_this->mBAC.y, i_this->mBAC.z, false); cMtx_YrotM(*calc_mtx, i_this->mBB8.y); J3DModel* model = i_this->mpFloorVineMorf->getModel(); @@ -324,7 +325,7 @@ int ug_move(bmdfoot_class* i_this) { } /* 00001180-00001B00 .text attack_2__FP13bmdfoot_class */ -void attack_2(bmdfoot_class* i_this) { +static void attack_2(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; J3DAnmTransform* pBck; cXyz local_3c; @@ -451,7 +452,7 @@ void attack_2(bmdfoot_class* i_this) { } /* 00001B00-00001CDC .text damage__FP13bmdfoot_class */ -void damage(bmdfoot_class* i_this) { +static void damage(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; f32 dVar5; @@ -481,7 +482,7 @@ void damage(bmdfoot_class* i_this) { } /* 00001CDC-00001ED8 .text start__FP13bmdfoot_class */ -void start(bmdfoot_class* i_this) { +static void start(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { @@ -522,7 +523,7 @@ void start(bmdfoot_class* i_this) { } /* 00001ED8-00001FB8 .text end__FP13bmdfoot_class */ -void end(bmdfoot_class* i_this) { +static void end(bmdfoot_class* i_this) { for (int i = 2; i <= ARRAY_SSIZE(i_this->m3A4); i++) { i_this->m2CC[i].z = 0; i_this->m3A4[i] = 0; @@ -536,7 +537,7 @@ void end(bmdfoot_class* i_this) { } /* 00001FB8-000021B8 .text move__FP13bmdfoot_class */ -void move(bmdfoot_class* i_this) { +static void move(bmdfoot_class* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; cXyz local_20; cXyz cStack_2c; @@ -573,7 +574,7 @@ void move(bmdfoot_class* i_this) { case 10: start(i_this); break; - case 0xb: + case 11: end(i_this); break; } @@ -682,7 +683,7 @@ static BOOL daBmdfoot_Delete(bmdfoot_class* i_this) { } /* 000026B0-000029B4 .text useHeapInit__FP13bmdfoot_class */ -int useHeapInit(bmdfoot_class* i_this) { +static int useHeapInit(bmdfoot_class* i_this) { i_this->mpBodyVineMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("Bmdfoot", dRes_INDEX_BMDFOOT_BMD_ASI_e), NULL, diff --git a/src/d/actor/d_a_hitobj.cpp b/src/d/actor/d_a_hitobj.cpp index c0968e791..b90da86eb 100644 --- a/src/d/actor/d_a_hitobj.cpp +++ b/src/d/actor/d_a_hitobj.cpp @@ -38,13 +38,15 @@ static BOOL daHitobj_IsDelete(hitobj_class* i_this) { /* 000000F0-00000120 .text daHitobj_Delete__FP12hitobj_class */ static BOOL daHitobj_Delete(hitobj_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "Hitobj"); + dComIfG_resDeleteDemo(&i_this->mPhs, "Hitobj"); return TRUE; } /* 00000120-0000025C .text daHitobj_Create__FP10fopAc_ac_c */ static cPhs_State daHitobj_Create(fopAc_ac_c* pActor) { hitobj_class* i_this = (hitobj_class*)pActor; + fopAc_ac_c* player = dComIfGp_getPlayer(0); + fopAcM_ct(i_this, hitobj_class); cPhs_State res = dComIfG_resLoad(&(i_this->mPhs), "Hitobj"); diff --git a/src/d/actor/d_a_kaji.cpp b/src/d/actor/d_a_kaji.cpp index fb94d69a1..0c8c0def8 100644 --- a/src/d/actor/d_a_kaji.cpp +++ b/src/d/actor/d_a_kaji.cpp @@ -41,14 +41,15 @@ BOOL daKaji_c::CreateHeap() { } cPhs_State daKaji_c::_create() { - fopAcM_ct(this, daKaji_c); + fopAcM_ct_Retail(this, daKaji_c); cPhs_State phase_state = dComIfG_resLoad(&mPhs, M_arcname); if (phase_state == cPhs_COMPLEATE_e) { + fopAcM_ct_Demo(this, daKaji_c); if (fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x660)) { - mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::YrotM(shape_angle.y); - mDoMtx_stack_c::scaleM(scale); + mDoMtx_stack_c::scaleM(scale.x, scale.y, scale.z); MTXCopy(mDoMtx_stack_c::get(), mMtx); l_p_ship = (daObjPirateship::Act_c*)fopAcM_SearchByID(parentActorID); @@ -66,7 +67,7 @@ cPhs_State daKaji_c::_create() { } bool daKaji_c::_delete() { - dComIfG_resDelete(&mPhs, M_arcname); + dComIfG_resDeleteDemo(&mPhs, M_arcname); return TRUE; } diff --git a/src/d/actor/d_a_kb.cpp b/src/d/actor/d_a_kb.cpp index 72db2fc25..9a74475a4 100644 --- a/src/d/actor/d_a_kb.cpp +++ b/src/d/actor/d_a_kb.cpp @@ -1733,8 +1733,6 @@ void attack_move(kb_class* i_this) { /* 0000519C-000054A8 .text money_drop__FP8kb_class */ void money_drop(kb_class* i_this) { - /* Nonmatching - regalloc */ - fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; int i; @@ -1754,12 +1752,13 @@ void money_drop(kb_class* i_this) { i_this->m407 = 0; + u32 temp2; for(i = 0; i < 2; i++) { f32 rnd = cM_rnd(); if(REG8_S(4) == 0) { if(rnd < 0.9f) { rnd *= 10.0f; - u32 temp2 = gold_rate_dt[(int)(0.3f * rnd)]; + temp2 = gold_rate_dt[(int)(0.3f * rnd)]; i_this->m407 = 1; cMtx_YrotS(*calc_mtx, cM_rndFX(0x8000)); temp3.set(0.0f, 0.0f, 20.0f); @@ -1780,7 +1779,7 @@ void money_drop(kb_class* i_this) { f32 rnd = cM_rnd(); if(rnd < 0.9f) { rnd *= 10.0f; - u32 temp2 = item_rate_dt[(int)(0.3f * rnd)]; + temp2 = item_rate_dt[(int)(0.3f * rnd)]; i_this->m407 = 1; cMtx_YrotS(*calc_mtx, cM_rndFX(0x8000)); temp3.set(0.0f, 0.0f, 20.0f); @@ -1801,11 +1800,10 @@ void money_drop(kb_class* i_this) { /* 000054A8-00006670 .text esa_demo_move__FP8kb_class */ void esa_demo_move(kb_class* i_this) { - /* Nonmatching - regalloc */ - fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; - daPy_py_c* pPlayer = daPy_getPlayerActorClass(); + fopAc_ac_c* player_actor = dComIfGp_getPlayer(0); + daPy_py_c* player = (daPy_py_c*)player_actor; camera_process_class* pCamera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); dBgS_LinChk linChk; @@ -1827,8 +1825,8 @@ void esa_demo_move(kb_class* i_this) { break; } - pPlayer->changeOriginalDemo(); - pPlayer->changeDemoMode(daPy_demo_c::DEMO_N_WAIT_e); + player->changeOriginalDemo(); + player->changeDemoMode(daPy_demo_c::DEMO_N_WAIT_e); pCamera->mCamera.Stop(); pCamera->mCamera.SetTrimSize(2); @@ -2025,17 +2023,17 @@ void esa_demo_move(kb_class* i_this) { case 0x2E: if(i_this->m426[0] == 0x23) { if(i_this->m407) { - pPlayer->changeDemoMode(daPy_demo_c::DEMO_SMILE_e); + player->changeDemoMode(daPy_demo_c::DEMO_SMILE_e); } else { - pPlayer->changeDemoMode(daPy_demo_c::DEMO_UNK_018_e); + player->changeDemoMode(daPy_demo_c::DEMO_UNK_018_e); } } if(i_this->m426[0] == 0) { actor->shape_angle.x = -0x7FFF; - pPlayer->changeDemoMode(daPy_demo_c::DEMO_N_WAIT_e); + player->changeDemoMode(daPy_demo_c::DEMO_N_WAIT_e); i_this->m5D4[1] = actor->current.pos; i_this->m5D4[1].y = i_this->mAcch.GetGroundH() + 15.0f + REG8_F(0x11); @@ -2104,7 +2102,7 @@ void esa_demo_move(kb_class* i_this) { fopAcM_monsSeStart(actor, JA_SE_CM_PG_L_JUMP, 0); } - pPlayer->cancelOriginalDemo(); + player->cancelOriginalDemo(); pCamera->mCamera.Reset(i_this->m520, i_this->m514); pCamera->mCamera.Start(); @@ -2128,7 +2126,7 @@ void esa_demo_move(kb_class* i_this) { if(i_this->m420 >= 0x2A) { pCamera->mCamera.Set(i_this->m520, i_this->m514, i_this->m53C, 0); - pPlayer->setPlayerPosAndAngle(&pPlayer->current.pos, fopAcM_searchActorAngleY(pPlayer, actor)); + player->setPlayerPosAndAngle(&player_actor->current.pos, fopAcM_searchActorAngleY(player_actor, actor)); } } @@ -2376,7 +2374,6 @@ static BOOL daKb_Delete(kb_class* i_this) { /* 00006F28-000071F4 .text useHeapInit__FP10fopAc_ac_c */ static BOOL useHeapInit(fopAc_ac_c* i_actor) { - /* Nonmatching - regalloc */ kb_class* i_this = (kb_class*)i_actor; J3DModelData* pModelData; @@ -2427,7 +2424,7 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) { tex_anm_set(i_this, temp); i_this->mpMaterialTable = (J3DMaterialTable*)dComIfG_getObjectRes("Kb", kb_bmt_idx[temp]); - i_this->mpMorf->getModel()->setUserArea((u32)i_this); + i_this->mpMorf->getModel()->setUserArea((u32)i_actor); for (u16 i = 0; i < i_this->mpMorf->getModel()->getModelData()->getJointNum(); i++) { i_this->mpMorf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); diff --git a/src/d/actor/d_a_msw.cpp b/src/d/actor/d_a_msw.cpp index 1d3badf2e..4f22d65d9 100644 --- a/src/d/actor/d_a_msw.cpp +++ b/src/d/actor/d_a_msw.cpp @@ -17,7 +17,8 @@ static void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { cMtx_YrotS(*calc_mtx, -i_ac->current.angle.y); - cXyz tmp = i_pt->current.pos - i_ac->current.pos; + cXyz tmp; + tmp = i_pt->current.pos - i_ac->current.pos; cXyz pos1; MtxPosition(&tmp, &pos1); cXyz pos2; @@ -58,10 +59,10 @@ void chain_Draw(msw_class* i_this) { s32 angle2; for (int i = 0; i < 4; i++) { - cXyz tmp = i_this->m310[i] - i_this->m2E0[i]; + cXyz tmp; + tmp = i_this->m310[i] - i_this->m2E0[i]; angle1 = -cM_atan2s(tmp.y, tmp.z); - // TODO: std::sqrtf(float) angle2 = cM_atan2s(tmp.x, std::sqrtf(tmp.y * tmp.y + tmp.z * tmp.z)); MtxTrans(i_this->m2E0[i].x, i_this->m2E0[i].y, i_this->m2E0[i].z, false); diff --git a/src/d/actor/d_a_obj_ferris.cpp b/src/d/actor/d_a_obj_ferris.cpp index 63ee40a64..e75c587c2 100644 --- a/src/d/actor/d_a_obj_ferris.cpp +++ b/src/d/actor/d_a_obj_ferris.cpp @@ -87,7 +87,7 @@ BOOL daObjFerris::Act_c::solidHeapCB(fopAc_ac_c* i_this) { /* 00000110-0000048C .text create_heap__Q211daObjFerris5Act_cFv */ bool daObjFerris::Act_c::create_heap() { - s32 i; + int i; J3DModelData* mdl_data_gondola = static_cast(dComIfG_getObjectRes(M_arcname, dRes_INDEX_SKANRAN_BDL_SGONDOR_e)); JUT_ASSERT(0x183, mdl_data_gondola != NULL); if (VERSION == VERSION_DEMO || mdl_data_gondola != NULL) { @@ -113,13 +113,15 @@ bool daObjFerris::Act_c::create_heap() { if (VERSION == VERSION_DEMO || bgw_data_gondola != NULL) { for (i = 0; i < 5; i++) { mpBgW[i] = new dBgW(); - if (mpBgW[i] != NULL && mpBgW[i]->Set(bgw_data_gondola, dBgW::MOVE_BG_e, &mMtx[i]) == true) { #if VERSION == VERSION_DEMO + if (mpBgW[i] != NULL && mpBgW[i]->Set(bgw_data_gondola, dBgW::MOVE_BG_e, &mMtx[i])) { r29 |= 1; -#else - return false; -#endif } +#else + if (mpBgW[i] != NULL && mpBgW[i]->Set(bgw_data_gondola, dBgW::MOVE_BG_e, &mMtx[i]) == true) { + return false; + } +#endif } } @@ -128,13 +130,15 @@ bool daObjFerris::Act_c::create_heap() { if (VERSION == VERSION_DEMO || bgw_data_wheelbase != NULL) { int r24 = 5; mpBgW[r24] = new dBgW(); - if (mpBgW[r24] != NULL && mpBgW[r24]->Set(bgw_data_wheelbase, dBgW::MOVE_BG_e, &mMtx[r24]) == true) { #if VERSION == VERSION_DEMO + if (mpBgW[r24] != NULL && mpBgW[r24]->Set(bgw_data_wheelbase, dBgW::MOVE_BG_e, &mMtx[r24])) { r29 |= 1; -#else - return false; -#endif } +#else + if (mpBgW[r24] != NULL && mpBgW[r24]->Set(bgw_data_wheelbase, dBgW::MOVE_BG_e, &mMtx[r24]) == true) { + return false; + } +#endif } #if VERSION == VERSION_DEMO @@ -150,7 +154,7 @@ bool daObjFerris::Act_c::create_heap() { /* 0000048C-000004DC .text ride_call_back__Q211daObjFerris5Act_cFP4dBgWP10fopAc_ac_cP10fopAc_ac_c */ void daObjFerris::Act_c::ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { Act_c* i_this = (Act_c*)i_ac; - for (s32 i = 0; i < 5; i++) { + for (int i = 0; i < 5; i++) { if (i_this->mpBgW[i] == bgw) { i_this->mRidePos = i_pt->current.pos; i_this->mRideState[i] = 1; @@ -165,7 +169,7 @@ cPhs_State daObjFerris::Act_c::_create() { cPhs_State ret = dComIfG_resLoad(&mPhs, M_arcname); - s32 i; + int i; if (ret == cPhs_COMPLEATE_e) { if (fopAcM_entrySolidHeap(this, solidHeapCB, 0x11a00)) { fopAcM_SetMtx(this, mpModel[5]->getBaseTRMtx()); @@ -219,14 +223,23 @@ cPhs_State daObjFerris::Act_c::_create() { /* 00000DE8-00000EA8 .text _delete__Q211daObjFerris5Act_cFv */ bool daObjFerris::Act_c::_delete() { +#if VERSION == VERSION_DEMO + for (int i = 0; i < 6; i++) { + if (mpBgW[i]->ChkUsed()) { + mpBgW[i]->SetRideCallback(NULL); + dComIfG_Bgsp()->Release(mpBgW[i]); + } + } +#else if (heap != NULL) { - for (s32 i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { if (mpBgW[i] != NULL && mpBgW[i]->ChkUsed()) { mpBgW[i]->SetRideCallback(NULL); dComIfG_Bgsp()->Release(mpBgW[i]); } } } +#endif dComIfG_resDelete(&mPhs, M_arcname); return true; @@ -265,7 +278,7 @@ void daObjFerris::Act_c::set_mtx(int idx) { /* 000011B8-00001240 .text init_mtx__Q211daObjFerris5Act_cFv */ void daObjFerris::Act_c::init_mtx() { - for (s32 i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { mpModel[i]->setBaseScale(scale); set_mtx(i); mpModel[i]->calc(); @@ -418,7 +431,7 @@ void daObjFerris::Act_c::rot_mng() { /* 000016C0-00001A50 .text set_collision__Q211daObjFerris5Act_cFv */ void daObjFerris::Act_c::set_collision() { - for (s32 i = 0; i < 5; i++) { + for (int i = 0; i < 5; i++) { static cXyz zero_offset(0.0f, 0.0f, 0.0f); cXyz pt; mDoMtx_multVec(mMtx[i], &zero_offset, &pt); @@ -447,7 +460,7 @@ void daObjFerris::Act_c::set_collision() { cXyz(2.82f, -1045.59f, 37.63f), }; - for (s32 i = 0; i < 5; i++) { + for (int i = 0; i < 5; i++) { static cXyz zero_offset(0.0f, 0.0f, 0.0f); mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::YrotM(shape_angle.y); @@ -478,35 +491,30 @@ void daObjFerris::Act_c::make_lean() { cXyz delta; cXyz delta2; - Mtx* mtx; - s32* pRideState; // Fakematch? - for (s32 i = 0; i < 5; i++) { - pRideState = &mRideState[i]; - if (*pRideState == 1) { - mtx = &mMtx[i]; - mDoMtx_multVec(*mtx, &offs0, &pt0); - mDoMtx_multVec(*mtx, &offs1, &pt1); + for (int i = 0; i < 5; i++) { + if (mRideState[i] == 1) { + mDoMtx_multVec(mMtx[i], &offs0, &pt0); + mDoMtx_multVec(mMtx[i], &offs1, &pt1); delta.set(pt1.x - pt0.x, 0.0f, pt1.z - pt0.z); - delta2.set(mRidePos.x - pt0.x, 0.0f, mRidePos.z - pt0.z); delta.normalizeRS(); - f32 z = -delta.z; - f32 h = std::fabsf(-(z * pt0.x + delta.x * pt0.z) + (z * mRidePos.x + delta.x * mRidePos.z)); + f32 temp2 = -delta.z; + f32 h = std::fabsf(-(temp2 * pt0.x + delta.x * pt0.z) + (temp2 * mRidePos.x + delta.x * mRidePos.z)); f32 temp = delta.x * delta2.z - delta.z * delta2.x; - h /= 162.0f; + f32 h2 = h / 162.0f; if (temp < 0.0f) { - mRideWaveTarget[i] = h * 550.0f; + mRideWaveTarget[i] = h2 * 550.0f; } else { - mRideWaveTarget[i] = h * -550.0f; + mRideWaveTarget[i] = h2 * -550.0f; } } else { mRideWaveTarget[i] = 0; } cLib_addCalcAngleS2(&mRideWaveAngle[i], mRideWaveTarget[i], 4, 0x1000); - *pRideState = 0; + mRideState[i] = 0; } } @@ -519,7 +527,7 @@ bool daObjFerris::Act_c::_execute() { rot_mng(); exe_event(); make_lean(); - for (s32 i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { set_mtx(i); if (i < 6) mpBgW[i]->Move(); @@ -533,7 +541,7 @@ bool daObjFerris::Act_c::_execute() { bool daObjFerris::Act_c::_draw() { dKy_getEnvlight().settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &tevStr); dComIfGd_setListBG(); - for (s32 i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { dKy_getEnvlight().setLightTevColorType(mpModel[i], &tevStr); mDoExt_modelUpdateDL(mpModel[i]); } diff --git a/src/d/actor/d_a_tbox.cpp b/src/d/actor/d_a_tbox.cpp index dec216d1c..7ef12ae68 100644 --- a/src/d/actor/d_a_tbox.cpp +++ b/src/d/actor/d_a_tbox.cpp @@ -1051,12 +1051,11 @@ BOOL daTbox_c::actionGenocide() { /* 00002C10-00002FB0 .text draw__8daTbox_cFv */ BOOL daTbox_c::draw() { - u8 tboxNo; - if (mRoomNo != -1 && !checkRoomDisp(mRoomNo)) { return TRUE; } + u8 tboxNo; if (flagCheck(daTboxFlg_UNK_01) || (checkEnv() && flagCheck(daTboxFlg_UNK_04))) { tboxNo = mTboxNo; } @@ -1071,11 +1070,11 @@ BOOL daTbox_c::draw() { tevStr.mRoomNo = mRoomNo; g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); + J3DModelData* modelData; if (getFuncType() == FUNC_TYPE_TACT) { - J3DModelData* platMdlData = mpTactPlatformMdl->getModelData(); - + modelData = mpTactPlatformMdl->getModelData(); g_env_light.setLightTevColorType(mpTactPlatformMdl, &tevStr); - mTactPlatformBrk.entry(platMdlData); + mTactPlatformBrk.entry(modelData); mDoExt_modelUpdateDL(mpTactPlatformMdl); } @@ -1085,14 +1084,14 @@ BOOL daTbox_c::draw() { g_env_light.setLightTevColorType(mpChestMdl, &tevStr); - J3DModelData* chestMdlData = mpChestMdl->getModelData(); - mOpenAnm.entry(chestMdlData); + modelData = mpChestMdl->getModelData(); + mOpenAnm.entry(modelData); if (mpAppearTexAnm != NULL) { - mpAppearTexAnm->entry(chestMdlData); + mpAppearTexAnm->entry(modelData); } if (mpAppearRegAnm != NULL) { - mpAppearRegAnm->entry(chestMdlData); + mpAppearRegAnm->entry(modelData); } if (checkEnv() && flagCheck(daTboxFlg_UNK_04)) { @@ -1101,8 +1100,8 @@ BOOL daTbox_c::draw() { float interpVal = (scrollOffset - offsetAsU8) * 0.5f + 0.5f; - for (u8 i = 0; i < chestMdlData->getMaterialNum(); i++) { - J3DMaterial* mat = chestMdlData->getMaterialNodePointer(i); + for (u8 i = 0; i < modelData->getMaterialNum(); i++) { + J3DMaterial* mat = modelData->getMaterialNodePointer(i); for (u8 j = 0; j < mat->getIndTexStageNum(); j++) { J3DIndTexMtx* texMtx = mat->getIndTexMtx(j); @@ -1128,11 +1127,10 @@ BOOL daTbox_c::draw() { } if (mIsFlashPlaying != 0 && mOpenTimer >= 0x24) { - J3DModelData* flashMdlData = mpFlashMdl->getModelData(); - - mFlashAnm.entry(flashMdlData); - mFlashRegAnm.entry(flashMdlData); - mFlashTexAnm.entry(flashMdlData); + modelData = mpFlashMdl->getModelData(); + mFlashAnm.entry(modelData); + mFlashRegAnm.entry(modelData); + mFlashTexAnm.entry(modelData); dComIfGd_setListMaskOff(); mDoExt_modelUpdateDL(mpFlashMdl);