more ActorStateUtil decompilation

This commit is contained in:
shibbo 2020-06-28 18:58:54 -04:00
parent 5e494907da
commit 61410f7fbe
3 changed files with 61 additions and 2 deletions

View File

@ -3,11 +3,16 @@
#include <revolution.h>
#include "Actor/Nerve/NerveExecutor.h"
#include "Actor/State/ActorStateKeeper.h"
class LiveActor;
namespace MR
{
void initActorStateKeeper(NerveExecutor *, s32);
void initActorState(NerveExecutor *, ActorStateBaseInterface *, const Nerve *, const char *);
bool updateActorState(LiveActor *, ActorStateBaseInterface *);
bool updateActorStateAndNextNerve(LiveActor *, ActorStateBaseInterface *, const Nerve *);
bool updateActorState(NerveExecutor *);
};

View File

@ -2,6 +2,7 @@
#define LIVEACTORUTIL_H
#include <revolution.h>
#include "JGeometry/TVec3.h"
#include "JMap/JMapInfoIter.h"
#include "System/Resource/ResourceHolder.h"

View File

@ -1,5 +1,6 @@
#include "MR/actor/ActorStateUtil.h"
#include "Actor/State/ActorStateKeeper.h"
#include "MR/actor/LiveActorUtil.h"
#include "Actor/LiveActor/LiveActor.h"
namespace MR
{
@ -8,6 +9,58 @@ namespace MR
pExecutor->mSpine->initStateKeeper(stateCount);
}
void initActorState(NerveExecutor *pExecutor, ActorStateBaseInterface *pStateBase, const Nerve *pNerve, const char *pStateName)
{
pStateBase->init();
pExecutor->mSpine->mStateKeeper->addState(pStateBase, pNerve, pStateName);
}
bool updateActorState(LiveActor *pActor, ActorStateBaseInterface *pStateBase)
{
bool ret;
if (MR::isFirstStep(pActor))
{
pStateBase->appear();
}
bool res = pStateBase->update();
if (res)
{
if (!pStateBase->mIsDead)
{
pStateBase->kill();
}
ret = true;
}
else
{
ret = false;
}
return ret;
}
bool updateActorStateAndNextNerve(LiveActor *pActor, ActorStateBaseInterface *pStateBase, const Nerve *pNerve)
{
bool ret;
bool needsNerveUpdate = updateActorState(pActor, pStateBase);
if (needsNerveUpdate)
{
pActor->setNerve(pNerve);
ret = true;
}
else
{
ret = false;
}
return ret;
}
bool updateActorState(NerveExecutor *pExecutor)
{
return pExecutor->mSpine->mStateKeeper->updateCurrentState();