SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
ShootingStar.cpp
1#include "Game/MapObj/ShootingStar.hpp"
2
3ShootingStar::ShootingStar(const char *pName) : LiveActor(pName), _8C(0, 0, 0), _98(0, 0, 1), _A4(0, -1, 0) {
4 _B0 = 5;
5 _B4 = 0xF0;
6 _B8 = 2000.0f;
7}
8
9void ShootingStar::init(const JMapInfoIter &rIter) {
10 initModelManagerWithAnm("ShootingStar", nullptr, false);
11 MR::connectToSceneMapObj(this);
12 MR::initDefaultPos(this, rIter);
13 _8C = mPosition;
14 s32 arg0 = 5;
15 MR::getJMapInfoArg0NoInit(rIter, &arg0);
16 _B0 = arg0;
17 arg0 = 0xF0;
18 MR::getJMapInfoArg1NoInit(rIter, &arg0);
19 _B4 = arg0;
20 f32 arg2 = -1.0f;
21 MR::getJMapInfoArg2NoInit(rIter, &arg2);
22
23 if (arg2 != 1.0f) {
24 _B8 = arg2;
25 }
26
27 arg0 = 5;
28 MR::getJMapInfoArg3NoInit(rIter, &arg0);
29 MR::declareStarPiece(this, arg0);
30 initBinder(100.0f, 0.0f, 0);
31 MR::setBindTriangleFilter(this, MR::createTriangleFilterFunc(MR::isWallCodeNoAction));
32 initNerve(&NrvShootingStar::HostTypeNrvPreShooting::sInstance);
33 initEffectKeeper(0, "ShootingStar", false);
34 initSound(4, false);
35 initHitSensor(1);
36 TVec3f offset;
37 offset.x = 0.0f;
38 offset.y = 0.0f;
39 offset.z = 0.0f;
40 MR::addHitSensorMapObj(this, "message", 1, 0.0f, offset);
41 MR::initShadowVolumeSphere(this, 30.0f);
42
43 if (MR::useStageSwitchReadAppear(this, rIter)) {
44 MR::listenStageSwitchOnOffAppear(this, MR::FunctorV0M<LiveActor *, void (LiveActor::*)(void)>(this, &LiveActor::kill), MR::FunctorV0M<ShootingStar *, void (ShootingStar::*)(void)>(this, &ShootingStar::appearPreShooting));
45 makeActorDead();
46 }
47 else {
48 makeActorAppeared();
49 }
50
52 TSMtxf matrix;
53 f32 x, y, z;
54 matrix.setInline_2(getBaseMtx());
55 x = matrix.mMtx[0][1];
56 y = matrix.mMtx[1][1];
57 z = matrix.mMtx[2][1];
58 _98.set<f32>(x, y, z);
59 MR::startBpk(this, "ShootingStar");
60}
61
62void ShootingStar::appearPreShooting() {
63 appear();
64 MR::invalidateClipping(this);
65 setNerve(&NrvShootingStar::HostTypeNrvPreShooting::sInstance);
66}
67
68/*
69void ShootingStar::control() {
70
71 mRotation.y = zero + fmod((360.0f + ((10.0f + mRotation.y) - zero)), 360.0);
72}
73
74void ShootingStar::exePreShooting() {
75 if (MR::isFirstStep(this)) {
76 MR::calcGravityVector(this, &_A4, nullptr, 0);
77 MR::showModel(this);
78 MR::emitEffect(this, "ShooingStarAppear");
79 mPosition.x = _8C.x;
80 mPosition.y = _8C.y;
81 mPosition.z = _8C.z;
82 TVec3f stack_8 = _98 * _B8;
83 }
84}*/
85
86// ShootingSTar::exeShooting
87
88void ShootingStar::exeWaitForNextShoot() {
89 if (MR::isFirstStep(this)) {
90 MR::hideModel(this);
91 MR::emitEffect(this, "ShootingStarBreak");
92 mVelocity.zero();
93
94 if (!MR::isValidSwitchAppear(this)) {
95 MR::validateClipping(this);
96 }
97
98 MR::offCalcAnim(this);
99 MR::invalidateShadow(this, nullptr);
100 }
101
102 if (!MR::getDeclareRemnantStarPieceCount(this)) {
103 kill();
104 }
105
106 if (MR::isGreaterStep(this, _B4)) {
107 MR::onCalcAnim(this);
108 MR::validateShadow(this, nullptr);
109 setNerve(&NrvShootingStar::HostTypeNrvPreShooting::sInstance);
110 }
111}
112
113namespace NrvShootingStar {
114 INIT_NERVE(HostTypeNrvPreShooting);
115 INIT_NERVE(HostTypeNrvShooting);
116 INIT_NERVE(HostTypeNrvWaitForNextShoot);
117
118 void HostTypeNrvWaitForNextShoot::execute(Spine *pSpine) const {
119 ShootingStar* star = reinterpret_cast<ShootingStar*>(pSpine->mExecutor);
120 star->exeWaitForNextShoot();
121 }
122
123 void HostTypeNrvShooting::execute(Spine *pSpine) const {
124 ShootingStar* star = reinterpret_cast<ShootingStar*>(pSpine->mExecutor);
125 star->exeShooting();
126 }
127
128 void HostTypeNrvPreShooting::execute(Spine *pSpine) const {
129 ShootingStar* star = reinterpret_cast<ShootingStar*>(pSpine->mExecutor);
130 star->exePreShooting();
131 }
132};
133
134ShootingStar::~ShootingStar() {
135
136}
The basis of a drawable actor that can contain states (see: Nerve)
Definition LiveActor.hpp:24
TVec3f mPosition
3D vector of the actor's position.
Definition LiveActor.hpp:95
TVec3f mVelocity
3D vector of the actor's velocity.
Definition LiveActor.hpp:98
virtual void calcAndSetBaseMtx()
Calculates and sets the base matrix of the actor.
virtual MtxPtr getBaseMtx() const
Gets the base matrix of the model used for the actor.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition Spine.hpp:9