1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
#include "Actor/ActorManager.hpp"
void ActorManager::func_ov00_020c3484(ActorRef *ref, Actor *actor, unk32 param3) {}
void ActorManager::Actor_vfunc_10(u32 param1) {}
Actor *ActorManager::FindActorById(u32 id) {}
Actor *ActorManager::GetActor(ActorRef *ref) {}
bool FilterActor::Filter(Actor *actor) {}
s32 ActorManager::FilterActors(FilterActorBase *filter, ActorList *filteredActors) {}
void ActorManager::FindActorByType(ActorRef *ref, ActorManager *manager, ActorTypeId type) {}
void ActorManager::FindNearestActorOfType(ActorRef *ref, ActorManager *manager, ActorTypeId type, Vec3p *pos) {}
bool ActorManager::func_ov00_020c398c(u32 index) {}
void ActorManager::func_ov00_020c399c(u32 index, Cylinder *cylinder) {}
Actor *ActorManager::func_ov00_020c39ac(u32 index, const ActorTypeId *actorTypes, bool param3) {}
s32 ActorManager::func_ov00_020c3b2c(s32 *param1) {}
s32 ActorManager::func_ov00_020c3bb0(unk32 param1, s32 *param2) {}
void ActorManager::func_ov00_020c3ce8(unk32 param1, unk32 param2) {}
void ActorManager::Actor_vfunc_28() {}
extern void func_ov00_020c3f54(void *, u32 param2);
extern s32 *data_027e103c;
extern s32 *data_027e077c;
extern s32 data_02056be4[];
ARM void ActorManager::DeleteActor(u32 index, bool param2) {
if (!param2) {
func_ov00_020c3f54(this->mUnk_14, index & 0xffff);
this->mActorTable[index]->StopLinkFollow();
}
if (this->mActorTable[index] != NULL) {
delete this->mActorTable[index];
}
this->mActorTable[index] = NULL;
if (param2) {
return;
}
this->mNumActors--;
if (index + 1 != this->mMaxActorIndex) {
return;
}
int i = index - 1;
while (i >= 0) {
if (this->mActorTable[i] != NULL) {
break;
}
i--;
}
this->mMaxActorIndex = i + 1 & 0xffff;
return;
}
ARM void ActorManager::Actor_vfunc_10(u32 param1) {
Actor *actor;
int i;
u32 uVar1 = param1;
Actor **currentActor = this->mActorTable;
for (i = 0; i < this->mMaxActorIndex; ++i) {
actor = *currentActor;
if (actor != NULL) {
uVar1 = actor->mAlive;
if (uVar1 != 0) {
actor->vfunc_10(param1);
}
}
currentActor += 1;
}
return;
}
ARM Actor *ActorManager::FindActorById(s32 id) {
u32 actorId;
s32 cacheIndex;
Actor *actor;
Actor **pActor;
Actor **lastActor;
actor = NULL;
if (id >= 0) {
cacheIndex = this->mCacheEmptyActorIndex;
if ((cacheIndex >= 0) && (cacheIndex < this->mMaxActorIndex)) {
pActor = this->mActorTable;
if (pActor[cacheIndex] != NULL) {
if ((Actor **) (u32) pActor[cacheIndex]->mAlive != NULL && id == pActor[cacheIndex]->mId) {
actor = pActor[cacheIndex];
goto ret;
}
}
}
pActor = this->mActorTable;
actorId = this->mMaxActorIndex;
lastActor = pActor + actorId;
for (; pActor < lastActor; pActor = pActor + 1) {
if (*pActor != NULL) {
actorId = (u32) (*pActor)->mAlive;
if (actorId != 0 && id == (*pActor)->mId) {
actor = *pActor;
break;
}
}
}
}
ret:
return actor;
}
Actor *ActorManager::GetActor(ActorRef *ref) {
Actor *pActor;
u32 alive;
alive = ref->index;
if ((s32) alive < 0) {
return NULL;
}
pActor = this->mActorTable[alive];
if (pActor != NULL) {
alive = pActor->mAlive;
if (alive != 0 && ref->id == pActor->mId) {
return pActor;
}
}
return NULL;
}
void ActorManager::Actor_vfunc_28() {
int i;
Actor **pActor;
pActor = this->mActorTable;
for (i = 0; i < this->mMaxActors; i++) {
if (*pActor != NULL) {
(*pActor)->vfunc_28();
}
pActor = pActor + 1;
}
}
char nullStr[] = "LLUN";
ARM static bool ActorTypeIsOneOf(char *type, char **types) {
int i;
bool found = false;
for (i = 0; *types != nullStr; i++) {
if (type == *types) {
found = true;
break;
}
types += 1;
}
return found;
}
|