SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
UFOKinoko.cpp
1#include "Game/MapObj/UFOKinoko.hpp"
2#include "Game/MapObj/MapObjActor.hpp"
3#include "Game/MapObj/MapObjActorInitInfo.hpp"
4#include "Game/MapObj/StageEffectDataTable.hpp"
5
6UFOKinoko::UFOKinoko(const char *pName) : MapObjActor(pName) {
7
8}
9
10UFOKinoko::~UFOKinoko() {
11
12}
13
14void UFOKinoko::init(const JMapInfoIter &rIter) {
15 MapObjActor::init(rIter);
16 s32 argShadowType = -1;
17 MR::getMapPartsArgShadowType(&argShadowType, rIter);
18 bool hasShadow = !MR::isMapPartsShadowTypeNone(argShadowType);
20 info.setupHioNode("地形オブジェ");
21 info.setupDefaultPos();
22 info.setupConnectToScene();
23 info.setupEffect(nullptr);
24 info.setupSound(4);
25 info.setupGroupClipping(64);
26 info.setupSeAppear();
27 info.setupRailMover();
28 info.setupRotator();
29 info.setupBaseMtxFollowTarget();
30 info.setupNerve(&NrvUFOKinoko::HostTypeWait::sInstance);
31 if (hasShadow) {
32 info.setupShadow(nullptr);
33 }
34 MapObjActorUtil::setupInitInfoColorChangeArg0(&info, rIter);
35 bool arg7 = true;
36 MR::getJMapInfoArg7NoInit(rIter, &arg7);
37 if (arg7) {
38 info.setupNouseLodCtrl();
39 }
40 initialize(rIter, info);
41 MapObjActorUtil::startRotator(this);
42 if (MR::isDemoCast(this, nullptr)) {
43 MR::FunctorV0M<UFOKinoko *, void (UFOKinoko::*)()> functor = MR::Functor<UFOKinoko>(this, &UFOKinoko::startMove);
44 MR::tryRegisterDemoActionFunctor(this, functor, "UFOキノコ登場");
45 }
46}
47
48void UFOKinoko::control() {
49 MapObjActor::control();
50 MR::StageEffect::tryStageEffectMoving(this, mObjectName);
51}
52
53void UFOKinoko::initCaseUseSwitchB(const MapObjActorInitInfo &) {
54 MR::FunctorV0M<UFOKinoko *, void (UFOKinoko::*)()> functor = MR::Functor<UFOKinoko>(this, &UFOKinoko::startMove);
55 MR::listenStageSwitchOnB(this, functor);
56}
57
58void UFOKinoko::initCaseNoUseSwitchB(const MapObjActorInitInfo &) {
59
60}
61
62void UFOKinoko::startMove() {
63 if (mRailMover != nullptr) {
64 MapObjActorUtil::startRailMover(this);
65 }
66 setNerve(&NrvUFOKinoko::HostTypeMove::sInstance);
67}
68
69void UFOKinoko::makeArchiveList(NameObjArchiveListCollector *pArchiveList, const JMapInfoIter &rIter) {
70 bool arg7 = false;
71 MR::getJMapInfoArg7NoInit(rIter, &arg7);
72 if (arg7) {
73 pArchiveList->addArchive("UFOKinokoLow");
74 }
75}
76
77void UFOKinoko::exeMove() {
78 if (MR::isFirstStep(this)) {
79 MR::StageEffect::tryStageEffectStart(this, mObjectName);
80 MR::startSound(this, "SE_OJ_UFO_KINOKO_MOVE_ST", -1, -1);
81 }
82 MR::startLevelSound(this, "SE_OJ_LV_UFO_KINOKO_MOVE", -1, -1, -1);
83 if (mRailMover != nullptr && !MapObjActorUtil::isRailMoverWorking(this)) {
84 setNerve(&NrvUFOKinoko::HostTypeStop::sInstance);
85 }
86}
87
88void UFOKinoko::exeStop() {
89 if (MR::isFirstStep(this)) {
90 MR::startSound(this, "SE_OJ_UFO_KINOKO_MOVE_ED", -1, -1);
91 MR::StageEffect::tryStageEffectStop(this, mObjectName);
92 }
93}
94
95namespace NrvUFOKinoko {
96 INIT_NERVE(HostTypeWait)
97 INIT_NERVE(HostTypeMove)
98 INIT_NERVE(HostTypeStop)
99
100 void HostTypeWait::execute(Spine *pSpine) const {
101
102 }
103 void HostTypeMove::execute(Spine *pSpine) const {
104 UFOKinoko* ufo = reinterpret_cast<UFOKinoko*>(pSpine->mExecutor);
105 ufo->exeMove();
106 }
107 void HostTypeStop::execute(Spine *pSpine) const {
108 UFOKinoko* ufo = reinterpret_cast<UFOKinoko*>(pSpine->mExecutor);
109 ufo->exeStop();
110 }
111};
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Stores archive names of NameObjs.
Definition Spine.hpp:9
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition UFOKinoko.cpp:14