From bd917524bad56cb7348f50a2fc1fa92c44dcdeed Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 31 May 2025 20:09:14 -0400 Subject: [PATCH] Demo work, d_a_kytag02 and d_a_ff OK --- configure.py | 10 +- include/JSystem/JAudio/JAIAnimation.h | 2 +- include/SSystem/SComponent/c_bg_s.h | 7 ++ include/d/actor/d_a_ff.h | 2 +- include/d/actor/d_a_player_main.h | 2 +- include/d/actor/d_a_swc00.h | 6 +- include/d/d_bg_s.h | 18 ++- include/d/d_stage.h | 2 +- src/c/c_damagereaction.cpp | 76 ++++++------ src/d/actor/d_a_branch.cpp | 10 +- src/d/actor/d_a_dr.cpp | 14 +-- src/d/actor/d_a_ff.cpp | 162 +++++++++++++------------- src/d/actor/d_a_kytag02.cpp | 12 +- src/d/actor/d_a_kytag03.cpp | 14 ++- src/d/actor/d_a_kytag05.cpp | 24 ++-- src/d/actor/d_a_kytag06.cpp | 7 +- src/d/actor/d_a_kytag07.cpp | 17 +-- src/d/actor/d_a_obj_movebox.cpp | 2 +- src/d/actor/d_a_player_main.cpp | 8 +- src/d/actor/d_a_swc00.cpp | 38 +++--- src/d/d_bg_s.cpp | 8 +- src/d/d_camera.cpp | 2 +- src/d/d_stage.cpp | 102 ++++++++++------ src/m_Do/m_Do_graphic.cpp | 94 ++++++++++++++- 24 files changed, 403 insertions(+), 236 deletions(-) diff --git a/configure.py b/configure.py index 164035394..4ead0162b 100755 --- a/configure.py +++ b/configure.py @@ -1370,11 +1370,11 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kui"), ActorRel(Matching, "d_a_kytag00"), ActorRel(Matching, "d_a_kytag01"), - ActorRel(NonMatching, "d_a_kytag02"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kytag03"), + ActorRel(Matching, "d_a_kytag02"), + ActorRel(Matching, "d_a_kytag03"), ActorRel(Matching, "d_a_kytag04"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kytag05"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kytag06"), + ActorRel(Matching, "d_a_kytag05"), + ActorRel(Matching, "d_a_kytag06"), ActorRel(Matching, "d_a_kytag07"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_lamp" , extra_cflags=['-sym off']), ActorRel(NonMatching, "d_a_lod_bg"), @@ -1473,7 +1473,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_demo_item", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_door12"), ActorRel(NonMatching, "d_a_fallrock"), - ActorRel(NonMatching, "d_a_ff"), + ActorRel(Matching, "d_a_ff", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_gy_ctrl"), ActorRel(NonMatching, "d_a_himo3"), ActorRel(NonMatching, "d_a_hmlif"), diff --git a/include/JSystem/JAudio/JAIAnimation.h b/include/JSystem/JAudio/JAIAnimation.h index 9df256417..8fef132c1 100644 --- a/include/JSystem/JAudio/JAIAnimation.h +++ b/include/JSystem/JAudio/JAIAnimation.h @@ -31,7 +31,7 @@ struct JAIAnimeSoundData { /* 0x02 */ u16 field_0x02; /* 0x04 */ void* field_0x04; /* 0x08 */ JAIAnimeFrameSoundData mAfsData[]; -}; // Size: 0x20 +}; struct JAIAnimeSound__Slot { /* 0x0 */ u8 mbIsPlaying; diff --git a/include/SSystem/SComponent/c_bg_s.h b/include/SSystem/SComponent/c_bg_s.h index c71b33184..63aa41390 100644 --- a/include/SSystem/SComponent/c_bg_s.h +++ b/include/SSystem/SComponent/c_bg_s.h @@ -45,6 +45,13 @@ public: cM3dGPla* GetTriPla(cBgS_PolyInfo& polyInfo) const { return GetTriPla(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); } + s32 GetTriGrp(cBgS_PolyInfo& polyInfo) const { + return GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + } + fopAc_ac_c* GetActorPointer(cBgS_PolyInfo& i_poly) const { + return GetActorPointer(i_poly.GetBgIndex()); + } + bool Regist(cBgW*, fpc_ProcID, void*); bool Release(cBgW*); bool LineCross(cBgS_LinChk*); diff --git a/include/d/actor/d_a_ff.h b/include/d/actor/d_a_ff.h index 4bea48ec7..c6309e5ee 100644 --- a/include/d/actor/d_a_ff.h +++ b/include/d/actor/d_a_ff.h @@ -31,7 +31,7 @@ public: /* 0x306 */ s16 mTargetRotY; /* 0x308 */ s16 mTimers[5]; /* 0x312 */ s16 mLiveTimer; - /* 0x314 */ u8 mState; + /* 0x314 */ s8 mMode; /* 0x315 */ u8 m315[0x317 - 0x315]; /* 0x317 */ u8 mbNotVisibleZ; /* 0x318 */ dCcD_Stts mStts; diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 757d2700c..22c4b78b6 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -1835,7 +1835,7 @@ public: BOOL allTrigger() const { return mItemTrigger & (BTN_A | BTN_B | BTN_X | BTN_Y | BTN_Z); } void otherWeaponTrigger() const {} - BOOL checkPlayerDemoMode() const { return mDemo.getDemoType(); } + BOOL checkPlayerDemoMode() const { return mDemo.getDemoType() != 0; } void checkSpecialDemoMode() const {} void checkAttentionLock() {} diff --git a/include/d/actor/d_a_swc00.h b/include/d/actor/d_a_swc00.h index bd1bab20a..e0ad2c3ba 100644 --- a/include/d/actor/d_a_swc00.h +++ b/include/d/actor/d_a_swc00.h @@ -6,8 +6,8 @@ class swc00_class : public fopAc_ac_c {}; -static inline s32 daSwc00_getSw1No(swc00_class* i_this) { return fopAcM_GetParam(i_this) & 0xFF; } -static inline s32 daSwc00_getSw2No(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 8) & 0xFF; } -static inline s32 daSwc00_getType(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 0x10) & 0x3; } +static inline int daSwc00_getSw1No(swc00_class* i_this) { return fopAcM_GetParam(i_this) & 0xFF; } +static inline int daSwc00_getSw2No(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 8) & 0xFF; } +static inline int daSwc00_getType(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 0x10) & 0x3; } #endif /* D_A_SWC00_H */ diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index 42680cf25..74e222217 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -65,6 +65,22 @@ public: dBgS() {} virtual ~dBgS() {} + bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); } + fopAc_ac_c* GetActorPointer(cBgS_PolyInfo& i_poly) const { + return cBgS::GetActorPointer(i_poly); + } + + // void CaptPoly(dBgS_CaptPoly&) {} + // void ChkDeleteActorRegist(fopAc_ac_c*) {} + // void DebugDrawPoly(dBgW&) {} + // void Draw() {} + // void DrawPoly(cBgS_PolyInfo&, _GXColor&) {} + // void GetBgWPointer(cBgS_PolyInfo&) {} + // void GetPolyCamId(cBgS_PolyInfo&) {} + // void GroundCross(cBgS_GndChk*) {} + // void LineCross(cBgS_LinChk*) {} + // void ShdwDraw(cBgS_ShdwDraw*) {} + virtual void Ct(); virtual void Dt(); virtual void Move(); @@ -106,8 +122,6 @@ public: void MoveBgMatrixCrrPos(cBgS_PolyInfo&, bool, cXyz*, csXyz*, csXyz*); void RideCallBack(cBgS_PolyInfo&, fopAc_ac_c*); fopAc_ac_c* PushPullCallBack(cBgS_PolyInfo&, fopAc_ac_c*, short, dBgW::PushPullLabel); - - bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); } }; // Size: 0x1404 class dBgS_CrrPos : public cBgS_PolyInfo, public dBgS_Chk, public cBgS_Chk { diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 737a1726c..f20c09881 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -935,7 +935,7 @@ public: void set(const char*, s8, s16, s8); const char* getName() const { return mName; } s16 getPoint() const { return mPoint; } - int getRoomNo() const { return mRoomNo; } + s8 getRoomNo() const { return mRoomNo; } s8 getLayer() const { return mLayer; } void setLayer(s8 layer) { mLayer = layer; } diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index ccf0bf55f..4f33e1c7a 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -183,7 +183,7 @@ BOOL enemy_ice(enemyice* ei) { ei->mCyl.SetStts(&ei->mStts); ei->mCyl.SetR(ei->mWallRadius); ei->mCyl.SetH(ei->mCylHeight); - ei->mBgAcch.Set(&ac->current.pos, &ac->old.pos, ac, 1, &ei->mBgAcchCir, &ei->mSpeed); + ei->mBgAcch.Set(fopAcM_GetPosition_p(ac), fopAcM_GetOldPosition_p(ac), ac, 1, &ei->mBgAcchCir, &ei->mSpeed); ei->mBgAcchCir.SetWall(40.0f, ei->mWallRadius); if (ei->mParticleScale < 0.1f) { @@ -227,6 +227,11 @@ BOOL enemy_ice(enemyice* ei) { case 2: // Frozen frozen = TRUE; moveAndCollide = TRUE; +#if VERSION == VERSION_DEMO + if (ei->mSpeedF > 19.0f) { + ac->shape_angle.x -= 0x300; + } +#endif if (ei->m00C != 1) { cLib_onBit(ac->attention_info.flags, fopAc_Attn_ACTION_CARRY_e); ac->attention_info.distances[fopAc_Attn_TYPE_CARRY_e] = 0x12; @@ -442,37 +447,41 @@ void enemy_fire(enemyfire* ef) { switch (ef->mMode) { case 0: // Not on fire. - if (ef->mFireDuration == 0) { - return; + if (ef->mFireDuration != 0) { + // The enemy has signaled that it wants to be lit on fire for some length of time. + ef->mFireTimer = ef->mFireDuration; + ef->mFireDuration = 0; + + ef->mMode = 1; // On fire + + dKy_plight_set(&ef->mLight); + + for (int i = 0; i < 10; i++) { + if (ef->mFlameJntIdxs[i] < 0) { + continue; + } + if (ef->mpFlameEmitters[i]) { + continue; + } + cXyz scale; + scale.setall(ef->mParticleScale[i]); + ef->mpFlameEmitters[i] = dComIfGp_particle_set(dPa_name::ID_COMMON_03F1, &ac->current.pos, NULL, &scale); + ef->mFlameTimers[i] = ef->mFireTimer - (s16)cM_rndF(60.0f); + if (ef->mFlameTimers[i] < 10) { + ef->mFlameTimers[i] = 10; + } + ef->mFlameScaleY = 2.0f; + } + + ef->mStts.Init(250, 0xFF, ac); + ef->mSph.Set(fire_at_sph_src); + ef->mSph.SetStts(&ef->mStts); } - // The enemy has signaled that it wants to be lit on fire for some length of time. - ef->mFireTimer = ef->mFireDuration; - ef->mFireDuration = 0; - - ef->mMode = 1; // On fire - - dKy_plight_set(&ef->mLight); - - for (int i = 0; i < 10; i++) { - if (ef->mFlameJntIdxs[i] < 0) { - continue; - } - if (ef->mpFlameEmitters[i]) { - continue; - } - cXyz scale; - scale.setall(ef->mParticleScale[i]); - ef->mpFlameEmitters[i] = dComIfGp_particle_set(dPa_name::ID_COMMON_03F1, &ac->current.pos, NULL, &scale); - ef->mFlameTimers[i] = ef->mFireTimer - (s16)cM_rndF(60.0f); - if (ef->mFlameTimers[i] < 10) { - ef->mFlameTimers[i] = 10; - } - ef->mFlameScaleY = 2.0f; +#if VERSION == VERSION_DEMO + else { + ef->mLight.mPower = 0.0f; } - - ef->mStts.Init(250, 0xFF, ac); - ef->mSph.Set(fire_at_sph_src); - ef->mSph.SetStts(&ef->mStts); +#endif break; case 1: // On fire. ef->mLight.mPos = ac->current.pos; @@ -529,7 +538,7 @@ void enemy_fire(enemyfire* ef) { } else { ef->mFlameTimers[i]--; - cMtx_copy(ef->mpMcaMorf->getModel()->getAnmMtx(ef->mFlameJntIdxs[i]), *calc_mtx); + MTXCopy(ef->mpMcaMorf->getModel()->getAnmMtx(ef->mFlameJntIdxs[i]), *calc_mtx); MtxPosition(&offset, &pos); ef->mpFlameEmitters[i]->setGlobalTranslation(pos.x, pos.y, pos.z); @@ -563,7 +572,9 @@ void enemy_fire(enemyfire* ef) { if (ef->mFireTimer == 0) { ef->mMode = 0; // Not on fire +#if VERSION > VERSION_DEMO dKy_plight_cut(&ef->mLight); +#endif ef->mSph.SetC(non_pos); dComIfG_Ccsp()->Set(&ef->mSph); } else { @@ -684,8 +695,7 @@ void dr_body_bg_check(damagereaction* dr) { bk_class* bk = (bk_class*)dr->mpEnemy; u8 switch_no = bk->m02B8; if (switch_no != 0) { - s8 roomNo = fopAcM_GetRoomNo(bk); - dComIfGs_onSwitch(switch_no, roomNo); + dComIfGs_onSwitch(switch_no, fopAcM_GetRoomNo(dr->mpEnemy)); } } } diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index 8cd6fba9b..04cbd74ea 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -190,16 +190,16 @@ static BOOL daBranch_Delete(daBranch_c* i_this) { } inline cPhs_State daBranch_c::create() { -#if VERSION == VERSION_DEMO - cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname); - if (phase_state == cPhs_COMPLEATE_e) { - fopAcM_SetupActor(this, daBranch_c); -#else +#if VERSION > VERSION_DEMO fopAcM_SetupActor(this, daBranch_c); +#endif cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname); if (phase_state == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(this, daBranch_c); #endif + if (!fopAcM_entrySolidHeap(this, daBranch_c::solidHeapCB, 0x4000)) { for (int i = 0; i < (s32)ARRAY_SIZE(mAnims); i++) { mAnims[i] = NULL; diff --git a/src/d/actor/d_a_dr.cpp b/src/d/actor/d_a_dr.cpp index fe1e3de28..9710e7b66 100644 --- a/src/d/actor/d_a_dr.cpp +++ b/src/d/actor/d_a_dr.cpp @@ -245,17 +245,17 @@ static BOOL createHeap(fopAc_ac_c* i_actor) { /* 00000C08-00000CE4 .text daDr_Create__FP10fopAc_ac_c */ static cPhs_State daDr_Create(fopAc_ac_c* i_this) { dr_class* a_this = (dr_class*)i_this; - -#if VERSION == VERSION_DEMO - cPhs_State phase_state = dComIfG_resLoad(&a_this->mPhs, "Dr"); - if (phase_state == cPhs_COMPLEATE_e) { - fopAcM_SetupActor(a_this, dr_class); -#else + +#if VERSION > VERSION_DEMO fopAcM_SetupActor(a_this, dr_class); - +#endif + cPhs_State phase_state = dComIfG_resLoad(&a_this->mPhs, "Dr"); if (phase_state == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(a_this, dr_class); #endif + if (!fopAcM_entrySolidHeap(a_this, createHeap, 0xF000)) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_ff.cpp b/src/d/actor/d_a_ff.cpp index c33fc0da7..e01607217 100644 --- a/src/d/actor/d_a_ff.cpp +++ b/src/d/actor/d_a_ff.cpp @@ -26,7 +26,7 @@ static void fire_fly_draw(ff_class* i_this) { dComIfGd_setListMaskOff(); mDoExt_modelUpdate(i_this->mpModel[0]); if (i_this->mGlowScale > 0.01f) { - mDoMtx_YrotM(*calc_mtx, i_this->mLiveTimer * 0x100); + cMtx_YrotM(*calc_mtx, i_this->mLiveTimer * 0x100); MtxScale(i_this->mGlowScale, i_this->mGlowScale * i_this->mGlowScaleY, i_this->mGlowScale, true); i_this->mpModel[1]->setBaseTRMtx(*calc_mtx); @@ -78,18 +78,11 @@ static BOOL daFf_Draw(ff_class* i_this) { /* 0000037C-00000D18 .text fire_fly_move__FP8ff_class */ static void fire_fly_move(ff_class* i_this) { - /* Nonmatching - regalloc */ - s8 cVar1; - f32 fVar2; - f32 fVar3; - f32 dVar7; - f32 dVar8; - f32 dVar9; - f32 fVar10; - cXyz local_cc; - daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); dBgS_GndChk chk; + f32 step; + cXyz local_cc; + i_this->mLiveTimer++; if (i_this->mTimers[2] == 0) { i_this->mTimers[1] = cM_rndF(50.0f) + 40.0f; @@ -100,95 +93,93 @@ static void fire_fly_move(ff_class* i_this) { } else { i_this->mScaleTarget = 0.0f; } + cLib_addCalc2(&i_this->mScale, i_this->mScaleTarget, 0.1f, 0.05f); - cVar1 = i_this->mState; - switch (cVar1) { + switch (i_this->mMode) { case 0: Vec pos; pos = i_this->current.pos; pos.y += 250.0f; chk.SetPos(&pos); - fVar10 = dComIfG_Bgsp()->GroundCross(&chk); - i_this->mGroundY = fVar10 + 12.5f; + i_this->mGroundY = dComIfG_Bgsp()->GroundCross(&chk) + 12.5f; if (i_this->mbNoUseGroundY == 0) { i_this->current.pos.y = i_this->mGroundY; } i_this->mHomePos = i_this->current.pos; - i_this->mState++; + i_this->mMode++; + // Fall-through + case 1: { cLib_addCalc2(&i_this->current.pos.x, i_this->mHomePos.x, 0.1f, std::abs(i_this->speed.x)); cLib_addCalc2(&i_this->current.pos.y, i_this->mHomePos.y, 0.1f, std::abs(i_this->speed.y)); cLib_addCalc2(&i_this->current.pos.z, i_this->mHomePos.z, 0.1f, std::abs(i_this->speed.z)); - fVar10 = player->current.pos.x - i_this->current.pos.x; - fVar2 = player->current.pos.y - i_this->current.pos.y; - fVar3 = player->current.pos.z - i_this->current.pos.z; - fVar10 = std::sqrtf(fVar3 * fVar3 + fVar10 * fVar10 + fVar2 * fVar2); - if (fVar10 < 250.0f) { - i_this->mState++; - fVar10 = cM_rndF(100.0f); - i_this->mTimers[3] = (fVar10 + 1000.0f); + f32 xd = player->current.pos.x - i_this->current.pos.x; + f32 yd = player->current.pos.y - i_this->current.pos.y; + f32 zd = player->current.pos.z - i_this->current.pos.z; + xd = std::sqrtf(xd * xd + yd * yd + zd * zd); + if (xd < 250.0f) { + i_this->mMode++; + xd = cM_rndF(100.0f); + i_this->mTimers[3] = (xd + 1000.0f); i_this->current.angle.x = -0x3000; i_this->speedF = 10.0f; } - break; - case 2: + goto label_870; + } + case 2: { if (i_this->mTimers[0] == 0) { i_this->mScatterPos.x = i_this->mHomePos.x + cM_rndFX(750.0f); i_this->mScatterPos.z = i_this->mHomePos.z + cM_rndFX(750.0f); i_this->mScatterPos.y = i_this->mHomePos.y + cM_rndFX(225.0f) + 137.5f; i_this->mRotVel = 0.0f; i_this->mVelocityFwdTarget = cM_rndF(20.0f) + 10.0f; - fVar2 = i_this->mScatterPos.x - i_this->current.pos.x; - dVar7 = i_this->mScatterPos.y - i_this->current.pos.y; - fVar3 = i_this->mScatterPos.z - i_this->current.pos.z; - dVar9 = fVar3 * fVar3; - dVar8 = fVar2 * fVar2; - fVar10 = std::sqrtf(dVar9 + (dVar8 + (dVar7 * dVar7))); - i_this->mTimers[0] = fVar10 / i_this->mVelocityFwdTarget; - i_this->mTargetRotY = cM_atan2s(fVar2, fVar3); - fVar10 = std::sqrtf(dVar8 + dVar9); - i_this->mTargetRotX = -cM_atan2s(dVar7, fVar10); + f32 xd = i_this->mScatterPos.x - i_this->current.pos.x; + f32 yd = i_this->mScatterPos.y - i_this->current.pos.y; + f32 zd = i_this->mScatterPos.z - i_this->current.pos.z; + f32 dist = std::sqrtf(xd * xd + yd * yd + zd * zd); + i_this->mTimers[0] = dist / i_this->mVelocityFwdTarget; + i_this->mTargetRotY = cM_atan2s(xd, zd); + f32 xz_dist = std::sqrtf(xd * xd + zd * zd); + i_this->mTargetRotX = -cM_atan2s(yd, xz_dist); } if (i_this->mTimers[3] == 0) { - i_this->mState++; + i_this->mMode++; i_this->mScatterPos.x = i_this->mHomePos.x; i_this->mScatterPos.y = i_this->mHomePos.y; i_this->mScatterPos.z = i_this->mHomePos.z; i_this->mRotVel = 0.0f; } break; - case 4: - /* attacked */ - fVar10 = i_this->mScatterPos.x - i_this->current.pos.x; - dVar8 = fVar10; - dVar7 = i_this->mScatterPos.y - i_this->current.pos.y; - fVar2 = i_this->mScatterPos.z - i_this->current.pos.z; - dVar9 = fVar2; - i_this->mTargetRotY = cM_atan2s(fVar10, fVar2); - dVar8 = dVar8 * dVar8; - dVar9 = dVar9 * dVar9; - fVar10 = std::sqrtf(dVar8 + dVar9); - i_this->mTargetRotX = -cM_atan2s(dVar7, fVar10); - if ((dVar9 + (dVar8 + (dVar7 * dVar7))) < 2500.0f) { - i_this->mState = 1; + } + case 3: { + f32 xd = i_this->mScatterPos.x - i_this->current.pos.x; + f32 yd = i_this->mScatterPos.y - i_this->current.pos.y; + f32 zd = i_this->mScatterPos.z - i_this->current.pos.z; + i_this->mTargetRotY = cM_atan2s(xd, zd); + f32 xz_dist = std::sqrtf(xd * xd + zd * zd); + i_this->mTargetRotX = -cM_atan2s(yd, xz_dist); + if (((xd * xd) + (yd * yd) + (zd * zd)) < 2500.0f) { + i_this->mMode = 1; } cLib_addCalc2(&i_this->mRotVel, 10.0f, 1.0f, 0.15f); break; - default: + } + case 4: + f32 f30; if (i_this->mTimers[4] == 0) { - i_this->mState = 2; - fVar10 = cM_rndF(100.0f); - i_this->mTimers[3] = (fVar10 + 1000.0f); + i_this->mMode = 2; + f30 = cM_rndF(100.0f); + i_this->mTimers[3] = (f30 + 1000.0f); } else { i_this->mVelImpulse += i_this->m2C0; - fVar10 = cM_rndF(1.0f); - if (fVar10 < REG13_F(0) + 0.1f) { - fVar10 = cM_rndFX(REG13_F(1) + 1.0f); - i_this->m2C0.x = fVar10; + f30 = cM_rndF(1.0f); + if (f30 < REG13_F(0) + 0.1f) { + f30 = cM_rndFX(REG13_F(1) + 1.0f); + i_this->m2C0.x = f30; } - fVar10 = cM_rndF(1.0f); - if (fVar10 < REG13_F(0) + 0.1f) { - fVar10 = cM_rndFX(REG13_F(1) + 1.0f); - i_this->m2C0.z = fVar10; + f30 = cM_rndF(1.0f); + if (f30 < REG13_F(0) + 0.1f) { + f30 = cM_rndFX(REG13_F(1) + 1.0f); + i_this->m2C0.z = f30; } i_this->m2C0.y = REG13_F(2) + 2.0f; if (i_this->mVelImpulse.y > REG13_F(3) + 10.0f) { @@ -196,23 +187,29 @@ static void fire_fly_move(ff_class* i_this) { } } break; + default: + goto label_870; } + + step = 500.0f; cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetRotY, 10, - i_this->mRotVel * 500.0f); + step * i_this->mRotVel); cLib_addCalcAngleS2(&i_this->current.angle.x, i_this->mTargetRotX, 10, - i_this->mRotVel * 500.0f); + step * i_this->mRotVel); cLib_addCalc2(&i_this->mRotVel, 1.0f, 1.0f, 0.1f); cLib_addCalc2(&i_this->speedF, i_this->mVelocityFwdTarget, 1.0f, 3.0f); local_cc.x = 0.0f; local_cc.y = 0.0f; local_cc.z = i_this->speedF * 0.25f; - mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); - mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); + cMtx_YrotS(*calc_mtx, i_this->current.angle.y); + cMtx_XrotM(*calc_mtx, i_this->current.angle.x); MtxPosition(&local_cc, &i_this->speed); i_this->current.pos += (i_this->speed + i_this->mVelImpulse); cLib_addCalc0(&i_this->mVelImpulse.x, 1.0f, 0.1f); cLib_addCalc0(&i_this->mVelImpulse.y, 1.0f, 0.1f); cLib_addCalc0(&i_this->mVelImpulse.z, 1.0f, 0.1f); + +label_870: if (i_this->current.pos.y < i_this->mGroundY + 12.5f) { if (i_this->current.pos.y < i_this->mGroundY) { i_this->current.pos.y = i_this->mGroundY; @@ -225,18 +222,14 @@ static void fire_fly_move(ff_class* i_this) { /* 00001098-00001168 .text daFf_Execute__FP8ff_class */ static BOOL daFf_Execute(ff_class* i_this) { - s16 sVar1; - int iVar3; - - for (iVar3 = 0; iVar3 < 5; iVar3++) { - sVar1 = i_this->mTimers[iVar3]; - if (sVar1 != 0) { - i_this->mTimers[iVar3]--; + for (int i = 0; i < 5; i++) { + if (i_this->mTimers[i] != 0) { + i_this->mTimers[i]--; } } fire_fly_move(i_this); if (i_this->mSph.ChkTgHit() != 0) { - i_this->mState = 4; + i_this->mMode = 4; i_this->mTimers[4] = REG13_F(9) + (cM_rndF(20.0f) + 30.0f); } i_this->mSph.SetC(i_this->current.pos); @@ -251,7 +244,7 @@ static BOOL daFf_IsDelete(ff_class*) { /* 00001170-000011AC .text daFf_Delete__FP8ff_class */ static BOOL daFf_Delete(ff_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "Ff"); + dComIfG_resDeleteDemo(&i_this->mPhs, "Ff"); ff_count = 0; return TRUE; } @@ -264,10 +257,12 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) { for (int i = 0; i < 2; i++) { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Ff", ho_bmd[i]); - JUT_ASSERT(719, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(717, 719, 719, 719), modelData != NULL); +#if VERSION > VERSION_DEMO if (modelData == NULL) { return FALSE; } +#endif a_this->mpModel[i] = mDoExt_J3DModel__create(modelData, 0x10000, 0x11020203); if (a_this->mpModel[i] == NULL) { return FALSE; @@ -276,13 +271,16 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) { if (a_this->mBrkAnm[i] == NULL) { return FALSE; } - J3DAnmTevRegKey* pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Ff", ho_brk[i]); - modelData = a_this->mpModel[i]->getModelData(); - int iVar6 = a_this->mBrkAnm[i]->init(modelData, pJVar5, true, J3DFrameCtrl::EMode_LOOP, - 0.9f + cM_rndF(0.15f), 0, -1, false, 0); + int iVar6 = a_this->mBrkAnm[i]->init( + a_this->mpModel[i]->getModelData(), + (J3DAnmTevRegKey*)dComIfG_getObjectRes("Ff", ho_brk[i]), + true, J3DFrameCtrl::EMode_LOOP, 0.9f + cM_rndF(0.15f), 0, -1, false, 0 + ); +#if VERSION > VERSION_DEMO if (iVar6 == 0) { return FALSE; } +#endif } return TRUE; } @@ -297,7 +295,7 @@ static cPhs_State daFf_Create(fopAc_ac_c* i_this) { if (fopAcM_entrySolidHeap(a_this, useHeapInit, 0x2320)) { int uVar1 = fopAcM_GetParam(a_this) & 0xFF; if (uVar1 != 0) { - a_this->base.mParameters = fopAcM_GetParam(a_this) & 0xFF00; + fopAcM_SetParam(a_this, fopAcM_GetParam(a_this) & 0xFF00); for (int iVar7 = 0; iVar7 < uVar1; iVar7 = iVar7 + 1) { fopAcM_prm_class* pfVar4 = fopAcM_CreateAppend(); pfVar4->base.position.x = a_this->current.pos.x + cM_rndFX(500.0f); diff --git a/src/d/actor/d_a_kytag02.cpp b/src/d/actor/d_a_kytag02.cpp index 3795b99dc..c3148a6b8 100644 --- a/src/d/actor/d_a_kytag02.cpp +++ b/src/d/actor/d_a_kytag02.cpp @@ -25,10 +25,14 @@ dPath* set_next_path_info(kytag02_class* i_this, dPath* path) { /* 000000F0-0000017C .text get_railwind_vec__FP5dPathi */ cXyz get_railwind_vec(dPath* path, int i_no) { - /* Nonmatching */ - dPnt* pnt = path->m_points; - cXyz p0 = pnt[i_no].m_position; - cXyz p1 = pnt[i_no + 1].m_position; + cXyz p0; + p0.x = path->m_points[i_no].m_position.x; + p0.y = path->m_points[i_no].m_position.y; + p0.z = path->m_points[i_no].m_position.z; + cXyz p1; + p1.x = path->m_points[i_no + 1].m_position.x; + p1.y = path->m_points[i_no + 1].m_position.y; + p1.z = path->m_points[i_no + 1].m_position.z; cXyz ret; dKyr_get_vectle_calc(&p0, &p1, &ret); return ret; diff --git a/src/d/actor/d_a_kytag03.cpp b/src/d/actor/d_a_kytag03.cpp index 718b13bb8..88c6420d8 100644 --- a/src/d/actor/d_a_kytag03.cpp +++ b/src/d/actor/d_a_kytag03.cpp @@ -90,7 +90,7 @@ static BOOL daKytag03_Execute(kytag03_class* i_this) { if (!i_this->mbIsActive && dKy_contrast_flg_get()) { if (!i_this->mbVisible) { cXyz pos; - s16 y = player->shape_angle.y; + const s16 y = player->shape_angle.y; pos.x = cM_scos(0) * cM_ssin(y); pos.y = cM_ssin(0); pos.z = cM_scos(0) * cM_scos(y); @@ -124,15 +124,17 @@ static BOOL daKytag03_Delete(kytag03_class* i_this) { /* 00000544-00000604 .text daKytag03_Create__FP10fopAc_ac_c */ static cPhs_State daKytag03_Create(fopAc_ac_c* i_ac) { kytag03_class* i_this = (kytag03_class*)i_ac; -#if VERSION == VERSION_DEMO - cPhs_State ret = dComIfG_resLoad(&i_this->mPhs, "M_DOOR"); - if (ret == cPhs_COMPLEATE_e) { - fopAcM_SetupActor(i_this, kytag03_class); -#else + +#if VERSION > VERSION_DEMO fopAcM_SetupActor(i_this, kytag03_class); +#endif + cPhs_State ret = dComIfG_resLoad(&i_this->mPhs, "M_DOOR"); if (ret == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, kytag03_class); #endif + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x4c30)) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_kytag05.cpp b/src/d/actor/d_a_kytag05.cpp index 15d094f99..5e4000bc1 100644 --- a/src/d/actor/d_a_kytag05.cpp +++ b/src/d/actor/d_a_kytag05.cpp @@ -43,26 +43,26 @@ static BOOL daKytag05_Execute(kytag05_class* a_this) { camera_process_class *camera = dComIfGp_getCamera(0); fopAc_ac_c *player = dComIfGp_getPlayer(0); f32 windPow = dKyw_get_wind_pow(); - f32 i_blend = 1.0f; + f32 blend = 1.0f; if (g_env_light.mWind.mEvtWindSet == 0xFF) { return TRUE; } - if (dComIfGp_event_runCheck() && dComIfGp_evmng_startCheck("demo41") && dComIfGp_demo_get()) { + if (dComIfGp_event_runCheck() != FALSE && dComIfGp_evmng_startCheck("demo41") && dComIfGp_demo_get()) { u32 demoFrame = dComIfGp_demo_get()->getFrame(); if(demoFrame >= 0x186) { f32 fVar7 = ((f32)demoFrame - 390.0f) / 100.0f; - if(fVar7 > i_blend) { - fVar7 = i_blend; + if(fVar7 > 1.0f) { + fVar7 = 1.0f; } - i_blend = 1.0f - fVar7; - g_env_light.mSnowCount = (int)(200.0f * i_blend); + blend = 1.0f - fVar7; + g_env_light.mSnowCount = (int)(200.0f * blend); } else if (demoFrame == 0x187) { daYkgr_c::stop(); } } - dKy_custom_colset(0, 7, i_blend); + dKy_custom_colset(0, 7, blend); if((a_this->mIndex & 1) == 0) { if (a_this->mTimer >= fuu_timer[a_this->mIndex >> 1]) { @@ -78,7 +78,8 @@ static BOOL daKytag05_Execute(kytag05_class* a_this) { if(a_this->mIndex >> 1 >= 4) { a_this->mIndex = 0; } - dKyw_evt_wind_set(0, wind_table[a_this->mIndex >> 1]); + s16 windY = wind_table[a_this->mIndex >> 1]; + dKyw_evt_wind_set(0, windY); a_this->mTimer = 0; g_env_light.mWind.mEvtWindSet = 1; } else { @@ -120,11 +121,18 @@ static BOOL daKytag05_Delete(kytag05_class*) { /* 00000404-000004C0 .text daKytag05_Create__FP10fopAc_ac_c */ static cPhs_State daKytag05_Create(fopAc_ac_c* i_this) { +#if VERSION > VERSION_DEMO fopAcM_SetupActor(i_this, kytag05_class); +#endif kytag05_class *a_this = (kytag05_class*)i_this; if (dComIfGs_isSymbol(1) != 0) { return cPhs_STOP_e; } + +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, kytag05_class); +#endif + a_this->mIndex = 0; a_this->mTimer = 0; a_this->mUnknownParam = i_this->base.mParameters & 0xff; diff --git a/src/d/actor/d_a_kytag06.cpp b/src/d/actor/d_a_kytag06.cpp index 544e0fd5b..e2596aae5 100644 --- a/src/d/actor/d_a_kytag06.cpp +++ b/src/d/actor/d_a_kytag06.cpp @@ -22,7 +22,7 @@ static BOOL daKytag06_Execute(kytag06_class* i_this) { f32 time; int date; - if (!dComIfGp_event_runCheck()) { + if (dComIfGp_event_runCheck() == FALSE) { return TRUE; } if(!dComIfGp_evmng_startCheck("ARRIVAL_BRK")) { @@ -59,13 +59,18 @@ static BOOL daKytag06_Delete(kytag06_class*) { /* 000001A4-00000224 .text daKytag06_Create__FP10fopAc_ac_c */ static cPhs_State daKytag06_Create(fopAc_ac_c* i_this) { +#if VERSION > VERSION_DEMO fopAcM_SetupActor(i_this, kytag06_class); +#endif kytag06_class* a_this = (kytag06_class*)i_this; cPhs_State phase_state; if(dComIfGs_isSymbol(0)) { phase_state = cPhs_ERROR_e; } else { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, kytag06_class); +#endif a_this->field_0x294 = 0; phase_state = cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_kytag07.cpp b/src/d/actor/d_a_kytag07.cpp index c4d9262d2..ca14c3af2 100644 --- a/src/d/actor/d_a_kytag07.cpp +++ b/src/d/actor/d_a_kytag07.cpp @@ -84,15 +84,18 @@ static BOOL daKytag07_Delete(kytag07_class*) { static cPhs_State daKytag07_Create(fopAc_ac_c* i_this) { kytag07_class* a_this = (kytag07_class*)i_this; dScnKy_env_light_c& env_light = dKy_getEnvlight(); -#if VERSION == VERSION_DEMO - if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0) - env_light.mbDayNightTactStop = true; + +#if VERSION > VERSION_DEMO fopAcM_SetupActor(a_this, kytag07_class); -#else - fopAcM_SetupActor(a_this, kytag07_class); - if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0) - env_light.mbDayNightTactStop = true; #endif + + if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0) + env_light.mbDayNightTactStop = true; + +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(a_this, kytag07_class); +#endif + return cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index de96ffe47..f1aa22034 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -132,7 +132,7 @@ namespace daObjMovebox { M_gnd_work[i].SetActorPid(movebox->base.mBsPcId); mGroundY[i] = dComIfG_Bgsp()->GroundCross(&M_gnd_work[i]); if (mGroundY[i] > maxGroundY) { - fopAc_ac_c* groundActor = dComIfG_Bgsp()->GetActorPointer(M_gnd_work[i].GetBgIndex()); + fopAc_ac_c* groundActor = dComIfG_Bgsp()->GetActorPointer(M_gnd_work[i]); if (!(groundActor && fopAcM_GetName(groundActor) == PROC_Obj_Movebox && ((Act_c*)groundActor)->mMode == Act_c::MODE_AFLOAT)) { maxGroundY = mGroundY[i]; mMaxGroundIdx = i; diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 5cc86e824..bb9d9ec44 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -6907,7 +6907,7 @@ BOOL daPy_lk_c::procFrontRollCrash_init() { dKy_Sound_set(current.pos, 100, fopAcM_GetID(this), 5); if ((mAcch.ChkWallHit()) && (mAcchCir[0].ChkWallHit())) { daObjMovebox::Act_c* iVar1 = - (daObjMovebox::Act_c*)dComIfG_Bgsp()->GetActorPointer(mAcchCir[0].GetBgIndex()); + (daObjMovebox::Act_c*)dComIfG_Bgsp()->GetActorPointer(mAcchCir[0]); if ((iVar1 != 0) && (fopAcM_GetName(iVar1) == PROC_Obj_Movebox) && ((iVar1->mType == 0) || (iVar1->mType == 5))) { @@ -11167,7 +11167,7 @@ void daPy_lk_c::checkRoofRestart() { { if ((dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) != dStageType_BOSS_e && ((!dComIfG_Bgsp()->ChkMoveBG(mAcch.m_roof) || - (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_roof.GetBgIndex())) != + (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_roof)) != PROC_BRIDGE))))) { f32 dVar9 = mAcch.m_roof_y; @@ -12460,14 +12460,14 @@ cPhs_State daPy_lk_c::makeBgWait() { mAcch.CrrPos(*dComIfG_Bgsp()); if ((-G_CM3D_F_INF == mAcch.GetGroundH()) || (((m352E != 0 && (dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd))) && - (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd.GetBgIndex())) == + (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd)) == PROC_TBOX)))) { return cPhs_INIT_e; } if (((fopAcM_GetParam(this) & 0x80) != 0) && (m352E != 0)) { if (!(dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd)) || - (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd.GetBgIndex())) != + (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd)) != PROC_OBJ_IKADA)) { return cPhs_INIT_e; diff --git a/src/d/actor/d_a_swc00.cpp b/src/d/actor/d_a_swc00.cpp index a27ae5a4c..5d3dc10f1 100644 --- a/src/d/actor/d_a_swc00.cpp +++ b/src/d/actor/d_a_swc00.cpp @@ -11,22 +11,22 @@ /* 00000078-00000180 .text daSwc00_Execute__FP11swc00_class */ static BOOL daSwc00_Execute(swc00_class* i_this) { - s32 enable_sw = daSwc00_getSw2No(i_this); fopAc_ac_c* actor = i_this; - if(enable_sw == 0xFF || dComIfGs_isSwitch(enable_sw, fopAcM_GetRoomNo(i_this))) { - s32 swBit = daSwc00_getSw1No(i_this); + int enable_sw = daSwc00_getSw2No(i_this); + if(enable_sw == 0xFF || dComIfGs_isSwitch(enable_sw, fopAcM_GetRoomNo(actor))) { + int swBit = daSwc00_getSw1No(i_this); - f32 xz_dist2 = fopAcM_searchPlayerDistanceXZ2(i_this); - f32 y_diff = fopAcM_searchPlayerDistanceY(i_this); - if(xz_dist2 < i_this->scale.x && (-100.0f < y_diff && y_diff < i_this->scale.y)) { - dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(i_this)); + f32 xz_dist2 = fopAcM_searchPlayerDistanceXZ2(actor); + f32 y_diff = fopAcM_searchPlayerDistanceY(actor); + if(xz_dist2 < actor->scale.x && (-100.0f < y_diff && y_diff < actor->scale.y)) { + dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(actor)); if(daSwc00_getType(i_this) != 0) { - fopAcM_delete(actor); + fopAcM_delete(i_this); } } else if(daSwc00_getType(i_this) == 0) { - dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(i_this)); + dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(actor)); } } @@ -44,21 +44,27 @@ static BOOL daSwc00_Delete(swc00_class* i_this) { } /* 00000190-00000274 .text daSwc00_Create__FP10fopAc_ac_c */ -static cPhs_State daSwc00_Create(fopAc_ac_c* i_actor) { - fopAcM_SetupActor(i_actor, swc00_class); +static cPhs_State daSwc00_Create(fopAc_ac_c* i_this) { +#if VERSION > VERSION_DEMO + fopAcM_SetupActor(i_this, swc00_class); +#endif - swc00_class* i_this = (swc00_class*)i_actor; + swc00_class* a_this = (swc00_class*)i_this; - if(dComIfGs_isSwitch(daSwc00_getSw1No(i_this), fopAcM_GetRoomNo(i_this))) { - if(daSwc00_getType(i_this) == 0) { - s32 swBit = daSwc00_getSw1No(i_this); - dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(i_this)); + u8 swBit = daSwc00_getSw1No(a_this); + if(dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(i_this))) { + if(daSwc00_getType(a_this) == 0) { + dComIfGs_offSwitch(daSwc00_getSw1No(a_this), fopAcM_GetRoomNo(i_this)); } else { return cPhs_ERROR_e; } } +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, swc00_class); +#endif + i_this->scale.x *= 100.0f; i_this->scale.x += 30.0f; i_this->scale.x *= i_this->scale.x; diff --git a/src/d/d_bg_s.cpp b/src/d/d_bg_s.cpp index 1eca3ff9a..e2907ed3e 100644 --- a/src/d/d_bg_s.cpp +++ b/src/d/d_bg_s.cpp @@ -130,7 +130,7 @@ int dBgS::GetGrpRoomInfId(cBgS_PolyInfo& polyInfo) { if (inf != 0xFF) return inf; - s32 grp_id = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp_id = GetTriGrp(polyInfo); if (grp_id == -1) return 0xFF; return GetGrpInf(polyInfo, grp_id) & 0xFF; @@ -138,7 +138,7 @@ int dBgS::GetGrpRoomInfId(cBgS_PolyInfo& polyInfo) { /* 800A07F4-800A0858 .text GetGrpSoundId__4dBgSFR13cBgS_PolyInfo */ s32 dBgS::GetGrpSoundId(cBgS_PolyInfo& polyInfo) { - s32 grp_id = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp_id = GetTriGrp(polyInfo); if (grp_id == -1) return -1; return (GetGrpInf(polyInfo, grp_id) >> 11) & 0xFF; @@ -146,7 +146,7 @@ s32 dBgS::GetGrpSoundId(cBgS_PolyInfo& polyInfo) { /* 800A0858-800A08C0 .text ChkGrpInf__4dBgSFR13cBgS_PolyInfoUl */ u32 dBgS::ChkGrpInf(cBgS_PolyInfo& polyInfo, u32 mask) { - s32 grp_id = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp_id = GetTriGrp(polyInfo); if (grp_id == -1) return 0; @@ -289,7 +289,7 @@ s32 dBgS::GetRoomId(cBgS_PolyInfo& polyInfo) { dBgW* bgwp = (dBgW*)m_chk_element[id].m_bgw_base_ptr; s32 roomNo = bgwp->mRoomNo; if (roomNo == 0xFFFF) { - s32 grp = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp = GetTriGrp(polyInfo); roomNo = GetGrpToRoomId(polyInfo.GetBgIndex(), grp); if (roomNo == 0xFFFF) return -1; diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index e20e26241..4111056f3 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -2521,7 +2521,7 @@ void dCamera_c::checkGroundInfo() { m33C = 0; if (dComIfG_Bgsp()->ChkMoveBG(mBG.m5C.m04)) { - m33C = dComIfG_Bgsp()->GetActorPointer(mBG.m5C.m04.GetBgIndex()); + m33C = dComIfG_Bgsp()->GetActorPointer(mBG.m5C.m04); if (m33C) { cXyz pos = positionOf(m33C); cSAngle angle = directionOf(m33C); diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index f760b716e..3abb25316 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -1387,7 +1387,7 @@ stage_actor_data_class* dStage_decodeSearchIkada(void* i_file, int ikadaShipId) /* 8004184C-800419D0 .text dStage_playerInitIkada__FP16fopAcM_prm_classPv */ void dStage_playerInitIkada(fopAcM_prm_class* player_prm, void* i_file) { stage_actor_data_class* ikada_data = dStage_decodeSearchIkada(i_file, dComIfGp_getIkadaShipId()); - JUT_ASSERT(1590, ikada_data != NULL); + JUT_ASSERT(VERSION_SELECT(1560, 1590, 1590, 1590), ikada_data != NULL); u8 roomNo = dComIfGp_getIkadaShipBeforeRoomId(); player_prm->base.parameters = 0xFF000000 | roomNo; @@ -1419,7 +1419,7 @@ bool dStage_chkPlayerId(int playerId, int room_no) { if (room_no == -1) { player = dComIfGp_getStage().getPlayer(); } else { - JUT_ASSERT(0x689, 0 <= room_no && room_no < 64); + JUT_ASSERT(VERSION_SELECT(1643, 1673, 1673, 1673), 0 <= room_no && room_no < 64); player = dComIfGp_roomControl_getStatusRoomDt(room_no)->getPlayer(); } @@ -1447,7 +1447,7 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) i_stage->setPlayerNum(num); fopAcM_prm_class* appen = fopAcM_CreateAppend(); - JUT_ASSERT(1735, appen != NULL); + JUT_ASSERT(VERSION_SELECT(1705, 1735, 1735, 1735), appen != NULL); int point = dComIfGp_getStartStagePoint(); u32 roomParam = dComIfGs_getRestartRoomParam(); @@ -1470,7 +1470,7 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) player_data++; } - JUT_ASSERT(1787, i != num); + JUT_ASSERT(VERSION_SELECT(1757, 1787, 1787, 1787), i != num); appen->base.parameters = player_data->base.parameters; appen->base.position = player_data->base.position; @@ -1494,16 +1494,21 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) dStage_actorCreate(player_data, appen); scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID()); - JUT_ASSERT(1842, stageProc != NULL); + JUT_ASSERT(VERSION_SELECT(1812, 1842, 1842, 1842), stageProc != NULL); if (stageProc->base.base.mProcName != PROC_PLAY_SCENE) { fopAcM_create(PROC_TITLE, 0); } +#if VERSION == VERSION_DEMO + else +#endif + { + fopMsgM_Create(PROC_METER, NULL, NULL); - fopMsgM_Create(PROC_METER, NULL, NULL); + cXyz agb_pos(appen->base.position.x, appen->base.position.y + 10.0f, appen->base.position.z); + fopAcM_create(PROC_AGB, 0, &agb_pos); + } - cXyz agb_pos(appen->base.position.x, appen->base.position.y + 10.0f, appen->base.position.z); - fopAcM_create(PROC_AGB, 0, &agb_pos); dComIfGp_setAgb(NULL); return 1; } @@ -1511,20 +1516,23 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) /* 80041E84-80041ED4 .text dStage_cameraInit__FP11dStage_dt_cPviPv */ int dStage_cameraInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { stage_camera_class* camera = (stage_camera_class*)((char*)i_data + 4); + int entryIdx = 0; i_stage->setCamera(camera); - dStage_cameraCreate(camera->m_entries, 0, 0); + dStage_cameraCreate(&camera->m_entries[entryIdx], 0, 0); return 1; } /* 80041ED4-80041F08 .text dStage_RoomCameraInit__FP11dStage_dt_cPviPv */ int dStage_RoomCameraInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setCamera((stage_camera_class*)((char*)i_data + 4)); + stage_camera_class* camera = (stage_camera_class*)((char*)i_data + 4); + i_stage->setCamera(camera); return 1; } /* 80041F08-80041F3C .text dStage_arrowInit__FP11dStage_dt_cPviPv */ int dStage_arrowInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setArrow((stage_arrow_class*)((char*)i_data + 4)); + stage_arrow_class* arrow = (stage_arrow_class*)((char*)i_data + 4); + i_stage->setArrow(arrow); return 1; } @@ -1681,7 +1689,8 @@ int dStage_stagInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 8004238C-800423C0 .text dStage_sclsInfoInit__FP11dStage_dt_cPviPv */ int dStage_sclsInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setSclsInfo((stage_scls_info_dummy_class*)((char*)i_data + 4)); + stage_scls_info_dummy_class* scls_info = (stage_scls_info_dummy_class*)((char*)i_data + 4); + i_stage->setSclsInfo(scls_info); return 1; } @@ -1755,7 +1764,8 @@ s8 dStage_roomRead_dt_c_GetReverbStage(roomRead_class& room, int index) { /* 80042658-8004268C .text dStage_ppntInfoInit__FP11dStage_dt_cPviPv */ int dStage_ppntInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setPntInfo((dStage_dPnt_c*)((char*)i_data + 4)); + dStage_dPnt_c* pStagePnt = (dStage_dPnt_c*)((char*)i_data + 4); + i_stage->setPntInfo(pStagePnt); return 1; } @@ -1772,7 +1782,8 @@ int dStage_pathInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 8004271C-80042750 .text dStage_rppnInfoInit__FP11dStage_dt_cPviPv */ int dStage_rppnInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setPnt2Info((dStage_dPnt_c*)((char*)i_data + 4)); + dStage_dPnt_c* pStagePnt = (dStage_dPnt_c*)((char*)i_data + 4); + i_stage->setPnt2Info(pStagePnt); return 1; } @@ -1789,19 +1800,22 @@ int dStage_rpatInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 800427E0-80042814 .text dStage_soundInfoInit__FP11dStage_dt_cPviPv */ int dStage_soundInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setSoundInfo((dStage_SoundInfo_c*)((char*)i_data + 4)); + dStage_SoundInfo_c* soundInfo = (dStage_SoundInfo_c*)((char*)i_data + 4); + i_stage->setSoundInfo(soundInfo); return 1; } /* 80042814-80042848 .text dStage_eventInfoInit__FP11dStage_dt_cPviPv */ int dStage_eventInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setEventInfo((dStage_EventInfo_c*)((char*)i_data + 4)); + dStage_EventInfo_c* eventInfo = (dStage_EventInfo_c*)((char*)i_data + 4); + i_stage->setEventInfo(eventInfo); return 1; } /* 80042848-8004287C .text dStage_floorInfoInit__FP11dStage_dt_cPviPv */ int dStage_floorInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setFloorInfo((dStage_FloorInfo_c*)((char*)i_data + 4)); + dStage_FloorInfo_c* floorInfo = (dStage_FloorInfo_c*)((char*)i_data + 4); + i_stage->setFloorInfo(floorInfo); return 1; } @@ -1815,7 +1829,7 @@ int dStage_memaInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { for (int i = 0; i < pd->num; i++) { JKRExpHeap* heap = dStage_roomControl_c::createMemoryBlock(i, *entry_p + 0x300); - JUT_ASSERT(2932, heap != NULL); + JUT_ASSERT(VERSION_SELECT(2903, 2932, 2932, 2932), heap != NULL); entry_p++; } } @@ -1842,10 +1856,14 @@ int dStage_mecoInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { #if VERSION == VERSION_DEMO bool dStage_setShipPos(int param_0, int i_roomNo) { - /* Nonmatching */ - i_roomNo = i_roomNo == 0xFF ? dComIfGp_roomControl_getStayNo() : i_roomNo; + int roomNo; + if (i_roomNo == 0xFF) { + roomNo = dComIfGp_roomControl_getStayNo(); + } else { + roomNo = i_roomNo; + } if (param_0 != 0xFF) { - dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(i_roomNo, param_0); + dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(roomNo, param_0); if (ship_data_p != NULL) { daShip_c* ship_p = (daShip_c*)fopAcM_SearchByName(PROC_SHIP); if (ship_p != NULL) { @@ -1885,8 +1903,13 @@ bool dStage_setShipPos(int param_0, int i_roomNo) { } if (param_0 != 0xFF) { - i_roomNo = i_roomNo == 0xFF ? dComIfGp_roomControl_getStayNo() : i_roomNo; - dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(i_roomNo, param_0); + int roomNo; + if (i_roomNo == 0xFF) { + roomNo = dComIfGp_roomControl_getStayNo(); + } else { + roomNo = i_roomNo; + } + dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(roomNo, param_0); if (ship_data_p != NULL) { daShip_c* ship_p = (daShip_c*)fopAcM_SearchByName(PROC_SHIP); if (ship_p != NULL) { @@ -1944,13 +1967,15 @@ int dStage_shipInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 80042C38-80042C6C .text dStage_multInfoInit__FP11dStage_dt_cPviPv */ int dStage_multInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setMulti((dStage_Multi_c*)((char*)i_data + 4)); + dStage_Multi_c* multi = (dStage_Multi_c*)((char*)i_data + 4); + i_stage->setMulti(multi); return 1; } /* 80042C6C-80042CA0 .text dStage_lbnkInfoInit__FP11dStage_dt_cPviPv */ int dStage_lbnkInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setLbnk((dStage_Lbnk_c*)((char*)i_data + 4)); + dStage_Lbnk_c* lbnk = (dStage_Lbnk_c*)((char*)i_data + 4); + i_stage->setLbnk(lbnk); return 1; } @@ -1977,7 +2002,8 @@ int dStage_layerTresureInit(dStage_dt_c* i_stage, void* i_data, int i_num, void* /* 80042DA4-80042DD8 .text dStage_dmapInfoInit__FP11dStage_dt_cPviPv */ int dStage_dmapInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setDMap((dStage_DMap_c*)((char*)i_data + 4)); + dStage_DMap_c* dmap = (dStage_DMap_c*)((char*)i_data + 4); + i_stage->setDMap(dmap); return 1; } @@ -2043,8 +2069,8 @@ void dStage_dt_c_offsetToPtr(void* i_data) { void dStage_dt_c_stageInitLoader(void* i_data, dStage_dt_c* i_stage) { static FuncTable l_funcTable[] = {"STAG", dStage_stagInfoInit}; - JUT_ASSERT(3557, i_data != NULL); - JUT_ASSERT(3558, i_stage != NULL); + JUT_ASSERT(VERSION_SELECT(3529, 3557, 3557, 3557), i_data != NULL); + JUT_ASSERT(VERSION_SELECT(3530, 3558, 3558, 3558), i_stage != NULL); dStage_dt_c_offsetToPtr(i_data); i_stage->init(); @@ -2197,7 +2223,7 @@ void dStage_dt_c_roomReLoader(void* i_data, dStage_dt_c* i_stage, int param_2) { /* 8004324C-800432EC .text dStage_infoCreate__Fv */ void dStage_infoCreate() { void* stageRsrc = dComIfG_getStageRes("Stage", "stage.dzs"); - JUT_ASSERT(3834, stageRsrc != NULL) + JUT_ASSERT(VERSION_SELECT(3806, 3834, 3834, 3834), stageRsrc != NULL) dStage_dt_c_stageInitLoader(stageRsrc, &dComIfGp_getStage()); } @@ -2207,14 +2233,14 @@ void dStage_Create() { dKankyo_create(); void* stageRsrc = dComIfG_getStageRes("Stage", "stage.dzs"); - JUT_ASSERT(3862, stageRsrc != NULL) + JUT_ASSERT(VERSION_SELECT(3834, 3862, 3862, 3862), stageRsrc != NULL) dComIfGp_roomControl_init(); dStage_dt_c_stageLoader(stageRsrc, &dComIfGp_getStage()); if (dComIfGp_getStartStageRoomNo() >= 0) { int status = dStage_roomInit(dComIfGp_getStartStageRoomNo()); - JUT_ASSERT(3873, status); + JUT_ASSERT(VERSION_SELECT(3845, 3873, 3873, 3873), status); } dMap_c::create(); @@ -2282,9 +2308,11 @@ void dStage_roomControl_c::SetTimePass(int i_timepass) { int dStage_changeSceneExitId(cBgS_PolyInfo& i_poly, f32 i_speed, u32 i_mode, s8 i_roomNo) { int exit_id = dComIfG_Bgsp()->GetExitId(i_poly); if (exit_id == 0x3E || exit_id == 0x3B) { - fopAc_ac_c* actor_p = dComIfG_Bgsp()->GetActorPointer(i_poly.GetBgIndex()); - s8 roomNo = IkadaGetRoomNoArg0(actor_p); - s16 point = IkadaGetLinkIdArg1(actor_p); + fopAc_ac_c* actor_p = dComIfG_Bgsp()->GetActorPointer(i_poly); + int arg0 = IkadaGetRoomNoArg0(actor_p); + s8 roomNo = arg0; + int arg1 = IkadaGetLinkIdArg1(actor_p); + u8 point = arg1; if (exit_id == 0x3E) { dComIfGp_setNextStage("Obshop", point, roomNo, -1, i_speed, i_mode); @@ -2297,7 +2325,7 @@ int dStage_changeSceneExitId(cBgS_PolyInfo& i_poly, f32 i_speed, u32 i_mode, s8 dComIfGp_setIkadaShipBeforePos(actor_p->current.pos); return 1; } else if (exit_id == 0x3D) { - JUT_ASSERT(4134, dComIfGp_getIkadaShipBeforeRoomId() >= 0 && + JUT_ASSERT(VERSION_SELECT(4106, 4134, 4134, 4134), dComIfGp_getIkadaShipBeforeRoomId() >= 0 && dComIfGp_getIkadaShipBeforeRoomId() < 64); dComIfGp_setNextStage("sea", -2, dComIfGp_getIkadaShipBeforeRoomId(), -1, i_speed, i_mode); return 1; @@ -2328,7 +2356,7 @@ int dStage_changeScene(int i_exitId, f32 speed, u32 mode, s8 room_no) { if (room_no == -1) { scls = dComIfGp_getStageSclsInfo(); } else { - JUT_ASSERT(4192, 0 <= room_no && room_no < 64); + JUT_ASSERT(VERSION_SELECT(4164, 4192, 4192, 4192), 0 <= room_no && room_no < 64); scls = dComIfGp_roomControl_getStatusRoomDt(room_no)->getSclsInfo(); } @@ -2336,7 +2364,7 @@ int dStage_changeScene(int i_exitId, f32 speed, u32 mode, s8 room_no) { return 0; } - JUT_ASSERT(4202, 0 <= i_exitId && i_exitId < scls->num); + JUT_ASSERT(VERSION_SELECT(4174, 4202, 4202, 4202), 0 <= i_exitId && i_exitId < scls->num); stage_scls_info_class* scls_info = &scls->m_entries[i_exitId]; s32 wipe = dStage_sclsInfo_getWipe(scls_info); diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index cd14a4128..c1764f0f4 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -108,7 +108,11 @@ void mDoGph_gInf_c::create() { /* 80007DDC-80007EA8 .text createHeap__13mDoGph_gInf_cFv */ void mDoGph_gInf_c::createHeap() { +#if VERSION == VERSION_DEMO + JKRHeap* parentHeap = mDoExt_getZeldaHeap(); +#else JKRHeap* parentHeap = JKRHeap::getCurrentHeap(); +#endif mHeap[0] = JKRSolidHeap::create(0x10000, parentHeap, false); JUT_ASSERT(0x1eb, mHeap[0] != NULL); @@ -176,6 +180,7 @@ void mDoGph_gInf_c::calcFade() { } } +#if VERSION > VERSION_DEMO if (mFadeColor.a != 0) { GXSetNumChans(1); GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_NONE, GX_AF_NONE); @@ -211,6 +216,7 @@ void mDoGph_gInf_c::calcFade() { GXPosition3s8(0, 1, -5); GXEnd(); } +#endif } /* 800082D8-80008314 .text onMonotone__13mDoGph_gInf_cFv */ @@ -525,12 +531,18 @@ void drawDepth(view_class* view, view_port_class* viewport, int depth) { GXPixModeSync(); GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP1); GXLoadTexObj(mDoGph_gInf_c::getZbufferTexObj(), GX_TEXMAP0); +#if VERSION == VERSION_DEMO + mDoGph_gInf_c::calcFade(); +#endif GXSetNumChans(0); GXSetNumTexGens(2); GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GXSetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GXSetNumTevStages(3); GXSetTevColorS10(GX_TEVREG0, l_tevColor0); +#if VERSION == VERSION_DEMO + GXSetTevColor(GX_TEVREG2, mDoGph_gInf_c::getFadeColor()); +#endif GXSetTevSwapModeTable(GX_TEV_SWAP3, GX_CH_ALPHA, GX_CH_GREEN, GX_CH_BLUE, GX_CH_RED); GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP3); GXSetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_1); @@ -546,9 +558,17 @@ void drawDepth(view_class* view, view_port_class* viewport, int depth) { GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_TEXA, GX_CA_A0); GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_4, GX_TRUE, GX_TEVPREV); GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR_NULL); +#if VERSION == VERSION_DEMO + GXSetTevColorIn(GX_TEVSTAGE2, GX_CC_TEXC, GX_CC_C2, GX_CC_A2, GX_CC_ZERO); +#else GXSetTevColorIn(GX_TEVSTAGE2, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC); +#endif GXSetTevColorOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); +#if VERSION == VERSION_DEMO + GXSetTevAlphaIn(GX_TEVSTAGE2, GX_CA_APREV, GX_CA_KONST, GX_CA_A2, GX_CA_ZERO); +#else GXSetTevAlphaIn(GX_TEVSTAGE2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV); +#endif GXSetTevAlphaOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetZCompLoc(GX_TRUE); GXSetZMode(GX_FALSE, GX_ALWAYS, GX_FALSE); @@ -558,6 +578,11 @@ void drawDepth(view_class* view, view_port_class* viewport, int depth) { GXSetCullMode(GX_CULL_NONE); GXSetDither(GX_TRUE); GXSetNumIndStages(0); +#if VERSION == VERSION_DEMO + GXSetTevDirect(GX_TEVSTAGE0); + GXSetTevDirect(GX_TEVSTAGE1); + GXSetTevDirect(GX_TEVSTAGE2); +#endif Mtx44 mtx; C_MTXOrtho(mtx, viewport->mYOrig, viewport->mYOrig + viewport->mHeight, viewport->mXOrig, viewport->mXOrig + viewport->mWidth, 0.0, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); @@ -1090,22 +1115,28 @@ out: /* 8000AAC4-8000AB1C .text mCaptureProc__FPv */ u32 mCaptureProc(void* dummy) { u32 bytesCopied = encode_s3tc(mCaptureCaptureBuffer, mCaptureTextureBuffer, mCaptureSizeWidth, mCaptureSizeHeight, (GXTexFmt)mCaptureCaptureFormat); +#if VERSION > VERSION_DEMO DCStoreRange(mCaptureTextureBuffer, mCaptureTextureSize); +#endif OSExitThread((void*)bytesCopied); return bytesCopied; } /* 8000AB1C-8000ABC4 .text mCaptureGXDrawSyncCallback__FUs */ void mCaptureGXDrawSyncCallback(u16) { +#if VERSION > VERSION_DEMO OSCancelAlarm(&mCaptureTimeOutAlarm); BOOL interrupt = OSDisableInterrupts(); if (mCaptureStep == 2) { +#endif void* oldcb = (void*)GXSetDrawSyncCallback(mCaptureOldCB); JUT_ASSERT(0xa5f, oldcb == mCaptureGXDrawSyncCallback); mCaptureOldCB = NULL; mCaptureStep++; +#if VERSION > VERSION_DEMO } OSRestoreInterrupts(interrupt); +#endif } /* 8000ABC4-8000AC3C .text mCaptureGXDrawSyncTimeOut__FP7OSAlarmP9OSContext */ @@ -1168,14 +1199,18 @@ bool mDoGph_screenCapture() { setUpRectangle(); GXSetTexCopySrc(centerX - sizeW, centerY - sizeH, sizeW2, sizeH2); GXSetTexCopyDst(sizeW, sizeH, (GXTexFmt)mCaptureCaptureFormat, GX_TRUE); +#if VERSION > VERSION_DEMO DCInvalidateRange(mCaptureCaptureBuffer, mCaptureCaptureSize); +#endif GXCopyTex(mCaptureCaptureBuffer, GX_FALSE); GXPixModeSync(); JUT_ASSERT(0xac1, mCaptureOldCB == NULL); mCaptureOldCB = GXSetDrawSyncCallback(mCaptureGXDrawSyncCallback); +#if VERSION > VERSION_DEMO OSCreateAlarm(&mCaptureTimeOutAlarm); OSSetAlarm(&mCaptureTimeOutAlarm, mCaptureTimeOutTicks, mCaptureGXDrawSyncTimeOut); +#endif mCaptureStep++; GXSetDrawSync(GX_FALSE); GXSetProjectionv(projv); @@ -1198,19 +1233,25 @@ void setLight() { /* 8000AF2C-8000BC38 .text mDoGph_Painter__Fv */ bool mDoGph_Painter() { +#if VERSION > VERSION_DEMO JFWDisplay::getManager()->setFader(mDoGph_gInf_c::mFader); +#endif mDoGph_gInf_c::setClearColor(mDoGph_gInf_c::getBackColor()); mDoGph_gInf_c::beginRender(); GXSetAlphaUpdate(GX_FALSE); +#if VERSION > VERSION_DEMO mDoGph_gInf_c::setBackColor(g_clearColor); +#endif mDoGph_gInf_c::free(); if (mCaptureEnableGXSetCopyFilter) GXSetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL); j3dSys.drawInit(); +#if VERSION > VERSION_DEMO GXSetDither(GX_TRUE); +#endif J2DOrthoGraph graf(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f); graf.setOrtho(JGeometry::TBox2(-9.0f, -21.0f, 650.0f, 503.0f), -1.0f, 1.0f); @@ -1246,9 +1287,11 @@ bool mDoGph_Painter() { jpaDrawInfo.setFovy(camera->mFovy); jpaDrawInfo.setAspect(camera->mAspect); +#if VERSION > VERSION_DEMO BOOL isTower9 = FALSE; if (strcmp(dComIfGp_getStartStageName(), "GTower") == 0 && dComIfGp_getStartStageLayer() == 9) isTower9 = TRUE; +#endif dComIfGp_setCurrentWindow(window); dComIfGp_setCurrentView(camera); dComIfGp_setCurrentViewport(viewport_p); @@ -1335,11 +1378,12 @@ bool mDoGph_Painter() { dComIfGd_drawOpaListInvisible(); dComIfGd_drawXluListInvisible(); +#if VERSION > VERSION_DEMO j3dSys.reinitGX(); GXSetNumIndStages(0); - if (isTower9) dComIfGp_particle_draw(&jpaDrawInfo); +#endif if (mDoGph_gInf_c::isMonotone()) { clearAlphaBuffer(camera, 0); @@ -1350,6 +1394,7 @@ bool mDoGph_Painter() { dComIfGp_particle_drawToonP1(&jpaDrawInfo); } +#if VERSION > VERSION_DEMO mDoGph_gInf_c::calcFade(); if (mCaptureStep == 1) { if (!mCaptureCansel) @@ -1357,11 +1402,13 @@ bool mDoGph_Painter() { else mCaptureStep = 0; } +#endif } } } if (mCaptureStep == 3) { +#if VERSION > VERSION_DEMO if (mCaptureCansel) { if (mCaptureCaptureBuffer != NULL) { JKRFreeToHeap(NULL, mCaptureCaptureBuffer); @@ -1372,7 +1419,9 @@ bool mDoGph_Painter() { mCaptureTextureBuffer = NULL; } mCaptureStep = 0; - } else { + } else +#endif + { if (mCaptureTextureFormat == GX_TF_CMPR) { mCaptureThreadStackHead = mDoGph_allocFromAny(mCaptureThreadStackSize, 0x20); if (mCaptureThreadStackHead == NULL) { @@ -1395,17 +1444,25 @@ bool mDoGph_Painter() { } if (mCaptureStep == 4) { +#if VERSION > VERSION_DEMO if (mCaptureCansel) { OSCancelThread(&mCaptureThread); } +#endif if (OSIsThreadTerminated(&mCaptureThread)) { - if (mCaptureCaptureBuffer != NULL) { +#if VERSION > VERSION_DEMO + if (mCaptureCaptureBuffer != NULL) +#endif + { JKRFreeToHeap(NULL, mCaptureCaptureBuffer); mCaptureCaptureBuffer = NULL; } - if (mCaptureThreadStackHead != NULL) { +#if VERSION > VERSION_DEMO + if (mCaptureThreadStackHead != NULL) +#endif + { JKRFreeToHeap(NULL, mCaptureThreadStackHead); mCaptureThreadStackHead = NULL; } @@ -1415,36 +1472,55 @@ bool mDoGph_Painter() { mCaptureStep++; } else { OSAlarm alarm; +#if VERSION == VERSION_DEMO + OSCreateAlarm(&alarm); + OSInitThreadQueue(&mCaptureThreadQueue); + OSSetAlarm(&alarm, OSMillisecondsToTicks(3), mCaptureAlarmHandler); +#else u64 tickNum = OSMillisecondsToTicks(10); OSCreateAlarm(&alarm); OSInitThreadQueue(&mCaptureThreadQueue); OSSetAlarm(&alarm, tickNum, mCaptureAlarmHandler); +#endif OSSleepThread(&mCaptureThreadQueue); OSCancelAlarm(&alarm); } } - if ((mCaptureStep == 3 || mCaptureStep == 4 || mCaptureStep == 5) && mCaptureDraw != 0 && !mCaptureCansel) { + if ((mCaptureStep == 3 || mCaptureStep == 4 || mCaptureStep == 5) && mCaptureDraw != 0 +#if VERSION > VERSION_DEMO + && !mCaptureCansel +#endif + ) { mDoGph_screenCaptureDraw(); } +#if VERSION > VERSION_DEMO if (mCaptureStep == 5 && mCaptureCansel) { mCaptureStep = 6; } +#endif if (mCaptureStep == 6) { - if (mCaptureTextureBuffer != NULL) { +#if VERSION > VERSION_DEMO + if (mCaptureTextureBuffer != NULL) +#endif + { JKRFreeToHeap(NULL, mCaptureTextureBuffer); mCaptureTextureBuffer = NULL; } mCaptureStep = 0; +#if VERSION > VERSION_DEMO mCaptureCansel = false; +#endif } dDlst_list_c::calcWipe(); j3dSys.reinitGX(); +#if VERSION > VERSION_DEMO GXSetNumIndStages(0); +#endif graf.setOrtho(JGeometry::TBox2(-9.0f, -21.0f, 650.0f, 503.0f), 100000.0f, -100000.0f); graf.setPort(); @@ -1466,7 +1542,9 @@ bool mDoGph_Painter() { j3dSys.setViewMtx(mDoMtx_stack_c::get()); dComIfGd_drawOpaList2D(); j3dSys.reinitGX(); +#if VERSION > VERSION_DEMO GXSetNumIndStages(0); +#endif j3dSys.setViewMtx(viewMtx); } @@ -1485,11 +1563,15 @@ bool mDoGph_Painter() { /* 8000BC94-8000BD08 .text mDoGph_Create__Fv */ bool mDoGph_Create() { +#if VERSION > VERSION_DEMO JKRSolidHeap * solidHeap = mDoExt_createSolidHeapToCurrent(0, NULL, 0); +#endif mDoGph_gInf_c::create(); dComIfGd_init(); +#if VERSION > VERSION_DEMO mDoExt_adjustSolidHeap(solidHeap); mDoExt_restoreCurrentHeap(); JFWAutoAbortGfx = mDoMain::developmentMode ? 0x02 : 0x01; +#endif return true; }