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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
#include "Actor/ActorManager.hpp"
void ActorManager::func_ov00_020c3484(ActorRef *ref, Actor *actor, unk32 param3) {}
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() {}
bool ActorManager::ActorTypeIsOneOf(u32 type, ActorTypeId *types) {}
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;
}
static void NONMATCH(func_ov00_020c3484)(ActorRef *ref, Actor *actor, unk32 param3) {
#ifndef NONMATCHING
#include "../asm/ov00/Actor/ActorManager_func_ov00_020c3484.inc"
#else
char bVar1;
s32 iVar3;
s32 iVar4;
u32 uVar7;
Actor **ppAVar5;
Actor **ppAVar6;
Actor *pActor;
ref->id = 0xffffffff;
int *puVar2 = data_027e103c;
ref->index = 0xffffffff;
if (*(char *)(*puVar2 + 0x24) == '\0') {
return;
}
ppAVar5 = *(Actor ***)&actor->mUnk_010;
bVar1 = data_02056be4[*data_027e077c];
iVar4 = 0x7fffffff;
ppAVar6 = ppAVar5 + actor->mType;
for (; ppAVar5 < ppAVar6; ppAVar5++) {
pActor = *ppAVar5;
if (pActor != NULL) {
actor = (Actor *)(u32)actor->mAlive;
}
if (pActor != NULL && actor != NULL) {
uVar7 = pActor->func_ov00_020c27a8(param3);
actor = (Actor *)(uVar7 >> 0x20);
if (uVar7 != 0) {
pActor = *ppAVar5;
actor = (Actor *)(u32)(pActor->mUnk_0a4.mUnk_00);
}
if (actor != NULL || (bVar1 & 1) != 0) {
uVar7 = pActor->mUnk_040(0);
pActor = (Actor *)(uVar7 >> 0x20);
iVar3 = (*ppAVar5)->DistanceToLink();
if (uVar7 != 0 && iVar3 < iVar4) {
pActor = *ppAVar5;
ref->id = actor->mId;
ref->index = actor->mIndex;
iVar4 = iVar3;
}
}
}
}
return;
#endif
}
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 bool ActorManager::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;
}
|