From 3699da9e0963bdba45d62449230aba349acb02e5 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 5 Feb 2024 04:52:28 -0500 Subject: [PATCH] Match mDoExt_McaMorf::isStop inline regalloc --- .../JSystem/J3DGraphAnimator/J3DAnimation.h | 2 +- include/m_Do/m_Do_ext.h | 22 ++------- src/d/actor/d_a_am.cpp | 49 +++---------------- src/d/actor/d_a_am2.cpp | 35 ++----------- src/d/actor/d_a_dr.cpp | 21 ++------ src/d/actor/d_a_obj_toripost.cpp | 14 +----- src/d/actor/d_a_rd.cpp | 15 +----- 7 files changed, 25 insertions(+), 133 deletions(-) diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index e6e73b13a..058481f2c 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -819,7 +819,7 @@ public: u8 getAttribute() const { return mAttribute; } void setAttribute(u8 attr) { mAttribute = attr; } u8 getState() const { return mState; } - bool checkState(u8 state) const { return mState & state; } + bool checkState(u8 state) const { return mState & state ? true : false; } s16 getStart() const { return mStart; } void setStart(s16 start) { mStart = start; diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 5ea37cb61..174cc556f 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -34,11 +34,7 @@ public: void setPlayMode(int i_mode) { mFrameCtrl->setAttribute(i_mode); } void setLoopFrame(f32 i_frame) { mFrameCtrl->setLoop(i_frame); } BOOL isStop() { - bool stopped = true; - if (!mFrameCtrl->checkState(J3DFrameCtrl::STATE_STOP_E) && mFrameCtrl->getRate() != 0.0f) { - stopped = false; - } - return stopped; + return mFrameCtrl->checkState(J3DFrameCtrl::STATE_STOP_E) || mFrameCtrl->getRate() == 0.0f; } BOOL isLoop() { return mFrameCtrl->checkState(J3DFrameCtrl::STATE_LOOP_E); } @@ -351,12 +347,8 @@ public: void setPlaySpeed(f32 speed) { mFrameCtrl.setRate(speed); } f32 getFrame() { return mFrameCtrl.getFrame(); } void setFrame(f32 frame) { mFrameCtrl.setFrame((s16)frame); } - BOOL isStop() { //regswap somewhere here - bool stopped = true; - if (!mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && mFrameCtrl.getRate() != 0.0f) { - stopped = false; - } - return stopped; + BOOL isStop() { + return mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) || mFrameCtrl.getRate() == 0.0f; } BOOL checkFrame(f32 frame) { return mFrameCtrl.checkPass(frame); @@ -411,12 +403,8 @@ public: void setPlaySpeed(f32 speed) { mFrameCtrl.setRate(speed); } f32 getFrame() { return mFrameCtrl.getFrame(); } void setFrame(f32 frame) { mFrameCtrl.setFrame((s16)frame); } - BOOL isStop() { //regswap somewhere here - bool stopped = true; - if (!mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && mFrameCtrl.getRate() != 0.0f) { - stopped = false; - } - return stopped; + BOOL isStop() { + return mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) || mFrameCtrl.getRate() == 0.0f; } BOOL checkFrame(f32 frame) { return mFrameCtrl.checkPass(frame); diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 70571d794..fbd515695 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -538,12 +538,7 @@ static void action_dousa(am_class* i_this) { } break; case 2: - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - mDoExt_McaMorf* morf = i_this->mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } i_this->mState += 1; @@ -609,12 +604,7 @@ static void action_dousa(am_class* i_this) { break; case 6: if (i_this->mCurrBckIdx == AM_BCK_CLOSE) { - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (i_this->mpMorf->isStop()) { - mDoExt_McaMorf* morf = i_this->mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if (i_this->mpMorf->isStop()) { anm_init(i_this, AM_BCK_CLOSE_LOOP, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); } } @@ -684,12 +674,7 @@ static void action_dousa(am_class* i_this) { i_this->mState += 1; break; case 10: - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if (i_this->mpMorf->isStop()) { i_this->mState = 0; } break; @@ -812,12 +797,7 @@ static void action_itai_move(am_class* i_this) { // Fall-through case 0x29: cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f); - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - mDoExt_McaMorf* morf = i_this->mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } i_this->mCountDownTimers[0] = 100; @@ -838,12 +818,7 @@ static void action_itai_move(am_class* i_this) { i_this->mState += 1; break; case 0x2B: - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } i_this->mNeedleCyl.OnAtSetBit(); @@ -888,12 +863,7 @@ static void action_itai_move(am_class* i_this) { i_this->m0340 = dComIfGp_particle_set(0x8156, &i_this->mJawPos); } - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } i_this->mCountDownTimers[0] = 100; @@ -947,12 +917,7 @@ static void action_itai_move(am_class* i_this) { break; case 0x2F: bomb_move_set(i_this, 1); - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } cXyz centerPos = i_this->current.pos; diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index 1568ba5a9..432e610a9 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -514,12 +514,7 @@ static void action_dousa(am2_class* i_this) { if (i_this->mpMorf->checkFrame(24.0f)) { fopAcM_seStart(i_this, JA_SE_CM_AM2_SPIKE_OUT, 0); } - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - mDoExt_McaMorf* morf = i_this->mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } i_this->mState++; @@ -603,12 +598,7 @@ static void action_dousa(am2_class* i_this) { i_this->mState++; // Fall-through case 7: - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if (i_this->mpMorf->isStop()) { for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { i_this->mCountUpTimers[i] = 0; } @@ -671,12 +661,7 @@ static void action_mahi(am2_class* i_this) { case 0xB: cLib_addCalc0(&actor->speedF, 0.5f, 1.0f); if (actor->speedF < 0.2f) { - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - mDoExt_McaMorf* morf = i_this->mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if (i_this->mpMorf->isStop()) { actor->speedF = 0.0f; i_this->mCountDownTimers[2] = 20*30; anm_init(i_this, AM2_BCK_MAHI, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); @@ -916,12 +901,7 @@ static void action_itai(am2_class* i_this) { i_this->mState++; break; case 0x17: - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - mDoExt_McaMorf* morf = i_this->mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } i_this->mNeedleCyl.OnAtSetBit(); @@ -972,12 +952,7 @@ static void action_itai(am2_class* i_this) { } break; case 0x19: - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!i_this->mpMorf->isStop()) { break; } diff --git a/src/d/actor/d_a_dr.cpp b/src/d/actor/d_a_dr.cpp index fad4afeed..0e0447dbe 100644 --- a/src/d/actor/d_a_dr.cpp +++ b/src/d/actor/d_a_dr.cpp @@ -92,12 +92,7 @@ static void move(dr_class* i_this) { break; case 2: isIdle = true; - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (i_this->mpMorf->isStop()) { - mDoExt_McaMorf* morf = i_this->mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if (i_this->mpMorf->isStop()) { i_this->mState = 0; } break; @@ -113,12 +108,7 @@ static void move(dr_class* i_this) { i_this->mCountDownTimers[1] = 5; } - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if (i_this->mpMorf->isStop()) { i_this->m2C9 = 1; if (i_this->mpBreathEmitter) { i_this->mpBreathEmitter->becomeInvalidEmitter(); @@ -165,12 +155,7 @@ static void move(dr_class* i_this) { i_this->mCountDownTimers[1] = 5; } - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (i_this->mpMorf->isStop()) { - morf = i_this->mpMorf; - stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if (i_this->mpMorf->isStop()) { i_this->mState = 0; if (i_this->mpBreathEmitter) { i_this->mpBreathEmitter->becomeInvalidEmitter(); diff --git a/src/d/actor/d_a_obj_toripost.cpp b/src/d/actor/d_a_obj_toripost.cpp index 977689b43..bb82d6551 100644 --- a/src/d/actor/d_a_obj_toripost.cpp +++ b/src/d/actor/d_a_obj_toripost.cpp @@ -189,12 +189,7 @@ void daObjTpost_c::cutSetAnmStart(int staffIdx) { /* 00000500-00000560 .text cutSetAnmProc__12daObjTpost_cFi */ void daObjTpost_c::cutSetAnmProc(int staffIdx) { - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if(mMorf->isStop()) { - mDoExt_McaMorf* morf = mMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if(mMorf->isStop()) { dComIfGp_evmng_cutEnd(staffIdx); } } @@ -746,12 +741,7 @@ void daObjTpost_c::modeTalkXY() { } if(field_0x6C9 == 2 || field_0x6C9 == 3) { - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if(mMorf->isStop()) { - mDoExt_McaMorf* morf = mMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (stopped) { + if(mMorf->isStop()) { if(cLib_calcTimer(&field_0x8DC) == 0 && talk(1) == fopMsgStts_BOX_CLOSED_e) { modeProc(PROC_INIT, 0); dComIfGp_event_reset(); diff --git a/src/d/actor/d_a_rd.cpp b/src/d/actor/d_a_rd.cpp index b923cf639..1fbd39bf5 100644 --- a/src/d/actor/d_a_rd.cpp +++ b/src/d/actor/d_a_rd.cpp @@ -827,12 +827,7 @@ void daRd_c::modeDeathInit() { /* 00001E68-00001F14 .text modeDeath__6daRd_cFv */ void daRd_c::modeDeath() { - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!mpMorf->isStop()) { - mDoExt_McaMorf* morf = mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!mpMorf->isStop()) { return; } @@ -860,12 +855,7 @@ void daRd_c::modeDamage() { return; } fopAc_ac_c* player = dComIfGp_getLinkPlayer(); - // Using the mDoExt_McaMorf::isStop inline causes regswap. - // if (!mpMorf->isStop()) { - mDoExt_McaMorf* morf = mpMorf; - bool stopped = true; - if (!morf->mFrameCtrl.checkState(J3DFrameCtrl::STATE_STOP_E) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } - if (!stopped) { + if (!mpMorf->isStop()) { return; } @@ -887,7 +877,6 @@ void daRd_c::modeParalysisInit() { /* 000020EC-000021F0 .text modeParalysis__6daRd_cFv */ void daRd_c::modeParalysis() { - /* Nonmatching: isStop inline regalloc */ if (isAnm(AnmPrm_BEAM_HIT) && mpMorf->isStop()) { setAnm(AnmPrm_BEAM, false); } else if (isAnm(AnmPrm_BEAM)) {