diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md index 6bd2a0455..f3c67510b 100644 --- a/docs/recommended_todo.md +++ b/docs/recommended_todo.md @@ -76,9 +76,9 @@ | ebi2DCallBack.cpp | 10813 | ebiScreenSaveMenu.cpp | 11850 | | ebiScreenTitleMenu.cpp | 11996 | ebiScreenOmakeGame.cpp | 12403 | | ebiMainTitleMgr.cpp | 12858 | ebiP2TitleUnit.cpp | 13380 | -| ebiFileSelectMgr.cpp | 14168 | ebiSaveMgr.cpp | 15440 | -| efxTPkEffectMgr.cpp | 15831 | efx2dEffect.cpp | 17839 | -| efxObject.cpp | 18240 | ebiCardMgr.cpp | 19273 | +| ebiFileSelectMgr.cpp | 14168 | ebiCardMgr.cpp | 14763 | +| ebiSaveMgr.cpp | 15440 | efxTPkEffectMgr.cpp | 15831 | +| efx2dEffect.cpp | 17839 | efxObject.cpp | 18240 | | particle2dMgr.cpp | 20520 | ###
plugProjectHikinoU
@@ -94,25 +94,24 @@ | ---- | ---- | ---- | ---- | | aiTeki.cpp | 5890 | gamePelletList.cpp | 8282 | | mapMgrTraceMove.cpp | 9030 | cellIterator.cpp | 9434 | -| itemBarrel.cpp | 11148 | aiBreakGate.cpp | 13918 | -| itemTreasure.cpp | 14296 | flockMgr.cpp | 14542 | +| itemBarrel.cpp | 11265 | aiBreakGate.cpp | 13918 | +| itemTreasure.cpp | 14461 | flockMgr.cpp | 14542 | | naviWhistle.cpp | 16714 | aiBattle.cpp | 17401 | | creatureLOD.cpp | 18468 | texCaster.cpp | 20776 | | aiRescue.cpp | 21024 | gameResultTexMgr.cpp | 21221 | | singleGS_MainResult.cpp | 21236 | singleGS_CaveResult.cpp | 22845 | | aiCrop.cpp | 26982 | aiTransport.cpp | 27275 | -| gameSystem.cpp | 27890 | pathfinder.cpp | 28318 | +| gameSystem.cpp | 27889 | pathfinder.cpp | 28318 | | aiAttack.cpp | 28457 | creatureStick.cpp | 29831 | | vsCardMgr.cpp | 31129 | aiEnter.cpp | 31721 | | singleGS_DayEnd.cpp | 31850 | gameDynamics.cpp | 34058 | | aiBore.cpp | 34883 | baseGameSectionKantei.cpp | 35202 | | gamePlayDataMemCard.cpp | 36035 | piki.cpp | 36397 | | gameGeneratorCache.cpp | 37575 | aiWeed.cpp | 38056 | -| collinfo.cpp | 42246 | aiFormation.cpp | 43348 | -| gameCPlate.cpp | 43761 | gameCaveInfo.cpp | 48343 | -| itemGate.cpp | 48763 | cellPyramid.cpp | 51345 | -| pelletCarcass.cpp | 55314 | gameGenerator.cpp | 55971 | -| naviMgr.cpp | 60041 | +| vsGameSection.cpp | 40561 | collinfo.cpp | 42246 | +| aiFormation.cpp | 43348 | gameCPlate.cpp | 43760 | +| gameCaveInfo.cpp | 48343 | itemGate.cpp | 48763 | +| cellPyramid.cpp | 51345 | pelletCarcass.cpp | 55314 | ###
plugProjectKonoU
| File | Size (bytes) | File | Size (bytes) | diff --git a/include/Game/StateMachine.h b/include/Game/StateMachine.h index 344793fdc..8fcee5828 100644 --- a/include/Game/StateMachine.h +++ b/include/Game/StateMachine.h @@ -47,29 +47,9 @@ struct StateMachine { obj->mCurrentState = nullptr; transit(obj, stateID, arg); } - virtual void exec(T* obj) // _10 - { - if (obj->mCurrentState != nullptr) { - obj->mCurrentState->exec(obj); - } - } - virtual void transit(T* obj, int stateID, StateArg* arg) // _14 - { - int index = mIdToIndexArray[stateID]; - T::StateType* state = obj->mCurrentState; - if (state) { - state->cleanup(obj); - mCurrentID = state->mId; - } - - ASSERT_HANG(index < mLimit); - - state = static_cast(mStates[index]); - obj->mCurrentState = state; - state->init(obj, arg); - } - + virtual void exec(T* obj); // _10 void create(int limit); + virtual void transit(T* obj, int stateID, StateArg* arg); // _14 void registerState(FSMState* state); @@ -94,6 +74,22 @@ void StateMachine::create(int limit) mIdToIndexArray = new int[mLimit]; } template +void StateMachine::transit(T* obj, int stateID, StateArg* arg) +{ + int index = mIdToIndexArray[stateID]; + T::StateType* state = obj->mCurrentState; + if (state) { + state->cleanup(obj); + mCurrentID = state->mId; + } + + ASSERT_HANG(index < mLimit); + + state = static_cast(mStates[index]); + obj->mCurrentState = state; + state->init(obj, arg); +} +template void StateMachine::registerState(FSMState* state) { if (mLimit <= mCount) { @@ -108,6 +104,13 @@ void StateMachine::registerState(FSMState* state) mIdToIndexArray[state->mId] = mCount; mCount++; } +template +void StateMachine::exec(T* obj) +{ + if (obj->mCurrentState != nullptr) { + obj->mCurrentState->exec(obj); + } +} } // namespace Game #endif