SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
LiveActorGroup.cpp
1#include "Game/LiveActor/LiveActorGroup.hpp"
2#include "Game/LiveActor/LiveActor.hpp"
3#include "Game/Util.hpp"
4
5LiveActorGroup::LiveActorGroup(const char *pName, int count) : NameObjGroup(pName, count) {
6
7}
8
9void LiveActorGroup::registerActor(LiveActor *pActor) {
10 registerObj(pActor);
11}
12
13LiveActor* LiveActorGroup::getActor(int idx) const {
14 return static_cast<LiveActor*>(mObjects[idx]);
15}
16
17LiveActor* LiveActorGroup::getDeadActor() const {
18 for (s32 i = 0; i < mObjectCount; i++) {
19 LiveActor* actor = static_cast<LiveActor*>(mObjects[i]);
20 if (MR::isDead(actor)) {
21 return static_cast<LiveActor*>(mObjects[i]);
22 }
23 }
24
25 return 0;
26}
27
28s32 LiveActorGroup::getLivingActorNum() const {
29 s32 num = 0;
30 for (s32 i = 0; i < mObjectCount; i++) {
31 LiveActor* actor = static_cast<LiveActor*>(mObjects[i]);
32
33 if (!MR::isDead(actor)) {
34 num++;
35 }
36 }
37
38 return num;
39}
40
41void LiveActorGroup::appearAll() {
42 for (s32 i = 0; i < mObjectCount; i++) {
43 if (!MR::isDead(static_cast<LiveActor*>(mObjects[i]))) {
44 static_cast<LiveActor*>(mObjects[i])->appear();
45 }
46 }
47}
48
49void LiveActorGroup::killAll() {
50 for (s32 i = 0; i < mObjectCount; i++) {
51 static_cast<LiveActor*>(mObjects[i])->kill();
52 }
53}
The basis of a drawable actor that can contain states (see: Nerve)
Definition LiveActor.hpp:24
Class that can contain multiple NameObj instances stored in a group.