diff --git a/configure.py b/configure.py index 5d99995d3..070546d7f 100755 --- a/configure.py +++ b/configure.py @@ -406,7 +406,7 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_op/f_op_scene_pause.cpp"), # f_pc - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_base.cpp"), + Object(Matching, "f_pc/f_pc_base.cpp"), Object(Matching, "f_pc/f_pc_create_iter.cpp"), Object(Matching, "f_pc/f_pc_create_req.cpp"), Object(Matching, "f_pc/f_pc_create_tag.cpp"), @@ -414,7 +414,7 @@ config.libs = [ Object(Matching, "f_pc/f_pc_delete_tag.cpp"), Object(Matching, "f_pc/f_pc_deletor.cpp"), Object(Matching, "f_pc/f_pc_draw_priority.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_executor.cpp"), + Object(Matching, "f_pc/f_pc_executor.cpp"), Object(Matching, "f_pc/f_pc_layer.cpp"), Object(Matching, "f_pc/f_pc_leaf.cpp"), Object(Matching, "f_pc/f_pc_layer_iter.cpp"), @@ -427,12 +427,12 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_node_req.cpp"), Object(Matching, "f_pc/f_pc_priority.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_profile.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_searcher.cpp"), + Object(Matching, "f_pc/f_pc_searcher.cpp"), Object(Matching, "f_pc/f_pc_line_tag.cpp"), Object(Matching, "f_pc/f_pc_line_iter.cpp"), Object(Matching, "f_pc/f_pc_method_iter.cpp"), Object(Matching, "f_pc/f_pc_method_tag.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_pause.cpp"), + Object(Matching, "f_pc/f_pc_pause.cpp"), Object(Matching, "f_pc/f_pc_draw.cpp"), Object(Matching, "f_pc/f_pc_fstcreate_req.cpp"), Object(Matching, "f_pc/f_pc_stdcreate_req.cpp"), @@ -505,7 +505,7 @@ config.libs = [ Object(Matching, "d/d_bg_w_hf.cpp"), Object(Matching, "d/d_bg_w_sv.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_d.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_mass_s.cpp"), + Object(Matching, "d/d_cc_mass_s.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_s.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_uty.cpp"), Object(NonMatching, "d/d_cam_param.cpp"), @@ -627,8 +627,8 @@ config.libs = [ Object(Matching, "SSystem/SComponent/c_malloc.cpp"), Object(Matching, "SSystem/SComponent/c_API.cpp"), Object(Matching, "SSystem/SComponent/c_API_graphic.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_cc_d.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_cc_s.cpp"), + Object(Matching, "SSystem/SComponent/c_cc_d.cpp"), + Object(Matching, "SSystem/SComponent/c_cc_s.cpp"), Object(Matching, "SSystem/SComponent/c_counter.cpp"), Object(Matching, "SSystem/SComponent/c_list.cpp"), Object(Matching, "SSystem/SComponent/c_list_iter.cpp"), @@ -642,15 +642,15 @@ config.libs = [ Object(Matching, "SSystem/SComponent/c_tag_iter.cpp"), Object(Matching, "SSystem/SComponent/c_xyz.cpp"), Object(Matching, "SSystem/SComponent/c_sxyz.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_math.cpp"), + Object(Matching, "SSystem/SComponent/c_math.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_chk.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_gnd_chk.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_lin_chk.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_bg_w.cpp"), + Object(Matching, "SSystem/SComponent/c_bg_w.cpp"), Object(Matching, "SSystem/SComponent/c_m2d.cpp"), Object(Matching, "SSystem/SComponent/c_m2d_g_box.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_m3d.cpp"), + Object(Matching, "SSystem/SComponent/c_m3d.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_aab.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_cyl.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_pla.cpp"), @@ -1436,7 +1436,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_ssk"), ActorRel(NonMatching, "d_a_stone"), ActorRel(NonMatching, "d_a_stone2"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_swc00"), + ActorRel(Matching, "d_a_swc00"), ActorRel(Equivalent, "d_a_swhit0", extra_cflags=['-pragma "nosyminline on"']), # weak func order ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_swtdoor"), ActorRel(NonMatching, "d_a_tag_attention"), diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index f4dffa200..5bc85e93e 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -340,7 +340,15 @@ public: virtual cCcD_GStts* GetGStts(); void Init(int, int, void*, fpc_ProcID); virtual void Ct(); +#if VERSION == VERSION_DEMO + void PlusCcMove(f32 x, f32 y, f32 z) { + m_cc_move.x += x; + m_cc_move.y += y; + m_cc_move.z += z; + } +#else void PlusCcMove(f32, f32, f32); +#endif void ClrCcMove() { m_cc_move.x = m_cc_move.y = m_cc_move.z = 0.0f; } diff --git a/include/SSystem/SComponent/c_cc_s.h b/include/SSystem/SComponent/c_cc_s.h index a81c87d7f..72616f537 100644 --- a/include/SSystem/SComponent/c_cc_s.h +++ b/include/SSystem/SComponent/c_cc_s.h @@ -51,15 +51,15 @@ public: void Move(); void DrawClear(); virtual void SetCoGObjInf(bool, bool, cCcD_GObjInf*, cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, - cCcD_GStts*, cCcD_GStts*); + cCcD_GStts*, cCcD_GStts*) {} virtual void SetAtTgGObjInf(bool, bool, cCcD_Obj*, cCcD_Obj*, cCcD_GObjInf*, cCcD_GObjInf*, - cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*, cXyz*); - virtual bool ChkNoHitGAtTg(cCcD_GObjInf const*, cCcD_GObjInf const*, cCcD_GStts*, cCcD_GStts*); + cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*, cXyz*) {} + virtual bool ChkNoHitGAtTg(cCcD_GObjInf const*, cCcD_GObjInf const*, cCcD_GStts*, cCcD_GStts*) { return false; } virtual bool ChkAtTgHitAfterCross(bool, bool, cCcD_GObjInf const*, cCcD_GObjInf const*, - cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*); - virtual bool ChkNoHitGCo(cCcD_Obj*, cCcD_Obj*); + cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*) { return false; } + virtual bool ChkNoHitGCo(cCcD_Obj*, cCcD_Obj*) { return false; } virtual ~cCcS() {} - virtual void MoveAfterCheck(); + virtual void MoveAfterCheck() {} virtual void SetCoGCorrectProc(cCcD_Obj*, cCcD_Obj*); }; // Size = 0x2850 diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index b0c494fdb..be49a5276 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1618,7 +1618,7 @@ inline void dComIfGs_onVisitedRoom(int i_no) { g_dComIfG_gameInfo.save.getMemory().getBit().onVisitedRoom(i_no); } -inline bool dComIfGs_isVisitedRoom(int i_no) { +inline BOOL dComIfGs_isVisitedRoom(int i_no) { return g_dComIfG_gameInfo.save.getMemory().getBit().isVisitedRoom(i_no); } diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index f53f67623..54e6af379 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -401,18 +401,23 @@ inline BOOL fopAcM_isItem(fopAc_ac_c* item, int bitNo) { return dComIfGs_isItem(bitNo, fopAcM_GetHomeRoomNo(item)); } +inline BOOL dComIfGs_isVisitedRoom(int i_no); inline BOOL dComIfGs_isSaveSwitch(int i_stageNo, int i_no); inline BOOL fopAcM_isItemForIb(int itemBitNo, u8 itemNo, s8 roomNo) { if (itemNo == dItem_BLUE_JELLY_e) { +#if VERSION == VERSION_DEMO + return dComIfGs_isVisitedRoom(itemBitNo); +#else // Blue Chu Jelly uses itemBitNo as if it was a switch in stageNo 0xE. return dComIfGs_isSaveSwitch(dSv_save_c::STAGE_BLUE_CHU_JELLY, itemBitNo); +#endif } else { return dComIfGs_isItem(itemBitNo, roomNo); } } -inline void dComIfGs_onSaveSwitch(int i_stageNo, int i_no); inline void dComIfGs_onVisitedRoom(int i_no); +inline void dComIfGs_onSaveSwitch(int i_stageNo, int i_no); inline void fopAcM_onItemForIb(int itemBitNo, u8 itemNo, s8 roomNo) { if (itemNo == dItem_BLUE_JELLY_e) { #if VERSION == VERSION_DEMO diff --git a/include/f_op/f_op_overlap.h b/include/f_op/f_op_overlap.h index 87aafefe0..d68789a83 100644 --- a/include/f_op/f_op_overlap.h +++ b/include/f_op/f_op_overlap.h @@ -3,7 +3,12 @@ #define F_F_OP_OVERLAP_H_ #include "f_pc/f_pc_leaf.h" +#include "f_pc/f_pc_manager.h" extern leafdraw_method_class g_fopOvlp_Method; +inline s16 fopOvlpM_GetName(void* ovlp) { + return fpcM_GetName(ovlp); +} + #endif diff --git a/src/SSystem/SComponent/c_bg_w.cpp b/src/SSystem/SComponent/c_bg_w.cpp index d76fb77e8..3c59ebda2 100644 --- a/src/SSystem/SComponent/c_bg_w.cpp +++ b/src/SSystem/SComponent/c_bg_w.cpp @@ -16,6 +16,10 @@ #include "dolphin/mtx/mtxvec.h" #include "dolphin/types.h" +#if VERSION == VERSION_DEMO +#pragma nosyminline on +#endif + /* 80247500-8024754C .text ASSERT_SOLDHEAP__Fv */ void ASSERT_SOLDHEAP() { if (JKRHeap::sCurrentHeap->getHeapType() != 'SLID') @@ -467,7 +471,7 @@ bool cBgW::LineCheckGrpRp(cBgS_LinChk* chk, int grp_id, int depth) { bool cBgW::RwgGroundCheckCommon(f32 y, u16 poly_index, cBgS_GndChk* chk) { if (y < chk->GetPointP()->y && y > chk->GetNowY()) { cBgD_Tri_t* tri = &pm_bgd->m_t_tbl[poly_index]; - if (cM3d_CrossY_Tri_Front(pm_vtx_tbl[tri->vtx0], pm_vtx_tbl[tri->vtx1], pm_vtx_tbl[tri->vtx2], &chk->m_pos) && !ChkPolyThrough(poly_index, chk->GetPolyPassChk())) { + if (cM3d_CrossY_Tri_Front(pm_vtx_tbl[tri->vtx0], pm_vtx_tbl[tri->vtx1], pm_vtx_tbl[tri->vtx2], chk->GetPointP()) && !ChkPolyThrough(poly_index, chk->GetPolyPassChk())) { chk->SetNowY(y); chk->SetPolyIndex(poly_index); return true; @@ -653,7 +657,7 @@ void cBgW::RwgShdwDraw(int index, cBgS_ShdwDraw* shdw) { if (rwg->next == 0xFFFF) break; index = rwg->next; - JUT_ASSERT(0xbc6, 0 <= index && index < pm_bgd->m_t_num); + JUT_ASSERT(VERSION_SELECT(3013, 3014, 3014, 3014), 0 <= index && index < pm_bgd->m_t_num); } } @@ -726,7 +730,7 @@ bool cBgW::ChkGrpThrough(int, cBgS_GrpPassChk*, int) { /* 80249940-80249A18 .text GetGrpToRoomIndex__4cBgWCFi */ u32 cBgW::GetGrpToRoomIndex(int grp_index) const { - JUT_ASSERT(0xc77, 0 <= grp_index && grp_index < pm_bgd->m_g_num); + JUT_ASSERT(VERSION_SELECT(3190, 3191, 3191, 3191), 0 <= grp_index && grp_index < pm_bgd->m_g_num); cBgD_Grp_t * g_tbl = pm_bgd->m_g_tbl; if (g_tbl[grp_index].m_parent == 0xFFFF || g_tbl[g_tbl[grp_index].m_parent].m_parent == 0xFFFF) return 0xFFFF; @@ -742,7 +746,7 @@ void cBgW::GetTrans(cXyz* dst) const { /* 80249A58-80249B64 .text GetTriPnt__4cBgWCFiP4cXyzP4cXyzP4cXyz */ void cBgW::GetTriPnt(int i_no, cXyz* p0, cXyz* p1, cXyz* p2) const { - JUT_ASSERT(0xcb3, pm_bgd != NULL); + JUT_ASSERT(VERSION_SELECT(3250, 3251, 3251, 3251), pm_bgd != NULL); cBgD_Tri_t * tri = &pm_bgd->m_t_tbl[i_no]; p0->set(pm_vtx_tbl[tri->vtx0]); diff --git a/src/SSystem/SComponent/c_cc_d.cpp b/src/SSystem/SComponent/c_cc_d.cpp index af277ef0c..83db4ba56 100644 --- a/src/SSystem/SComponent/c_cc_d.cpp +++ b/src/SSystem/SComponent/c_cc_d.cpp @@ -204,6 +204,7 @@ void cCcD_Stts::Ct() { m_dmg = 0; } +#if VERSION > VERSION_DEMO /* 802419C4-80241C5C .text PlusCcMove__9cCcD_SttsFfff */ void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) { m_cc_move.x += x; @@ -214,6 +215,7 @@ void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) { CHECK_FLOAT_CLASS(0x1bd, m_cc_move.z); CHECK_VEC3_RANGE(0x1c1, m_cc_move); } +#endif /* 80241C5C-80241C98 .text Set__8cCcD_ObjFRC11cCcD_SrcObj */ void cCcD_Obj::Set(const cCcD_SrcObj& src) { diff --git a/src/SSystem/SComponent/c_cc_s.cpp b/src/SSystem/SComponent/c_cc_s.cpp index 3f7319978..fd89e6903 100644 --- a/src/SSystem/SComponent/c_cc_s.cpp +++ b/src/SSystem/SComponent/c_cc_s.cpp @@ -6,6 +6,10 @@ #include "SSystem/SComponent/c_cc_s.h" #include "JSystem/JUtility/JUTAssert.h" +#if VERSION == VERSION_DEMO +#pragma nosyminline on +#endif + #define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(fpclassify(x) == 1)); #define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f); #define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f) @@ -185,7 +189,10 @@ void cCcS::ChkCo() { cCcD_ShapeAttr* co2ShapeAttr = (*objCo2)->GetShapeAttr(); if (objCo2 == NULL) continue; - f32 cross_len = 0.0f; + f32 cross_len; +#if VERSION > VERSION_DEMO + cross_len = 0.0f; +#endif if (co1ShapeAttr->CrossCo(*co2ShapeAttr, &cross_len)) { SetCoCommonHitInf(*objCo1, co1ShapeAttr->GetCoCP(), *objCo2, co2ShapeAttr->GetCoCP(), cross_len); } @@ -249,7 +256,9 @@ void cCcS::SetCoCommonHitInf(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* /* 8024388C-80244750 .text SetPosCorrect__4cCcSFP8cCcD_ObjP4cXyzP8cCcD_ObjP4cXyzf */ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos2, f32 cross_len) { CHECK_FLOAT_CLASS(604, cross_len); +#if VERSION > VERSION_DEMO CHECK_FLOAT_RANGE(605, cross_len); +#endif if (obj1->ChkCoNoCrr() || obj2->ChkCoNoCrr()) { return; @@ -260,9 +269,15 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos if (obj1->GetStts()->GetActor() != NULL && obj1->GetStts()->GetActor() == obj2->GetStts()->GetActor()) { return; } +#if VERSION == VERSION_DEMO + if (std::fabsf(cross_len) < G_CM3D_F_ABS_MIN) { + return; + } +#else if (std::fabsf(cross_len) < (1.0f / 125.0f)) { return; } +#endif SetCoGCorrectProc(obj1, obj2); @@ -362,6 +377,7 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos } } +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(794, vec1.x); CHECK_FLOAT_CLASS(795, vec1.y); CHECK_FLOAT_CLASS(796, vec1.z); @@ -370,12 +386,14 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos CHECK_FLOAT_CLASS(800, vec2.z); CHECK_VEC3_RANGE(804, vec1); CHECK_VEC3_RANGE(808, vec2); +#endif obj1->GetStts()->PlusCcMove(vec1.x, vec1.y, vec1.z); obj2->GetStts()->PlusCcMove(vec2.x, vec2.y, vec2.z); (*ppos1) += vec1; (*ppos2) += vec2; +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(817, ppos1->x); CHECK_FLOAT_CLASS(818, ppos1->y); CHECK_FLOAT_CLASS(819, ppos1->z); @@ -384,6 +402,7 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos CHECK_FLOAT_CLASS(823, ppos2->z); CHECK_PVEC3_RANGE(827, ppos1); CHECK_PVEC3_RANGE(831, ppos2); +#endif } /* 80244750-80244894 .text CalcArea__4cCcSFv */ @@ -447,25 +466,3 @@ void cCcS::DrawClear() { /* 8024498C-80244990 .text SetCoGCorrectProc__4cCcSFP8cCcD_ObjP8cCcD_Obj */ void cCcS::SetCoGCorrectProc(cCcD_Obj*, cCcD_Obj*) { } - -/* 80244990-80244998 .text ChkNoHitGCo__4cCcSFP8cCcD_ObjP8cCcD_Obj */ -bool cCcS::ChkNoHitGCo(cCcD_Obj*, cCcD_Obj*) { - return false; -} - -/* 80244998-8024499C .text SetAtTgGObjInf__4cCcSFbbP8cCcD_ObjP8cCcD_ObjP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GSttsP4cXyz */ -void cCcS::SetAtTgGObjInf(bool, bool, cCcD_Obj*, cCcD_Obj*, cCcD_GObjInf*, cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*, cXyz*) { -} - -/* 8024499C-802449A4 .text ChkAtTgHitAfterCross__4cCcSFbbPC12cCcD_GObjInfPC12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts */ -bool cCcS::ChkAtTgHitAfterCross(bool, bool, const cCcD_GObjInf*, const cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*) { - return false; -} - -/* 802449A4-802449A8 .text SetCoGObjInf__4cCcSFbbP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts */ -void cCcS::SetCoGObjInf(bool, bool, cCcD_GObjInf*, cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*) { -} - -/* 802449A8-802449AC .text MoveAfterCheck__4cCcSFv */ -void cCcS::MoveAfterCheck() { -} diff --git a/src/SSystem/SComponent/c_m3d.cpp b/src/SSystem/SComponent/c_m3d.cpp index 994537c71..0e790ca7a 100644 --- a/src/SSystem/SComponent/c_m3d.cpp +++ b/src/SSystem/SComponent/c_m3d.cpp @@ -107,7 +107,12 @@ f32 cM3d_SignedLenPlaAndPos(const cM3dGPla* plane, const Vec* pos) { void cM3d_CalcPla(const Vec* p0, const Vec* p1, const Vec* p2, Vec* pDst, f32* pT) { cM3d_VectorProduct(p0, p1, p2, pDst); f32 t = VECMag(pDst); - if (std::fabsf(t) >= 0.02f) { +#if VERSION == VERSION_DEMO + if (!cM3d_IsZero(t)) +#else + if (std::fabsf(t) >= 0.02f) +#endif + { VECScale(pDst, pDst, 1.0f / t); *pT = -VECDotProduct(pDst, p0); } else { @@ -1372,16 +1377,16 @@ int cM3d_Cross_LinSph_CrossPos(const cM3dGSph& sph, const cM3dGLin& line, Vec* p /* 8024D378-8024DB34 .text cM3d_Cross_CylSph__FPC8cM3dGCylPC8cM3dGSphP3VecPf */ bool cM3d_Cross_CylSph(const cM3dGCyl* pcyl, const cM3dGSph* psph, Vec* param_2, f32* pcross_len) { const Vec* pnow_sph_center = psph->GetCP(); - CHECK_FLOAT_CLASS(2498, pnow_sph_center->x); - CHECK_FLOAT_CLASS(2499, pnow_sph_center->y); - CHECK_FLOAT_CLASS(2500, pnow_sph_center->z); - CHECK_FLOAT_CLASS(2501, psph->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2499, 2498, 2498, 2498), pnow_sph_center->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2500, 2499, 2499, 2499), pnow_sph_center->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2501, 2500, 2500, 2500), pnow_sph_center->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2502, 2501, 2501, 2501), psph->GetR()); const Vec* pnow_cyl_center = pcyl->GetCP(); - CHECK_FLOAT_CLASS(2503, pnow_cyl_center->x); - CHECK_FLOAT_CLASS(2504, pnow_cyl_center->y); - CHECK_FLOAT_CLASS(2505, pnow_cyl_center->z); - CHECK_FLOAT_CLASS(2506, pcyl->GetH()); - CHECK_FLOAT_CLASS(2507, pcyl->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2504, 2503, 2503, 2503), pnow_cyl_center->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2505, 2504, 2504, 2504), pnow_cyl_center->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2506, 2505, 2505, 2505), pnow_cyl_center->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2507, 2506, 2506, 2506), pcyl->GetH()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2508, 2507, 2507, 2507), pcyl->GetR()); f32 radius_sum = pcyl->GetR() + psph->GetR(); f32 dist = std::sqrtf(cM3d_Len2dSq(pnow_sph_center->x, pnow_sph_center->z, pnow_cyl_center->x, pnow_cyl_center->z)); @@ -1406,7 +1411,9 @@ bool cM3d_Cross_CylSph(const cM3dGCyl* pcyl, const cM3dGSph* psph, Vec* param_2, } else { *param_2 = *pnow_sph_center; } +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(2539, *pcross_len); +#endif return true; } @@ -1415,26 +1422,26 @@ bool cM3d_Cross_CylSph(const cM3dGCyl* pcyl, const cM3dGSph* psph, Vec* param_2, /* 8024DB34-8024E1B4 .text cM3d_Cross_SphSph__FPC8cM3dGSphPC8cM3dGSphPfPf */ bool cM3d_Cross_SphSph(const cM3dGSph* i_a, const cM3dGSph* i_b, f32* param_2, f32* i_pcc_crosslen) { - CHECK_FLOAT_CLASS(2565, i_a->GetCP()->x); - CHECK_FLOAT_CLASS(2566, i_a->GetCP()->y); - CHECK_FLOAT_CLASS(2567, i_a->GetCP()->z); - CHECK_FLOAT_CLASS(2568, i_a->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2566, 2565, 2565, 2565), i_a->GetCP()->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2567, 2566, 2566, 2566), i_a->GetCP()->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2568, 2567, 2567, 2567), i_a->GetCP()->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2569, 2568, 2568, 2568), i_a->GetR()); - CHECK_FLOAT_CLASS(2569, i_b->GetCP()->x); - CHECK_FLOAT_CLASS(2570, i_b->GetCP()->y); - CHECK_FLOAT_CLASS(2571, i_b->GetCP()->z); - CHECK_FLOAT_CLASS(2572, i_b->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2570, 2569, 2569, 2569), i_b->GetCP()->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2571, 2570, 2570, 2570), i_b->GetCP()->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2572, 2571, 2571, 2571), i_b->GetCP()->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2573, 2572, 2572, 2572), i_b->GetR()); Vec delta; VECSubtract(i_a->GetCP(), i_b->GetCP(), &delta); *param_2 = VECMag(&delta); *i_pcc_crosslen = i_a->GetR() + i_b->GetR() - *param_2; if (*i_pcc_crosslen > G_CM3D_F_ABS_MIN) { - CHECK_FLOAT_CLASS(2582, *i_pcc_crosslen); + CHECK_FLOAT_CLASS(VERSION_SELECT(2583, 2582, 2582, 2582), *i_pcc_crosslen); return true; } else { *i_pcc_crosslen = 0.0f; - CHECK_FLOAT_CLASS(2587, *i_pcc_crosslen); + CHECK_FLOAT_CLASS(VERSION_SELECT(2588, 2587, 2587, 2587), *i_pcc_crosslen); return false; } } @@ -1547,17 +1554,17 @@ bool cM3d_Cross_SphTri(const cM3dGSph* sph, const cM3dGTri* tri, Vec* param_2) { /* 8024E694-8024EF80 .text cM3d_Cross_CylCyl__FPC8cM3dGCylPC8cM3dGCylPf */ bool cM3d_Cross_CylCyl(const cM3dGCyl* i_cyl1, const cM3dGCyl* i_cyl2, f32* i_pcross_len) { const Vec& c1 = i_cyl1->GetC(); - CHECK_FLOAT_CLASS(2826, c1.x); - CHECK_FLOAT_CLASS(2827, c1.y); - CHECK_FLOAT_CLASS(2828, c1.z); - CHECK_FLOAT_CLASS(2829, i_cyl1->GetR()); - CHECK_FLOAT_CLASS(2830, i_cyl1->GetH()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2827, 2826, 2826, 2826), c1.x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2828, 2827, 2827, 2827), c1.y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2829, 2828, 2828, 2828), c1.z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2830, 2829, 2829, 2829), i_cyl1->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2831, 2830, 2830, 2830), i_cyl1->GetH()); const Vec& c2 = i_cyl2->GetC(); - CHECK_FLOAT_CLASS(2832, c2.x); - CHECK_FLOAT_CLASS(2833, c2.y); - CHECK_FLOAT_CLASS(2834, c2.z); - CHECK_FLOAT_CLASS(2835, i_cyl2->GetR()); - CHECK_FLOAT_CLASS(2836, i_cyl2->GetH()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2833, 2832, 2832, 2832), c2.x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2834, 2833, 2833, 2833), c2.y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2835, 2834, 2834, 2834), c2.z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2836, 2835, 2835, 2835), i_cyl2->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2837, 2836, 2836, 2836), i_cyl2->GetH()); f32 delta_x = c1.x - c2.x; f32 delta_z = c1.z - c2.z; @@ -1566,18 +1573,18 @@ bool cM3d_Cross_CylCyl(const cM3dGCyl* i_cyl1, const cM3dGCyl* i_cyl2, f32* i_pc if (dist_sq > radius_sum * radius_sum) { *i_pcross_len = 0.0f; - CHECK_FLOAT_CLASS(2849, *i_pcross_len); + CHECK_FLOAT_CLASS(VERSION_SELECT(2850, 2849, 2849, 2849), *i_pcross_len); return false; } if (c1.y + i_cyl1->GetH() < c2.y || c1.y > c2.y + i_cyl2->GetH()) { *i_pcross_len = 0.0f; - CHECK_FLOAT_CLASS(2857, *i_pcross_len); + CHECK_FLOAT_CLASS(VERSION_SELECT(2858, 2857, 2857, 2857), *i_pcross_len); return false; } *i_pcross_len = radius_sum - std::sqrtf(dist_sq); - CHECK_FLOAT_CLASS(2864, *i_pcross_len); + CHECK_FLOAT_CLASS(VERSION_SELECT(2865, 2864, 2864, 2864), *i_pcross_len); return true; } @@ -1632,7 +1639,7 @@ bool cM3d_Cross_CylTri(const cM3dGCyl* cyl, const cM3dGTri* tri, Vec* param_2) { } Vec vec1, vec2; - f32 min_len_sq = 1.0e9f; + f32 min_len_sq = G_CM3D_F_INF; if (cM3d_Cross_CylPntPnt(cyl, &tri->mA, &tri->mB, &vec1, &vec2)) { min_len_sq = cM3d_LenSq(&vec1, &tri->mA); *param_2 = vec1; @@ -1652,7 +1659,7 @@ bool cM3d_Cross_CylTri(const cM3dGCyl* cyl, const cM3dGTri* tri, Vec* param_2) { } } - if (min_len_sq != 1.0e9f) { + if (min_len_sq != G_CM3D_F_INF) { return true; } diff --git a/src/SSystem/SComponent/c_math.cpp b/src/SSystem/SComponent/c_math.cpp index ddfffd9de..363b8647b 100644 --- a/src/SSystem/SComponent/c_math.cpp +++ b/src/SSystem/SComponent/c_math.cpp @@ -199,3 +199,16 @@ void cM_initRnd2(int p0, int p1, int p2) { r12 = p1; r22 = p2; } + +#if VERSION == VERSION_DEMO +float cM_rnd2(void) { + r02 = (r02 * 0xAB) % 0x763D; + r12 = (r12 * 0xAC) % 0x7663; + r22 = (r22 * 0xAA) % 0x7673; + return std::fabsf(std::fmodf(r02 / 30269.0f + r12 / 30307.0f + r22 / 30323.0f, 1.0)); +} + +float cM_rndFX2(float f) { + return f * (cM_rnd2() - 0.5f) * 2.0f; +} +#endif diff --git a/src/d/actor/d_a_andsw2.cpp b/src/d/actor/d_a_andsw2.cpp index 99a8d515e..de91c9701 100644 --- a/src/d/actor/d_a_andsw2.cpp +++ b/src/d/actor/d_a_andsw2.cpp @@ -31,18 +31,18 @@ u8 daAndsw2_c::getEventNo() { /* 00000084-00000090 .text getSwbit__10daAndsw2_cFv */ u8 daAndsw2_c::getSwbit() { // Switch to set. - return (base.mParameters & 0x00FF0000) >> 16; + return (fopAcM_GetParam(this) & 0x00FF0000) >> 16; } /* 00000090-0000009C .text getSwbit2__10daAndsw2_cFv */ u8 daAndsw2_c::getSwbit2() { // First switch to check. - return (base.mParameters & 0xFF000000) >> 24; + return (fopAcM_GetParam(this) & 0xFF000000) >> 24; } /* 0000009C-000000A8 .text getType__10daAndsw2_cFv */ u8 daAndsw2_c::getType() { - return (base.mParameters & 0x0000FF00) >> 8; + return (fopAcM_GetParam(this) & 0x0000FF00) >> 8; } /* 000000A8-000000B4 .text getTimer__10daAndsw2_cFv */ @@ -53,7 +53,7 @@ u8 daAndsw2_c::getTimer() { /* 000000B4-000000C0 .text getNum__10daAndsw2_cFv */ u8 daAndsw2_c::getNum() { // Number of switches to check. - return (base.mParameters & 0x000000FF) >> 0; + return (fopAcM_GetParam(this) & 0x000000FF) >> 0; } /* 000000C0-00000130 .text getTopSw__10daAndsw2_cFv */ diff --git a/src/d/actor/d_a_kytag04.cpp b/src/d/actor/d_a_kytag04.cpp index 348330f40..05edbc668 100644 --- a/src/d/actor/d_a_kytag04.cpp +++ b/src/d/actor/d_a_kytag04.cpp @@ -50,8 +50,8 @@ static cPhs_State daKytag04_Create(fopAc_ac_c* i_this) { fopAcM_SetupActor(i_this, kytag04_class); kytag04_class* a_this = (kytag04_class*)i_this; a_this->mState = 0; - a_this->mOffColPat = a_this->base.mParameters; - a_this->mOnColPat = a_this->base.mParameters >> 8; + a_this->mOffColPat = fopAcM_GetParam(a_this) & 0xFF; + a_this->mOnColPat = (fopAcM_GetParam(a_this) >> 8) & 0xFF; a_this->mSwitchNo = a_this->current.angle.x; a_this->mScaleX = a_this->scale.x * 100.0f; a_this->mScaleY = a_this->scale.y * 100.0f; diff --git a/src/d/actor/d_a_kytag05.cpp b/src/d/actor/d_a_kytag05.cpp index 5e4000bc1..b9222e3c6 100644 --- a/src/d/actor/d_a_kytag05.cpp +++ b/src/d/actor/d_a_kytag05.cpp @@ -135,7 +135,7 @@ static cPhs_State daKytag05_Create(fopAc_ac_c* i_this) { a_this->mIndex = 0; a_this->mTimer = 0; - a_this->mUnknownParam = i_this->base.mParameters & 0xff; + a_this->mUnknownParam = fopAcM_GetParam(i_this) & 0xff; dKyw_evt_wind_set_go(); dKyw_evt_wind_set(0, 0); g_env_light.mSnowCount = 200; diff --git a/src/d/actor/d_a_sail.cpp b/src/d/actor/d_a_sail.cpp index 9315b4c65..54fd49f1e 100644 --- a/src/d/actor/d_a_sail.cpp +++ b/src/d/actor/d_a_sail.cpp @@ -489,7 +489,7 @@ static BOOL daSail_Draw(sail_class* i_this) { mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z); - mDoMtx_concat(j3dSys.mViewMtx, *calc_mtx, *i_this->mSailPacket.getMtx()); + mDoMtx_concat(j3dSys.getViewMtx(), *calc_mtx, *i_this->mSailPacket.getMtx()); cXyz* vtxPos = i_this->mSailPacket.getPos(); MtxTrans( @@ -503,7 +503,7 @@ static BOOL daSail_Draw(sail_class* i_this) { mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z); - mDoMtx_concat(j3dSys.mViewMtx, *calc_mtx, *i_this->mSailPacket.getStickMtx()); + mDoMtx_concat(j3dSys.getViewMtx(), *calc_mtx, *i_this->mSailPacket.getStickMtx()); i_this->mSailPacket.mStickModel->setBaseTRMtx(*calc_mtx); MtxTrans(0.0f, 0.0f, 0.0f, 0); diff --git a/src/d/actor/d_a_shand.cpp b/src/d/actor/d_a_shand.cpp index 015aa326b..358d098df 100644 --- a/src/d/actor/d_a_shand.cpp +++ b/src/d/actor/d_a_shand.cpp @@ -250,16 +250,17 @@ void hand_move(shand_class* i_this) { case 1: if((fopAcM_GetParam(actor) & 0xFF) != 1){ dBgS_GndChk local_ac; - float chk_pos_x = actor->current.pos.x, chk_pos_y = actor->current.pos.y, chk_pos_z = actor->current.pos.z; - chk_pos_y -= 100.0f; - local_ac.GetPointP()->set(chk_pos_x, chk_pos_y, chk_pos_z); + Vec chk_pos; + chk_pos = actor->current.pos; + chk_pos.y -= 100.0f; + local_ac.SetPos(&chk_pos); i_this->ground_y = dComIfG_Bgsp()->GroundCross(&local_ac); dBgS_ObjGndChk_Spl local_100; - chk_pos_x = actor->current.pos.x, chk_pos_y = actor->current.pos.y, chk_pos_z = actor->current.pos.z; - chk_pos_y += 200.0f; - local_100.GetPointP()->set(chk_pos_x, chk_pos_y, chk_pos_z); - float spl_ground_y = dComIfG_Bgsp()->GroundCross(&local_100) + 10.0f; + chk_pos = actor->current.pos; + chk_pos.y += 200.0f; + local_100.SetPos(&chk_pos); + f32 spl_ground_y = dComIfG_Bgsp()->GroundCross(&local_100) + 10.0f; if(spl_ground_y != -G_CM3D_F_INF){ i_this->ground_y = spl_ground_y; } diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index 322fff5f9..376cd4327 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -17,22 +17,22 @@ static u8 msg_mode; /* 00000078-00000084 .text getEventNo__11daTag_Msg_cFv */ u32 daTag_Msg_c::getEventNo() { - return base.mParameters >> 0x18; + return fopAcM_GetParam(this) >> 0x18; } /* 00000084-00000090 .text getSwbit__11daTag_Msg_cFv */ u32 daTag_Msg_c::getSwbit() { - return base.mParameters >> 8 & 0xff; + return (fopAcM_GetParam(this) >> 8) & 0xff; } /* 00000090-0000009C .text getSwbit2__11daTag_Msg_cFv */ u32 daTag_Msg_c::getSwbit2() { - return base.mParameters >> 0x10 & 0xff; + return (fopAcM_GetParam(this) >> 0x10) & 0xff; } /* 0000009C-000000A8 .text getType2__11daTag_Msg_cFv */ u32 daTag_Msg_c::getType2() { - return base.mParameters >> 6 & 3; + return (fopAcM_GetParam(this) >> 6) & 3; } /* 000000A8-0000015C .text myDemoName__11daTag_Msg_cFv */ diff --git a/src/d/d_a_bomb_static.cpp b/src/d/d_a_bomb_static.cpp index 1de8baf05..c799d8086 100644 --- a/src/d/d_a_bomb_static.cpp +++ b/src/d/d_a_bomb_static.cpp @@ -109,7 +109,9 @@ bool daBomb_c::chk_state(daBomb_c::State_e state) const { /* 800682C0-800682F0 .text change_state__8daBomb_cFQ28daBomb_c7State_e */ void daBomb_c::change_state(daBomb_c::State_e new_state) { - base.mParameters = (base.mParameters & ~(((1 << PRM_STATE_W) - 1) << PRM_STATE_S)) | (new_state << PRM_STATE_S); // & 0xFF000000 + u32 params = fopAcM_GetParam(this) & ~(((1 << PRM_STATE_W) - 1) << PRM_STATE_S); + params |= (new_state << PRM_STATE_S); + fopAcM_SetParam(this, params); _prm_chk_version(); } diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index c8cc4ee10..c442ed504 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -128,7 +128,7 @@ void dBgS_Acch::GroundCheck(dBgS& i_bgs) { pos.y += m_ground_up_h_diff + (m_ground_check_offset - m_ground_up_h); m_ground_up_h_diff = 0.0f; - m_gnd.m_pos = pos; + m_gnd.SetPos(&pos); m_ground_h = i_bgs.GroundCross(&m_gnd); if (m_ground_h != -G_CM3D_F_INF) { diff --git a/src/d/d_cc_mass_s.cpp b/src/d/d_cc_mass_s.cpp index 4ae8ac42c..d4f0d8a51 100644 --- a/src/d/d_cc_mass_s.cpp +++ b/src/d/d_cc_mass_s.cpp @@ -32,25 +32,23 @@ void dCcMassS_Mng::Ct() { void dCcMassS_Mng::Prepare() { cM3dGAab area; area.ClearForMinMax(); - cCcD_ShapeAttr* attr; for (dCcMassS_Obj* mass = mMassObjs; mass < mMassObjs + mMassObjCount; mass++) { cCcD_Obj* pobj = mass->GetObj(); JUT_ASSERT(61, pobj != NULL); - attr = pobj->GetShapeAttr(); + cCcD_ShapeAttr* attr = pobj->GetShapeAttr(); attr->CalcAabBox(); area.SetMinMax(attr->GetWorkAab()); } for (dCcMassS_Obj* mass = mMassAreas; mass < mMassAreas + mMassAreaCount; mass++) { cCcD_Obj* parea = mass->GetObj(); JUT_ASSERT(73, parea != NULL); - attr = parea->GetShapeAttr(); + cCcD_ShapeAttr* attr = parea->GetShapeAttr(); attr->CalcAabBox(); area.SetMinMax(attr->GetWorkAab()); } if (mFlag & 1) { mCpsAttr.CalcAabBox(); - attr = &mCpsAttr; - area.SetMinMax(attr->GetWorkAab()); + area.SetMinMax(mCpsAttr.GetWorkAab()); } mDivideArea.SetArea(area); for (dCcMassS_Obj* mass = mMassObjs; mass < mMassObjs + mMassObjCount; mass++) { diff --git a/src/d/d_cc_s.cpp b/src/d/d_cc_s.cpp index 61b2b2ba7..4a1fee476 100644 --- a/src/d/d_cc_s.cpp +++ b/src/d/d_cc_s.cpp @@ -479,8 +479,3 @@ bool dCcS::ChkNoHitGCo(cCcD_Obj* obj1, cCcD_Obj* obj2) { } return false; } - -/* 800AE930-800AE938 .text ChkNoHitGAtTg__4cCcSFPC12cCcD_GObjInfPC12cCcD_GObjInfP10cCcD_GSttsP10cCcD_GStts */ -bool cCcS::ChkNoHitGAtTg(const cCcD_GObjInf*, const cCcD_GObjInf*, cCcD_GStts*, cCcD_GStts*) { - return false; -} diff --git a/src/d/d_cc_uty.cpp b/src/d/d_cc_uty.cpp index f55c485f3..a0c3d1e40 100644 --- a/src/d/d_cc_uty.cpp +++ b/src/d/d_cc_uty.cpp @@ -86,7 +86,7 @@ void def_se_set_p(fopAc_ac_c* actor, cXyz* sePos, cCcD_Obj* obj, unsigned long r /* 800AEBCC-800AEEF8 .text at_power_check__FP8CcAtInfo */ fopAc_ac_c* at_power_check(CcAtInfo* atInfo) { - daPy_py_c* player = daPy_getPlayerActorClass(); + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); if (atInfo->mpObj == NULL) { return NULL; } @@ -209,7 +209,7 @@ fopAc_ac_c* cc_at_check(fopAc_ac_c* tgActor, CcAtInfo* atInfo) { if (fopAcM_GetName(atInfo->mpActor) == PROC_HIMO2 && tgActor->stealItemLeft != 0) { tgActor->stealItemLeft--; - fopAcM_createStealItem(&tgActor->current.pos, tgActor->itemTableIdx, tgActor->current.roomNo, NULL, tgActor->stealItemBitNo); + fopAcM_createStealItem(&tgActor->current.pos, tgActor->itemTableIdx, fopAcM_GetRoomNo(tgActor), NULL, tgActor->stealItemBitNo); tgActor->stealItemBitNo++; atInfo->mDamage = 0; } diff --git a/src/d/d_ovlp_fade4.cpp b/src/d/d_ovlp_fade4.cpp index 451ef2967..ddf455f47 100644 --- a/src/d/d_ovlp_fade4.cpp +++ b/src/d/d_ovlp_fade4.cpp @@ -185,7 +185,7 @@ dOvlpFd4_c::dOvlpFd4_c() { first = true; setExecute(&dOvlpFd4_c::execFirstSnap); setDraw(&dOvlpFd4_c::drawFadeOut); - if (base.mProcName == PROC_OVERLAP4) { + if (fopOvlpM_GetName(this) == PROC_OVERLAP4) { fadeOutComposite_dlst.init(mDoGph_gInf_c::getFrameBufferTimg(), 0.0f, 0.0f, 640.0f, 480.0f, g_saftyWhiteColor); } else { fadeOutComposite_dlst.init(mDoGph_gInf_c::getFrameBufferTimg(), 0.0f, 0.0f, 640.0f, 480.0f, (GXColor){ 0x00, 0x00, 0x00, 0x00 }); diff --git a/src/d/d_s_actor_data_mng.cpp b/src/d/d_s_actor_data_mng.cpp index 0683c7201..8f3ac628e 100644 --- a/src/d/d_s_actor_data_mng.cpp +++ b/src/d/d_s_actor_data_mng.cpp @@ -65,11 +65,10 @@ void dADM_CharTbl::SetUpIndex() { /* 800C2B40-800C2BC8 .text GetNameIndex2__12dADM_CharTblCFPCci */ int dADM_CharTbl::GetNameIndex2(const char* pName, int index) const { for (int start = 0; ; start++) { - int col = GetNameIndex(pName, start); - if (col == -1) + start = GetNameIndex(pName, start); + if (start == -1) return -1; - start = col; int inf = GetInf(mIndex_ARG, start); if (index == inf) return start; @@ -117,7 +116,7 @@ void dADM::SetData(void* pData) { } if (FindTag('ACFN', &row, &rowOffs) && FindTag('ACNA', &name, &nameOffs) && FindTag('ACDS', &dat_size, &dataOffs)) { - JUT_ASSERT(0xca, row * name == dat_size); + JUT_ASSERT(202, row * name == dat_size); mCharTbl.SetData((u32)pData, row, rowOffs, name, nameOffs, dat_size, dataOffs); } } diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 3abb25316..fcc19831e 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -194,7 +194,7 @@ int stayRoomCheck(int roomCount, u8* rooms, int roomNo) { /* 80040DDC-80040E38 .text createRoomScene__Fi */ int createRoomScene(int param_0) { - int* ptr = (int*)JKRHeap::alloc(4, -4, NULL); + int* ptr = (int*)JKRAlloc(4, -4); if (ptr == NULL) { return 0; } diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index c4ed54183..cf3253286 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -30,12 +30,12 @@ #include "weak_bss_3569.h" // IWYU pragma: keep #define MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action) \ - ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 0x8 | switchNo2 << 0x10 | (type & 0x3) << 0x18 | (action & 0x3F) << 0x1A) + ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 8 | (switchNo2 & 0xFF) << 16 | (type & 0x3) << 24 | (action & 0x3F) << 26) /* 80024060-80024104 .text fopAcM_setStageLayer__FPv */ void fopAcM_setStageLayer(void* pProc) { scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID()); - JUT_ASSERT(0xee, stageProc != NULL); + JUT_ASSERT(238, stageProc != NULL); fpcM_ChangeLayerID(pProc, fopScnM_LayerID(stageProc)); } @@ -43,7 +43,7 @@ void fopAcM_setStageLayer(void* pProc) { void fopAcM_setRoomLayer(void* pProc, int room_no) { if (room_no >= 0) { scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(room_no)); - JUT_ASSERT(0x105, roomProc != NULL); + JUT_ASSERT(261, roomProc != NULL); fpcM_ChangeLayerID(pProc, fopScnM_LayerID(roomProc)); } } @@ -269,8 +269,8 @@ fpc_ProcID fopAcM_createChildFromOffset(char* pProcNameString, fpc_ProcID parent /* 80024B78-80024CA0 .text fopAcM_createHeap__FP10fopAc_ac_cUlUl */ s32 fopAcM_createHeap(fopAc_ac_c* i_this, u32 size, u32 align) { - JUT_ASSERT(0x33b, i_this); - JUT_ASSERT(0x33c, i_this->heap == NULL); + JUT_ASSERT(827, i_this); + JUT_ASSERT(828, i_this->heap == NULL); fopAcM_Log(i_this, "アクターのヒープの生成"); if (align == 0) align = 0x20; @@ -317,8 +317,11 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 heap = mDoExt_createSolidHeapFromGameToCurrent(estimatedHeapSize, 0x20); if (heap != NULL) { bool result = createHeapCB(i_this); + +#if VERSION > VERSION_DEMO if (heap->getFreeSize() >= 0x20) - JKRHeap::alloc(0x20, 0, NULL); + JKRAlloc(0x20, 0); +#endif mDoExt_restoreCurrentHeap(); @@ -352,7 +355,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 if (heap == NULL) { heap = mDoExt_createSolidHeapFromGameToCurrent(-1, 0x20); - JUT_ASSERT(0x453, heap); + JUT_ASSERT(VERSION_SELECT(1103, 1107, 1107, 1107), heap); bool result = createHeapCB(i_this); mDoExt_restoreCurrentHeap(); @@ -389,7 +392,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 heap = NULL; bool result = createHeapCB(i_this); mDoExt_restoreCurrentHeap(); - JUT_ASSERT(0x48d, result != FALSE); + JUT_ASSERT(VERSION_SELECT(1161, 1165, 1165, 1165), result != FALSE); if (result == FALSE) { // "Entry failed with the exact size heap? (Bug)\n" OSReport_Error("ぴったりサイズで、登録失敗?(バグ)\n"); @@ -417,7 +420,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 // "Buggy!\n" OSReport_Error("ばぐばぐです\n"); - JUT_ASSERT(0x4b5, FALSE); + JUT_ASSERT(VERSION_SELECT(1201, 1205, 1205, 1205), FALSE); } // "fopAcM_entrySolidHeap failed. [%s]\n" @@ -445,7 +448,7 @@ void fopAcM_setCullSizeSphere(fopAc_ac_c* i_this, f32 x, f32 y, f32 z, f32 r) { /* 80025114-80025144 .text fopAcM_addAngleY__FP10fopAc_ac_css */ bool fopAcM_addAngleY(fopAc_ac_c* i_this, short target, short step) { - return cLib_chaseAngleS(&i_this->current.angle.y, target, step); + return cLib_chaseAngleS(&fopAcM_GetAngle_p(i_this)->y, target, step); } /* 80025144-800251A0 .text fopAcM_calcSpeed__FP10fopAc_ac_c */ @@ -483,24 +486,24 @@ void fopAcM_posMoveF(fopAc_ac_c* i_this, const cXyz* move) { /* 80025250-80025278 .text fopAcM_searchActorAngleY__FP10fopAc_ac_cP10fopAc_ac_c */ s16 fopAcM_searchActorAngleY(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - return cLib_targetAngleY(&i_this->current.pos, &i_other->current.pos); + return cLib_targetAngleY(fopAcM_GetPosition_p(i_this), fopAcM_GetPosition_p(i_other)); } /* 80025278-800252BC .text fopAcM_seenActorAngleY__FP10fopAc_ac_cP10fopAc_ac_c */ s32 fopAcM_seenActorAngleY(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - s16 angleY = cLib_targetAngleY(&i_this->current.pos, &i_other->current.pos); + s16 angleY = cLib_targetAngleY(fopAcM_GetPosition_p(i_this), fopAcM_GetPosition_p(i_other)); return abs((s16)(angleY - i_this->shape_angle.y)); } /* 800252BC-80025370 .text fopAcM_searchActorDistance__FP10fopAc_ac_cP10fopAc_ac_c */ f32 fopAcM_searchActorDistance(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - cXyz delta = i_other->current.pos - i_this->current.pos; + cXyz delta = *fopAcM_GetPosition_p(i_other) - *fopAcM_GetPosition_p(i_this); return delta.abs(); } /* 80025370-800253C0 .text fopAcM_searchActorDistance2__FP10fopAc_ac_cP10fopAc_ac_c */ f32 fopAcM_searchActorDistance2(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - cXyz delta = i_other->current.pos - i_this->current.pos; + cXyz delta = *fopAcM_GetPosition_p(i_other) - *fopAcM_GetPosition_p(i_this); return delta.abs2(); } @@ -541,7 +544,7 @@ s32 fopAcM_checkCullingBox(Mtx pMtx, f32 x0, f32 y0, f32 z0, f32 x1, f32 y1, f32 Vec p0 = { x0, y0, z0 }; Vec p1 = { x1, y1, z1 }; Mtx viewMtx; - MTXConcat(j3dSys.mViewMtx, pMtx, viewMtx); + MTXConcat(j3dSys.getViewMtx(), pMtx, viewMtx); return mDoLib_clipper::clip(viewMtx, &p1, &p0) != 0; } @@ -608,14 +611,14 @@ s32 fopAcM_cullingCheck(fopAc_ac_c* i_this) { return mDoLib_clipper::clip(pMtx, fopAcM_getCullSizeBoxMax(i_this), fopAcM_getCullSizeBoxMin(i_this)); } } else { - fopAc_cullSizeBox& cullBox = l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_this))]; + fopAc_cullSizeBox* cullBox = &l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_this))]; if (fopAcM_getCullSizeFar(i_this) > 0.0f) { mDoLib_clipper::changeFar(cullFar * mDoLib_clipper::getFar()); - s32 ret = mDoLib_clipper::clip(pMtx, &cullBox.max, &cullBox.min); + s32 ret = mDoLib_clipper::clip(pMtx, &cullBox->max, &cullBox->min); mDoLib_clipper::resetFar(); return ret; } else { - return mDoLib_clipper::clip(pMtx, &cullBox.max, &cullBox.min); + return mDoLib_clipper::clip(pMtx, &cullBox->max, &cullBox->min); } } } else { // Sphere @@ -632,17 +635,16 @@ s32 fopAcM_cullingCheck(fopAc_ac_c* i_this) { return mDoLib_clipper::clip(pMtx, *fopAcM_getCullSizeSphereCenter(i_this), radius); } } else { - fopAc_cullSizeSphere& cullSphere = l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_this))]; + fopAc_cullSizeSphere* cullSphere = &l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_this))]; if (fopAcM_getCullSizeFar(i_this) > 0.0f) { mDoLib_clipper::changeFar(cullFar * mDoLib_clipper::getFar()); - f32 radius = cullSphere.radius; - Vec center = cullSphere.center; + f32 radius = cullSphere->radius; + Vec center = cullSphere->center; s32 ret = mDoLib_clipper::clip(pMtx, center, radius); mDoLib_clipper::resetFar(); return ret; } else { - f32 radius = cullSphere.radius; - return mDoLib_clipper::clip(pMtx, cullSphere.center, radius); + return mDoLib_clipper::clip(pMtx, cullSphere->center, cullSphere->radius); } } } @@ -777,7 +779,7 @@ fopAc_ac_c* fopAcM_getEventPartner(fopAc_ac_c* i_this) { /* 80026118-800261E8 .text fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz */ fpc_ProcID fopAcM_createItemForPresentDemo(cXyz* pos, int i_itemNo, u8 argFlag, int roomNo, int param_5, csXyz* angle, cXyz* scale) { - JUT_ASSERT(2413, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(2409, 2413, 2413, 2413), 0 <= i_itemNo && i_itemNo < 256); dComIfGp_event_setGtItm(i_itemNo); @@ -790,7 +792,7 @@ fpc_ProcID fopAcM_createItemForPresentDemo(cXyz* pos, int i_itemNo, u8 argFlag, /* 800261E8-800262B4 .text fopAcM_createItemForTrBoxDemo__FP4cXyziiiP5csXyzP4cXyz */ fpc_ProcID fopAcM_createItemForTrBoxDemo(cXyz* pos, int i_itemNo, int roomNo, int param_5, csXyz* angle, cXyz* scale) { - JUT_ASSERT(2458, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(2454, 2458, 2458, 2458), 0 <= i_itemNo && i_itemNo < 256); dComIfGp_event_setGtItm(i_itemNo); @@ -803,7 +805,7 @@ fpc_ProcID fopAcM_createItemForTrBoxDemo(cXyz* pos, int i_itemNo, int roomNo, in /* 800262B4-80026694 .text fopAcM_createItemFromTable__FP4cXyziiiiP5csXyziP4cXyz */ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* p_angle, int action, cXyz* p_scale) { - JUT_ASSERT(2514, 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2510, 2514, 2514, 2514), 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); static cXyz fairy_offset_tbl[3] = { cXyz(40.0f, 0.0f, 0.0f), @@ -822,9 +824,13 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo case 0x02: case 0x03: case 0x04: { - int life = dComIfGs_getLife() * 100; + int life = dComIfGs_getLife(); +#if VERSION == VERSION_DEMO + int max = dComIfGs_getMaxLife(); +#else int max = dComIfGs_getMaxLife() & 0xFC; - u8 lifePercent = life / max; +#endif + u8 lifePercent = (100 * life) / max; if (lifePercent != 0 && lifePercent <= 20) { tableIdx = 4; } else if (lifePercent > 20 && lifePercent <= 40) { @@ -896,13 +902,13 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo /* 80026694-800267C8 .text fopAcM_createRaceItemFromTable__FP4cXyziiiP5csXyzP4cXyzi */ fpc_ProcID fopAcM_createRaceItemFromTable(cXyz* pos, int i_itemNo, int i_itemBitNo, int i_roomNo, csXyz* angle, cXyz* scale, int param_7) { - JUT_ASSERT(2660, 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2654, 2660, 2660, 2660), 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo >= 0x20 && i_itemNo <= 0x3E) { + i_itemNo -= 0x20; ItemTableList* itemTableList = dComIfGp_getItemTable(); int itemIdx = (int)cM_rndF(15.9999f); - int tableIdx = i_itemNo - 0x20; - i_itemNo = itemTableList->mItemTables[tableIdx][itemIdx]; + i_itemNo = itemTableList->mItemTables[i_itemNo][itemIdx]; } if (i_itemNo == 0x3F || i_itemNo == 0xFF) { @@ -917,7 +923,7 @@ fpc_ProcID fopAcM_createRaceItemFromTable(cXyz* pos, int i_itemNo, int i_itemBit /* 800267C8-8002688C .text fopAcM_createShopItem__FP4cXyziP5csXyziP4cXyzPFPv_i */ fpc_ProcID fopAcM_createShopItem(cXyz* pos, int i_itemNo, csXyz* angle, int roomNo, cXyz* scale, createFunc createFunc) { - JUT_ASSERT(2716, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(2710, 2716, 2716, 2716), 0 <= i_itemNo && i_itemNo < 256); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; } @@ -927,24 +933,24 @@ fpc_ProcID fopAcM_createShopItem(cXyz* pos, int i_itemNo, csXyz* angle, int room /* 8002688C-80026980 .text fopAcM_createRaceItem__FP4cXyziiP5csXyziP4cXyzi */ fpc_ProcID fopAcM_createRaceItem(cXyz* pos, int i_itemNo, int i_itemBitNo, csXyz* angle, int roomNo, cXyz* scale, int param_7) { - JUT_ASSERT(2763, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2757, 2763, 2763, 2763), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; } i_itemNo = check_itemno(i_itemNo); - u32 params = (i_itemBitNo & 0x7F) << 0x08 | (i_itemNo & 0xFF) | (param_7 & 0xF) << 0xF; + u32 params = (i_itemBitNo & 0x7F) << 8 | (i_itemNo & 0xFF) << 0 | (param_7 & 0xF) << 15; return fopAcM_create(PROC_RACEITEM, params, pos, roomNo, angle, scale); } /* 80026980-80026A68 .text fopAcM_createDemoItem__FP4cXyziiP5csXyziP4cXyzUc */ fpc_ProcID fopAcM_createDemoItem(cXyz* pos, int i_itemNo, int i_itemBitNo, csXyz* i_angle, int i_roomNo, cXyz* i_scale, u8 i_argFlag) { - JUT_ASSERT(2813, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2807, 2813, 2813, 2813), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; } - u32 params = (i_itemNo & 0xFF) | (i_itemBitNo & 0x7F) << 0x08 | (i_argFlag & 0xFF) << 0x10; + u32 params = (i_itemNo & 0xFF) << 0 | (i_itemBitNo & 0x7F) << 8 | (i_argFlag & 0xFF) << 16; return fopAcM_create(PROC_Demo_Item, params, pos, i_roomNo, i_angle, i_scale); } @@ -961,10 +967,7 @@ fpc_ProcID fopAcM_createItemForBoss(cXyz* pos, int unused, int roomNo, csXyz* an /* 80026ADC-80026C90 .text fopAcM_createItem__FP4cXyziiiiP5csXyziP4cXyz */ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* angle, int action, cXyz* scale) { - int switchNo = 0xFF; - int switchNo2 = 0xFF; - - JUT_ASSERT(2915, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2909, 2915, 2915, 2915), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; @@ -974,9 +977,11 @@ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN if (angle) { prmAngle = *angle; } + int switchNo = 0xFF; prmAngle.z = switchNo; u8 itemNo = check_itemno(i_itemNo); + int switchNo2 = -1; u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action); switch (i_itemNo) { @@ -997,10 +1002,8 @@ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* angle, int action, cXyz* scale) { - int switchNo = 0xFF; - int switchNo2 = 0xFF; - - JUT_ASSERT(2995, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + + JUT_ASSERT(VERSION_SELECT(2989, 2995, 2995, 2995), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); int i; @@ -1013,9 +1016,11 @@ void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN if (angle) { prmAngle = *angle; } + int switchNo = 0xFF; prmAngle.z = switchNo; u8 itemNo = check_itemno(i_itemNo); + int switchNo2 = -1; u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action); switch (i_itemNo) { @@ -1034,11 +1039,12 @@ void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN /* 80026E5C-80026F5C .text fopAcM_createItemForKP2__FP4cXyziiP5csXyzP4cXyzfffUs */ fopAc_ac_c* fopAcM_createItemForKP2(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, cXyz* scale, f32 speedF, f32 speedY, f32 gravity, u16 i_itemBitNo) { - JUT_ASSERT(0xc25, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(3103, 3109, 3109, 3109), 0 <= i_itemNo && i_itemNo < 256); if (i_itemNo == dItem_NONE_e) return NULL; - fopAc_ac_c* ac = (fopAc_ac_c*)fopAcM_fastCreate(PROC_SPC_ITEM01, i_itemNo | (i_itemBitNo & 0xFFFF) << 8, pos, roomNo, angle, scale); + u32 params = i_itemNo | (i_itemBitNo & 0xFFFF) << 8; + fopAc_ac_c* ac = (fopAc_ac_c*)fopAcM_fastCreate(PROC_SPC_ITEM01, params, pos, roomNo, angle, scale); if (ac != NULL) { fopAcM_SetSpeedF(ac, speedF); ac->speed.y = speedY; @@ -1058,12 +1064,7 @@ daItem_c* fopAcM_createItemForSimpleDemo(cXyz* pos, int i_itemNo, int roomNo, cs /* 80026F98-80027254 .text fopAcM_fastCreateItem__FP4cXyziiP5csXyzP4cXyzfffiPFPv_i */ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, cXyz* scale, f32 speedF, f32 speedY, f32 gravity, int i_itemBitNo, createFunc createFunc) { - int type = daItemType_0_e; - int action = daItemAct_A_e; - int switchNo = 0xFF; - int switchNo2 = 0xFF; - - JUT_ASSERT(3201, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(3195, 3201, 3201, 3201), 0 <= i_itemNo && i_itemNo < 256); if (i_itemNo == dItem_NONE_e) { return NULL; } @@ -1071,6 +1072,9 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c int i; u8 itemNo = check_itemno(i_itemNo); + int type = daItemType_0_e; + int action = daItemAct_A_e; + int switchNo2 = -1; u8 itemBitNo = i_itemBitNo; u32 params = MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action); @@ -1092,6 +1096,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c } else { prmAngle = csXyz::Zero; } + int switchNo = 0xFF; prmAngle.z = switchNo; prmAngle.y += (int)cM_rndFX(0x2000); @@ -1121,6 +1126,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c } } +#if VERSION > VERSION_DEMO /* 80027254-80027280 .text stealItem_CB__FPv */ BOOL stealItem_CB(void* actor) { if (actor) { @@ -1130,6 +1136,7 @@ BOOL stealItem_CB(void* actor) { } return TRUE; } +#endif /* 80027280-800273D4 .text fopAcM_createStealItem__FP4cXyziiP5csXyzi */ void* fopAcM_createStealItem(cXyz* p_pos, int i_tblNo, int i_roomNo, csXyz* p_angle, int i_itemBitNo) { @@ -1158,7 +1165,16 @@ void* fopAcM_createStealItem(cXyz* p_pos, int i_tblNo, int i_roomNo, csXyz* p_an i_itemBitNo = -1; } +#if VERSION == VERSION_DEMO + daItem_c* item = (daItem_c*)fopAcM_fastCreateItem(p_pos, itemNo, i_roomNo, p_angle, NULL, 0.0f, 0.0f, -6.0f, i_itemBitNo); + if (item != NULL) { + item->scale.setall(1.0f); + item->setFlag(daItem_c::FLAG_HOOK); + } + return item; +#else return fopAcM_fastCreateItem(p_pos, itemNo, i_roomNo, p_angle, NULL, 0.0f, 0.0f, -6.0f, i_itemBitNo, stealItem_CB); +#endif } /* 800273D4-8002777C .text fopAcM_createItemFromEnemyTable__FUsiiP4cXyzP5csXyz */ @@ -1207,7 +1223,11 @@ void* fopAcM_createItemFromEnemyTable(u16 itemTableIdx, int i_itemBitNo, int i_r items[itemIdx] = getItemNoByLife(items[itemIdx]); return fopAcM_fastCreateItem( +#if VERSION == VERSION_DEMO + p_pos, items[itemIdx], i_roomNo, p_angle, &scale, +#else p_pos, items[itemIdx], i_roomNo, NULL, &scale, +#endif cM_rndFX(5.0f), 50.0f + cM_rndFX(10.0f), -6.0f, i_itemBitNo ); } @@ -1226,11 +1246,13 @@ fpc_ProcID fopAcM_createIball(cXyz* p_pos, int itemTableIdx, int i_roomNo, csXyz } if (dropChance > randPercent) { + u32 params = (u16)itemTableIdx | (i_itemBitNo & 0xFF) << 16; daIball_c::remove_old(); - void* item = fopAcM_fastCreate( - PROC_Iball, (u16)itemTableIdx | (i_itemBitNo & 0xFF) << 0x10, - p_pos, i_roomNo - ); +#if VERSION == VERSION_DEMO + void* item = fopAcM_fastCreate(PROC_Iball, params, p_pos, i_roomNo, p_angle); +#else + void* item = fopAcM_fastCreate(PROC_Iball, params, p_pos, i_roomNo); +#endif return fopAcM_GetID(item); } else { void* item = fopAcM_createItemFromEnemyTable( @@ -1259,10 +1281,10 @@ fopAc_ac_c * enemySearchJugge(void* ptr, void*) { /* 80027970-80027A9C .text fopAcM_myRoomSearchEnemy__FSc */ fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { - JUT_ASSERT(0xe07, roomNo >= 0); + JUT_ASSERT(VERSION_SELECT(3569, 3591, 3591, 3591), roomNo >= 0); scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(roomNo)); - JUT_ASSERT(0xe0a, roomProc != NULL); + JUT_ASSERT(VERSION_SELECT(3572, 3594, 3594, 3594), roomProc != NULL); fpc_ProcID grabProcID = daPy_getPlayerActorClass()->getGrabActorID(); fopAc_ac_c* enemy = fopAcM_SearchByID(grabProcID); @@ -1274,8 +1296,12 @@ fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { /* 80027A9C-80027B24 .text fopAcM_createDisappear__FP10fopAc_ac_cP4cXyzUcUcUc */ fpc_ProcID fopAcM_createDisappear(fopAc_ac_c* i_actor, cXyz* p_pos, u8 i_scale, u8 i_dropType, u8 i_itemBitNo) { - u32 params = (i_itemBitNo & 0xFF) << 0x10 | (i_scale & 0xFF) << 0x08 | (i_dropType & 0xFF); + u32 params = (i_itemBitNo & 0xFF) << 16 | (i_scale & 0xFF) << 8 | (i_dropType & 0xFF) << 0; +#if VERSION == VERSION_DEMO + fopAc_ac_c* disappear = (fopAc_ac_c*)fopAcM_fastCreate(PROC_DISAPPEAR, params, p_pos, fopAcM_GetRoomNo(i_actor)); +#else fopAc_ac_c* disappear = (fopAc_ac_c*)fopAcM_fastCreate(PROC_DISAPPEAR, params, p_pos, fopAcM_GetRoomNo(i_actor), fopAcM_GetAngle_p(i_actor)); +#endif if (disappear) { disappear->itemTableIdx = i_actor->itemTableIdx; } @@ -1294,25 +1320,26 @@ BOOL fopAcM_getGroundAngle(fopAc_ac_c* actor, csXyz* p_angle) { s16 targetAngleX; int targetAngleZ; if (pos.y != -G_CM3D_F_INF) { - f32 origY = pos.y + 50.0f; - gndChk.GetPointP()->set(pos.x, origY, pos.z + 10.0f); - f32 origX = gndChk.GetPointP()->x; - f32 origZ = gndChk.GetPointP()->z; + Vec chk_pos; + chk_pos.x = pos.x; + chk_pos.y = pos.y + 50.0f; + chk_pos.z = pos.z + 10.0f; + gndChk.SetPos(&chk_pos); f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk); if (groundY != -G_CM3D_F_INF) { - targetAngleX = -cM_atan2s(groundY - pos.y, origZ - pos.z); + targetAngleX = -cM_atan2s(groundY - pos.y, chk_pos.z - pos.z); } else { pos.y = pos.y; // ?? fakematch? ret = FALSE; } - origX = pos.x + 10.0f; - origY = pos.y + 50.0f; - f32 tempZ = pos.z; - gndChk.GetPointP()->set(origX, origY, tempZ); + chk_pos.x = pos.x + 10.0f; + chk_pos.y = pos.y + 50.0f; + chk_pos.z = pos.z; + gndChk.SetPos(&chk_pos); groundY = dComIfG_Bgsp()->GroundCross(&gndChk); if (groundY != -G_CM3D_F_INF) { - targetAngleZ = cM_atan2s(groundY - pos.y, origX - pos.x); + targetAngleZ = cM_atan2s(groundY - pos.y, chk_pos.x - pos.x); } else { ret = FALSE; } @@ -1386,7 +1413,7 @@ const char * fopAcM_getProcNameString(fopAc_ac_c* i_this) { /* 8002833C-80028410 .text fopAcM_findObjectCB__FP10fopAc_ac_cPv */ fopAc_ac_c* fopAcM_findObjectCB(fopAc_ac_c* it, void* i_prm) { fopAcM_search_prm* Prm = (fopAcM_search_prm*)i_prm; - JUT_ASSERT(4095, Prm); + JUT_ASSERT(VERSION_SELECT(4071, 4095, 4095, 4095), Prm); dStage_objectNameInf *inf = dStage_searchName(Prm->procname); if (inf == NULL) diff --git a/src/f_pc/f_pc_base.cpp b/src/f_pc/f_pc_base.cpp index 9bbad4888..2c210f3d1 100644 --- a/src/f_pc/f_pc_base.cpp +++ b/src/f_pc/f_pc_base.cpp @@ -41,11 +41,13 @@ fpc_ProcID fpcBs_MakeOfId() { /* 8003C904-8003C960 .text fpcBs_Execute__FP18base_process_class */ BOOL fpcBs_Execute(base_process_class* i_proc) { - BOOL result; - layer_class* savedLayer = fpcLy_CurrentLayer(); - fpcLy_SetCurrentLayer(i_proc->mLyTg.mpLayer); - result = fpcMtd_Execute(i_proc->mpPcMtd, i_proc); - fpcLy_SetCurrentLayer(savedLayer); + BOOL result = TRUE; + if (result == TRUE) { + layer_class* savedLayer = fpcLy_CurrentLayer(); + fpcLy_SetCurrentLayer(i_proc->mLyTg.mpLayer); + result = fpcMtd_Execute(i_proc->mpPcMtd, i_proc); + fpcLy_SetCurrentLayer(savedLayer); + } return result; } @@ -69,13 +71,16 @@ BOOL fpcBs_IsDelete(base_process_class* i_proc) { /* 8003C9FC-8003CA60 .text fpcBs_Delete__FP18base_process_class */ BOOL fpcBs_Delete(base_process_class* i_proc) { - BOOL deleteResult = fpcMtd_Delete(i_proc->mpPcMtd, i_proc); - if (deleteResult == TRUE) { - fpcBs_DeleteAppend(i_proc); - i_proc->mBsType = 0; - cMl::free(i_proc); + BOOL result = TRUE; + if (result == TRUE) { + result = fpcMtd_Delete(i_proc->mpPcMtd, i_proc); + if (result == TRUE) { + fpcBs_DeleteAppend(i_proc); + i_proc->mBsType = 0; + cMl::free(i_proc); + } } - return deleteResult; + return result; } /* 8003CA60-8003CB5C .text fpcBs_Create__FsUiPv */ diff --git a/src/f_pc/f_pc_executor.cpp b/src/f_pc/f_pc_executor.cpp index 9716c7dd7..5729114bd 100644 --- a/src/f_pc/f_pc_executor.cpp +++ b/src/f_pc/f_pc_executor.cpp @@ -39,7 +39,8 @@ s32 fpcEx_ToLineQ(base_process_class* i_proc) { base_process_class* pLayerPcNode = &pLayer->mpPcNode->base; if (pLayer->mLayerID == 0 || cTg_IsUse(&pLayerPcNode->mLnTg.base) == TRUE) { - s32 ret = fpcLnTg_ToQueue(&i_proc->mLnTg, i_proc->mPi.mInfoCurr.mListID); + u16 listID = i_proc->mPi.mInfoCurr.mListID; + s32 ret = fpcLnTg_ToQueue(&i_proc->mLnTg, listID); if (ret == 0) { fpcLyTg_QueueTo(&i_proc->mLyTg); return 0; diff --git a/src/f_pc/f_pc_pause.cpp b/src/f_pc/f_pc_pause.cpp index 32f1ca122..79d697788 100644 --- a/src/f_pc/f_pc_pause.cpp +++ b/src/f_pc/f_pc_pause.cpp @@ -33,7 +33,8 @@ s32 fpcPause_Enable(void* i_proc, u8 i_flag) { /* 800403AC-80040420 .text fpcPause_Disable__FPvUc */ s32 fpcPause_Disable(void* i_proc, u8 i_flag) { base_process_class* pProc = (base_process_class*)i_proc; - pProc->mPauseFlag &= (0xFF - i_flag) & 0xFF; + u8 mask = 0xFF - i_flag; + pProc->mPauseFlag &= mask; if (fpcBs_Is_JustOfType(g_fpcNd_type, pProc->mSubType)) { process_node_class* pNode = (process_node_class*)pProc; diff --git a/src/f_pc/f_pc_searcher.cpp b/src/f_pc/f_pc_searcher.cpp index 0464d4349..76a952e45 100644 --- a/src/f_pc/f_pc_searcher.cpp +++ b/src/f_pc/f_pc_searcher.cpp @@ -7,18 +7,14 @@ /* 80040050-80040068 .text fpcSch_JudgeForPName__FPvPv */ void* fpcSch_JudgeForPName(void* i_proc, void* i_data) { - s16 proc_name = *(s16*)i_data; - - if (((base_process_class*)i_proc)->mProcName == proc_name) + if (((base_process_class*)i_proc)->mProcName == *(s16*)i_data) return i_proc; return NULL; } /* 80040068-80040080 .text fpcSch_JudgeByID__FPvPv */ void* fpcSch_JudgeByID(void* i_proc, void* i_data) { - fpc_ProcID process_id = *(fpc_ProcID*)i_data; - - if (((base_process_class*)i_proc)->mBsPcId == process_id) + if (((base_process_class*)i_proc)->mBsPcId == *(fpc_ProcID*)i_data) return i_proc; return NULL; } diff --git a/src/m_Do/m_Do_MemCardRWmng.cpp b/src/m_Do/m_Do_MemCardRWmng.cpp index 521462655..60596c219 100644 --- a/src/m_Do/m_Do_MemCardRWmng.cpp +++ b/src/m_Do/m_Do_MemCardRWmng.cpp @@ -306,8 +306,7 @@ u32 mDoMemCdRWm_CalcCheckSum(void* p_, u32 size) { u16 mDoMemCdRWm_CalcCheckSumPictData(void* p, u32 size) { u16 csum = 0; for (int i = 0; i < size; i++) { - u8 v = ((u8*)p)[i]; - csum += v; + csum += ((u8*)p)[i]; } return csum; }