SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
ActiveActorList.cpp
1#include "Game/LiveActor/ActiveActorList.hpp"
2#include "Game/LiveActor/LiveActor.hpp"
3
4ActiveActorList::ActiveActorList(int max) {
5 mCurCount = max;
6 mActorList = 0;
7 mMaxCount = 0;
8 mActorList = new LiveActor*[max];
9 clear();
10}
11
12bool ActiveActorList::isFull() const {
13 return mCurCount >= mMaxCount;
14}
15
16void ActiveActorList::addActor(LiveActor *pActor) {
17 if (!hasTooMany()) {
18 mActorList[mCurCount] = pActor;
19 mCurCount++;
20 }
21}
22
23void ActiveActorList::removeDeadActor() {
24 s32 cur = 0;
25 s32 idx = 0;
26
27 while (cur < mCurCount) {
28 if (MR::isDead(mActorList[idx])) {
29 mActorList[idx] = mActorList[mCurCount - 1];
30 s32 newCount = mCurCount - 1;
31 mActorList[newCount] = 0;
32 mCurCount--;
33 }
34 else {
35 ++cur;
36 ++idx;
37 }
38 }
39}
40
41void ActiveActorList::clear() {
42 for (s32 i = 0; i < mMaxCount; i++) {
43 mActorList[i] = 0;
44 }
45
46 mCurCount = 0;
47}
48
49void ActiveActorList::killAll() {
50 for (s32 i = 0; i < mCurCount; i++) {
51 if (!MR::isDead(mActorList[i])) {
52 mActorList[i]->kill();
53 }
54
55 mActorList[i] = 0;
56 }
57
58 mCurCount = 0;
59}
The basis of a drawable actor that can contain states (see: Nerve)
Definition LiveActor.hpp:24