1#include "Game/MapObj/Note.hpp"
2#include "Game/MapObj/NoteFairy.hpp"
3#include "Game/Scene/SceneObjHolder.hpp"
4#include "Game/Screen/NoteCounter.hpp"
6Note::Note(
const char *pName,
const TVec3f &rRailDirection,
NoteFairy *pParent) :
LiveActor(pName) {
7 mParentFairy = pParent;
9 mRailDirection.setInlinePS_2(rRailDirection);
17 MR::createSceneObj(SceneObj_NoteGroup);
19 initModelManagerWithAnm(
"Note",
nullptr,
false);
20 MR::connectToSceneNoSilhouettedMapObjStrongLight(
this);
26 MR::addHitSensorMapObj(
this,
"body", 8, 80.0f, offs);
27 initEffectKeeper(0,
nullptr,
false);
29 initNerve(&NrvNote::NoteNrvWait::sInstance);
31 MR::calcGravityAndDropShadowVector(
this, &
mGravity,
nullptr, 0);
32 if (MR::isNearZero(
mGravity, 0.001f)) {
38 MR::initShadowVolumeSphere(
this, 30.0f);
39 MR::turnVecToPlane(&mRailDirection, mRailDirection,
mGravity);
40 MR::invalidateClipping(
this);
44void Note::startCountDown() {
49 if (MR::isFirstStep(
this)) {
50 MR::startBrk(
this,
"Note");
51 f32 framemax = MR::getBrkFrameMax(
this,
"Note");
52 f32 rpt = MR::repeat(_AC, 0.0f, framemax);
53 MR::setBrkFrame(
this, rpt);
57 setNerve(&NrvNote::NoteNrvCountDown::sInstance);
62 if (MR::isFirstStep(
this)) {
67 MR::emitEffect(
this,
"Vanish");
68 MR::startSound(
this,
"SE_OJ_MUSICAL_NOTE_BREAK", -1, -1);
69 MR::failureNoteCollection();
75 if (MR::isFirstStep(
this)) {
78 MR::invalidateHitSensors(
this);
82 if (MR::isStep(
this, 10)) {
88 mRotation.y = MR::getSceneObj<NoteGroup*>(SceneObj_NoteGroup)->mRotation;
95 MR::makeMtxUpFront(&stack_44, stack_8, mRailDirection);
97 f32 val = MR::getSceneObj<NoteGroup*>(SceneObj_NoteGroup)->mRotation;
98 MR::makeMtxRotateY(mtxRotateY, val);
99 PSMTXConcat(stack_44.toMtxPtr(), mtxRotateY, stack_44.toMtxPtr());
103 MR::setBaseTRMtx(
this, stack_44);
107 if (MR::isSensorPlayerOrRide(a2)) {
108 if (!isNerve(&NrvNote::NoteNrvFlyUp::sInstance)) {
109 MR::emitEffect(
this,
"Get");
110 MR::addNoteToCounter();
112 setNerve(&NrvNote::NoteNrvFlyUp::sInstance);
122 MR::connectToSceneMapObjMovement(
this);
125void NoteGroup::movement() {
126 f32 v1 = MR::subtractFromSum(8.0f, mRotation, 0.0f);
127 mRotation = mRotation + 8.0f;
128 mRotation = MR::modAndAdd(0.0f, v1);
135NoteGroup::~NoteGroup() {
140 INIT_NERVE(NoteNrvWait);
141 INIT_NERVE(NoteNrvCountDown);
142 INIT_NERVE(NoteNrvFlyUp);
The basis of a drawable actor that can contain states (see: Nerve)
TVec3f mRotation
3D vector of the actor's rotation.
TVec3f mPosition
3D vector of the actor's position.
TVec3f mVelocity
3D vector of the actor's velocity.
TVec3f mGravity
3D vector of the actor's gravity.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
void exeFlyUp()
Scales the note's velocity by -30.0 and then invalidates all hit sensors, and after 10 steps,...
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
virtual void calcAndSetBaseMtx()
Calculates and sets the base matrix of the actor.
int mCounter
The amount of steps it takes for the note to disappear.
void exeCountDown()
Begins the flashing sequence and if the current step reaches Note::mCounter's value,...
NoteFairy * mParentFairy
The parent NoteFairy that this note was spawned from.
virtual void attackSensor(HitSensor *, HitSensor *)
Checks if the sensor is either a player or a rideable entity and if it is, it will "collect" the note...
void exeWait()
Begins the countdown sequence that plays the "waiting" animation, and is switched to the countdown ne...