mirror of
https://github.com/zeldaret/ph
synced 2026-07-07 21:31:01 -04:00
Decomp ActorManager
This commit is contained in:
@@ -915,7 +915,7 @@ func_ov000_0208e6f0 kind:function(arm,size=0x14) addr:0x208e6f0
|
||||
func_ov000_0208e704 kind:function(arm,size=0x14) addr:0x208e704
|
||||
func_ov000_0208e718 kind:function(arm,size=0x14) addr:0x208e718
|
||||
func_ov000_0208e72c kind:function(arm,size=0x78) addr:0x208e72c
|
||||
func_ov000_0208e7a4 kind:function(arm,size=0x44) addr:0x208e7a4
|
||||
_ZN4AABB12ContainsInXZEP5Vec3p kind:function(arm,size=0x44) addr:0x208e7a4
|
||||
func_ov000_0208e7e8 kind:function(arm,size=0x44) addr:0x208e7e8
|
||||
func_ov000_0208e82c kind:function(arm,size=0x50) addr:0x208e82c
|
||||
func_ov000_0208e87c kind:function(arm,size=0x4f8) addr:0x208e87c
|
||||
@@ -927,7 +927,7 @@ func_ov000_0208ee90 kind:function(arm,size=0x1a0) addr:0x208ee90
|
||||
func_ov000_0208f030 kind:function(arm,size=0x170) addr:0x208f030
|
||||
func_ov000_0208f1a0 kind:function(arm,size=0xf4) addr:0x208f1a0
|
||||
func_ov000_0208f294 kind:function(arm,size=0x84) addr:0x208f294
|
||||
func_ov000_0208f318 kind:function(arm,size=0x5c) addr:0x208f318
|
||||
_ZN6Sphere12ContainsInXZEP5Vec3p kind:function(arm,size=0x5c) addr:0x208f318
|
||||
func_ov000_0208f374 kind:function(arm,size=0x104) addr:0x208f374
|
||||
func_ov000_0208f478 kind:function(arm,size=0x224) addr:0x208f478
|
||||
func_ov000_0208f69c kind:function(arm,size=0x38) addr:0x208f69c
|
||||
@@ -2838,9 +2838,9 @@ func_ov000_020c336c kind:function(thumb,size=0x1c) addr:0x20c336c
|
||||
func_ov000_020c3388 kind:function(thumb,size=0x28) addr:0x20c3388
|
||||
func_ov000_020c33b0 kind:function(thumb,size=0x24) addr:0x20c33b0
|
||||
_ZN12ActorManager11DeleteActorEjb kind:function(arm,size=0xb0) addr:0x20c33d4
|
||||
_ZN12ActorManager18func_ov00_020c3484EP8ActorRefP5Actori kind:function(arm,size=0xf8) addr:0x20c3484
|
||||
_ZN12ActorManager18func_ov00_020c3484EP8ActorRefPS_i kind:function(arm,size=0xf8) addr:0x20c3484
|
||||
_ZN12ActorManager14Actor_vfunc_10Ej kind:function(arm,size=0x5c) addr:0x20c357c
|
||||
_ZN12ActorManager13FindActorByIdEj kind:function(arm,size=0x9c) addr:0x20c35d8
|
||||
_ZN12ActorManager13FindActorByIdEi kind:function(arm,size=0x9c) addr:0x20c35d8
|
||||
_ZN12ActorManager8GetActorEP8ActorRef kind:function(arm,size=0x40) addr:0x20c3674
|
||||
_ZN11FilterActor6FilterEP5Actor kind:function(arm,size=0x138) addr:0x20c36b4
|
||||
_ZN12ActorManager12FilterActorsEP15FilterActorBaseP9ActorList kind:function(arm,size=0xa8) addr:0x20c37ec
|
||||
@@ -2848,7 +2848,7 @@ _ZN12ActorManager15FindActorByTypeEP8ActorRefPS_j kind:function(arm,size=0x68) a
|
||||
_ZN12ActorManager22FindNearestActorOfTypeEP8ActorRefPS_jP5Vec3p kind:function(arm,size=0x90) addr:0x20c38fc
|
||||
_ZN12ActorManager18func_ov00_020c398cEj kind:function(arm,size=0x10) addr:0x20c398c
|
||||
_ZN12ActorManager18func_ov00_020c399cEjP8Cylinder kind:function(arm,size=0x10) addr:0x20c399c
|
||||
_ZN12ActorManager18func_ov00_020c39acEjPKjb kind:function(arm,size=0x180) addr:0x20c39ac
|
||||
_ZN12ActorManager18func_ov00_020c39acEjPjb kind:function(arm,size=0x180) addr:0x20c39ac
|
||||
_ZN12ActorManager18func_ov00_020c3b2cEPi kind:function(arm,size=0x84) addr:0x20c3b2c
|
||||
_ZN12ActorManager18func_ov00_020c3bb0EiPi kind:function(arm,size=0x138) addr:0x20c3bb0
|
||||
_ZN12ActorManager18func_ov00_020c3ce8Eii kind:function(arm,size=0xe8) addr:0x20c3ce8
|
||||
|
||||
@@ -915,7 +915,7 @@ func_ov000_0208e6f0 kind:function(arm,size=0x14) addr:0x208e690
|
||||
func_ov000_0208e704 kind:function(arm,size=0x14) addr:0x208e6a4
|
||||
func_ov000_0208e718 kind:function(arm,size=0x14) addr:0x208e6b8
|
||||
func_ov000_0208e72c kind:function(arm,size=0x78) addr:0x208e6cc
|
||||
func_ov000_0208e7a4 kind:function(arm,size=0x44) addr:0x208e744
|
||||
_ZN4AABB12ContainsInXZEP5Vec3p kind:function(arm,size=0x44) addr:0x208e744
|
||||
func_ov000_0208e7e8 kind:function(arm,size=0x44) addr:0x208e788
|
||||
func_ov000_0208e82c kind:function(arm,size=0x50) addr:0x208e7cc
|
||||
func_ov000_0208e87c kind:function(arm,size=0x4f8) addr:0x208e81c
|
||||
@@ -927,7 +927,7 @@ func_ov000_0208ee90 kind:function(arm,size=0x1a0) addr:0x208ee30
|
||||
func_ov000_0208f030 kind:function(arm,size=0x170) addr:0x208efd0
|
||||
func_ov000_0208f1a0 kind:function(arm,size=0xf4) addr:0x208f140
|
||||
func_ov000_0208f294 kind:function(arm,size=0x84) addr:0x208f234
|
||||
func_ov000_0208f318 kind:function(arm,size=0x5c) addr:0x208f2b8
|
||||
_ZN6Sphere12ContainsInXZEP5Vec3p kind:function(arm,size=0x5c) addr:0x208f2b8
|
||||
func_ov000_0208f374 kind:function(arm,size=0x104) addr:0x208f314
|
||||
func_ov000_0208f478 kind:function(arm,size=0x224) addr:0x208f418
|
||||
func_ov000_0208f69c kind:function(arm,size=0x38) addr:0x208f63c
|
||||
@@ -2838,9 +2838,9 @@ func_ov000_020c336c kind:function(thumb,size=0x1c) addr:0x20c330c
|
||||
func_ov000_020c3388 kind:function(thumb,size=0x28) addr:0x20c3328
|
||||
func_ov000_020c33b0 kind:function(thumb,size=0x24) addr:0x20c3350
|
||||
_ZN12ActorManager11DeleteActorEjb kind:function(arm,size=0xb0) addr:0x20c3374
|
||||
_ZN12ActorManager18func_ov00_020c3484EP8ActorRefP5Actori kind:function(arm,size=0xf8) addr:0x20c3424
|
||||
_ZN12ActorManager18func_ov00_020c3484EP8ActorRefPS_i kind:function(arm,size=0xf8) addr:0x20c3424
|
||||
_ZN12ActorManager14Actor_vfunc_10Ej kind:function(arm,size=0x5c) addr:0x20c351c
|
||||
_ZN12ActorManager13FindActorByIdEj kind:function(arm,size=0x9c) addr:0x20c3578
|
||||
_ZN12ActorManager13FindActorByIdEi kind:function(arm,size=0x9c) addr:0x20c3578
|
||||
_ZN12ActorManager8GetActorEP8ActorRef kind:function(arm,size=0x40) addr:0x20c3614
|
||||
_ZN11FilterActor6FilterEP5Actor kind:function(arm,size=0x138) addr:0x20c3654
|
||||
_ZN12ActorManager12FilterActorsEP15FilterActorBaseP9ActorList kind:function(arm,size=0xa8) addr:0x20c378c
|
||||
@@ -2848,7 +2848,7 @@ _ZN12ActorManager15FindActorByTypeEP8ActorRefPS_j kind:function(arm,size=0x68) a
|
||||
_ZN12ActorManager22FindNearestActorOfTypeEP8ActorRefPS_jP5Vec3p kind:function(arm,size=0x90) addr:0x20c389c
|
||||
_ZN12ActorManager18func_ov00_020c398cEj kind:function(arm,size=0x10) addr:0x20c392c
|
||||
_ZN12ActorManager18func_ov00_020c399cEjP8Cylinder kind:function(arm,size=0x10) addr:0x20c393c
|
||||
_ZN12ActorManager18func_ov00_020c39acEjPKjb kind:function(arm,size=0x180) addr:0x20c394c
|
||||
_ZN12ActorManager18func_ov00_020c39acEjPjb kind:function(arm,size=0x180) addr:0x20c394c
|
||||
_ZN12ActorManager18func_ov00_020c3b2cEPi kind:function(arm,size=0x84) addr:0x20c3acc
|
||||
_ZN12ActorManager18func_ov00_020c3bb0EiPi kind:function(arm,size=0x138) addr:0x20c3b50
|
||||
_ZN12ActorManager18func_ov00_020c3ce8Eii kind:function(arm,size=0xe8) addr:0x20c3c88
|
||||
|
||||
@@ -21,13 +21,13 @@ class FilterActor : public FilterActorBase {
|
||||
/* 04 */ u32 mType;
|
||||
/* 08 */ s32 mUnk_08;
|
||||
/* 0c */ s32 mUnk_0c;
|
||||
/* 10 */ s32 *mExcludeIds; // list of excluded actor ids, terminated by -1
|
||||
/* 10 */ ActorRef *mExcludeRefs; // list of excluded actor ids, terminated by -1
|
||||
/* 14 */ bool mExcludeNotInAABB;
|
||||
/* 15 */ unk8 mUnk_15[3];
|
||||
/* 18 */ AABB mAABB;
|
||||
/* 30 */ bool mExcludeNotInSphere;
|
||||
/* 31 */ unk8 mUnk_1a[3];
|
||||
/* 34 */ Sphere sphere;
|
||||
/* 34 */ Sphere mSphere;
|
||||
/* 44 */
|
||||
|
||||
/* 0 */ virtual bool Filter(Actor *actor) override;
|
||||
@@ -78,21 +78,21 @@ public:
|
||||
/* c4 */
|
||||
|
||||
void DeleteActor(u32 index, bool param2);
|
||||
static void func_ov00_020c3484(ActorRef *ref, Actor *actor, unk32 param3);
|
||||
static void func_ov00_020c3484(ActorRef *ref, ActorManager *actorMgr, unk32 param3);
|
||||
void Actor_vfunc_10(u32 param1);
|
||||
Actor *FindActorById(s32 id);
|
||||
Actor *GetActor(ActorRef *ref);
|
||||
s32 FilterActors(FilterActorBase *filter, ActorList *filteredActors);
|
||||
static void FindActorByType(ActorRef *ref, ActorManager *manager, ActorTypeId type);
|
||||
static void FindNearestActorOfType(ActorRef *ref, ActorManager *manager, ActorTypeId type, Vec3p *pos);
|
||||
static void FindActorByType(ActorRef *ref, ActorManager *actorMgr, ActorTypeId type);
|
||||
static void FindNearestActorOfType(ActorRef *ref, ActorManager *actorMgr, ActorTypeId type, Vec3p *pos);
|
||||
bool func_ov00_020c398c(u32 index);
|
||||
void func_ov00_020c399c(u32 index, Cylinder *cylinder);
|
||||
Actor *func_ov00_020c39ac(u32 index, const ActorTypeId *actorTypes, bool param3);
|
||||
Actor *func_ov00_020c39ac(u32 index, ActorTypeId *actorTypes, bool param3);
|
||||
s32 func_ov00_020c3b2c(s32 *param1);
|
||||
s32 func_ov00_020c3bb0(unk32 param1, s32 *param2);
|
||||
void func_ov00_020c3ce8(unk32 param1, unk32 param2);
|
||||
void Actor_vfunc_28();
|
||||
static bool ActorTypeIsOneOf(char *type, char **types);
|
||||
static bool ActorTypeIsOneOf(ActorTypeId type, ActorTypeId *types);
|
||||
};
|
||||
|
||||
extern ActorManager *gActorManager;
|
||||
|
||||
@@ -12,20 +12,6 @@ class Actor;
|
||||
class FilterActorBase {
|
||||
public:
|
||||
/* 00 (vtable) */
|
||||
/* 04 */ unk32 mType;
|
||||
/* 08 */ unk32 mUnk_08;
|
||||
/* 0c */ unk32 mUnk_0c;
|
||||
/* 10 */ s32 *mExcludeIds;
|
||||
/* 14 */ bool mExcludeNotInAABB;
|
||||
/* 15 */ unk8 mUnk_15;
|
||||
/* 16 */ unk8 mUnk_16;
|
||||
/* 17 */ unk8 mUnk_17;
|
||||
/* 18 */ AABB mAABB;
|
||||
/* 30 */ bool mExcludeNotInSphere;
|
||||
/* 31 */ unk8 mUnk_31;
|
||||
/* 32 */ unk8 mUnk_32;
|
||||
/* 33 */ unk8 mUnk_33;
|
||||
/* 34 */ Sphere mSphere;
|
||||
|
||||
/* 0 */ virtual bool Filter(Actor *actor) = 0;
|
||||
/* 4 */
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "global.h"
|
||||
#include "types.h"
|
||||
|
||||
struct UnkStruct_027e103c {
|
||||
/* 00 */ unk32 mUnk_00;
|
||||
/* 04 */ unk32 mUnk_04;
|
||||
/* 08 */ unk32 mUnk_08;
|
||||
/* 0c */ unk32 mUnk_0c;
|
||||
/* 10 */ unk32 mUnk_10;
|
||||
/* 14 */ unk16 *mUnk_14;
|
||||
/* 18 */ unk32 mUnk_18;
|
||||
/* 1c */ unk16 mUnk_1c;
|
||||
/* 1e */ unk16 mUnk_1a;
|
||||
/* 20 */ unk16 mUnk_20;
|
||||
/* 22 */ s16 mUnk_22;
|
||||
/* 24 */ u8 mUnk_24;
|
||||
/* 25 */ unk8 mUnk_25[7];
|
||||
/* 2c */
|
||||
};
|
||||
|
||||
extern UnkStruct_027e103c *data_027e103c;
|
||||
@@ -8,4 +8,6 @@
|
||||
struct AABB {
|
||||
Vec3p min;
|
||||
Vec3p max;
|
||||
|
||||
bool ContainsInXZ(Vec3p *vec);
|
||||
};
|
||||
|
||||
@@ -8,4 +8,6 @@
|
||||
struct Sphere {
|
||||
Vec3p pos;
|
||||
int radius;
|
||||
|
||||
bool ContainsInXZ(Vec3p *vec);
|
||||
};
|
||||
|
||||
@@ -1,29 +1,18 @@
|
||||
#include "Actor/ActorManager.hpp"
|
||||
#include "DTCM/UnkStruct_027e103c.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() {}
|
||||
char *gShipParts[8] = {"anc", "bow", "hul", "can", "dco", "pdl", "fnl", "brg"};
|
||||
|
||||
extern void func_ov00_020c3f54(void *, u32 param2);
|
||||
extern s32 *data_027e103c;
|
||||
extern s32 *data_027e077c;
|
||||
extern s32 data_02056be4[];
|
||||
extern "C" Cylinder *func_ov000_020c3ef0(void *, u32 index);
|
||||
extern "C" bool func_ov000_020c3f08(void *, u32 index);
|
||||
extern "C" void func_ov000_020c3f3c(void *, u32 index, Cylinder *cylinder);
|
||||
extern "C" void func_ov000_020c3f54(void *, u32 param2);
|
||||
extern s32 data_027e077c;
|
||||
extern u8 data_02056be4[];
|
||||
|
||||
ARM void ActorManager::DeleteActor(u32 index, bool param2) {
|
||||
if (!param2) {
|
||||
func_ov00_020c3f54(this->mUnk_14, index & 0xffff);
|
||||
func_ov000_020c3f54(this->mUnk_14, index & 0xffff);
|
||||
this->mActorTable[index]->StopLinkFollow();
|
||||
}
|
||||
|
||||
@@ -56,6 +45,34 @@ ARM void ActorManager::DeleteActor(u32 index, bool param2) {
|
||||
return;
|
||||
}
|
||||
|
||||
ARM void ActorManager::func_ov00_020c3484(ActorRef *ref, ActorManager *actorMgr, unk32 param3) {
|
||||
ref->Reset();
|
||||
if (data_027e103c->mUnk_24 == 0) return;
|
||||
|
||||
Actor **actorIter = actorMgr->mActorTable;
|
||||
q20 minDistance = 0x7fffffff;
|
||||
u8 unkByte = data_02056be4[data_027e077c];
|
||||
bool unk1 = (unkByte & 1) != 0;
|
||||
Actor **actorTableEnd = actorIter + actorMgr->mMaxActorIndex;
|
||||
|
||||
for (; actorIter < actorTableEnd; actorIter++) {
|
||||
Actor *actor = *actorIter;
|
||||
if (actor != NULL && actor->mAlive) {
|
||||
if (actor->func_ov00_020c27a8(param3)) {
|
||||
if (actor->mUnk_0a4.mUnk_00 || unk1) {
|
||||
if (actor->IsHitboxTouched(false)) {
|
||||
q20 distance = actor->DistanceToLink();
|
||||
if (distance < minDistance) {
|
||||
*ref = actor->mRef;
|
||||
minDistance = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ARM void ActorManager::Actor_vfunc_10(u32 param1) {
|
||||
Actor *actor;
|
||||
int i;
|
||||
@@ -89,7 +106,7 @@ ARM Actor *ActorManager::FindActorById(s32 id) {
|
||||
if ((cacheIndex >= 0) && (cacheIndex < this->mMaxActorIndex)) {
|
||||
pActor = this->mActorTable;
|
||||
if (pActor[cacheIndex] != NULL) {
|
||||
if ((Actor **) (u32) pActor[cacheIndex]->mAlive != NULL && id == pActor[cacheIndex]->mId) {
|
||||
if ((Actor **) (u32) pActor[cacheIndex]->mAlive != NULL && id == pActor[cacheIndex]->mRef.id) {
|
||||
actor = pActor[cacheIndex];
|
||||
goto ret;
|
||||
}
|
||||
@@ -102,7 +119,7 @@ ARM Actor *ActorManager::FindActorById(s32 id) {
|
||||
for (; pActor < lastActor; pActor = pActor + 1) {
|
||||
if (*pActor != NULL) {
|
||||
actorId = (u32) (*pActor)->mAlive;
|
||||
if (actorId != 0 && id == (*pActor)->mId) {
|
||||
if (actorId != 0 && id == (*pActor)->mRef.id) {
|
||||
actor = *pActor;
|
||||
break;
|
||||
}
|
||||
@@ -114,7 +131,7 @@ ret:
|
||||
return actor;
|
||||
}
|
||||
|
||||
Actor *ActorManager::GetActor(ActorRef *ref) {
|
||||
ARM Actor *ActorManager::GetActor(ActorRef *ref) {
|
||||
Actor *pActor;
|
||||
u32 alive;
|
||||
|
||||
@@ -127,7 +144,7 @@ Actor *ActorManager::GetActor(ActorRef *ref) {
|
||||
pActor = this->mActorTable[alive];
|
||||
if (pActor != NULL) {
|
||||
alive = pActor->mAlive;
|
||||
if (alive != 0 && ref->id == pActor->mId) {
|
||||
if (alive != 0 && ref->id == pActor->mRef.id) {
|
||||
return pActor;
|
||||
}
|
||||
}
|
||||
@@ -135,7 +152,143 @@ Actor *ActorManager::GetActor(ActorRef *ref) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ActorManager::Actor_vfunc_28() {
|
||||
ARM bool FilterActor::Filter(Actor *actor) {
|
||||
if (mType != actor->mType) return false;
|
||||
if (mUnk_08 != -1 && mUnk_08 != actor->mUnk_034) return false;
|
||||
if (mExcludeRefs != NULL) {
|
||||
for (s32 i = 0; mExcludeRefs[i].id != -1; ++i) {
|
||||
if (mExcludeRefs[i].id == actor->mRef.id) return false;
|
||||
}
|
||||
}
|
||||
if (mExcludeNotInAABB) {
|
||||
Vec3p pos;
|
||||
pos.x = actor->mPos.x;
|
||||
pos.y = actor->mPos.y;
|
||||
pos.z = actor->mPos.z;
|
||||
bool result = !mAABB.ContainsInXZ(&pos);
|
||||
if (result) return false;
|
||||
}
|
||||
if (mExcludeNotInSphere) {
|
||||
Vec3p pos;
|
||||
pos.x = actor->mPos.x;
|
||||
pos.y = actor->mPos.y;
|
||||
pos.z = actor->mPos.z;
|
||||
bool result = !mSphere.ContainsInXZ(&pos);
|
||||
if (result) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ARM s32 ActorManager::FilterActors(FilterActorBase *filter, ActorList *filteredActors) {
|
||||
s32 numApplied = 0;
|
||||
if (filteredActors != NULL) filteredActors->length = 0;
|
||||
|
||||
Actor **actorIter = mActorTable;
|
||||
Actor **actorTableEnd = actorIter + mMaxActorIndex;
|
||||
for (; actorIter < actorTableEnd; actorIter++) {
|
||||
Actor *actor = *actorIter;
|
||||
if (actor != NULL && actor->mAlive && filter->Filter(actor)) {
|
||||
if (filteredActors != NULL && filteredActors->length < filteredActors->capacity) {
|
||||
ActorRef *ref = &filteredActors->actors[filteredActors->length];
|
||||
|
||||
*ref = (*actorIter)->mRef;
|
||||
filteredActors->length += 1;
|
||||
}
|
||||
numApplied += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return numApplied;
|
||||
}
|
||||
|
||||
ARM void ActorManager::FindActorByType(ActorRef *ref, ActorManager *actorMgr, ActorTypeId type) {
|
||||
ref->Reset();
|
||||
|
||||
Actor **actorIter = actorMgr->mActorTable;
|
||||
Actor **actorTableEnd = actorIter + actorMgr->mMaxActorIndex;
|
||||
|
||||
for (; actorIter < actorTableEnd; actorIter++) {
|
||||
Actor *actor = *actorIter;
|
||||
if (actor != NULL && actor->mAlive && type == actor->mType) {
|
||||
*ref = actor->mRef;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ARM void ActorManager::FindNearestActorOfType(ActorRef *ref, ActorManager *actorMgr, ActorTypeId type, Vec3p *pos) {
|
||||
ref->Reset();
|
||||
|
||||
q20 minDistance = 0x7fffffff;
|
||||
|
||||
Actor **actorIter = actorMgr->mActorTable;
|
||||
Actor **actorTableEnd = actorIter + actorMgr->mMaxActorIndex;
|
||||
|
||||
for (; actorIter < actorTableEnd; actorIter++) {
|
||||
Actor *actor = *actorIter;
|
||||
if (actor != NULL && actor->mAlive && type == actor->mType) {
|
||||
q20 distance = Vec3p_Distance(&actor->mPos, pos);
|
||||
if (distance < minDistance) {
|
||||
*ref = (*actorIter)->mRef;
|
||||
minDistance = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ARM bool ActorManager::func_ov00_020c398c(u32 index) {
|
||||
return func_ov000_020c3f08(mUnk_14, index);
|
||||
}
|
||||
|
||||
ARM void ActorManager::func_ov00_020c399c(u32 index, Cylinder *cylinder) {
|
||||
func_ov000_020c3f3c(mUnk_14, index, cylinder);
|
||||
}
|
||||
|
||||
ARM Actor *ActorManager::func_ov00_020c39ac(u32 index, ActorTypeId *actorTypes, bool param3) {
|
||||
if (actorTypes == NULL && param3) return NULL;
|
||||
|
||||
Actor *actor = mActorTable[index];
|
||||
Actor *result = NULL;
|
||||
if (actor != NULL && actor->mAlive) {
|
||||
if (actorTypes != NULL || mMaxActorIndex > 0) {
|
||||
for (s16 i = 0; i < mMaxActorIndex; ++i) {
|
||||
if (i != index) {
|
||||
Actor *otherActor = mActorTable[i];
|
||||
if (otherActor != NULL && func_ov000_020c3f08(mUnk_14, i)) {
|
||||
if ((actorTypes == NULL && !param3) ||
|
||||
(this->ActorTypeIsOneOf(mActorTable[i]->mType, actorTypes) != param3))
|
||||
{
|
||||
Cylinder oldHitbox = otherActor->mHitbox;
|
||||
// q20 x = otherActor->mHitbox.pos.x;
|
||||
// q20 y = otherActor->mHitbox.pos.y;
|
||||
// q20 z = otherActor->mHitbox.pos.z;
|
||||
// q20 size = otherActor->mHitbox.size;
|
||||
Cylinder *newHitbox = func_ov000_020c3ef0(mUnk_14, i);
|
||||
|
||||
otherActor->mHitbox = *newHitbox;
|
||||
if (otherActor->CollidesWith(actor)) result = otherActor;
|
||||
otherActor->mHitbox = oldHitbox;
|
||||
// otherActor->mHitbox.pos.x = x;
|
||||
// otherActor->mHitbox.pos.y = y;
|
||||
// otherActor->mHitbox.pos.z = z;
|
||||
// otherActor->mHitbox.size = size;
|
||||
|
||||
if (result != NULL) return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ARM s32 ActorManager::func_ov00_020c3b2c(s32 *param1) {}
|
||||
ARM s32 ActorManager::func_ov00_020c3bb0(unk32 param1, s32 *param2) {}
|
||||
ARM void ActorManager::func_ov00_020c3ce8(unk32 param1, unk32 param2) {}
|
||||
|
||||
ARM void ActorManager::Actor_vfunc_28() {
|
||||
int i;
|
||||
Actor **pActor;
|
||||
|
||||
@@ -149,13 +302,11 @@ void ActorManager::Actor_vfunc_28() {
|
||||
}
|
||||
}
|
||||
|
||||
char nullStr[] = "LLUN";
|
||||
|
||||
ARM static bool ActorTypeIsOneOf(char *type, char **types) {
|
||||
ARM bool ActorManager::ActorTypeIsOneOf(ActorTypeId type, ActorTypeId *types) {
|
||||
int i;
|
||||
bool found = false;
|
||||
|
||||
for (i = 0; *types != nullStr; i++) {
|
||||
for (i = 0; *types != ActorTypeId_Null; i++) {
|
||||
if (type == *types) {
|
||||
found = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user