From 37f7baaaf0cc58a2459069605158777461962002 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Thu, 13 Aug 2026 16:19:28 -0400 Subject: [PATCH] Several demo matches (#1165) --- configure.py | 6 +- .../JSystem/J3DGraphAnimator/J3DAnimation.h | 2 +- include/JSystem/J3DGraphAnimator/J3DJoint.h | 1 - include/JSystem/J3DGraphBase/J3DMatBlock.h | 28 +++- include/JSystem/J3DGraphBase/J3DSys.h | 7 +- include/SSystem/SComponent/c_cc_d.h | 6 +- include/SSystem/SComponent/c_m3d_g_cyl.h | 12 ++ include/SSystem/SComponent/c_m3d_g_sph.h | 10 ++ include/d/actor/d_a_hmlif.h | 2 +- include/d/d_drawlist.h | 4 +- include/f_ap/f_ap_game.h | 24 ++-- include/f_op/f_op_actor_mng.h | 32 ++--- include/m_Do/m_Do_mtx.h | 4 + src/d/actor/d_a_dai.cpp | 1 - src/d/actor/d_a_dai_item.cpp | 96 +++++++++++-- src/d/actor/d_a_hmlif.cpp | 4 +- src/d/actor/d_a_npc_bm1.cpp | 5 +- src/d/actor/d_a_obj_mkie.cpp | 2 +- src/d/d_cloth_packet.cpp | 2 +- src/d/d_com_static.cpp | 2 + src/f_ap/f_ap_game.cpp | 35 ++--- src/m_Do/m_Do_ext.cpp | 131 ++++++++++-------- 22 files changed, 272 insertions(+), 144 deletions(-) diff --git a/configure.py b/configure.py index 4ae30cbcc..c48ebc31b 100755 --- a/configure.py +++ b/configure.py @@ -409,7 +409,7 @@ config.libs = [ Object(NonMatching, "m_Do/m_Do_graphic.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "m_Do/m_Do_machine.cpp"), Object(Matching, "m_Do/m_Do_mtx.cpp"), - Object(NonMatching, "m_Do/m_Do_ext.cpp"), + Object(MatchingFor("D44J01"), "m_Do/m_Do_ext.cpp"), Object(Matching, "m_Do/m_Do_lib.cpp"), Object(Matching, "m_Do/m_Do_hostIO.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "m_Do/m_Do_Reset.cpp"), @@ -565,7 +565,7 @@ config.libs = [ Object(Matching, "d/d_bg_w_deform.cpp"), 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(Matching, "d/d_cc_d.cpp"), Object(Matching, "d/d_cc_mass_s.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_s.cpp"), Object(Matching, "d/d_cc_uty.cpp"), @@ -593,7 +593,7 @@ config.libs = [ Object(Matching, "d/actor/d_a_bomb.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_bomb2.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_boomerang.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_dai_item.cpp"), + Object(Matching, "d/actor/d_a_dai_item.cpp"), Object(Matching, "d/actor/d_a_demo00.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_disappear.cpp"), Object(Matching, "d/actor/d_a_esa.cpp"), diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index 1dc6b9ac9..cfb35d9bb 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -430,7 +430,7 @@ public: } u16 getUpdateMaterialNum() const { return mTrackNum / 3; } JUTNameTab * getUpdateMaterialName() { return &mUpdateMaterialName; } - u16 getUpdateTexMtxID(u16 idx) const { + int getUpdateTexMtxID(u16 idx) const { J3D_ASSERT(1017, idx < (mTrackNum / 3), "Error : range over."); return mUpdateTexMtxID[idx]; } diff --git a/include/JSystem/J3DGraphAnimator/J3DJoint.h b/include/JSystem/J3DGraphAnimator/J3DJoint.h index eb98d6965..6f46ba1b1 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJoint.h +++ b/include/JSystem/J3DGraphAnimator/J3DJoint.h @@ -119,7 +119,6 @@ class J3DMtxCalcMayaAnm : public J3DMtxCalcMaya, public J3DMtxCalcAnm { public: J3DMtxCalcMayaAnm(J3DAnmTransform* pAnmTransform) : J3DMtxCalcMaya(), J3DMtxCalcAnm(pAnmTransform) {} - virtual ~J3DMtxCalcMayaAnm() {} virtual void calc(u16 jnt_no) { J3DMtxCalcAnm::calc(jnt_no); } }; diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index a5c1c5183..f3e588286 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -9,8 +9,18 @@ struct J3DGXColorS10 { J3DGXColorS10() {} - J3DGXColorS10(GXColorS10& other) { mColor = other; } - J3DGXColorS10(J3DGXColorS10& other) { mColor = other.mColor; } + J3DGXColorS10(GXColorS10& other) { + mColor.r = other.r; + mColor.g = other.g; + mColor.b = other.b; + mColor.a = other.a; + } + J3DGXColorS10(J3DGXColorS10& other) { + mColor.r = other.mColor.r; + mColor.g = other.mColor.g; + mColor.b = other.mColor.b; + mColor.a = other.mColor.a; + } J3DGXColorS10& operator=(const J3DGXColorS10& other) { mColor = other.mColor; return *this; @@ -25,8 +35,18 @@ struct J3DGXColorS10 { struct J3DGXColor { J3DGXColor() {} - J3DGXColor(GXColor& other) { mColor = other; } - J3DGXColor(J3DGXColor& other) { mColor = other.mColor; } + J3DGXColor(GXColor& other) { + mColor.r = other.r; + mColor.g = other.g; + mColor.b = other.b; + mColor.a = other.a; + } + J3DGXColor(J3DGXColor& other) { + mColor.r = other.mColor.r; + mColor.g = other.mColor.g; + mColor.b = other.mColor.b; + mColor.a = other.mColor.a; + } J3DGXColor& operator=(const J3DGXColor& other) { mColor = other.mColor; return *this; diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h index 39e9ce208..62f141a57 100644 --- a/include/JSystem/J3DGraphBase/J3DSys.h +++ b/include/JSystem/J3DGraphBase/J3DSys.h @@ -12,9 +12,10 @@ enum J3DError { J3DErrType_OutOfMemory = 4, }; -enum J3DSysDrawBuffer { - /* 0x0 */ OPA_BUFFER, - /* 0x1 */ XLU_BUFFER +enum J3DSysDrawBuf { + /* 0x0 */ J3DSysDrawBuf_Opa, + /* 0x1 */ J3DSysDrawBuf_Xlu, + /* 0x2 */ J3DSysDrawBuf_MAX, }; class J3DMtxCalc; diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index 0ed9dc136..db557c83f 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -380,9 +380,9 @@ public: cCcD_ObjCommonBase() { ct(); } virtual ~cCcD_ObjCommonBase() {} void ct() { - SetSPrm(0); - SetRPrm(0); - ClrObj(); + mSPrm = 0; + mRPrm = 0; + mHitObj = NULL; } void SetSPrm(u32 sprm) { mSPrm = sprm; } void SetRPrm(u32 rprm) { mRPrm = rprm; } diff --git a/include/SSystem/SComponent/c_m3d_g_cyl.h b/include/SSystem/SComponent/c_m3d_g_cyl.h index d9ce487da..23fb4b2db 100644 --- a/include/SSystem/SComponent/c_m3d_g_cyl.h +++ b/include/SSystem/SComponent/c_m3d_g_cyl.h @@ -35,14 +35,26 @@ public: void SetR(f32 r); #endif void Set(const cM3dGCylS & src) { +#if VERSION == VERSION_DEMO + mCenter = src.mCenter; + mRadius = src.mRadius; + mHeight = src.mHeight; +#else SetC(src.mCenter); SetR(src.mRadius); SetH(src.mHeight); +#endif } void Set(const cXyz& center, f32 radius, f32 height) { +#if VERSION == VERSION_DEMO + mCenter = center; + mRadius = radius; + mHeight = height; +#else SetC(center); SetR(radius); SetH(height); +#endif } bool cross(const cM3dGSph*, cXyz*) const; bool cross(const cM3dGCyl*, cXyz*) const; diff --git a/include/SSystem/SComponent/c_m3d_g_sph.h b/include/SSystem/SComponent/c_m3d_g_sph.h index dcc7d4151..9d8403f07 100644 --- a/include/SSystem/SComponent/c_m3d_g_sph.h +++ b/include/SSystem/SComponent/c_m3d_g_sph.h @@ -29,12 +29,22 @@ public: #endif void SetC(f32 x, f32 y, f32 z) { mCenter.x = x; mCenter.y = y; mCenter.z = z; } void Set(const cM3dGSphS & src) { +#if VERSION == VERSION_DEMO + mCenter = src.mCenter; + mRadius = src.mRadius; +#else SetC(src.mCenter); SetR(src.mRadius); +#endif } void Set(const cXyz& srcCenter, f32 srcRadius) { +#if VERSION == VERSION_DEMO + mCenter = srcCenter; + mRadius = srcRadius; +#else SetC(srcCenter); SetR(srcRadius); +#endif } bool Cross(const cM3dGCps* cps, cXyz* dst) const { return cM3d_Cross_CpsSph(*cps, *this, dst); diff --git a/include/d/actor/d_a_hmlif.h b/include/d/actor/d_a_hmlif.h index ebadedd07..9df9d0c22 100644 --- a/include/d/actor/d_a_hmlif.h +++ b/include/d/actor/d_a_hmlif.h @@ -23,7 +23,7 @@ public: void check_col(); void lift_smooth_move(); void lift_normal_move(); - BOOL check_path_point(cXyz, cXyz, cXyz, s8); + BOOL check_path_point(cXyz, cXyz, s8); void set_next_pnt(); BOOL setNextPath(); bool chkSwitchPathType(); diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index 58ed7da0b..61806f656 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -535,8 +535,8 @@ public: J3DDrawBuffer* getXluList() { return mpXluList; } J3DDrawBuffer* getXluListP1() { return mpXluListP1; } - void setXluDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, XLU_BUFFER); } - void setOpaDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, OPA_BUFFER); } + void setXluDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSysDrawBuf_Xlu); } + void setOpaDrawList(J3DDrawBuffer* buffer) { j3dSys.setDrawBuffer(buffer, J3DSysDrawBuf_Opa); } void setOpaList() { setOpaDrawList(mpOpaList); } void setXluList() { setXluDrawList(mpXluList); } void setOpaListInvisible() { setOpaDrawList(mpOpaListInvisible); } diff --git a/include/f_ap/f_ap_game.h b/include/f_ap/f_ap_game.h index c5d7c0995..a2d8390eb 100644 --- a/include/f_ap/f_ap_game.h +++ b/include/f_ap/f_ap_game.h @@ -17,7 +17,7 @@ public: public: /* 0x04 */ s8 mNo; - /* 0x05 */ u8 field_0x05; + /* 0x05 */ u8 mUsingHostIO; /* 0x06 */ u8 mDisplayMeter; /* 0x07 */ u8 mDisplayFlag; /* 0x08 */ u8 field_0x08; @@ -41,7 +41,7 @@ public: /* 0x1D */ u8 field_0x1d; /* 0x1E */ u8 field_0x1e; /* 0x1F */ u8 field_0x1f; - /* 0x20 */ JUtility::TColor field_0x20; + /* 0x20 */ JUtility::TColor mColor; /* 0x24 */ f32 mTriggerThreshLo; /* 0x28 */ f32 mTriggerThreshHi; /* 0x2C */ s16 mFbWidth; @@ -58,16 +58,16 @@ public: /* 0x39 */ u8 field_0x39; /* 0x3A */ u8 field_0x3a; /* 0x3B */ u8 field_0x3b; - /* 0x3C */ JUtility::TColor field_0x3c; - /* 0x40 */ JUtility::TColor field_0x40; - /* 0x44 */ JUtility::TColor field_0x44; - /* 0x48 */ JUtility::TColor field_0x48; - /* 0x4C */ u16 field_0x4c; - /* 0x4E */ u16 field_0x4e; - /* 0x50 */ u16 field_0x50; - /* 0x52 */ u16 field_0x52; - /* 0x54 */ u16 field_0x54; - /* 0x56 */ u8 field_0x56; + /* 0x3C */ JUtility::TColor mLetterTopColor; + /* 0x40 */ JUtility::TColor mLetterBottomColor; + /* 0x44 */ JUtility::TColor mLetterTopShadowColor; + /* 0x48 */ JUtility::TColor mLetterBottomShadowColor; + /* 0x4C */ u16 mLetterPositionX; + /* 0x4E */ u16 mLetterPositionY; + /* 0x50 */ u16 mLineSpacing; + /* 0x52 */ u16 mLetterSpacing; + /* 0x54 */ u16 mLetterFontSize; + /* 0x56 */ u8 mBackgroundAlpha; }; // Size: 0x58 extern fapGm_HIO_c g_HIO; diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index c01a4479c..0c048fce0 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -127,22 +127,6 @@ inline MtxP fopAcM_GetMtx(fopAc_ac_c* pActor) { return pActor->cullMtx; } -inline u32 fopAcM_CheckStatus(fopAc_ac_c* pActor, u32 status) { - return pActor->actor_status & status; -} - -inline u32 fopAcM_checkCarryNow(fopAc_ac_c* pActor) { - return pActor->actor_status & fopAcStts_CARRY_e; -} - -inline void fopAcM_ClearStatusMap(fopAc_ac_c* pActor) { - pActor->actor_status &= ~0x3F; -} - -inline bool fopAcM_checkHookCarryNow(fopAc_ac_c* pActor) { - return fopAcM_CheckStatus(pActor, fopAcStts_HOOK_CARRY_e); -} - inline u32 fopAcM_GetParam(void* pActor) { return fpcM_GetParam(pActor); } @@ -179,6 +163,10 @@ inline void fopAcM_SetGroup(fopAc_ac_c* pActor, u8 group) { pActor->group = group; } +inline u32 fopAcM_CheckStatus(fopAc_ac_c* pActor, u32 status) { + return pActor->actor_status & status; +} + inline void fopAcM_OnStatus(fopAc_ac_c* pActor, u32 flag) { pActor->actor_status |= flag; } @@ -187,6 +175,14 @@ inline void fopAcM_OffStatus(fopAc_ac_c* pActor, u32 flag) { pActor->actor_status &= ~flag; } +inline u32 fopAcM_checkCarryNow(fopAc_ac_c* pActor) { + return pActor->actor_status & fopAcStts_CARRY_e; +} + +inline bool fopAcM_checkHookCarryNow(fopAc_ac_c* pActor) { + return fopAcM_CheckStatus(pActor, fopAcStts_HOOK_CARRY_e); +} + inline BOOL fopAcM_CheckStatusMap(fopAc_ac_c* pActor, u32) { // TODO: This implementation probably isn't right, the u32 argument is likely used for something return (pActor->actor_status & fopAcStts_SHOWMAP_e) && (pActor->actor_status & 0x1F) == 0; @@ -196,6 +192,10 @@ inline void fopAcM_SetStatusMap(fopAc_ac_c* pActor, u32 flag) { pActor->actor_status = (pActor->actor_status & ~0x3F) | fopAcStts_SHOWMAP_e | flag; } +inline void fopAcM_ClearStatusMap(fopAc_ac_c* pActor) { + pActor->actor_status &= ~0x3F; +} + inline fopAc_ac_c* fopAcM_Search(fopAcIt_JudgeFunc func, void* param) { return (fopAc_ac_c*)fopAcIt_Judge(func, param); } diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h index 4fdaf59f7..483c1eaa2 100644 --- a/include/m_Do/m_Do_mtx.h +++ b/include/m_Do/m_Do_mtx.h @@ -95,6 +95,10 @@ inline void cMtx_copy(CMtxP src, MtxP dst) { mDoMtx_copy(src, dst); } +inline void cMtx_trans(Mtx dst, f32 x, f32 y, f32 z) { + mDoMtx_trans(dst, x, y, z); +} + inline void cMtx_multVecArray(Mtx mtx, const Vec* src, Vec* dst, u32 count) { mDoMtx_multVecArray(mtx, src, dst, count); } diff --git a/src/d/actor/d_a_dai.cpp b/src/d/actor/d_a_dai.cpp index 90520e811..759272efb 100644 --- a/src/d/actor/d_a_dai.cpp +++ b/src/d/actor/d_a_dai.cpp @@ -133,7 +133,6 @@ cPhs_State daDai_c::_create() { if (PVar3 != cPhs_COMPLEATE_e) { return PVar3; } - #else if (PVar2 != cPhs_COMPLEATE_e) { return PVar2; diff --git a/src/d/actor/d_a_dai_item.cpp b/src/d/actor/d_a_dai_item.cpp index ecce612c5..6004fce5f 100644 --- a/src/d/actor/d_a_dai_item.cpp +++ b/src/d/actor/d_a_dai_item.cpp @@ -202,8 +202,8 @@ bool daStandItem_c::_delete() { m698 = NULL; } - dComIfG_resDelete(&mPhsDai, m_arcname); - dComIfG_resDelete(&mPhsCloth, "Cloth"); + dComIfG_resDeleteDemo(&mPhsDai, m_arcname); + dComIfG_resDeleteDemo(&mPhsCloth, "Cloth"); return true; } @@ -215,7 +215,7 @@ static BOOL CheckCreateHeap(fopAc_ac_c* i_ac) { /* 800E37B8-800E3AF8 .text CreateHeap__13daStandItem_cFv */ BOOL daStandItem_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(m_arcname, m_bmdidx[mItemType]); - JUT_ASSERT(0x239, modelData != NULL); + JUT_ASSERT(DEMO_SELECT(566, 569), modelData != NULL); if (mItemNo == dItemNo_SHOP_GURU_STATUE_e) { mpModel = mDoExt_J3DModel__create(modelData, 0x0, 0x11020203); @@ -228,7 +228,7 @@ BOOL daStandItem_c::CreateHeap() { if (m_bckidx[mItemType] != -1) { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(m_arcname, m_bckidx[mItemType]); - JUT_ASSERT(0x250, pbck != NULL); + JUT_ASSERT(DEMO_SELECT(589, 592), pbck != NULL); mpBckAnm = new mDoExt_bckAnm(); static const u32 playmode[] = { @@ -297,6 +297,37 @@ BOOL daStandItem_c::CreateHeap() { return TRUE; } +#if VERSION == VERSION_DEMO +// Note: Retail moved this into d_com_static.cpp as daStandItem_c::daiItemNodeCallBack +static BOOL nodeCallBack(J3DNode* node, int calcTiming) { + if (calcTiming == J3DNodeCBCalcTiming_In) { + J3DJoint* joint = (J3DJoint*)node; + s32 jntNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + void* userArea = (void*)model->getUserArea(); + if (userArea && fopAcM_IsActor(userArea) && fopAcM_GetName(userArea) == fpcNm_STANDITEM_e) { + daStandItem_c* i_this = (daStandItem_c*)userArea; + mDoMtx_stack_c::copy(model->getAnmMtx(jntNo)); + switch (i_this->getItemNo()) { + case dItemNo_PINWHEEL_e: + mDoMtx_stack_c::XrotM(i_this->m6B4); + break; + case dItemNo_FOUNTAIN_IDOL_e: + if (jntNo == FOBJ09_JNT_TUBOKO_BASE_e) { + mDoMtx_copy(mDoMtx_stack_c::get(), i_this->m630); + } else if (jntNo == FOBJ09_JNT_TUBOKO_HEAD_e) { + mDoMtx_copy(mDoMtx_stack_c::get(), i_this->m660); + } + break; + } + model->setAnmMtx(jntNo, mDoMtx_stack_c::get()); + cMtx_copy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx); + } + } + return TRUE; +} +#endif + /* 800E3AF8-800E3E94 .text CreateInit__13daStandItem_cFv */ void daStandItem_c::CreateInit() { fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); @@ -312,7 +343,9 @@ void daStandItem_c::CreateInit() { m6A4 = *dKyw_get_wind_vec(); m6A2 = cM_atan2s(m6A4.x, m6A4.z); set_mtx(); +#if VERSION > VERSION_DEMO mpModel->setUserArea(NULL); +#endif JUTNameTab* jointNameTab = mpModel->getModelData()->getJointName(); const char* jointName; @@ -323,7 +356,7 @@ void daStandItem_c::CreateInit() { for (i = 0; i < mpModel->getModelData()->getJointNum(); i++) { jointName = jointNameTab->getName(i); if (strcmp("top", jointName) == 0) { - mpModel->getModelData()->getJointNodePointer(i)->setCallBack(daiItemNodeCallBack); + mpModel->getModelData()->getJointNodePointer(i)->setCallBack(DEMO_SELECT(nodeCallBack, daiItemNodeCallBack)); break; } } @@ -336,7 +369,7 @@ void daStandItem_c::CreateInit() { for (i = 0; i < mpModel->getModelData()->getJointNum(); i++) { jointName = jointNameTab->getName(i); if (strcmp("tuboko_head", jointName) == 0 || strcmp("tuboko_base", jointName) == 0) - mpModel->getModelData()->getJointNodePointer(i)->setCallBack(daiItemNodeCallBack); + mpModel->getModelData()->getJointNodePointer(i)->setCallBack(DEMO_SELECT(nodeCallBack, daiItemNodeCallBack)); } mpModel->setUserArea((u32)this); mpModel->calc(); @@ -352,18 +385,20 @@ void daStandItem_c::CreateInit() { s16 stopMaxTime = m_stop_max_time[mItemType]; s16 r29 = (animMinTime + animMaxTime) / 2; s16 r28 = (animMaxTime - animMinTime) / 2; + s16 temp3 = (stopMinTime + stopMaxTime) / 2; s16 temp = (stopMaxTime - stopMinTime) / 2; mBckPlayTimer = 0; f32 temp2 = cM_rndFX(temp); - s16 temp3 = (stopMinTime + stopMaxTime) / 2; mBckStopTimer = temp3 + temp2; if (stopMaxTime == 0) { mBckPlayTimer = r29 + cM_rndFX(r28); } +#if VERSION > VERSION_DEMO m690 = NULL; m694 = NULL; m698 = NULL; +#endif #if VERSION > VERSION_JPN g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); #endif @@ -376,6 +411,23 @@ cPhs_State daStandItem_c::_create() { mItemNo = fopAcM_GetParam(this); mItemType = convItemNo(mItemNo); +#if VERSION == VERSION_DEMO + cPhs_State rt; + cPhs_State cloth_rt; + rt = dComIfG_resLoad(&mPhsDai, m_arcname); + cloth_rt = dComIfG_resLoad(&mPhsCloth, "Cloth"); + + if (rt == cPhs_ERROR_e || cloth_rt == cPhs_ERROR_e) { + return cPhs_ERROR_e; + } + if (rt != cPhs_COMPLEATE_e) { + return rt; + } + // !@bug They meant to check cloth_rt here, instead they check rt a second time. + if (rt != cPhs_COMPLEATE_e) { + return cloth_rt; + } +#else cPhs_State rt = dComIfG_resLoad(&mPhsDai, m_arcname); if (rt != cPhs_COMPLEATE_e) return rt; @@ -383,6 +435,7 @@ cPhs_State daStandItem_c::_create() { cPhs_State cloth_rt = dComIfG_resLoad(&mPhsCloth, "Cloth"); if (cloth_rt != cPhs_COMPLEATE_e) return cloth_rt; +#endif if (rt == cPhs_COMPLEATE_e && cloth_rt == cPhs_COMPLEATE_e) { if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, m_heapsize[mItemType])) @@ -509,7 +562,8 @@ bool daStandItem_c::actionFobj06() { m6C4 = 4.0f; } - m6B2 = m6C4 * 0x600; + int r0 = 0x600; + m6B2 = (f32)r0 * m6C4; cLib_addCalc(&m6C4, 0.0f, 0.08f, dKyw_get_wind_pow() + 0.3f, dKyw_get_wind_pow() + 0.1f); m6B4 += m6B2; return true; @@ -572,7 +626,10 @@ bool daStandItem_c::actionFobj09() { if (m694 == NULL) { m694 = dComIfGp_particle_set(dPa_name::ID_AK_SN_FOUNTAINFIGURE01, ¤t.pos, ¤t.angle, NULL, 0xFF, NULL, fopAcM_GetRoomNo(this), &tevStr.mColorK0); } - if (m698 == NULL) { +#if VERSION > VERSION_DEMO + if (m698 == NULL) +#endif + { m698 = dComIfGp_particle_set(dPa_name::ID_AK_SN_FOUNTAINFIGURE02, ¤t.pos, ¤t.angle); } if (m698) { @@ -627,8 +684,8 @@ void daStandItem_c::animTest() { } if (mBckSpeed == 0.0f || mBckPlayTimer == 0) { mpBckAnm->setPlaySpeed(0.0f); - s16 temp = (stopMaxTime - stopMinTime) / 2; s16 temp2 = (stopMinTime + stopMaxTime) / 2; + s16 temp = (stopMaxTime - stopMinTime) / 2; mBckStopTimer = temp2 + cM_rndFX(temp); } } else if (mBckStopTimer > 0) { @@ -637,8 +694,8 @@ void daStandItem_c::animTest() { mBckStopTimer = 1; } if (mBckStopTimer == 0) { - s16 temp = (animMaxTime - animMinTime) / 2; s16 temp2 = (animMinTime + animMaxTime) / 2; + s16 temp = (animMaxTime - animMinTime) / 2; mBckPlayTimer = temp2 + cM_rndFX(temp); mBckSpeed = 1.0f; if (mpBckAnm) { @@ -662,8 +719,8 @@ void daStandItem_c::animTestForOneTime() { if (mBckStopTimer == 0) { mpBckAnm->setPlaySpeed(1.0f); mpBckAnm->setFrame(0.0f); - s16 temp = (animMaxTime - animMinTime) / 2; s16 temp2 = (animMinTime + animMaxTime) / 2; + s16 temp = (animMaxTime - animMinTime) / 2; mBckPlayTimer = temp2 + cM_rndFX(temp); } } else if (mBckPlayTimer > 0) { @@ -672,8 +729,8 @@ void daStandItem_c::animTestForOneTime() { mpBckAnm->setPlaySpeed(1.0f); mpBckAnm->setFrame(0.0f); } else if (mBckPlayTimer == 0 && isStop) { - s16 temp = (stopMaxTime - stopMinTime) / 2; s16 temp2 = (stopMinTime + stopMaxTime) / 2; + s16 temp = (stopMaxTime - stopMinTime) / 2; mBckStopTimer = temp2 + cM_rndFX(temp); } else if (mBckPlayTimer == 0) { mBckPlayTimer = 1; @@ -754,13 +811,22 @@ void daStandItem_c::mode_drop() { bool daStandItem_c::_draw() { g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); g_env_light.setLightTevColorType(mpModel, &tevStr); +#if VERSION == VERSION_DEMO + if (mpBckAnm != NULL) + mpBckAnm->entry(mpModel->getModelData()); + if (mItemNo == dItemNo_PINWHEEL_e) + mDoExt_bckAnmRemove(mpModel->getModelData()); +#else if (mItemNo == dItemNo_PINWHEEL_e) mDoExt_bckAnmRemove(mpModel->getModelData()); else if (mpBckAnm != NULL) mpBckAnm->entry(mpModel->getModelData()); +#endif - if (mItemNo == dItemNo_SHOP_GURU_STATUE_e) - dDlst_texSpecmapST(&eyePos, &tevStr, mpModel->getModelData(), 1.0f); + if (mItemNo == dItemNo_SHOP_GURU_STATUE_e) { + f32 scale = 1.0f; + dDlst_texSpecmapST(&eyePos, &tevStr, mpModel->getModelData(), scale); + } mDoExt_modelUpdateDL(mpModel); if (mpCloth != NULL) diff --git a/src/d/actor/d_a_hmlif.cpp b/src/d/actor/d_a_hmlif.cpp index ea2ba404c..49fbdaa09 100644 --- a/src/d/actor/d_a_hmlif.cpp +++ b/src/d/actor/d_a_hmlif.cpp @@ -416,7 +416,9 @@ void daHmlif_c::lift_normal_move() { cLib_addCalcPos2(¤t.pos, m450, 1.0f, fopAcM_GetSpeedF(this)); } -BOOL daHmlif_c::check_path_point(cXyz, cXyz, cXyz, s8) { +BOOL daHmlif_c::check_path_point(cXyz, cXyz, s8) { + // Unused stripped function + return FALSE; } /* 00001270-00001410 .text set_next_pnt__9daHmlif_cFv */ diff --git a/src/d/actor/d_a_npc_bm1.cpp b/src/d/actor/d_a_npc_bm1.cpp index 3599ffef6..dfe7116a9 100644 --- a/src/d/actor/d_a_npc_bm1.cpp +++ b/src/d/actor/d_a_npc_bm1.cpp @@ -52,8 +52,9 @@ public: class daNpc_Bm1_HIO_c : public mDoHIO_entry_c { public: daNpc_Bm1_HIO_c(); - virtual ~daNpc_Bm1_HIO_c() {}; - void genMessage(JORMContext* ctx); + virtual ~daNpc_Bm1_HIO_c() {} + + void genMessage(JORMContext* ctx) {} public: /* 0x04 */ s8 m4; diff --git a/src/d/actor/d_a_obj_mkie.cpp b/src/d/actor/d_a_obj_mkie.cpp index 9c504f690..0e389ce12 100644 --- a/src/d/actor/d_a_obj_mkie.cpp +++ b/src/d/actor/d_a_obj_mkie.cpp @@ -185,7 +185,7 @@ BOOL daObjMkie::Act_c::Create() { #if VERSION > VERSION_DEMO if (daObj::PrmAbstract(this, PRM_FLAG_W, PRM_FLAG_S) != 0) { - actor_status &= ~0x3F; + fopAcM_ClearStatusMap(this); gbaName = 0; } #endif diff --git a/src/d/d_cloth_packet.cpp b/src/d/d_cloth_packet.cpp index 7e9bb3ff6..a53ab8418 100644 --- a/src/d/d_cloth_packet.cpp +++ b/src/d/d_cloth_packet.cpp @@ -357,7 +357,7 @@ void dCloth_packet_c::setMtx(Mtx mtx) { /* 800642FC-80064330 .text cloth_draw__15dCloth_packet_cFv */ void dCloth_packet_c::cloth_draw() { - j3dSys.getDrawBuffer(OPA_BUFFER)->entryImm(this, 0); + j3dSys.getDrawBuffer(J3DSysDrawBuf_Opa)->entryImm(this, 0); } /* 80064330-8006441C .text TexObjInit__15dCloth_packet_cFP7ResTIMG */ diff --git a/src/d/d_com_static.cpp b/src/d/d_com_static.cpp index b68cd7376..fcd96c6ce 100644 --- a/src/d/d_com_static.cpp +++ b/src/d/d_com_static.cpp @@ -457,6 +457,7 @@ void daTitle_proc_c::daTitle_Kirakira_Sound_flag_on() { } #endif +#if VERSION > VERSION_DEMO /* 80056CCC-80056DE0 .text daiItemNodeCallBack__13daStandItem_cFP7J3DNodei */ BOOL daStandItem_c::daiItemNodeCallBack(J3DNode* node, int calcTiming) { if (calcTiming == J3DNodeCBCalcTiming_In) { @@ -485,6 +486,7 @@ BOOL daStandItem_c::daiItemNodeCallBack(J3DNode* node, int calcTiming) { } return TRUE; } +#endif u8 daNpc_Ji1_c::game_life_point; diff --git a/src/f_ap/f_ap_game.cpp b/src/f_ap/f_ap_game.cpp index 7764527a7..a50c248a0 100644 --- a/src/f_ap/f_ap_game.cpp +++ b/src/f_ap/f_ap_game.cpp @@ -16,7 +16,7 @@ fapGm_HIO_c g_HIO; /* 8002306C-800231BC .text __ct__11fapGm_HIO_cFv */ fapGm_HIO_c::fapGm_HIO_c() { - field_0x05 = 1; + mUsingHostIO = true; #if VERSION > VERSION_DEMO if (mDoMain::developmentMode) { @@ -45,25 +45,26 @@ fapGm_HIO_c::fapGm_HIO_c() { field_0x1a = 0; field_0x1b = 1; field_0x1c = 0; - mFbWidth = 0x280; - mEfbHeight = 0x1e0; + mFbWidth = 640; + mEfbHeight = 480; field_0x30 = 0; - field_0x20.r = 0xff; - field_0x20.g = 0xff; - field_0x20.b = 0xff; - field_0x20.a = 0xff; + + mColor = JUtility::TColor(0xff, 0xff, 0xff, 0xff); + mTriggerThreshLo = 0.9f; mTriggerThreshHi = 0.6f; - field_0x3c = JUtility::TColor(0xff, 0x96, 0x00, 0xff); - field_0x40 = JUtility::TColor(0xff, 0x78, 0x00, 0xff); - field_0x44 = JUtility::TColor(0x00, 0x00, 0x00, 0xff); - field_0x48 = JUtility::TColor(0x00, 0x00, 0x00, 0xff); - field_0x4c = 0; - field_0x4e = 10; - field_0x54 = 0x1b; - field_0x50 = 0; - field_0x52 = 0; - field_0x56 = 0x82; + + mLetterTopColor = JUtility::TColor(0xff, 0x96, 0x00, 0xff); + mLetterBottomColor = JUtility::TColor(0xff, 0x78, 0x00, 0xff); + mLetterTopShadowColor = JUtility::TColor(0x00, 0x00, 0x00, 0xff); + mLetterBottomShadowColor = JUtility::TColor(0x00, 0x00, 0x00, 0xff); + + mLetterPositionX = 0; + mLetterPositionY = 10; + mLetterFontSize = 27; + mLineSpacing = 0; + mLetterSpacing = 0; + mBackgroundAlpha = 130; } /* 800231BC-800231E4 .text fapGm_After__Fv */ diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 09c1f1078..0eaf2a156 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -159,15 +159,15 @@ int mDoExt_bpkAnm::init(J3DMaterialTable* i_matTable, J3DAnmColor* i_bpk, BOOL i if (i_anmPlay) { int attribute; - #if VERSION == VERSION_JPN +#if VERSION == VERSION_JPN if (i_attribute < 0) { attribute = mpAnm->getAttribute(); } else { attribute = i_attribute; } - #else +#else attribute = i_attribute; - #endif +#endif if (initPlay(mpAnm->getFrameMax(), attribute, i_rate, i_startF, i_endF, i_modify) == 0) { return 0; } @@ -260,7 +260,7 @@ int mDoExt_btkAnm::init(J3DMaterialTable* i_matTable, J3DAnmTextureSRTKey* i_btk J3DMaterial* material = i_matTable->getMaterialNodePointer(materialId); u8 texMtxId = mpAnm->getUpdateTexMtxID(i); if (texMtxId != 0xFF) { - J3DTexMtx* texMtx = material->getTexGenBlock()->getTexMtx(texMtxId); + J3DTexMtx* texMtx = material->getTexMtx(texMtxId); if (!texMtx) { texMtx = new J3DTexMtx(); } @@ -286,15 +286,15 @@ int mDoExt_btkAnm::init(J3DMaterialTable* i_matTable, J3DAnmTextureSRTKey* i_btk if (i_anmPlay) { int attribute; - #if VERSION == VERSION_JPN +#if VERSION == VERSION_JPN if (i_attribute < 0) { attribute = mpAnm->getAttribute(); } else { attribute = i_attribute; } - #else +#else attribute = i_attribute; - #endif +#endif if (initPlay(mpAnm->getFrameMax(), attribute, i_rate, i_startF, i_endF, i_modify) == 0) { return 0; } @@ -365,15 +365,15 @@ int mDoExt_brkAnm::init(J3DMaterialTable* i_matTable, J3DAnmTevRegKey* i_brk, BO if (i_anmPlay) { int attribute; - #if VERSION == VERSION_JPN +#if VERSION == VERSION_JPN if (i_attribute < 0) { attribute = mpAnm->getAttribute(); } else { attribute = i_attribute; } - #else +#else attribute = i_attribute; - #endif +#endif if (initPlay(mpAnm->getFrameMax(), attribute, i_rate, i_startF, i_endF, i_modify) == 0) { return 0; } @@ -405,15 +405,15 @@ int mDoExt_bvaAnm::init(J3DModel* i_model, J3DAnmVisibilityFull* i_bva, BOOL i_a } if (i_anmPlay) { int attribute; - #if VERSION == VERSION_JPN +#if VERSION == VERSION_JPN if (i_attribute < 0) { attribute = mpAnm->getAttribute(); } else { attribute = i_attribute; } - #else +#else attribute = i_attribute; - #endif +#endif if (initPlay(mpAnm->getFrameMax(), attribute, i_rate, i_startF, i_endF, i_modify) == 0) { return 0; } @@ -442,15 +442,15 @@ int mDoExt_bckAnm::init(J3DModelData* i_modelData, J3DAnmTransform* i_bck, BOOL } if (i_anmPlay) { int attribute; - #if VERSION == VERSION_JPN +#if VERSION == VERSION_JPN if (i_attribute < 0) { attribute = mpAnm->getAttribute(); } else { attribute = i_attribute; } - #else +#else attribute = i_attribute; - #endif +#endif if (initPlay(mpAnm->getFrameMax(), attribute, i_rate, i_startF, i_endF, i_modify) == 0) { return 0; } @@ -850,9 +850,9 @@ JKRExpHeap* gameHeap; JKRExpHeap* mDoExt_createGameHeap(u32 heapSize, JKRHeap* i_heap) { JUT_ASSERT(VERSION_SELECT(2036, 2035, 2050, 2050), gameHeap == NULL || heapSize == 0); gameHeap = JKRCreateExpHeap(heapSize, i_heap, true); - #if VERSION > VERSION_DEMO +#if VERSION > VERSION_DEMO gameHeap->setAllocationMode(JKRExpHeap::ALLOC_MODE_1); - #endif +#endif return gameHeap; } @@ -935,9 +935,9 @@ JKRExpHeap* archiveHeap; JKRExpHeap* mDoExt_createArchiveHeap(u32 heapSize, JKRHeap* i_heap) { JUT_ASSERT(VERSION_SELECT(2173, 2222, 2237, 2237), archiveHeap == NULL || heapSize == 0); archiveHeap = JKRCreateExpHeap(heapSize, i_heap, true); - #if VERSION > VERSION_DEMO +#if VERSION > VERSION_DEMO archiveHeap->setAllocationMode(JKRExpHeap::ALLOC_MODE_1); - #endif +#endif return archiveHeap; } @@ -955,25 +955,28 @@ s32 mDoExt_getSafeArchiveHeapSize() { } #endif +#if VERSION == VERSION_DEMO +static u8 archiveHeapGroupID; +#endif + JKRHeap* mDoExt_SaveCurrentHeap; #if VERSION == VERSION_DEMO -static u8 archiveHeapGroupID; static u8 SolidHeapGroupID; #endif /* 80011AB4-80011ABC .text mDoExt_getArchiveHeap__Fv */ JKRExpHeap* mDoExt_getArchiveHeap() { - #if VERSION == VERSION_DEMO +#if VERSION == VERSION_DEMO JKRExpHeap* heap = archiveHeap; heap->changeGroupID(archiveHeapGroupID++); if (archiveHeapGroupID >= 200) { archiveHeapGroupID = 0; } return heap; - #else +#else return archiveHeap; - #endif +#endif } static void dummy() { @@ -993,9 +996,9 @@ JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_alignmen u32 size; JKRSolidHeap* createdHeap; - #if VERSION == VERSION_DEMO +#if VERSION == VERSION_DEMO u8 groupID = i_heap->changeGroupID(SolidHeapGroupID); - #endif +#endif if (i_size == 0 || i_size == -1) { createdHeap = JKRSolidHeap::create(-1, i_heap, false); @@ -1010,15 +1013,15 @@ JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_alignmen createdHeap = JKRSolidHeap::create(size, i_heap, false); } - #if VERSION == VERSION_DEMO +#if VERSION == VERSION_DEMO i_heap->changeGroupID(groupID); - #endif +#endif if (createdHeap != NULL) { createdHeap->setErrorFlag(true); } - #if VERSION == VERSION_DEMO +#if VERSION == VERSION_DEMO if (createdHeap == NULL) { // "mDoExt_createMaxSolidHeap: Failed to allocate a %fK solid heap. Contiguous free space=%fK Remaining free space=%f\n" OSReport_Warning( @@ -1034,7 +1037,7 @@ JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_heap, u32 i_alignmen } else { SolidHeapGroupID = SolidHeapGroupID < 199 ? (u8)(SolidHeapGroupID + 1) : 0; } - #endif +#endif return createdHeap; } @@ -1055,9 +1058,9 @@ JKRSolidHeap* mDoExt_createSolidHeapToCurrent(u32 i_size, JKRHeap* i_parent, u32 if (!resultHeap) { return NULL; } - #if VERSION > VERSION_DEMO +#if VERSION > VERSION_DEMO JUT_ASSERT(VERSION_SELECT(0, 2530, 2545, 2545), OSGetCurrentThread() == &mainThread); - #endif +#endif JUT_ASSERT(VERSION_SELECT(2441, 2531, 2546, 2546), mDoExt_SaveCurrentHeap == NULL); mDoExt_SaveCurrentHeap = JKRGetCurrentHeap(); mDoExt_setCurrentHeap(resultHeap); @@ -1102,9 +1105,9 @@ JKRHeap* mDoExt_getCurrentHeap() { /* 80011DDC-80011E98 .text mDoExt_restoreCurrentHeap__Fv */ void mDoExt_restoreCurrentHeap() { - #if VERSION > VERSION_DEMO +#if VERSION > VERSION_DEMO JUT_ASSERT(VERSION_SELECT(0, 2739, 2754, 2754), OSGetCurrentThread() == &mainThread); - #endif +#endif JUT_ASSERT(VERSION_SELECT(2647, 2740, 2755, 2755), mDoExt_SaveCurrentHeap != NULL); mDoExt_SaveCurrentHeap->becomeCurrentHeap(); mDoExt_SaveCurrentHeap = NULL; @@ -1136,6 +1139,7 @@ void mDoExt_MtxCalcAnmBlendTbl::calc(u16 jnt_no) { Quaternion quat3; mAnmRatio->getAnmTransform()->getTransform(jnt_no, &info2); JMAEulerToQuat(info2.mRotation.x, info2.mRotation.y, info2.mRotation.z, &quat1); + f32 f30 = mAnmRatio[0].getRatio(); quat3 = quat1; for (int i = 1; i < mNum; i++) { J3DAnmTransform* transform = mAnmRatio[i].getAnmTransform(); @@ -1143,7 +1147,7 @@ void mDoExt_MtxCalcAnmBlendTbl::calc(u16 jnt_no) { J3DTransformInfo info3; transform->getTransform(jnt_no, &info3); f32 ratio = mAnmRatio[i].getRatio(); - f32 f30 = 1.0f - ratio; + f30 = 1.0f - ratio; JMAEulerToQuat(info3.mRotation.x, info3.mRotation.y, info3.mRotation.z, &quat2); JMAQuatLerp(&quat1, &quat2, ratio, &quat3); quat1 = quat3; @@ -1316,7 +1320,7 @@ mDoExt_McaMorf::mDoExt_McaMorf(J3DModelData* modelData, mDoExt_McaMorfCallBack1_ J3DTransformInfo* info = mpTransformInfo; Quaternion* quat = mpQuat; J3DModelData* r23 = mpModel->getModelData(); - u16 jointNum = r23->getJointNum(); + int jointNum = r23->getJointNum(); for (int i = 0; i < jointNum; i++) { *info = r23->getJointNodePointer(i)->getTransformInfo(); JMAEulerToQuat(info->mRotation.x, info->mRotation.y, info->mRotation.z, quat); @@ -1604,7 +1608,7 @@ mDoExt_McaMorf2::mDoExt_McaMorf2(J3DModelData* modelData, mDoExt_McaMorfCallBack J3DTransformInfo* info = mpTransformInfo; Quaternion* quat = mpQuat; J3DModelData* r23 = mpModel->getModelData(); - u16 jointNum = r23->getJointNum(); + int jointNum = r23->getJointNum(); for (int i = 0; i < jointNum; i++) { *info = r23->getJointNodePointer(i)->getTransformInfo(); JMAEulerToQuat(info->mRotation.x, info->mRotation.y, info->mRotation.z, quat); @@ -1954,9 +1958,9 @@ void mDoExt_3DlineMat0_c::setMaterial() { {0xC0, 0x00, 0x00}, }; j3dSys.reinitGX(); - #if VERSION > VERSION_JPN +#if VERSION > VERSION_JPN GXSetNumIndStages(0); - #endif +#endif dKy_setLight_again(); GXClearVtxDesc(); @@ -2220,9 +2224,9 @@ void mDoExt_3DlineMat1_c::setMaterial() { {0xC0, 0x00, 0x00}, }; j3dSys.reinitGX(); - #if VERSION > VERSION_JPN +#if VERSION > VERSION_JPN GXSetNumIndStages(0); - #endif +#endif dKy_setLight_again(); GXClearVtxDesc(); @@ -2341,7 +2345,7 @@ void mDoExt_3DlineMat1_c::update(u16 i_segs, f32 i_size, GXColor& i_color, u16 i delta = delta.outprod(eyeDelta); f32 scale = delta.abs(); if (scale != 0.0f) { - scale = i_size / scale; + scale = r_size / scale; delta *= scale; } @@ -2531,9 +2535,9 @@ void mDoExt_3DlineMatSortPacket::draw() { lineMat->draw(); lineMat = lineMat->mpNextLineMat; } while (lineMat); - #if VERSION > VERSION_JPN +#if VERSION > VERSION_JPN J3DShape::resetVcdVatCache(); - #endif +#endif } /* 800165E4-8001683C .text mDoExt_initFontCommon__FPP7JUTFontPP7ResFONTP7JKRHeapPCcP10JKRArchiveUcUlUl */ @@ -2549,11 +2553,11 @@ void mDoExt_initFontCommon(JUTFont** p_font, ResFONT** p_resfont, JKRHeap* p_hea JUT_ASSERT(VERSION_SELECT(6544, 6637, 6651, 6651), mDoExt_resfont != NULL); if (param_6 == 0) { - #if VERSION <= VERSION_JPN +#if VERSION <= VERSION_JPN u32 temp = (param_8 + 0x40) * param_7; - #else +#else u32 temp = (((param_8+0x1F) & ~0x1F) + 0x40) * param_7; - #endif +#endif JUTCacheFont* cacheFont = new(p_heap, 0) JUTCacheFont(*p_resfont, temp, p_heap); if (cacheFont->isValid()) { *p_font = cacheFont; @@ -2576,18 +2580,29 @@ void mDoExt_initFontCommon(JUTFont** p_font, ResFONT** p_resfont, JKRHeap* p_hea JUT_ASSERT(VERSION_SELECT(6575, 6668, 6685, 6685), mDoExt_font != NULL); } +#if VERSION == VERSION_DEMO JUTFont* mDoExt_font0; -ResFONT* mDoExt_resfont0; +JUTFont* mDoExt_font1; s32 mDoExt_font0_getCount; +s32 mDoExt_font1_getCount; +ResFONT* mDoExt_resfont0; +ResFONT* mDoExt_resfont1; +#else +JUTFont* mDoExt_font0; +s32 mDoExt_font0_getCount; +ResFONT* mDoExt_resfont0; +JUTFont* mDoExt_font1; +s32 mDoExt_font1_getCount; +ResFONT* mDoExt_resfont1; +#endif #if VERSION <= VERSION_JPN void mDoExt_initFont0() { - /* Nonmatching */ - static const char* fontdata[] = { + static const char* const fontdata[] = { "rock_24_20_4i1.bfn", "rock_e_24_20_4i.bfn", }; - u8 r30 = g_msgDHIO.field_0x08; + const u8 r30 = g_msgDHIO.field_0x08; mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(), fontdata[r30], dComIfGp_getFontArchive(), r30, 0xB4, 0x800); } #else @@ -2598,10 +2613,6 @@ void mDoExt_initFont0() { } #endif -JUTFont* mDoExt_font1; -ResFONT* mDoExt_resfont1; -s32 mDoExt_font1_getCount; - #if VERSION <= VERSION_JPN void mDoExt_initFont1() { mDoExt_initFontCommon(&mDoExt_font1, &mDoExt_resfont1, mDoExt_getZeldaHeap(), "rodb_16_11_4i.bfn", dComIfGp_getRubyArchive(), 1, 1, 0x8000); @@ -2640,11 +2651,11 @@ void mDoExt_removeMesgFont() { mDoExt_font0 = NULL; if (mDoExt_resfont0) { - #if VERSION <= VERSION_JPN +#if VERSION <= VERSION_JPN if (g_msgDHIO.field_0x08 == 0) { JKRFileLoader::removeResource(mDoExt_resfont0, NULL); } else - #endif +#endif { JKRHeap::free(mDoExt_resfont0, NULL); } @@ -2657,12 +2668,12 @@ void mDoExt_removeMesgFont() { #if VERSION > VERSION_JPN /* 80016A1C-80016A7C .text mDoExt_initFont1__Fv */ void mDoExt_initFont1() { - #if VERSION <= VERSION_JPN +#if VERSION <= VERSION_JPN mDoExt_initFontCommon(&mDoExt_font1, &mDoExt_resfont1, mDoExt_getZeldaHeap(), "rodb_16_11_4i.bfn", dComIfGp_getRubyArchive(), 1, 1, 0x8000); - #else +#else static const char fontdata[] = "hyrule.bfn"; mDoExt_initFontCommon(&mDoExt_font1, &mDoExt_resfont1, mDoExt_getZeldaHeap(), fontdata, dComIfGp_getRubyArchive(), 1, 1, 0x8000); - #endif +#endif } #endif