SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
SwitchArea.cpp
1#include "Game/AreaObj/SwitchArea.hpp"
2#include "Game/Util/PlayerUtil.hpp"
3
4SwitchArea::SwitchArea(int type, const char *pName) : AreaObj(type, pName) {
5
6}
7
8void SwitchArea::init(const JMapInfoIter &rIter) {
9 AreaObj::init(rIter);
10 MR::connectToSceneAreaObj(this);
11}
12
13void SwitchArea::movement() {
14 if (!isUpdate()) {
15 return;
16 }
17
18 bool bVar1 = false;
19
20 if (!isValidSwitchB() || isOnSwitchB()) {
21 bVar1 = true;
22 }
23
24 if (bVar1 && isInVolume(*MR::getPlayerPos())) {
25 if (mObjArg1 == -1) {
26 onSwitchA();
27 }
28 else {
29 offSwitchA();
30 }
31 }
32 else if (mObjArg0 != -1) {
33 offSwitchA();
34 }
35}
36
37const char *SwitchArea::getManagerName() const {
38 return "SwitchArea";
39}
40
41bool SwitchArea::isUpdate() const {
42 if (mObjArg2 != -1 && !MR::isOnGroundPlayer()) {
43 return false;
44 }
45
46 if (mObjArg0 != -1) {
47 return true;
48 }
49
50 if (mObjArg1 == -1) {
51 return !isOnSwitchA();
52 }
53
54 return isOnSwitchA();
55}
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition AreaObj.cpp:41
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
Definition SwitchArea.cpp:8