1#include "Game/LiveActor/LiveActor.hpp"
2#include "Game/LiveActor/AllLiveActorGroup.hpp"
3#include "Game/LiveActor/Binder.hpp"
4#include "Game/LiveActor/ClippingDirector.hpp"
5#include "Game/LiveActor/ActorPadAndCameraCtrl.hpp"
6#include "Game/NameObj/NameObjExecuteHolder.hpp"
7#include "Game/Util.hpp"
10 mPosition(0.0f), mRotation(0.0f), mScale(1.0f), mVelocity(0.0f), mGravity(0.0f, -1.0f, 0.0f),
11 mModelManager(nullptr), mAnimationKeeper(nullptr), mSpine(nullptr),
12 mSensorKeeper(nullptr), mBinder(nullptr), mRailRider(nullptr),
13 mEffectKeeper(nullptr), mSoundObject(nullptr) {
15 mShadowList =
nullptr;
16 mCollisionParts =
nullptr;
18 mStarPointerTarget =
nullptr;
19 mActorLightCtrl =
nullptr;
20 mCameraCtrl =
nullptr;
22 MR::getAllLiveActorGroup()->registerActor(
this);
23 MR::getClippingDirector()->registerActor(
this);
30void LiveActor::appear() {
34void LiveActor::makeActorAppeared() {
39 if (MR::isClipped(
this)) {
44 if (mCollisionParts) {
45 MR::validateCollisionParts(
this);
48 MR::resetPosition(
this);
49 if (mActorLightCtrl) {
50 mActorLightCtrl->reset();
53 MR::tryUpdateHitSensorsAll(
this);
54 MR::addToClippingTarget(
this);
55 MR::connectToSceneTemporarily(
this);
57 if (!MR::isNoEntryDrawBuffer(
this)) {
58 MR::connectToDrawTemporarily(
this);
62void LiveActor::kill() {
67void LiveActor::makeActorDead() {
71 MR::clearHitSensors(
this);
82 mEffectKeeper->clear();
85 if (mCollisionParts) {
86 MR::invalidateCollisionParts(
this);
90 MR::removeFromClippingTarget(
this);
91 MR::disconnectToSceneTemporarily(
this);
92 MR::disconnectToDrawTemporarily(
this);
96MtxPtr LiveActor::getTakingMtx()
const {
100void LiveActor::setNerve(
const Nerve *pNerve) {
101 mSpine->setNerve(pNerve);
104bool LiveActor::isNerve(
const Nerve *pNerve)
const {
105 return mSpine->getCurrentNerve() == pNerve;
108s32 LiveActor::getNerveStep()
const {
109 return mSpine->mStep;
121 if (!MR::getJ3DModel(
this)) {
125 return MR::getJ3DModel(
this)->_24;
130void LiveActor::startClipped() {
136 keeper->invalidateBySystem();
141 effectKeeper->stopEmitterOnClipped();
144 MR::disconnectToSceneTemporarily(
this);
146 if (!MR::isNoEntryDrawBuffer(
this)) {
147 MR::disconnectToDrawTemporarily(
this);
151void LiveActor::endClipped() {
152 mFlags.mIsClipped =
false;
156 MR::updateHitSensorsAll(
this);
160 mEffectKeeper->playEmitterOffClipped();
163 MR::connectToSceneTemporarily(
this);
165 if (!MR::isNoEntryDrawBuffer(
this)) {
166 MR::connectToDrawTemporarily(
this);
171void LiveActor::initModelManagerWithAnm(
const char *pName,
const char *a2,
bool a3) {
174 MR::getJ3DModel(
this)->setBaseScale(
reinterpret_cast<const Vec &
>(
mScale));
176 MR::calcJ3DModel(
this);
181void LiveActor::initNerve(
const Nerve *pNerve) {
182 mSpine =
new Spine(
this, pNerve);
185void LiveActor::initHitSensor(
int numSensors) {
191void LiveActor::initRailRider(
const JMapInfoIter &rIter) {
196void LiveActor::initEffectKeeper(
int a1,
const char *a2,
bool doSort) {
198 mEffectKeeper = keeper;
201 keeper->enableSort();
207 keeper->setBinder(mBinder);
214void LiveActor::initShadowControllerList(u32 numShadows) {
220void LiveActor::initStageSwitch(
const JMapInfoIter &rIter) {
226void LiveActor::initActorLightCtrl() {
235 MR::setHitSensorApart(pSensor_0, pSensor_1);
RailRider * mRailRider
A pointer to a RailRider instance, used for allowing the actor to ride on paths.
HitSensorKeeper * mSensorKeeper
A pointer to a HitSensorKeeper instance, used for storing HitSensor instances.
TVec3f mPosition
3D vector of the actor's position.
LiveActor(const char *pName)
Constructs a new LiveActor instance.
TVec3f mScale
3D vector of the actor's scale.
TVec3f mVelocity
3D vector of the actor's velocity.
StageSwitchCtrl * mStageSwitchCtrl
A pointer to a StageSwitchCtrl instance, used for activating and deactivating switches.
LiveActorFlag mFlags
Flags relating to drawing, animation calculation, etc.
virtual void init(JMapInfoIter const &)
Intializes the NameObj and can set various settings and construct necessary classes.
virtual void calcAndSetBaseMtx()
Calculates and sets the base matrix of the actor.
ModelManager * mModelManager
A pointer to a ModelManager instance, used for drawing a 3D model.
ActorAnimKeeper * mAnimationKeeper
A pointer to a ActorAnimKeeper instance, used for storing and playing model animations.
virtual MtxPtr getBaseMtx() const
Gets the base matrix of the model used for the actor.
HitSensor * getSensor(const char *pSensorName) const
Gets a sensor.
The most basic form of an object.
const char * mName
A string to identify the NameObj.
Used for executing states of a LiveActor.