SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
BgmProhibitArea.cpp
1#include "Game/AreaObj/BgmProhibitArea.hpp"
2
3BgmProhibitArea::~BgmProhibitArea() {
4
5}
6
7namespace {
8 BgmMuteSet* findDataElement(const char *pName) {
9 for (u32 i = 0; i < 2; i++) {
10 BgmMuteSet* ret = &sBgmMuteSet[i];
11
12 if (MR::isEqualString(pName, ret->mGalaxyName)) {
13 return ret;
14 }
15 }
16
17 return 0;
18 }
19};
20
21BgmProhibitArea::BgmProhibitArea(int a1, const char *pName) : AreaObj(a1, pName) {
22 _3C = 0;
23 _3D = 0;
24 _40.x = 0.0f;
25 _40.y = 0.0f;
26 _40.z = 0.0f;
27}
28
30 AreaObj::init(rIter);
31 MR::connectToSceneAreaObj(this);
32}
33
34void BgmProhibitArea::movement() {
35 if (!MR::isStageStateScenarioOpeningCamera()) {
36 TVec3f stack_8;
37 stack_8.setInlinePS(*MR::getPlayerPos());
38 f32 dist = PSVECDistance(stack_8.toCVec(), _40.toCVec());
39
40 if (isInVolume(*MR::getPlayerPos())) {
41 _3D = 0;
42
43 if (!_3C && MR::isPlayingStageBgm()) {
44 BgmMuteSet* set = findDataElement(MR::getCurrentStageName());
45 s32 v10 = set ? set->_4 : -1;
46 if (v10 >= 0) {
47 if (dist >= 10000.0f) {
48 MR::setStageBGMState(v10, 0);
49 }
50 else {
51 MR::setStageBGMState(v10, 120);
52 }
53 }
54
55 _3C = 1;
56 }
57 }
58 else {
59 _3C = 0;
60 if (!_3D && MR::isPlayingStageBgm()) {
61 BgmMuteSet* set = findDataElement(MR::getCurrentStageName());
62 s32 v14 = set ? set->_8 : -1;
63
64 if (v14 >= 0) {
65 MR::setStageBGMState(v14, 120);
66 }
67
68 _3D = 1;
69 }
70 }
71
72 _40.setInlinePS(stack_8);
73 }
74}
75
76const char* BgmProhibitArea::getManagerName() const {
77 return "BgmProhibitArea";
78}
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.