SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
TimerSwitch.cpp
1#include "Game/Map/TimerSwitch.hpp"
2
3TimerSwitch::TimerSwitch(const char *pName) : LiveActor(pName) {
4 mTimerLength = -1;
5 mCurrentTime = -1;
6}
7
8void TimerSwitch::init(const JMapInfoIter &rIter) {
9 MR::connectToSceneMapObjMovement(this);
10 MR::getJMapInfoArg0NoInit(rIter, &mTimerLength);
11 MR::needStageSwitchWriteA(this, rIter);
12 MR::needStageSwitchReadB(this, rIter);
13 MR::invalidateClipping(this);
14 makeActorAppeared();
15}
16
17void TimerSwitch::control() {
18 if (mCurrentTime < 0 && MR::isOnSwitchB(this)) {
19 mCurrentTime = mTimerLength;
20 }
21
22 s32 current = mCurrentTime;
23 if (current > 0) {
24 mCurrentTime = current - 1;
25
26 if (current - 1 <= 0) {
27 MR::onSwitchA(this);
28 kill();
29 }
30 }
31}
32
33TimerSwitch::~TimerSwitch() {
34
35}
The basis of a drawable actor that can contain states (see: Nerve)
Definition LiveActor.hpp:24
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.