diff --git a/assets/xml/objects/gameplay_field_keep.xml b/assets/xml/objects/gameplay_field_keep.xml
index 537d596a6b..a73a2f28db 100644
--- a/assets/xml/objects/gameplay_field_keep.xml
+++ b/assets/xml/objects/gameplay_field_keep.xml
@@ -26,12 +26,12 @@
-
-
-
+
+
+
-
+
diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml
index a6504f2f37..265f1d5601 100644
--- a/assets/xml/objects/gameplay_keep.xml
+++ b/assets/xml/objects/gameplay_keep.xml
@@ -882,8 +882,8 @@
-
-
+
+
@@ -892,14 +892,14 @@
-
+
-
+
diff --git a/assets/xml/objects/object_dor02.xml b/assets/xml/objects/object_dor02.xml
index 0b64a9b1bd..c60fa9ba98 100644
--- a/assets/xml/objects/object_dor02.xml
+++ b/assets/xml/objects/object_dor02.xml
@@ -1,7 +1,7 @@
-
-
-
+
+
+
diff --git a/assets/xml/objects/object_dor03.xml b/assets/xml/objects/object_dor03.xml
index c374837eaf..941fa6fcc1 100644
--- a/assets/xml/objects/object_dor03.xml
+++ b/assets/xml/objects/object_dor03.xml
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/assets/xml/objects/object_dor04.xml b/assets/xml/objects/object_dor04.xml
index 2d1ac5611d..394f5a6fe0 100644
--- a/assets/xml/objects/object_dor04.xml
+++ b/assets/xml/objects/object_dor04.xml
@@ -1,7 +1,7 @@
-
-
-
+
+
+
diff --git a/assets/xml/objects/object_kaizoku_obj.xml b/assets/xml/objects/object_kaizoku_obj.xml
index a38d16827b..8dd96770a0 100644
--- a/assets/xml/objects/object_kaizoku_obj.xml
+++ b/assets/xml/objects/object_kaizoku_obj.xml
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/assets/xml/objects/object_numa_obj.xml b/assets/xml/objects/object_numa_obj.xml
index e8035b3e86..a450cf11a2 100644
--- a/assets/xml/objects/object_numa_obj.xml
+++ b/assets/xml/objects/object_numa_obj.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/assets/xml/objects/object_wdor04.xml b/assets/xml/objects/object_wdor04.xml
index 040df15980..07ad601dd2 100644
--- a/assets/xml/objects/object_wdor04.xml
+++ b/assets/xml/objects/object_wdor04.xml
@@ -1,7 +1,7 @@
-
-
-
+
+
+
diff --git a/assets/xml/objects/object_wdor05.xml b/assets/xml/objects/object_wdor05.xml
index f8fda23221..6eb0f4ed08 100644
--- a/assets/xml/objects/object_wdor05.xml
+++ b/assets/xml/objects/object_wdor05.xml
@@ -1,7 +1,7 @@
-
-
-
+
+
+
diff --git a/spec b/spec
index 12c9d6e3c2..ec0af718ed 100644
--- a/spec
+++ b/spec
@@ -775,8 +775,6 @@ beginseg
name "ovl_En_Door"
compress
include "build/src/overlays/actors/ovl_En_Door/z_en_door.o"
- include "build/data/ovl_En_Door/ovl_En_Door.data.o"
- include "build/data/ovl_En_Door/ovl_En_Door.bss.o"
include "build/data/ovl_En_Door/ovl_En_Door.reloc.o"
endseg
diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c
index b803b291ce..915687125c 100644
--- a/src/code/z_en_hy_code.c
+++ b/src/code/z_en_hy_code.c
@@ -61,21 +61,21 @@ s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) {
EnDoor* nearestDoor = NULL;
Actor* doorIter = NULL;
- EnDoor* door;
f32 dist;
+ EnDoor* door;
s32 isSetup = false;
f32 minDist = 0.0f;
do {
doorIter = SubS_FindActor(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR);
door = (EnDoor*)doorIter;
- dist = Actor_DistanceBetweenActors(actor, &door->actor);
+ dist = Actor_DistanceBetweenActors(actor, &door->dyna.actor);
if (!isSetup || (dist < minDist)) {
nearestDoor = door;
minDist = dist;
isSetup = true;
}
- doorIter = door->actor.next;
+ doorIter = door->dyna.actor.next;
} while (doorIter != NULL);
if (1) {}
@@ -130,20 +130,20 @@ s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeleton
void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, EnDoor* door, s16 arg3, s16 arg4) {
s32 pad;
- s8 sp3B;
+ s8 animIndex;
Vec3f offset;
f32 phi_f0;
- Actor_OffsetOfPointInActorCoords(&door->actor, &offset, &enHy->actor.world.pos);
+ Actor_OffsetOfPointInActorCoords(&door->dyna.actor, &offset, &enHy->actor.world.pos);
phi_f0 = (offset.z >= 0.0f) ? 1.0f : -1.0f;
- sp3B = ((s8)phi_f0 < 0) ? 0 : 2;
- EnHy_ChangeObjectAndAnim(enHy, globalCtx, (sp3B == 0) ? arg3 : arg4);
+ animIndex = ((s8)phi_f0 < 0) ? 0 : 2;
+ EnHy_ChangeObjectAndAnim(enHy, globalCtx, (animIndex == 0) ? arg3 : arg4);
enHy->skelAnime.baseTransl = *enHy->skelAnime.jointTable;
enHy->skelAnime.prevTransl = *enHy->skelAnime.jointTable;
enHy->skelAnime.moveFlags |= 3;
AnimationContext_SetMoveActor(globalCtx, &enHy->actor, &enHy->skelAnime, 1.0f);
door->unk_1A1 = 1;
- door->unk_1A0 = sp3B;
+ door->animIndex = animIndex;
}
s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5) {
@@ -157,7 +157,7 @@ s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3
if (door != NULL) {
ret = true;
func_800F0BB4(enHy, globalCtx, door, arg3, arg4);
- yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->actor.world.pos);
+ yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->dyna.actor.world.pos);
enHy->actor.world.pos.x += arg5 * Math_SinS(yaw);
enHy->actor.world.pos.z += arg5 * Math_CosS(yaw);
enHy->actor.world.rot.y = -yaw;
@@ -179,7 +179,7 @@ s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
if (door != NULL) {
ret = true;
func_800F0BB4(enHy, globalCtx, door, arg2, arg3);
- enHy->actor.shape.rot.y = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->actor.world.pos);
+ enHy->actor.shape.rot.y = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->dyna.actor.world.pos);
enHy->actor.world.rot.y = enHy->actor.shape.rot.y;
enHy->actor.gravity = 0.0f;
enHy->actor.flags &= ~ACTOR_FLAG_1;
diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c
index eda9731259..52a5b07dac 100644
--- a/src/code/z_sub_s.c
+++ b/src/code/z_sub_s.c
@@ -21,7 +21,7 @@ EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 unk_1A5) {
break;
}
- if ((door->unk_1A4 == 5) && (door->unk_1A5 == (u8)unk_1A5)) {
+ if ((door->unk_1A4 == 5) && (door->switchFlag == (u8)unk_1A5)) {
break;
}
diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c
index f907ae4215..e5733c2b16 100644
--- a/src/overlays/actors/ovl_En_Door/z_en_door.c
+++ b/src/overlays/actors/ovl_En_Door/z_en_door.c
@@ -5,6 +5,20 @@
*/
#include "z_en_door.h"
+#include "objects/object_mkk/object_mkk.h"
+#include "objects/object_dor01/object_dor01.h"
+#include "objects/object_dor02/object_dor02.h"
+#include "objects/object_dor03/object_dor03.h"
+#include "objects/object_dor04/object_dor04.h"
+#include "objects/object_wdor01/object_wdor01.h"
+#include "objects/object_wdor02/object_wdor02.h"
+#include "objects/object_wdor03/object_wdor03.h"
+#include "objects/object_wdor04/object_wdor04.h"
+#include "objects/object_wdor05/object_wdor05.h"
+#include "objects/gameplay_keep/gameplay_keep.h"
+#include "objects/object_numa_obj/object_numa_obj.h"
+#include "objects/object_kaizoku_obj/object_kaizoku_obj.h"
+#include "objects/gameplay_field_keep/gameplay_field_keep.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -15,7 +29,115 @@ void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx);
-#if 0
+void func_80866B20(EnDoor*, GlobalContext*);
+void func_8086704C(EnDoor*, GlobalContext*);
+void func_80866F94(EnDoor*, GlobalContext*);
+void func_80867080(EnDoor*, GlobalContext*);
+void func_80867144(EnDoor*, GlobalContext*);
+void func_808670F0(EnDoor*, GlobalContext*);
+void func_80866A5C(EnDoor*, GlobalContext*);
+
+u8 D_808675D0[] = {
+ 0x0C, 0x00, 0x03, 0x0E, 0x02, 0x06, 0x00, 0x17, 0x00, 0x08,
+ 0x02, 0x00, 0x00, 0x06, 0x00, 0x02, 0x09, 0x07, 0x05, 0x00,
+};
+
+u8 D_808675E4[] = {
+ 0x0F, 0x09, 0x00, 0x47, 0x0F, 0x0C, 0x00, 0x15, 0x0C, 0x00, 0x01, 0x13, 0x11, 0x00, 0x0F, 0x0D,
+ 0x00, 0x0A, 0x0F, 0x0F, 0x00, 0x07, 0x0F, 0x00, 0x00, 0x02, 0x09, 0x09, 0x05, 0x09, 0x08, 0x0C,
+ 0x00, 0x02, 0x19, 0x00, 0x1C, 0x08, 0x07, 0x0F, 0x0D, 0x00, 0x02, 0x09, 0x09, 0x05, 0x0F, 0x0D,
+ 0x00, 0xEA, 0x0F, 0x11, 0x00, 0xE7, 0x0F, 0x00, 0x00, 0xE2, 0x09, 0x09, 0x0F, 0x0D, 0x00, 0xDC,
+ 0x0F, 0x0D, 0x00, 0xD9, 0x0F, 0x12, 0x00, 0x01, 0x05, 0x09, 0x09, 0x09, 0x09, 0x00, 0x00, 0x00,
+};
+
+u8 D_80867634[] = {
+ 0x02, 0x06, 0x00, 0x17, 0x00, 0x02, 0x09, 0x1C, 0x05, 0x00, 0x00, 0x00,
+};
+
+u8 D_80867640[] = {
+ 0x02, 0x15, 0x00, 0x16, 0x00, 0x01, 0x05, 0x09, 0x0B, 0x00, 0x00, 0x00,
+};
+u8 D_8086764C[] = {
+ 0x02, 0x16, 0x00, 0x05, 0x00, 0x02, 0x09, 0x0A, 0x05, 0x00, 0x00, 0x00,
+};
+u8 D_80867658[] = {
+ 0x0C, 0x00, 0x02, 0x0F, 0x00, 0x1C, 0x08, 0x02, 0x09, 0x0C, 0x02, 0x0F, 0x0A, 0x16, 0x00,
+ 0x02, 0x09, 0x0C, 0x05, 0x0C, 0x00, 0x03, 0x11, 0x0F, 0x0D, 0x00, 0x0D, 0x00, 0x33, 0x08,
+ 0x02, 0x09, 0x0C, 0x0F, 0x16, 0x00, 0x02, 0x09, 0x0C, 0x05, 0x09, 0x0C, 0x00, 0x00,
+};
+
+u8 D_80867684[] = { 0x05, 0x00, 0x00, 0x00 };
+
+u8 D_80867688[] = { 0x0F, 0x16, 0x00, 0x02, 0x09, 0x0F, 0x05, 0x00 };
+
+u8 D_80867690[] = { 0x0F, 0x16, 0x00, 0x02, 0x09, 0x10, 0x05, 0x00 };
+
+u8 D_80867698[] = { 0x0F, 0x16, 0x00, 0x02, 0x09, 0x11, 0x05, 0x00 };
+
+u8 D_808676A0[] = {
+ 0x02, 0x0A, 0x00, 0x15, 0x00, 0x0F, 0x02, 0x16, 0x00, 0x05, 0x00, 0x02,
+ 0x09, 0x12, 0x08, 0x02, 0x02, 0x09, 0x22, 0x09, 0x21, 0x05, 0x00, 0x00,
+};
+
+u8 D_808676B8[] = {
+ 0x08, 0x00, 0x14, 0x0C, 0x00, 0x03, 0x07, 0x0F, 0x08, 0x00, 0x01, 0x05,
+ 0x09, 0x13, 0x02, 0x08, 0x00, 0x14, 0x1E, 0x02, 0x09, 0x13, 0x05, 0x05,
+};
+
+u8 D_808676D0[] = { 0x05, 0x00, 0x00, 0x00 };
+
+u8 D_808676D4[] = { 0x05, 0x00, 0x00, 0x00 };
+
+u8 D_808676D8[] = { 0x0C, 0x00, 0x03, 0x05, 0x0F, 0x12, 0x00, 0x01, 0x05, 0x09, 0x14, 0x00 };
+
+u8 D_808676E4[] = { 0x08, 0x00, 0x02, 0x09, 0x16, 0x05, 0x00, 0x00 };
+
+u8 D_808676EC[] = { 0x05, 0x00, 0x00, 0x00 };
+
+u8 D_808676F0[] = {
+ 0x0C, 0x00, 0x03, 0x05, 0x0F, 0x0A, 0x00, 0x07, 0x05, 0x02,
+ 0x0A, 0x00, 0x14, 0x00, 0xF9, 0x09, 0x15, 0x00, 0x00, 0x00,
+};
+
+u8 D_80867704[] = { 0x05, 0x00, 0x00, 0x00 };
+u8 D_80867708[] = { 0x05, 0x00, 0x00, 0x00 };
+u8 D_8086770C[] = { 0x05, 0x00, 0x00, 0x00 };
+u8 D_80867710[] = { 0x05, 0x00, 0x00, 0x00 };
+
+u8 D_80867714[] = { 0x0F, 0x14, 0x00, 0x02, 0x09, 0x17, 0x05, 0x00 };
+
+u8 D_8086771C[] = {
+ 0x0C, 0x00, 0x01, 0x07, 0x0F, 0x02, 0x1E, 0x02, 0x09, 0x18, 0x05, 0x0C,
+ 0x00, 0x03, 0xFB, 0x0F, 0x14, 0x00, 0xF7, 0x09, 0x0C, 0x00, 0x00, 0x00,
+};
+
+u8 D_80867734[] = { 0x0F, 0x14, 0x00, 0x02, 0x09, 0x19, 0x05, 0x00 };
+
+u8 D_8086773C[] = { 0x0F, 0x14, 0x00, 0x02, 0x09, 0x1A, 0x05, 0x00 };
+
+u8 D_80867744[] = {
+ 0x0C, 0x00, 0x02, 0x04, 0x00, 0x63, 0x80, 0x06, 0x0F, 0x14, 0x00, 0x08,
+ 0x09, 0x1B, 0x0F, 0x12, 0x00, 0x02, 0x09, 0x1B, 0x05, 0x00, 0x00, 0x00,
+};
+
+u8 D_8086775C[] = {
+ 0x00, 0x34, 0x20, 0x17, 0x00, 0x4B, 0x20, 0x13, 0x00, 0x0E, 0x04, 0x02, 0x09, 0x1D,
+ 0x00, 0x3B, 0x01, 0x08, 0x00, 0x3D, 0x02, 0x02, 0x09, 0x1E, 0x09, 0x1F, 0x05, 0x05,
+};
+
+u8 D_80867778[] = { 0x09, 0x20, 0x00, 0x00 };
+u8 D_8086777C[] = { 0x05, 0x00, 0x00, 0x00 };
+u8 D_80867780[] = { 0x05, 0x00, 0x00, 0x00 };
+u8 D_80867784[] = { 0x0F, 0x16, 0x00, 0x02, 0x09, 0x23, 0x05, 0x00 };
+
+// void* seems to keep the compiler happy.
+void* D_8086778C[] = {
+ &D_808675D0, &D_808675E4, &D_80867634, &D_80867640, &D_8086764C, &D_80867658, &D_80867684, &D_80867688,
+ &D_80867690, &D_80867698, &D_808676A0, &D_808676B8, &D_808676D0, &D_808676D4, &D_808676D8, &D_808676E4,
+ &D_808676EC, &D_808676F0, &D_80867704, &D_80867708, &D_8086770C, &D_80867710, &D_80867714, &D_8086771C,
+ &D_80867734, &D_8086773C, &D_80867744, &D_8086775C, &D_80867778, &D_8086777C, &D_80867780, &D_80867784,
+};
+
const ActorInit En_Door_InitVars = {
ACTOR_EN_DOOR,
ACTORCAT_DOOR,
@@ -28,38 +150,395 @@ const ActorInit En_Door_InitVars = {
(ActorFunc)EnDoor_Draw,
};
-// static InitChainEntry sInitChain[] = {
-static InitChainEntry D_80867954[] = {
+typedef struct {
+ /* 0x00 */ s16 sceneNum;
+ /* 0x02 */ u8 dListIndex;
+ /* 0x04 */ s16 objectId;
+} EnDoorInfo;
+
+static EnDoorInfo sObjInfo[] = {
+ { SCENE_MITURIN, 0x01, OBJECT_NUMA_OBJ },
+ { SCENE_TENMON_DAI, 0x02, OBJECT_DOR01 },
+ { SCENE_00KEIKOKU, 0x02, OBJECT_DOR01 },
+ { SCENE_30GYOSON, 0x02, OBJECT_DOR01 },
+ { SCENE_LABO, 0x02, OBJECT_DOR01 },
+ { SCENE_33ZORACITY, 0x03, OBJECT_DOR02 },
+ { SCENE_UNSET_31, 0x03, OBJECT_DOR02 },
+ { SCENE_BANDROOM, 0x03, OBJECT_DOR02 },
+ { SCENE_20SICHITAI, 0x04, OBJECT_DOR03 },
+ { SCENE_20SICHITAI2, 0x04, OBJECT_DOR03 },
+ { SCENE_MAP_SHOP, 0x04, OBJECT_DOR03 },
+ { SCENE_KAIZOKU, 0x0B, OBJECT_KAIZOKU_OBJ },
+ { SCENE_PIRATE, 0x0B, OBJECT_KAIZOKU_OBJ },
+ { SCENE_TORIDE, 0x0B, OBJECT_KAIZOKU_OBJ },
+ { SCENE_KINDAN2, 0x0C, OBJECT_KINSTA2_OBJ },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x08, OBJECT_WDOR03 },
+ { -1, 0x07, OBJECT_WDOR02 },
+ { -1, 0x06, OBJECT_WDOR01 },
+ { -1, 0x07, OBJECT_WDOR02 },
+ { -1, 0x06, OBJECT_WDOR01 },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x09, OBJECT_WDOR04 },
+ { -1, 0x08, OBJECT_WDOR03 },
+ { -1, 0x08, OBJECT_WDOR03 },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x06, OBJECT_WDOR01 },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x00, GAMEPLAY_KEEP },
+ { -1, 0x0A, OBJECT_WDOR05 },
+ { -1, 0x0D, GAMEPLAY_FIELD_KEEP },
+ { -1, 0x05, OBJECT_DOR04 },
+ { -1, 0x09, OBJECT_WDOR04 },
+ { -1, 0x04, OBJECT_DOR03 },
+};
+
+static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, 0, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
ICHAIN_U16(shape.rot.x, 0, ICHAIN_CONTINUE),
ICHAIN_U16(shape.rot.z, 0, ICHAIN_STOP),
};
-#endif
+static AnimationHeader* sAnimations[] = {
+ &gameplay_keep_Anim_020658, &gameplay_keep_Anim_022CA8, &gameplay_keep_Anim_020658, &gameplay_keep_Anim_022E68,
+ &gameplay_keep_Anim_0204B4, &gameplay_keep_Anim_022BE8, &gameplay_keep_Anim_022D90, &gameplay_keep_Anim_022BE8,
+ &gameplay_keep_Anim_022FF0, &gameplay_keep_Anim_0205A0,
+};
+static u8 sAnimOpenFrames[10] = {
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+};
-extern InitChainEntry D_80867954[];
+static u8 sAnimCloseFrames[10] = {
+ 60, 60, 60, 70, 70, 60, 60, 60, 60, 70,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/EnDoor_Init.s")
+static Gfx* D_808679A4[14][2] = {
+ { gDoorLeftDL, gDoorRightDL },
+ { gWoodfallDoorDL, gWoodfallDoorDL },
+ { object_dor01_DL_000448, object_dor01_DL_000448 },
+ { gZoraHallDoorDL, gZoraHallDoorDL },
+ { gSwampDoorDL, gSwampDoorDL },
+ { gMagicHagPotionShopDoorDL, gMagicHagPotionShopDoorDL },
+ { object_wdor01_DL_000548, object_wdor01_DL_000548 }, // Lottery Shop / Curiosity Shop / Mayor's House Door
+ { object_wdor02_DL_000548, object_wdor02_DL_000548 }, // Trading Post / Post Office Door
+ { object_wdor03_DL_000548, object_wdor03_DL_000548 }, // Stockpot Inn & Swordsman's School Door
+ { gMilkBarDoorDL, gMilkBarDoorDL },
+ { gMusicBoxHouseDoorDL, gMusicBoxHouseDoorDL },
+ { gPiratesFortressDoorDL, gPiratesFortressDoorDL },
+ { object_mkk_DL_000310, object_mkk_DL_000310 },
+ { gFieldWoodDoorLeftDL, gFieldWoodDoorRightDL },
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/EnDoor_Destroy.s")
+void EnDoor_Init(Actor* thisx, GlobalContext* globalCtx2) {
+ GlobalContext* globalCtx = globalCtx2;
+ s32 objectBankIndex;
+ EnDoorInfo* objectInfo = sObjInfo;
+ EnDoor* this = THIS;
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_80866A5C.s")
+ Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_80866B20.s")
+ this->unk_1A4 = ENDOOR_GET_PARAMS_7(thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_80866F94.s")
+ this->switchFlag = ENDOOR_GET_PARAMS_7F(thisx);
+ if ((this->unk_1A4 == 7) && (this->switchFlag == 0)) {
+ DynaPolyActor_Init(&this->dyna, 0);
+ DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gDoorCol);
+ }
+ SkelAnime_Init(globalCtx, &this->skelAnime, &gDoorSkel, &gameplay_keep_Anim_020658, this->limbTable,
+ this->limbTable, 5);
+ if (this->unk_1A4 == 5) {
+ objectInfo = &sObjInfo[17 + this->switchFlag];
+ } else {
+ for (i = 0; i < ARRAY_COUNT(sObjInfo) - 34; i++, objectInfo++) {
+ if (globalCtx->sceneNum == objectInfo->sceneNum) {
+ break;
+ }
+ }
+ if ((i >= ARRAY_COUNT(sObjInfo) - 34) && (Object_GetIndex(&globalCtx->objectCtx, GAMEPLAY_FIELD_KEEP) >= 0)) {
+ objectInfo++;
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_8086704C.s")
+ this->dlIndex = objectInfo->dListIndex;
+ objectBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectInfo->objectId);
+ if (objectBankIndex < 0) {
+ objectInfo = &sObjInfo[15];
+ objectBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectInfo->objectId);
+ if (objectBankIndex != 0) {
+ Actor_MarkForDeath(&this->dyna.actor);
+ return;
+ }
+ }
+ this->requiredObjBankIndex = objectBankIndex;
+ this->dlIndex = objectInfo->dListIndex; // Set twice?
+ if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex) {
+ func_80866A5C(this, globalCtx);
+ } else {
+ this->actionFunc = func_80866A5C;
+ }
+ Actor_SetFocus(&this->dyna.actor, 35.0f);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_80867080.s")
+void EnDoor_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnDoor* this = (EnDoor*)thisx;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_808670F0.s")
+ if (this->unk_1A4 != 7) {
+ TransitionActorEntry* transitionEntry =
+ &globalCtx->doorCtx.transitionActorList[(u16)this->dyna.actor.params >> 0xA];
+ if (transitionEntry->id < 0) {
+ transitionEntry->id = -transitionEntry->id;
+ }
+ } else if (this->switchFlag == 0) {
+ DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_80867144.s")
+void func_80866A5C(EnDoor* this, GlobalContext* globalCtx) {
+ if (Object_IsLoaded(&globalCtx->objectCtx, this->requiredObjBankIndex)) {
+ this->dyna.actor.objBankIndex = this->requiredObjBankIndex;
+ this->actionFunc = func_80866B20;
+ this->dyna.actor.world.rot.y = 0;
+ if (this->unk_1A4 == 1) {
+ if (!Flags_GetSwitch(globalCtx, this->switchFlag)) {
+ this->unk_1A6 = 10;
+ }
+ } else if ((this->unk_1A4 == 4) &&
+ (Actor_XZDistanceBetweenActors(&this->dyna.actor, &GET_PLAYER(globalCtx)->actor) > 120.0f)) {
+ this->actionFunc = func_8086704C;
+ this->dyna.actor.world.rot.y = -0x1800;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/EnDoor_Update.s")
+void func_80866B20(EnDoor* this, GlobalContext* globalCtx) {
+ static s32 D_80867BC0[4];
+ Player* player = GET_PLAYER(globalCtx);
+ Vec3f playerPosRelToDoor;
+ s16 temp_a2;
+ s16 yawDiff;
+ s32 temp_a1_2;
+ s32 temp_t0;
+ u8 temp_a1;
+ s32 pad;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/func_80867350.s")
+ if (Actor_ProcessTalkRequest(&this->dyna.actor, &globalCtx->state) && (this->dyna.actor.textId == 0x1821)) {
+ D_80867BC0[0] = 1;
+ }
+ if (this->unk_1A1 != 0) {
+ this->actionFunc = func_80867144;
+ Animation_PlayOnceSetSpeed(&this->skelAnime, sAnimations[this->animIndex],
+ (player->stateFlags1 & 0x8000000) ? 0.75f : 1.5f);
+ if (this->unk_1A6 != 0) {
+ gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--;
+ Flags_SetSwitch(globalCtx, this->switchFlag);
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK);
+ }
+ } else if (this->unk_1A7 != 0) {
+ this->actionFunc = func_80866F94;
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_OPEN);
+ } else if (!Player_InCsMode(&globalCtx->state)) {
+ Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &playerPosRelToDoor, &player->actor.world.pos);
+ if ((D_80867BC0[0] != 0) || ((fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) &&
+ (fabsf(playerPosRelToDoor.z) < 50.0f))) {
+ yawDiff = player->actor.shape.rot.y - this->dyna.actor.shape.rot.y;
+ if (playerPosRelToDoor.z > 0.0f) {
+ yawDiff = (0x8000 - yawDiff);
+ }
+ if (ABS_ALT(yawDiff) < 0x3000) {
+ player->doorType = 1;
+ player->doorDirection = playerPosRelToDoor.z >= 0.0f ? 1.0f : -1.0f;
+ player->doorActor = &this->dyna.actor;
+ if (this->unk_1A6 != 0) {
+ if (gSaveContext.inventory.dungeonKeys[((void)0, gSaveContext.mapIndex)] <= 0) {
+ player->doorType = -1;
+ this->dyna.actor.textId = 0x1802;
+ } else {
+ player->doorTimer = 10;
+ }
+ } else if (this->unk_1A4 == 4) {
+ player->doorType = -1;
+ this->dyna.actor.textId = 0x1800;
+ } else if ((this->unk_1A4 == 0) || (this->unk_1A4 == 2) || (this->unk_1A4 == 3)) {
+ s32 textIdOffset;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Door/EnDoor_Draw.s")
+ temp_t0 = (globalCtx->actorCtx.unkC & 0x2AA) >> 1;
+ temp_a2 = D_801AED48[this->switchFlag & 7];
+ temp_a1_2 = globalCtx->actorCtx.unkC & 0x155;
+ textIdOffset = (this->switchFlag >> 3) & 0xF;
+ if (((this->unk_1A4 == 0) && (((temp_t0 | temp_a1_2) & temp_a2) == 0)) ||
+ ((this->unk_1A4 == 2) && ((temp_a2 & temp_a1_2) == 0)) ||
+ ((this->unk_1A4 == 3) && ((temp_a2 & temp_t0) == 0))) {
+ s16 baseTextId = 0x182D;
+
+ if (this->unk_1A4 == 3) {
+ baseTextId = 0x180D;
+ } else if (this->unk_1A4 == 2) {
+ baseTextId = 0x181D;
+ }
+ player->doorType = -1;
+ this->dyna.actor.textId = baseTextId + textIdOffset;
+ }
+ } else if ((this->unk_1A4 == 5) && (playerPosRelToDoor.z > 0.0f)) {
+ struct_80133038_arg2 sp30;
+
+ if (func_80133038(globalCtx, D_8086778C[this->switchFlag], &sp30) != 0) {
+ this->dyna.actor.textId = sp30.unk0 + 0x1800;
+
+ player->doorType = ((this->dyna.actor.textId == 0x1821) && (D_80867BC0[0] != 0)) ? 5 : -1;
+ }
+ }
+ func_80122F28(player);
+ }
+ } else if ((this->unk_1A4 == 4) && (this->dyna.actor.xzDistToPlayer > 240.0f)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_OPEN);
+ this->actionFunc = func_80867080;
+ }
+ }
+}
+
+void func_80866F94(EnDoor* this, GlobalContext* globalCtx) {
+ s32 direction;
+
+ if (this->unk_1A7 != 0) {
+ if (this->unk_1A7 >= 0) {
+ direction = 1;
+ } else {
+ direction = -1;
+ }
+ if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, direction * 0x3E80, 0x7D0)) {
+ Math_StepToC(&this->unk_1A7, 0, 1);
+ }
+ } else {
+ if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, 0, 0x7D0)) {
+ this->actionFunc = func_80866B20;
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_AUTO_DOOR_CLOSE);
+ }
+ }
+}
+
+void func_8086704C(EnDoor* this, GlobalContext* globalCtx) {
+ if (this->dyna.actor.xzDistToPlayer < 120.0f) {
+ this->actionFunc = func_808670F0;
+ }
+}
+
+void func_80867080(EnDoor* this, GlobalContext* globalCtx) {
+ if (this->dyna.actor.xzDistToPlayer < 120.0f) {
+ this->actionFunc = func_808670F0;
+ } else if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, -0x1800, 0x100)) {
+ this->actionFunc = func_8086704C;
+ }
+}
+
+void func_808670F0(EnDoor* this, GlobalContext* globalCtx) {
+ if (Math_ScaledStepToS(&this->dyna.actor.world.rot.y, 0, 0x700)) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_CLOSE);
+ this->actionFunc = func_80866B20;
+ }
+}
+
+void func_80867144(EnDoor* this, GlobalContext* globalCtx) {
+ s32 numEffects;
+ s32 i;
+
+ if (DECR(this->unk_1A6) == 0) {
+ if (SkelAnime_Update(&this->skelAnime) != 0) {
+ this->actionFunc = func_80866B20;
+ this->unk_1A1 = 0;
+ } else if (Animation_OnFrame(&this->skelAnime, sAnimOpenFrames[this->animIndex])) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_OC_DOOR_OPEN);
+ if (this->skelAnime.playSpeed < 1.5f) {
+ numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50;
+ for (i = 0; i < numEffects; i++) {
+ EffectSsBubble_Spawn(globalCtx, &this->dyna.actor.world.pos, 60.0, 100.0f, 50.0f, 0.15f);
+ }
+ }
+ } else if (Animation_OnFrame(&this->skelAnime, sAnimCloseFrames[this->animIndex])) {
+ Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_DOOR_CLOSE);
+ }
+ }
+}
+
+void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnDoor* this = THIS;
+
+ this->actionFunc(this, globalCtx);
+}
+
+s32 EnDoor_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
+ Actor* thisx) {
+ TransitionActorEntry* transitionEntry;
+ EnDoor* this = THIS;
+
+ if (limbIndex == 4) {
+ Gfx** dl = D_808679A4[this->dlIndex];
+ s16 temp;
+ s32 dlIndex;
+
+ transitionEntry = NULL;
+
+ if (this->unk_1A4 != 7) {
+ transitionEntry = &globalCtx->doorCtx.transitionActorList[(u16)this->dyna.actor.params >> 0xA];
+ }
+ rot->z += this->dyna.actor.world.rot.y;
+ if ((this->unk_1A4 == 7) || (globalCtx->roomCtx.prevRoom.num >= 0) ||
+ (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) {
+ s32 pad;
+
+ temp = (this->dyna.actor.shape.rot.y + this->skelAnime.jointTable[3].z + rot->z) -
+ Math_Vec3f_Yaw(&globalCtx->view.eye, &this->dyna.actor.world.pos);
+ *dList = (ABS_ALT(temp) < 0x4000) ? dl[0] : dl[1];
+
+ } else {
+ dlIndex = 0;
+ if (transitionEntry->sides[0].room != this->dyna.actor.room) {
+ dlIndex = 1;
+ }
+ *dList = dl[dlIndex];
+ }
+ }
+ return 0;
+}
+
+void EnDoor_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ EnDoor* this = THIS;
+
+ if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex) {
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+ if ((this->unk_1A4 == 7) && (this->switchFlag == 0)) {
+ Gfx_DrawDListOpa(globalCtx, gameplay_keep_DL_0221B8);
+ } else {
+ func_8012C28C(globalCtx->state.gfxCtx);
+ }
+ SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDoor_OverrideLimbDraw,
+ NULL, &this->dyna.actor);
+ if (this->dyna.actor.world.rot.y != 0) {
+ if (this->dyna.actor.world.rot.y > 0) {
+ gSPDisplayList(POLY_OPA_DISP++, gDoorRightDL);
+ } else {
+ gSPDisplayList(POLY_OPA_DISP++, gDoorLeftDL);
+ }
+ }
+ if (this->unk_1A6) {
+ Actor_DrawDoorLock(globalCtx, this->unk_1A6, 0);
+ }
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+ }
+}
diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.h b/src/overlays/actors/ovl_En_Door/z_en_door.h
index 6ed5aac156..bc94e150ee 100644
--- a/src/overlays/actors/ovl_En_Door/z_en_door.h
+++ b/src/overlays/actors/ovl_En_Door/z_en_door.h
@@ -7,19 +7,24 @@ struct EnDoor;
typedef void (*EnDoorActionFunc)(struct EnDoor*, GlobalContext*);
+#define ENDOOR_GET_PARAMS_7(thisx) (((thisx)->params >> 7) & 7)
+#define ENDOOR_GET_PARAMS_7F(thisx) (((thisx)->params) & 0x7F)
+
+
typedef struct EnDoor {
- /* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x5C];
- /* 0x1A0 */ s8 unk_1A0;
- /* 0x1A1 */ s8 unk_1A1;
- /* 0x1A2 */ char unk_1A2[0x2];
+ /* 0x000 */ DynaPolyActor dyna;
+ /* 0x15C */ SkelAnime skelAnime;
+ /* 0x1A0 */ u8 animIndex;
+ /* 0x1A1 */ u8 unk_1A1;
+ /* 0x1A2 */ s8 requiredObjBankIndex;
+ /* 0x1A3 */ s8 dlIndex;
/* 0x1A4 */ u8 unk_1A4;
- /* 0x1A5 */ u8 unk_1A5;
- /* 0x1A6 */ s8 unk_1A6;
+ /* 0x1A5 */ u8 switchFlag;
+ /* 0x1A6 */ u8 unk_1A6;
/* 0x1A7 */ s8 unk_1A7;
- /* 0x1A8 */ char unk_1A8[0x20];
+ /* 0x1A8 */ Vec3s limbTable[5];
/* 0x1C8 */ EnDoorActionFunc actionFunc;
-} EnDoor; // size = 0x1CC
+} EnDoor;
extern const ActorInit En_Door_InitVars;
diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
index 9be7b1a003..cdfda5ba91 100644
--- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c
+++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
@@ -922,7 +922,7 @@ s32 func_8094F7D0(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) {
u16 sp56 = gSaveContext.time - 0x3FFC;
u8 sp55 = ENGM_GET_FF(&this->actor);
- EnDoor* sp50;
+ EnDoor* door;
Vec3s* sp4C;
Vec3f sp40;
Vec3f sp34;
@@ -930,13 +930,13 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
s32 ret = false;
this->unk_234 = NULL;
- sp50 = func_8094DF90(globalCtx, arg2->unk0);
+ door = func_8094DF90(globalCtx, arg2->unk0);
if (D_80951A0C[arg2->unk0] >= 0) {
this->unk_234 = func_8013BB34(globalCtx, sp55, D_80951A0C[arg2->unk0]);
}
- if ((sp50 != NULL) && (sp50->actor.update != NULL)) {
+ if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if (this->unk_234 != NULL) {
sp4C = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points);
Math_Vec3s_ToVec3f(&sp40, &sp4C[0]);
@@ -946,7 +946,7 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp40, &sp34);
Math_Vec3f_Copy(&this->actor.world.pos, &sp40);
- if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, sp50->actor.shape.rot.y)) <= 0x4000) {
+ if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, door->dyna.actor.shape.rot.y)) <= 0x4000) {
this->unk_261 = -75;
} else {
this->unk_261 = 75;
@@ -1357,18 +1357,18 @@ s32 func_80950690(EnGm* this, GlobalContext* globalCtx) {
}
s32 func_80950804(EnGm* this, GlobalContext* globalCtx) {
- EnDoor* sp44;
+ EnDoor* door;
Vec3f sp38;
s32 pad;
f32 temp_f0;
- sp44 = func_8094DF90(globalCtx, this->unk_258);
+ door = func_8094DF90(globalCtx, this->unk_258);
if (!func_8013AD6C(globalCtx) && (this->unk_3C4 != 0)) {
- if ((sp44 != NULL) && (sp44->actor.update != NULL)) {
+ if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if ((this->unk_3BA / (f32)this->unk_3B8) <= 0.9f) {
- sp44->unk_1A7 = this->unk_261;
+ door->unk_1A7 = this->unk_261;
} else {
- sp44->unk_1A7 = 0;
+ door->unk_1A7 = 0;
}
}
diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c
index 15ef372bdb..c43f065dcb 100644
--- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c
+++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c
@@ -511,7 +511,7 @@ s32 func_80BF1D78(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) {
u16 sp56 = gSaveContext.time - 0x3FFC;
u8 sp55 = ENIG_GET_FF(&this->actor);
- EnDoor* sp50;
+ EnDoor* door;
Vec3s* sp4C;
Vec3f sp40;
Vec3f sp34;
@@ -519,13 +519,13 @@ s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
s32 ret = false;
this->unk_274 = NULL;
- sp50 = func_80BF1200(globalCtx, arg2->unk0);
+ door = func_80BF1200(globalCtx, arg2->unk0);
if (D_80BF3318[arg2->unk0] >= 0) {
this->unk_274 = func_8013BB34(globalCtx, sp55, D_80BF3318[arg2->unk0]);
}
- if ((sp50 != NULL) && (sp50->actor.update != NULL)) {
+ if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if (this->unk_274 != NULL) {
sp4C = Lib_SegmentedToVirtual(this->unk_274->points);
Math_Vec3s_ToVec3f(&sp40, &sp4C[0]);
@@ -535,7 +535,7 @@ s32 func_80BF1DF4(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp40, &sp34);
Math_Vec3f_Copy(&this->actor.world.pos, &sp40);
- if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, sp50->actor.shape.rot.y)) <= 0x4000) {
+ if (ABS_ALT(BINANG_SUB(this->actor.world.rot.y, door->dyna.actor.shape.rot.y)) <= 0x4000) {
this->unk_2A4 = -75;
} else {
this->unk_2A4 = 75;
@@ -697,17 +697,17 @@ s32 func_80BF2400(EnIg* this, GlobalContext* globalCtx) {
}
s32 func_80BF2470(EnIg* this, GlobalContext* globalCtx) {
- EnDoor* sp44 = func_80BF1200(globalCtx, this->unk_298.unk0);
+ EnDoor* door = func_80BF1200(globalCtx, this->unk_298.unk0);
Vec3f sp38;
f32 temp;
s32 pad;
if (!func_8013AD6C(globalCtx) && (this->unk_3EC != 0)) {
- if ((sp44 != NULL) && (sp44->actor.update != NULL)) {
+ if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if (((f32)this->unk_3E2 / this->unk_3E0) <= 0.9f) {
- sp44->unk_1A7 = this->unk_2A4;
+ door->unk_1A7 = this->unk_2A4;
} else {
- sp44->unk_1A7 = 0;
+ door->unk_1A7 = 0;
}
}
this->unk_3E2 = CLAMP(this->unk_3E2, 0, this->unk_3E0);
diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c
index fe043938a8..10648fa3f7 100644
--- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c
+++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c
@@ -935,7 +935,7 @@ s32 func_80AF8ED4(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) {
u16 sp56 = gSaveContext.time - 0x3FFC;
u8 sp55 = this->actor.params & 0xFF;
- EnDoor* sp50;
+ EnDoor* door;
Vec3s* sp4C;
Vec3f sp40;
Vec3f sp34;
@@ -943,12 +943,12 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
s32 ret = false;
this->unk_234 = NULL;
- sp50 = func_80AF7D60(globalCtx, arg2->unk0);
+ door = func_80AF7D60(globalCtx, arg2->unk0);
if (D_80AFB430[arg2->unk0] >= 0) {
this->unk_234 = func_8013BB34(globalCtx, sp55, D_80AFB430[arg2->unk0]);
}
- if ((sp50 != NULL) && (sp50->actor.update != NULL)) {
+ if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if (this->unk_234 != 0) {
sp4C = (Vec3s*)Lib_SegmentedToVirtual(this->unk_234->points);
Math_Vec3s_ToVec3f(&sp40, &sp4C[0]);
@@ -957,7 +957,7 @@ s32 func_80AF9008(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
Math_Vec3f_Copy(&this->unk_278, &sp34);
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp40, &sp34);
Math_Vec3f_Copy(&this->actor.world.pos, &sp40);
- temp = this->actor.world.rot.y - sp50->actor.shape.rot.y;
+ temp = this->actor.world.rot.y - door->dyna.actor.shape.rot.y;
if (ABS_ALT(temp) <= 0x4000) {
this->unk_260 = -0x4B;
} else {
@@ -1402,17 +1402,17 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
}
s32 func_80AF9D04(EnPm* this, GlobalContext* globalCtx) {
- EnDoor* sp44 = func_80AF7D60(globalCtx, this->unk_258);
+ EnDoor* door = (EnDoor*)func_80AF7D60(globalCtx, this->unk_258);
Vec3f sp38;
Vec3f* sp28;
f32 temp;
if (!func_8013AD6C(globalCtx) && (this->unk_374 != 0)) {
- if ((sp44 != NULL) && (sp44->actor.update != NULL)) {
+ if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if (((f32)this->unk_36E / this->unk_36C) <= 0.9f) {
- sp44->unk_1A7 = this->unk_260;
+ door->unk_1A7 = this->unk_260;
} else {
- sp44->unk_1A7 = 0;
+ door->unk_1A7 = 0;
}
}
this->unk_36E = CLAMP(this->unk_36E, 0, this->unk_36C);
diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c
index 1e7e8f0d16..f7b5a339ec 100644
--- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c
+++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c
@@ -383,7 +383,7 @@ void func_80AECE0C(EnTk* this, GlobalContext* globalCtx) {
}
s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
- EnDoor* sp4C4;
+ EnDoor* door;
f32 spA0[265];
Vec3f sp94;
Vec3f sp88;
@@ -436,7 +436,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
this->unk_3D4 = sp7C;
}
- sp4C4 = NULL;
+ door = NULL;
if (!(this->unk_2CA & 0xC00)) {
door1 = NULL;
label:
@@ -447,7 +447,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
if (ABS(BINANG_SUB(Actor_YawToPoint(&this->actor, &door1->world.pos), this->actor.shape.rot.y)) <=
0x2000) {
this->unk_2CA |= 0x400;
- sp4C4 = (EnDoor*)door1;
+ door = (EnDoor*)door1;
break;
}
}
@@ -460,7 +460,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
door2 = SubS_FindActor(globalCtx, door2, ACTORCAT_DOOR, ACTOR_EN_DOOR);
if (door2 != NULL) {
if (Actor_XZDistanceBetweenActors(&this->actor, door2) <= 160.0f) {
- sp4C4 = (EnDoor*)door2;
+ door = (EnDoor*)door2;
break;
}
door2 = door2->next;
@@ -468,19 +468,19 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
} while (door2 != NULL);
}
- if ((sp4C4 != NULL) && (this->unk_2CA & 0x400)) {
+ if ((door != NULL) && (this->unk_2CA & 0x400)) {
Vec3f sp5C;
- Actor_OffsetOfPointInActorCoords(&this->actor, &sp5C, &sp4C4->actor.world.pos);
- sp4C4->unk_1A7 = 2;
+ Actor_OffsetOfPointInActorCoords(&this->actor, &sp5C, &door->dyna.actor.world.pos);
+ door->unk_1A7 = 2;
if (sp5C.z < -20.0f) {
this->unk_2CA &= ~0x400;
this->unk_2CA |= 0x800;
}
}
- if (sp4C4 != NULL) {
- if ((this->unk_2CA & 0x800) && (sp4C4->unk_1A7 == 0)) {
+ if (door != NULL) {
+ if ((this->unk_2CA & 0x800) && (door->unk_1A7 == 0)) {
this->unk_2CA &= ~0x800;
}
}
diff --git a/tools/actorfixer.py b/tools/actorfixer.py
index c54a72422b..5eae310c4b 100755
--- a/tools/actorfixer.py
+++ b/tools/actorfixer.py
@@ -247,6 +247,8 @@ animdict = {
"BgCheck_CreateVertexFromVec3f": "BgCheck_Vec3fToVec3s",
"BgCheck_PolygonGetMinY": "CollisionPoly_GetMinY",
"BgCheck_PolygonGetNormal": "CollisionPoly_GetNormalF",
+ "BcCheck3_BgActorInit": "DynaPolyActor_Init",
+ "BgCheck3_LoadMesh": "DynaPolyActor_LoadMesh",
"func_800C01B8": "CollisionPoly_GetPointDistanceFromPlane",
"BgCheck_CreateTriNormFromPolygon": "CollisionPoly_GetVertices",
"func_800C02C0": "CollisionPoly_GetVerticesByBgId",
@@ -411,6 +413,7 @@ animdict = {
"func_800A81F0": "EffectBlure_AddVertex",
"func_800A8514": "EffectBlure_AddSpace",
"Effect_GetParams": "Effect_GetByIndex",
+
"func_801343C0": "SkelAnime_DrawTransformFlexOpa",
"func_80134148": "SkelAnime_DrawTransformFlexLimbOpa",
"func_8013AB00": "SubS_DrawTransformFlex",
@@ -446,6 +449,7 @@ animdict = {
"skelAnime.prevFrameRot": "skelAnime.prevRot",
"skelAnime.prevFramePos": "skelAnime.prevTransl",
"skelAnime.unk3E": "skelAnime.baseTransl",
+
"actor.minVelocityY": "actor.terminalVelocity",
"actor.yDistToWater": "actor.depthInWater",
"actor.yDistToPlayer": "actor.playerHeightRel",
@@ -464,12 +468,13 @@ animdict = {
"globalCtx->msgCtx.unk1202C": "globalCtx->msgCtx.ocarinaAction",
"globalCtx->msgCtx.unk11F22": "globalCtx->msgCtx.msgMode",
- # Variables
- "D_0407D590": "gGameplayKeepDrawFlameDL",
- "D_801D15B0": "gZeroVec3f",
- "D_801D15BC": "gZeroVec3s",
- "D_801D1DE0": "gIdentityMtx",
- "D_801D1E20": "gIdentityMtxF",
+ "D_801D15B0" : "gZeroVec3f",
+ "D_801D15BC" : "gZeroVec3s",
+ "D_801D1DE0" : "gIdentityMtx",
+ "D_801D1E20" : "gIdentityMtxF",
+ "D_04020658" : "gameplay_keep_Anim_020658",
+ "D_04022B28" : "gDoorSkel",
+ "D_04023100" : "gDoorCol",
# Structs
"ActorAnimationEntry": "AnimationInfo",
@@ -513,20 +518,20 @@ def replace_anim_all(repo):
for filename in files:
if(filename.endswith('.s')):
file = subdir + os.sep + filename
- replace_anim(file)
+ replace_anim(file)
for subdir, dirs, files in os.walk(repo + os.sep + 'data'):
for filename in files:
if(filename.endswith('.s')):
file = subdir + os.sep + filename
replace_anim(file)
-
+
for subdir, dirs, files in os.walk(repo + os.sep + 'docs'):
for filename in files:
if(filename.endswith('.md')):
file = subdir + os.sep + filename
replace_anim(file)
-
+
for subdir, dirs, files in os.walk(repo + os.sep + 'tools' + os.sep + 'sizes'):
for filename in files:
if(filename.endswith('.csv')):
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 1f4d019f0d..e1bf5f8070 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -4960,7 +4960,7 @@
0x808670F0:("func_808670F0",),
0x80867144:("func_80867144",),
0x8086732C:("EnDoor_Update",),
- 0x80867350:("func_80867350",),
+ 0x80867350:("EnDoor_OverrideLimbDraw",),
0x808674B0:("EnDoor_Draw",),
0x80867BD0:("func_80867BD0",),
0x80867BDC:("func_80867BDC",),
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index d0678cc717..3af06baa57 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -5618,13 +5618,11 @@
0x80867784:("D_80867784","UNK_TYPE1","",0x1),
0x8086778C:("D_8086778C","UNK_PTR","",0x4),
0x8086780C:("En_Door_InitVars","UNK_TYPE1","",0x1),
- 0x8086782C:("D_8086782C","UNK_TYPE2","",0x2),
- 0x80867886:("D_80867886","UNK_TYPE1","",0x1),
- 0x8086788A:("D_8086788A","UNK_TYPE2","",0x2),
- 0x80867954:("D_80867954","UNK_TYPE1","",0x1),
- 0x80867964:("D_80867964","UNK_TYPE1","",0x1),
- 0x8086798C:("D_8086798C","UNK_TYPE1","",0x1),
- 0x80867998:("D_80867998","UNK_TYPE1","",0x1),
+ 0x8086782C:("sObjInfo","UNK_TYPE2","",0x126),
+ 0x80867954:("sInitChain","UNK_TYPE1","",0x1),
+ 0x80867964:("sAnimations","AnimationHeader","[10]",0x28),
+ 0x8086798C:("sAnimOpenFrames","u8","[10]",0x10),
+ 0x80867998:("sAnimCloseFrames","u8","[10]",0x10),
0x808679A4:("D_808679A4","UNK_TYPE1","",0x1),
0x80867A20:("D_80867A20","f32","",0x4),
0x80867BC0:("D_80867BC0","UNK_TYPE1","",0x1),
diff --git a/undefined_syms.txt b/undefined_syms.txt
index c3647b9158..d30baf7870 100644
--- a/undefined_syms.txt
+++ b/undefined_syms.txt
@@ -396,8 +396,6 @@ D_04020658 = 0x04020658;
D_04020BB8 = 0x04020BB8;
D_04020D00 = 0x04020D00;
D_040221B8 = 0x040221B8;
-D_04022B28 = 0x04022B28;
-D_04023100 = 0x04023100;
D_04023130 = 0x04023130;
D_04023210 = 0x04023210;
D_04023288 = 0x04023288;