summaryrefslogtreecommitdiff
path: root/src/00_Core/Actor
diff options
context:
space:
mode:
Diffstat (limited to 'src/00_Core/Actor')
-rw-r--r--src/00_Core/Actor/Actor.cpp28
-rw-r--r--src/00_Core/Actor/ActorManager.cpp7
-rw-r--r--src/00_Core/Actor/ActorSpawner.cpp104
-rw-r--r--src/00_Core/Actor/Dungeon/ActorActionObject.cpp85
-rw-r--r--src/00_Core/Actor/Dungeon/ActorEventIcon.cpp4
-rw-r--r--src/00_Core/Actor/Dungeon/ActorSwitchObject.cpp109
-rw-r--r--src/00_Core/Actor/Navi/ActorForceNavi.cpp14
-rw-r--r--src/00_Core/Actor/Navi/ActorNavi.cpp32
-rw-r--r--src/00_Core/Actor/Navi/ActorWisdomNavi.cpp14
9 files changed, 357 insertions, 40 deletions
diff --git a/src/00_Core/Actor/Actor.cpp b/src/00_Core/Actor/Actor.cpp
index f008064d..85f58869 100644
--- a/src/00_Core/Actor/Actor.cpp
+++ b/src/00_Core/Actor/Actor.cpp
@@ -5,6 +5,8 @@ extern "C" {
#include "Actor/Actor.hpp"
#include "Actor/ActorManager.hpp"
#include "Actor/ActorPlayerDummy.hpp"
+#include "DTCM/UnkStruct_027e077c.hpp"
+#include "DTCM/UnkStruct_027e103c.hpp"
#include "Item/ItemManager.hpp"
#include "Map/MapManager.hpp"
#include "Player/EquipSword.hpp"
@@ -46,8 +48,7 @@ ARM Actor::Actor() :
mUnk_010(0),
mUnk_011(0),
mUnk_012(0),
- mUnk_034(-1),
- mUnk_038(-1),
+ mUnk_034(-1, -1),
mUnk_03c(-1),
mUnk_040(-1, -1),
mGravity(FLOAT_TO_Q20(0.0498)),
@@ -111,11 +112,11 @@ ARM Actor::Actor() :
ARM Actor::~Actor() {}
-ARM bool Actor::vfunc_08() {
+ARM bool Actor::Init() {
return true;
}
-ARM void Actor::vfunc_0c() {}
+ARM bool Actor::vfunc_0c() {}
ARM void Actor::vfunc_10(u32 param1) {}
ARM void Actor::vfunc_24() {}
ARM void Actor::vfunc_28() {}
@@ -255,20 +256,9 @@ ARM bool Actor::func_ov00_020c195c() {
return true;
}
-struct UnkStruct2 {
- /* 0 */ u32 mUnk_0;
- /* 4 */ u32 mUnk_4;
- /* 8 */
-};
-extern UnkStruct2 data_027e077c;
-extern u8 data_02056be4[];
-extern "C" bool func_ov05_02103f4c(s32 param1);
-extern s32 data_027e103c;
ARM bool Actor::func_ov00_020c198c() {
- u32 unk1 = data_027e077c.mUnk_0;
- u32 unk2 = data_027e077c.mUnk_4;
- if (data_027e077c.mUnk_0 != data_027e077c.mUnk_4 || (data_02056be4[unk1] & 1) != 0 || (data_02056be4[unk2] & 4) != 0 ||
- func_ov05_02103f4c(data_027e103c) || gPlayer->mHealth <= 0)
+ if (data_027e077c.GetUnk0() != data_027e077c.GetUnk4() || (data_02056be4[data_027e077c.GetUnk0()] & 1) != 0 ||
+ (data_02056be4[data_027e077c.GetUnk4()] & 4) != 0 || data_027e103c->func_ov005_02103f4c() || gPlayer->mHealth <= 0)
{
return false;
}
@@ -318,8 +308,8 @@ ARM void Actor::SetTransform(Transform *transform) {
ARM void Actor::vfunc_a8() {}
-ARM void Actor::func_Ov00_020c1bfc(s32 param1) {
- gMapManager->func_ov00_02084be0(mUnk_020.mUnk_0a[param1], mUnk_020.mUnk_08[param1]);
+ARM bool Actor::func_ov00_020c1bfc(s32 param1) {
+ return gMapManager->func_ov00_02084be0(mUnk_020.mUnk_0a[param1], mUnk_020.mUnk_08[param1]);
}
ARM void Actor::func_ov00_020c1c20(s32 param1, unk32 param2) {
diff --git a/src/00_Core/Actor/ActorManager.cpp b/src/00_Core/Actor/ActorManager.cpp
index 73ab6bbb..955c447d 100644
--- a/src/00_Core/Actor/ActorManager.cpp
+++ b/src/00_Core/Actor/ActorManager.cpp
@@ -1,4 +1,5 @@
#include "Actor/ActorManager.hpp"
+#include "DTCM/UnkStruct_027e077c.hpp"
#include "DTCM/UnkStruct_027e103c.hpp"
#include "Map/MapManager.hpp"
@@ -8,8 +9,6 @@ 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) {
@@ -52,7 +51,7 @@ ARM void ActorManager::func_ov00_020c3484(ActorRef *ref, ActorManager *actorMgr,
q20 minDistance = 0x7fffffff;
Actor **actorIter = actorMgr->mActorTable;
- u8 unkByte = data_02056be4[data_027e077c];
+ u8 unkByte = data_02056be4[data_027e077c.GetUnk0()];
bool unk1 = (unkByte & 1) != 0;
Actor **actorTableEnd = actorIter + actorMgr->mMaxActorIndex;
@@ -155,7 +154,7 @@ ARM Actor *ActorManager::GetActor(ActorRef *ref) {
ARM bool FilterActor::Filter(Actor *actor) {
if (mType != actor->mType) return false;
- if (mUnk_08 != -1 && mUnk_08 != actor->mUnk_034) return false;
+ if (mUnk_08 != -1 && mUnk_08 != actor->mUnk_034.id) return false;
if (mExcludeRefs != NULL) {
for (s32 i = 0; mExcludeRefs[i].id != -1; ++i) {
ActorRef *ref = &mExcludeRefs[i];
diff --git a/src/00_Core/Actor/ActorSpawner.cpp b/src/00_Core/Actor/ActorSpawner.cpp
index 76b4ae74..55cf1a57 100644
--- a/src/00_Core/Actor/ActorSpawner.cpp
+++ b/src/00_Core/Actor/ActorSpawner.cpp
@@ -1,10 +1,98 @@
#include "Actor/ActorSpawner.hpp"
+#include "Actor/ActorManager.hpp"
+#include "Map/MapManager.hpp"
-ActorSpawner *ActorSpawner::Create() {}
-void ActorSpawner::Destroy() {}
-ActorSpawner::ActorSpawner() {}
-ActorSpawner::~ActorSpawner() {}
-void ActorSpawner::func_ov000_020c4014() {}
-void ActorSpawner::func_ov000_020c4018() {}
-Actor *ActorSpawner::CreateActor(ActorTypeId type) {}
-s32 ActorSpawner::Spawn(ActorTypeId type, Vec3p *pos, void *param3, ActorRef *ref) {}
+extern u32 *data_027e0ce0[];
+ARM ActorSpawner *ActorSpawner::Create() {
+ gActorSpawner = new(data_027e0ce0[1], 4) ActorSpawner();
+}
+
+ARM void ActorSpawner::Destroy() {
+ delete gActorSpawner;
+ gActorSpawner = NULL;
+}
+
+ARM ActorSpawner::ActorSpawner() {}
+
+ARM ActorSpawner::~ActorSpawner() {}
+
+ARM void ActorSpawner::func_ov000_020c4014() {}
+
+ARM void ActorSpawner::func_ov000_020c4018() {}
+
+ARM Actor *ActorSpawner::CreateActor(ActorTypeId typeId) {
+ Actor *actor = NULL;
+ ActorType *type = ActorType::Find(typeId);
+ if (type != NULL) {
+ actor = type->create();
+ }
+ return actor;
+}
+
+extern "C" unk32 GetCardinal(s16 angle);
+ARM s32 ActorSpawner::Spawn(ActorTypeId type, Vec3p *pos, ActorSpawnOptions *options, ActorRef *ref) {
+ ActorManager *actorManager = gActorManager;
+ u16 maxActors = actorManager->mMaxActors;
+ s32 id = -1;
+ s32 index;
+ Actor **actorSlot = actorManager->mActorTable;
+ for (index = 0; index < maxActors; index++, actorSlot++) {
+ if (*actorSlot != NULL) {
+ continue;
+ }
+
+ Actor *actor = this->CreateActor(type);
+ *actorSlot = actor;
+ if (actor == NULL) {
+ if (ref != NULL) {
+ ref->Reset();
+ }
+ return -1;
+ }
+ actor->mType = type;
+ (*actorSlot)->mRef.id = actorManager->mNextActorId;
+ (*actorSlot)->mRef.index = index;
+ (*actorSlot)->mUnk_014 = *pos;
+ (*actorSlot)->mUnk_020 = options->mUnk_00;
+ (*actorSlot)->mAngle = options->mAngle;
+ (*actorSlot)->mUnk_012 = options->mAngle;
+ (*actorSlot)->mUnk_074 = GetCardinal(options->mAngle);
+ if (options->mUnk_18 >= 0xffff) {
+ (*actorSlot)->mUnk_03c = -1;
+ } else {
+ (*actorSlot)->mUnk_03c = options->mUnk_18;
+ }
+ (*actorSlot)->mUnk_034 = options->mUnk_1c;
+ (*actorSlot)->mUnk_140 = options->mUnk_24;
+ (*actorSlot)->mUnk_144 = options->mUnk_28;
+ Actor *actor2 = *actorSlot;
+ actor2->mPos = *pos;
+ actor2->mPrevPos = *pos;
+ (*actorSlot)->mUnk_010 = gMapManager->GetCourseData_Unk_1c();
+ (*actorSlot)->mUnk_011 = gMapManager->GetCourseData_Unk_1d();
+ u16 nextIndex = index + 1;
+ if (actorManager->mMaxActorIndex < nextIndex) {
+ actorManager->mMaxActorIndex = nextIndex;
+ }
+ actorManager->mCacheEmptyActorIndex = index;
+
+ id = actorManager->mNextActorId;
+ if (ref != NULL) {
+ *ref = ActorRef(id, index);
+ }
+ actorManager->mNextActorId += 1;
+ actorManager->mNumActors += 1;
+ if (!(*actorSlot)->Init()) {
+ (*actorSlot)->mAlive = false;
+ if (ref != NULL) {
+ ref->Reset();
+ }
+ return -1;
+ }
+ break;
+ }
+ if ((id == -1) && (ref != NULL)) {
+ ref->Reset();
+ }
+ return id;
+}
diff --git a/src/00_Core/Actor/Dungeon/ActorActionObject.cpp b/src/00_Core/Actor/Dungeon/ActorActionObject.cpp
new file mode 100644
index 00000000..ea2dfec2
--- /dev/null
+++ b/src/00_Core/Actor/Dungeon/ActorActionObject.cpp
@@ -0,0 +1,85 @@
+#include "Actor/Dungeon/ActorActionObject.hpp"
+#include "Map/MapManager.hpp"
+#include "Player/LinkStateBase.hpp"
+#include "Player/PlayerLinkBase.hpp"
+#include "Save/AdventureFlags.hpp"
+
+#pragma section sbss begin
+ActorType ActorActionObject::gType = ActorType(ActorTypeId_ActionObject, (ActorCreateFunc) ActorActionObject::Create, NULL);
+#pragma section sbss end
+
+extern u32 **data_027e0fe0[];
+ARM ActorActionObject *ActorActionObject::Create() {
+ return new(*data_027e0fe0[0], 4) ActorActionObject();
+}
+
+ARM ActorActionObject::ActorActionObject() {}
+
+ARM ActorActionObject::~ActorActionObject() {}
+
+// non-matching
+ARM bool ActorActionObject::Init() {
+ mGravity = 0;
+ mHitbox.pos = gVec3p_ZERO;
+ mHitbox.size = -1;
+ mUnk_08c.pos = mHitbox.pos;
+ mUnk_08c.size = mHitbox.size;
+ mUnk_0a4.mUnk_04 = gVec3p_ZERO;
+ mUnk_0a4.mUnk_10 = -1;
+ mVisible = false;
+ mUnk_130 = 0;
+ return true;
+}
+
+ARM void ActorActionObject::vfunc_14(u32 param1) {
+ if (!this->func_ov00_020c313c(param1)) {
+ return;
+ }
+
+ u32 flag = mUnk_020.mUnk_00[2];
+ bool bVar3;
+ switch (mUnk_020.mUnk_00[0]) {
+ case 0: bVar3 = true; break;
+ case 1:
+ if (gPlayerLink->mGrabActor.id != -1 && gPlayerLink->GetStateId() == LinkStateId_Move) {
+ bVar3 = true;
+ } else {
+ bVar3 = false;
+ }
+ break;
+ case 2:
+ if (gPlayerLink->mGrabActor.id == -1 && gPlayerLink->GetStateId() == LinkStateId_Move) {
+ bVar3 = true;
+ } else {
+ bVar3 = false;
+ }
+ break;
+ default: bVar3 = false; break;
+ }
+
+ if (!bVar3) {
+ return;
+ }
+ if (!gMapManager->func_ov00_020836dc((u32) mUnk_020.mUnk_00[1], 0)) {
+ return;
+ }
+ if (mUnk_020.mUnk_0a[0] != 0 && !this->func_ov00_020c1bfc(0)) {
+ return;
+ }
+ if (flag != 0 && !gAdventureFlags->Get(flag)) {
+ return;
+ }
+
+ PlayerLinkBase *link = gPlayerLink;
+ if (link != NULL && link->vfunc_18(7)) {
+ if (mUnk_020.mUnk_00[3] == 1) {
+ link->func_ov000_020bcf50(&mPos, 0x800);
+ }
+ this->func_ov00_020c1c20(1, 1);
+ this->Kill();
+ }
+}
+
+ARM void ActorActionObject::vfunc_18(u32 param1) {
+ this->func_ov00_020c313c(param1);
+}
diff --git a/src/00_Core/Actor/Dungeon/ActorEventIcon.cpp b/src/00_Core/Actor/Dungeon/ActorEventIcon.cpp
index 8e943095..22e35d8e 100644
--- a/src/00_Core/Actor/Dungeon/ActorEventIcon.cpp
+++ b/src/00_Core/Actor/Dungeon/ActorEventIcon.cpp
@@ -4,10 +4,10 @@ ActorType ActorEventIcon::gType = ActorType(ActorTypeId_EventIcon, (ActorCreateF
ActorEventIcon *ActorEventIcon::Create() {}
ActorEventIcon::ActorEventIcon() {}
-bool ActorEventIcon::vfunc_08() {}
+bool ActorEventIcon::Init() {}
void ActorEventIcon::vfunc_14(u32 param1) {}
void ActorEventIcon::vfunc_18(u32 param1) {}
u32 ActorEventIcon::func_ov000_02090648(u32 param1) {}
-bool func_ov000_02090774(u32 param1) {}
+bool ActorEventIcon::func_ov000_02090774(u32 param1) {}
void ActorEventIcon::vfunc_1c(u16 *param1) {}
ActorEventIcon::~ActorEventIcon() {}
diff --git a/src/00_Core/Actor/Dungeon/ActorSwitchObject.cpp b/src/00_Core/Actor/Dungeon/ActorSwitchObject.cpp
index 37c4511c..78e229db 100644
--- a/src/00_Core/Actor/Dungeon/ActorSwitchObject.cpp
+++ b/src/00_Core/Actor/Dungeon/ActorSwitchObject.cpp
@@ -1,15 +1,110 @@
#include "Actor/Dungeon/ActorSwitchObject.hpp"
+#include "Map/MapManager.hpp"
ActorType ActorSwitchObject::gType = ActorType(ActorTypeId_SwitchObject, (ActorCreateFunc) ActorSwitchObject::Create, NULL);
ActorSwitchObject *ActorSwitchObject::Create() {}
-bool ActorSwitchObject::vfunc_08() {}
-void ActorSwitchObject::vfunc_0c() {}
-void ActorSwitchObject::vfunc_14(u32 param1) {}
-void ActorSwitchObject::vfunc_18(u32 param1) {}
-bool ActorSwitchObject::func_ov000_0208fc10(s32 param1) {}
-void ActorSwitchObject::func_ov000_0208fc7c() {}
+
+bool ActorSwitchObject::Init() {
+ Actor::Init();
+ this->func_ov000_0208fc7c();
+ this->mUnk_130 = 0;
+ return true;
+}
+
+bool ActorSwitchObject::vfunc_0c() {
+ return this->func_ov00_020c1bfc(0) ? this->func_ov000_0208fc10(1) : this->func_ov000_0208fc10(0);
+}
+
+void ActorSwitchObject::vfunc_14(u32 param1) {
+ bool bVar1;
+ u32 uVar2;
+ u32 uVar3;
+ s32 iVar4;
+ s32 iVar5;
+
+ bVar1 = this->func_ov00_020c313c(param1);
+ if (bVar1 == NULL) {
+ return;
+ }
+ uVar2 = this->mUnk_130;
+ switch (uVar2) {
+ default:
+ if (uVar2 == 2) {
+ break;
+ }
+ return;
+ case 0:
+ uVar3 = this->func_ov000_0208fcb4();
+ switch (uVar3) {
+ case 1: this->func_ov000_0208fc10(1); return;
+ case 2: this->func_ov000_0208fc10(2); return;
+ default: return;
+ }
+ bVar1 = this->func_ov000_0208fc10(2);
+ return;
+ case 1:
+ iVar4 = this->func_ov000_0208fcb4();
+ if (iVar4 == 1) {
+ return;
+ }
+ bVar1 = this->func_ov000_0208fc10(0);
+ return;
+ }
+
+ iVar5 = this->mActiveFrames + 1;
+ this->mActiveFrames = iVar5;
+ if (iVar5 < 0x1e) {
+ return;
+ }
+
+ this->func_ov000_0209032c();
+ bVar1 = this->func_ov000_0208fc10(0);
+
+ return;
+}
+
+void ActorSwitchObject::vfunc_18(u32 param1) {
+ this->vfunc_14(param1);
+}
+
+bool ActorSwitchObject::func_ov000_0208fc10(s32 param1) {
+ this->mUnk_130 = param1;
+
+ switch (param1) {
+ case 0: this->func_ov00_020c1c20(0, 0); break;
+ case 1:
+ this->func_ov00_020c1c20(0, 1);
+ if (this->mUnk_158 == 0) {
+ this->mAlive = false;
+ }
+ break;
+ case 2:
+ this->func_ov000_0208fef8();
+ this->mActiveFrames = 0;
+ break;
+ }
+
+ return true;
+}
+
+void ActorSwitchObject::func_ov000_0208fc7c() {
+ this->mUnk_158 = this->mUnk_020.mUnk_00[1];
+ this->mUnk_15c = this->mUnk_020.mUnk_00[2];
+ this->mUnk_164 = this->mUnk_020.mUnk_0a[1];
+ this->mUnk_168 = this->mUnk_164 + this->mUnk_020.mUnk_00[0];
+ this->mUnk_16c = this->mUnk_020.mUnk_08[1];
+ this->mUnk_160 = this->mUnk_164;
+}
+
bool ActorSwitchObject::func_ov000_0208fcb4() {}
void ActorSwitchObject::func_ov000_0208fef8() {}
-void ActorSwitchObject::func_ov000_0209032c() {}
+
+void ActorSwitchObject::func_ov000_0209032c() {
+ unk32 i;
+ for (i = this->mUnk_164; i < this->mUnk_168; i++) {
+ gMapManager->func_ov00_02084b38(i, this->mUnk_16c, 0);
+ }
+}
+
ActorSwitchObject::~ActorSwitchObject() {}
diff --git a/src/00_Core/Actor/Navi/ActorForceNavi.cpp b/src/00_Core/Actor/Navi/ActorForceNavi.cpp
new file mode 100644
index 00000000..04b83c13
--- /dev/null
+++ b/src/00_Core/Actor/Navi/ActorForceNavi.cpp
@@ -0,0 +1,14 @@
+#include "Actor/Navi/ActorForceNavi.hpp"
+
+#pragma section sbss begin
+ActorType ActorForceNavi::gType = ActorType(ActorTypeId_ForceNavi, (ActorCreateFunc) ActorForceNavi::Create, NULL);
+#pragma section sbss end
+
+extern u32 **data_027e0fe0[];
+ActorForceNavi *ActorForceNavi::Create() {
+ return new(*data_027e0fe0[0], 4) ActorForceNavi();
+}
+
+ARM FairyId ActorForceNavi::GetFairyId() {
+ return FairyId_Power;
+}
diff --git a/src/00_Core/Actor/Navi/ActorNavi.cpp b/src/00_Core/Actor/Navi/ActorNavi.cpp
new file mode 100644
index 00000000..7c195178
--- /dev/null
+++ b/src/00_Core/Actor/Navi/ActorNavi.cpp
@@ -0,0 +1,32 @@
+#include "Actor/Navi/ActorNavi.hpp"
+#include "Player/EquipHammer.hpp"
+
+ActorType ActorNavi::gType = ActorType(ActorTypeId_Navi, (ActorCreateFunc) ActorNavi::Create, NULL);
+UnkStruct_ov000_020b8110 data_ov000_020ee1cc;
+
+ActorNavi *ActorNavi::Create() {}
+UnkStruct_ov000_020b8110::UnkStruct_ov000_020b8110() :
+ UnkStruct_ov000_020beba8(7) {}
+UnkStruct_ov000_020b8110::~UnkStruct_ov000_020b8110() {}
+void UnkStruct_ov000_020b8110::vfunc_08(unk16 *param1) {}
+void UnkStruct_ov000_020b8110::vfunc_18(s32 *param1) {}
+void UnkStruct_ov000_020b8110::vfunc_14(u16 *param1) {}
+void ActorNavi::func_ov000_020b8200() {}
+void ActorNavi::vfunc_c4() {}
+void ActorNavi::vfunc_c8() {}
+FairyId ActorNavi::GetFairyId() {}
+s32 ActorNavi::vfunc_b8() {}
+void ActorNavi::vfunc_d4() {}
+void ActorNavi::vfunc_d0() {}
+void ActorNavi::SetActive(bool active) {}
+void ActorNavi::vfunc_e0() {}
+void ActorNavi::vfunc_d8() {}
+void ActorNavi::vfunc_20(bool param1) {}
+bool ActorNavi::vfunc_cc(unk32 *param1) {}
+bool ActorNavi::vfunc_c0(Vec3p *param1) {}
+void ActorNavi::vfunc_e8() {}
+bool ActorNavi::vfunc_8c() {}
+void ActorNavi::vfunc_ec() {}
+EquipHammer *GetEquipHammer() {}
+void ActorNavi::func_ov000_020b853c() {}
+ActorNavi::~ActorNavi() {}
diff --git a/src/00_Core/Actor/Navi/ActorWisdomNavi.cpp b/src/00_Core/Actor/Navi/ActorWisdomNavi.cpp
new file mode 100644
index 00000000..84c02e33
--- /dev/null
+++ b/src/00_Core/Actor/Navi/ActorWisdomNavi.cpp
@@ -0,0 +1,14 @@
+#include "Actor/Navi/ActorWisdomNavi.hpp"
+
+#pragma section sbss begin
+ActorType ActorWisdomNavi::gType = ActorType(ActorTypeId_WisdomNavi, (ActorCreateFunc) ActorWisdomNavi::Create, NULL);
+#pragma section sbss end
+
+extern u32 **data_027e0fe0[];
+ARM ActorWisdomNavi *ActorWisdomNavi::Create() {
+ return new(*data_027e0fe0[0], 4) ActorWisdomNavi();
+}
+
+ARM FairyId ActorWisdomNavi::GetFairyId() {
+ return FairyId_Wisdom;
+}