SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
SimpleTimerObj.cpp
1#include "Game/MapObj/SimpleTimerObj.hpp"
2
3SimpleTimerObj::SimpleTimerObj(const char *pName) : MapObjActor(pName) {
4 mFlashingCtrl = 0;
5 mTimer = 600;
6 mTimeLeft = 0;
7}
8
10 MapObjActor::init(rIter);
12 MapObjActorUtil::setupInitInfoSimpleMapObj(&info);
13 info.setupNerve(&NrvSimpleTimerObj::SimpleTimerObjNrvTimer::sInstance);
14 initialize(rIter, info);
15 MR::getJMapInfoArg7NoInit(rIter, &mTimer);
16 mFlashingCtrl = new FlashingCtrl(this, true);
17 MR::invalidateShadow(this, 0);
18}
19
20void SimpleTimerObj::exeTimer() {
21 if (MR::isFirstStep(this)) {
22 mTimeLeft = mTimer;
23 }
24}
25
26void SimpleTimerObj::appear() {
27 MapObjActor::appear();
28 MR::showModel(this);
29 MR::validateShadow(this, 0);
30 setNerve(&NrvSimpleTimerObj::SimpleTimerObjNrvTimer::sInstance);
31}
32
33void SimpleTimerObj::kill() {
34 mFlashingCtrl->end();
35 MR::invalidateShadow(this, 0);
36 MR::emitEffect(this, "Appear");
37 MapObjActor::kill();
38}
39
40void SimpleTimerObj::control() {
41 s32 curTime = mTimeLeft;
42 mTimeLeft = curTime - 1;
43
44 if (mTimeLeft == 120) {
45 mFlashingCtrl->start(120);
46 }
47 else if (mTimeLeft != 0) {
48 kill();
49 }
50}
51
52SimpleTimerObj::~SimpleTimerObj() {
53
54}
55
56namespace NrvSimpleTimerObj {
57 INIT_NERVE(SimpleTimerObjNrvTimer);
58
59 void SimpleTimerObjNrvTimer::execute(Spine *pSpine) const {
60 SimpleTimerObj* timer_obj = reinterpret_cast<SimpleTimerObj*>(pSpine->mExecutor);
61 timer_obj->exeTimer();
62 }
63};
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition Spine.hpp:9