SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
RotateMoveObj.cpp
1#include "Game/MapObj/RotateMoveObj.hpp"
2#include "Game/MapObj/StageEffectDataTable.hpp"
3#include "Game/MapObj/MapPartsRotator.hpp"
4
5void RotateMoveObj::init(const JMapInfoIter &rIter) {
8 MapObjActorUtil::setupInitInfoSimpleMapObj(&info);
9 info.setupRotator();
10 info.setupBaseMtxFollowTarget();
11 info.setupNerve(&NrvMapObjActor::HostTypeWait::sInstance);
12 MapObjActorUtil::setupInitInfoColorChangeArg0(&info, rIter);
13 MapObjActorUtil::setupInitInfoTextureChangeArg1(&info, rIter);
14 MapObjActorUtil::setupInitInfoTypical(&info, mObjectName);
15 initialize(rIter, info);
16
17 bool v5 = true;
18 s32 condType = 0;
19 MR::getMapPartsArgMoveConditionType(&condType, rIter);
20
21 if (!MR::isMoveStartTypeUnconditional(condType)) {
22 setNerve(&NrvRotateMoveObj::HostTypeWaitForPlayerOn::sInstance);
23 v5 = false;
24 }
25
26 if (MR::isDemoCast(this, nullptr)) {
27 MR::FunctorV0M<RotateMoveObj *, void (RotateMoveObj::*)()> setStateFunc = MR::Functor<RotateMoveObj>(this, &RotateMoveObj::setStateMove);
28
29 if (MR::tryRegisterDemoActionFunctor(this, setStateFunc, nullptr)) {
30 v5 = false;
31 }
32 }
33
34 if (MR::isValidSwitchB(this)) {
35 v5 = false;
36 }
37
38 if (v5) {
39 startMapPartsFunctions();
40 setNerve(&NrvRotateMoveObj::HostTypeMove::sInstance);
41 }
42}
43
44/*
45void RotateMoveObj::initCaseUseSwitchB(const MapObjActorInitInfo &rInfo) {
46 MR::FunctorV0M<RotateMoveObj *, void (RotateMoveObj::*)()> setFunc = MR::Functor<RotateMoveObj>(this, &RotateMoveObj::setStateMove);
47 MR::listenStageSwitchOnOffB(this, MR::FunctorV0M<RotateMoveObj *, void (RotateMoveObj::*)(void)>(this, &RotateMoveObj::pauseMapPartsFunctions), setFunc);
48}*/
49
50void RotateMoveObj::initCaseNoUseSwitchB(const MapObjActorInitInfo &rInfo) {
51
52}
53
54void RotateMoveObj::setStateMove() {
55 if (MR::isRegisteredEffect(this, "Appear")) {
56 MR::emitEffect(this, "Appear");
57 }
58
59 startMapPartsFunctions();
60 setNerve(&NrvMapObjActor::HostTypeMove::sInstance);
61}
62
63void RotateMoveObj::exeMove() {
64 if (MR::isFirstStep(this)) {
65 MR::StageEffect::tryStageEffectStart(this, mObjectName);
66 }
67
68 if (!MapObjActorUtil::isRotatorMoving(this)) {
69 setNerve(&NrvRotateMoveObj::HostTypeStop::sInstance);
70 }
71 else {
72 if (mRotator->_14) {
73 if (MR::isEqualString(mObjectName, "OceanRingRuinsGearBig") || MR::isEqualString(mObjectName, "OceanRingRuinsGearSmall")) {
74 if (mRotator->getRotateSpeed() != 0.0f) {
75 MR::StageEffect::tryStageEffectMoving(this, mObjectName);
76 }
77 }
78 else {
79 MR::StageEffect::tryStageEffectMoving(this, mObjectName);
80 }
81 }
82 }
83}
84
85void RotateMoveObj::exeStop() {
86 if (MapObjActorUtil::isRotatorMoving(this)) {
87 setNerve(&NrvRotateMoveObj::HostTypeMove::sInstance);
88 }
89 else if (MR::isFirstStep(this)) {
90 MR::StageEffect::tryStageEffectStop(this, mObjectName);
91 }
92}
93
94void RotateMoveObj::exeWaitForPlayerOn() {
95 if (MR::isOnPlayer(this)) {
96 setStateMove();
97 }
98}
99
100namespace NrvRotateMoveObj {
101 INIT_NERVE(HostTypeWaitForPlayerOn);
102 INIT_NERVE(HostTypeWait);
103 INIT_NERVE(HostTypeMove);
104 INIT_NERVE(HostTypeStop);
105};
106
107RotateMoveObj::~RotateMoveObj() {
108
109}
110
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.