mirror of
https://github.com/zeldaret/ph
synced 2026-07-11 22:40:17 -04:00
Match ActorType.s
This commit is contained in:
@@ -1,14 +1,73 @@
|
||||
#include "Actor/ActorType.hpp"
|
||||
|
||||
#ifdef STUBS
|
||||
|
||||
ActorTypeList sActorTypeList;
|
||||
ActorTypeList sActorTypeList2;
|
||||
|
||||
ActorType::ActorType(ActorTypeId id, ActorCreateFunc create, void *unk_08) {}
|
||||
ActorType::~ActorType() {}
|
||||
void ActorType::func_0203e7c8() {}
|
||||
void ActorType::Register() {}
|
||||
void ActorType::Unregister() {}
|
||||
ActorType* ActorType::Find(ActorTypeId id) {}
|
||||
// Kill duplicate dtors
|
||||
KILL(_ZN9ActorTypeC2EjPFP5ActorvEPFivE)
|
||||
KILL(_ZN9ActorTypeD2Ev)
|
||||
|
||||
#endif
|
||||
ARM ActorType::ActorType(ActorTypeId id, ActorCreateFunc create, unk32 (*unk_08)()) {
|
||||
this->id = id;
|
||||
this->create = create;
|
||||
this->unk_08 = unk_08;
|
||||
this->unk_0c = 0;
|
||||
this->next = NULL;
|
||||
this->Register();
|
||||
sActorTypeList.tail = this;
|
||||
}
|
||||
|
||||
ARM ActorType::~ActorType() {
|
||||
this->Unregister();
|
||||
}
|
||||
|
||||
ARM unk32 ActorType::func_0203e7c8() {
|
||||
if (this->unk_08 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return (*unk_08)();
|
||||
}
|
||||
|
||||
ARM void ActorType::Register() {
|
||||
ActorType *actorType;
|
||||
ActorType **tail = &sActorTypeList.tail;
|
||||
|
||||
for (actorType = sActorTypeList.head; actorType != NULL; actorType = actorType->next) {
|
||||
tail = &actorType->next;
|
||||
}
|
||||
|
||||
*tail = this;
|
||||
}
|
||||
|
||||
ARM void NONMATCH(ActorType::Unregister)() {
|
||||
#ifndef NONMATCHING
|
||||
#include "../asm/main/Actor/ActorType_Unregister.inc"
|
||||
#else
|
||||
ActorType *actorType;
|
||||
|
||||
ActorType **current = &sActorTypeList2.head;
|
||||
ActorType **previous = NULL;
|
||||
|
||||
for (actorType = sActorTypeList.head; actorType != NULL; actorType = actorType->next) {
|
||||
if (actorType == this) break;
|
||||
previous = current;
|
||||
current = &actorType->next;
|
||||
}
|
||||
|
||||
if (previous != NULL) {
|
||||
(*previous)->next = this->next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ARM ActorType *ActorType::Find(ActorTypeId id) {
|
||||
ActorType *actorType;
|
||||
|
||||
for (actorType = sActorTypeList.head; actorType != NULL; actorType = actorType->next) {
|
||||
if (id == actorType->id) {
|
||||
return actorType;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user