SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
NameObjHolder.cpp
1#include "Game/NameObj/NameObj.hpp"
2#include "Game/NameObj/NameObjHolder.hpp"
3#include "Game/Util.hpp"
4
5NameObjHolder::NameObjHolder(int a1) :
6 mObjs(0), _4(0), mObjCount(0), _4C(0) {
7 mObjs = new NameObj*[a1];
8 _4 = a1;
9 }
10
11void NameObjHolder::add(NameObj *pObj) {
12 u32 count = mObjCount;
13 mObjCount = count + 1;
14 mObjs[count] = pObj;
15}
16
17void NameObjHolder::suspendAllObj() {
18 for (int i = 0; i < mObjCount; i++) {
19 MR::requestMovementOff(mObjs[i]);
20 }
21}
22
23void NameObjHolder::resumeAllObj() {
24 for (int i = 0; i < mObjCount; i++) {
25 MR::requestMovementOn(mObjs[i]);
26 }
27}
28
29
30void NameObjHolder::syncWithFlags() {
31 callMethodAllObj(&NameObj::syncWithFlags);
32}
33
34#ifdef NON_MATCHING
35// some weird register usage and ordering
36void NameObjHolder::callMethodAllObj(func functionPtr) {
37 func function = functionPtr;
38
39 NameObj** start = mObjs;
40 NameObj** end = &mObjs[mObjCount];
41
42 while (start != end) {
43 (*start->*function)();
44 start++;
45 }
46}
47#endif
48
49void NameObjHolder::clearArray() {
50 mObjCount = 0;
51 _4C = 0;
52}
The most basic form of an object.
Definition NameObj.hpp:11