2023-12-13 00:40:16 -05:00
|
|
|
#include "Game/LiveActor/LiveActor.hpp"
|
|
|
|
|
#include "Game/LiveActor/AllLiveActorGroup.hpp"
|
|
|
|
|
#include "Game/LiveActor/Binder.hpp"
|
|
|
|
|
#include "Game/LiveActor/ClippingDirector.hpp"
|
|
|
|
|
#include "Game/LiveActor/ActorPadAndCameraCtrl.hpp"
|
2024-03-25 19:37:30 -04:00
|
|
|
#include "Game/LiveActor/RailRider.hpp"
|
2023-12-13 00:40:16 -05:00
|
|
|
#include "Game/NameObj/NameObjExecuteHolder.hpp"
|
|
|
|
|
#include "Game/Util.hpp"
|
2021-12-13 21:03:30 -05:00
|
|
|
|
2023-07-07 00:41:49 -04:00
|
|
|
LiveActor::LiveActor(const char* pName) : NameObj(pName),
|
|
|
|
|
mPosition(0.0f), mRotation(0.0f), mScale(1.0f), mVelocity(0.0f), mGravity(0.0f, -1.0f, 0.0f),
|
|
|
|
|
mModelManager(nullptr), mAnimationKeeper(nullptr), mSpine(nullptr),
|
|
|
|
|
mSensorKeeper(nullptr), mBinder(nullptr), mRailRider(nullptr),
|
|
|
|
|
mEffectKeeper(nullptr), mSoundObject(nullptr) {
|
|
|
|
|
|
|
|
|
|
mShadowList = nullptr;
|
|
|
|
|
mCollisionParts = nullptr;
|
|
|
|
|
mStageSwitchCtrl = nullptr;
|
|
|
|
|
mStarPointerTarget = nullptr;
|
|
|
|
|
mActorLightCtrl = nullptr;
|
|
|
|
|
mCameraCtrl = nullptr;
|
|
|
|
|
|
|
|
|
|
MR::getAllLiveActorGroup()->registerActor(this);
|
|
|
|
|
MR::getClippingDirector()->registerActor(this);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-13 21:03:30 -05:00
|
|
|
void LiveActor::init(const JMapInfoIter &) {
|
|
|
|
|
|
2021-12-22 03:23:24 -05:00
|
|
|
}
|
2021-12-13 21:03:30 -05:00
|
|
|
|
|
|
|
|
void LiveActor::appear() {
|
|
|
|
|
makeActorAppeared();
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-28 00:50:22 -05:00
|
|
|
void LiveActor::makeActorAppeared() {
|
|
|
|
|
if (mSensorKeeper) {
|
|
|
|
|
mSensorKeeper->validateBySystem();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MR::isClipped(this)) {
|
|
|
|
|
endClipped();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mFlags.mIsDead = false;
|
|
|
|
|
if (mCollisionParts) {
|
|
|
|
|
MR::validateCollisionParts(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MR::resetPosition(this);
|
|
|
|
|
if (mActorLightCtrl) {
|
|
|
|
|
mActorLightCtrl->reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MR::tryUpdateHitSensorsAll(this);
|
|
|
|
|
MR::addToClippingTarget(this);
|
|
|
|
|
MR::connectToSceneTemporarily(this);
|
|
|
|
|
|
|
|
|
|
if (!MR::isNoEntryDrawBuffer(this)) {
|
|
|
|
|
MR::connectToDrawTemporarily(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LiveActor::kill() {
|
|
|
|
|
makeActorDead();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef NON_MATCHING
|
|
|
|
|
void LiveActor::makeActorDead() {
|
|
|
|
|
mVelocity.z = 0.0f;
|
|
|
|
|
mVelocity.y = 0.0f;
|
|
|
|
|
mVelocity.x = 0.0f;
|
|
|
|
|
MR::clearHitSensors(this);
|
|
|
|
|
|
|
|
|
|
if (mSensorKeeper) {
|
|
|
|
|
mSensorKeeper->invalidateBySystem();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mBinder) {
|
|
|
|
|
mBinder->clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mEffectKeeper) {
|
|
|
|
|
mEffectKeeper->clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mCollisionParts) {
|
|
|
|
|
MR::invalidateCollisionParts(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mFlags.mIsDead = true;
|
|
|
|
|
MR::removeFromClippingTarget(this);
|
|
|
|
|
MR::disconnectToSceneTemporarily(this);
|
|
|
|
|
MR::disconnectToDrawTemporarily(this);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-12-22 03:23:24 -05:00
|
|
|
MtxPtr LiveActor::getTakingMtx() const {
|
|
|
|
|
return getBaseMtx();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LiveActor::setNerve(const Nerve *pNerve) {
|
|
|
|
|
mSpine->setNerve(pNerve);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool LiveActor::isNerve(const Nerve *pNerve) const {
|
|
|
|
|
return mSpine->getCurrentNerve() == pNerve;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-12 02:02:54 -04:00
|
|
|
s32 LiveActor::getNerveStep() const {
|
2021-12-22 03:23:24 -05:00
|
|
|
return mSpine->mStep;
|
|
|
|
|
}
|
2021-12-23 05:03:29 -05:00
|
|
|
|
2021-12-22 03:23:24 -05:00
|
|
|
HitSensor* LiveActor::getSensor(const char *pSensorName) const {
|
|
|
|
|
if (mSensorKeeper) {
|
|
|
|
|
return mSensorKeeper->getSensor(pSensorName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 23:37:55 -05:00
|
|
|
MtxPtr LiveActor::getBaseMtx() const {
|
|
|
|
|
if (!MR::getJ3DModel(this)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return MR::getJ3DModel(this)->_24;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef NON_MATCHING
|
|
|
|
|
// prologue refuses to schedule right for both of these
|
|
|
|
|
void LiveActor::startClipped() {
|
2023-01-17 14:02:51 -05:00
|
|
|
HitSensorKeeper* keeper = mSensorKeeper;
|
2021-12-27 23:37:55 -05:00
|
|
|
|
2023-01-17 14:02:51 -05:00
|
|
|
mFlags.onClipped();
|
|
|
|
|
|
|
|
|
|
if (keeper != 0) {
|
|
|
|
|
keeper->invalidateBySystem();
|
2021-12-27 23:37:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectKeeper* effectKeeper = mEffectKeeper;
|
|
|
|
|
if (effectKeeper) {
|
|
|
|
|
effectKeeper->stopEmitterOnClipped();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MR::disconnectToSceneTemporarily(this);
|
2023-01-17 14:02:51 -05:00
|
|
|
|
2021-12-27 23:37:55 -05:00
|
|
|
if (!MR::isNoEntryDrawBuffer(this)) {
|
|
|
|
|
MR::disconnectToDrawTemporarily(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LiveActor::endClipped() {
|
|
|
|
|
mFlags.mIsClipped = false;
|
|
|
|
|
|
|
|
|
|
if (mSensorKeeper) {
|
|
|
|
|
mSensorKeeper->validateBySystem();
|
|
|
|
|
MR::updateHitSensorsAll(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mEffectKeeper) {
|
|
|
|
|
mEffectKeeper->playEmitterOffClipped();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MR::connectToSceneTemporarily(this);
|
|
|
|
|
|
|
|
|
|
if (!MR::isNoEntryDrawBuffer(this)) {
|
|
|
|
|
MR::connectToDrawTemporarily(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void LiveActor::initModelManagerWithAnm(const char *pName, const char *a2, bool a3) {
|
|
|
|
|
mModelManager = new ModelManager();
|
|
|
|
|
mModelManager->init(pName, a2, a3);
|
|
|
|
|
MR::getJ3DModel(this)->setBaseScale(reinterpret_cast<const Vec &>(mScale));
|
|
|
|
|
LiveActor::calcAndSetBaseMtx();
|
|
|
|
|
MR::calcJ3DModel(this);
|
|
|
|
|
mAnimationKeeper = ActorAnimKeeper::tryCreate(this);
|
|
|
|
|
mCameraCtrl = ActorPadAndCameraCtrl::tryCreate(mModelManager, &mPosition);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-22 03:23:24 -05:00
|
|
|
void LiveActor::initNerve(const Nerve *pNerve) {
|
|
|
|
|
mSpine = new Spine(this, pNerve);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LiveActor::initHitSensor(int numSensors) {
|
|
|
|
|
mSensorKeeper = new HitSensorKeeper(numSensors);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 23:37:55 -05:00
|
|
|
// LiveActor::initBinder
|
|
|
|
|
|
|
|
|
|
void LiveActor::initRailRider(const JMapInfoIter &rIter) {
|
|
|
|
|
mRailRider = new RailRider(rIter);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-28 00:50:22 -05:00
|
|
|
#ifdef NON_MATCHING
|
2021-12-27 23:37:55 -05:00
|
|
|
void LiveActor::initEffectKeeper(int a1, const char *a2, bool doSort) {
|
2021-12-28 00:50:22 -05:00
|
|
|
EffectKeeper* keeper = new EffectKeeper(mName, MR::getModelResourceHolder(this), a1, a2);
|
|
|
|
|
mEffectKeeper = keeper;
|
2021-12-27 23:37:55 -05:00
|
|
|
|
|
|
|
|
if (doSort) {
|
2021-12-28 00:50:22 -05:00
|
|
|
keeper->enableSort();
|
2021-12-27 23:37:55 -05:00
|
|
|
}
|
|
|
|
|
|
2021-12-28 00:50:22 -05:00
|
|
|
keeper->init(this);
|
2021-12-27 23:37:55 -05:00
|
|
|
|
|
|
|
|
if (mBinder) {
|
2021-12-28 00:50:22 -05:00
|
|
|
keeper->setBinder(mBinder);
|
2021-12-27 23:37:55 -05:00
|
|
|
}
|
|
|
|
|
}
|
2021-12-28 00:50:22 -05:00
|
|
|
#endif
|
2021-12-27 23:37:55 -05:00
|
|
|
|
|
|
|
|
// LiveActor::initSound
|
|
|
|
|
|
2021-12-22 03:23:24 -05:00
|
|
|
void LiveActor::initShadowControllerList(u32 numShadows) {
|
|
|
|
|
mShadowList = new ShadowControllerList(this, numShadows);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 23:37:55 -05:00
|
|
|
// LiveActor::initActorCollisionParts
|
|
|
|
|
|
|
|
|
|
void LiveActor::initStageSwitch(const JMapInfoIter &rIter) {
|
|
|
|
|
mStageSwitchCtrl = MR::createStageSwitchCtrl(this, rIter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LiveActor::initActorStarPointerTarget
|
|
|
|
|
|
2021-12-22 03:23:24 -05:00
|
|
|
void LiveActor::initActorLightCtrl() {
|
|
|
|
|
mActorLightCtrl = new ActorLightCtrl(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LiveActor::attackSensor(HitSensor *, HitSensor *) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 23:37:55 -05:00
|
|
|
u32 LiveActor::receiveMsgApart(HitSensor *pSensor_0, HitSensor *pSensor_1) {
|
|
|
|
|
MR::setHitSensorApart(pSensor_0, pSensor_1);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|