SMG-Decomp
A decompilation of Super Mario Galaxy 1
Loading...
Searching...
No Matches
LiveActorGroupArray.cpp
1#include "Game/LiveActor/LiveActorGroupArray.hpp"
2#include "Game/LiveActor/LiveActor.hpp"
3#include <cstdio>
4#include <cstring>
5
6MsgSharedGroup::MsgSharedGroup(const char *pName, s32 a2, const JMapInfoIter &rIter) : LiveActorGroup(_28, a2) {
7 mIDInfo = 0;
8 _1C = -1;
9 _20 = 0;
10 _24 = 0;
11 MR::copyString(_28, pName, 0x30);
12 JMapIdInfo* inf = new JMapIdInfo();
13
14 if (inf) {
15 JMapIdInfo newInfo = MR::createJMapIdInfoFromClippingGroupId(rIter);
16 inf->_0 = newInfo._0;
17 inf->mZoneID = newInfo.mZoneID;
18 }
19
20 mIDInfo = inf;
21}
22
24 MR::connectToScene(this, 6, -1, -1, -1);
25}
26
27void MsgSharedGroup::movement() {
28 NameObj::movement();
29
30 if (_1C != 0xFFFFFFFF) {
31 for (s32 i = 0; i < mObjectCount; i++) {
32 LiveActor* actor = getActor(i);
33 HitSensor* sensor = actor->getSensor(_24);
34 sensor->receiveMessage(_1C, _20);
35 }
36
37 _1C = -1;
38 }
39}
40
41void MsgSharedGroup::sendMsgToGroupMember(u32 msg, HitSensor *pSensor, const char *pName) {
42 _1C = msg;
43 _20 = pSensor;
44 _24 = pName;
45}
46
47LiveActorGroupArray::LiveActorGroupArray(const char *pName) : NameObj(pName) {
48 mNumGroups = 0;
49}
50
52
53}
54
55LiveActorGroup* LiveActorGroupArray::getLiveActorGroup(const LiveActor *pActor) const {
56 return findGroup(pActor);
57}
58
59MsgSharedGroup* LiveActorGroupArray::createGroup(const JMapInfoIter &rIter, const char *pName, s32 msg) {
60 MsgSharedGroup* group = new MsgSharedGroup(pName, msg, rIter);
61 group->initWithoutIter();
62 s32 cnt = mNumGroups;
63 mNumGroups = cnt + 1;
64 mGroups[cnt] = group;
65 return group;
66}
67
68LiveActorGroup* LiveActorGroupArray::entry(LiveActor *pActor, const JMapInfoIter &rIter, const char *pName, s32 a4) {
69 s32 groupID = -1;
70 MR::getJMapInfoGroupID(rIter, &groupID);
71
72 if (!pName) {
73 char buf[0x20];
74 snprintf(buf, 0x20, "group%02d", groupID);
75 pName = buf;
76 }
77
78 LiveActorGroup* group = findGroup(rIter);
79
80 if (!group) {
81 group = createGroup(rIter, pName, a4);
82 }
83
84 group->registerActor(pActor);
85 return group;
86}
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
The basis of a drawable actor that can contain states (see: Nerve)
Definition LiveActor.hpp:24
HitSensor * getSensor(const char *pSensorName) const
Gets a sensor.
virtual void init(const JMapInfoIter &)
Intializes the NameObj and can set various settings and construct necessary classes.
The most basic form of an object.
Definition NameObj.hpp:11
void initWithoutIter()
Initializes a NameObj without a JMapInfoIter instance.
Definition NameObj.cpp:41