diff --git a/configure.py b/configure.py index e72fc4673..164035394 100755 --- a/configure.py +++ b/configure.py @@ -453,7 +453,7 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_lib.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_save.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(Matching, "d/d_save_init.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_shop.cpp", extra_cflags=['-pragma "nosyminline on"']), + Object(Matching, "d/d_shop.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_jnt_hit.cpp"), Object(Matching, "d/d_chain.cpp"), Object(NonMatching, "d/d_cloth_packet.cpp"), @@ -467,8 +467,8 @@ config.libs = [ Object(Matching, "d/d_a_itembase_static.cpp"), Object(Matching, "d/d_a_item_static.cpp"), Object(Matching, "d/d_a_shop_item_static.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_a_race_item_static.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_a_leaflift_static.cpp"), + Object(Matching, "d/d_a_race_item_static.cpp"), + Object(Matching, "d/d_a_leaflift_static.cpp"), Object(NonMatching, "d/d_demo.cpp"), Object(Equivalent, "d/d_door.cpp", extra_cflags=['-pragma "nosyminline on"']), # weak func order Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_resorce.cpp", extra_cflags=['-pragma "nosyminline on"']), @@ -599,7 +599,7 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_s_room.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_s_title.cpp"), Object(NonMatching, "d/d_scope.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_throwstone.cpp"), + Object(Matching, "d/d_throwstone.cpp"), Object(Matching, "d/d_timer.cpp"), Object(NonMatching, "d/d_water_mark.cpp"), Object(Matching, "d/d_wind_arrow.cpp"), @@ -943,16 +943,16 @@ config.libs = [ Object(Matching, "JSystem/JUtility/JUTResFont.cpp"), Object(Matching, "JSystem/JUtility/JUTDbPrint.cpp"), Object(Matching, "JSystem/JUtility/JUTGamePad.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JUtility/JUTException.cpp"), + Object(Matching, "JSystem/JUtility/JUTException.cpp"), Object(Matching, "JSystem/JUtility/JUTDirectPrint.cpp"), Object(Matching, "JSystem/JUtility/JUTAssert.cpp"), Object(Matching, "JSystem/JUtility/JUTVideo.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JUtility/JUTXfb.cpp"), + Object(Equivalent, "JSystem/JUtility/JUTXfb.cpp"), Object(Matching, "JSystem/JUtility/JUTFader.cpp"), Object(Matching, "JSystem/JUtility/JUTProcBar.cpp"), Object(Matching, "JSystem/JUtility/JUTConsole.cpp"), Object(Matching, "JSystem/JUtility/JUTDirectFile.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JUtility/JUTGba.cpp"), + Object(Matching, "JSystem/JUtility/JUTGba.cpp"), Object(Matching, "JSystem/JUtility/JUTFontData_Ascfont_fix12.cpp"), # Originally a .s file ], ), @@ -1347,7 +1347,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_att", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bflower", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_bita", extra_cflags=['-pragma "nosyminline on"']), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_branch"), + ActorRel(Matching, "d_a_branch"), ActorRel(NonMatching, "d_a_bridge"), ActorRel(NonMatching, "d_a_coming2"), ActorRel(NonMatching, "d_a_coming3"), @@ -1382,7 +1382,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_magma"), ActorRel(NonMatching, "d_a_majuu_flag"), ActorRel(NonMatching, "d_a_mdoor"), - ActorRel(NonMatching, "d_a_msw"), + ActorRel(MatchingFor("D44J01"), "d_a_msw", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_mtoge"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_AjavW", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_obj_Ygush00", extra_cflags=['-pragma "nosyminline on"']), diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index 67be0f45e..596ffc38e 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -801,16 +801,16 @@ private: class J3DFrameCtrl { public: enum Attribute_e { - EMode_NONE, - EMode_RESET, - EMode_LOOP, - EMode_REVERSE, - EMode_LOOP_REVERSE, + /* 0x0 */ EMode_NONE, + /* 0x1 */ EMode_RESET, + /* 0x2 */ EMode_LOOP, + /* 0x3 */ EMode_REVERSE, + /* 0x4 */ EMode_LOOP_REVERSE, }; enum State_e { - STATE_STOP_E = 0x1, - STATE_LOOP_E = 0x2, + /* 0x1 */ STATE_STOP_E = 0x1, + /* 0x2 */ STATE_LOOP_E = 0x2, }; J3DFrameCtrl() { this->init(0); } diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index 808c8b5c6..67434e804 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -571,8 +571,7 @@ struct J3DZMode { u8 getUpdateEnable() const { return j3dZModeTable[mZModeID * 3 + 2]; } void setZModeInfo(const J3DZModeInfo& info) { - u8 compareEn = info.mCompareEnable; - mZModeID = calcZModeID(compareEn, info.mFunc, info.mUpdateEnable); + mZModeID = calcZModeID(info.mCompareEnable, info.mFunc, info.mUpdateEnable); } void load() const { diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h index 9c98f9120..58e9bac9f 100644 --- a/include/JSystem/J3DGraphBase/J3DSys.h +++ b/include/JSystem/J3DGraphBase/J3DSys.h @@ -32,9 +32,11 @@ struct J3DTexCoordScaleInfo { }; enum J3DSysFlag { - J3DSysFlag_SkinPosCpu = 0x00000004, - J3DSysFlag_SkinNrmCpu = 0x00000008, - J3DSysFlag_PostTexMtx = 0x40000000, + J3DSysFlag_UNK2 = 0x00000002, + J3DSysFlag_SkinPosCpu = 0x00000004, + J3DSysFlag_SkinNrmCpu = 0x00000008, + J3DSysFlag_PostTexMtx = 0x40000000, + J3DSysFlag_UNK80000000 = 0x80000000, }; struct J3DSys { @@ -75,10 +77,8 @@ public: void setNBTScale(Vec* scale) { mNBTScale = scale; } void onFlag(u32 flag) { mFlags |= flag; } - void offFlag(u32 flag) { mFlags &= ~flag; } - - bool checkFlag(u32 flag) { return mFlags & flag; } + bool checkFlag(u32 flag) { return (mFlags & flag) ? true : false; } void setModelDrawMtx(Mtx* pMtxArr) { mModelDrawMtx = pMtxArr; diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h index 687b2e87e..ec9c11230 100644 --- a/include/JSystem/JUtility/JUTAssert.h +++ b/include/JSystem/JUtility/JUTAssert.h @@ -24,9 +24,12 @@ #define JUT_LOG(LINE, ...) \ JUTAssertion::setLogMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__) -#define JUT_CONFIRM(LINE, COND) \ +#define JUT_SET_CONFIRM(LINE, COND) \ JUTAssertion::setConfirmMessage(JUTAssertion::getSDevice(), __FILE__, LINE, COND, #COND) +#define JUT_CONFIRM(LINE, COND) \ + JUT_SET_CONFIRM(LINE, COND) + namespace JUTAssertion { u32 getSDevice(); void showAssert(u32 device, const char * file, int line, const char * assertion); diff --git a/include/d/actor/d_a_branch.h b/include/d/actor/d_a_branch.h index a3e2892b4..c050d24bd 100644 --- a/include/d/actor/d_a_branch.h +++ b/include/d/actor/d_a_branch.h @@ -15,7 +15,7 @@ public: } } - dComIfG_resDelete(&mPhase, m_arcname); + dComIfG_resDeleteDemo(&mPhase, m_arcname); } inline cPhs_State create(); inline BOOL draw(); diff --git a/include/d/actor/d_a_ship.h b/include/d/actor/d_a_ship.h index f51d099d5..960163988 100644 --- a/include/d/actor/d_a_ship.h +++ b/include/d/actor/d_a_ship.h @@ -77,15 +77,15 @@ public: typedef BOOL (daShip_c::*ProcFunc)(); - bool checkStateFlg(daSHIP_SFLG flag) const { return mStateFlag & flag; } - bool getFlyFlg() { return checkStateFlg(daSFLG_FLY_e); } - bool getJumpFlg() const { return checkStateFlg(daSFLG_JUMP_e); } - bool getLandFlg() const { return checkStateFlg(daSFLG_LAND_e); } - bool getSailOn() { return checkStateFlg(daSFLG_SAIL_ON_e); } + u32 checkStateFlg(daSHIP_SFLG flag) const { return mStateFlag & flag; } + BOOL getFlyFlg() { return checkStateFlg(daSFLG_FLY_e); } + BOOL getJumpFlg() const { return checkStateFlg(daSFLG_JUMP_e); } + BOOL getLandFlg() const { return checkStateFlg(daSFLG_LAND_e); } + BOOL getSailOn() { return checkStateFlg(daSFLG_SAIL_ON_e); } void onJumpRideFlg() { onStateFlg(daSFLG_JUMP_RIDE_e); } - bool checkJumpOkFlg() const { return checkStateFlg(daSFLG_JUMP_OK_e); } - bool checkShootCannon() const { return checkStateFlg(daSFLG_SHOOT_CANNON_e); } - bool checkHeadNoDraw() const { return checkStateFlg(daSFLG_HEAD_NO_DRAW_e); } + BOOL checkJumpOkFlg() const { return checkStateFlg(daSFLG_JUMP_OK_e); } + BOOL checkShootCannon() const { return checkStateFlg(daSFLG_SHOOT_CANNON_e); } + BOOL checkHeadNoDraw() const { return checkStateFlg(daSFLG_HEAD_NO_DRAW_e); } void setSteerMove() { mNextMode = MODE_STEER_MOVE_e; } void setPaddleMove() { mNextMode = MODE_PADDLE_MOVE_e; } diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index d2a403cb8..b0c494fdb 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -3971,6 +3971,14 @@ inline dCcS* dComIfG_Ccsp() { return &g_dComIfG_gameInfo.play.mCcS; } +// This should be dComIfG_Ccsp()->SetMass everywhere, but for some reason that combination of two +// inlines consistently breaks the match on retail. But for the demo, using the proper inlines is requires to match. +#if VERSION == VERSION_DEMO +#define dComIfG_Ccsp_SetMass dComIfG_Ccsp()->SetMass +#else +#define dComIfG_Ccsp_SetMass dComIfG_Ccsp()->mMass_Mng.Set +#endif + inline void dComIfG_setTimerMode(int ms) { g_dComIfG_gameInfo.play.setTimerMode(ms); } inline int dComIfG_getTimerMode() { return g_dComIfG_gameInfo.play.getTimerMode(); } diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 770c91447..f53f67623 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -132,7 +132,7 @@ inline u32 fopAcM_checkCarryNow(fopAc_ac_c* pActor) { return pActor->actor_status & fopAcStts_CARRY_e; } -inline u32 fopAcM_checkHookCarryNow(fopAc_ac_c* pActor) { +inline bool fopAcM_checkHookCarryNow(fopAc_ac_c* pActor) { return fopAcM_CheckStatus(pActor, fopAcStts_HOOK_CARRY_e); } diff --git a/include/global.h b/include/global.h index 1dc605591..d7b4a30ee 100644 --- a/include/global.h +++ b/include/global.h @@ -41,11 +41,10 @@ #define WEAKFUNC #endif +#ifndef __MWERKS__ extern int __cntlzw(uint); extern int __rlwimi(int, int, int, int, int); extern void __dcbz(void*, int); - -#ifndef __MWERKS__ extern void __sync(); #endif diff --git a/src/JSystem/J3DGraphAnimator/J3DJoint.cpp b/src/JSystem/J3DGraphAnimator/J3DJoint.cpp index 76161fcad..4dd4798a9 100644 --- a/src/JSystem/J3DGraphAnimator/J3DJoint.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DJoint.cpp @@ -230,7 +230,7 @@ void J3DJoint::entryIn() { j3dSys.getDrawBuffer(0)->setZMtx(anmMtx); j3dSys.getDrawBuffer(1)->setZMtx(anmMtx); for (J3DMaterial* mesh = mMesh; mesh != NULL; ) { - if (mesh->getShape()->checkFlag(1)) { + if (mesh->getShape()->checkFlag(J3DShpFlag_Hide)) { mesh = mesh->getNext(); } else { J3DMatPacket* matPacket = j3dSys.getModel()->getMatPacket(mesh->getIndex()); diff --git a/src/JSystem/J3DGraphAnimator/J3DModel.cpp b/src/JSystem/J3DGraphAnimator/J3DModel.cpp index a04c223f5..d182c6498 100644 --- a/src/JSystem/J3DGraphAnimator/J3DModel.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DModel.cpp @@ -402,16 +402,16 @@ void J3DModel::calcMaterial() { j3dSys.setModel(this); j3dSys.setTexture(mModelData->getTexture()); - if (checkFlag(4)) { - j3dSys.onFlag(4); + if (checkFlag(J3DMdlFlag_SkinPosCpu)) { + j3dSys.onFlag(J3DSysFlag_SkinPosCpu); } else { - j3dSys.offFlag(4); + j3dSys.offFlag(J3DSysFlag_SkinPosCpu); } - if (checkFlag(8)) { - j3dSys.onFlag(8); + if (checkFlag(J3DMdlFlag_SkinNrmCpu)) { + j3dSys.onFlag(J3DSysFlag_SkinNrmCpu); } else { - j3dSys.offFlag(8); + j3dSys.offFlag(J3DSysFlag_SkinNrmCpu); } for (u16 i = 0; i < getModelData()->getMaterialNum(); i++) { @@ -755,14 +755,14 @@ void J3DModel::prepareShapePackets() { J3DShapePacket* pkt = getShapePacket(i); if (checkFlag(J3DMdlFlag_SkinPosCpu)) - pShape->onFlag(J3DSysFlag_SkinPosCpu); + pShape->onFlag(J3DShpFlag_SkinPosCpu); else - pShape->offFlag(J3DSysFlag_SkinPosCpu); + pShape->offFlag(J3DShpFlag_SkinPosCpu); if (checkFlag(J3DMdlFlag_SkinNrmCpu) && !pShape->checkFlag(J3DShpFlag_EnableLod)) - pShape->onFlag(J3DSysFlag_SkinNrmCpu); + pShape->onFlag(J3DShpFlag_SkinNrmCpu); else - pShape->offFlag(J3DSysFlag_SkinNrmCpu); + pShape->offFlag(J3DShpFlag_SkinNrmCpu); if (getMtxCalcMode() == 2) pkt->setBaseMtxPtr(&mViewBaseMtx); diff --git a/src/JSystem/J3DGraphAnimator/J3DVisibility.cpp b/src/JSystem/J3DGraphAnimator/J3DVisibility.cpp index 12af46008..4fe24d86c 100644 --- a/src/JSystem/J3DGraphAnimator/J3DVisibility.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DVisibility.cpp @@ -16,9 +16,9 @@ void J3DVisibilityManager::setVisibility(J3DModelData* pModel) { visibility = 0; mAnmVisibility->getVisibility(index, &visibility); if (visibility != 0) { - pModel->getShapeNodePointer(index)->offFlag(1); + pModel->getShapeNodePointer(index)->offFlag(J3DShpFlag_Hide); } else { - pModel->getShapeNodePointer(index)->onFlag(1); + pModel->getShapeNodePointer(index)->onFlag(J3DShpFlag_Hide); } } } diff --git a/src/JSystem/J3DGraphBase/J3DMatBlock.cpp b/src/JSystem/J3DGraphBase/J3DMatBlock.cpp index 53b8a5c8c..161a205c9 100644 --- a/src/JSystem/J3DGraphBase/J3DMatBlock.cpp +++ b/src/JSystem/J3DGraphBase/J3DMatBlock.cpp @@ -1815,7 +1815,7 @@ void J3DPEBlockFull::reset(J3DPEBlock* pBlock) { /* 802E96C8-802E9920 .text calc__21J3DTexGenBlockPatchedFPA4_Cf */ void J3DTexGenBlockPatched::calc(const Mtx modelMtx) { - if (!((j3dSys.mFlags >> 2) & 0x01) || !j3dSys.checkFlag(J3DSysFlag_SkinNrmCpu)) { + if (!j3dSys.checkFlag(J3DSysFlag_SkinPosCpu) || !j3dSys.checkFlag(J3DSysFlag_SkinNrmCpu)) { for (s32 i = 0; i < (s32)ARRAY_SIZE(mTexMtx); i++) { if (mTexMtx[i] == NULL) continue; diff --git a/src/JSystem/J3DGraphBase/J3DMaterial.cpp b/src/JSystem/J3DGraphBase/J3DMaterial.cpp index 939e5c1de..9f7edb416 100644 --- a/src/JSystem/J3DGraphBase/J3DMaterial.cpp +++ b/src/JSystem/J3DGraphBase/J3DMaterial.cpp @@ -213,7 +213,7 @@ void J3DMaterial::makeSharedDisplayList() { /* 802DEAD4-802DEB3C .text load__11J3DMaterialFv */ void J3DMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); - if (!j3dSys.checkFlag(2)) { + if (!j3dSys.checkFlag(J3DSysFlag_UNK2)) { j3dSys.mMatPacket->callDL(); loadNBTScale(*mTexGenBlock->getNBTScale()); } @@ -222,7 +222,7 @@ void J3DMaterial::load() { /* 802DEB3C-802DEBA0 .text loadSharedDL__11J3DMaterialFv */ void J3DMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); - if (!j3dSys.checkFlag(2)) { + if (!j3dSys.checkFlag(J3DSysFlag_UNK2)) { mSharedDLObj->callDL(); loadNBTScale(*mTexGenBlock->getNBTScale()); } @@ -360,7 +360,7 @@ void J3DPatchedMaterial::makeSharedDisplayList() {} /* 802DF268-802DF2AC .text load__18J3DPatchedMaterialFv */ void J3DPatchedMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); - if (j3dSys.checkFlag(0x02)) { + if (j3dSys.checkFlag(J3DSysFlag_UNK2)) { return; } j3dSys.mMatPacket->callDL(); @@ -369,7 +369,7 @@ void J3DPatchedMaterial::load() { /* 802DF2AC-802DF2EC .text loadSharedDL__18J3DPatchedMaterialFv */ void J3DPatchedMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); - if (!j3dSys.checkFlag(0x02)) { + if (!j3dSys.checkFlag(J3DSysFlag_UNK2)) { mSharedDLObj->callDL(); } } @@ -402,7 +402,7 @@ void J3DLockedMaterial::makeSharedDisplayList() {} /* 802DF368-802DF3AC .text load__17J3DLockedMaterialFv */ void J3DLockedMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); - if (j3dSys.checkFlag(0x02)) { + if (j3dSys.checkFlag(J3DSysFlag_UNK2)) { return; } j3dSys.mMatPacket->callDL(); @@ -411,7 +411,7 @@ void J3DLockedMaterial::load() { /* 802DF3AC-802DF3EC .text loadSharedDL__17J3DLockedMaterialFv */ void J3DLockedMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); - if (!j3dSys.checkFlag(0x02)) { + if (!j3dSys.checkFlag(J3DSysFlag_UNK2)) { mSharedDLObj->callDL(); } } diff --git a/src/JSystem/J3DGraphBase/J3DSys.cpp b/src/JSystem/J3DGraphBase/J3DSys.cpp index f7b6c54c0..cc7d17968 100644 --- a/src/JSystem/J3DGraphBase/J3DSys.cpp +++ b/src/JSystem/J3DGraphBase/J3DSys.cpp @@ -126,7 +126,7 @@ void J3DSys::setTexCacheRegion(GXTexCacheSize size) { u32 regionNum = kRegionNum[size]; mTexCacheRegionNum = regionNum; - if (!!(mFlags & 0x80000000)) { + if (checkFlag(J3DSysFlag_UNK80000000)) { for (u32 i = 0; i < regionNum; i++) { if (!!(i & 1)) { GXInitTexCacheRegion(&mTexCacheRegion[i], GX_FALSE, i * kSize[size] + 0x80000, size, i * kSize[size], size); diff --git a/src/JSystem/JAudio/JASTrack.cpp b/src/JSystem/JAudio/JASTrack.cpp index 6aa491d6b..3f307747c 100644 --- a/src/JSystem/JAudio/JASTrack.cpp +++ b/src/JSystem/JAudio/JASTrack.cpp @@ -1110,7 +1110,6 @@ void JASystem::TTrack::writeRegDirect(u8 target, u16 value) { /* 80283164-802836FC .text writeRegParam__Q28JASystem6TTrackFUc */ void JASystem::TTrack::writeRegParam(u8 param) { - /* Nonmatching */ u8 curr_file_byte; u8 bVar0; u8 bVar1; @@ -1246,6 +1245,7 @@ void JASystem::TTrack::writeRegParam(u8 param) { break; } + // Bug: reg_flags is uninitialized in several of these cases. u16 reg_flags; switch (bVar0) { case 0: @@ -1324,7 +1324,6 @@ void JASystem::TTrack::writeSelfPort(int param_1, u16 param_2) { /* 80283744-802837AC .text writePortAppDirect__Q28JASystem6TTrackFUlUs */ int JASystem::TTrack::writePortAppDirect(u32 port, u16 value) { - /* Nonmatching */ mTrackPort.writeImport(port, value); if (port == 0 || port == 1) { TIntrMgr& intrMgr = mIntrMgr; diff --git a/src/JSystem/JFramework/JFWDisplay.cpp b/src/JSystem/JFramework/JFWDisplay.cpp index 3a62e7362..3176465fb 100644 --- a/src/JSystem/JFramework/JFWDisplay.cpp +++ b/src/JSystem/JFramework/JFWDisplay.cpp @@ -75,7 +75,7 @@ JFWDisplay::~JFWDisplay() { /* 80255354-802553EC .text createManager__10JFWDisplayFP7JKRHeapQ26JUTXfb10EXfbNumberb */ JFWDisplay* JFWDisplay::createManager(JKRHeap* p_heap, JUTXfb::EXfbNumber xfb_num, bool enableAlpha) { - JUT_CONFIRM(VERSION_SELECT(244, 244, 243, 243), sManager == 0); + JUT_CONFIRM(VERSION_SELECT(244, 244, 243, 243), sManager == NULL); if(sManager == 0) { sManager = new JFWDisplay(0, p_heap, xfb_num, enableAlpha); } diff --git a/src/JSystem/JStudio/JStudio/stb.cpp b/src/JSystem/JStudio/JStudio/stb.cpp index 7ba5137b8..f9425222b 100644 --- a/src/JSystem/JStudio/JStudio/stb.cpp +++ b/src/JSystem/JStudio/JStudio/stb.cpp @@ -164,25 +164,25 @@ void TObject::process_sequence_() { switch (type) { case 0: JUT_EXPECT(u32Value == 0); - JUT_EXPECT(pContent == 0); + JUT_EXPECT(pContent == NULL); break; case 1: - JUT_EXPECT(pContent == 0); + JUT_EXPECT(pContent == NULL); setFlag_operation_(u32Value); break; case 2: - JUT_EXPECT(pContent == 0); + JUT_EXPECT(pContent == NULL); setWait(u32Value); break; case 3: { - JUT_EXPECT(pContent == 0); + JUT_EXPECT(pContent == NULL); s32 off = toInt32FromUInt24_(u32Value); void* nextseq = (void*)getSequence_offset(off); setSequence_next(nextseq); break; } case 4: { - JUT_EXPECT(pContent == 0); + JUT_EXPECT(pContent == NULL); u32 val = toInt32FromUInt24_(u32Value); suspend(val); break; diff --git a/src/JSystem/JUtility/JUTException.cpp b/src/JSystem/JUtility/JUTException.cpp index eafcf4c20..cdb7c1642 100644 --- a/src/JSystem/JUtility/JUTException.cpp +++ b/src/JSystem/JUtility/JUTException.cpp @@ -124,7 +124,11 @@ u32 JUTException::fpscr; void JUTException::errorHandler(OSError error, OSContext* context, u32 param_3, u32 param_4) { if (error == 0x10) { OSReport("\x1b[41;37m"); +#if VERSION == VERSION_DEMO + OSReport(" FPE: 浮動小数点例外が発生しました。アドレスは %08x\n", context->srr0); +#else OSReport(" FPE: 浮動小数点例外が発生しました。アドレスは %08x fpscr=%08x\n", context->srr0, context->fpscr); +#endif u8 stack_38[0x20]; u32 stack_3c; u32 stack_40; @@ -993,7 +997,11 @@ void JUTException::createConsole(void* console_buffer, u32 console_buffer_size) manager->setDirectConsole(sConsole); sConsole->setFontSize(10.0, 6.0); +#if VERSION == VERSION_DEMO + sConsole->setPosition(15, 26); +#else sConsole->setPosition(12, 40); +#endif sConsole->setHeight(23); sConsole->setVisible(true); sConsole->setOutput(JUTConsole::OUTPUT_OSREPORT | JUTConsole::OUTPUT_CONSOLE); diff --git a/src/JSystem/JUtility/JUTGba.cpp b/src/JSystem/JUtility/JUTGba.cpp index 0642b06d2..e251dbd16 100644 --- a/src/JSystem/JUtility/JUTGba.cpp +++ b/src/JSystem/JUtility/JUTGba.cpp @@ -224,7 +224,9 @@ BOOL JUTGba::resultGetStatus(int param_1, u8* param_2) { void* JUTGba::gbaThreadMain(void* param_1) { JUTGbaParam* param = (JUTGbaParam*)param_1; { JKRThread jkrThread(OSGetCurrentThread(), 0); } +#if VERSION > VERSION_DEMO JKRSetCurrentHeap(NULL); +#endif JUTGbaThreadVar threadVar; threadVar.field_0x0 = param; while (true) { @@ -279,7 +281,7 @@ void* JUTGba::gbaThreadMain(void* param_1) { sManager->gbaThread_GetStatus(&threadVar); break; default: - OSPanic(__FILE__, 623, "UNKNOWN GBA COMMAND."); + OSPanic(__FILE__, VERSION_SELECT(622, 623, 623, 623), "UNKNOWN GBA COMMAND."); break; } if (threadVar.field_0x14) { diff --git a/src/JSystem/JUtility/JUTXfb.cpp b/src/JSystem/JUtility/JUTXfb.cpp index 29bdd55c0..60b508450 100644 --- a/src/JSystem/JUtility/JUTXfb.cpp +++ b/src/JSystem/JUtility/JUTXfb.cpp @@ -63,7 +63,7 @@ void JUTXfb::delXfb(int xfbIdx) { /* 802C837C-802C8410 .text createManager__6JUTXfbFPC16_GXRenderModeObjP7JKRHeapQ26JUTXfb10EXfbNumber */ JUTXfb* JUTXfb::createManager(const GXRenderModeObj* pObj, JKRHeap* pHeap, JUTXfb::EXfbNumber xfbNum) { - JUT_CONFIRM(VERSION_SELECT(198, 198, 203, 203), sManager == 0); + JUT_CONFIRM(VERSION_SELECT(198, 198, 203, 203), sManager == NULL); if (sManager == NULL) { sManager = new JUTXfb(pObj, pHeap, xfbNum); } @@ -72,6 +72,12 @@ JUTXfb* JUTXfb::createManager(const GXRenderModeObj* pObj, JKRHeap* pHeap, JUTXf /* 802C8410-802C8468 .text destroyManager__6JUTXfbFv */ void JUTXfb::destroyManager() { + /* Nondeterministically nonmatching */ + // MWCC randomly picks between two different possible codegen patterns for converting sManager + // to a bool for this JUT_CONFIRM call. It usually picks the longer pattern, which is required + // to match on all 3 retail versions. But it sometimes picks the shorter pattern, which is + // required to match on the demo version. There seems to be no consistent way to get it to pick + // one or the other. JUT_CONFIRM(VERSION_SELECT(339, 339, 344, 344), sManager); delete sManager; sManager = NULL; diff --git a/src/SSystem/SComponent/c_xyz.cpp b/src/SSystem/SComponent/c_xyz.cpp index ffc851a72..2724b33b3 100644 --- a/src/SSystem/SComponent/c_xyz.cpp +++ b/src/SSystem/SComponent/c_xyz.cpp @@ -67,7 +67,7 @@ cXyz cXyz::outprod(const Vec& vec) const { /* 80245874-80245918 .text norm__4cXyzCFv */ cXyz cXyz::norm(void) const { Vec ret; - JUT_CONFIRM(233, isNearZeroSquare() == 0); + JUT_CONFIRM(233, isNearZeroSquare() == FALSE); VECNormalize(this, &ret); return cXyz(ret); } diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 059adc4d0..2e454da69 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -298,9 +298,7 @@ void daArrow_c::arrowShooting() { mAtCps.CalcAtVec(); dComIfG_Ccsp()->Set(&mAtCps); - // Using the dComIfG_Ccsp inline here breaks the match. - // dComIfG_Ccsp()->SetMass(&mCps, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mAtCps, 1); + dComIfG_Ccsp_SetMass(&mAtCps, 1); clrAtHitNormal(); setAtHitPosBuff(&end); @@ -874,9 +872,7 @@ BOOL daArrow_c::procMove() { mAtCps.CalcAtVec(); dComIfG_Ccsp()->Set(&mAtCps); - // Using the dComIfG_Ccsp inline here breaks the match. - // dComIfG_Ccsp()->SetMass(&mCps, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mAtCps, 1); + dComIfG_Ccsp_SetMass(&mAtCps, 1); } return TRUE; diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index cce6709e0..3c6986c98 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -362,7 +362,10 @@ static void search_check_draw(bk_class* i_this) { return; } cXyz sp14[0x10]; - cXyz sp08(0.0f, 0.0f, l_bkHIO.m028); + cXyz sp08; + sp08.x = 0.0f; + sp08.y = 0.0f; + sp08.z = l_bkHIO.m028; int i; s16 r26 = 0; for (i = 0; i < 0x10; i++, r26 += 0x1000) { @@ -493,10 +496,9 @@ static void daBk_shadowDraw(bk_class* i_this) { i_this->current.pos.y + 150.0f + REG8_F(18), i_this->current.pos.z ); - f32 temp = 800.0f + REG8_F(19); - f32 shadowSize = 40.0f + REG8_F(17); i_this->mShadowId = dComIfGd_setShadow( - i_this->mShadowId, 1, model, &shadowPos, temp, shadowSize, + i_this->mShadowId, 1, model, &shadowPos, + 800.0f + REG8_F(19), 40.0f + REG8_F(17), i_this->current.pos.y, i_this->dr.mAcch.GetGroundH(), i_this->dr.mAcch.m_gnd, &i_this->tevStr ); @@ -2132,9 +2134,7 @@ static fopAc_ac_c* yari_hit_check(bk_class* i_this) { i_this->m1040.MoveCAt(i_this->m11A8); dComIfG_Ccsp()->Set(&i_this->m1040); if (i_this->m02D5 != 0) { - // Using the dComIfG_Ccsp inline here breaks the match. - // dComIfG_Ccsp()->SetMass(&i_this->m1040, 3); - dComIfG_Ccsp()->mMass_Mng.Set(&i_this->m1040, 3); + dComIfG_Ccsp_SetMass(&i_this->m1040, 3); } if (i_this->m1040.ChkAtHit()) { i_this->m0B78 = 5; @@ -3332,9 +3332,7 @@ static void Bk_move(bk_class* i_this) { i_this->m1040.OffAtVsPlayerBit(); i_this->m1040.SetAtSpl(dCcG_At_Spl_UNK1); dComIfG_Ccsp()->Set(&i_this->m1040); - // Using the dComIfG_Ccsp inline here breaks the match. - // dComIfG_Ccsp()->SetMass(&i_this->m1040, 3); - dComIfG_Ccsp()->mMass_Mng.Set(&i_this->m1040, 3); + dComIfG_Ccsp_SetMass(&i_this->m1040, 3); if (i_this->m1040.ChkAtHit() && actor->speed.y < -50.0f) { actor->speed.y = 0.0f; @@ -4420,9 +4418,7 @@ static BOOL daBk_Execute(bk_class* i_this) { MtxPosition(&sp58, &sp4C); i_this->m0B88.SetC(sp4C); dComIfG_Ccsp()->Set(&i_this->m0B88); - // Using the inline breaks the match. - // dComIfG_Ccsp()->SetMass(&i_this->m0B88, 3); - dComIfG_Ccsp()->mMass_Mng.Set(&i_this->m0B88, 3); + dComIfG_Ccsp_SetMass(&i_this->m0B88, 3); cXyz sp40 = i_this->m116C; cXyz sp34 = i_this->current.pos; diff --git a/src/d/actor/d_a_bomb2.cpp b/src/d/actor/d_a_bomb2.cpp index 212ca1e58..9e49ca1b2 100644 --- a/src/d/actor/d_a_bomb2.cpp +++ b/src/d/actor/d_a_bomb2.cpp @@ -477,9 +477,7 @@ namespace daBomb2 { mSph.SetR(radius); mSph.SetC(pos); dComIfG_Ccsp()->Set(&mSph); - //using inline breaks match - //dComIfG_Ccsp()->SetMass(&mSph, 3); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mSph, 3); + dComIfG_Ccsp_SetMass(&mSph, 3); } } diff --git a/src/d/actor/d_a_bomb3.inc b/src/d/actor/d_a_bomb3.inc index 506a1e977..05f2b0184 100644 --- a/src/d/actor/d_a_bomb3.inc +++ b/src/d/actor/d_a_bomb3.inc @@ -672,9 +672,7 @@ void daBomb_c::makeWaterEffect() { mSph.SetC(current.pos); if(mMassCounter != g_Counter.mCounter0) { dComIfG_Ccsp()->Set(&mSph); - //using inline breaks match - //dComIfG_Ccsp()->SetMass(&mSph, 3); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mSph, 3); + dComIfG_Ccsp_SetMass(&mSph, 3); mMassCounter = g_Counter.mCounter0; field_0x782 = 1; } @@ -834,9 +832,7 @@ BOOL daBomb_c::procExplode_init() { mSph.SetC(current.pos); if(mMassCounter != g_Counter.mCounter0) { dComIfG_Ccsp()->Set(&mSph); - //using inline breaks match - //dComIfG_Ccsp()->SetMass(&mSph, 3); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mSph, 3); + dComIfG_Ccsp_SetMass(&mSph, 3); field_0x782 = 1; mMassCounter = g_Counter.mCounter0; } @@ -899,9 +895,7 @@ bool daBomb_c::procExplode() { mSph.SetC(current.pos); if(mMassCounter != g_Counter.mCounter0) { dComIfG_Ccsp()->Set(&mSph); - //using inline breaks match - //dComIfG_Ccsp()->SetMass(&mSph, 3); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mSph, 3); + dComIfG_Ccsp_SetMass(&mSph, 3); mMassCounter = g_Counter.mCounter0; field_0x782 = 1; } @@ -1088,9 +1082,7 @@ BOOL daBomb_c::execute() { mSph.SetR(scale.x * 30.0f); if(mMassCounter != g_Counter.mCounter0) { dComIfG_Ccsp()->Set(&mSph); - //using inline breaks match - //dComIfG_Ccsp()->SetMass(&mSph, 3); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mSph, 3); + dComIfG_Ccsp_SetMass(&mSph, 3); mMassCounter = g_Counter.mCounter0; } } diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index 80e9e13ea..8cd6fba9b 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -42,10 +42,11 @@ void daBranch_c::set_mtx() { /* 00000128-000001E4 .text set_anim__10daBranch_cFiii */ void daBranch_c::set_anim(int i_animIdx, int i_bckIdx, int i_basIdx) { if (i_bckIdx > 0 && i_basIdx > 0) { - void* pSnd = dComIfG_getObjectIDRes(m_arcname, i_basIdx); - J3DAnmTransform* pAnm = static_cast(dComIfG_getObjectIDRes(m_arcname, i_bckIdx)); - - mAnims[i_animIdx]->setAnm(pAnm, -1, 0.0f, 1.0f, 0.0f, -1.0f, pSnd); + mAnims[i_animIdx]->setAnm( + static_cast(dComIfG_getObjectIDRes(m_arcname, i_bckIdx)), + -1, 0.0f, 1.0f, 0.0f, -1.0f, + dComIfG_getObjectIDRes(m_arcname, i_basIdx) + ); } } @@ -74,12 +75,14 @@ BOOL daBranch_c::CreateHeap() { BOOL status = TRUE; for (int i = 0; i < (s32)ARRAY_SIZE(mAnims); i++) { +#if VERSION > VERSION_DEMO J3DModelData* modelData = static_cast(dComIfG_getObjectIDRes(m_arcname, bmd[i])); J3DAnmTransformKey* bckData = static_cast(dComIfG_getObjectIDRes(m_arcname, bck[i])); JUT_ASSERT(0x1CC, modelData != NULL); // Bug: They probably meant to assert that bckData isn't null, but accidentally used the array of bck file IDs. JUT_ASSERT(0x1CD, bck != NULL); +#endif mAnims[i] = new mDoExt_McaMorf( static_cast(dComIfG_getObjectIDRes(m_arcname, bmd[i])), @@ -89,10 +92,17 @@ BOOL daBranch_c::CreateHeap() { 0, 0x11020203 ); +#if VERSION == VERSION_DEMO + set_anim(i, bck[i], bas[i]); + mAnims[i]->setFrame(0.0f); +#endif + +#if VERSION > VERSION_DEMO if (!mAnims[i]) { status = FALSE; break; } +#endif mModel[i] = mAnims[i]->getModel(); if (!mModel[i]) { @@ -100,8 +110,10 @@ BOOL daBranch_c::CreateHeap() { break; } +#if VERSION > VERSION_DEMO mAnims[i]->setFrame(0.0f); set_anim(i, bck[i], bas[i]); +#endif } return status; @@ -178,10 +190,16 @@ static BOOL daBranch_Delete(daBranch_c* i_this) { } inline cPhs_State daBranch_c::create() { +#if VERSION == VERSION_DEMO + cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname); + if (phase_state == cPhs_COMPLEATE_e) { + fopAcM_SetupActor(this, daBranch_c); +#else fopAcM_SetupActor(this, daBranch_c); cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname); if (phase_state == cPhs_COMPLEATE_e) { +#endif if (!fopAcM_entrySolidHeap(this, daBranch_c::solidHeapCB, 0x4000)) { for (int i = 0; i < (s32)ARRAY_SIZE(mAnims); i++) { mAnims[i] = NULL; @@ -241,7 +259,11 @@ actor_process_profile_definition g_profile_BRANCH = { /* Leaf SubMtd */ &g_fopAc_Method.base, /* Priority */ PRIO_BRANCH, /* Actor SubMtd */ &l_daBranch_Method, +#if VERSION == VERSION_DEMO + /* Status */ fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, +#else /* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, +#endif /* Group */ fopAc_ACTOR_e, /* CullType */ fopAc_CULLBOX_CUSTOM_e, }; diff --git a/src/d/actor/d_a_hookshot.cpp b/src/d/actor/d_a_hookshot.cpp index 74ba55f30..a811da7fa 100644 --- a/src/d/actor/d_a_hookshot.cpp +++ b/src/d/actor/d_a_hookshot.cpp @@ -186,9 +186,7 @@ BOOL daHookshot_c::procWait() { mSightCps.SetR(5.0f); mSightCps.CalcAtVec(); dComIfG_Ccsp()->Set(&mSightCps); - // Using the inline breaks the match. - // dComIfG_Ccsp()->SetMass(&mSightCps, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mSightCps, 1); + dComIfG_Ccsp_SetMass(&mSightCps, 1); m2A3 = false; mCurrProcFunc = &daHookshot_c::procShot; @@ -298,9 +296,7 @@ BOOL daHookshot_c::procShot() { mSightCps.SetR(5.0f); mSightCps.CalcAtVec(); dComIfG_Ccsp()->Set(&mSightCps); - // Using the inline breaks the match. - // dComIfG_Ccsp()->SetMass(&mSightCps, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mSightCps, 1); + dComIfG_Ccsp_SetMass(&mSightCps, 1); current.pos = sp8C; } diff --git a/src/d/actor/d_a_hys.cpp b/src/d/actor/d_a_hys.cpp index 09cbba183..eabe096a6 100644 --- a/src/d/actor/d_a_hys.cpp +++ b/src/d/actor/d_a_hys.cpp @@ -71,7 +71,7 @@ BOOL daHys_c::CreateHeap() { J3DAnmTexPattern* pbtp = (J3DAnmTexPattern *)dComIfG_getObjectRes(m_arcname[mType], m_btpidx[mType]); JUT_ASSERT(0x114, pbtp != NULL); - if (!mBtpAnm.init(modelData, pbtp, 0, 0, 1.0, 0, -1, FALSE, FALSE)) { + if (!mBtpAnm.init(modelData, pbtp, FALSE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, FALSE, FALSE)) { return FALSE; } field_0x458 = 0; diff --git a/src/d/actor/d_a_msw.cpp b/src/d/actor/d_a_msw.cpp index 87403ccf9..b9f4306fc 100644 --- a/src/d/actor/d_a_msw.cpp +++ b/src/d/actor/d_a_msw.cpp @@ -11,7 +11,6 @@ #include "m_Do/m_Do_ext.h" #include "d/d_com_inf_game.h" #include "d/d_s_play.h" -#include "d/actor/d_a_player.h" /* 00000078-000002D4 .text ride_call_back__FP4dBgWP10fopAc_ac_cP10fopAc_ac_c */ void ride_call_back(dBgW* bgw, fopAc_ac_c* i_ac, fopAc_ac_c* i_pt) { @@ -107,12 +106,14 @@ static BOOL daMsw_Draw(msw_class* i_this) { void msw_move(msw_class* i_this) { i_this->m298 += 1; +#if VERSION > VERSION_DEMO // Branchless comparison // Probably something #ifdef'd out for debug switch (i_this->m29A) { case 0: break; } +#endif cLib_addCalcAngleS2(&i_this->current.angle.x, 0, 10, 0x200); cLib_addCalcAngleS2(&i_this->current.angle.z, 0, 10, 0x200); @@ -135,23 +136,23 @@ void msw_move(msw_class* i_this) { /* 0000080C-00000AD4 .text daMsw_Execute__FP9msw_class */ static BOOL daMsw_Execute(msw_class* i_this) { - /* Nonmatching */ - static f32 xd[4] = { 1.0f, 1.0f, -1.0f, -1.0f }; - static f32 zd[4] = { 1.0f, -1.0f, 1.0f, -1.0f }; + /* Nonmatching - retail-only regalloc */ + fopAc_ac_c* actor = i_this; + fopAc_ac_c* player = dComIfGp_getPlayer(0); - daPy_py_c* pPlayer = static_cast(dComIfGp_getPlayer(0)); msw_move(i_this); - MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, false); - cMtx_YrotM(*calc_mtx, i_this->shape_angle.y); - cMtx_XrotM(*calc_mtx, i_this->shape_angle.x); - cMtx_ZrotM(*calc_mtx, i_this->shape_angle.z); - MtxScale(i_this->scale.x, 1.0f, i_this->scale.z, true); - + MtxTrans(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z, false); + cMtx_YrotM(*calc_mtx, actor->shape_angle.y); + cMtx_XrotM(*calc_mtx, actor->shape_angle.x); + cMtx_ZrotM(*calc_mtx, actor->shape_angle.z); + MtxScale(actor->scale.x, 1.0f, actor->scale.z, true); i_this->mpModel->setBaseTRMtx(*calc_mtx); MtxPush(); for (int chainIdx = 0; chainIdx < 4; chainIdx++) { + static f32 xd[4] = { 1.0f, 1.0f, -1.0f, -1.0f }; + static f32 zd[4] = { 1.0f, -1.0f, 1.0f, -1.0f }; cXyz src; src.x = (200.0f + REG0_F(10)) * xd[chainIdx]; src.y = 0.0f; @@ -159,26 +160,23 @@ static BOOL daMsw_Execute(msw_class* i_this) { MtxPosition(&src, &i_this->m2E0[chainIdx]); if (i_this->m844 != 0) { - i_this->m844 -= 1; + i_this->m844--; i_this->m310[chainIdx] = i_this->m2E0[chainIdx]; i_this->m310[chainIdx].y = i_this->m2E0[chainIdx].y + 1000.0f; } if (i_this->m83C[chainIdx] != 0) { - i_this->m83C[chainIdx] -= 1; + i_this->m83C[chainIdx]--; } if (i_this->mChainCyls[chainIdx].ChkTgHit() && i_this->m83C[chainIdx] < 10) { - i_this->m83C[chainIdx] = REG6_S(3) + 0xF; + i_this->m83C[chainIdx] = REG6_S(3) + 15; - mDoAud_seStart(JA_SE_LK_HIT_SBRIDGE_CHAIN, &i_this->m2E0[chainIdx], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + mDoAud_seStart(JA_SE_LK_HIT_SBRIDGE_CHAIN, &i_this->m2E0[chainIdx], 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); cXyz scale; - scale.z = 2.0f; - scale.y = 2.0f; - scale.x = 2.0f; - - dComIfGp_particle_set(dPa_name::ID_COMMON_PURPLE_HIT, i_this->mChainCyls[chainIdx].GetTgHitPosP(), &pPlayer->shape_angle, &scale); + scale.x = scale.y = scale.z = 2.0f; + dComIfGp_particle_set(dPa_name::ID_COMMON_PURPLE_HIT, i_this->mChainCyls[chainIdx].GetTgHitPosP(), &player->shape_angle, &scale); } i_this->mChainCyls[chainIdx].SetC(i_this->m2E0[chainIdx]); @@ -203,7 +201,7 @@ static BOOL daMsw_IsDelete(msw_class* i_this) { /* 00000B38-00000B88 .text daMsw_Delete__FP9msw_class */ static BOOL daMsw_Delete(msw_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "Msw"); + dComIfG_resDeleteDemo(&i_this->mPhs, "Msw"); dComIfG_Bgsp()->Release(i_this->mpBgW); return TRUE; @@ -221,7 +219,7 @@ BOOL daMsw_CreateInit(fopAc_ac_c* i_this) { } modelData = static_cast(dComIfG_getObjectRes("Msw", MSW_BDL_OBM_CHAIN1)); - JUT_ASSERT(0x20B, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(519, 523, 523, 523), modelData != NULL); for (int chainIdx = 0; chainIdx < 4; chainIdx++) { pActor->mpChainModels[chainIdx] = mDoExt_J3DModel__create(modelData, 0, 0x11020203); @@ -282,62 +280,62 @@ static cPhs_State daMsw_Create(fopAc_ac_c* i_this) { }; fopAcM_SetupActor(i_this, msw_class); - msw_class* pActor = static_cast(i_this); + msw_class* a_this = static_cast(i_this); - cPhs_State phase_state = dComIfG_resLoad(&pActor->mPhs, "Msw"); + cPhs_State phase_state = dComIfG_resLoad(&a_this->mPhs, "Msw"); if (phase_state == cPhs_COMPLEATE_e) { - pActor->m2A0 = (fopAcM_GetParam(pActor) >> 0) & 0xFF; + a_this->m2A0 = (fopAcM_GetParam(a_this) >> 0) & 0xFF; - if (pActor->m2A0 == 0xFF) { - pActor->m2A0 = 0; + if (a_this->m2A0 == 0xFF) { + a_this->m2A0 = 0; } - if (!fopAcM_entrySolidHeap(pActor, daMsw_CreateInit, 0x10040)) { + if (!fopAcM_entrySolidHeap(a_this, daMsw_CreateInit, 0x10040)) { return cPhs_ERROR_e; } - if (pActor->mpModel == NULL) { + if (a_this->mpModel == NULL) { return cPhs_ERROR_e; } - if (dComIfG_Bgsp()->Regist(pActor->mpBgW, pActor)) { + if (dComIfG_Bgsp()->Regist(a_this->mpBgW, a_this)) { return cPhs_ERROR_e; } - switch (pActor->m2A0) { + switch (a_this->m2A0) { case 1: - pActor->scale.x = 1.5f; - pActor->scale.z = 1.5f; + a_this->scale.x = 1.5f; + a_this->scale.z = 1.5f; break; case 2: - pActor->scale.x = 2.0f; - pActor->scale.z = 2.0f; + a_this->scale.x = 2.0f; + a_this->scale.z = 2.0f; break; case 3: - pActor->scale.x = 3.0f; - pActor->scale.z = 3.0f; + a_this->scale.x = 3.0f; + a_this->scale.z = 3.0f; break; default: - pActor->scale.z = 1.0f; - pActor->scale.x = 1.0f; + a_this->scale.z = 1.0f; + a_this->scale.x = 1.0f; break; } - pActor->scale.y = 1.0f; - fopAcM_SetMtx(pActor, pActor->mpModel->getBaseTRMtx()); - fopAcM_SetMin(pActor, pActor->scale.x * -200.0f, -5000.0f, pActor->scale.z * -200.0f); - fopAcM_SetMax(pActor, pActor->scale.x * 200.0f, 5000.0f, pActor->scale.z * 200.0f); + a_this->scale.y = 1.0f; + fopAcM_SetMtx(a_this, a_this->mpModel->getBaseTRMtx()); + fopAcM_SetMin(a_this, a_this->scale.x * -200.0f, -5000.0f, a_this->scale.z * -200.0f); + fopAcM_SetMax(a_this, a_this->scale.x * 200.0f, 5000.0f, a_this->scale.z * 200.0f); - pActor->mStts.Init(0xFF, 0xFF, pActor); + a_this->mStts.Init(0xFF, 0xFF, a_this); for (int chainIdx = 0; chainIdx < 4; chainIdx++) { - pActor->mChainCyls[chainIdx].Set(himo_cyl_src); - pActor->mChainCyls[chainIdx].SetStts(&pActor->mStts); + a_this->mChainCyls[chainIdx].Set(himo_cyl_src); + a_this->mChainCyls[chainIdx].SetStts(&a_this->mStts); } - pActor->m844 = 10; - daMsw_Execute(pActor); + a_this->m844 = 10; + daMsw_Execute(a_this); } return phase_state; diff --git a/src/d/actor/d_a_npc_bs1.cpp b/src/d/actor/d_a_npc_bs1.cpp index 11e79cef7..bbb978775 100644 --- a/src/d/actor/d_a_npc_bs1.cpp +++ b/src/d/actor/d_a_npc_bs1.cpp @@ -191,7 +191,7 @@ BOOL daNpc_Bs1_c::initTexPatternAnm(bool i_modify) { J3DModelData* modelData = mpMorf->getModel()->getModelData(); m_head_tex_pattern = (J3DAnmTexPattern*)dComIfG_getObjectRes("Bs", l_btp_ix_tbl[m828]); JUT_ASSERT(0x1bd, m_head_tex_pattern != NULL); - if (!mBtpAnm.init(modelData, m_head_tex_pattern, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, i_modify, 0)) { + if (!mBtpAnm.init(modelData, m_head_tex_pattern, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, i_modify, FALSE)) { return FALSE; } mFrame = 0; @@ -936,8 +936,7 @@ u16 daNpc_Bs1_c::next_msgStatus(u32* pMsgNo) { break; case 0xF4C: case 0xF4E: { - int points = dComIfGs_getEventReg(0x86FF); - points += 1; + int points = dComIfGs_getEventReg(0x86FF) + 1; points = cLib_maxLimit(points, 0xFF); dComIfGs_setEventReg(0x86FF, points); diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index cc06b0c8f..a214247d5 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -135,7 +135,7 @@ BOOL daNpc_Btsw2_c::initTexPatternAnm(bool i_modify) { J3DModelData* modelData = mpMorf->getModel()->getModelData(); m_btp = static_cast(dComIfG_getObjectRes(m_arc_name, l_btp_ix_tbl[m744])); JUT_ASSERT(282, m_btp != NULL); - if (!mBtpAnm.init(modelData, m_btp, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, i_modify, 0)) { + if (!mBtpAnm.init(modelData, m_btp, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, i_modify, FALSE)) { return FALSE; } mBtpFrame = 0; diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index b8adc0ddc..fc6446abb 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -2411,7 +2411,7 @@ BOOL daNpc_Md_c::initTexPatternAnm(u8 btpAnmTblIdx, bool param_2) { bool ret = false; J3DAnmTexPattern* eyeTexPtrn = (J3DAnmTexPattern*)dComIfG_getObjectRes(mModelArcName, btpAnmTbl[btpAnmTblIdx].m00); JUT_ASSERT(7502, eyeTexPtrn != NULL); - if (m0520.init(modelData, eyeTexPtrn, TRUE, J3DFrameCtrl::EMode_RESET, 1.0f, 0, -1, param_2, 0)) { + if (m0520.init(modelData, eyeTexPtrn, TRUE, J3DFrameCtrl::EMode_RESET, 1.0f, 0, -1, param_2, FALSE)) { m3112 = eyeTexPtrn->getFrameMax(); m3133 = 0; m3136 = btpAnmTbl[btpAnmTblIdx].m20; diff --git a/src/d/actor/d_a_npc_people.cpp b/src/d/actor/d_a_npc_people.cpp index 34194fb2d..251ec3f94 100644 --- a/src/d/actor/d_a_npc_people.cpp +++ b/src/d/actor/d_a_npc_people.cpp @@ -3829,7 +3829,11 @@ static u32 l_msg_ug2_out_area[] = { }; static int l_get_item_no[] = { +#if VERSION == VERSION_DEMO + dItem_ORANGE_RUPEE_e, +#else dItem_HEART_PIECE_e, +#endif dItem_COLLECT_MAP_20_e, dItem_COLLECT_MAP_16_e, dItem_HEART_PIECE_e, @@ -3877,7 +3881,11 @@ static PsoData l_pso_ub4 = { 0.0f, 100.0f, 0.0f, +#if VERSION == VERSION_DEMO + 30.0f, +#else 50.0f, +#endif 85.0f, 0x0000, 0xFF, @@ -4581,7 +4589,7 @@ bool daNpcPeople_c::_delete() { /* 0000158C-000018B8 .text _draw__13daNpcPeople_cFv */ bool daNpcPeople_c::_draw() { - /* Nonmatching - regalloc */ + /* Nonmatching - retail-only regalloc */ J3DModel* pModel1 = mpMorf->getModel(); J3DModel* pModel2; @@ -6655,8 +6663,6 @@ u16 daNpcPeople_c::next_msgStatus(u32* pMsgNo) { /* 00005FB8-000073B8 .text getMsg__13daNpcPeople_cFv */ u32 daNpcPeople_c::getMsg() { - /* Nonmatching - extra clrlwi, regalloc */ - u32 msgNo = 0; m734 = NULL; @@ -6681,7 +6687,9 @@ u32 daNpcPeople_c::getMsg() { } else if(!dComIfGs_checkGetItem(dItem_COLLECT_MAP_16_e)) { m734 = l_msg_xy_ub4_get_item; +#if VERSION > VERSION_DEMO dComIfGs_onEventBit(0x2504); +#endif } else { m734 = l_msg_xy_ub4_talk; @@ -6726,9 +6734,11 @@ u32 daNpcPeople_c::getMsg() { } break; +#if VERSION > VERSION_DEMO case 0x10: m734 = l_msg_xy_sa5_no_skull_necklace; break; +#endif } } else if(dComIfGp_event_chkTalkXY()) { @@ -6974,6 +6984,18 @@ u32 daNpcPeople_c::getMsg() { else if(dComIfGs_getEventReg(0xC407) < 7) { m734 = l_msg_um2_no_1day_photo3; } +#if VERSION == VERSION_DEMO + else if(!dComIfGs_isEventBit(0x2240)) { + m734 = l_msg_um2_no_request; + } + else if(!dComIfGs_isEventBit(0x2220)) { + m734 = l_msg_um2_cafe_off; + } + else { + m734 = l_msg_um2_cafe_on; + dComIfGs_setEventReg(0xB907, 1); + } +#else else if(dComIfGs_isEventBit(0x2220)) { m734 = l_msg_um2_cafe_on; dComIfGs_setEventReg(0xB907, 1); @@ -6984,6 +7006,7 @@ u32 daNpcPeople_c::getMsg() { else { m734 = l_msg_um2_cafe_off; } +#endif } else if(dComIfGs_getEventReg(0xB907) < 4) { if(!dComIfGs_isEventBit(0x2204)) { @@ -7153,7 +7176,8 @@ u32 daNpcPeople_c::getMsg() { break; } - dComIfGs_setTmpReg(0xFE03, reg - 1); + reg -= 1; + dComIfGs_setTmpReg(0xFE03, reg); } } else if(!dComIfGs_isEventBit(0x2440)) { @@ -7701,7 +7725,7 @@ BOOL daNpcPeople_c::initTexPatternAnm(bool param_1) { m_head_tex_pattern = (J3DAnmTexPattern*)dComIfG_getObjectIDRes(l_arcname_tbl[mNpcType], l_btp_ix_tbl[mNpcType]); JUT_ASSERT(0x231D, m_head_tex_pattern != NULL); - if(!mBtpAnm.init(modelData, m_head_tex_pattern, 1, 2, 1.0f, 0, -1, param_1, 0)) { + if(!mBtpAnm.init(modelData, m_head_tex_pattern, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, param_1, FALSE)) { return false; } } diff --git a/src/d/actor/d_a_npc_photo.cpp b/src/d/actor/d_a_npc_photo.cpp index 61a01bd19..a60295d4b 100644 --- a/src/d/actor/d_a_npc_photo.cpp +++ b/src/d/actor/d_a_npc_photo.cpp @@ -2058,7 +2058,7 @@ BOOL daNpcPhoto_c::initTexPatternAnm(bool i_modify, int i_param2) { m_head_tex_pattern = (J3DAnmTexPattern*)dComIfG_getObjectIDRes(l_arcname_tbl[0], l_btp_ix_tbl[i_param2]); JUT_ASSERT(0xBAA, m_head_tex_pattern != NULL); - if(!mBtpAnm.init(modelData, m_head_tex_pattern, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, i_modify, 0)) { + if(!mBtpAnm.init(modelData, m_head_tex_pattern, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, i_modify, FALSE)) { return FALSE; } mFrame = 0; diff --git a/src/d/actor/d_a_npc_roten.cpp b/src/d/actor/d_a_npc_roten.cpp index 3cc134801..d0d3fecd6 100644 --- a/src/d/actor/d_a_npc_roten.cpp +++ b/src/d/actor/d_a_npc_roten.cpp @@ -2716,7 +2716,7 @@ BOOL daNpcRoten_c::initTexPatternAnm(bool modify) { m_head_tex_pattern = static_cast(dComIfG_getObjectIDRes(l_arcname_tbl[mNpcNo], l_btp_ix_tbl[mNpcNo])); JUT_ASSERT(0xBFF, m_head_tex_pattern != NULL); - if(!mBtpAnm.init(modelData, m_head_tex_pattern, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, modify, 0)) { + if(!mBtpAnm.init(modelData, m_head_tex_pattern, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, modify, FALSE)) { return false; } diff --git a/src/d/actor/d_a_obj_figure.cpp b/src/d/actor/d_a_obj_figure.cpp index edde0143b..c9eefb35d 100644 --- a/src/d/actor/d_a_obj_figure.cpp +++ b/src/d/actor/d_a_obj_figure.cpp @@ -487,7 +487,7 @@ BOOL daObjFigure_c::createHeap() { return false; } - if(!mBtpAnm1.init(pPedestalData, mpPedestalBtp, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, 0)) { + if(!mBtpAnm1.init(pPedestalData, mpPedestalBtp, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, FALSE)) { return false; } diff --git a/src/d/actor/d_a_obj_mknjd.cpp b/src/d/actor/d_a_obj_mknjd.cpp index d2153fe5c..d6b992510 100644 --- a/src/d/actor/d_a_obj_mknjd.cpp +++ b/src/d/actor/d_a_obj_mknjd.cpp @@ -4,7 +4,7 @@ */ #include "d/actor/d_a_obj_mknjd.h" -#include "d/d_s_play.h" +#include "d/d_s_play.h" // IWYU pragma: keep #include "d/res/res_mknjd.h" #include "f_op/f_op_actor_mng.h" #include "f_pc/f_pc_manager.h" diff --git a/src/d/actor/d_a_obj_pbco.cpp b/src/d/actor/d_a_obj_pbco.cpp index 1ee10d8b1..706ae75a2 100644 --- a/src/d/actor/d_a_obj_pbco.cpp +++ b/src/d/actor/d_a_obj_pbco.cpp @@ -86,7 +86,7 @@ bool daObj_Pbco_c::_delete() { if (mpBgW != NULL) { dComIfG_Bgsp()->Release(mpBgW); } - dComIfG_resDelete(&mPhs, M_arcname); + dComIfG_resDeleteDemo(&mPhs, M_arcname); return TRUE; } diff --git a/src/d/actor/d_a_obj_swpush.cpp b/src/d/actor/d_a_obj_swpush.cpp index 823d90e8e..9d46eb436 100644 --- a/src/d/actor/d_a_obj_swpush.cpp +++ b/src/d/actor/d_a_obj_swpush.cpp @@ -168,7 +168,7 @@ bool daObjSwpush::Act_c::create_heap() { if (attr().mBtpArcName != NULL) { J3DAnmTexPattern* btp_data = (J3DAnmTexPattern*) dComIfG_getObjectRes(attr().mBtpArcName, attr().mBtpResIndex); JUT_ASSERT(0x21E, btp_data != NULL); - btp_success = mBtpAnm.init(model_data, btp_data, 1, 0, 1.0f, 0, -1, false, 0); + btp_success = mBtpAnm.init(model_data, btp_data, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false, FALSE); } cBgD_t* bg_data = (cBgD_t*) dComIfG_getObjectRes(attr().mBgArcName, attr().mBgResIndex); diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index c69193bf6..5cc86e824 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -1332,7 +1332,7 @@ s32 daPy_lk_c::setItemModel() { dVar15 = mtx[1][3]; dVar17 = mtx[2][3]; u16 uVar10 = - cM_rad2s(((6.2831855f * (mFrameCtrlUnder[UNDER_MOVE0_e].getFrame() - 22.0f)) / + cM_rad2s((((2*M_PI) * (mFrameCtrlUnder[UNDER_MOVE0_e].getFrame() - 22.0f)) / mFrameCtrlUnder[UNDER_MOVE0_e].getEnd())); mDoMtx_stack_c::YrotS( (-5500.0f * std::abs(mVelocity / mMaxNormalSpeed) * cM_ssin(uVar10 & 0xFFFF))); @@ -9817,10 +9817,7 @@ void daPy_lk_c::setCollision() { mCyl.OnTgSetBit(); } dComIfG_Ccsp()->Set(&mCyl); - // Using the dComIfG_Ccsp inline here (and everywhere else - // in this function) breaks the match. - // dComIfG_Ccsp()->SetMass(&mCyl, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mCyl, 1); + dComIfG_Ccsp_SetMass(&mCyl, 1); mWindCyl.SetC(spD0); mWindCyl.SetH(mCyl.GetH()); mWindCyl.SetR(mCyl.GetR()); @@ -10074,14 +10071,12 @@ void daPy_lk_c::setCollision() { } } dComIfG_Ccsp()->Set(&mAtCyl); - // dComIfG_Ccsp()->SetMass(&mAtCyl, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mAtCyl, 1); + dComIfG_Ccsp_SetMass(&mAtCyl, 1); int i; dCcD_Cps* pdVar21 = &mAtCps[0]; for (i = 0; i < 3; i++, pdVar21++) { dComIfG_Ccsp()->Set(pdVar21); - // dComIfG_Ccsp()->SetMass(&pdVar21, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(pdVar21, 1); + dComIfG_Ccsp_SetMass(pdVar21, 1); } } else { if (mSwBlur.field_0x014 < 10) { @@ -10200,8 +10195,7 @@ void daPy_lk_c::setCollision() { mFanWindCps.SetAtVec(spC4); mFanWindCps.SetR(in_f31); dComIfG_Ccsp()->Set(&mFanWindCps); - // dComIfG_Ccsp()->SetMass(&mFanWindCps, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mFanWindCps, 1); + dComIfG_Ccsp_SetMass(&mFanWindCps, 1); } else { mFanWindCps.ResetAtHit(); } @@ -10217,8 +10211,7 @@ void daPy_lk_c::setCollision() { mFanWindSph.SetC(current.pos); } dComIfG_Ccsp()->Set(&mFanWindSph); - // dComIfG_Ccsp()->SetMass(&mFanWindSph, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mFanWindSph, 1); + dComIfG_Ccsp_SetMass(&mFanWindSph, 1); m353A--; } else { mFanWindSph.ResetAtHit(); @@ -10237,8 +10230,7 @@ void daPy_lk_c::setCollision() { mFanLightCps.SetAtVec(local_118); mFanLightCps.OnAtSetBit(); dComIfG_Ccsp()->Set(&mFanLightCps); - // dComIfG_Ccsp()->SetMass(&mFanLightCps, 1); - g_dComIfG_gameInfo.play.mCcS.SetMass(&mFanLightCps, 1); + dComIfG_Ccsp_SetMass(&mFanLightCps, 1); } else { mFanLightCps.ResetAtHit(); mFanLightCps.OffAtSetBit(); diff --git a/src/d/actor/d_a_ship.cpp b/src/d/actor/d_a_ship.cpp index 6ade5838f..138309697 100644 --- a/src/d/actor/d_a_ship.cpp +++ b/src/d/actor/d_a_ship.cpp @@ -7,6 +7,7 @@ #include "d/d_procname.h" #include "d/d_priority.h" #include "d/d_com_inf_game.h" +#include "d/d_s_play.h" // IWYU pragma: keep #include "m_Do/m_Do_mtx.h" #include "d/d_drawlist.h" #include "f_op/f_op_actor_mng.h" @@ -220,8 +221,8 @@ BOOL daShip_c::draw() { dComIfGd_setListP1(); if (m02A0 && m02A4) { - j3dSys.onFlag(0x4); - j3dSys.onFlag(0x8); + j3dSys.onFlag(J3DSysFlag_SkinPosCpu); + j3dSys.onFlag(J3DSysFlag_SkinNrmCpu); cXyz local_5c(current.pos.x, current.pos.y + m03D8 + 5.0f, current.pos.z); @@ -811,8 +812,8 @@ void daShip_c::setWaveAngle(short* param1, short* param2) { *param2 = cM_atan2s(-local_a8.y, local_a8.absXZ()); *param1 = cM_atan2s(-local_9c.y, local_9c.absXZ()); - short iVar3 = *param1 - m0370; - short iVar2 = *param2 - m0372; + s16 iVar2 = *param2 - m0372; + s16 iVar3 = *param1 - m0370; m0376 += (iVar2 * 0.045f); m0372 += m0376; @@ -892,7 +893,8 @@ void daShip_c::setYPos() { } } else { - fVar2 = std::abs(speedF) / 55.0f; + f32 f1 = 55.0f; + fVar2 = std::abs(speedF) / f1; if (fVar2 > 1.0f) { fVar2 = 1.0f; } @@ -1152,13 +1154,15 @@ void daShip_c::changeDemoEndProc() { void daShip_c::setCrashData(short param1) { float fVar1; float fVar2; - daPy_lk_c *link; s16 iVar5; if (!dComIfGp_event_runCheck()) { - link = daPy_getPlayerLinkActorClass(); - if (!link->checkNoDamageMode() && !link->checkNoControll()) { + if (!daPy_getPlayerLinkActorClass()->checkNoDamageMode() +#if VERSION > VERSION_DEMO + && !daPy_getPlayerLinkActorClass()->checkNoControll() +#endif + ) { if (!checkForceMove()) { - link->onShipDrop(param1); + daPy_getPlayerLinkActorClass()->onShipDrop(param1); procWait_init(); } } @@ -2641,6 +2645,9 @@ BOOL daShip_c::procStartModeWarp_init() { cXyz local_38(current.pos.x, m03F4 + 1500.0f, current.pos.z + 2000.0f); camera->mCamera.Set(current.pos, local_38); m037A = 0; +#if VERSION == VERSION_DEMO + mTactWarpID = fopAcM_create(PROC_TORNADO, 2, ¤t.pos, fopAcM_GetRoomNo(this)); +#endif fopAcM_seStartCurrent(this, 0x186D, 0); return TRUE; } @@ -2657,11 +2664,13 @@ BOOL daShip_c::procStartModeWarp() { shape_angle.y += m03A6; current.angle.y = shape_angle.y; if (pfVar2) { +#if VERSION > VERSION_DEMO if (!checkStateFlg(daSFLG_UNK8_e)) { onStateFlg(daSFLG_UNK8_e); pfVar2->current.pos.x = current.pos.x; pfVar2->current.pos.z = current.pos.z; } +#endif iVar5 = 0; for (int i = 0; i < 11; iVar5++, i++) { if (current.pos.y < pfVar2->getJointYPos(i)) break; @@ -2821,10 +2830,15 @@ BOOL daShip_c::procWhirlDown_init() { /* 00007A90-00007BEC .text procWhirlDown__8daShip_cFv */ BOOL daShip_c::procWhirlDown() { - shape_angle.y += (m0408 / 6.2831855f) * 65536.0f; + shape_angle.y += (m0408 / (2*M_PI)) * 65536.0f; if (mWhirlActor) { +#if VERSION == VERSION_DEMO + if (cLib_addCalcPosXZ(¤t.pos, mWhirlActor->current.pos, 1.0f, speedF, 10.0f) < 10.0f) +#else speedF = 40.0f; - if (cLib_addCalcPosXZ(¤t.pos, mWhirlActor->current.pos, 1.0f, 40.0f, 10.0f) < 10.0f) { + if (cLib_addCalcPosXZ(¤t.pos, mWhirlActor->current.pos, 1.0f, 40.0f, 10.0f) < 10.0f) +#endif + { speed.y -= 0.5f; if (speed.y < -10.0f) { speed.y = -10.0f; @@ -3030,7 +3044,7 @@ void daShip_c::setRoomInfo() { m03C4 = dComIfG_Bgsp()->GetGroundCode(mAcch.m_gnd); } else { - roomId = dStage_roomControl_c::mStayNo; + roomId = dComIfGp_roomControl_getStayNo(); m03C4 = 0; } tevStr.mRoomNo = roomId; @@ -3655,9 +3669,9 @@ BOOL daShip_c::execute() { } else { if (mWhirlActor) { - short sVar16; + s16 sVar16; sVar16 = shape_angle.y; - short sVar5; + s16 sVar5; if (m0352) { sVar5 = m040C * 10430.378f + 20480.0f; } @@ -3670,9 +3684,9 @@ BOOL daShip_c::execute() { } } } - short sVar16; + s16 sVar16; sVar16 = -m0384; - short sVar5; + s16 sVar5; sVar5 = sVar16 * 0.05f; if (sVar5 == 0) { if (sVar16 > 0) { @@ -3755,83 +3769,81 @@ BOOL daShip_c::execute() { m1044 = cXyz::Zero; } - else { - if (checkForceMove() && !dComIfGp_event_runCheck()) { - if (mTornadoActor) { - if (!dComIfGp_checkPlayerStatus0(0, daPyStts0_BOW_AIM_e) || !dComIfGp_checkCameraAttentionStatus(0, 0x20)) { - prev_speedF = 25.0f; - } - else { - prev_speedF = 5.0f; - } + else if (checkForceMove() && !dComIfGp_event_runCheck()) { + if (mTornadoActor) { + if (!dComIfGp_checkPlayerStatus0(0, daPyStts0_BOW_AIM_e) || !dComIfGp_checkCameraAttentionStatus(0, 0x20)) { + prev_speedF = 25.0f; } else { - // Bug? This room check assumes we're on the sea without checking? - if (dComIfGs_getBombNum() == 0 && fopAcM_GetRoomNo(this) == dIsleRoom_OutsetIsland_e) { - prev_speedF = 10.0f; - } - else { - prev_speedF = 0.6f; - } - } - - cLib_chaseF(&m0400, 0.0f, prev_speedF); - - m0408 = std::fabsf(speedF) / m0400; - - m040C += m0408; - - BOOL r23; // BUG: this var is never initialized to FALSE - if (mTornadoActor) { - current.pos.x = mTornadoActor->current.pos.x + (m0400 * cM_fsin(m040C)); - current.pos.z = mTornadoActor->current.pos.z + (m0400 * cM_fcos(m040C)); - r23 = TRUE; - } - else if (m0352) { - current.pos.x = mWhirlActor->current.pos.x + (m0400 * cM_fsin(m040C)); - current.pos.z = mWhirlActor->current.pos.z + (m0400 * cM_fcos(m040C)); - r23 = TRUE; - } - else { - prev_speedF = current.pos.y; - fopAcM_posMoveF(this, mStts.GetCCMoveP()); - current.pos.y = prev_speedF; - } - if (r23) { - cXyz sp114(current.pos - old.pos); - float dVar27; - dVar27 = sp114.absXZ(); - if (dVar27 > 1.0f) { - prev_speedF = speedF / dVar27; - current.pos.x = old.pos.x + sp114.x * prev_speedF; - current.pos.z = old.pos.z + sp114.z * prev_speedF; - } + prev_speedF = 5.0f; } } else { - speed.x = (speedF * cM_ssin(current.angle.y)) * cM_scos(m0370); - speed.y = -speedF * cM_ssin(m0370); - speed.z = (speedF * cM_scos(current.angle.y)) * cM_scos(m0370); - fopAcM_posMove(this, mStts.GetCCMoveP()); - if (dComIfGp_event_runCheck()) { - m1044 = cXyz::Zero; - + // Bug? This room check assumes we're on the sea without checking? + if (dComIfGs_getBombNum() == 0 && fopAcM_GetRoomNo(this) == dIsleRoom_OutsetIsland_e) { + prev_speedF = 10.0f; } else { - cXyz sp108; - int sp18; - if (mAcch.GetGroundH() != -G_CM3D_F_INF && dPath_GetPolyRoomPathVec(mAcch.m_gnd, &sp108, &sp18)) { - sp108.normalizeZP(); - sp108 *= sp18 >> 1; - cLib_addCalcPosXZ(&m1044, sp108, 0.5f, 5.0f, 1.0f); - } - else { - cLib_addCalcPosXZ(&m1044, cXyz::Zero, 0.05f, 0.1f, 0.02f); - - } - current.pos += m1044; + prev_speedF = 0.6f; } } + + cLib_chaseF(&m0400, 0.0f, prev_speedF); + + m0408 = std::fabsf(speedF) / m0400; + + m040C += m0408; + + BOOL r23; // BUG: this var is never initialized to FALSE + if (mTornadoActor) { + current.pos.x = mTornadoActor->current.pos.x + (m0400 * cM_fsin(m040C)); + current.pos.z = mTornadoActor->current.pos.z + (m0400 * cM_fcos(m040C)); + r23 = TRUE; + } + else if (m0352) { + current.pos.x = mWhirlActor->current.pos.x + (m0400 * cM_fsin(m040C)); + current.pos.z = mWhirlActor->current.pos.z + (m0400 * cM_fcos(m040C)); + r23 = TRUE; + } + else { + prev_speedF = current.pos.y; + fopAcM_posMoveF(this, mStts.GetCCMoveP()); + current.pos.y = prev_speedF; + } + if (r23) { + cXyz sp114(current.pos - old.pos); + f32 dVar27; + dVar27 = sp114.absXZ(); + if (dVar27 > 1.0f) { + prev_speedF = speedF / dVar27; + current.pos.x = old.pos.x + sp114.x * prev_speedF; + current.pos.z = old.pos.z + sp114.z * prev_speedF; + } + } + } + else { + speed.x = (speedF * cM_ssin(current.angle.y)) * cM_scos(m0370); + speed.y = -speedF * cM_ssin(m0370); + speed.z = (speedF * cM_scos(current.angle.y)) * cM_scos(m0370); + fopAcM_posMove(this, mStts.GetCCMoveP()); + if (dComIfGp_event_runCheck()) { + m1044 = cXyz::Zero; + + } + else { + cXyz sp108; + int sp18; + if (mAcch.GetGroundH() != -G_CM3D_F_INF && dPath_GetPolyRoomPathVec(mAcch.m_gnd, &sp108, &sp18)) { + sp108.normalizeZP(); + sp108 *= sp18 >> 1; + cLib_addCalcPosXZ(&m1044, sp108, 0.5f, 5.0f, 1.0f); + } + else { + cLib_addCalcPosXZ(&m1044, cXyz::Zero, 0.05f, 0.1f, 0.02f); + + } + current.pos += m1044; + } } } else { @@ -3876,7 +3888,7 @@ BOOL daShip_c::execute() { setYPos(); - float diff = m03F4 - current.pos.y; + f32 diff = m03F4 - current.pos.y; mTrack.mBaseY = m03F4; mTrack.mMinY = m03F8; @@ -4001,6 +4013,7 @@ BOOL daShip_c::execute() { cMtx_multVec(mModel1->getAnmMtx(10), &l_tiller_top_offset, &mTillerTopPos); + daGrid_c* grid; MtxP mMtx = mModel1->getAnmMtx(7); m0444.x = mMtx[0][3]; @@ -4008,7 +4021,7 @@ BOOL daShip_c::execute() { m0444.z = mMtx[2][3]; cXyz spD8; - daGrid_c* grid = mpGrid; + grid = mpGrid; if (grid) { static cXyz top_offset(0.0f, 0.0f, -365.0f); static cXyz XZ_top_offset(265.0f, 0.0f, 0.0f); @@ -4023,7 +4036,11 @@ BOOL daShip_c::execute() { grid->m2200 = 1.0f - (spD8.abs() / 265.0f); // No idea why this is generating an extra lwz instruction for loading mpGrid when the instructions above don't if (mTornadoActor) { +#if VERSION == VERSION_DEMO + mpGrid->force_calc_wind_rel_angle(REG4_S(5)); +#else mpGrid->force_calc_wind_rel_angle(0x3000); +#endif } } @@ -4041,7 +4058,7 @@ BOOL daShip_c::execute() { } if (!checkStateFlg(daSFLG_FLY_e)) { - float shipCruiseSpeed = std::fabsf(speedF) / 55.0f; + f32 shipCruiseSpeed = std::fabsf(speedF) / 55.0f; if (shipCruiseSpeed > 1.0f){ shipCruiseSpeed = 1.0f; } @@ -4063,33 +4080,42 @@ BOOL daShip_c::execute() { link = daPy_getPlayerLinkActorClass(); cXyz spCC; spCC = link->current.pos - current.pos; - float distXz = (spCC.x * cM_ssin(shape_angle.y) + spCC.z * cM_scos(shape_angle.y)); + f32 distXz = (spCC.x * cM_ssin(shape_angle.y) + spCC.z * cM_scos(shape_angle.y)); attention_info.flags = 0; - BOOL bVar21 = FALSE; + BOOL r23_2; + r23_2 = FALSE; attention_info.position.set(eyePos.x, eyePos.y + 30.0f, eyePos.z); cXyz spC0; if (checkStateFlg(daSFLG_UNK1000000_e)) { spC0 = m1068 - eyePos; - bVar21 = TRUE; + r23_2 = TRUE; offStateFlg(daSFLG_UNK1000000_e); } else if (m0428) { spC0 = *m0428 - eyePos; - bVar21 = TRUE; + r23_2 = TRUE; } else if ((mCurMode == 10 || mCurMode == 11) && m0434 && mRopeCnt > 0) { spC0 = *m0434 - eyePos; - bVar21 = TRUE; + r23_2 = TRUE; } else if (mCurMode == 8 || distXz > 125.0f) { if ( - (!dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02))) && - dComIfGp_getMiniGameType() != 1 && fopAcM_searchPlayerDistanceXZ2(this) < 250000.0f + (!dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && + (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02))) && + dComIfGp_getMiniGameType() != 1 ) { - spC0 = link->eyePos - eyePos; - bVar21 = TRUE; +#if VERSION == VERSION_DEMO attention_info.flags = fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e; +#endif + if (fopAcM_searchPlayerDistanceXZ2(this) < 250000.0f) { + spC0 = link->eyePos - eyePos; + r23_2 = TRUE; +#if VERSION > VERSION_DEMO + attention_info.flags = fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e; +#endif + } } } else { @@ -4109,9 +4135,9 @@ BOOL daShip_c::execute() { } } - short sVar16; - short sVar5; - if (bVar21) { + s16 sVar16; + s16 sVar5; + if (r23_2) { sVar16 = cM_atan2s(-spC0.y, spC0.absXZ()) - shape_angle.x; if (sVar16 > 0x2000) { @@ -4161,7 +4187,9 @@ BOOL daShip_c::execute() { fopAcM_orderSpeakEvent(this); offStateFlg(daSFLG_UNK400000_e); attention_info.flags |= (fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e); +#if VERSION > VERSION_DEMO eventInfo.onCondition(dEvtCnd_CANTALK_e); +#endif } } if ( @@ -4172,8 +4200,8 @@ BOOL daShip_c::execute() { attention_info.flags &= ~fopAc_Attn_ACTION_SHIP_e; } if (mCurMode != 8 && dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e)) { - BOOL r24; - r24 = TRUE; + BOOL r24_2; + r24_2 = TRUE; if (dComIfGs_isEventBit(0x1E40) && !dComIfGs_isEventBit(0x3840)) { mNextMessageNo = 0x168c; } @@ -4190,11 +4218,13 @@ BOOL daShip_c::execute() { mNextMessageNo = 0x1683; } else { - r24 = FALSE; + r24_2 = FALSE; } - if (r24) { + if (r24_2) { fopAcM_orderSpeakEvent(this); +#if VERSION > VERSION_DEMO eventInfo.onCondition(dEvtCnd_CANTALK_e); +#endif attention_info.flags |= (fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e); offStateFlg(daSFLG_UNK400000_e); } diff --git a/src/d/actor/d_a_vrbox2.cpp b/src/d/actor/d_a_vrbox2.cpp index 1b84569d3..10e5b5715 100644 --- a/src/d/actor/d_a_vrbox2.cpp +++ b/src/d/actor/d_a_vrbox2.cpp @@ -117,6 +117,12 @@ BOOL daVrbox2_color_set(vrbox2_class* i_this) { windNrmVec = *windVec; if (dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) == dStageType_MISC_e) { +#if VERSION == VERSION_DEMO + int windX; + int windY; + windX = g_env_light.mWind.mTactWindAngleX; + windY = g_env_light.mWind.mTactWindAngleY; +#else s16 stageWindY = 0; if (strcmp(dComIfGp_getStartStageName(), "LinkRM") == 0) stageWindY = 0x4000; @@ -129,23 +135,24 @@ BOOL daVrbox2_color_set(vrbox2_class* i_this) { else if (strcmp(dComIfGp_getStartStageName(), "Onobuta") == 0) stageWindY = 0x4000; - s32 windY2; - s16 windY; - s32 windX; + s16 windY_s16; // Fakematch? + int windX; + int windY; if (dComIfGs_getWindX() == -1 && dComIfGs_getWindY() == -1) { windX = 0; - windY = 0; + windY_s16 = 0; } else { windX = g_env_light.mWind.mTactWindAngleX; - windY = g_env_light.mWind.mTactWindAngleY; + windY_s16 = g_env_light.mWind.mTactWindAngleY; } - windY += stageWindY; - windY2 = windY; + windY_s16 += stageWindY; + windY = windY_s16; +#endif - windNrmVec.x = cM_scos(windX) * cM_scos(windY2); + windNrmVec.x = cM_scos(windX) * cM_scos(windY); windNrmVec.y = cM_ssin(windX); - windNrmVec.z = cM_scos(windX) * cM_ssin(windY2); + windNrmVec.z = cM_scos(windX) * cM_ssin(windY); windPow = 0.6f; } @@ -257,7 +264,7 @@ static BOOL daVrbox2_solidHeapCB(fopAc_ac_c* i_actor) { vrbox2_class* i_this = static_cast(i_actor); J3DModelData* modelData = (J3DModelData*)dComIfG_getStageRes("Stage", "vr_back_cloud.bdl"); - JUT_ASSERT(0x211, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(511, 529, 529, 529), modelData != NULL); i_this->mpBackCloud = mDoExt_J3DModel__create(modelData, 0x80000, 0x11020202); modelData = (J3DModelData*)dComIfG_getStageRes("Stage", "vr_kasumi_mae.bdl"); @@ -279,9 +286,14 @@ static cPhs_State daVrbox2_Create(fopAc_ac_c* i_actor) { fopAcM_SetupActor(i_actor, vrbox2_class); vrbox2_class* i_this = static_cast(i_actor); +#if VERSION == VERSION_DEMO + fopAcM_entrySolidHeap(i_this, daVrbox2_solidHeapCB, 0x21a0); + cPhs_State phase_state = cPhs_COMPLEATE_e; +#else cPhs_State phase_state = cPhs_COMPLEATE_e; if (!fopAcM_entrySolidHeap(i_this, daVrbox2_solidHeapCB, 0x21a0)) phase_state = cPhs_ERROR_e; +#endif return phase_state; } diff --git a/src/d/d_a_leaflift_static.cpp b/src/d/d_a_leaflift_static.cpp index f008a0527..e7d933503 100644 --- a/src/d/d_a_leaflift_static.cpp +++ b/src/d/d_a_leaflift_static.cpp @@ -18,13 +18,15 @@ BOOL daLlift_c::checkEndDownLift() { /* 80069100-800692C4 .text MoveUpLift__9daLlift_cFv */ BOOL daLlift_c::MoveUpLift() { + f32 max_speed = m_max_speed; + f32 min_speed = m_min_speed; cXyz upLiftPos; bool res = FALSE; mEmitterTimer++; if (current.pos.y != home.pos.y + m_height) { m43D = TRUE; } - float upVel = cLib_addCalc(¤t.pos.y, home.pos.y + m_height, 0.1f, m_max_speed, m_min_speed); + f32 upVel = cLib_addCalc(¤t.pos.y, home.pos.y + m_height, 0.1f, max_speed, min_speed); if (upVel == 0.0f) { mbIsAscending = FALSE; res = TRUE; diff --git a/src/d/d_a_obj.cpp b/src/d/d_a_obj.cpp index 5f6f3e294..c2de23568 100644 --- a/src/d/d_a_obj.cpp +++ b/src/d/d_a_obj.cpp @@ -141,38 +141,41 @@ namespace daObj { } /* 80066D6C-8006700C .text posMoveF_grade__5daObjFP10fopAc_ac_cPC4cXyzPC4cXyzffPC4cXyzffPC4cXyz */ - void posMoveF_grade(fopAc_ac_c* pActor, const cXyz* pAddVel, const cXyz* stream_spd, f32 param_4, f32 param_5, const cXyz* pNorm, f32 friction, f32 no_grade_cos, const cXyz* pAddAccel) { - /* Nonmatching */ - JUT_ASSERT(0x118, stream_spd != NULL) + void posMoveF_grade(fopAc_ac_c* i_actor, const cXyz* p_add_vel, const cXyz* stream_spd, f32 param_4, + f32 param_5, const cXyz* pNorm, f32 friction, f32 no_grade_cos, const cXyz* p_add_accel + ) { + JUT_ASSERT(280, stream_spd != NULL) cXyz resist_accel; - posMoveF_resist_acc(&resist_accel, pActor, stream_spd, param_4, param_5); + posMoveF_resist_acc(&resist_accel, i_actor, stream_spd, param_4, param_5); - JUT_ASSERT(0x121, (friction >= 0.0f) && (friction < 1.0f) && (no_grade_cos >= 0.0f) && (no_grade_cos <= 1.0f)) + JUT_ASSERT(289, (friction >= 0.0f) && (friction < 1.0f) && (no_grade_cos >= 0.0f) && (no_grade_cos <= 1.0f)) cXyz vel; - posMoveF_grade_acc(&vel, pActor, pNorm, param_5, param_4, &resist_accel, pAddAccel); + posMoveF_grade_acc(&vel, i_actor, pNorm, friction, no_grade_cos, &resist_accel, p_add_accel); - f32 spf = pActor->speedF; - f32 grav = pActor->gravity; + f32 speedF = fopAcM_GetSpeedF(i_actor); + f32 gravity = fopAcM_GetGravity(i_actor); + cXyz* speed_p = fopAcM_GetSpeed_p(i_actor); - f32 x = spf * cM_ssin(pActor->current.angle.y) + resist_accel.x + vel.x; - f32 y = pActor->speed.y + grav + resist_accel.y + vel.y; - f32 z = spf * cM_scos(pActor->current.angle.y) + resist_accel.z + vel.z; - if(pAddAccel) { - x += pAddAccel->x; - y += pAddAccel->y; - z += pAddAccel->z; + f32 speed_x = vel.x + (resist_accel.x + (speedF * cM_ssin(i_actor->current.angle.y))); + f32 speed_y = vel.y + (resist_accel.y + (speed_p->y + gravity)); + f32 speed_z = vel.z + (resist_accel.z + (speedF * cM_scos(i_actor->current.angle.y))); + + if(p_add_accel) { + speed_x += p_add_accel->x; + speed_y += p_add_accel->y; + speed_z += p_add_accel->z; } - if(y < pActor->maxFallSpeed) { - y = pActor->maxFallSpeed; + if(speed_y < fopAcM_GetMaxFallSpeed(i_actor)) { + speed_y = fopAcM_GetMaxFallSpeed(i_actor); } - pActor->speed.set(x, y, z); - pActor->speedF = std::sqrtf(x * x + z * z); - pActor->current.angle.y = cM_atan2s(spf, grav); - fopAcM_posMove(pActor, pAddVel); + fopAcM_SetSpeed(i_actor, speed_x, speed_y, speed_z); + i_actor->speedF = std::sqrtf(speed_x * speed_x + speed_z * speed_z); + i_actor->current.angle.y = cM_atan2s(speed_x, speed_z); + fopAcM_posMove(i_actor, p_add_vel); } /* 8006700C-800671D4 .text quat_rotBaseY__5daObjFP10QuaternionRC4cXyz */ diff --git a/src/d/d_door.cpp b/src/d/d_door.cpp index 5077b5047..9260d010d 100644 --- a/src/d/d_door.cpp +++ b/src/d/d_door.cpp @@ -89,7 +89,11 @@ s32 dDoor_info_c::frontCheckOld() { cSAngle angle1; angle1 = (globe.U() - current.angle.y); s16 angle = angle1.Abs(); +#if VERSION == VERSION_DEMO + if (angle < 0x4000) +#else if (angle < 0x4000 && angle >= 0) +#endif return 0; else return 1; @@ -200,14 +204,19 @@ void dDoor_info_c::makeEventId(int spl) { mEventIdx[i] = dComIfGp_evmng_getEventIdx(table[i], mToolId[i]); } + s16 r27; switch (spl) { case 1: - mEventIdx[2] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_10", mToolId[2]); - mEventIdx[3] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_10", mToolId[3]); + r27 = 2; + mEventIdx[r27] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_10", mToolId[r27]); + r27 = 3; + mEventIdx[r27] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_10", mToolId[r27]); break; case 2: - mEventIdx[2] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_12", mToolId[2]); - mEventIdx[3] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_12", mToolId[3]); + r27 = 2; + mEventIdx[r27] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_12", mToolId[r27]); + r27 = 3; + mEventIdx[r27] = dComIfGp_evmng_getEventIdx("DEFAULT_SHUTTER_DOOR_12", mToolId[r27]); break; } } diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index ddb3a71ab..236b4d567 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -41,7 +41,9 @@ void dSv_player_status_a_c::init() { mMagic = 0; field_0x15 = 0; field_0x6 = 0; +#if VERSION > VERSION_DEMO field_0x16 = 0; +#endif } /* 80058B54-80058B84 .text init__21dSv_player_status_b_cFv */ @@ -51,7 +53,9 @@ void dSv_player_status_b_c::init() { mTime = 165.0f; mDate = 0; mDateIPL = 0; +#if VERSION > VERSION_DEMO field_0x8 = 0.0f; +#endif } /* 80058B84-80058BC8 .text init__25dSv_player_return_place_cFv */ @@ -63,7 +67,7 @@ void dSv_player_return_place_c::init() { /* 80058BC8-80058C60 .text set__25dSv_player_return_place_cFPCcScUc */ void dSv_player_return_place_c::set(const char* i_name, s8 i_roomNo, u8 i_status) { - JUT_ASSERT(179, strlen(i_name) <= 7); + JUT_ASSERT(VERSION_SELECT(173, 179, 179, 179), strlen(i_name) <= 7); strcpy(mName, i_name); mRoomNo = i_roomNo; @@ -197,14 +201,14 @@ void dSv_player_get_item_c::init() { /* 800594C4-8005955C .text onItem__21dSv_player_get_item_cFiUc */ void dSv_player_get_item_c::onItem(int i_field, u8 i_item) { - JUT_ASSERT(399, 0 <= i_item && i_item < 8); + JUT_ASSERT(VERSION_SELECT(393, 399, 399, 399), 0 <= i_item && i_item < 8); mItemFlags[i_field] |= (u8)(1 << i_item); } /* 8005955C-800595F8 .text isItem__21dSv_player_get_item_cFiUc */ BOOL dSv_player_get_item_c::isItem(int i_field, u8 i_item) { - JUT_ASSERT(429, 0 <= i_item && i_item < 8); + JUT_ASSERT(VERSION_SELECT(423, 429, 429, 429), 0 <= i_item && i_item < 8); return mItemFlags[i_field] & (u8)(1 << i_item) ? TRUE : FALSE; } @@ -663,37 +667,37 @@ void dSv_player_get_bag_item_c::init() { /* 8005A8CC-8005A960 .text onBeast__25dSv_player_get_bag_item_cFUc */ void dSv_player_get_bag_item_c::onBeast(u8 i_no) { - JUT_ASSERT(1235, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1229, 1235, 1235, 1235), 0 <= i_no && i_no < 8); mBeastFlags |= (u8)(1 << i_no); } /* 8005A960-8005A9F8 .text isBeast__25dSv_player_get_bag_item_cFUc */ BOOL dSv_player_get_bag_item_c::isBeast(u8 i_no) { - JUT_ASSERT(1265, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1259, 1265, 1265, 1265), 0 <= i_no && i_no < 8); return mBeastFlags & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005A9F8-8005AA8C .text onBait__25dSv_player_get_bag_item_cFUc */ void dSv_player_get_bag_item_c::onBait(u8 i_no) { - JUT_ASSERT(1280, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1274, 1280, 1280, 1280), 0 <= i_no && i_no < 8); mBaitFlags |= (u8)(1 << i_no); } /* 8005AA8C-8005AB24 .text isBait__25dSv_player_get_bag_item_cFUc */ BOOL dSv_player_get_bag_item_c::isBait(u8 i_no) { - JUT_ASSERT(1310, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1304, 1310, 1310, 1310), 0 <= i_no && i_no < 8); return mBaitFlags & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005AB24-8005ABB4 .text onReserve__25dSv_player_get_bag_item_cFUc */ void dSv_player_get_bag_item_c::onReserve(u8 i_no) { - JUT_ASSERT(1325, 0 <= i_no && i_no < 32); + JUT_ASSERT(VERSION_SELECT(1319, 1325, 1325, 1325), 0 <= i_no && i_no < 32); mReserveFlags |= (1 << i_no); } /* 8005ABB4-8005AC48 .text isReserve__25dSv_player_get_bag_item_cFUc */ BOOL dSv_player_get_bag_item_c::isReserve(u8 i_no) { - JUT_ASSERT(1355, 0 <= i_no && i_no < 32); + JUT_ASSERT(VERSION_SELECT(1349, 1355, 1355, 1355), 0 <= i_no && i_no < 32); return mReserveFlags & (1 << i_no) ? TRUE : FALSE; } @@ -727,55 +731,55 @@ void dSv_player_collect_c::init() { /* 8005ACE0-8005AD78 .text onCollect__20dSv_player_collect_cFiUc */ void dSv_player_collect_c::onCollect(int i_idx, u8 i_item) { - JUT_ASSERT(1412, 0 <= i_item && i_item < 8); + JUT_ASSERT(VERSION_SELECT(1406, 1412, 1412, 1412), 0 <= i_item && i_item < 8); mCollect[i_idx] |= (u8)(1 << i_item); } /* 8005AD78-8005AE10 .text offCollect__20dSv_player_collect_cFiUc */ void dSv_player_collect_c::offCollect(int i_idx, u8 i_item) { - JUT_ASSERT(1427, 0 <= i_item && i_item < 8); + JUT_ASSERT(VERSION_SELECT(1421, 1427, 1427, 1427), 0 <= i_item && i_item < 8); mCollect[i_idx] &= ~(u8)(1 << i_item); } /* 8005AE10-8005AEAC .text isCollect__20dSv_player_collect_cFiUc */ BOOL dSv_player_collect_c::isCollect(int i_idx, u8 i_item) { - JUT_ASSERT(1442, 0 <= i_item && i_item < 8); + JUT_ASSERT(VERSION_SELECT(1436, 1442, 1442, 1442), 0 <= i_item && i_item < 8); return mCollect[i_idx] & (u8)(1 << i_item) ? TRUE : FALSE; } /* 8005AEAC-8005AF40 .text onTact__20dSv_player_collect_cFUc */ void dSv_player_collect_c::onTact(u8 i_no) { - JUT_ASSERT(1502, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1496, 1502, 1502, 1502), 0 <= i_no && i_no < 8); mTact |= (u8)(1 << i_no); } /* 8005AF40-8005AFD8 .text isTact__20dSv_player_collect_cFUc */ BOOL dSv_player_collect_c::isTact(u8 i_no) { - JUT_ASSERT(1532, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1526, 1532, 1532, 1532), 0 <= i_no && i_no < 8); return mTact & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005AFD8-8005B06C .text onTriforce__20dSv_player_collect_cFUc */ void dSv_player_collect_c::onTriforce(u8 i_no) { - JUT_ASSERT(1547, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1541, 1547, 1547, 1547), 0 <= i_no && i_no < 8); mTriforce |= (u8)(1 << i_no); } /* 8005B06C-8005B104 .text isTriforce__20dSv_player_collect_cFUc */ BOOL dSv_player_collect_c::isTriforce(u8 i_no) { - JUT_ASSERT(1577, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1571, 1577, 1577, 1577), 0 <= i_no && i_no < 8); return mTriforce & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005B104-8005B198 .text onSymbol__20dSv_player_collect_cFUc */ void dSv_player_collect_c::onSymbol(u8 i_no) { - JUT_ASSERT(1592, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1586, 1592, 1592, 1592), 0 <= i_no && i_no < 8); mSymbol |= (u8)(1 << i_no); } /* 8005B198-8005B230 .text isSymbol__20dSv_player_collect_cFUc */ BOOL dSv_player_collect_c::isSymbol(u8 i_no) { - JUT_ASSERT(1622, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1616, 1622, 1622, 1622), 0 <= i_no && i_no < 8); return mSymbol & (u8)(1 << i_no) ? TRUE : FALSE; } @@ -805,7 +809,9 @@ void dSv_player_map_c::init() { mFmapBits[i] = 0; } +#if VERSION > VERSION_DEMO field_0x81 = 0; +#endif mFmapBits[dIsleIdx_ForsakenFortress_e] = 1 | 2; mFmapBits[dIsleIdx_OutsetIsland_e] = 1 | 2; mFmapBits[dIsleIdx_WindfallIsland_e] = 1 | 2; @@ -817,67 +823,67 @@ void dSv_player_map_c::init() { /* 8005B320-8005B3CC .text onGetMap__16dSv_player_map_cFi */ void dSv_player_map_c::onGetMap(int i_no) { - JUT_ASSERT(1690, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(1680, 1690, 1690, 1690), 0 <= i_no && i_no < 128); field_0x0[1][i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005B3CC-8005B47C .text isGetMap__16dSv_player_map_cFi */ BOOL dSv_player_map_c::isGetMap(int i_no) { - JUT_ASSERT(1718, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(1708, 1718, 1718, 1718), 0 <= i_no && i_no < 128); return field_0x0[1][i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005B47C-8005B528 .text onOpenMap__16dSv_player_map_cFi */ void dSv_player_map_c::onOpenMap(int i_no) { - JUT_ASSERT(1751, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(1741, 1751, 1751, 1751), 0 <= i_no && i_no < 128); field_0x0[2][i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005B528-8005B5D4 .text offOpenMap__16dSv_player_map_cFi */ void dSv_player_map_c::offOpenMap(int i_no) { - JUT_ASSERT(1765, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(0, 1765, 1765, 1765), 0 <= i_no && i_no < 128); field_0x0[2][i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005B5D4-8005B684 .text isOpenMap__16dSv_player_map_cFi */ BOOL dSv_player_map_c::isOpenMap(int i_no) { - JUT_ASSERT(1779, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(1769, 1779, 1779, 1779), 0 <= i_no && i_no < 128); return field_0x0[2][i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005B684-8005B730 .text onCompleteMap__16dSv_player_map_cFi */ void dSv_player_map_c::onCompleteMap(int i_no) { - JUT_ASSERT(1812, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(1802, 1812, 1812, 1812), 0 <= i_no && i_no < 128); field_0x0[3][i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005B730-8005B7DC .text offCompleteMap__16dSv_player_map_cFi */ void dSv_player_map_c::offCompleteMap(int i_no) { - JUT_ASSERT(1826, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(0, 1826, 1826, 1826), 0 <= i_no && i_no < 128); field_0x0[3][i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005B7DC-8005B88C .text isCompleteMap__16dSv_player_map_cFi */ BOOL dSv_player_map_c::isCompleteMap(int i_no) { - JUT_ASSERT(1840, 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(1830, 1840, 1840, 1840), 0 <= i_no && i_no < 128); return field_0x0[3][i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005B88C-8005B92C .text onTriforce__16dSv_player_map_cFi */ void dSv_player_map_c::onTriforce(int i_no) { - JUT_ASSERT(1874, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1864, 1874, 1874, 1874), 0 <= i_no && i_no < 8); field_0x81 |= (u8)(1 << i_no); } /* 8005B92C-8005B9CC .text offTriforce__16dSv_player_map_cFi */ void dSv_player_map_c::offTriforce(int i_no) { - JUT_ASSERT(1888, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(0, 1888, 1888, 1888), 0 <= i_no && i_no < 8); field_0x81 &= ~(u8)(1 << i_no); } /* 8005B9CC-8005BA70 .text isTriforce__16dSv_player_map_cFi */ BOOL dSv_player_map_c::isTriforce(int i_no) { - JUT_ASSERT(1902, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1892, 1902, 1902, 1902), 0 <= i_no && i_no < 8); return field_0x81 & (u8)(1 << i_no) ? TRUE : FALSE; } @@ -895,37 +901,37 @@ int dSv_player_map_c::getCollectMapNum() { /* 8005BAE8-8005BB84 .text onFmapBit__16dSv_player_map_cFiUc */ void dSv_player_map_c::onFmapBit(int i_idx, u8 i_no) { - JUT_ASSERT(1957, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1947, 1957, 1957, 1957), 0 <= i_no && i_no < 8); mFmapBits[i_idx] |= (u8)(1 << i_no); } /* 8005BB84-8005BC24 .text isFmapBit__16dSv_player_map_cFiUc */ BOOL dSv_player_map_c::isFmapBit(int i_idx, u8 i_no) { - JUT_ASSERT(1987, 0 <= i_no && i_no < 8); + JUT_ASSERT(VERSION_SELECT(1977, 1987, 1987, 1987), 0 <= i_no && i_no < 8); return mFmapBits[i_idx] & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005BC24-8005BCBC .text onSaveArriveGrid__16dSv_player_map_cFi */ void dSv_player_map_c::onSaveArriveGrid(int no) { - JUT_ASSERT(1996, (no >= 0) && (no < 49)); + JUT_ASSERT(VERSION_SELECT(1986, 1996, 1996, 1996), (no >= 0) && (no < 49)); onFmapBit(no, 0); } /* 8005BCBC-8005BD54 .text isSaveArriveGrid__16dSv_player_map_cFi */ BOOL dSv_player_map_c::isSaveArriveGrid(int no) { - JUT_ASSERT(2010, (no >= 0) && (no < 49)); + JUT_ASSERT(VERSION_SELECT(2000, 2010, 2010, 2010), (no >= 0) && (no < 49)); return isFmapBit(no, 0); } /* 8005BD54-8005BDEC .text onSaveArriveGridForAgb__16dSv_player_map_cFi */ void dSv_player_map_c::onSaveArriveGridForAgb(int no) { - JUT_ASSERT(2017, (no >= 0) && (no < 49)); + JUT_ASSERT(VERSION_SELECT(2007, 2017, 2017, 2017), (no >= 0) && (no < 49)); onFmapBit(no, 1); } /* 8005BDEC-8005BE84 .text isSaveArriveGridForAgb__16dSv_player_map_cFi */ BOOL dSv_player_map_c::isSaveArriveGridForAgb(int no) { - JUT_ASSERT(2029, (no >= 0) && (no < 49)); + JUT_ASSERT(VERSION_SELECT(2019, 2029, 2029, 2029), (no >= 0) && (no < 49)); return isFmapBit(no, 1); } @@ -1037,37 +1043,37 @@ void dSv_memBit_c::init() { /* 8005C0EC-8005C188 .text onTbox__12dSv_memBit_cFi */ void dSv_memBit_c::onTbox(int i_no) { - JUT_ASSERT(VERSION_SELECT(2225, 2225, 2252, 2252), 0 <= i_no && i_no < 32); + JUT_ASSERT(VERSION_SELECT(2197, 2225, 2252, 2252), 0 <= i_no && i_no < 32); mTbox |= (1 << i_no); } /* 8005C188-8005C228 .text isTbox__12dSv_memBit_cFi */ BOOL dSv_memBit_c::isTbox(int i_no) { - JUT_ASSERT(VERSION_SELECT(2253, 2253, 2280, 2280), 0 <= i_no && i_no < 32); + JUT_ASSERT(VERSION_SELECT(2225, 2253, 2280, 2280), 0 <= i_no && i_no < 32); return mTbox & (1 << i_no) ? TRUE : FALSE; } /* 8005C228-8005C2D4 .text onSwitch__12dSv_memBit_cFi */ void dSv_memBit_c::onSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2284, 2284, 2311, 2311), 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(2256, 2284, 2311, 2311), 0 <= i_no && i_no < 128); mSwitch[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005C2D4-8005C380 .text offSwitch__12dSv_memBit_cFi */ void dSv_memBit_c::offSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2298, 2298, 2325, 2325), 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(2270, 2298, 2325, 2325), 0 <= i_no && i_no < 128); mSwitch[i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005C380-8005C430 .text isSwitch__12dSv_memBit_cFi */ BOOL dSv_memBit_c::isSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2312, 2312, 2339, 2339), 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(2284, 2312, 2339, 2339), 0 <= i_no && i_no < 128); return mSwitch[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005C430-8005C4EC .text revSwitch__12dSv_memBit_cFi */ BOOL dSv_memBit_c::revSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2326, 2326, 2353, 2353), 0 <= i_no && i_no < 128); + JUT_ASSERT(VERSION_SELECT(2298, 2326, 2353, 2353), 0 <= i_no && i_no < 128); u32 idx = i_no >> 5; u32 sw = 1 << (i_no & 0x1F); @@ -1077,37 +1083,37 @@ BOOL dSv_memBit_c::revSwitch(int i_no) { /* 8005C4EC-8005C598 .text onItem__12dSv_memBit_cFi */ void dSv_memBit_c::onItem(int i_no) { - JUT_ASSERT(VERSION_SELECT(2345, 2345, 2372, 2372), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2317, 2345, 2372, 2372), 0 <= i_no && i_no < 64); mItem[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005C598-8005C648 .text isItem__12dSv_memBit_cFi */ BOOL dSv_memBit_c::isItem(int i_no) { - JUT_ASSERT(VERSION_SELECT(2373, 2373, 2400, 2400), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2345, 2373, 2400, 2400), 0 <= i_no && i_no < 64); return mItem[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005C648-8005C6F4 .text onVisitedRoom__12dSv_memBit_cFi */ void dSv_memBit_c::onVisitedRoom(int i_no) { - JUT_ASSERT(VERSION_SELECT(2405, 2405, 2432, 2432), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2377, 2405, 2432, 2432), 0 <= i_no && i_no < 64); mVisitedRoom[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005C6F4-8005C7A4 .text isVisitedRoom__12dSv_memBit_cFi */ BOOL dSv_memBit_c::isVisitedRoom(int i_no) { - JUT_ASSERT(VERSION_SELECT(2433, 2433, 2460, 2460), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2405, 2433, 2460, 2460), 0 <= i_no && i_no < 64); return mVisitedRoom[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005C7A4-8005C844 .text onDungeonItem__12dSv_memBit_cFi */ void dSv_memBit_c::onDungeonItem(int i_no) { - JUT_ASSERT(VERSION_SELECT(2465, 2465, 2492, 2492), 0 <= i_no && i_no < 6); + JUT_ASSERT(VERSION_SELECT(2437, 2465, 2492, 2492), 0 <= i_no && i_no < 6); mDungeonItem |= (u8)(1 << i_no); } /* 8005C844-8005C8E8 .text isDungeonItem__12dSv_memBit_cFi */ BOOL dSv_memBit_c::isDungeonItem(int i_no) { - JUT_ASSERT(VERSION_SELECT(2494, 2494, 2521, 2521), 0 <= i_no && i_no < 6); + JUT_ASSERT(VERSION_SELECT(2466, 2494, 2521, 2521), 0 <= i_no && i_no < 6); return mDungeonItem & (u8)(1 << i_no) ? TRUE : FALSE; } @@ -1124,15 +1130,15 @@ void dSv_ocean_c::init() { /* 8005C908-8005C9E8 .text onOceanSvBit__11dSv_ocean_cFUcUs */ void dSv_ocean_c::onOceanSvBit(u8 i_grid, u16 i_bit) { - JUT_ASSERT(VERSION_SELECT(2613, 2613, 2640, 2640), (0 <= i_grid) && (i_grid <= 0x31)); - JUT_ASSERT(VERSION_SELECT(2614, 2614, 2641, 2641), (0 <= i_bit) && (i_bit < 16)); + JUT_ASSERT(VERSION_SELECT(2585, 2613, 2640, 2640), (0 <= i_grid) && (i_grid <= 0x31)); + JUT_ASSERT(VERSION_SELECT(2586, 2614, 2641, 2641), (0 <= i_bit) && (i_bit < 16)); field_0x0[i_grid] |= (u16)(1 << i_bit); } /* 8005C9E8-8005CACC .text isOceanSvBit__11dSv_ocean_cFUcUs */ BOOL dSv_ocean_c::isOceanSvBit(u8 i_grid, u16 i_bit) { - JUT_ASSERT(VERSION_SELECT(2645, 2645, 2672, 2672), (0 <= i_grid) && (i_grid <= 0x31)); - JUT_ASSERT(VERSION_SELECT(2646, 2646, 2673, 2673), (0 <= i_bit) && (i_bit < 16)); + JUT_ASSERT(VERSION_SELECT(2617, 2645, 2672, 2672), (0 <= i_grid) && (i_grid <= 0x31)); + JUT_ASSERT(VERSION_SELECT(2618, 2646, 2673, 2673), (0 <= i_bit) && (i_bit < 16)); return field_0x0[i_grid] & (u16)(1 << i_bit) ? TRUE : FALSE; } @@ -1198,25 +1204,25 @@ int dSv_danBit_c::init(s8 i_stageNo) { /* 8005CC08-8005CCB4 .text onSwitch__12dSv_danBit_cFi */ void dSv_danBit_c::onSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2790, 2790, 2817, 2817), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2762, 2790, 2817, 2817), 0 <= i_no && i_no < 64); mSwitch[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005CCB4-8005CD60 .text offSwitch__12dSv_danBit_cFi */ void dSv_danBit_c::offSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2804, 2804, 2831, 2831), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2776, 2804, 2831, 2831), 0 <= i_no && i_no < 64); mSwitch[i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005CD60-8005CE10 .text isSwitch__12dSv_danBit_cFi */ BOOL dSv_danBit_c::isSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2818, 2818, 2845, 2845), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2790, 2818, 2845, 2845), 0 <= i_no && i_no < 64); return mSwitch[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005CE10-8005CECC .text revSwitch__12dSv_danBit_cFi */ BOOL dSv_danBit_c::revSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2832, 2832, 2859, 2859), 0 <= i_no && i_no < 64); + JUT_ASSERT(VERSION_SELECT(2804, 2832, 2859, 2859), 0 <= i_no && i_no < 64); int sw = 1 << (i_no & 0x1F); mSwitch[i_no >> 5] ^= sw; @@ -1239,25 +1245,25 @@ void dSv_zoneBit_c::clearRoomSwitch() { /* 8005CF00-8005CFAC .text onSwitch__13dSv_zoneBit_cFi */ void dSv_zoneBit_c::onSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2876, 2876, 2903, 2903), 0 <= i_no && i_no < SWITCH_MAX); + JUT_ASSERT(VERSION_SELECT(2848, 2876, 2903, 2903), 0 <= i_no && i_no < SWITCH_MAX); mSwitch[i_no >> 4] |= (u16)(1 << (i_no & 0xF)); } /* 8005CFAC-8005D054 .text offSwitch__13dSv_zoneBit_cFi */ void dSv_zoneBit_c::offSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2890, 2890, 2917, 2917), 0 <= i_no && i_no < SWITCH_MAX); + JUT_ASSERT(VERSION_SELECT(2862, 2890, 2917, 2917), 0 <= i_no && i_no < SWITCH_MAX); mSwitch[i_no >> 4] &= ~(1 << (i_no & 0xF)); } /* 8005D054-8005D100 .text isSwitch__13dSv_zoneBit_cFi */ BOOL dSv_zoneBit_c::isSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2904, 2904, 2931, 2931), 0 <= i_no && i_no < SWITCH_MAX); + JUT_ASSERT(VERSION_SELECT(2876, 2904, 2931, 2931), 0 <= i_no && i_no < SWITCH_MAX); return mSwitch[i_no >> 4] & 1 << (i_no & 0xF) ? TRUE : FALSE; } /* 8005D100-8005D1B8 .text revSwitch__13dSv_zoneBit_cFi */ BOOL dSv_zoneBit_c::revSwitch(int i_no) { - JUT_ASSERT(VERSION_SELECT(2918, 2918, 2945, 2945), 0 <= i_no && i_no < SWITCH_MAX); + JUT_ASSERT(VERSION_SELECT(2890, 2918, 2945, 2945), 0 <= i_no && i_no < SWITCH_MAX); u32 idx = i_no >> 4; int sw = 1 << (i_no & 0xF); @@ -1267,13 +1273,13 @@ BOOL dSv_zoneBit_c::revSwitch(int i_no) { /* 8005D1B8-8005D254 .text onItem__13dSv_zoneBit_cFi */ void dSv_zoneBit_c::onItem(int i_no) { - JUT_ASSERT(VERSION_SELECT(2937, 2937, 2964, 2964), 0 <= i_no && i_no < 16); + JUT_ASSERT(VERSION_SELECT(2909, 2937, 2964, 2964), 0 <= i_no && i_no < 16); mItem |= (1 << i_no); } /* 8005D254-8005D2F4 .text isItem__13dSv_zoneBit_cFi */ BOOL dSv_zoneBit_c::isItem(int i_no) { - JUT_ASSERT(VERSION_SELECT(2965, 2965, 2992, 2992), 0 <= i_no && i_no < 16); + JUT_ASSERT(VERSION_SELECT(2937, 2965, 2992, 2992), 0 <= i_no && i_no < 16); return mItem & (1 << i_no) ? TRUE : FALSE; } @@ -1286,13 +1292,13 @@ void dSv_zoneActor_c::init() { /* 8005D314-8005D3BC .text on__15dSv_zoneActor_cFi */ void dSv_zoneActor_c::on(int i_id) { - JUT_ASSERT(VERSION_SELECT(3010, 3010, 3037, 3037), 0 <= i_id && i_id < ACTOR_MAX); + JUT_ASSERT(VERSION_SELECT(2982, 3010, 3037, 3037), 0 <= i_id && i_id < ACTOR_MAX); mActorFlags[i_id >> 5] |= (1 << (i_id & 0x1F)); } /* 8005D3BC-8005D468 .text is__15dSv_zoneActor_cFi */ BOOL dSv_zoneActor_c::is(int i_id) { - JUT_ASSERT(VERSION_SELECT(3038, 3038, 3065, 3065), 0 <= i_id && i_id < ACTOR_MAX); + JUT_ASSERT(VERSION_SELECT(3010, 3038, 3065, 3065), 0 <= i_id && i_id < ACTOR_MAX); return mActorFlags[i_id >> 5] & (1 << (i_id & 0x1F)) ? TRUE : FALSE; } @@ -1380,7 +1386,9 @@ void dSv_info_c::reinit() { u8 pictureNum = dComIfGs_getPictureNum(); +#if VERSION > VERSION_DEMO u8 r27 = dComIfGs_getEventReg(0x89FF); +#endif init(); @@ -1392,7 +1400,9 @@ void dSv_info_c::reinit() { dComIfGs_onEventBit(l_onEventBit[i]); } +#if VERSION > VERSION_DEMO dComIfGs_setEventReg(0xC407, 7); +#endif dComIfGs_setClearCount(clearCount); @@ -1412,12 +1422,14 @@ void dSv_info_c::reinit() { dComIfGs_setItem(dInvSlot_CAMERA_e, CAMERA2); dComIfGp_setItem(dInvSlot_CAMERA_e, CAMERA2); +#if VERSION > VERSION_DEMO dComIfGs_onGetItem(dInvSlot_CAMERA_e, 0); dComIfGs_onGetItem(dInvSlot_CAMERA_e, 1); dComIfGs_setPictureNum(pictureNum); dComIfGs_setEventReg(0x89FF, r27); +#endif } /* 8005D860-8005D8C8 .text init__10dSv_save_cFv */ @@ -1434,13 +1446,13 @@ void dSv_save_c::init() { /* 8005D8C8-8005D988 .text getSave__10dSv_info_cFi */ void dSv_info_c::getSave(int i_stageNo) { - JUT_ASSERT(VERSION_SELECT(3308, 3308, 3335, 3335), 0 <= i_stageNo && i_stageNo < dSv_save_c::STAGE_MAX); + JUT_ASSERT(VERSION_SELECT(3271, 3308, 3335, 3335), 0 <= i_stageNo && i_stageNo < dSv_save_c::STAGE_MAX); mMemory = mSavedata.getSave(i_stageNo); } /* 8005D988-8005DA70 .text putSave__10dSv_info_cFi */ void dSv_info_c::putSave(int i_stageNo) { - JUT_ASSERT(VERSION_SELECT(3324, 3324, 3351, 3351), 0 <= i_stageNo && i_stageNo < dSv_save_c::STAGE_MAX); + JUT_ASSERT(VERSION_SELECT(3287, 3324, 3351, 3351), 0 <= i_stageNo && i_stageNo < dSv_save_c::STAGE_MAX); mSavedata.putSave(i_stageNo, mMemory); } @@ -1468,7 +1480,7 @@ int dSv_info_c::createZone(int i_roomNo) { /* 8005DB24-8005DCD0 .text onSwitch__10dSv_info_cFii */ void dSv_info_c::onSwitch(int i_no, int i_roomNo) { - JUT_ASSERT(VERSION_SELECT(3384, 3384, 3411, 3411), + JUT_ASSERT(VERSION_SELECT(3347, 3384, 3411, 3411), (0 <= i_no && i_no < (MEMORY_SWITCH+ DAN_SWITCH+ ZONE_SWITCH)) || i_no == -1 || i_no == 255); if (i_no == -1 || i_no == 255) { @@ -1480,10 +1492,10 @@ void dSv_info_c::onSwitch(int i_no, int i_roomNo) { } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { mDan.onSwitch(i_no - MEMORY_SWITCH); } else { - JUT_ASSERT(VERSION_SELECT(3397, 3397, 3424, 3424), 0 <= i_roomNo && i_roomNo < 64); + JUT_ASSERT(VERSION_SELECT(3360, 3397, 3424, 3424), 0 <= i_roomNo && i_roomNo < 64); int zoneId = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3399, 3399, 3426, 3426), 0 <= zoneId && zoneId < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3362, 3399, 3426, 3426), 0 <= zoneId && zoneId < ZONE_MAX); mZone[zoneId].getZoneBit().onSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); } @@ -1491,7 +1503,7 @@ void dSv_info_c::onSwitch(int i_no, int i_roomNo) { /* 8005DCEC-8005DE98 .text offSwitch__10dSv_info_cFii */ void dSv_info_c::offSwitch(int i_no, int i_roomNo) { - JUT_ASSERT(VERSION_SELECT(3421, 3421, 3448, 3448), + JUT_ASSERT(VERSION_SELECT(3384, 3421, 3448, 3448), (0 <= i_no && i_no < (MEMORY_SWITCH+ DAN_SWITCH+ ZONE_SWITCH)) || i_no == -1 || i_no == 255); if (i_no == -1 || i_no == 255) { @@ -1503,10 +1515,10 @@ void dSv_info_c::offSwitch(int i_no, int i_roomNo) { } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { mDan.offSwitch(i_no - MEMORY_SWITCH); } else { - JUT_ASSERT(VERSION_SELECT(3434, 3434, 3461, 3461), 0 <= i_roomNo && i_roomNo < 64); + JUT_ASSERT(VERSION_SELECT(3397, 3434, 3461, 3461), 0 <= i_roomNo && i_roomNo < 64); int zoneNo = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3436, 3436, 3463, 3463), 0 <= zoneNo && zoneNo < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3399, 3436, 3463, 3463), 0 <= zoneNo && zoneNo < ZONE_MAX); mZone[zoneNo].getZoneBit().offSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); } @@ -1523,10 +1535,10 @@ BOOL dSv_info_c::isSwitch(int i_no, int i_roomNo) { } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { return mDan.isSwitch(i_no - MEMORY_SWITCH); } else { - JUT_ASSERT(VERSION_SELECT(3482, 3482, 3509, 3509), 0 <= i_roomNo && i_roomNo < 64); + JUT_ASSERT(VERSION_SELECT(3445, 3482, 3509, 3509), 0 <= i_roomNo && i_roomNo < 64); int zoneNo = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3484, 3484, 3511, 3511), 0 <= zoneNo && zoneNo < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3447, 3484, 3511, 3511), 0 <= zoneNo && zoneNo < ZONE_MAX); return mZone[zoneNo].getZoneBit().isSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); } @@ -1534,7 +1546,7 @@ BOOL dSv_info_c::isSwitch(int i_no, int i_roomNo) { /* 8005DFE0-8005E190 .text revSwitch__10dSv_info_cFii */ BOOL dSv_info_c::revSwitch(int i_no, int i_roomNo) { - JUT_ASSERT(VERSION_SELECT(3505, 3505, 3532, 3532), + JUT_ASSERT(VERSION_SELECT(3468, 3505, 3532, 3532), (0 <= i_no && i_no < (MEMORY_SWITCH+ DAN_SWITCH+ ZONE_SWITCH)) || i_no == -1 || i_no == 255); if (i_no == -1 || i_no == 255) { @@ -1546,10 +1558,10 @@ BOOL dSv_info_c::revSwitch(int i_no, int i_roomNo) { } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { return mDan.revSwitch(i_no - MEMORY_SWITCH); } else { - JUT_ASSERT(VERSION_SELECT(3517, 3517, 3544, 3544), 0 <= i_roomNo && i_roomNo < 64); + JUT_ASSERT(VERSION_SELECT(3480, 3517, 3544, 3544), 0 <= i_roomNo && i_roomNo < 64); int zoneNo = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3519, 3519, 3546, 3546), 0 <= zoneNo && zoneNo < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3482, 3519, 3546, 3546), 0 <= zoneNo && zoneNo < ZONE_MAX); return mZone[zoneNo].getZoneBit().revSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); } @@ -1557,7 +1569,7 @@ BOOL dSv_info_c::revSwitch(int i_no, int i_roomNo) { /* 8005E190-8005E324 .text onItem__10dSv_info_cFii */ void dSv_info_c::onItem(int i_no, int i_roomNo) { - JUT_ASSERT(VERSION_SELECT(3538, 3538, 3565, 3565), + JUT_ASSERT(VERSION_SELECT(3501, 3538, 3565, 3565), (0 <= i_no && i_no < (MEMORY_ITEM+ZONE_ITEM)) || i_no == -1 || i_no == 127); if (i_no == -1 || i_no == 127) { @@ -1567,10 +1579,10 @@ void dSv_info_c::onItem(int i_no, int i_roomNo) { if (i_no < MEMORY_ITEM) { mMemory.getBit().onItem(i_no); } else { - JUT_ASSERT(VERSION_SELECT(3548, 3548, 3575, 3575), 0 <= i_roomNo && i_roomNo < 64); + JUT_ASSERT(VERSION_SELECT(3511, 3548, 3575, 3575), 0 <= i_roomNo && i_roomNo < 64); int zoneNo = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3550, 3550, 3577, 3577), 0 <= zoneNo && zoneNo < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3513, 3550, 3577, 3577), 0 <= zoneNo && zoneNo < ZONE_MAX); mZone[zoneNo].getZoneBit().onItem(i_no - MEMORY_ITEM); } @@ -1578,7 +1590,7 @@ void dSv_info_c::onItem(int i_no, int i_roomNo) { /* 8005E324-8005E4BC .text isItem__10dSv_info_cFii */ BOOL dSv_info_c::isItem(int i_no, int i_roomNo) { - JUT_ASSERT(VERSION_SELECT(3602, 3602, 3629, 3629), + JUT_ASSERT(VERSION_SELECT(3565, 3602, 3629, 3629), (0 <= i_no && i_no < (MEMORY_ITEM+ZONE_ITEM)) || i_no == -1 || i_no == 127); if (i_no == -1 || i_no == 127) { @@ -1588,10 +1600,10 @@ BOOL dSv_info_c::isItem(int i_no, int i_roomNo) { if (i_no < MEMORY_ITEM) { return mMemory.getBit().isItem(i_no); } else { - JUT_ASSERT(VERSION_SELECT(3611, 3611, 3638, 3638), 0 <= i_roomNo && i_roomNo < 64); + JUT_ASSERT(VERSION_SELECT(3574, 3611, 3638, 3638), 0 <= i_roomNo && i_roomNo < 64); int zoneNo = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3613, 3613, 3640, 3640), 0 <= zoneNo && zoneNo < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3576, 3613, 3640, 3640), 0 <= zoneNo && zoneNo < ZONE_MAX); return mZone[zoneNo].getZoneBit().isItem(i_no - MEMORY_ITEM); } @@ -1603,10 +1615,10 @@ void dSv_info_c::onActor(int i_id, int i_roomNo) { return; } - JUT_ASSERT(VERSION_SELECT(3666, 3666, 3693, 3693), (0 <= i_id && i_id < dSv_zoneActor_c::ACTOR_MAX) && (0 <= i_roomNo && i_roomNo < 64)); + JUT_ASSERT(VERSION_SELECT(3629, 3666, 3693, 3693), (0 <= i_id && i_id < dSv_zoneActor_c::ACTOR_MAX) && (0 <= i_roomNo && i_roomNo < 64)); int zoneNo = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3668, 3668, 3695, 3695), 0 <= zoneNo && zoneNo < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3631, 3668, 3695, 3695), 0 <= zoneNo && zoneNo < ZONE_MAX); mZone[zoneNo].getActor().on(i_id); } @@ -1618,13 +1630,13 @@ BOOL dSv_info_c::isActor(int i_id, int i_roomNo) { } if (0 > i_id || i_id >= dSv_zoneActor_c::ACTOR_MAX) { - JUT_ASSERT(VERSION_SELECT(3717, 3717, 3744, 3744), 0 <= i_id && i_id < dSv_zoneActor_c::ACTOR_MAX); + JUT_ASSERT(VERSION_SELECT(3680, 3717, 3744, 3744), 0 <= i_id && i_id < dSv_zoneActor_c::ACTOR_MAX); } - JUT_ASSERT(VERSION_SELECT(3719, 3719, 3746, 3746), 0 <= i_roomNo && i_roomNo < 64); + JUT_ASSERT(VERSION_SELECT(3682, 3719, 3746, 3746), 0 <= i_roomNo && i_roomNo < 64); int zoneNo = dComIfGp_roomControl_getZoneNo(i_roomNo); - JUT_ASSERT(VERSION_SELECT(3721, 3721, 3748, 3748), 0 <= zoneNo && zoneNo < ZONE_MAX); + JUT_ASSERT(VERSION_SELECT(3684, 3721, 3748, 3748), 0 <= zoneNo && zoneNo < ZONE_MAX); return mZone[zoneNo].getActor().is(i_id); } diff --git a/src/d/d_shop.cpp b/src/d/d_shop.cpp index b4e32e9c9..dd6beb05b 100644 --- a/src/d/d_shop.cpp +++ b/src/d/d_shop.cpp @@ -4,6 +4,7 @@ // #include "d/d_shop.h" +#include "f_op/f_op_camera_mng.h" #include "f_op/f_op_msg.h" #include "d/d_lib.h" #include "f_op/f_op_actor_mng.h" @@ -994,9 +995,9 @@ int ShopCam_action_c::ds_normal_cam_action() { void ShopCam_action_c::Save() { camera_class* camera = dComIfGp_getCamera(0); if (camera) { - mOrigCenter = camera->mLookat.mCenter; - mOrigEye = camera->mLookat.mEye; - mOrigFovy = camera->mFovy; + mOrigCenter = *fopCamM_GetCenter_p(camera); + mOrigEye = *fopCamM_GetEye_p(camera); + mOrigFovy = fopCamM_GetFovy(camera); } } @@ -1006,7 +1007,7 @@ void ShopCam_action_c::Reset() { camera->mCamera.Set(mOrigCenter, mOrigEye, mOrigFovy, 0); camera->mCamera.Stay(); camera->mCamera.Reset(mOrigCenter, mOrigEye, mOrigFovy, 0); - setCamAction(NULL); + mCurrActionFunc = NULL; } /* 8005F6C4-8005F708 .text move__16ShopCam_action_cFv */ @@ -1073,10 +1074,12 @@ BOOL ShopItems_c::Item_Select(int idx) { temp -= item->getCenter(); if (m3C == 1) { cXyz temp3 = temp - temp2; - cLib_addCalcPos2(pPos, temp, 0.5f, temp3.abs() * 0.05f); + f32 f2 = temp3.abs() * 0.05f; + cLib_addCalcPos2(pPos, temp, 0.5f, f2); } else { cXyz temp3 = temp - temp2; - cLib_addCalcPos2(pPos, temp2, 0.5f, temp3.abs() * 0.1f); + f32 f2 = temp3.abs() * 0.1f; + cLib_addCalcPos2(pPos, temp2, 0.5f, f2); } pAngle->y += 0x400; return TRUE; @@ -1337,7 +1340,8 @@ BOOL dShop_maxCheck(int itemNo, int) { /* 8006044C-800606A8 .text dShop_BoughtErrorStatus__FP11ShopItems_cii */ u8 dShop_BoughtErrorStatus(ShopItems_c* shopItems, int param_2, int param_3) { - ShopItems_c__ItemData* itemData = shopItems->mpItemSetList[shopItems->mSelectedItemIdx]->mpItemData; + s16 selectedItemIdx = shopItems->mSelectedItemIdx; + ShopItems_c__ItemData* itemData = shopItems->mpItemSetList[selectedItemIdx]->mpItemData; u8 buyCond = itemData->mBuyConditions; u32 itemNo = itemData->mItemNo; u8 errorStatus = 0x00; @@ -1418,8 +1422,10 @@ ShopCursor_c::ShopCursor_c(J3DModelData* modelData, J3DAnmTevRegKey* brkData, f3 m40 = m38; m44 = 15; m48 = param_2; +#if VERSION > VERSION_DEMO m4C = 1.0f; m50 = 1.0f; +#endif m54 = 0; } @@ -1428,8 +1434,7 @@ void ShopCursor_c::anm_play() { mBrkAnm.play(); if (m44-- <= 0) { m44 = 15 + (s16)cM_rndF(5.0f); - f32 temp = (m38 + m3C) * 0.5f; - if (m40 > temp) { + if (m40 > (m38 + m3C) * 0.5f) { m40 = m3C; } else { m40 = m38; @@ -1440,16 +1445,15 @@ void ShopCursor_c::anm_play() { /* 80060960-80060B2C .text draw__12ShopCursor_cFv */ void ShopCursor_c::draw() { camera_class* camera = dComIfGp_getCamera(0); - s16 angleY = cLib_targetAngleY(&camera->mLookat.mCenter, &camera->mLookat.mEye); - s16 angleX = -cLib_targetAngleX(&camera->mLookat.mCenter, &camera->mLookat.mEye); + s16 angleY = cLib_targetAngleY(fopCamM_GetCenter_p(camera), fopCamM_GetEye_p(camera)); + s16 angleX = -cLib_targetAngleX(fopCamM_GetCenter_p(camera), fopCamM_GetEye_p(camera)); if (m54 == 0) { return; } f32 temp2; - f32 temp = (m38 + m3C) * 0.5f; - if (m40 > temp) { + if (m40 > (m38 + m3C) * 0.5f) { temp2 = m4C; } else { temp2 = m50;