diff options
| author | Mike <mikebuntu68@gmail.com> | 2024-05-05 15:56:39 -0400 |
|---|---|---|
| committer | Mike <mikebuntu68@gmail.com> | 2024-07-20 11:33:18 -0400 |
| commit | f1559f1ef11b525d32f54275ef6d09871fdc074a (patch) | |
| tree | 57bf25314317eb2fd347f1d39648ec19b0b10acc /src/00_Core/Actor/ActorManager.cpp | |
| parent | 900fe701574c03be0674b4c9a908aeb19b40ce3a (diff) | |
Add nonmatching function for `FindActorById`
Diffstat (limited to 'src/00_Core/Actor/ActorManager.cpp')
| -rw-r--r-- | src/00_Core/Actor/ActorManager.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/00_Core/Actor/ActorManager.cpp b/src/00_Core/Actor/ActorManager.cpp index 55efc223..27acf972 100644 --- a/src/00_Core/Actor/ActorManager.cpp +++ b/src/00_Core/Actor/ActorManager.cpp @@ -141,3 +141,45 @@ void NONMATCH(ActorManager::Actor_vfunc_10)(u32 param1) { return; #endif } + +Actor* NONMATCH(ActorManager::FindActorById)(s32 id) { + #ifndef NONMATCHING + #include "../asm/ov00/Actor/ActorManager_Actor_FindActorById.inc" + #else + 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; + actor = this->mActorTable[cacheIndex]; + if (actor != NULL) { + pActor = (Actor**)(u32)actor->mAlive; + if (pActor != NULL && id == actor->mId) { + return actor; + } + } + } + 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; + } + } + } + } + + return actor; + #endif +} |
