SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
DeadLeaves.cpp
1#include "Game/MapObj/DeadLeaves.hpp"
2#include "Game/MapObj/MapObjActorInitInfo.hpp"
3
4DeadLeaves::DeadLeaves(const char *pName) : MapObjActor(pName) {
5 mItemType = -1;
6}
7
8void DeadLeaves::init(const JMapInfoIter &rIter) {
11 MapObjActorUtil::setupInitInfoSimpleMapObj(&info);
12 info.setupHitSensor();
13 TVec3f sensor;
14 sensor.x = 0.0f;
15 sensor.y = 30.0f;
16 sensor.z = 0.0f;
17 info.setupHitSensorParam(8, 70.0f, sensor);
18 info.setupNerve(&NrvDeadLeaves::DeadLeavesNrvWait::sInstance);
19 initialize(rIter, info);
20 MR::getJMapInfoArg0NoInit(rIter, &mItemType);
21
22 if (mItemType == 0) {
23 MR::declareCoin(this, 1);
24 }
25 else if (mItemType == 1) {
26 MR::declareStarPiece(this, 3);
27 }
28}
29
30void DeadLeaves::exeSpin() {
31 if (MR::isFirstStep(this)) {
32 MR::startAllAnim(this, "Spin");
33 MR::startSound(this, "SE_OJ_LEAVES_SWING", -1, -1);
34
35 if (mItemType == 0) {
36 MR::appearCoinPop(this, mPosition, 1);
37 }
38 else if (mItemType == 1) {
39 bool appear = MR::appearStarPiece(this, mPosition, 3, 10.0f, 40.0f, false);
40 if (appear) {
41 MR::startSound(this, "SE_OJ_STAR_PIECE_BURST", -1, -1);
42 }
43 }
44 }
45
46 if (MR::isBckStopped(this)) {
47 setNerve(&NrvDeadLeaves::DeadLeavesNrvWait::sInstance);
48 }
49}
50
51bool DeadLeaves::receiveMsgPlayerAttack(u32 msg, HitSensor *, HitSensor *) {
52 if (MR::isMsgPlayerSpinAttack(msg)) {
53 setNerve(&NrvDeadLeaves::DeadLeavesNrvSpin::sInstance);
54 return 1;
55 }
56
57 return 0;
58}
59
60DeadLeaves::~DeadLeaves() {
61
62}
63
64namespace NrvDeadLeaves {
65 INIT_NERVE(DeadLeavesNrvWait);
66 INIT_NERVE(DeadLeavesNrvSpin);
67
68 void DeadLeavesNrvSpin::execute(Spine *pSpine) const {
69 DeadLeaves* leaves = reinterpret_cast<DeadLeaves*>(pSpine->mExecutor);
70 leaves->exeSpin();
71 }
72
73 void DeadLeavesNrvWait::execute(Spine *pSpine) const {
74
75 }
76};
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition DeadLeaves.cpp:8
TVec3f mPosition
3D vector of the actor's position.
Definition LiveActor.hpp:95
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition Spine.hpp:9