SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
DashRing.cpp
1#include "Game/MapObj/DashRing.hpp"
2
3DashRing::~DashRing() {
4
5}
6
7void DashRing::initCommon(const JMapInfoIter &rIter, const char *pName) {
8 MR::initDefaultPos(this, rIter);
9 _A4 = 0;
10 _A6 = 0;
11 _B4 = 0;
12
13 if (pName) {
14 initModelManagerWithAnm(pName, nullptr, false);
15 MR::connectToSceneMapObj(this);
16 _B4 = 1;
17 }
18 else {
19 MR::connectToScene(this, 34, -1, -1, 56);
20 }
21
22 initHitSensor(1);
23 MR::addHitSensorMapObj(this, "body", 4, 1000.0f, TVec3f(0.0f, 0.0f, 0.0f));
24 MR::validateClipping(this);
25 calcAxis();
26
27 _A8 = 300;
28 _AC = 120;
29 _B0 = 2.5f;
30 _B5 = 1;
31
32 if (MR::checkJMapDataEntries(rIter)) {
33 s32 arg0 = -1;
34 s32 arg1 = -1;
35 s32 arg2 = -1;
36
37 MR::getJMapInfoArg0NoInit(rIter, &arg0);
38 MR::getJMapInfoArg1NoInit(rIter, &arg1);
39
40 if (arg0 != -1) {
41 _A8 = arg0;
42 }
43
44 if (arg1 != -1) {
45 _AC = arg1;
46 }
47
48 if (MR::getJMapInfoArg2NoInit(rIter, &arg2) && arg2 != -1) {
49 _B0 = arg2 / 100.0f;
50 }
51
52 s32 arg3 = -1;
53 MR::getJMapInfoArg3NoInit(rIter, &arg3);
54
55 if (arg3 != -1) {
56 _B5 = 0;
57 }
58 }
59
60 initSound(3, false);
61 initEffectKeeper(3, nullptr, false);
62 appear();
63
64 if (_B4) {
65 const char* animName = "Loop";
66 MR::startBck(this, animName, 0);
67 MR::startBrk(this, animName);
68 }
69
70 _B8 = mPosition;
71}
72
73// DashRing::attackSensor
74// DashRing::control
75
77 if (_B4) {
78 TPos3f pos;
79 MR::makeMtxFrontSidePos(&pos, mAxis, mSubAxis, mPosition);
80 PSMTXCopy(pos.mMtx, getBaseMtx());
81 }
82}
83
84void DashRing::calcAxis() {
85 TVec3f stack_8(0.0f, 1.0f, 0.0f);
86 Mtx mtx;
87 MR::makeMtxTR(mtx, 0.0f, 0.0f, 0.0f, mRotation.x, mRotation.y, mRotation.z);
88 PSMTXMultVec(mtx, stack_8.toCVec(), stack_8.toVec());
89 mAxis = stack_8;
90 calcSubAxis();
91}
92
93void DashRing::calcSubAxis() {
94 TVec3f stack_14(mAxis);
95 TVec3f stack_8;
96
97 if (MR::isNearZero(stack_14.y, 0.001f)) {
98 stack_8.x = stack_14.y;
99 stack_8.y = -stack_14.x;
100 stack_8.z = 0.0f;
101 }
102 else {
103 stack_8.x = stack_14.x;
104 stack_8.y = 0.0f;
105 stack_8.z = -stack_14.y;
106 }
107
108 MR::normalizeOrZero(&stack_8);
109 mSubAxis = stack_8;
110}
111
112// DashRing::draw
113
114void DashRing::init(const JMapInfoIter &rIter) {
115 initCommon(rIter, "DashRing");
116}
virtual void calcAndSetBaseMtx()
Calculates and sets the base matrix of the actor.
Definition DashRing.cpp:76
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition DashRing.cpp:114
TVec3f mRotation
3D vector of the actor's rotation.
Definition LiveActor.hpp:96
TVec3f mPosition
3D vector of the actor's position.
Definition LiveActor.hpp:95
virtual MtxPtr getBaseMtx() const
Gets the base matrix of the model used for the actor.