SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
PowerStarEventKeeper.cpp
1#include "Game/NPC/PowerStarEventKeeper.hpp"
2#include "Game/Util.hpp"
3
4PowerStarEventKeeper::PowerStarEventKeeper() {
5 _0 = 1;
6 mPowerStarNum = 1;
7 mInfoTbl = nullptr;
8 mPowerStarNum = MR::getCurrentStagePowerStarNum();
9 initStarInfoTable();
10}
11
12/*
13void PowerStarEventKeeper::initStarInfoTable() {
14 mInfoTbl = new PowerStarInfo*[mPowerStarNum * 2];
15
16 for (s32 i = 0; i < mPowerStarNum; i++) {
17 PowerStarInfo* inf = mInfoTbl[(i - 1) + _0];
18 inf->_0 = 0;
19 inf->_1 = 0;
20 inf->_2 = 0;
21 inf->_3 = 0;
22 inf->_4 = nullptr;
23 }
24
25 for (s32 i = _0; i < mPowerStarNum; i++) {
26 if (isExistPowerStarAtScenario(i)) {
27 mInfoTbl[(i * 8) - 1]->_0 = 1;
28 }
29
30 if (!MR::getAppearPowerStarObjName(i)) {
31 mInfoTbl[(i - 1) * 8]->_1 = 1;
32 }
33 }
34}
35*/
36
37// PowerStarEventKeeper::declareStar
38
39bool PowerStarEventKeeper::isGreen(const char *pName, s32 starNum) const {
40 if (starNum < 0) {
41 starNum = findStarID(pName);
42 }
43
44 if (!isCorrectStarIdWithBBS(pName, "ゾーン不明", starNum)) {
45 return false;
46 }
47
48 return MR::isPowerStarGreenInCurrentStage(starNum);
49}
50
51bool PowerStarEventKeeper::isRed(const char *pName, s32 starNum) const {
52 if (starNum < 0) {
53 starNum = findStarID(pName);
54 }
55
56 if (!isCorrectStarIdWithBBS(pName, "ゾーン不明", starNum)) {
57 return false;
58 }
59
60 return MR::isPowerStarRedInCurrentStage(starNum);
61}
62
63bool PowerStarEventKeeper::isGrand(const char *pName, s32 starNum) const {
64 if (starNum < 0) {
65 starNum = findStarID(pName);
66 }
67
68 if (!isCorrectStarIdWithBBS(pName, "ゾーン不明", starNum)) {
69 return false;
70 }
71
72 return MR::isGrandStarInCurrentStage(starNum);
73}
74
75// PowerStarEventKeeper::initStarInfoTableAfterPlacement
76// PowerStarEventKeeper::requestAppearPowerStar
77// PowerStarEventKeeper::isExistPowerStarAtScenario
78// PowerStarEventKeeper::isCorrectStarIdWithBBS
79
80bool PowerStarEventKeeper::isSuccess(const char *pName, s32 starNum) const {
81 if (starNum < 0) {
82 starNum = findStarID(pName);
83 }
84
85 if (!isCorrectStarIdWithBBS(pName, "ゾーン不明", starNum)) {
86 return false;
87 }
88
89 return MR::hasPowerStarInCurrentStage(starNum);
90}