SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
Fountain.cpp
1#include "Game/MapObj/Fountain.hpp"
2
3Fountain::Fountain(const char *pName) : LiveActor(pName) {
4 mFountainName = nullptr;
5 _90.x = 0.0f;
6 _90.y = 1.0f;
7 _90.z = 0.0f;
8}
9
10#ifdef NON_MATCHING
11void Fountain::init(const JMapInfoIter &rIter) {
12 MR::initDefaultPos(this, rIter);
13 TMtx34f mtx;
14 mtx.identity();
15 TVec3f v30 = mRotation * 0.017453292f;
16 f32 v10 = v30.z;
17 f32 v11 = v30.y;
18 f32 v12 = v30.x;
19 f32 v13 = cos(v30.z);
20 f32 v14 = cos(v11);
21 f32 v15 = cos(v12);
22 f32 v16 = sin(v10);
23 f32 v17 = sin(v11);
24 f32 v18 = sin(v12);
25 f32 v19 = v18;
26 f32 v20 = (v18 * v14);
27 mtx.mMtx[0][0] = v14 * v13;
28 mtx.mMtx[2][1] = v18 * v14;
29 mtx.mMtx[1][0] = v14 * v16;
30 f32 v21 = ((v15 * v13) + ((v18 * v17) * v16));
31 f32 v22 = (((v18 * v17) * v13) - (v15 * v16));
32 mtx.mMtx[1][1] = v21;
33 mtx.mMtx[0][1] = v22;
34 mtx.mMtx[0][2] = ((v15 * v13) * v17) + (v19 * v16);
35 mtx.mMtx[2][0] = -v17;
36 mtx.mMtx[2][2] = v15 * v14;
37 mtx.mMtx[1][2] = ((v15 * v16) * v17) - (v19 * v13);
38
39 _90.set<f32>(v22, v21, v20);
40 MR::normalize(&_90);
41 MR::getObjectName(&mFountainName, rIter);
42 initEffectKeeper(0, mFountainName, false);
43 initSound(4, false);
44 initHitSensor(1);
45 TVec3f offs;
46 offs.x = 0.0f;
47 offs.y = 300.0f;
48 offs.z = 0.0f;
49 MR::addHitSensorMapObj(this, "body", 0x10, 300.0f, offs);
50 MR::setClippingTypeSphere(this, 3500.0f);
51 MR::useStageSwitchReadA(this, rIter);
52 initNerve(&NrvFountain::HostTypeMove::sInstance);
53 MR::connectToSceneMapObjMovement(this);
54
55 if (MR::useStageSwitchReadAppear(this, rIter)) {
56 MR::syncStageSwitchAppear(this);
57 makeActorDead();
58 }
59 else {
60 appear();
61 }
62}
63#endif
64
65void Fountain::appear() {
66 LiveActor::appear();
67
68 if (MR::isValidSwitchA(this)) {
69 setNerve(&NrvFountain::HostTypeWait::sInstance);
70 }
71 else {
72 setNerve(&NrvFountain::HostTypeMove::sInstance);
73 }
74}
75
76void Fountain::startClipped() {
77 LiveActor::startClipped();
78
79 if (!isNerve(&NrvFountain::HostTypeWait::sInstance)) {
80 MR::deleteEffectAll(this);
81 }
82}
83
84
85void Fountain::endClipped() {
86 LiveActor::endClipped();
87
88 if (!isNerve(&NrvFountain::HostTypeWait::sInstance)) {
89 MR::emitEffect(this, mFountainName);
90 }
91}
92
93// Fountain::attackSensor
94
95void Fountain::exeWait() {
96 if (MR::isFirstStep(this)) {
97 MR::invalidateHitSensor(this, "body");
98 }
99
100 if (MR::isOnSwitchA(this)) {
101 setNerve(&NrvFountain::HostTypeMove::sInstance);
102 }
103}
104
105void Fountain::exeMove() {
106 if (MR::isFirstStep(this)) {
107 MR::validateHitSensor(this, "body");
108 MR::emitEffect(this, mFountainName);
109 }
110
111 MR::startLevelSound(this, "SE_OJ_LV_FOUNTAIN", -1, -1, -1);
112}
113
114Fountain::~Fountain() {
115
116}
117
118namespace NrvFountain {
119 INIT_NERVE(HostTypeWait);
120 INIT_NERVE(HostTypeMove);
121};
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
The basis of a drawable actor that can contain states (see: Nerve)
Definition LiveActor.hpp:24
TVec3f mRotation
3D vector of the actor's rotation.
Definition LiveActor.hpp:96