SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
ChipCounter.cpp
1#include "Game/MapObj/ChipCounter.hpp"
2#include "Game/NPC/TalkDirector.hpp"
3#include "Game/Util.hpp"
4
5ChipCounter::ChipCounter(const char *pName, s32 type) : LayoutActor(pName, true) {
6 mCollectCounter = 0;
7 mCount = 0;
8 mType = type;
9 _2C = -1;
10 _30 = 1.0f;
11}
12
13void ChipCounter::init(const JMapInfoIter &rIter) {
14 MR::connectToSceneLayout(this);
15
16 switch(mType) {
17 case 0:
18 initLayoutManager("BlueChipCounter", 2);
19 break;
20 case 1:
21 initLayoutManager("YellowChipCounter", 2);
22 break;
23 }
24
25 initNerve(&NrvChipCounter::ChipCounterNrvHide::sInstance);
26
27 for (s32 i = 0; i < sChipPainCount; i++) {
28 MR::createAndAddPaneCtrl(this, sChipPainName[i], 2);
29 MR::startPaneAnim(this, sChipPainName[i], "ChipGet", 0);
30 }
31
32 MR::startAnim(this, "ShowHide", 1);
33 MR::setAnimFrameAndStop(this, _30 * 20.0f, 1);
34 mCollectCounter = new CollectCounter("集め数字");
35 mCollectCounter->initWithoutIter();
36 kill();
37}
38
39void ChipCounter::control() {
40 if (MR::isActiveTalkBalloonShort()) {
41 _30 -= 0.050000001f;
42
43 if (_30 < 0.0f) {
44 _30 = 0.0f;
45 }
46 }
47 else {
48 _30 += 0.050000001f;
49
50 if (_30 > 1.0f) {
51 _30 = 1.0f;
52 }
53 }
54
55 MR::setAnimFrameAndStop(this, (_30 * 20.0f), 1);
56}
57
58// ChipCounter::setCount
59
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
void initWithoutIter()
Initializes a NameObj without a JMapInfoIter instance.
Definition NameObj.cpp:41