summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorangie <angheloalf95@gmail.com>2023-09-23 18:56:47 -0300
committerangie <angheloalf95@gmail.com>2023-09-23 18:56:47 -0300
commit6368519052d4f6ffbc557082ff39f7140e7fdd67 (patch)
treefc0d26baf855d71569f0cbc69b9fcd06c6ead382 /src
parentb88aa2c0fc996a911cadb2d34a0b18e6c3457c88 (diff)
Init and Destroy
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_En_An/z_en_an.c70
-rw-r--r--src/overlays/actors/ovl_En_An/z_en_an.h13
2 files changed, 77 insertions, 6 deletions
diff --git a/src/overlays/actors/ovl_En_An/z_en_an.c b/src/overlays/actors/ovl_En_An/z_en_an.c
index 3ab31bfb8..5c5739d39 100644
--- a/src/overlays/actors/ovl_En_An/z_en_an.c
+++ b/src/overlays/actors/ovl_En_An/z_en_an.c
@@ -53,7 +53,34 @@ extern UNK_TYPE D_06012618;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/func_80B539CC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/func_80B53A7C.s")
+Actor* func_80B53A7C(EnAn* this, PlayState* play, u8 actorCategory, s16 actorId) {
+ Actor* foundActor = NULL;
+
+ while (true) {
+ foundActor = SubS_FindActor(play, foundActor, actorCategory, actorId);
+
+ if (foundActor == NULL) {
+ break;
+ }
+
+ if ((this != (EnAn*)foundActor)) {
+ if ((foundActor->update != NULL) && !(foundActor->params & 0x8000)) {
+ break;
+ }
+ }
+
+ if (foundActor->next == NULL) {
+ foundActor = NULL;
+ break;
+ }
+
+ foundActor = foundActor->next;
+ }
+
+ return foundActor;
+}
+
+//#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/func_80B53A7C.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/func_80B53B3C.s")
@@ -159,9 +186,44 @@ extern UNK_TYPE D_06012618;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/func_80B57B48.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/EnAn_Init.s")
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/EnAn_Destroy.s")
+void EnAn_Init(Actor* thisx, PlayState* play) {
+ s32 pad;
+ EnAn* this = THIS;
+ s32 temp_v1; // sp1C
+ s32 temp_v0;
+
+ if (play->sceneId != SCENE_YADOYA) {
+ this->actor.params &= (s16)~0x8000;
+ }
+
+ temp_v1 = ENAN_GET_8000(&this->actor);
+ temp_v0 = gSaveContext.save.saveInfo.weekEventReg[0x33] & 0x40;
+
+ if (((temp_v0 == 0) && (temp_v1 == 1)) || ((temp_v0 != 0) && (temp_v1 == 0))) {
+ Actor_Kill(&this->actor);
+ return;
+ }
+
+ if (temp_v1 == 0) {
+ if (func_80B53A7C(this, play, ACTORCAT_NPC, ACTOR_EN_AN) != NULL) {
+ Actor_Kill(&this->actor);
+ return;
+ }
+ }
+
+ this->unk_214 = -0x80;
+ this->unk_3B8 = 0;
+ if (temp_v1 == 0) {
+ this->actor.room = -1;
+ }
+ this->actionFunc = func_80B577F0;
+}
+
+void EnAn_Destroy(Actor* thisx, PlayState* play) {
+ EnAn* this = THIS;
+
+ Collider_DestroyCylinder(play, &this->unk_190);
+}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_An/EnAn_Update.s")
diff --git a/src/overlays/actors/ovl_En_An/z_en_an.h b/src/overlays/actors/ovl_En_An/z_en_an.h
index 7f1a11930..b0c036315 100644
--- a/src/overlays/actors/ovl_En_An/z_en_an.h
+++ b/src/overlays/actors/ovl_En_An/z_en_an.h
@@ -7,11 +7,20 @@ struct EnAn;
typedef void (*EnAnActionFunc)(struct EnAn*, PlayState*);
+#define ENAN_GET_8000(thisx) (((thisx)->params & 0x8000) >> 0xF)
+
typedef struct EnAn {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x44];
+ /* 0x144 */ UNK_TYPE1 unk_144[0x44];
/* 0x188 */ EnAnActionFunc actionFunc;
- /* 0x18C */ char unk_18C[0x23C];
+ /* 0x18C */ UNK_TYPE1 unk_18C[0x4];
+ /* 0x190 */ ColliderCylinder unk_190;
+ /* 0x1DC */ UNK_TYPE1 pad_1DC[0x214-0x1DC];
+ /* 0x214 */ s8 unk_214;
+ /* 0x215 */ UNK_TYPE1 unk_215[0x3];
+ /* 0x218 */ UNK_TYPE1 unk_218[0x3B8-0x218];
+ /* 0x3B8 */ s32 unk_3B8;
+ /* 0x3BC */ UNK_TYPE1 unk_3BC[0x3C8-0x3BC];
} EnAn; // size = 0x3C8
#endif // Z_EN_AN_H